def _Exists(self):
    # Example output:
    # [
    #   {
    #     "localPort": 22,
    #     "name": "ssh",
    #     "port": 22,
    #     "protocol": "tcp",
    #     "virtualIPAddress": "104.43.224.13",
    #     "enableDirectServerReturn": false
    #   }
    # ]
    exists_cmd = [AZURE_PATH,
                  'vm',
                  'endpoint',
                  'list',
                  '--json',
                  self.vm_name]
    stdout, _, status = vm_util.IssueCommand(exists_cmd)
    if status or stdout == 'No VMs found':
      return False
    else:
      arr = json.loads(stdout)
      return any(ep['port'] == self.port and ep['protocol'] == self.protocol
                 for ep in arr)
Returns whether or not an endpoint exists.
dataset/ETHPy150Open GoogleCloudPlatform/PerfKitBenchmarker/perfkitbenchmarker/providers/azure/azure_network.py/_AzureEndpoint._Exists