azure_mgmt_event_hub 0.17.0 → 0.18.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +5 -5
  2. data/lib/2014-09-01/generated/azure_mgmt_event_hub.rb +59 -0
  3. data/lib/2014-09-01/generated/azure_mgmt_event_hub/consumer_groups.rb +598 -0
  4. data/lib/2014-09-01/generated/azure_mgmt_event_hub/event_hub_management_client.rb +145 -0
  5. data/lib/2014-09-01/generated/azure_mgmt_event_hub/event_hubs.rb +1239 -0
  6. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/access_rights.rb +17 -0
  7. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/check_name_availability_parameter.rb +46 -0
  8. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/check_name_availability_result.rb +75 -0
  9. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/consumer_group_create_or_update_parameters.rb +115 -0
  10. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/consumer_group_list_result.rb +100 -0
  11. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/consumer_group_resource.rb +117 -0
  12. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/entity_status.rb +23 -0
  13. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/event_hub_create_or_update_parameters.rb +150 -0
  14. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/event_hub_list_result.rb +100 -0
  15. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/event_hub_resource.rb +152 -0
  16. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/namespace_create_or_update_parameters.rb +160 -0
  17. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/namespace_list_result.rb +100 -0
  18. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/namespace_resource.rb +181 -0
  19. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/namespace_state.rb +27 -0
  20. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/namespace_update_parameter.rb +66 -0
  21. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/operation.rb +59 -0
  22. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/operation_display.rb +72 -0
  23. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/operation_list_result.rb +103 -0
  24. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/resource.rb +91 -0
  25. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/shared_access_authorization_rule_create_or_update_parameters.rb +79 -0
  26. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/shared_access_authorization_rule_list_result.rb +102 -0
  27. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/shared_access_authorization_rule_post_resource.rb +175 -0
  28. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/shared_access_authorization_rule_resource.rb +90 -0
  29. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/sku.rb +70 -0
  30. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/sku_name.rb +16 -0
  31. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/sku_tier.rb +17 -0
  32. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/tracked_resource.rb +89 -0
  33. data/lib/2014-09-01/generated/azure_mgmt_event_hub/models/unavailable_reason.rb +20 -0
  34. data/lib/2014-09-01/generated/azure_mgmt_event_hub/module_definition.rb +9 -0
  35. data/lib/2014-09-01/generated/azure_mgmt_event_hub/namespaces.rb +2044 -0
  36. data/lib/2014-09-01/generated/azure_mgmt_event_hub/operations.rb +219 -0
  37. data/lib/2015-08-01/generated/azure_mgmt_event_hub/consumer_groups.rb +10 -0
  38. data/lib/2015-08-01/generated/azure_mgmt_event_hub/event_hub_management_client.rb +1 -1
  39. data/lib/2015-08-01/generated/azure_mgmt_event_hub/event_hubs.rb +31 -5
  40. data/lib/2015-08-01/generated/azure_mgmt_event_hub/models/consumer_group_list_result.rb +1 -1
  41. data/lib/2015-08-01/generated/azure_mgmt_event_hub/models/event_hub_list_result.rb +1 -1
  42. data/lib/2015-08-01/generated/azure_mgmt_event_hub/models/namespace_list_result.rb +1 -1
  43. data/lib/2015-08-01/generated/azure_mgmt_event_hub/models/operation_list_result.rb +1 -1
  44. data/lib/2015-08-01/generated/azure_mgmt_event_hub/models/resource.rb +9 -0
  45. data/lib/2015-08-01/generated/azure_mgmt_event_hub/models/shared_access_authorization_rule_list_result.rb +1 -1
  46. data/lib/2015-08-01/generated/azure_mgmt_event_hub/namespaces.rb +32 -0
  47. data/lib/2015-08-01/generated/azure_mgmt_event_hub/operations.rb +4 -0
  48. data/lib/2017-04-01/generated/azure_mgmt_event_hub.rb +20 -13
  49. data/lib/2017-04-01/generated/azure_mgmt_event_hub/consumer_groups.rb +14 -0
  50. data/lib/2017-04-01/generated/azure_mgmt_event_hub/disaster_recovery_configs.rb +27 -3
  51. data/lib/2017-04-01/generated/azure_mgmt_event_hub/event_hub_management_client.rb +1 -1
  52. data/lib/2017-04-01/generated/azure_mgmt_event_hub/event_hubs.rb +33 -0
  53. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/arm_disaster_recovery.rb +1 -1
  54. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/arm_disaster_recovery_list_result.rb +1 -1
  55. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/authorization_rule_list_result.rb +1 -1
  56. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/capture_description.rb +11 -0
  57. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/consumer_group.rb +1 -1
  58. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/consumer_group_list_result.rb +1 -1
  59. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/default_action.rb +16 -0
  60. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/ehnamespace.rb +13 -1
  61. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/ehnamespace_list_result.rb +1 -1
  62. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/error_response.rb +1 -1
  63. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/event_hub_list_result.rb +1 -1
  64. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/messaging_regions_list_result.rb +1 -1
  65. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/network_rule_ipaction.rb +15 -0
  66. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/network_rule_set.rb +114 -0
  67. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/network_rule_set_list_result.rb +100 -0
  68. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/nwrule_set_ip_rules.rb +59 -0
  69. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/nwrule_set_virtual_network_rules.rb +59 -0
  70. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/operation_list_result.rb +1 -1
  71. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/regenerate_access_key_parameters.rb +1 -1
  72. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/resource.rb +9 -0
  73. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/sku.rb +1 -1
  74. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/subnet.rb +46 -0
  75. data/lib/2017-04-01/generated/azure_mgmt_event_hub/namespaces.rb +461 -0
  76. data/lib/2017-04-01/generated/azure_mgmt_event_hub/operations.rb +4 -0
  77. data/lib/2017-04-01/generated/azure_mgmt_event_hub/regions.rb +4 -0
  78. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub.rb +22 -7
  79. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/clusters.rb +483 -0
  80. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/configuration.rb +4 -0
  81. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/event_hub2018preview_management_client.rb +1 -1
  82. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/available_cluster.rb +47 -0
  83. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/available_clusters_list.rb +56 -0
  84. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/cluster.rb +12 -0
  85. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/cluster_list_result.rb +1 -1
  86. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/default_action.rb +16 -0
  87. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/ehnamespace.rb +36 -1
  88. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/ehnamespace_id_container.rb +46 -0
  89. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/ehnamespace_id_list_result.rb +56 -0
  90. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/ehnamespace_list_result.rb +1 -1
  91. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/encryption.rb +62 -0
  92. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/identity.rb +72 -0
  93. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/identity_type.rb +15 -0
  94. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/ip_filter_rule_list_result.rb +1 -1
  95. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/key_source.rb +15 -0
  96. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/key_vault_properties.rb +57 -0
  97. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/network_rule_ipaction.rb +15 -0
  98. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/network_rule_set.rb +114 -0
  99. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/nwrule_set_ip_rules.rb +58 -0
  100. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/nwrule_set_virtual_network_rules.rb +59 -0
  101. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/operation_list_result.rb +1 -1
  102. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/resource.rb +9 -0
  103. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/sku.rb +1 -1
  104. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/subnet.rb +46 -0
  105. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/virtual_network_rule_list_result.rb +6 -6
  106. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/namespaces.rb +260 -11
  107. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/operations.rb +4 -0
  108. data/lib/azure_mgmt_event_hub.rb +2 -1
  109. data/lib/profiles/latest/modules/eventhub_profile_module.rb +82 -22
  110. data/lib/version.rb +1 -1
  111. metadata +62 -5
@@ -0,0 +1,145 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::EventHub::Mgmt::V2014_09_01
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class EventHubManagementClient < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] Subscription credentials that uniquely identify a
21
+ # Microsoft Azure subscription. The subscription ID forms part of the URI
22
+ # for every service call.
23
+ attr_accessor :subscription_id
24
+
25
+ # @return [String] Client API Version.
26
+ attr_reader :api_version
27
+
28
+ # @return [String] The preferred language for the response.
29
+ attr_accessor :accept_language
30
+
31
+ # @return [Integer] The retry timeout in seconds for Long Running
32
+ # Operations. Default value is 30.
33
+ attr_accessor :long_running_operation_retry_timeout
34
+
35
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
36
+ # generated. When set to true a unique x-ms-client-request-id value is
37
+ # generated and included in each request. Default is true.
38
+ attr_accessor :generate_client_request_id
39
+
40
+ # @return [Operations] operations
41
+ attr_reader :operations
42
+
43
+ # @return [Namespaces] namespaces
44
+ attr_reader :namespaces
45
+
46
+ # @return [EventHubs] event_hubs
47
+ attr_reader :event_hubs
48
+
49
+ # @return [ConsumerGroups] consumer_groups
50
+ attr_reader :consumer_groups
51
+
52
+ #
53
+ # Creates initializes a new instance of the EventHubManagementClient class.
54
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
55
+ # @param base_url [String] the base URI of the service.
56
+ # @param options [Array] filters to be applied to the HTTP requests.
57
+ #
58
+ def initialize(credentials = nil, base_url = nil, options = nil)
59
+ super(credentials, options)
60
+ @base_url = base_url || 'https://management.azure.com'
61
+
62
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
63
+ @credentials = credentials
64
+
65
+ @operations = Operations.new(self)
66
+ @namespaces = Namespaces.new(self)
67
+ @event_hubs = EventHubs.new(self)
68
+ @consumer_groups = ConsumerGroups.new(self)
69
+ @api_version = '2014-09-01'
70
+ @accept_language = 'en-US'
71
+ @long_running_operation_retry_timeout = 30
72
+ @generate_client_request_id = true
73
+ add_telemetry
74
+ end
75
+
76
+ #
77
+ # Makes a request and returns the body of the response.
78
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
79
+ # @param path [String] the path, relative to {base_url}.
80
+ # @param options [Hash{String=>String}] specifying any request options like :body.
81
+ # @return [Hash{String=>String}] containing the body of the response.
82
+ # Example:
83
+ #
84
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
85
+ # path = "/path"
86
+ # options = {
87
+ # body: request_content,
88
+ # query_params: {'api-version' => '2016-02-01'}
89
+ # }
90
+ # result = @client.make_request(:put, path, options)
91
+ #
92
+ def make_request(method, path, options = {})
93
+ result = make_request_with_http_info(method, path, options)
94
+ result.body unless result.nil?
95
+ end
96
+
97
+ #
98
+ # Makes a request and returns the operation response.
99
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
100
+ # @param path [String] the path, relative to {base_url}.
101
+ # @param options [Hash{String=>String}] specifying any request options like :body.
102
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
103
+ #
104
+ def make_request_with_http_info(method, path, options = {})
105
+ result = make_request_async(method, path, options).value!
106
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
107
+ result
108
+ end
109
+
110
+ #
111
+ # Makes a request asynchronously.
112
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
113
+ # @param path [String] the path, relative to {base_url}.
114
+ # @param options [Hash{String=>String}] specifying any request options like :body.
115
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
116
+ #
117
+ def make_request_async(method, path, options = {})
118
+ fail ArgumentError, 'method is nil' if method.nil?
119
+ fail ArgumentError, 'path is nil' if path.nil?
120
+
121
+ request_url = options[:base_url] || @base_url
122
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
123
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
124
+ end
125
+
126
+ request_headers = @request_headers
127
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
128
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
129
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
130
+
131
+ super(request_url, method, path, options)
132
+ end
133
+
134
+
135
+ private
136
+ #
137
+ # Adds telemetry information.
138
+ #
139
+ def add_telemetry
140
+ sdk_information = 'azure_mgmt_event_hub'
141
+ sdk_information = "#{sdk_information}/0.18.1"
142
+ add_user_agent_information(sdk_information)
143
+ end
144
+ end
145
+ end
@@ -0,0 +1,1239 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::EventHub::Mgmt::V2014_09_01
7
+ #
8
+ # Azure Event Hubs client
9
+ #
10
+ class EventHubs
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the EventHubs class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [EventHubManagementClient] reference to the EventHubManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Gets all the Event Hubs in a Namespace.
26
+ #
27
+ # @param resource_group_name [String] Name of the resource group within the
28
+ # azure subscription.
29
+ # @param namespace_name [String] The Namespace name
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [Array<EventHubResource>] operation results.
34
+ #
35
+ def list_all(resource_group_name, namespace_name, custom_headers:nil)
36
+ first_page = list_all_as_lazy(resource_group_name, namespace_name, custom_headers:custom_headers)
37
+ first_page.get_all_items
38
+ end
39
+
40
+ #
41
+ # Gets all the Event Hubs in a Namespace.
42
+ #
43
+ # @param resource_group_name [String] Name of the resource group within the
44
+ # azure subscription.
45
+ # @param namespace_name [String] The Namespace name
46
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
47
+ # will be added to the HTTP request.
48
+ #
49
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
50
+ #
51
+ def list_all_with_http_info(resource_group_name, namespace_name, custom_headers:nil)
52
+ list_all_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
53
+ end
54
+
55
+ #
56
+ # Gets all the Event Hubs in a Namespace.
57
+ #
58
+ # @param resource_group_name [String] Name of the resource group within the
59
+ # azure subscription.
60
+ # @param namespace_name [String] The Namespace name
61
+ # @param [Hash{String => String}] A hash of custom headers that will be added
62
+ # to the HTTP request.
63
+ #
64
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
65
+ #
66
+ def list_all_async(resource_group_name, namespace_name, custom_headers:nil)
67
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
68
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
69
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
70
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
71
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
72
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
73
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
74
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
75
+
76
+
77
+ request_headers = {}
78
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
79
+
80
+ # Set Headers
81
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
82
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
83
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs'
84
+
85
+ request_url = @base_url || @client.base_url
86
+
87
+ options = {
88
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
89
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'subscriptionId' => @client.subscription_id},
90
+ query_params: {'api-version' => @client.api_version},
91
+ headers: request_headers.merge(custom_headers || {}),
92
+ base_url: request_url
93
+ }
94
+ promise = @client.make_request_async(:get, path_template, options)
95
+
96
+ promise = promise.then do |result|
97
+ http_response = result.response
98
+ status_code = http_response.status
99
+ response_content = http_response.body
100
+ unless status_code == 200
101
+ error_model = JSON.load(response_content)
102
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
103
+ end
104
+
105
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
106
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
107
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
108
+ # Deserialize Response
109
+ if status_code == 200
110
+ begin
111
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
112
+ result_mapper = Azure::EventHub::Mgmt::V2014_09_01::Models::EventHubListResult.mapper()
113
+ result.body = @client.deserialize(result_mapper, parsed_response)
114
+ rescue Exception => e
115
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
116
+ end
117
+ end
118
+
119
+ result
120
+ end
121
+
122
+ promise.execute
123
+ end
124
+
125
+ #
126
+ # Creates or updates a new Event Hub as a nested resource within a Namespace.
127
+ #
128
+ # @param resource_group_name [String] Name of the resource group within the
129
+ # azure subscription.
130
+ # @param namespace_name [String] The Namespace name
131
+ # @param event_hub_name [String] The Event Hub name
132
+ # @param parameters [EventHubCreateOrUpdateParameters] Parameters supplied to
133
+ # create an Event Hub resource.
134
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
135
+ # will be added to the HTTP request.
136
+ #
137
+ # @return [EventHubResource] operation results.
138
+ #
139
+ def create_or_update(resource_group_name, namespace_name, event_hub_name, parameters, custom_headers:nil)
140
+ response = create_or_update_async(resource_group_name, namespace_name, event_hub_name, parameters, custom_headers:custom_headers).value!
141
+ response.body unless response.nil?
142
+ end
143
+
144
+ #
145
+ # Creates or updates a new Event Hub as a nested resource within a Namespace.
146
+ #
147
+ # @param resource_group_name [String] Name of the resource group within the
148
+ # azure subscription.
149
+ # @param namespace_name [String] The Namespace name
150
+ # @param event_hub_name [String] The Event Hub name
151
+ # @param parameters [EventHubCreateOrUpdateParameters] Parameters supplied to
152
+ # create an Event Hub resource.
153
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
154
+ # will be added to the HTTP request.
155
+ #
156
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
157
+ #
158
+ def create_or_update_with_http_info(resource_group_name, namespace_name, event_hub_name, parameters, custom_headers:nil)
159
+ create_or_update_async(resource_group_name, namespace_name, event_hub_name, parameters, custom_headers:custom_headers).value!
160
+ end
161
+
162
+ #
163
+ # Creates or updates a new Event Hub as a nested resource within a Namespace.
164
+ #
165
+ # @param resource_group_name [String] Name of the resource group within the
166
+ # azure subscription.
167
+ # @param namespace_name [String] The Namespace name
168
+ # @param event_hub_name [String] The Event Hub name
169
+ # @param parameters [EventHubCreateOrUpdateParameters] Parameters supplied to
170
+ # create an Event Hub resource.
171
+ # @param [Hash{String => String}] A hash of custom headers that will be added
172
+ # to the HTTP request.
173
+ #
174
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
175
+ #
176
+ def create_or_update_async(resource_group_name, namespace_name, event_hub_name, parameters, custom_headers:nil)
177
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
178
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
179
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
180
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
181
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
182
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
183
+ fail ArgumentError, 'event_hub_name is nil' if event_hub_name.nil?
184
+ fail ArgumentError, "'event_hub_name' should satisfy the constraint - 'MaxLength': '50'" if !event_hub_name.nil? && event_hub_name.length > 50
185
+ fail ArgumentError, "'event_hub_name' should satisfy the constraint - 'MinLength': '1'" if !event_hub_name.nil? && event_hub_name.length < 1
186
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
187
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
188
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
189
+
190
+
191
+ request_headers = {}
192
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
193
+
194
+ # Set Headers
195
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
196
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
197
+
198
+ # Serialize Request
199
+ request_mapper = Azure::EventHub::Mgmt::V2014_09_01::Models::EventHubCreateOrUpdateParameters.mapper()
200
+ request_content = @client.serialize(request_mapper, parameters)
201
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
202
+
203
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}'
204
+
205
+ request_url = @base_url || @client.base_url
206
+
207
+ options = {
208
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
209
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'eventHubName' => event_hub_name,'subscriptionId' => @client.subscription_id},
210
+ query_params: {'api-version' => @client.api_version},
211
+ body: request_content,
212
+ headers: request_headers.merge(custom_headers || {}),
213
+ base_url: request_url
214
+ }
215
+ promise = @client.make_request_async(:put, path_template, options)
216
+
217
+ promise = promise.then do |result|
218
+ http_response = result.response
219
+ status_code = http_response.status
220
+ response_content = http_response.body
221
+ unless status_code == 200
222
+ error_model = JSON.load(response_content)
223
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
224
+ end
225
+
226
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
227
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
228
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
229
+ # Deserialize Response
230
+ if status_code == 200
231
+ begin
232
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
233
+ result_mapper = Azure::EventHub::Mgmt::V2014_09_01::Models::EventHubResource.mapper()
234
+ result.body = @client.deserialize(result_mapper, parsed_response)
235
+ rescue Exception => e
236
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
237
+ end
238
+ end
239
+
240
+ result
241
+ end
242
+
243
+ promise.execute
244
+ end
245
+
246
+ #
247
+ # Deletes an Event Hub from the specified Namespace and resource group.
248
+ #
249
+ # @param resource_group_name [String] Name of the resource group within the
250
+ # azure subscription.
251
+ # @param namespace_name [String] The Namespace name
252
+ # @param event_hub_name [String] The Event Hub name
253
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
254
+ # will be added to the HTTP request.
255
+ #
256
+ #
257
+ def delete(resource_group_name, namespace_name, event_hub_name, custom_headers:nil)
258
+ response = delete_async(resource_group_name, namespace_name, event_hub_name, custom_headers:custom_headers).value!
259
+ nil
260
+ end
261
+
262
+ #
263
+ # Deletes an Event Hub from the specified Namespace and resource group.
264
+ #
265
+ # @param resource_group_name [String] Name of the resource group within the
266
+ # azure subscription.
267
+ # @param namespace_name [String] The Namespace name
268
+ # @param event_hub_name [String] The Event Hub name
269
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
270
+ # will be added to the HTTP request.
271
+ #
272
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
273
+ #
274
+ def delete_with_http_info(resource_group_name, namespace_name, event_hub_name, custom_headers:nil)
275
+ delete_async(resource_group_name, namespace_name, event_hub_name, custom_headers:custom_headers).value!
276
+ end
277
+
278
+ #
279
+ # Deletes an Event Hub from the specified Namespace and resource group.
280
+ #
281
+ # @param resource_group_name [String] Name of the resource group within the
282
+ # azure subscription.
283
+ # @param namespace_name [String] The Namespace name
284
+ # @param event_hub_name [String] The Event Hub name
285
+ # @param [Hash{String => String}] A hash of custom headers that will be added
286
+ # to the HTTP request.
287
+ #
288
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
289
+ #
290
+ def delete_async(resource_group_name, namespace_name, event_hub_name, custom_headers:nil)
291
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
292
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
293
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
294
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
295
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
296
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
297
+ fail ArgumentError, 'event_hub_name is nil' if event_hub_name.nil?
298
+ fail ArgumentError, "'event_hub_name' should satisfy the constraint - 'MaxLength': '50'" if !event_hub_name.nil? && event_hub_name.length > 50
299
+ fail ArgumentError, "'event_hub_name' should satisfy the constraint - 'MinLength': '1'" if !event_hub_name.nil? && event_hub_name.length < 1
300
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
301
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
302
+
303
+
304
+ request_headers = {}
305
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
306
+
307
+ # Set Headers
308
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
309
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
310
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}'
311
+
312
+ request_url = @base_url || @client.base_url
313
+
314
+ options = {
315
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
316
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'eventHubName' => event_hub_name,'subscriptionId' => @client.subscription_id},
317
+ query_params: {'api-version' => @client.api_version},
318
+ headers: request_headers.merge(custom_headers || {}),
319
+ base_url: request_url
320
+ }
321
+ promise = @client.make_request_async(:delete, path_template, options)
322
+
323
+ promise = promise.then do |result|
324
+ http_response = result.response
325
+ status_code = http_response.status
326
+ response_content = http_response.body
327
+ unless status_code == 204 || status_code == 200
328
+ error_model = JSON.load(response_content)
329
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
330
+ end
331
+
332
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
333
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
334
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
335
+
336
+ result
337
+ end
338
+
339
+ promise.execute
340
+ end
341
+
342
+ #
343
+ # Gets an Event Hubs description for the specified Event Hub.
344
+ #
345
+ # @param resource_group_name [String] Name of the resource group within the
346
+ # azure subscription.
347
+ # @param namespace_name [String] The Namespace name
348
+ # @param event_hub_name [String] The Event Hub name
349
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
350
+ # will be added to the HTTP request.
351
+ #
352
+ # @return [EventHubResource] operation results.
353
+ #
354
+ def get(resource_group_name, namespace_name, event_hub_name, custom_headers:nil)
355
+ response = get_async(resource_group_name, namespace_name, event_hub_name, custom_headers:custom_headers).value!
356
+ response.body unless response.nil?
357
+ end
358
+
359
+ #
360
+ # Gets an Event Hubs description for the specified Event Hub.
361
+ #
362
+ # @param resource_group_name [String] Name of the resource group within the
363
+ # azure subscription.
364
+ # @param namespace_name [String] The Namespace name
365
+ # @param event_hub_name [String] The Event Hub name
366
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
367
+ # will be added to the HTTP request.
368
+ #
369
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
370
+ #
371
+ def get_with_http_info(resource_group_name, namespace_name, event_hub_name, custom_headers:nil)
372
+ get_async(resource_group_name, namespace_name, event_hub_name, custom_headers:custom_headers).value!
373
+ end
374
+
375
+ #
376
+ # Gets an Event Hubs description for the specified Event Hub.
377
+ #
378
+ # @param resource_group_name [String] Name of the resource group within the
379
+ # azure subscription.
380
+ # @param namespace_name [String] The Namespace name
381
+ # @param event_hub_name [String] The Event Hub name
382
+ # @param [Hash{String => String}] A hash of custom headers that will be added
383
+ # to the HTTP request.
384
+ #
385
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
386
+ #
387
+ def get_async(resource_group_name, namespace_name, event_hub_name, custom_headers:nil)
388
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
389
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
390
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
391
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
392
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
393
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
394
+ fail ArgumentError, 'event_hub_name is nil' if event_hub_name.nil?
395
+ fail ArgumentError, "'event_hub_name' should satisfy the constraint - 'MaxLength': '50'" if !event_hub_name.nil? && event_hub_name.length > 50
396
+ fail ArgumentError, "'event_hub_name' should satisfy the constraint - 'MinLength': '1'" if !event_hub_name.nil? && event_hub_name.length < 1
397
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
398
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
399
+
400
+
401
+ request_headers = {}
402
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
403
+
404
+ # Set Headers
405
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
406
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
407
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}'
408
+
409
+ request_url = @base_url || @client.base_url
410
+
411
+ options = {
412
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
413
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'eventHubName' => event_hub_name,'subscriptionId' => @client.subscription_id},
414
+ query_params: {'api-version' => @client.api_version},
415
+ headers: request_headers.merge(custom_headers || {}),
416
+ base_url: request_url
417
+ }
418
+ promise = @client.make_request_async(:get, path_template, options)
419
+
420
+ promise = promise.then do |result|
421
+ http_response = result.response
422
+ status_code = http_response.status
423
+ response_content = http_response.body
424
+ unless status_code == 200
425
+ error_model = JSON.load(response_content)
426
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
427
+ end
428
+
429
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
430
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
431
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
432
+ # Deserialize Response
433
+ if status_code == 200
434
+ begin
435
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
436
+ result_mapper = Azure::EventHub::Mgmt::V2014_09_01::Models::EventHubResource.mapper()
437
+ result.body = @client.deserialize(result_mapper, parsed_response)
438
+ rescue Exception => e
439
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
440
+ end
441
+ end
442
+
443
+ result
444
+ end
445
+
446
+ promise.execute
447
+ end
448
+
449
+ #
450
+ # Gets the authorization rules for an Event Hub.
451
+ #
452
+ # @param resource_group_name [String] Name of the resource group within the
453
+ # azure subscription.
454
+ # @param namespace_name [String] The Namespace name
455
+ # @param event_hub_name [String] The Event Hub name
456
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
457
+ # will be added to the HTTP request.
458
+ #
459
+ # @return [Array<SharedAccessAuthorizationRuleResource>] operation results.
460
+ #
461
+ def list_authorization_rules(resource_group_name, namespace_name, event_hub_name, custom_headers:nil)
462
+ first_page = list_authorization_rules_as_lazy(resource_group_name, namespace_name, event_hub_name, custom_headers:custom_headers)
463
+ first_page.get_all_items
464
+ end
465
+
466
+ #
467
+ # Gets the authorization rules for an Event Hub.
468
+ #
469
+ # @param resource_group_name [String] Name of the resource group within the
470
+ # azure subscription.
471
+ # @param namespace_name [String] The Namespace name
472
+ # @param event_hub_name [String] The Event Hub name
473
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
474
+ # will be added to the HTTP request.
475
+ #
476
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
477
+ #
478
+ def list_authorization_rules_with_http_info(resource_group_name, namespace_name, event_hub_name, custom_headers:nil)
479
+ list_authorization_rules_async(resource_group_name, namespace_name, event_hub_name, custom_headers:custom_headers).value!
480
+ end
481
+
482
+ #
483
+ # Gets the authorization rules for an Event Hub.
484
+ #
485
+ # @param resource_group_name [String] Name of the resource group within the
486
+ # azure subscription.
487
+ # @param namespace_name [String] The Namespace name
488
+ # @param event_hub_name [String] The Event Hub name
489
+ # @param [Hash{String => String}] A hash of custom headers that will be added
490
+ # to the HTTP request.
491
+ #
492
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
493
+ #
494
+ def list_authorization_rules_async(resource_group_name, namespace_name, event_hub_name, custom_headers:nil)
495
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
496
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
497
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
498
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
499
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
500
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
501
+ fail ArgumentError, 'event_hub_name is nil' if event_hub_name.nil?
502
+ fail ArgumentError, "'event_hub_name' should satisfy the constraint - 'MaxLength': '50'" if !event_hub_name.nil? && event_hub_name.length > 50
503
+ fail ArgumentError, "'event_hub_name' should satisfy the constraint - 'MinLength': '1'" if !event_hub_name.nil? && event_hub_name.length < 1
504
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
505
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
506
+
507
+
508
+ request_headers = {}
509
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
510
+
511
+ # Set Headers
512
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
513
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
514
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules'
515
+
516
+ request_url = @base_url || @client.base_url
517
+
518
+ options = {
519
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
520
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'eventHubName' => event_hub_name,'subscriptionId' => @client.subscription_id},
521
+ query_params: {'api-version' => @client.api_version},
522
+ headers: request_headers.merge(custom_headers || {}),
523
+ base_url: request_url
524
+ }
525
+ promise = @client.make_request_async(:get, path_template, options)
526
+
527
+ promise = promise.then do |result|
528
+ http_response = result.response
529
+ status_code = http_response.status
530
+ response_content = http_response.body
531
+ unless status_code == 200
532
+ error_model = JSON.load(response_content)
533
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
534
+ end
535
+
536
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
537
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
538
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
539
+ # Deserialize Response
540
+ if status_code == 200
541
+ begin
542
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
543
+ result_mapper = Azure::EventHub::Mgmt::V2014_09_01::Models::SharedAccessAuthorizationRuleListResult.mapper()
544
+ result.body = @client.deserialize(result_mapper, parsed_response)
545
+ rescue Exception => e
546
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
547
+ end
548
+ end
549
+
550
+ result
551
+ end
552
+
553
+ promise.execute
554
+ end
555
+
556
+ #
557
+ # Creates or updates an AuthorizationRule for the specified Event Hub.
558
+ #
559
+ # @param resource_group_name [String] Name of the resource group within the
560
+ # azure subscription.
561
+ # @param namespace_name [String] The Namespace name
562
+ # @param event_hub_name [String] The Event Hub name
563
+ # @param authorization_rule_name [String] The authorization rule name.
564
+ # @param parameters [SharedAccessAuthorizationRuleCreateOrUpdateParameters] The
565
+ # shared access AuthorizationRule.
566
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
567
+ # will be added to the HTTP request.
568
+ #
569
+ # @return [SharedAccessAuthorizationRuleResource] operation results.
570
+ #
571
+ def create_or_update_authorization_rule(resource_group_name, namespace_name, event_hub_name, authorization_rule_name, parameters, custom_headers:nil)
572
+ response = create_or_update_authorization_rule_async(resource_group_name, namespace_name, event_hub_name, authorization_rule_name, parameters, custom_headers:custom_headers).value!
573
+ response.body unless response.nil?
574
+ end
575
+
576
+ #
577
+ # Creates or updates an AuthorizationRule for the specified Event Hub.
578
+ #
579
+ # @param resource_group_name [String] Name of the resource group within the
580
+ # azure subscription.
581
+ # @param namespace_name [String] The Namespace name
582
+ # @param event_hub_name [String] The Event Hub name
583
+ # @param authorization_rule_name [String] The authorization rule name.
584
+ # @param parameters [SharedAccessAuthorizationRuleCreateOrUpdateParameters] The
585
+ # shared access AuthorizationRule.
586
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
587
+ # will be added to the HTTP request.
588
+ #
589
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
590
+ #
591
+ def create_or_update_authorization_rule_with_http_info(resource_group_name, namespace_name, event_hub_name, authorization_rule_name, parameters, custom_headers:nil)
592
+ create_or_update_authorization_rule_async(resource_group_name, namespace_name, event_hub_name, authorization_rule_name, parameters, custom_headers:custom_headers).value!
593
+ end
594
+
595
+ #
596
+ # Creates or updates an AuthorizationRule for the specified Event Hub.
597
+ #
598
+ # @param resource_group_name [String] Name of the resource group within the
599
+ # azure subscription.
600
+ # @param namespace_name [String] The Namespace name
601
+ # @param event_hub_name [String] The Event Hub name
602
+ # @param authorization_rule_name [String] The authorization rule name.
603
+ # @param parameters [SharedAccessAuthorizationRuleCreateOrUpdateParameters] The
604
+ # shared access AuthorizationRule.
605
+ # @param [Hash{String => String}] A hash of custom headers that will be added
606
+ # to the HTTP request.
607
+ #
608
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
609
+ #
610
+ def create_or_update_authorization_rule_async(resource_group_name, namespace_name, event_hub_name, authorization_rule_name, parameters, custom_headers:nil)
611
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
612
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
613
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
614
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
615
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
616
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
617
+ fail ArgumentError, 'event_hub_name is nil' if event_hub_name.nil?
618
+ fail ArgumentError, "'event_hub_name' should satisfy the constraint - 'MaxLength': '50'" if !event_hub_name.nil? && event_hub_name.length > 50
619
+ fail ArgumentError, "'event_hub_name' should satisfy the constraint - 'MinLength': '1'" if !event_hub_name.nil? && event_hub_name.length < 1
620
+ fail ArgumentError, 'authorization_rule_name is nil' if authorization_rule_name.nil?
621
+ fail ArgumentError, "'authorization_rule_name' should satisfy the constraint - 'MaxLength': '50'" if !authorization_rule_name.nil? && authorization_rule_name.length > 50
622
+ fail ArgumentError, "'authorization_rule_name' should satisfy the constraint - 'MinLength': '1'" if !authorization_rule_name.nil? && authorization_rule_name.length < 1
623
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
624
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
625
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
626
+
627
+
628
+ request_headers = {}
629
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
630
+
631
+ # Set Headers
632
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
633
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
634
+
635
+ # Serialize Request
636
+ request_mapper = Azure::EventHub::Mgmt::V2014_09_01::Models::SharedAccessAuthorizationRuleCreateOrUpdateParameters.mapper()
637
+ request_content = @client.serialize(request_mapper, parameters)
638
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
639
+
640
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}'
641
+
642
+ request_url = @base_url || @client.base_url
643
+
644
+ options = {
645
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
646
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'eventHubName' => event_hub_name,'authorizationRuleName' => authorization_rule_name,'subscriptionId' => @client.subscription_id},
647
+ query_params: {'api-version' => @client.api_version},
648
+ body: request_content,
649
+ headers: request_headers.merge(custom_headers || {}),
650
+ base_url: request_url
651
+ }
652
+ promise = @client.make_request_async(:put, path_template, options)
653
+
654
+ promise = promise.then do |result|
655
+ http_response = result.response
656
+ status_code = http_response.status
657
+ response_content = http_response.body
658
+ unless status_code == 200
659
+ error_model = JSON.load(response_content)
660
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
661
+ end
662
+
663
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
664
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
665
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
666
+ # Deserialize Response
667
+ if status_code == 200
668
+ begin
669
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
670
+ result_mapper = Azure::EventHub::Mgmt::V2014_09_01::Models::SharedAccessAuthorizationRuleResource.mapper()
671
+ result.body = @client.deserialize(result_mapper, parsed_response)
672
+ rescue Exception => e
673
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
674
+ end
675
+ end
676
+
677
+ result
678
+ end
679
+
680
+ promise.execute
681
+ end
682
+
683
+ #
684
+ # Gets an AuthorizationRule for an Event Hub by rule name.
685
+ #
686
+ # @param resource_group_name [String] Name of the resource group within the
687
+ # azure subscription.
688
+ # @param namespace_name [String] The Namespace name
689
+ # @param event_hub_name [String] The Event Hub name
690
+ # @param authorization_rule_name [String] The authorization rule name.
691
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
692
+ # will be added to the HTTP request.
693
+ #
694
+ # @return [SharedAccessAuthorizationRuleResource] operation results.
695
+ #
696
+ def get_authorization_rule(resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers:nil)
697
+ response = get_authorization_rule_async(resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers:custom_headers).value!
698
+ response.body unless response.nil?
699
+ end
700
+
701
+ #
702
+ # Gets an AuthorizationRule for an Event Hub by rule name.
703
+ #
704
+ # @param resource_group_name [String] Name of the resource group within the
705
+ # azure subscription.
706
+ # @param namespace_name [String] The Namespace name
707
+ # @param event_hub_name [String] The Event Hub name
708
+ # @param authorization_rule_name [String] The authorization rule name.
709
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
710
+ # will be added to the HTTP request.
711
+ #
712
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
713
+ #
714
+ def get_authorization_rule_with_http_info(resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers:nil)
715
+ get_authorization_rule_async(resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers:custom_headers).value!
716
+ end
717
+
718
+ #
719
+ # Gets an AuthorizationRule for an Event Hub by rule name.
720
+ #
721
+ # @param resource_group_name [String] Name of the resource group within the
722
+ # azure subscription.
723
+ # @param namespace_name [String] The Namespace name
724
+ # @param event_hub_name [String] The Event Hub name
725
+ # @param authorization_rule_name [String] The authorization rule name.
726
+ # @param [Hash{String => String}] A hash of custom headers that will be added
727
+ # to the HTTP request.
728
+ #
729
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
730
+ #
731
+ def get_authorization_rule_async(resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers:nil)
732
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
733
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
734
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
735
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
736
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
737
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
738
+ fail ArgumentError, 'event_hub_name is nil' if event_hub_name.nil?
739
+ fail ArgumentError, "'event_hub_name' should satisfy the constraint - 'MaxLength': '50'" if !event_hub_name.nil? && event_hub_name.length > 50
740
+ fail ArgumentError, "'event_hub_name' should satisfy the constraint - 'MinLength': '1'" if !event_hub_name.nil? && event_hub_name.length < 1
741
+ fail ArgumentError, 'authorization_rule_name is nil' if authorization_rule_name.nil?
742
+ fail ArgumentError, "'authorization_rule_name' should satisfy the constraint - 'MaxLength': '50'" if !authorization_rule_name.nil? && authorization_rule_name.length > 50
743
+ fail ArgumentError, "'authorization_rule_name' should satisfy the constraint - 'MinLength': '1'" if !authorization_rule_name.nil? && authorization_rule_name.length < 1
744
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
745
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
746
+
747
+
748
+ request_headers = {}
749
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
750
+
751
+ # Set Headers
752
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
753
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
754
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}'
755
+
756
+ request_url = @base_url || @client.base_url
757
+
758
+ options = {
759
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
760
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'eventHubName' => event_hub_name,'authorizationRuleName' => authorization_rule_name,'subscriptionId' => @client.subscription_id},
761
+ query_params: {'api-version' => @client.api_version},
762
+ headers: request_headers.merge(custom_headers || {}),
763
+ base_url: request_url
764
+ }
765
+ promise = @client.make_request_async(:get, path_template, options)
766
+
767
+ promise = promise.then do |result|
768
+ http_response = result.response
769
+ status_code = http_response.status
770
+ response_content = http_response.body
771
+ unless status_code == 200
772
+ error_model = JSON.load(response_content)
773
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
774
+ end
775
+
776
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
777
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
778
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
779
+ # Deserialize Response
780
+ if status_code == 200
781
+ begin
782
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
783
+ result_mapper = Azure::EventHub::Mgmt::V2014_09_01::Models::SharedAccessAuthorizationRuleResource.mapper()
784
+ result.body = @client.deserialize(result_mapper, parsed_response)
785
+ rescue Exception => e
786
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
787
+ end
788
+ end
789
+
790
+ result
791
+ end
792
+
793
+ promise.execute
794
+ end
795
+
796
+ #
797
+ # Gets an AuthorizationRule for an Event Hub by rule name.
798
+ #
799
+ # @param resource_group_name [String] Name of the resource group within the
800
+ # azure subscription.
801
+ # @param namespace_name [String] The Namespace name
802
+ # @param event_hub_name [String] The Event Hub name
803
+ # @param authorization_rule_name [String] The authorization rule name.
804
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
805
+ # will be added to the HTTP request.
806
+ #
807
+ # @return [SharedAccessAuthorizationRulePostResource] operation results.
808
+ #
809
+ def post_authorization_rule(resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers:nil)
810
+ response = post_authorization_rule_async(resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers:custom_headers).value!
811
+ response.body unless response.nil?
812
+ end
813
+
814
+ #
815
+ # Gets an AuthorizationRule for an Event Hub by rule name.
816
+ #
817
+ # @param resource_group_name [String] Name of the resource group within the
818
+ # azure subscription.
819
+ # @param namespace_name [String] The Namespace name
820
+ # @param event_hub_name [String] The Event Hub name
821
+ # @param authorization_rule_name [String] The authorization rule name.
822
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
823
+ # will be added to the HTTP request.
824
+ #
825
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
826
+ #
827
+ def post_authorization_rule_with_http_info(resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers:nil)
828
+ post_authorization_rule_async(resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers:custom_headers).value!
829
+ end
830
+
831
+ #
832
+ # Gets an AuthorizationRule for an Event Hub by rule name.
833
+ #
834
+ # @param resource_group_name [String] Name of the resource group within the
835
+ # azure subscription.
836
+ # @param namespace_name [String] The Namespace name
837
+ # @param event_hub_name [String] The Event Hub name
838
+ # @param authorization_rule_name [String] The authorization rule name.
839
+ # @param [Hash{String => String}] A hash of custom headers that will be added
840
+ # to the HTTP request.
841
+ #
842
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
843
+ #
844
+ def post_authorization_rule_async(resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers:nil)
845
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
846
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
847
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
848
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
849
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
850
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
851
+ fail ArgumentError, 'event_hub_name is nil' if event_hub_name.nil?
852
+ fail ArgumentError, "'event_hub_name' should satisfy the constraint - 'MaxLength': '50'" if !event_hub_name.nil? && event_hub_name.length > 50
853
+ fail ArgumentError, "'event_hub_name' should satisfy the constraint - 'MinLength': '1'" if !event_hub_name.nil? && event_hub_name.length < 1
854
+ fail ArgumentError, 'authorization_rule_name is nil' if authorization_rule_name.nil?
855
+ fail ArgumentError, "'authorization_rule_name' should satisfy the constraint - 'MaxLength': '50'" if !authorization_rule_name.nil? && authorization_rule_name.length > 50
856
+ fail ArgumentError, "'authorization_rule_name' should satisfy the constraint - 'MinLength': '1'" if !authorization_rule_name.nil? && authorization_rule_name.length < 1
857
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
858
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
859
+
860
+
861
+ request_headers = {}
862
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
863
+
864
+ # Set Headers
865
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
866
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
867
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}'
868
+
869
+ request_url = @base_url || @client.base_url
870
+
871
+ options = {
872
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
873
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'eventHubName' => event_hub_name,'authorizationRuleName' => authorization_rule_name,'subscriptionId' => @client.subscription_id},
874
+ query_params: {'api-version' => @client.api_version},
875
+ headers: request_headers.merge(custom_headers || {}),
876
+ base_url: request_url
877
+ }
878
+ promise = @client.make_request_async(:post, path_template, options)
879
+
880
+ promise = promise.then do |result|
881
+ http_response = result.response
882
+ status_code = http_response.status
883
+ response_content = http_response.body
884
+ unless status_code == 200
885
+ error_model = JSON.load(response_content)
886
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
887
+ end
888
+
889
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
890
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
891
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
892
+ # Deserialize Response
893
+ if status_code == 200
894
+ begin
895
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
896
+ result_mapper = Azure::EventHub::Mgmt::V2014_09_01::Models::SharedAccessAuthorizationRulePostResource.mapper()
897
+ result.body = @client.deserialize(result_mapper, parsed_response)
898
+ rescue Exception => e
899
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
900
+ end
901
+ end
902
+
903
+ result
904
+ end
905
+
906
+ promise.execute
907
+ end
908
+
909
+ #
910
+ # Deletes an Event Hub AuthorizationRule.
911
+ #
912
+ # @param resource_group_name [String] Name of the resource group within the
913
+ # azure subscription.
914
+ # @param namespace_name [String] The Namespace name
915
+ # @param event_hub_name [String] The Event Hub name
916
+ # @param authorization_rule_name [String] The authorization rule name.
917
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
918
+ # will be added to the HTTP request.
919
+ #
920
+ #
921
+ def delete_authorization_rule(resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers:nil)
922
+ response = delete_authorization_rule_async(resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers:custom_headers).value!
923
+ nil
924
+ end
925
+
926
+ #
927
+ # Deletes an Event Hub AuthorizationRule.
928
+ #
929
+ # @param resource_group_name [String] Name of the resource group within the
930
+ # azure subscription.
931
+ # @param namespace_name [String] The Namespace name
932
+ # @param event_hub_name [String] The Event Hub name
933
+ # @param authorization_rule_name [String] The authorization rule name.
934
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
935
+ # will be added to the HTTP request.
936
+ #
937
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
938
+ #
939
+ def delete_authorization_rule_with_http_info(resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers:nil)
940
+ delete_authorization_rule_async(resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers:custom_headers).value!
941
+ end
942
+
943
+ #
944
+ # Deletes an Event Hub AuthorizationRule.
945
+ #
946
+ # @param resource_group_name [String] Name of the resource group within the
947
+ # azure subscription.
948
+ # @param namespace_name [String] The Namespace name
949
+ # @param event_hub_name [String] The Event Hub name
950
+ # @param authorization_rule_name [String] The authorization rule name.
951
+ # @param [Hash{String => String}] A hash of custom headers that will be added
952
+ # to the HTTP request.
953
+ #
954
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
955
+ #
956
+ def delete_authorization_rule_async(resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers:nil)
957
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
958
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
959
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
960
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
961
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
962
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
963
+ fail ArgumentError, 'event_hub_name is nil' if event_hub_name.nil?
964
+ fail ArgumentError, "'event_hub_name' should satisfy the constraint - 'MaxLength': '50'" if !event_hub_name.nil? && event_hub_name.length > 50
965
+ fail ArgumentError, "'event_hub_name' should satisfy the constraint - 'MinLength': '1'" if !event_hub_name.nil? && event_hub_name.length < 1
966
+ fail ArgumentError, 'authorization_rule_name is nil' if authorization_rule_name.nil?
967
+ fail ArgumentError, "'authorization_rule_name' should satisfy the constraint - 'MaxLength': '50'" if !authorization_rule_name.nil? && authorization_rule_name.length > 50
968
+ fail ArgumentError, "'authorization_rule_name' should satisfy the constraint - 'MinLength': '1'" if !authorization_rule_name.nil? && authorization_rule_name.length < 1
969
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
970
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
971
+
972
+
973
+ request_headers = {}
974
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
975
+
976
+ # Set Headers
977
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
978
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
979
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}'
980
+
981
+ request_url = @base_url || @client.base_url
982
+
983
+ options = {
984
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
985
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'eventHubName' => event_hub_name,'authorizationRuleName' => authorization_rule_name,'subscriptionId' => @client.subscription_id},
986
+ query_params: {'api-version' => @client.api_version},
987
+ headers: request_headers.merge(custom_headers || {}),
988
+ base_url: request_url
989
+ }
990
+ promise = @client.make_request_async(:delete, path_template, options)
991
+
992
+ promise = promise.then do |result|
993
+ http_response = result.response
994
+ status_code = http_response.status
995
+ response_content = http_response.body
996
+ unless status_code == 204 || status_code == 200
997
+ error_model = JSON.load(response_content)
998
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
999
+ end
1000
+
1001
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1002
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1003
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1004
+
1005
+ result
1006
+ end
1007
+
1008
+ promise.execute
1009
+ end
1010
+
1011
+ #
1012
+ # Gets all the Event Hubs in a Namespace.
1013
+ #
1014
+ # @param next_page_link [String] The NextLink from the previous successful call
1015
+ # to List operation.
1016
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1017
+ # will be added to the HTTP request.
1018
+ #
1019
+ # @return [EventHubListResult] operation results.
1020
+ #
1021
+ def list_all_next(next_page_link, custom_headers:nil)
1022
+ response = list_all_next_async(next_page_link, custom_headers:custom_headers).value!
1023
+ response.body unless response.nil?
1024
+ end
1025
+
1026
+ #
1027
+ # Gets all the Event Hubs in a Namespace.
1028
+ #
1029
+ # @param next_page_link [String] The NextLink from the previous successful call
1030
+ # to List operation.
1031
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1032
+ # will be added to the HTTP request.
1033
+ #
1034
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1035
+ #
1036
+ def list_all_next_with_http_info(next_page_link, custom_headers:nil)
1037
+ list_all_next_async(next_page_link, custom_headers:custom_headers).value!
1038
+ end
1039
+
1040
+ #
1041
+ # Gets all the Event Hubs in a Namespace.
1042
+ #
1043
+ # @param next_page_link [String] The NextLink from the previous successful call
1044
+ # to List operation.
1045
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1046
+ # to the HTTP request.
1047
+ #
1048
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1049
+ #
1050
+ def list_all_next_async(next_page_link, custom_headers:nil)
1051
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1052
+
1053
+
1054
+ request_headers = {}
1055
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1056
+
1057
+ # Set Headers
1058
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1059
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1060
+ path_template = '{nextLink}'
1061
+
1062
+ request_url = @base_url || @client.base_url
1063
+
1064
+ options = {
1065
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1066
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1067
+ headers: request_headers.merge(custom_headers || {}),
1068
+ base_url: request_url
1069
+ }
1070
+ promise = @client.make_request_async(:get, path_template, options)
1071
+
1072
+ promise = promise.then do |result|
1073
+ http_response = result.response
1074
+ status_code = http_response.status
1075
+ response_content = http_response.body
1076
+ unless status_code == 200
1077
+ error_model = JSON.load(response_content)
1078
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1079
+ end
1080
+
1081
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1082
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1083
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1084
+ # Deserialize Response
1085
+ if status_code == 200
1086
+ begin
1087
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1088
+ result_mapper = Azure::EventHub::Mgmt::V2014_09_01::Models::EventHubListResult.mapper()
1089
+ result.body = @client.deserialize(result_mapper, parsed_response)
1090
+ rescue Exception => e
1091
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1092
+ end
1093
+ end
1094
+
1095
+ result
1096
+ end
1097
+
1098
+ promise.execute
1099
+ end
1100
+
1101
+ #
1102
+ # Gets the authorization rules for an Event Hub.
1103
+ #
1104
+ # @param next_page_link [String] The NextLink from the previous successful call
1105
+ # to List operation.
1106
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1107
+ # will be added to the HTTP request.
1108
+ #
1109
+ # @return [SharedAccessAuthorizationRuleListResult] operation results.
1110
+ #
1111
+ def list_authorization_rules_next(next_page_link, custom_headers:nil)
1112
+ response = list_authorization_rules_next_async(next_page_link, custom_headers:custom_headers).value!
1113
+ response.body unless response.nil?
1114
+ end
1115
+
1116
+ #
1117
+ # Gets the authorization rules for an Event Hub.
1118
+ #
1119
+ # @param next_page_link [String] The NextLink from the previous successful call
1120
+ # to List operation.
1121
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1122
+ # will be added to the HTTP request.
1123
+ #
1124
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1125
+ #
1126
+ def list_authorization_rules_next_with_http_info(next_page_link, custom_headers:nil)
1127
+ list_authorization_rules_next_async(next_page_link, custom_headers:custom_headers).value!
1128
+ end
1129
+
1130
+ #
1131
+ # Gets the authorization rules for an Event Hub.
1132
+ #
1133
+ # @param next_page_link [String] The NextLink from the previous successful call
1134
+ # to List operation.
1135
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1136
+ # to the HTTP request.
1137
+ #
1138
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1139
+ #
1140
+ def list_authorization_rules_next_async(next_page_link, custom_headers:nil)
1141
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1142
+
1143
+
1144
+ request_headers = {}
1145
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1146
+
1147
+ # Set Headers
1148
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1149
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1150
+ path_template = '{nextLink}'
1151
+
1152
+ request_url = @base_url || @client.base_url
1153
+
1154
+ options = {
1155
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1156
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1157
+ headers: request_headers.merge(custom_headers || {}),
1158
+ base_url: request_url
1159
+ }
1160
+ promise = @client.make_request_async(:get, path_template, options)
1161
+
1162
+ promise = promise.then do |result|
1163
+ http_response = result.response
1164
+ status_code = http_response.status
1165
+ response_content = http_response.body
1166
+ unless status_code == 200
1167
+ error_model = JSON.load(response_content)
1168
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1169
+ end
1170
+
1171
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1172
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1173
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1174
+ # Deserialize Response
1175
+ if status_code == 200
1176
+ begin
1177
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1178
+ result_mapper = Azure::EventHub::Mgmt::V2014_09_01::Models::SharedAccessAuthorizationRuleListResult.mapper()
1179
+ result.body = @client.deserialize(result_mapper, parsed_response)
1180
+ rescue Exception => e
1181
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1182
+ end
1183
+ end
1184
+
1185
+ result
1186
+ end
1187
+
1188
+ promise.execute
1189
+ end
1190
+
1191
+ #
1192
+ # Gets all the Event Hubs in a Namespace.
1193
+ #
1194
+ # @param resource_group_name [String] Name of the resource group within the
1195
+ # azure subscription.
1196
+ # @param namespace_name [String] The Namespace name
1197
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1198
+ # will be added to the HTTP request.
1199
+ #
1200
+ # @return [EventHubListResult] which provide lazy access to pages of the
1201
+ # response.
1202
+ #
1203
+ def list_all_as_lazy(resource_group_name, namespace_name, custom_headers:nil)
1204
+ response = list_all_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
1205
+ unless response.nil?
1206
+ page = response.body
1207
+ page.next_method = Proc.new do |next_page_link|
1208
+ list_all_next_async(next_page_link, custom_headers:custom_headers)
1209
+ end
1210
+ page
1211
+ end
1212
+ end
1213
+
1214
+ #
1215
+ # Gets the authorization rules for an Event Hub.
1216
+ #
1217
+ # @param resource_group_name [String] Name of the resource group within the
1218
+ # azure subscription.
1219
+ # @param namespace_name [String] The Namespace name
1220
+ # @param event_hub_name [String] The Event Hub name
1221
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1222
+ # will be added to the HTTP request.
1223
+ #
1224
+ # @return [SharedAccessAuthorizationRuleListResult] which provide lazy access
1225
+ # to pages of the response.
1226
+ #
1227
+ def list_authorization_rules_as_lazy(resource_group_name, namespace_name, event_hub_name, custom_headers:nil)
1228
+ response = list_authorization_rules_async(resource_group_name, namespace_name, event_hub_name, custom_headers:custom_headers).value!
1229
+ unless response.nil?
1230
+ page = response.body
1231
+ page.next_method = Proc.new do |next_page_link|
1232
+ list_authorization_rules_next_async(next_page_link, custom_headers:custom_headers)
1233
+ end
1234
+ page
1235
+ end
1236
+ end
1237
+
1238
+ end
1239
+ end