class Azure::Network::Mgmt::V2016_09_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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 16
def initialize(client)
  @client = client
end

Public Instance Methods

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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 901
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 930
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 916
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_flow_log_status(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Queries status of flow log 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 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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 1712
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 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 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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 1749
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::V2016_09_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::V2016_09_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::V2016_09_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 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 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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 1731
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 1108
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 1141
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::V2016_09_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::V2016_09_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::V2016_09_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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 1125
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 1345
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 1380
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::V2016_09_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::V2016_09_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::V2016_09_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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 1466
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 1501
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::V2016_09_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::V2016_09_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::V2016_09_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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 1484
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 1363
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 1226
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 1259
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::V2016_09_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::V2016_09_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::V2016_09_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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 1243
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_set_flow_log_configuration(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Configures flow log 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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 1588
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 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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 1625
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::V2016_09_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::V2016_09_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::V2016_09_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 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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 1607
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 988
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 1023
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::V2016_09_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::V2016_09_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::V2016_09_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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 1006
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
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 35
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 68
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::V2016_09_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::V2016_09_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::V2016_09_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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 52
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 243
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 257
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 151
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 180
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::V2016_09_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_flow_log_status(resource_group_name, network_watcher_name, parameters, custom_headers:nil) click to toggle source

Queries status of flow log 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 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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 856
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 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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 874
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::V2016_09_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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 616
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 632
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::V2016_09_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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 461
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 494
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::V2016_09_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::V2016_09_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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 478
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 709
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 726
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::V2016_09_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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 757
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 774
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::V2016_09_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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 662
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 678
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::V2016_09_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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 166
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 282
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 371
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 396
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::V2016_09_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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 384
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 309
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::V2016_09_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_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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 296
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 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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 806
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 824
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::V2016_09_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
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 570
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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb, line 586
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::V2016_09_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