Class: Azure::ServiceBus::Mgmt::V2018_01_01_preview::Namespaces

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb

Overview

Azure Service Bus client for managing Namespace, IPFilter Rules, VirtualNetworkRules and Zone Redundant

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Namespaces

Creates and initializes a new instance of the Namespaces class.

Parameters:

  • client

    service class for accessing basic functionality.



18
19
20
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 18

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientServiceBusManagementClient (readonly)

Returns reference to the ServiceBusManagementClient.

Returns:



23
24
25
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 23

def client
  @client
end

Instance Method Details

#begin_create_or_update(resource_group_name, namespace_name, parameters, custom_headers: nil) ⇒ SBNamespace

Creates or updates a service namespace. Once created, this namespace’s resource manifest is immutable. This operation is idempotent.

Azure subscription. resource. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name.

  • parameters (SBNamespace)

    Parameters supplied to create a namespace

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

    A hash of custom headers that

Returns:

  • (SBNamespace)

    operation results.



1565
1566
1567
1568
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1565

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

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

Creates or updates a service namespace. Once created, this namespace’s resource manifest is immutable. This operation is idempotent.

Azure subscription. resource. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name.

  • parameters (SBNamespace)

    Parameters supplied to create a namespace

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1602
1603
1604
1605
1606
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
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1602

def begin_create_or_update_async(resource_group_name, namespace_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


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

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

  # Serialize Request
  request_mapper = Azure::ServiceBus::Mgmt::V2018_01_01_preview::Models::SBNamespace.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.ServiceBus/namespaces/{namespaceName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_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 == 201 || status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

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

    result
  end

  promise.execute
end

#begin_create_or_update_with_http_info(resource_group_name, namespace_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Creates or updates a service namespace. Once created, this namespace’s resource manifest is immutable. This operation is idempotent.

Azure subscription. resource. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name.

  • parameters (SBNamespace)

    Parameters supplied to create a namespace

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1584
1585
1586
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1584

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

#begin_delete(resource_group_name, namespace_name, custom_headers: nil) ⇒ Object

Deletes an existing namespace. This operation also removes all associated resources under the namespace.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

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

    A hash of custom headers that



1686
1687
1688
1689
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1686

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

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

Deletes an existing namespace. This operation also removes all associated resources under the namespace.

Azure subscription. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
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
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1719

def begin_delete_async(resource_group_name, namespace_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

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

Deletes an existing namespace. This operation also removes all associated resources under the namespace.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1703
1704
1705
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1703

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

#create_or_update(resource_group_name, namespace_name, parameters, custom_headers: nil) ⇒ SBNamespace

Creates or updates a service namespace. Once created, this namespace’s resource manifest is immutable. This operation is idempotent.

Azure subscription. resource. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name.

  • parameters (SBNamespace)

    Parameters supplied to create a namespace

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

    A hash of custom headers that

Returns:

  • (SBNamespace)

    operation results.



219
220
221
222
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 219

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

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

Azure subscription. resource. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name.

  • parameters (SBNamespace)

    Parameters supplied to create a namespace

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 236

def create_or_update_async(resource_group_name, namespace_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_create_or_update_async(resource_group_name, namespace_name, parameters, custom_headers:custom_headers)

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

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

  promise
end

#create_or_update_ip_filter_rule(resource_group_name, namespace_name, ip_filter_rule_name, parameters, custom_headers: nil) ⇒ IpFilterRule

Creates or updates an IpFilterRule for a Namespace.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • ip_filter_rule_name (String)

    The IP Filter Rule name.

  • parameters (IpFilterRule)

    The Namespace IpFilterRule.

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

    A hash of custom headers that

Returns:

  • (IpFilterRule)

    operation results.



632
633
634
635
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 632

def create_or_update_ip_filter_rule(resource_group_name, namespace_name, ip_filter_rule_name, parameters, custom_headers:nil)
  response = create_or_update_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Creates or updates an IpFilterRule for a Namespace.

Azure subscription. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • ip_filter_rule_name (String)

    The IP Filter Rule name.

  • parameters (IpFilterRule)

    The Namespace IpFilterRule.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 667

def create_or_update_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
  fail ArgumentError, 'ip_filter_rule_name is nil' if ip_filter_rule_name.nil?
  fail ArgumentError, "'ip_filter_rule_name' should satisfy the constraint - 'MinLength': '1'" if !ip_filter_rule_name.nil? && ip_filter_rule_name.length < 1
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


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

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

  # Serialize Request
  request_mapper = Azure::ServiceBus::Mgmt::V2018_01_01_preview::Models::IpFilterRule.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.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'ipFilterRuleName' => ip_filter_rule_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
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceBus::Mgmt::V2018_01_01_preview::Models::IpFilterRule.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_ip_filter_rule_with_http_info(resource_group_name, namespace_name, ip_filter_rule_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Creates or updates an IpFilterRule for a Namespace.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • ip_filter_rule_name (String)

    The IP Filter Rule name.

  • parameters (IpFilterRule)

    The Namespace IpFilterRule.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



650
651
652
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 650

def create_or_update_ip_filter_rule_with_http_info(resource_group_name, namespace_name, ip_filter_rule_name, parameters, custom_headers:nil)
  create_or_update_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, parameters, custom_headers:custom_headers).value!
end

#create_or_update_network_rule_set(resource_group_name, namespace_name, parameters, custom_headers: nil) ⇒ NetworkRuleSet

Gets NetworkRuleSet for a Namespace.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • parameters (NetworkRuleSet)

    The Namespace IpFilterRule.

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

    A hash of custom headers that

Returns:

  • (NetworkRuleSet)

    operation results.



1354
1355
1356
1357
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1354

def create_or_update_network_rule_set(resource_group_name, namespace_name, parameters, custom_headers:nil)
  response = create_or_update_network_rule_set_async(resource_group_name, namespace_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_network_rule_set_async(resource_group_name, namespace_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Gets NetworkRuleSet for a Namespace.

Azure subscription. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • parameters (NetworkRuleSet)

    The Namespace IpFilterRule.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1387

def create_or_update_network_rule_set_async(resource_group_name, namespace_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?


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

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

  # Serialize Request
  request_mapper = Azure::ServiceBus::Mgmt::V2018_01_01_preview::Models::NetworkRuleSet.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.ServiceBus/namespaces/{namespaceName}/networkrulesets/default'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_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
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceBus::Mgmt::V2018_01_01_preview::Models::NetworkRuleSet.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_network_rule_set_with_http_info(resource_group_name, namespace_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets NetworkRuleSet for a Namespace.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • parameters (NetworkRuleSet)

    The Namespace IpFilterRule.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1371
1372
1373
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1371

def create_or_update_network_rule_set_with_http_info(resource_group_name, namespace_name, parameters, custom_headers:nil)
  create_or_update_network_rule_set_async(resource_group_name, namespace_name, parameters, custom_headers:custom_headers).value!
end

#create_or_update_virtual_network_rule(resource_group_name, namespace_name, virtual_network_rule_name, parameters, custom_headers: nil) ⇒ VirtualNetworkRule

Creates or updates an VirtualNetworkRule for a Namespace.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • virtual_network_rule_name (String)

    The Virtual Network Rule name.

  • parameters (VirtualNetworkRule)

    The Namespace VirtualNetworkRule.

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

    A hash of custom headers that

Returns:

  • (VirtualNetworkRule)

    operation results.



1043
1044
1045
1046
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1043

def create_or_update_virtual_network_rule(resource_group_name, namespace_name, virtual_network_rule_name, parameters, custom_headers:nil)
  response = create_or_update_virtual_network_rule_async(resource_group_name, namespace_name, virtual_network_rule_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_virtual_network_rule_async(resource_group_name, namespace_name, virtual_network_rule_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Creates or updates an VirtualNetworkRule for a Namespace.

Azure subscription. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • virtual_network_rule_name (String)

    The Virtual Network Rule name.

  • parameters (VirtualNetworkRule)

    The Namespace VirtualNetworkRule.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1078

def create_or_update_virtual_network_rule_async(resource_group_name, namespace_name, virtual_network_rule_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
  fail ArgumentError, 'virtual_network_rule_name is nil' if virtual_network_rule_name.nil?
  fail ArgumentError, "'virtual_network_rule_name' should satisfy the constraint - 'MinLength': '1'" if !virtual_network_rule_name.nil? && virtual_network_rule_name.length < 1
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


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

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

  # Serialize Request
  request_mapper = Azure::ServiceBus::Mgmt::V2018_01_01_preview::Models::VirtualNetworkRule.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.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'virtualNetworkRuleName' => virtual_network_rule_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
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceBus::Mgmt::V2018_01_01_preview::Models::VirtualNetworkRule.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_virtual_network_rule_with_http_info(resource_group_name, namespace_name, virtual_network_rule_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Creates or updates an VirtualNetworkRule for a Namespace.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • virtual_network_rule_name (String)

    The Virtual Network Rule name.

  • parameters (VirtualNetworkRule)

    The Namespace VirtualNetworkRule.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1061
1062
1063
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1061

def create_or_update_virtual_network_rule_with_http_info(resource_group_name, namespace_name, virtual_network_rule_name, parameters, custom_headers:nil)
  create_or_update_virtual_network_rule_async(resource_group_name, namespace_name, virtual_network_rule_name, parameters, custom_headers:custom_headers).value!
end

#delete(resource_group_name, namespace_name, custom_headers: nil) ⇒ Object

Deletes an existing namespace. This operation also removes all associated resources under the namespace.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

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

    A hash of custom headers that



264
265
266
267
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 264

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

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

Azure subscription. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 279

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

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

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

  promise
end

#delete_ip_filter_rule(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers: nil) ⇒ Object

Deletes an IpFilterRule for a Namespace.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • ip_filter_rule_name (String)

    The IP Filter Rule name.

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

    A hash of custom headers that



745
746
747
748
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 745

def delete_ip_filter_rule(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:nil)
  response = delete_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:custom_headers).value!
  nil
end

#delete_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers: nil) ⇒ Concurrent::Promise

Deletes an IpFilterRule for a Namespace.

Azure subscription. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • ip_filter_rule_name (String)

    The IP Filter Rule name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 778

def delete_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
  fail ArgumentError, 'ip_filter_rule_name is nil' if ip_filter_rule_name.nil?
  fail ArgumentError, "'ip_filter_rule_name' should satisfy the constraint - 'MinLength': '1'" if !ip_filter_rule_name.nil? && ip_filter_rule_name.length < 1
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#delete_ip_filter_rule_with_http_info(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes an IpFilterRule for a Namespace.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • ip_filter_rule_name (String)

    The IP Filter Rule name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



762
763
764
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 762

def delete_ip_filter_rule_with_http_info(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:nil)
  delete_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:custom_headers).value!
end

#delete_virtual_network_rule(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers: nil) ⇒ Object

Deletes an VirtualNetworkRule for a Namespace.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • virtual_network_rule_name (String)

    The Virtual Network Rule name.

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

    A hash of custom headers that



1156
1157
1158
1159
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1156

def delete_virtual_network_rule(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers:nil)
  response = delete_virtual_network_rule_async(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers:custom_headers).value!
  nil
end

#delete_virtual_network_rule_async(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers: nil) ⇒ Concurrent::Promise

Deletes an VirtualNetworkRule for a Namespace.

Azure subscription. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • virtual_network_rule_name (String)

    The Virtual Network Rule name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1189

def delete_virtual_network_rule_async(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
  fail ArgumentError, 'virtual_network_rule_name is nil' if virtual_network_rule_name.nil?
  fail ArgumentError, "'virtual_network_rule_name' should satisfy the constraint - 'MinLength': '1'" if !virtual_network_rule_name.nil? && virtual_network_rule_name.length < 1
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#delete_virtual_network_rule_with_http_info(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes an VirtualNetworkRule for a Namespace.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • virtual_network_rule_name (String)

    The Virtual Network Rule name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1173
1174
1175
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1173

def delete_virtual_network_rule_with_http_info(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers:nil)
  delete_virtual_network_rule_async(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers:custom_headers).value!
end

#get(resource_group_name, namespace_name, custom_headers: nil) ⇒ SBNamespace

Gets a description for the specified namespace.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

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

    A hash of custom headers that

Returns:

  • (SBNamespace)

    operation results.



306
307
308
309
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 306

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

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

Gets a description for the specified namespace.

Azure subscription. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 337

def get_async(resource_group_name, namespace_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceBus::Mgmt::V2018_01_01_preview::Models::SBNamespace.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_ip_filter_rule(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers: nil) ⇒ IpFilterRule

Gets an IpFilterRule for a Namespace by rule name.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • ip_filter_rule_name (String)

    The IP Filter Rule name.

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

    A hash of custom headers that

Returns:

  • (IpFilterRule)

    operation results.



839
840
841
842
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 839

def get_ip_filter_rule(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:nil)
  response = get_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets an IpFilterRule for a Namespace by rule name.

Azure subscription. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • ip_filter_rule_name (String)

    The IP Filter Rule name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 872

def get_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
  fail ArgumentError, 'ip_filter_rule_name is nil' if ip_filter_rule_name.nil?
  fail ArgumentError, "'ip_filter_rule_name' should satisfy the constraint - 'MinLength': '1'" if !ip_filter_rule_name.nil? && ip_filter_rule_name.length < 1
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceBus::Mgmt::V2018_01_01_preview::Models::IpFilterRule.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_ip_filter_rule_with_http_info(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets an IpFilterRule for a Namespace by rule name.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • ip_filter_rule_name (String)

    The IP Filter Rule name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



856
857
858
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 856

def get_ip_filter_rule_with_http_info(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:nil)
  get_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:custom_headers).value!
end

#get_network_rule_set(resource_group_name, namespace_name, custom_headers: nil) ⇒ NetworkRuleSet

Gets NetworkRuleSet for a Namespace.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

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

    A hash of custom headers that

Returns:

  • (NetworkRuleSet)

    operation results.



1463
1464
1465
1466
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1463

def get_network_rule_set(resource_group_name, namespace_name, custom_headers:nil)
  response = get_network_rule_set_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_network_rule_set_async(resource_group_name, namespace_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets NetworkRuleSet for a Namespace.

Azure subscription. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1494

def get_network_rule_set_async(resource_group_name, namespace_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceBus::Mgmt::V2018_01_01_preview::Models::NetworkRuleSet.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_network_rule_set_with_http_info(resource_group_name, namespace_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets NetworkRuleSet for a Namespace.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1479
1480
1481
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1479

def get_network_rule_set_with_http_info(resource_group_name, namespace_name, custom_headers:nil)
  get_network_rule_set_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
end

#get_virtual_network_rule(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers: nil) ⇒ VirtualNetworkRule

Gets an VirtualNetworkRule for a Namespace by rule name.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • virtual_network_rule_name (String)

    The Virtual Network Rule name.

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

    A hash of custom headers that

Returns:

  • (VirtualNetworkRule)

    operation results.



1250
1251
1252
1253
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1250

def get_virtual_network_rule(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers:nil)
  response = get_virtual_network_rule_async(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_virtual_network_rule_async(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets an VirtualNetworkRule for a Namespace by rule name.

Azure subscription. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • virtual_network_rule_name (String)

    The Virtual Network Rule name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1283

def get_virtual_network_rule_async(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
  fail ArgumentError, 'virtual_network_rule_name is nil' if virtual_network_rule_name.nil?
  fail ArgumentError, "'virtual_network_rule_name' should satisfy the constraint - 'MinLength': '1'" if !virtual_network_rule_name.nil? && virtual_network_rule_name.length < 1
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceBus::Mgmt::V2018_01_01_preview::Models::VirtualNetworkRule.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_virtual_network_rule_with_http_info(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets an VirtualNetworkRule for a Namespace by rule name.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • virtual_network_rule_name (String)

    The Virtual Network Rule name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1267
1268
1269
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1267

def get_virtual_network_rule_with_http_info(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers:nil)
  get_virtual_network_rule_async(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers:custom_headers).value!
end

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

Gets a description for the specified namespace.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



322
323
324
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 322

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

#list(custom_headers: nil) ⇒ Array<SBNamespace>

Gets all the available namespaces within the subscription, irrespective of the resource groups.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (Array<SBNamespace>)

    operation results.



34
35
36
37
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 34

def list(custom_headers:nil)
  first_page = list_as_lazy(custom_headers:custom_headers)
  first_page.get_all_items
end

#list_as_lazy(custom_headers: nil) ⇒ SBNamespaceListResult

Gets all the available namespaces within the subscription, irrespective of the resource groups.

will be added to the HTTP request.

response.

Parameters:

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

    A hash of custom headers that

Returns:

  • (SBNamespaceListResult)

    which provide lazy access to pages of the



2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 2131

def list_as_lazy(custom_headers:nil)
  response = list_async(custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_async(custom_headers: nil) ⇒ Concurrent::Promise

Gets all the available namespaces within the subscription, irrespective of the resource groups.

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.



61
62
63
64
65
66
67
68
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
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 61

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


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

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

  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 MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceBus::Mgmt::V2018_01_01_preview::Models::SBNamespaceListResult.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_by_resource_group(resource_group_name, custom_headers: nil) ⇒ Array<SBNamespace>

Gets the available namespaces within a resource group.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

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

    A hash of custom headers that

Returns:

  • (Array<SBNamespace>)

    operation results.



122
123
124
125
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 122

def list_by_resource_group(resource_group_name, custom_headers:nil)
  first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_by_resource_group_as_lazy(resource_group_name, custom_headers: nil) ⇒ SBNamespaceListResult

Gets the available namespaces within a resource group.

Azure subscription. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

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

    A hash of custom headers that

Returns:

  • (SBNamespaceListResult)

    which provide lazy access to pages of the



2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 2153

def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
  response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_by_resource_group_async(resource_group_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets the available namespaces within a resource group.

Azure subscription. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 151

def list_by_resource_group_async(resource_group_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


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

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

  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 MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceBus::Mgmt::V2018_01_01_preview::Models::SBNamespaceListResult.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_by_resource_group_next(next_page_link, custom_headers: nil) ⇒ SBNamespaceListResult

Gets the available namespaces within a resource group.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (SBNamespaceListResult)

    operation results.



1867
1868
1869
1870
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1867

def list_by_resource_group_next(next_page_link, custom_headers:nil)
  response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_by_resource_group_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Gets the available namespaces within a resource group.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1896

def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


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

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

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceBus::Mgmt::V2018_01_01_preview::Models::SBNamespaceListResult.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_by_resource_group_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the available namespaces within a resource group.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1882
1883
1884
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1882

def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
  list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_by_resource_group_with_http_info(resource_group_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the available namespaces within a resource group.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



137
138
139
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 137

def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
  list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
end

#list_ip_filter_rules(resource_group_name, namespace_name, custom_headers: nil) ⇒ Array<IpFilterRule>

Gets a list of IP Filter rules for a Namespace.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

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

    A hash of custom headers that

Returns:

  • (Array<IpFilterRule>)

    operation results.



531
532
533
534
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 531

def list_ip_filter_rules(resource_group_name, namespace_name, custom_headers:nil)
  first_page = list_ip_filter_rules_as_lazy(resource_group_name, namespace_name, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_ip_filter_rules_as_lazy(resource_group_name, namespace_name, custom_headers: nil) ⇒ IpFilterRuleListResult

Gets a list of IP Filter rules for a Namespace.

Azure subscription. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

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

    A hash of custom headers that

Returns:

  • (IpFilterRuleListResult)

    which provide lazy access to pages of the



2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 2176

def list_ip_filter_rules_as_lazy(resource_group_name, namespace_name, custom_headers:nil)
  response = list_ip_filter_rules_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_ip_filter_rules_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_ip_filter_rules_async(resource_group_name, namespace_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets a list of IP Filter rules for a Namespace.

Azure subscription. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 562

def list_ip_filter_rules_async(resource_group_name, namespace_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceBus::Mgmt::V2018_01_01_preview::Models::IpFilterRuleListResult.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_ip_filter_rules_next(next_page_link, custom_headers: nil) ⇒ IpFilterRuleListResult

Gets a list of IP Filter rules for a Namespace.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (IpFilterRuleListResult)

    operation results.



1955
1956
1957
1958
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1955

def list_ip_filter_rules_next(next_page_link, custom_headers:nil)
  response = list_ip_filter_rules_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_ip_filter_rules_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Gets a list of IP Filter rules for a Namespace.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1984

def list_ip_filter_rules_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


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

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

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceBus::Mgmt::V2018_01_01_preview::Models::IpFilterRuleListResult.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_ip_filter_rules_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a list of IP Filter rules for a Namespace.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1970
1971
1972
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1970

def list_ip_filter_rules_next_with_http_info(next_page_link, custom_headers:nil)
  list_ip_filter_rules_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_ip_filter_rules_with_http_info(resource_group_name, namespace_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a list of IP Filter rules for a Namespace.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



547
548
549
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 547

def list_ip_filter_rules_with_http_info(resource_group_name, namespace_name, custom_headers:nil)
  list_ip_filter_rules_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
end

#list_next(next_page_link, custom_headers: nil) ⇒ SBNamespaceListResult

Gets all the available namespaces within the subscription, irrespective of the resource groups.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (SBNamespaceListResult)

    operation results.



1777
1778
1779
1780
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1777

def list_next(next_page_link, custom_headers:nil)
  response = list_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Gets all the available namespaces within the subscription, irrespective of the resource groups.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1808

def list_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


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

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

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceBus::Mgmt::V2018_01_01_preview::Models::SBNamespaceListResult.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_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets all the available namespaces within the subscription, irrespective of the resource groups.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1793
1794
1795
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 1793

def list_next_with_http_info(next_page_link, custom_headers:nil)
  list_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_virtual_network_rules(resource_group_name, namespace_name, custom_headers: nil) ⇒ Array<VirtualNetworkRule>

Gets a list of VirtualNetwork rules for a Namespace.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

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

    A hash of custom headers that

Returns:

  • (Array<VirtualNetworkRule>)

    operation results.



942
943
944
945
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 942

def list_virtual_network_rules(resource_group_name, namespace_name, custom_headers:nil)
  first_page = list_virtual_network_rules_as_lazy(resource_group_name, namespace_name, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_virtual_network_rules_as_lazy(resource_group_name, namespace_name, custom_headers: nil) ⇒ VirtualNetworkRuleListResult

Gets a list of VirtualNetwork rules for a Namespace.

Azure subscription. will be added to the HTTP request.

the response.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

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

    A hash of custom headers that

Returns:

  • (VirtualNetworkRuleListResult)

    which provide lazy access to pages of



2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 2199

def list_virtual_network_rules_as_lazy(resource_group_name, namespace_name, custom_headers:nil)
  response = list_virtual_network_rules_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_virtual_network_rules_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_virtual_network_rules_async(resource_group_name, namespace_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets a list of VirtualNetwork rules for a Namespace.

Azure subscription. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 973

def list_virtual_network_rules_async(resource_group_name, namespace_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceBus::Mgmt::V2018_01_01_preview::Models::VirtualNetworkRuleListResult.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_virtual_network_rules_next(next_page_link, custom_headers: nil) ⇒ VirtualNetworkRuleListResult

Gets a list of VirtualNetwork rules for a Namespace.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (VirtualNetworkRuleListResult)

    operation results.



2043
2044
2045
2046
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 2043

def list_virtual_network_rules_next(next_page_link, custom_headers:nil)
  response = list_virtual_network_rules_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_virtual_network_rules_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Gets a list of VirtualNetwork rules for a Namespace.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 2072

def list_virtual_network_rules_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


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

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

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceBus::Mgmt::V2018_01_01_preview::Models::VirtualNetworkRuleListResult.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_virtual_network_rules_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a list of VirtualNetwork rules for a Namespace.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2058
2059
2060
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 2058

def list_virtual_network_rules_next_with_http_info(next_page_link, custom_headers:nil)
  list_virtual_network_rules_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_virtual_network_rules_with_http_info(resource_group_name, namespace_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a list of VirtualNetwork rules for a Namespace.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



958
959
960
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 958

def list_virtual_network_rules_with_http_info(resource_group_name, namespace_name, custom_headers:nil)
  list_virtual_network_rules_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
end

#list_with_http_info(custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets all the available namespaces within the subscription, irrespective of the resource groups.

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.



48
49
50
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 48

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

#update(resource_group_name, namespace_name, parameters, custom_headers: nil) ⇒ SBNamespace

Updates a service namespace. Once created, this namespace’s resource manifest is immutable. This operation is idempotent.

Azure subscription. a namespace resource. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • parameters (SBNamespaceUpdateParameters)

    Parameters supplied to update

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

    A hash of custom headers that

Returns:

  • (SBNamespace)

    operation results.



408
409
410
411
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 408

def update(resource_group_name, namespace_name, parameters, custom_headers:nil)
  response = update_async(resource_group_name, namespace_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#update_async(resource_group_name, namespace_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Updates a service namespace. Once created, this namespace’s resource manifest is immutable. This operation is idempotent.

Azure subscription. a namespace resource. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • parameters (SBNamespaceUpdateParameters)

    Parameters supplied to update

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
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
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 445

def update_async(resource_group_name, namespace_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
  fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


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

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

  # Serialize Request
  request_mapper = Azure::ServiceBus::Mgmt::V2018_01_01_preview::Models::SBNamespaceUpdateParameters.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.ServiceBus/namespaces/{namespaceName}'

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#update_with_http_info(resource_group_name, namespace_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Updates a service namespace. Once created, this namespace’s resource manifest is immutable. This operation is idempotent.

Azure subscription. a namespace resource. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • namespace_name (String)

    The namespace name

  • parameters (SBNamespaceUpdateParameters)

    Parameters supplied to update

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



427
428
429
# File 'lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb', line 427

def update_with_http_info(resource_group_name, namespace_name, parameters, custom_headers:nil)
  update_async(resource_group_name, namespace_name, parameters, custom_headers:custom_headers).value!
end