Class: Azure::Network::Mgmt::V2019_11_01::ConnectionMonitors

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb

Overview

ConnectionMonitors

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ConnectionMonitors

Creates and initializes a new instance of the ConnectionMonitors class.

Parameters:

  • client

    service class for accessing basic functionality.


17
18
19
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientNetworkManagementClient (readonly)

Returns reference to the NetworkManagementClient.

Returns:


22
23
24
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 22

def client
  @client
end

Instance Method Details

#begin_create_or_update(resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers: nil) ⇒ ConnectionMonitorResult

Create or update a connection monitor.

Network Watcher. resource. create a connection monitor. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name of the connection monitor.

  • parameters (ConnectionMonitor)

    Parameters that define the operation to

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (ConnectionMonitorResult)

    operation results.


589
590
591
592
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 589

def begin_create_or_update(resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers:nil)
  response = begin_create_or_update_async(resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_create_or_update_async(resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Create or update a connection monitor.

Network Watcher. resource. create a connection monitor. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name of the connection monitor.

  • parameters (ConnectionMonitor)

    Parameters that define the operation to

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.


628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 628

def begin_create_or_update_async(resource_group_name, network_watcher_name, connection_monitor_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, 'connection_monitor_name is nil' if connection_monitor_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::V2019_11_01::Models::ConnectionMonitor.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}/connectionMonitors/{connectionMonitorName}'

  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,'connectionMonitorName' => connection_monitor_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 MsRest::HttpOperationError.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::V2019_11_01::Models::ConnectionMonitorResult.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::V2019_11_01::Models::ConnectionMonitorResult.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_create_or_update_with_http_info(resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Create or update a connection monitor.

Network Watcher. resource. create a connection monitor. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name of the connection monitor.

  • parameters (ConnectionMonitor)

    Parameters that define the operation to

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.


609
610
611
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 609

def begin_create_or_update_with_http_info(resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers:nil)
  begin_create_or_update_async(resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers:custom_headers).value!
end

#begin_delete(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers: nil) ⇒ Object

Deletes the specified connection monitor.

Network Watcher. resource. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name of the connection monitor.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that


714
715
716
717
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 714

def begin_delete(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
  response = begin_delete_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
  nil
end

#begin_delete_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers: nil) ⇒ Concurrent::Promise

Deletes the specified connection monitor.

Network Watcher. resource. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name of the connection monitor.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.


749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 749

def begin_delete_async(resource_group_name, network_watcher_name, connection_monitor_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, 'connection_monitor_name is nil' if connection_monitor_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}/connectionMonitors/{connectionMonitorName}'

  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,'connectionMonitorName' => connection_monitor_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 == 204 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.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, connection_monitor_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes the specified connection monitor.

Network Watcher. resource. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name of the connection monitor.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.


732
733
734
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 732

def begin_delete_with_http_info(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
  begin_delete_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
end

#begin_query(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers: nil) ⇒ ConnectionMonitorQueryResult

Query a snapshot of the most recent connection states.

Network Watcher. resource. monitor. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name given to the connection

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (ConnectionMonitorQueryResult)

    operation results.


995
996
997
998
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 995

def begin_query(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
  response = begin_query_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_query_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers: nil) ⇒ Concurrent::Promise

Query a snapshot of the most recent connection states.

Network Watcher. resource. monitor. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name given to the connection

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.


1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 1032

def begin_query_async(resource_group_name, network_watcher_name, connection_monitor_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, 'connection_monitor_name is nil' if connection_monitor_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}/connectionMonitors/{connectionMonitorName}/query'

  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,'connectionMonitorName' => connection_monitor_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(: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 MsRest::HttpOperationError.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::V2019_11_01::Models::ConnectionMonitorQueryResult.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::V2019_11_01::Models::ConnectionMonitorQueryResult.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_query_with_http_info(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Query a snapshot of the most recent connection states.

Network Watcher. resource. monitor. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name given to the connection

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.


1014
1015
1016
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 1014

def begin_query_with_http_info(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
  begin_query_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
end

#begin_start(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers: nil) ⇒ Object

Starts the specified connection monitor.

Network Watcher. resource. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name of the connection monitor.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that


900
901
902
903
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 900

def begin_start(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
  response = begin_start_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
  nil
end

#begin_start_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers: nil) ⇒ Concurrent::Promise

Starts the specified connection monitor.

Network Watcher. resource. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name of the connection monitor.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.


935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 935

def begin_start_async(resource_group_name, network_watcher_name, connection_monitor_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, 'connection_monitor_name is nil' if connection_monitor_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}/connectionMonitors/{connectionMonitorName}/start'

  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,'connectionMonitorName' => connection_monitor_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(: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 MsRest::HttpOperationError.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_start_with_http_info(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Starts the specified connection monitor.

Network Watcher. resource. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name of the connection monitor.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.


918
919
920
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 918

def begin_start_with_http_info(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
  begin_start_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
end

#begin_stop(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers: nil) ⇒ Object

Stops the specified connection monitor.

Network Watcher. resource. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name of the connection monitor.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that


807
808
809
810
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 807

def begin_stop(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
  response = begin_stop_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
  nil
end

#begin_stop_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers: nil) ⇒ Concurrent::Promise

Stops the specified connection monitor.

Network Watcher. resource. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name of the connection monitor.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.


842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 842

def begin_stop_async(resource_group_name, network_watcher_name, connection_monitor_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, 'connection_monitor_name is nil' if connection_monitor_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}/connectionMonitors/{connectionMonitorName}/stop'

  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,'connectionMonitorName' => connection_monitor_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(: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 MsRest::HttpOperationError.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_stop_with_http_info(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Stops the specified connection monitor.

Network Watcher. resource. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name of the connection monitor.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.


825
826
827
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 825

def begin_stop_with_http_info(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
  begin_stop_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
end

#create_or_update(resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers: nil) ⇒ ConnectionMonitorResult

Create or update a connection monitor.

Network Watcher. resource. create a connection monitor. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name of the connection monitor.

  • parameters (ConnectionMonitor)

    Parameters that define the operation to

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (ConnectionMonitorResult)

    operation results.


39
40
41
42
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 39

def create_or_update(resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers:nil)
  response = create_or_update_async(resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_async(resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Network Watcher. resource. create a connection monitor. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name of the connection monitor.

  • parameters (ConnectionMonitor)

    Parameters that define the operation to

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http


58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 58

def create_or_update_async(resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_create_or_update_async(resource_group_name, network_watcher_name, connection_monitor_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::V2019_11_01::Models::ConnectionMonitorResult.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

#delete(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers: nil) ⇒ Object

Deletes the specified connection monitor.

Network Watcher. resource. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name of the connection monitor.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that


191
192
193
194
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 191

def delete(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
  response = delete_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
  nil
end

#delete_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers: nil) ⇒ Concurrent::Promise

Network Watcher. resource. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name of the connection monitor.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http


208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 208

def delete_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
  # Send request
  promise = begin_delete_async(resource_group_name, network_watcher_name, connection_monitor_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, connection_monitor_name, custom_headers: nil) ⇒ ConnectionMonitorResult

Gets a connection monitor by name.

Network Watcher. resource. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name of the connection monitor.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (ConnectionMonitorResult)

    operation results.


89
90
91
92
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 89

def get(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
  response = get_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets a connection monitor by name.

Network Watcher. resource. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name of the connection monitor.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.


124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 124

def get_async(resource_group_name, network_watcher_name, connection_monitor_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, 'connection_monitor_name is nil' if connection_monitor_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}/connectionMonitors/{connectionMonitorName}'

  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,'connectionMonitorName' => connection_monitor_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 MsRest::HttpOperationError.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::V2019_11_01::Models::ConnectionMonitorResult.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_with_http_info(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a connection monitor by name.

Network Watcher. resource. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name of the connection monitor.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.


107
108
109
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 107

def get_with_http_info(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
  get_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
end

#list(resource_group_name, network_watcher_name, custom_headers: nil) ⇒ ConnectionMonitorListResult

Lists all connection monitors for the specified Network Watcher.

Network Watcher. resource. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (ConnectionMonitorListResult)

    operation results.


486
487
488
489
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 486

def list(resource_group_name, network_watcher_name, custom_headers:nil)
  response = list_async(resource_group_name, network_watcher_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_async(resource_group_name, network_watcher_name, custom_headers: nil) ⇒ Concurrent::Promise

Lists all connection monitors for the specified Network Watcher.

Network Watcher. resource. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.


519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 519

def list_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}/connectionMonitors'

  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 MsRest::HttpOperationError.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::V2019_11_01::Models::ConnectionMonitorListResult.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, network_watcher_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all connection monitors for the specified Network Watcher.

Network Watcher. resource. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.


503
504
505
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 503

def list_with_http_info(resource_group_name, network_watcher_name, custom_headers:nil)
  list_async(resource_group_name, network_watcher_name, custom_headers:custom_headers).value!
end

#query(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers: nil) ⇒ ConnectionMonitorQueryResult

Query a snapshot of the most recent connection states.

Network Watcher. resource. monitor. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name given to the connection

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (ConnectionMonitorQueryResult)

    operation results.


438
439
440
441
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 438

def query(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
  response = query_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#query_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers: nil) ⇒ Concurrent::Promise

Network Watcher. resource. monitor. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name given to the connection

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http


456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 456

def query_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
  # Send request
  promise = begin_query_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers)

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

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

  promise
end

#start(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers: nil) ⇒ Object

Starts the specified connection monitor.

Network Watcher. resource. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name of the connection monitor.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that


391
392
393
394
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 391

def start(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
  response = start_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
  nil
end

#start_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers: nil) ⇒ Concurrent::Promise

Network Watcher. resource. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name of the connection monitor.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http


408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 408

def start_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
  # Send request
  promise = begin_start_async(resource_group_name, network_watcher_name, connection_monitor_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, FinalStateVia::LOCATION)
  end

  promise
end

#stop(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers: nil) ⇒ Object

Stops the specified connection monitor.

Network Watcher. resource. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name of the connection monitor.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that


347
348
349
350
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 347

def stop(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
  response = stop_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
  nil
end

#stop_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers: nil) ⇒ Concurrent::Promise

Network Watcher. resource. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • network_watcher_name (String)

    The name of the Network Watcher

  • connection_monitor_name (String)

    The name of the connection monitor.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http


364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 364

def stop_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
  # Send request
  promise = begin_stop_async(resource_group_name, network_watcher_name, connection_monitor_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, FinalStateVia::LOCATION)
  end

  promise
end

#update_tags(resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers: nil) ⇒ ConnectionMonitorResult

Update tags of the specified connection monitor.

monitor tags. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • network_watcher_name (String)

    The name of the network watcher.

  • connection_monitor_name (String)

    The name of the connection monitor.

  • parameters (TagsObject)

    Parameters supplied to update connection

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (ConnectionMonitorResult)

    operation results.


237
238
239
240
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 237

def update_tags(resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers:nil)
  response = update_tags_async(resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#update_tags_async(resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Update tags of the specified connection monitor.

monitor tags. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • network_watcher_name (String)

    The name of the network watcher.

  • connection_monitor_name (String)

    The name of the connection monitor.

  • parameters (TagsObject)

    Parameters supplied to update connection

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.


272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 272

def update_tags_async(resource_group_name, network_watcher_name, connection_monitor_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, 'connection_monitor_name is nil' if connection_monitor_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::V2019_11_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}/connectionMonitors/{connectionMonitorName}'

  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,'connectionMonitorName' => connection_monitor_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 MsRest::HttpOperationError.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::V2019_11_01::Models::ConnectionMonitorResult.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, connection_monitor_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Update tags of the specified connection monitor.

monitor tags. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • network_watcher_name (String)

    The name of the network watcher.

  • connection_monitor_name (String)

    The name of the connection monitor.

  • parameters (TagsObject)

    Parameters supplied to update connection

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.


255
256
257
# File 'lib/2019-11-01/generated/azure_mgmt_network/connection_monitors.rb', line 255

def update_tags_with_http_info(resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers:nil)
  update_tags_async(resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers:custom_headers).value!
end