class Azure::Network::Mgmt::V2018_01_01::NetworkWatchers

Network Client

Attributes

client[R]

@return [NetworkManagementClient] reference to the NetworkManagementClient

Public Class Methods

new(client) click to toggle source

Creates and initializes a new instance of the NetworkWatchers class. @param client service class for accessing basic functionality.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 17
def initialize(client)
  @client = client
end

Public Instance Methods

begin_check_connectivity(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Verifies the possibility of establishing a direct TCP connection from a virtual machine to a given endpoint including another VM or an arbitrary remote server.

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [ConnectivityParameters] Parameters that determine how the connectivity check will be performed. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [ConnectivityInformation] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 2104
def begin_check_connectivity(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  response = begin_check_connectivity_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
begin_check_connectivity_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Verifies the possibility of establishing a direct TCP connection from a virtual machine to a given endpoint including another VM or an arbitrary remote server.

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [ConnectivityParameters] Parameters that determine how the connectivity check will be performed. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 2145
def begin_check_connectivity_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::Network::Mgmt::V2018_01_01::Models::ConnectivityParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectivityCheck'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'networkWatcherName' => network_watcher_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::ConnectivityInformation.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 202
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::ConnectivityInformation.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
begin_check_connectivity_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Verifies the possibility of establishing a direct TCP connection from a virtual machine to a given endpoint including another VM or an arbitrary remote server.

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [ConnectivityParameters] Parameters that determine how the connectivity check will be performed. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 2125
def begin_check_connectivity_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  begin_check_connectivity_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
end
begin_delete(resource_group_name, network_watcher_name, custom_headers:nil) click to toggle source

Deletes the specified network watcher resource.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1164
def begin_delete(resource_group_name, network_watcher_name, custom_headers:nil)
  response = begin_delete_async(resource_group_name, network_watcher_name, custom_headers:custom_headers).value!
  nil
end
begin_delete_async(resource_group_name, network_watcher_name, custom_headers:nil) click to toggle source

Deletes the specified network watcher resource.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1193
def begin_delete_async(resource_group_name, network_watcher_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'networkWatcherName' => network_watcher_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 202 || status_code == 204
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end
begin_delete_with_http_info(resource_group_name, network_watcher_name, custom_headers:nil) click to toggle source

Deletes the specified network watcher resource.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1179
def begin_delete_with_http_info(resource_group_name, network_watcher_name, custom_headers:nil)
  begin_delete_async(resource_group_name, network_watcher_name, custom_headers:custom_headers).value!
end
begin_get_azure_reachability_report(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Gets the relative latency score for internet service providers from a specified location to Azure regions.

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [AzureReachabilityReportParameters] Parameters that determine Azure reachability report configuration. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [AzureReachabilityReport] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 2233
def begin_get_azure_reachability_report(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  response = begin_get_azure_reachability_report_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
begin_get_azure_reachability_report_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Gets the relative latency score for internet service providers from a specified location to Azure regions.

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [AzureReachabilityReportParameters] Parameters that determine Azure reachability report configuration. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 2272
def begin_get_azure_reachability_report_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::Network::Mgmt::V2018_01_01::Models::AzureReachabilityReportParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/azureReachabilityReport'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'networkWatcherName' => network_watcher_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::AzureReachabilityReport.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 202
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::AzureReachabilityReport.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
begin_get_azure_reachability_report_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Gets the relative latency score for internet service providers from a specified location to Azure regions.

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [AzureReachabilityReportParameters] Parameters that determine Azure reachability report configuration. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 2253
def begin_get_azure_reachability_report_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  begin_get_azure_reachability_report_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
end
begin_get_flow_log_status(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Queries status of flow log and traffic analytics (optional) on a specified resource.

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [FlowLogStatusParameters] Parameters that define a resource to query flow log and traffic analytics (optional) status. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [FlowLogInformation] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1976
def begin_get_flow_log_status(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  response = begin_get_flow_log_status_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
begin_get_flow_log_status_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Queries status of flow log and traffic analytics (optional) on a specified resource.

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [FlowLogStatusParameters] Parameters that define a resource to query flow log and traffic analytics (optional) status. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 2015
def begin_get_flow_log_status_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::Network::Mgmt::V2018_01_01::Models::FlowLogStatusParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryFlowLogStatus'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'networkWatcherName' => network_watcher_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::FlowLogInformation.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 202
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::FlowLogInformation.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
begin_get_flow_log_status_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Queries status of flow log and traffic analytics (optional) on a specified resource.

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [FlowLogStatusParameters] Parameters that define a resource to query flow log and traffic analytics (optional) status. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1996
def begin_get_flow_log_status_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  begin_get_flow_log_status_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
end
begin_get_next_hop(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Gets the next hop from the specified VM.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [NextHopParameters] Parameters that define the source and destination endpoint. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [NextHopResult] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1371
def begin_get_next_hop(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  response = begin_get_next_hop_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
begin_get_next_hop_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Gets the next hop from the specified VM.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [NextHopParameters] Parameters that define the source and destination endpoint. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1404
def begin_get_next_hop_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::Network::Mgmt::V2018_01_01::Models::NextHopParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/nextHop'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'networkWatcherName' => network_watcher_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::NextHopResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 202
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::NextHopResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
begin_get_next_hop_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Gets the next hop from the specified VM.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [NextHopParameters] Parameters that define the source and destination endpoint. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1388
def begin_get_next_hop_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  begin_get_next_hop_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
end
begin_get_troubleshooting(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Initiate troubleshooting on a specified resource

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [TroubleshootingParameters] Parameters that define the resource to troubleshoot. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [TroubleshootingResult] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1608
def begin_get_troubleshooting(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  response = begin_get_troubleshooting_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
begin_get_troubleshooting_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Initiate troubleshooting on a specified resource

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [TroubleshootingParameters] Parameters that define the resource to troubleshoot. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1643
def begin_get_troubleshooting_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::Network::Mgmt::V2018_01_01::Models::TroubleshootingParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/troubleshoot'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'networkWatcherName' => network_watcher_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::TroubleshootingResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 202
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::TroubleshootingResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
begin_get_troubleshooting_result(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Get the last completed troubleshooting result on a specified resource

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [QueryTroubleshootingParameters] Parameters that define the resource to query the troubleshooting result. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [TroubleshootingResult] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1729
def begin_get_troubleshooting_result(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  response = begin_get_troubleshooting_result_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
begin_get_troubleshooting_result_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Get the last completed troubleshooting result on a specified resource

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [QueryTroubleshootingParameters] Parameters that define the resource to query the troubleshooting result. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1764
def begin_get_troubleshooting_result_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::Network::Mgmt::V2018_01_01::Models::QueryTroubleshootingParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryTroubleshootResult'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'networkWatcherName' => network_watcher_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::TroubleshootingResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 202
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::TroubleshootingResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
begin_get_troubleshooting_result_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Get the last completed troubleshooting result on a specified resource

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [QueryTroubleshootingParameters] Parameters that define the resource to query the troubleshooting result. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1747
def begin_get_troubleshooting_result_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  begin_get_troubleshooting_result_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
end
begin_get_troubleshooting_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Initiate troubleshooting on a specified resource

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [TroubleshootingParameters] Parameters that define the resource to troubleshoot. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1626
def begin_get_troubleshooting_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  begin_get_troubleshooting_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
end
begin_get_vmsecurity_rules(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Gets the configured and effective security group rules on the specified VM.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [SecurityGroupViewParameters] Parameters that define the VM to check security groups for. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SecurityGroupViewResult] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1489
def begin_get_vmsecurity_rules(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  response = begin_get_vmsecurity_rules_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
begin_get_vmsecurity_rules_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Gets the configured and effective security group rules on the specified VM.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [SecurityGroupViewParameters] Parameters that define the VM to check security groups for. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1522
def begin_get_vmsecurity_rules_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::Network::Mgmt::V2018_01_01::Models::SecurityGroupViewParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/securityGroupView'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'networkWatcherName' => network_watcher_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::SecurityGroupViewResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 202
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::SecurityGroupViewResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
begin_get_vmsecurity_rules_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Gets the configured and effective security group rules on the specified VM.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [SecurityGroupViewParameters] Parameters that define the VM to check security groups for. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1506
def begin_get_vmsecurity_rules_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  begin_get_vmsecurity_rules_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
end
begin_list_available_providers(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Lists all available internet service providers for a specified Azure region.

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [AvailableProvidersListParameters] Parameters that scope the list of available providers. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [AvailableProvidersList] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 2359
def begin_list_available_providers(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  response = begin_list_available_providers_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
begin_list_available_providers_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Lists all available internet service providers for a specified Azure region.

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [AvailableProvidersListParameters] Parameters that scope the list of available providers. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 2396
def begin_list_available_providers_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::Network::Mgmt::V2018_01_01::Models::AvailableProvidersListParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/availableProvidersList'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'networkWatcherName' => network_watcher_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::AvailableProvidersList.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 202
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::AvailableProvidersList.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
begin_list_available_providers_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Lists all available internet service providers for a specified Azure region.

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [AvailableProvidersListParameters] Parameters that scope the list of available providers. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 2378
def begin_list_available_providers_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  begin_list_available_providers_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
end
begin_set_flow_log_configuration(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Configures flow log and traffic analytics (optional) on a specified resource.

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [FlowLogInformation] Parameters that define the configuration of flow log. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [FlowLogInformation] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1851
def begin_set_flow_log_configuration(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  response = begin_set_flow_log_configuration_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
begin_set_flow_log_configuration_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Configures flow log and traffic analytics (optional) on a specified resource.

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [FlowLogInformation] Parameters that define the configuration of flow log. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1888
def begin_set_flow_log_configuration_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::Network::Mgmt::V2018_01_01::Models::FlowLogInformation.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/configureFlowLog'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'networkWatcherName' => network_watcher_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::FlowLogInformation.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 202
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::FlowLogInformation.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
begin_set_flow_log_configuration_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Configures flow log and traffic analytics (optional) on a specified resource.

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [FlowLogInformation] Parameters that define the configuration of flow log. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1870
def begin_set_flow_log_configuration_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  begin_set_flow_log_configuration_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
end
begin_verify_ipflow(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Verify IP flow from the specified VM to a location given the currently configured NSG rules.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [VerificationIPFlowParameters] Parameters that define the IP flow to be verified. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [VerificationIPFlowResult] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1251
def begin_verify_ipflow(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  response = begin_verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
begin_verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Verify IP flow from the specified VM to a location given the currently configured NSG rules.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [VerificationIPFlowParameters] Parameters that define the IP flow to be verified. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1286
def begin_verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::Network::Mgmt::V2018_01_01::Models::VerificationIPFlowParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/ipFlowVerify'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'networkWatcherName' => network_watcher_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::VerificationIPFlowResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 202
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::VerificationIPFlowResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
begin_verify_ipflow_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Verify IP flow from the specified VM to a location given the currently configured NSG rules.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [VerificationIPFlowParameters] Parameters that define the IP flow to be verified. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1269
def begin_verify_ipflow_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  begin_verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
end
check_connectivity(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Verifies the possibility of establishing a direct TCP connection from a virtual machine to a given endpoint including another VM or an arbitrary remote server.

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [ConnectivityParameters] Parameters that determine how the connectivity check will be performed. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [ConnectivityInformation] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1018
def check_connectivity(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  response = check_connectivity_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
check_connectivity_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [ConnectivityParameters] Parameters that determine how the connectivity check will be performed. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1036
def check_connectivity_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_check_connectivity_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::ConnectivityInformation.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end
create_or_update(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Creates or updates a network watcher in the specified resource group.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [NetworkWatcher] Parameters that define the network watcher resource. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [NetworkWatcher] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 36
def create_or_update(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  response = create_or_update_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
create_or_update_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Creates or updates a network watcher in the specified resource group.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [NetworkWatcher] Parameters that define the network watcher resource. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 69
def create_or_update_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::Network::Mgmt::V2018_01_01::Models::NetworkWatcher.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'networkWatcherName' => network_watcher_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 201
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::NetworkWatcher.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::NetworkWatcher.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
create_or_update_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Creates or updates a network watcher in the specified resource group.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [NetworkWatcher] Parameters that define the network watcher resource. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 53
def create_or_update_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  create_or_update_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
end
delete(resource_group_name, network_watcher_name, custom_headers:nil) click to toggle source

Deletes the specified network watcher resource.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 244
def delete(resource_group_name, network_watcher_name, custom_headers:nil)
  response = delete_async(resource_group_name, network_watcher_name, custom_headers:custom_headers).value!
  nil
end
delete_async(resource_group_name, network_watcher_name, custom_headers:nil) click to toggle source

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 258
def delete_async(resource_group_name, network_watcher_name, custom_headers:nil)
  # Send request
  promise = begin_delete_async(resource_group_name, network_watcher_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end
get(resource_group_name, network_watcher_name, custom_headers:nil) click to toggle source

Gets the specified network watcher by resource group.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [NetworkWatcher] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 152
def get(resource_group_name, network_watcher_name, custom_headers:nil)
  response = get_async(resource_group_name, network_watcher_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_async(resource_group_name, network_watcher_name, custom_headers:nil) click to toggle source

Gets the specified network watcher by resource group.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 181
def get_async(resource_group_name, network_watcher_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'networkWatcherName' => network_watcher_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::NetworkWatcher.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
get_azure_reachability_report(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Gets the relative latency score for internet service providers from a specified location to Azure regions.

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [AzureReachabilityReportParameters] Parameters that determine Azure reachability report configuration. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [AzureReachabilityReport] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1069
def get_azure_reachability_report(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  response = get_azure_reachability_report_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_azure_reachability_report_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [AzureReachabilityReportParameters] Parameters that determine Azure reachability report configuration. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1087
def get_azure_reachability_report_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_get_azure_reachability_report_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::AzureReachabilityReport.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end
get_flow_log_status(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Queries status of flow log and traffic analytics (optional) on a specified resource.

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [FlowLogStatusParameters] Parameters that define a resource to query flow log and traffic analytics (optional) status. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [FlowLogInformation] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 966
def get_flow_log_status(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  response = get_flow_log_status_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_flow_log_status_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [FlowLogStatusParameters] Parameters that define a resource to query flow log and traffic analytics (optional) status. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 984
def get_flow_log_status_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_get_flow_log_status_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::FlowLogInformation.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end
get_next_hop(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Gets the next hop from the specified VM.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [NextHopParameters] Parameters that define the source and destination endpoint. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [NextHopResult] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 725
def get_next_hop(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  response = get_next_hop_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_next_hop_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [NextHopParameters] Parameters that define the source and destination endpoint. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 741
def get_next_hop_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_get_next_hop_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::NextHopResult.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end
get_topology(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Gets the current network topology by resource group.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [TopologyParameters] Parameters that define the representation of topology. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Topology] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 570
def get_topology(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  response = get_topology_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_topology_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Gets the current network topology by resource group.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [TopologyParameters] Parameters that define the representation of topology. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 603
def get_topology_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::Network::Mgmt::V2018_01_01::Models::TopologyParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/topology'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'networkWatcherName' => network_watcher_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::Topology.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
get_topology_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Gets the current network topology by resource group.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [TopologyParameters] Parameters that define the representation of topology. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 587
def get_topology_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  get_topology_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
end
get_troubleshooting(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Initiate troubleshooting on a specified resource

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [TroubleshootingParameters] Parameters that define the resource to troubleshoot. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [TroubleshootingResult] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 818
def get_troubleshooting(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  response = get_troubleshooting_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_troubleshooting_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [TroubleshootingParameters] Parameters that define the resource to troubleshoot. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 835
def get_troubleshooting_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_get_troubleshooting_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::TroubleshootingResult.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end
get_troubleshooting_result(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Get the last completed troubleshooting result on a specified resource

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [QueryTroubleshootingParameters] Parameters that define the resource to query the troubleshooting result. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [TroubleshootingResult] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 866
def get_troubleshooting_result(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  response = get_troubleshooting_result_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_troubleshooting_result_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [QueryTroubleshootingParameters] Parameters that define the resource to query the troubleshooting result. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 883
def get_troubleshooting_result_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_get_troubleshooting_result_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::TroubleshootingResult.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end
get_vmsecurity_rules(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Gets the configured and effective security group rules on the specified VM.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [SecurityGroupViewParameters] Parameters that define the VM to check security groups for. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SecurityGroupViewResult] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 771
def get_vmsecurity_rules(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  response = get_vmsecurity_rules_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_vmsecurity_rules_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [SecurityGroupViewParameters] Parameters that define the VM to check security groups for. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 787
def get_vmsecurity_rules_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_get_vmsecurity_rules_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::SecurityGroupViewResult.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end
get_with_http_info(resource_group_name, network_watcher_name, custom_headers:nil) click to toggle source

Gets the specified network watcher by resource group.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 167
def get_with_http_info(resource_group_name, network_watcher_name, custom_headers:nil)
  get_async(resource_group_name, network_watcher_name, custom_headers:custom_headers).value!
end
list(resource_group_name, custom_headers:nil) click to toggle source

Gets all network watchers by resource group.

@param resource_group_name [String] The name of the resource group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [NetworkWatcherListResult] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 391
def list(resource_group_name, custom_headers:nil)
  response = list_async(resource_group_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_all(custom_headers:nil) click to toggle source

Gets all network watchers by subscription.

@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [NetworkWatcherListResult] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 480
def list_all(custom_headers:nil)
  response = list_all_async(custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_all_async(custom_headers:nil) click to toggle source

Gets all network watchers by subscription.

@param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 505
def list_all_async(custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Network/networkWatchers'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::NetworkWatcherListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
list_all_with_http_info(custom_headers:nil) click to toggle source

Gets all network watchers by subscription.

@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 493
def list_all_with_http_info(custom_headers:nil)
  list_all_async(custom_headers:custom_headers).value!
end
list_async(resource_group_name, custom_headers:nil) click to toggle source

Gets all network watchers by resource group.

@param resource_group_name [String] The name of the resource group. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 418
def list_async(resource_group_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::NetworkWatcherListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
list_available_providers(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Lists all available internet service providers for a specified Azure region.

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [AvailableProvidersListParameters] Parameters that scope the list of available providers. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [AvailableProvidersList] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1119
def list_available_providers(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  response = list_available_providers_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_available_providers_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [AvailableProvidersListParameters] Parameters that scope the list of available providers. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 1137
def list_available_providers_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_list_available_providers_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::AvailableProvidersList.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end
list_with_http_info(resource_group_name, custom_headers:nil) click to toggle source

Gets all network watchers by resource group.

@param resource_group_name [String] The name of the resource group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 405
def list_with_http_info(resource_group_name, custom_headers:nil)
  list_async(resource_group_name, custom_headers:custom_headers).value!
end
set_flow_log_configuration(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Configures flow log and traffic analytics (optional) on a specified resource.

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [FlowLogInformation] Parameters that define the configuration of flow log. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [FlowLogInformation] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 915
def set_flow_log_configuration(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  response = set_flow_log_configuration_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
set_flow_log_configuration_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

@param resource_group_name [String] The name of the network watcher resource group. @param network_watcher_name [String] The name of the network watcher resource. @param parameters [FlowLogInformation] Parameters that define the configuration of flow log. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 933
def set_flow_log_configuration_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_set_flow_log_configuration_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::FlowLogInformation.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end
update_tags(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Updates a network watcher tags.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [TagsObject] Parameters supplied to update network watcher tags. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [NetworkWatcher] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 286
def update_tags(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  response = update_tags_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
update_tags_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Updates a network watcher tags.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [TagsObject] Parameters supplied to update network watcher tags. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 319
def update_tags_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::Network::Mgmt::V2018_01_01::Models::TagsObject.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'networkWatcherName' => network_watcher_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:patch, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::NetworkWatcher.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
update_tags_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Updates a network watcher tags.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [TagsObject] Parameters supplied to update network watcher tags. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 303
def update_tags_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  update_tags_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
end
verify_ipflow(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Verify IP flow from the specified VM to a location given the currently configured NSG rules.

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [VerificationIPFlowParameters] Parameters that define the IP flow to be verified. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [VerificationIPFlowResult] operation results.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 679
def verify_ipflow(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  response = verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

@param resource_group_name [String] The name of the resource group. @param network_watcher_name [String] The name of the network watcher. @param parameters [VerificationIPFlowParameters] Parameters that define the IP flow to be verified. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2018-01-01/generated/azure_mgmt_network/network_watchers.rb, line 695
def verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::VerificationIPFlowResult.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end