Class: Azure::Network::Mgmt::V2016_09_01::NetworkWatchers

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb

Overview

Network Client

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ NetworkWatchers

Creates and initializes a new instance of the NetworkWatchers class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.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/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 22

def client
  @client
end

Instance Method Details

#begin_delete(resource_group_name, network_watcher_name, custom_headers = nil) ⇒ Object

Deletes the specified network watcher resource.

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.

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

    A hash of custom headers that



891
892
893
894
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 891

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

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

Deletes the specified network watcher resource.

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.

  • 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
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 920

def begin_delete_async(resource_group_name, network_watcher_name, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#begin_delete_with_http_info(resource_group_name, network_watcher_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes the specified network watcher resource.

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.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



906
907
908
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 906

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

#begin_get_flow_log_status(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ FlowLogInformation

Queries status of flow log on a specified resource.

group. resource. to query flow log status. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the network watcher resource

  • network_watcher_name (String)

    The name of the network watcher

  • parameters (FlowLogStatusParameters)

    Parameters that define a resource

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

    A hash of custom headers that

Returns:

  • (FlowLogInformation)

    operation results.



1693
1694
1695
1696
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 1693

def begin_get_flow_log_status(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  response = begin_get_flow_log_status_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#begin_get_flow_log_status_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Queries status of flow log on a specified resource.

group. resource. to query flow log status. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the network watcher resource

  • network_watcher_name (String)

    The name of the network watcher

  • parameters (FlowLogStatusParameters)

    Parameters that define a resource

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 1730

def begin_get_flow_log_status_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

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

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

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

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#begin_get_flow_log_status_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Queries status of flow log on a specified resource.

group. resource. to query flow log status. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the network watcher resource

  • network_watcher_name (String)

    The name of the network watcher

  • parameters (FlowLogStatusParameters)

    Parameters that define a resource

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1712
1713
1714
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 1712

def begin_get_flow_log_status_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  begin_get_flow_log_status_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
end

#begin_get_next_hop(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ NextHopResult

Gets the next hop from the specified VM.

destination endpoint. 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.

  • parameters (NextHopParameters)

    Parameters that define the source and

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

    A hash of custom headers that

Returns:

  • (NextHopResult)

    operation results.



1094
1095
1096
1097
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 1094

def begin_get_next_hop(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  response = begin_get_next_hop_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#begin_get_next_hop_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Gets the next hop from the specified VM.

destination endpoint. 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.

  • parameters (NextHopParameters)

    Parameters that define the source and

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 1127

def begin_get_next_hop_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

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

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

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

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#begin_get_next_hop_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the next hop from the specified VM.

destination endpoint. 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.

  • parameters (NextHopParameters)

    Parameters that define the source and

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1111
1112
1113
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 1111

def begin_get_next_hop_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  begin_get_next_hop_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
end

#begin_get_troubleshooting(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ TroubleshootingResult

Initiate troubleshooting on a specified resource

resource. resource to troubleshoot. 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

  • parameters (TroubleshootingParameters)

    Parameters that define the

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

    A hash of custom headers that

Returns:

  • (TroubleshootingResult)

    operation results.



1329
1330
1331
1332
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 1329

def begin_get_troubleshooting(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  response = begin_get_troubleshooting_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#begin_get_troubleshooting_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Initiate troubleshooting on a specified resource

resource. resource to troubleshoot. 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

  • parameters (TroubleshootingParameters)

    Parameters that define the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 1364

def begin_get_troubleshooting_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

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

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

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

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#begin_get_troubleshooting_result(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ TroubleshootingResult

Get the last completed troubleshooting result on a specified resource

resource. resource to query the troubleshooting result. 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

  • parameters (QueryTroubleshootingParameters)

    Parameters that define the

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

    A hash of custom headers that

Returns:

  • (TroubleshootingResult)

    operation results.



1449
1450
1451
1452
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 1449

def begin_get_troubleshooting_result(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  response = begin_get_troubleshooting_result_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#begin_get_troubleshooting_result_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Get the last completed troubleshooting result on a specified resource

resource. resource to query the troubleshooting result. 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

  • parameters (QueryTroubleshootingParameters)

    Parameters that define the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 1484

def begin_get_troubleshooting_result_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

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

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

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

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#begin_get_troubleshooting_result_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get the last completed troubleshooting result on a specified resource

resource. resource to query the troubleshooting result. 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

  • parameters (QueryTroubleshootingParameters)

    Parameters that define the

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1467
1468
1469
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 1467

def begin_get_troubleshooting_result_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  begin_get_troubleshooting_result_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
end

#begin_get_troubleshooting_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Initiate troubleshooting on a specified resource

resource. resource to troubleshoot. 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

  • parameters (TroubleshootingParameters)

    Parameters that define the

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1347
1348
1349
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 1347

def begin_get_troubleshooting_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  begin_get_troubleshooting_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
end

#begin_get_vmsecurity_rules(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ SecurityGroupViewResult

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

to check security groups for. 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.

  • parameters (SecurityGroupViewParameters)

    Parameters that define the VM

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

    A hash of custom headers that

Returns:

  • (SecurityGroupViewResult)

    operation results.



1211
1212
1213
1214
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 1211

def begin_get_vmsecurity_rules(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  response = begin_get_vmsecurity_rules_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#begin_get_vmsecurity_rules_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

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

to check security groups for. 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.

  • parameters (SecurityGroupViewParameters)

    Parameters that define the VM

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 1244

def begin_get_vmsecurity_rules_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

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

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

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

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#begin_get_vmsecurity_rules_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

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

to check security groups for. 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.

  • parameters (SecurityGroupViewParameters)

    Parameters that define the VM

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1228
1229
1230
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 1228

def begin_get_vmsecurity_rules_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  begin_get_vmsecurity_rules_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
end

#begin_set_flow_log_configuration(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ FlowLogInformation

Configures flow log on a specified resource.

group. resource. configuration of flow log. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the network watcher resource

  • network_watcher_name (String)

    The name of the network watcher

  • parameters (FlowLogInformation)

    Parameters that define the

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

    A hash of custom headers that

Returns:

  • (FlowLogInformation)

    operation results.



1570
1571
1572
1573
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 1570

def begin_set_flow_log_configuration(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  response = begin_set_flow_log_configuration_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#begin_set_flow_log_configuration_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Configures flow log on a specified resource.

group. resource. configuration of flow log. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the network watcher resource

  • network_watcher_name (String)

    The name of the network watcher

  • parameters (FlowLogInformation)

    Parameters that define the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 1607

def begin_set_flow_log_configuration_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

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

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

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

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#begin_set_flow_log_configuration_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Configures flow log on a specified resource.

group. resource. configuration of flow log. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the network watcher resource

  • network_watcher_name (String)

    The name of the network watcher

  • parameters (FlowLogInformation)

    Parameters that define the

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1589
1590
1591
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 1589

def begin_set_flow_log_configuration_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  begin_set_flow_log_configuration_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
end

#begin_verify_ipflow(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ VerificationIPFlowResult

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

IP flow to be verified. 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.

  • parameters (VerificationIPFlowParameters)

    Parameters that define the

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

    A hash of custom headers that

Returns:

  • (VerificationIPFlowResult)

    operation results.



975
976
977
978
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 975

def begin_verify_ipflow(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  response = begin_verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#begin_verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

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

IP flow to be verified. 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.

  • parameters (VerificationIPFlowParameters)

    Parameters that define the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
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
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 1010

def begin_verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

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

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

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

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#begin_verify_ipflow_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

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

IP flow to be verified. 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.

  • parameters (VerificationIPFlowParameters)

    Parameters that define the

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



993
994
995
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 993

def begin_verify_ipflow_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  begin_verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
end

#create_or_update(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ NetworkWatcher

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

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

  • parameters (NetworkWatcher)

    Parameters that define the network watcher

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

    A hash of custom headers that

Returns:

  • (NetworkWatcher)

    operation results.



36
37
38
39
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 36

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

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

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

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

  • parameters (NetworkWatcher)

    Parameters that define 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.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 69

def create_or_update_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

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

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

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

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#create_or_update_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

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

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

  • parameters (NetworkWatcher)

    Parameters that define the network watcher

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



53
54
55
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 53

def create_or_update_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  create_or_update_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
end

#delete(resource_group_name, network_watcher_name, custom_headers = nil) ⇒ Object

Deletes the specified network watcher resource.

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.

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

    A hash of custom headers that



240
241
242
243
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 240

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

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

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • 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:

  • (Concurrent::Promise)

    promise which provides async access to http



254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 254

def delete_async(resource_group_name, network_watcher_name, custom_headers = nil)
  # Send request
  promise = begin_delete_async(resource_group_name, network_watcher_name, custom_headers)

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

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

  promise
end

#get(resource_group_name, network_watcher_name, custom_headers = nil) ⇒ NetworkWatcher

Gets the specified network watcher by resource group.

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.

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

    A hash of custom headers that

Returns:

  • (NetworkWatcher)

    operation results.



151
152
153
154
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 151

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

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

Gets the specified network watcher by resource group.

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.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 180

def get_async(resource_group_name, network_watcher_name, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#get_flow_log_status(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ FlowLogInformation

Queries status of flow log on a specified resource.

group. resource. to query flow log status. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the network watcher resource

  • network_watcher_name (String)

    The name of the network watcher

  • parameters (FlowLogStatusParameters)

    Parameters that define a resource

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

    A hash of custom headers that

Returns:

  • (FlowLogInformation)

    operation results.



846
847
848
849
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 846

def get_flow_log_status(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  response = get_flow_log_status_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#get_flow_log_status_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

group. resource. to query flow log status. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the network watcher resource

  • network_watcher_name (String)

    The name of the network watcher

  • parameters (FlowLogStatusParameters)

    Parameters that define a resource

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 864

def get_flow_log_status_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  # Send request
  promise = begin_get_flow_log_status_async(resource_group_name, network_watcher_name, parameters, custom_headers)

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

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

  promise
end

#get_next_hop(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ NextHopResult

Gets the next hop from the specified VM.

destination endpoint. 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.

  • parameters (NextHopParameters)

    Parameters that define the source and

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

    A hash of custom headers that

Returns:

  • (NextHopResult)

    operation results.



606
607
608
609
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 606

def get_next_hop(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  response = get_next_hop_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#get_next_hop_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

destination endpoint. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • network_watcher_name (String)

    The name of the network watcher.

  • parameters (NextHopParameters)

    Parameters that define the source and

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 622

def get_next_hop_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  # Send request
  promise = begin_get_next_hop_async(resource_group_name, network_watcher_name, parameters, custom_headers)

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

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

  promise
end

#get_topology(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ Topology

Gets the current network topology by resource group.

representation of topology. 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.

  • parameters (TopologyParameters)

    Parameters that define the

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

    A hash of custom headers that

Returns:

  • (Topology)

    operation results.



452
453
454
455
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 452

def get_topology(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  response = get_topology_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#get_topology_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Gets the current network topology by resource group.

representation of topology. 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.

  • parameters (TopologyParameters)

    Parameters that define the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
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
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 485

def get_topology_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'network_watcher_name is nil' if network_watcher_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

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

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

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

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#get_topology_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the current network topology by resource group.

representation of topology. 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.

  • parameters (TopologyParameters)

    Parameters that define the

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



469
470
471
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 469

def get_topology_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  get_topology_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
end

#get_troubleshooting(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ TroubleshootingResult

Initiate troubleshooting on a specified resource

resource. resource to troubleshoot. 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

  • parameters (TroubleshootingParameters)

    Parameters that define the

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

    A hash of custom headers that

Returns:

  • (TroubleshootingResult)

    operation results.



699
700
701
702
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 699

def get_troubleshooting(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  response = get_troubleshooting_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#get_troubleshooting_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

resource. resource to troubleshoot. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • network_watcher_name (String)

    The name of the network watcher

  • parameters (TroubleshootingParameters)

    Parameters that define the

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 716

def get_troubleshooting_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  # Send request
  promise = begin_get_troubleshooting_async(resource_group_name, network_watcher_name, parameters, custom_headers)

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

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

  promise
end

#get_troubleshooting_result(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ TroubleshootingResult

Get the last completed troubleshooting result on a specified resource

resource. resource to query the troubleshooting result. 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

  • parameters (QueryTroubleshootingParameters)

    Parameters that define the

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

    A hash of custom headers that

Returns:

  • (TroubleshootingResult)

    operation results.



747
748
749
750
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 747

def get_troubleshooting_result(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  response = get_troubleshooting_result_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#get_troubleshooting_result_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

resource. resource to query the troubleshooting result. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • network_watcher_name (String)

    The name of the network watcher

  • parameters (QueryTroubleshootingParameters)

    Parameters that define the

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 764

def get_troubleshooting_result_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  # Send request
  promise = begin_get_troubleshooting_result_async(resource_group_name, network_watcher_name, parameters, custom_headers)

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

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

  promise
end

#get_vmsecurity_rules(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ SecurityGroupViewResult

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

to check security groups for. 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.

  • parameters (SecurityGroupViewParameters)

    Parameters that define the VM

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

    A hash of custom headers that

Returns:

  • (SecurityGroupViewResult)

    operation results.



652
653
654
655
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 652

def get_vmsecurity_rules(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  response = get_vmsecurity_rules_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#get_vmsecurity_rules_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

to check security groups for. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • network_watcher_name (String)

    The name of the network watcher.

  • parameters (SecurityGroupViewParameters)

    Parameters that define the VM

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 668

def get_vmsecurity_rules_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  # Send request
  promise = begin_get_vmsecurity_rules_async(resource_group_name, network_watcher_name, parameters, custom_headers)

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

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

  promise
end

#get_with_http_info(resource_group_name, network_watcher_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the specified network watcher by resource group.

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.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



166
167
168
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 166

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

#list(resource_group_name, custom_headers = nil) ⇒ NetworkWatcherListResult

Gets all network watchers by resource group.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

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

    A hash of custom headers that

Returns:

  • (NetworkWatcherListResult)

    operation results.



279
280
281
282
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 279

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

#list_all(custom_headers = nil) ⇒ NetworkWatcherListResult

Gets all network watchers by subscription.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (NetworkWatcherListResult)

    operation results.



365
366
367
368
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 365

def list_all(custom_headers = nil)
  response = list_all_async(custom_headers).value!
  response.body unless response.nil?
end

#list_all_async(custom_headers = nil) ⇒ Concurrent::Promise

Gets all network watchers by subscription.

to the HTTP request.

Parameters:

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
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
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 390

def list_all_async(custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#list_all_with_http_info(custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets all network watchers by subscription.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



378
379
380
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 378

def list_all_with_http_info(custom_headers = nil)
  list_all_async(custom_headers).value!
end

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

Gets all network watchers by resource group.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 306

def list_async(resource_group_name, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#list_with_http_info(resource_group_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets all network watchers by resource group.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



293
294
295
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 293

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

#set_flow_log_configuration(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ FlowLogInformation

Configures flow log on a specified resource.

group. resource. configuration of flow log. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the network watcher resource

  • network_watcher_name (String)

    The name of the network watcher

  • parameters (FlowLogInformation)

    Parameters that define the

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

    A hash of custom headers that

Returns:

  • (FlowLogInformation)

    operation results.



796
797
798
799
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 796

def set_flow_log_configuration(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  response = set_flow_log_configuration_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#set_flow_log_configuration_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

group. resource. configuration of flow log. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the network watcher resource

  • network_watcher_name (String)

    The name of the network watcher

  • parameters (FlowLogInformation)

    Parameters that define the

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 814

def set_flow_log_configuration_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  # Send request
  promise = begin_set_flow_log_configuration_async(resource_group_name, network_watcher_name, parameters, custom_headers)

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

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

  promise
end

#verify_ipflow(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ VerificationIPFlowResult

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

IP flow to be verified. 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.

  • parameters (VerificationIPFlowParameters)

    Parameters that define the

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

    A hash of custom headers that

Returns:

  • (VerificationIPFlowResult)

    operation results.



560
561
562
563
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 560

def verify_ipflow(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  response = verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

IP flow to be verified. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • network_watcher_name (String)

    The name of the network watcher.

  • parameters (VerificationIPFlowParameters)

    Parameters that define the

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
# File 'lib/2016-09-01/generated/azure_mgmt_network/network_watchers.rb', line 576

def verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers = nil)
  # Send request
  promise = begin_verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers)

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

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

  promise
end