Class: Azure::Network::Mgmt::V2019_04_01::ConnectionMonitors

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2019-04-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-04-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-04-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.


477
478
479
480
# File 'lib/2019-04-01/generated/azure_mgmt_network/connection_monitors.rb', line 477

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.


516
517
518
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
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
# File 'lib/2019-04-01/generated/azure_mgmt_network/connection_monitors.rb', line 516

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_04_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_04_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_04_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.


497
498
499
# File 'lib/2019-04-01/generated/azure_mgmt_network/connection_monitors.rb', line 497

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


602
603
604
605
# File 'lib/2019-04-01/generated/azure_mgmt_network/connection_monitors.rb', line 602

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.


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
# File 'lib/2019-04-01/generated/azure_mgmt_network/connection_monitors.rb', line 637

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.


620
621
622
# File 'lib/2019-04-01/generated/azure_mgmt_network/connection_monitors.rb', line 620

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.


883
884
885
886
# File 'lib/2019-04-01/generated/azure_mgmt_network/connection_monitors.rb', line 883

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.


920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
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
980
981
982
983
984
# File 'lib/2019-04-01/generated/azure_mgmt_network/connection_monitors.rb', line 920

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_04_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_04_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.


902
903
904
# File 'lib/2019-04-01/generated/azure_mgmt_network/connection_monitors.rb', line 902

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


788
789
790
791
# File 'lib/2019-04-01/generated/azure_mgmt_network/connection_monitors.rb', line 788

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.


823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
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
# File 'lib/2019-04-01/generated/azure_mgmt_network/connection_monitors.rb', line 823

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.


806
807
808
# File 'lib/2019-04-01/generated/azure_mgmt_network/connection_monitors.rb', line 806

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


695
696
697
698
# File 'lib/2019-04-01/generated/azure_mgmt_network/connection_monitors.rb', line 695

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.


730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
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
# File 'lib/2019-04-01/generated/azure_mgmt_network/connection_monitors.rb', line 730

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.


713
714
715
# File 'lib/2019-04-01/generated/azure_mgmt_network/connection_monitors.rb', line 713

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-04-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-04-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_04_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-04-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-04-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-04-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-04-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_04_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-04-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.


374
375
376
377
# File 'lib/2019-04-01/generated/azure_mgmt_network/connection_monitors.rb', line 374

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.


407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
# File 'lib/2019-04-01/generated/azure_mgmt_network/connection_monitors.rb', line 407

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_04_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.


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

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.


326
327
328
329
# File 'lib/2019-04-01/generated/azure_mgmt_network/connection_monitors.rb', line 326

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


344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/2019-04-01/generated/azure_mgmt_network/connection_monitors.rb', line 344

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_04_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


279
280
281
282
# File 'lib/2019-04-01/generated/azure_mgmt_network/connection_monitors.rb', line 279

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


296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
# File 'lib/2019-04-01/generated/azure_mgmt_network/connection_monitors.rb', line 296

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


235
236
237
238
# File 'lib/2019-04-01/generated/azure_mgmt_network/connection_monitors.rb', line 235

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


252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/2019-04-01/generated/azure_mgmt_network/connection_monitors.rb', line 252

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