azure_mgmt_service_bus 0.16.0 → 0.17.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +5 -5
  2. data/lib/2015-08-01/generated/azure_mgmt_service_bus/models/check_name_availability.rb +1 -1
  3. data/lib/2015-08-01/generated/azure_mgmt_service_bus/models/namespace_list_result.rb +1 -1
  4. data/lib/2015-08-01/generated/azure_mgmt_service_bus/models/operation_list_result.rb +1 -1
  5. data/lib/2015-08-01/generated/azure_mgmt_service_bus/models/queue_list_result.rb +1 -1
  6. data/lib/2015-08-01/generated/azure_mgmt_service_bus/models/resource.rb +9 -0
  7. data/lib/2015-08-01/generated/azure_mgmt_service_bus/models/shared_access_authorization_rule_list_result.rb +1 -1
  8. data/lib/2015-08-01/generated/azure_mgmt_service_bus/models/subscription_list_result.rb +1 -1
  9. data/lib/2015-08-01/generated/azure_mgmt_service_bus/models/topic_create_or_update_parameters.rb +0 -12
  10. data/lib/2015-08-01/generated/azure_mgmt_service_bus/models/topic_list_result.rb +1 -1
  11. data/lib/2015-08-01/generated/azure_mgmt_service_bus/models/topic_resource.rb +0 -12
  12. data/lib/2015-08-01/generated/azure_mgmt_service_bus/namespaces.rb +15 -15
  13. data/lib/2015-08-01/generated/azure_mgmt_service_bus/queues.rb +126 -15
  14. data/lib/2015-08-01/generated/azure_mgmt_service_bus/service_bus_management_client.rb +7 -6
  15. data/lib/2015-08-01/generated/azure_mgmt_service_bus/topics.rb +129 -18
  16. data/lib/2017-04-01/generated/azure_mgmt_service_bus.rb +31 -20
  17. data/lib/2017-04-01/generated/azure_mgmt_service_bus/disaster_recovery_configs.rb +9 -9
  18. data/lib/2017-04-01/generated/azure_mgmt_service_bus/migration_configs.rb +777 -0
  19. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/arm_disaster_recovery.rb +14 -2
  20. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/arm_disaster_recovery_list_result.rb +1 -1
  21. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/check_name_availability.rb +1 -1
  22. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/correlation_filter.rb +19 -0
  23. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/default_action.rb +16 -0
  24. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/error_response.rb +1 -1
  25. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/event_hub_list_result.rb +1 -1
  26. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/migration_config_list_result.rb +100 -0
  27. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/migration_config_properties.rb +123 -0
  28. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/name_space_type.rb +19 -0
  29. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/network_rule_ipaction.rb +15 -0
  30. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/network_rule_set.rb +114 -0
  31. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/nwrule_set_ip_rules.rb +59 -0
  32. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/nwrule_set_virtual_network_rules.rb +59 -0
  33. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/operation_list_result.rb +1 -1
  34. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/premium_messaging_regions_list_result.rb +1 -1
  35. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/regenerate_access_key_parameters.rb +1 -1
  36. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/resource.rb +9 -0
  37. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/rule_list_result.rb +1 -1
  38. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/sbauthorization_rule_list_result.rb +1 -1
  39. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/sbnamespace.rb +1 -1
  40. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/sbnamespace_list_result.rb +1 -1
  41. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/sbnamespace_migrate.rb +48 -0
  42. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/sbnamespace_update_parameters.rb +1 -1
  43. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/sbqueue.rb +12 -0
  44. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/sbqueue_list_result.rb +1 -1
  45. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/sbsubscription_list_result.rb +1 -1
  46. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/sbtopic.rb +1 -1
  47. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/sbtopic_list_result.rb +1 -1
  48. data/lib/2017-04-01/generated/azure_mgmt_service_bus/models/subnet.rb +46 -0
  49. data/lib/2017-04-01/generated/azure_mgmt_service_bus/namespaces.rb +326 -15
  50. data/lib/2017-04-01/generated/azure_mgmt_service_bus/queues.rb +51 -23
  51. data/lib/2017-04-01/generated/azure_mgmt_service_bus/rules.rb +36 -8
  52. data/lib/2017-04-01/generated/azure_mgmt_service_bus/service_bus_management_client.rb +11 -6
  53. data/lib/2017-04-01/generated/azure_mgmt_service_bus/subscriptions.rb +36 -8
  54. data/lib/2017-04-01/generated/azure_mgmt_service_bus/topics.rb +54 -26
  55. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus.rb +53 -0
  56. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/default_action.rb +16 -0
  57. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/error_response.rb +58 -0
  58. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/ip_filter_rule.rb +96 -0
  59. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/ip_filter_rule_list_result.rb +100 -0
  60. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/ipaction.rb +16 -0
  61. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/network_rule_ipaction.rb +15 -0
  62. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/network_rule_set.rb +114 -0
  63. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/nwrule_set_ip_rules.rb +58 -0
  64. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/nwrule_set_virtual_network_rules.rb +59 -0
  65. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/operation.rb +59 -0
  66. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/operation_display.rb +72 -0
  67. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/operation_list_result.rb +103 -0
  68. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/resource.rb +80 -0
  69. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/resource_namespace_patch.rb +92 -0
  70. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/sbnamespace.rb +171 -0
  71. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/sbnamespace_list_result.rb +99 -0
  72. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/sbnamespace_update_parameters.rb +171 -0
  73. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/sbsku.rb +73 -0
  74. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/sku_name.rb +17 -0
  75. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/sku_tier.rb +17 -0
  76. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/subnet.rb +46 -0
  77. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/tracked_resource.rb +92 -0
  78. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/virtual_network_rule.rb +73 -0
  79. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/models/virtual_network_rule_list_result.rb +100 -0
  80. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/module_definition.rb +9 -0
  81. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb +2211 -0
  82. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/operations.rb +216 -0
  83. data/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/service_bus_management_client.rb +137 -0
  84. data/lib/azure_mgmt_service_bus.rb +2 -1
  85. data/lib/profiles/latest/modules/servicebus_profile_module.rb +107 -65
  86. data/lib/version.rb +1 -1
  87. metadata +45 -5
@@ -0,0 +1,777 @@
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::ServiceBus::Mgmt::V2017_04_01
7
+ #
8
+ # Azure Service Bus client
9
+ #
10
+ class MigrationConfigs
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the MigrationConfigs class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [ServiceBusManagementClient] reference to the ServiceBusManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Gets all migrationConfigurations
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<MigrationConfigProperties>] operation results.
34
+ #
35
+ def list(resource_group_name, namespace_name, custom_headers:nil)
36
+ first_page = list_as_lazy(resource_group_name, namespace_name, custom_headers:custom_headers)
37
+ first_page.get_all_items
38
+ end
39
+
40
+ #
41
+ # Gets all migrationConfigurations
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_with_http_info(resource_group_name, namespace_name, custom_headers:nil)
52
+ list_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
53
+ end
54
+
55
+ #
56
+ # Gets all migrationConfigurations
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_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.ServiceBus/namespaces/{namespaceName}/migrationConfigurations'
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 MsRest::HttpOperationError.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
+ # Deserialize Response
107
+ if status_code == 200
108
+ begin
109
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
110
+ result_mapper = Azure::ServiceBus::Mgmt::V2017_04_01::Models::MigrationConfigListResult.mapper()
111
+ result.body = @client.deserialize(result_mapper, parsed_response)
112
+ rescue Exception => e
113
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
114
+ end
115
+ end
116
+
117
+ result
118
+ end
119
+
120
+ promise.execute
121
+ end
122
+
123
+ #
124
+ # Creates Migration configuration and starts migration of entities from
125
+ # Standard to Premium namespace
126
+ #
127
+ # @param resource_group_name [String] Name of the Resource group within the
128
+ # Azure subscription.
129
+ # @param namespace_name [String] The namespace name
130
+ # @param parameters [MigrationConfigProperties] Parameters required to create
131
+ # Migration Configuration
132
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
133
+ # will be added to the HTTP request.
134
+ #
135
+ # @return [MigrationConfigProperties] operation results.
136
+ #
137
+ def create_and_start_migration(resource_group_name, namespace_name, parameters, custom_headers:nil)
138
+ response = create_and_start_migration_async(resource_group_name, namespace_name, parameters, custom_headers:custom_headers).value!
139
+ response.body unless response.nil?
140
+ end
141
+
142
+ #
143
+ # @param resource_group_name [String] Name of the Resource group within the
144
+ # Azure subscription.
145
+ # @param namespace_name [String] The namespace name
146
+ # @param parameters [MigrationConfigProperties] Parameters required to create
147
+ # Migration Configuration
148
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
149
+ # will be added to the HTTP request.
150
+ #
151
+ # @return [Concurrent::Promise] promise which provides async access to http
152
+ # response.
153
+ #
154
+ def create_and_start_migration_async(resource_group_name, namespace_name, parameters, custom_headers:nil)
155
+ # Send request
156
+ promise = begin_create_and_start_migration_async(resource_group_name, namespace_name, parameters, custom_headers:custom_headers)
157
+
158
+ promise = promise.then do |response|
159
+ # Defining deserialization method.
160
+ deserialize_method = lambda do |parsed_response|
161
+ result_mapper = Azure::ServiceBus::Mgmt::V2017_04_01::Models::MigrationConfigProperties.mapper()
162
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
163
+ end
164
+
165
+ # Waiting for response.
166
+ @client.get_long_running_operation_result(response, deserialize_method)
167
+ end
168
+
169
+ promise
170
+ end
171
+
172
+ #
173
+ # Deletes a MigrationConfiguration
174
+ #
175
+ # @param resource_group_name [String] Name of the Resource group within the
176
+ # Azure subscription.
177
+ # @param namespace_name [String] The namespace name
178
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
179
+ # will be added to the HTTP request.
180
+ #
181
+ #
182
+ def delete(resource_group_name, namespace_name, custom_headers:nil)
183
+ response = delete_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
184
+ nil
185
+ end
186
+
187
+ #
188
+ # Deletes a MigrationConfiguration
189
+ #
190
+ # @param resource_group_name [String] Name of the Resource group within the
191
+ # Azure subscription.
192
+ # @param namespace_name [String] The namespace name
193
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
194
+ # will be added to the HTTP request.
195
+ #
196
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
197
+ #
198
+ def delete_with_http_info(resource_group_name, namespace_name, custom_headers:nil)
199
+ delete_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
200
+ end
201
+
202
+ #
203
+ # Deletes a MigrationConfiguration
204
+ #
205
+ # @param resource_group_name [String] Name of the Resource group within the
206
+ # Azure subscription.
207
+ # @param namespace_name [String] The namespace name
208
+ # @param [Hash{String => String}] A hash of custom headers that will be added
209
+ # to the HTTP request.
210
+ #
211
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
212
+ #
213
+ def delete_async(resource_group_name, namespace_name, custom_headers:nil)
214
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
215
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
216
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
217
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
218
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
219
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
220
+ config_name = '$default'
221
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
222
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
223
+
224
+
225
+ request_headers = {}
226
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
227
+
228
+ # Set Headers
229
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
230
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
231
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'
232
+
233
+ request_url = @base_url || @client.base_url
234
+
235
+ options = {
236
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
237
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'configName' => config_name,'subscriptionId' => @client.subscription_id},
238
+ query_params: {'api-version' => @client.api_version},
239
+ headers: request_headers.merge(custom_headers || {}),
240
+ base_url: request_url
241
+ }
242
+ promise = @client.make_request_async(:delete, path_template, options)
243
+
244
+ promise = promise.then do |result|
245
+ http_response = result.response
246
+ status_code = http_response.status
247
+ response_content = http_response.body
248
+ unless status_code == 200 || status_code == 204
249
+ error_model = JSON.load(response_content)
250
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
251
+ end
252
+
253
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
254
+
255
+ result
256
+ end
257
+
258
+ promise.execute
259
+ end
260
+
261
+ #
262
+ # Retrieves Migration Config
263
+ #
264
+ # @param resource_group_name [String] Name of the Resource group within the
265
+ # Azure subscription.
266
+ # @param namespace_name [String] The namespace name
267
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
268
+ # will be added to the HTTP request.
269
+ #
270
+ # @return [MigrationConfigProperties] operation results.
271
+ #
272
+ def get(resource_group_name, namespace_name, custom_headers:nil)
273
+ response = get_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
274
+ response.body unless response.nil?
275
+ end
276
+
277
+ #
278
+ # Retrieves Migration Config
279
+ #
280
+ # @param resource_group_name [String] Name of the Resource group within the
281
+ # Azure subscription.
282
+ # @param namespace_name [String] The namespace name
283
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
284
+ # will be added to the HTTP request.
285
+ #
286
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
287
+ #
288
+ def get_with_http_info(resource_group_name, namespace_name, custom_headers:nil)
289
+ get_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
290
+ end
291
+
292
+ #
293
+ # Retrieves Migration Config
294
+ #
295
+ # @param resource_group_name [String] Name of the Resource group within the
296
+ # Azure subscription.
297
+ # @param namespace_name [String] The namespace name
298
+ # @param [Hash{String => String}] A hash of custom headers that will be added
299
+ # to the HTTP request.
300
+ #
301
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
302
+ #
303
+ def get_async(resource_group_name, namespace_name, custom_headers:nil)
304
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
305
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
306
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
307
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
308
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
309
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
310
+ config_name = '$default'
311
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
312
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
313
+
314
+
315
+ request_headers = {}
316
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
317
+
318
+ # Set Headers
319
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
320
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
321
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'
322
+
323
+ request_url = @base_url || @client.base_url
324
+
325
+ options = {
326
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
327
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'configName' => config_name,'subscriptionId' => @client.subscription_id},
328
+ query_params: {'api-version' => @client.api_version},
329
+ headers: request_headers.merge(custom_headers || {}),
330
+ base_url: request_url
331
+ }
332
+ promise = @client.make_request_async(:get, path_template, options)
333
+
334
+ promise = promise.then do |result|
335
+ http_response = result.response
336
+ status_code = http_response.status
337
+ response_content = http_response.body
338
+ unless status_code == 200
339
+ error_model = JSON.load(response_content)
340
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
341
+ end
342
+
343
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
344
+ # Deserialize Response
345
+ if status_code == 200
346
+ begin
347
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
348
+ result_mapper = Azure::ServiceBus::Mgmt::V2017_04_01::Models::MigrationConfigProperties.mapper()
349
+ result.body = @client.deserialize(result_mapper, parsed_response)
350
+ rescue Exception => e
351
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
352
+ end
353
+ end
354
+
355
+ result
356
+ end
357
+
358
+ promise.execute
359
+ end
360
+
361
+ #
362
+ # This operation Completes Migration of entities by pointing the connection
363
+ # strings to Premium namespace and any entities created after the operation
364
+ # will be under Premium Namespace. CompleteMigration operation will fail when
365
+ # entity migration is in-progress.
366
+ #
367
+ # @param resource_group_name [String] Name of the Resource group within the
368
+ # Azure subscription.
369
+ # @param namespace_name [String] The namespace name
370
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
371
+ # will be added to the HTTP request.
372
+ #
373
+ #
374
+ def complete_migration(resource_group_name, namespace_name, custom_headers:nil)
375
+ response = complete_migration_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
376
+ nil
377
+ end
378
+
379
+ #
380
+ # This operation Completes Migration of entities by pointing the connection
381
+ # strings to Premium namespace and any entities created after the operation
382
+ # will be under Premium Namespace. CompleteMigration operation will fail when
383
+ # entity migration is in-progress.
384
+ #
385
+ # @param resource_group_name [String] Name of the Resource group within the
386
+ # Azure subscription.
387
+ # @param namespace_name [String] The namespace name
388
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
389
+ # will be added to the HTTP request.
390
+ #
391
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
392
+ #
393
+ def complete_migration_with_http_info(resource_group_name, namespace_name, custom_headers:nil)
394
+ complete_migration_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
395
+ end
396
+
397
+ #
398
+ # This operation Completes Migration of entities by pointing the connection
399
+ # strings to Premium namespace and any entities created after the operation
400
+ # will be under Premium Namespace. CompleteMigration operation will fail when
401
+ # entity migration is in-progress.
402
+ #
403
+ # @param resource_group_name [String] Name of the Resource group within the
404
+ # Azure subscription.
405
+ # @param namespace_name [String] The namespace name
406
+ # @param [Hash{String => String}] A hash of custom headers that will be added
407
+ # to the HTTP request.
408
+ #
409
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
410
+ #
411
+ def complete_migration_async(resource_group_name, namespace_name, custom_headers:nil)
412
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
413
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
414
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
415
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
416
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
417
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
418
+ config_name = '$default'
419
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
420
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
421
+
422
+
423
+ request_headers = {}
424
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
425
+
426
+ # Set Headers
427
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
428
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
429
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade'
430
+
431
+ request_url = @base_url || @client.base_url
432
+
433
+ options = {
434
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
435
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'configName' => config_name,'subscriptionId' => @client.subscription_id},
436
+ query_params: {'api-version' => @client.api_version},
437
+ headers: request_headers.merge(custom_headers || {}),
438
+ base_url: request_url
439
+ }
440
+ promise = @client.make_request_async(:post, path_template, options)
441
+
442
+ promise = promise.then do |result|
443
+ http_response = result.response
444
+ status_code = http_response.status
445
+ response_content = http_response.body
446
+ unless status_code == 200
447
+ error_model = JSON.load(response_content)
448
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
449
+ end
450
+
451
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
452
+
453
+ result
454
+ end
455
+
456
+ promise.execute
457
+ end
458
+
459
+ #
460
+ # This operation reverts Migration
461
+ #
462
+ # @param resource_group_name [String] Name of the Resource group within the
463
+ # Azure subscription.
464
+ # @param namespace_name [String] The namespace name
465
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
466
+ # will be added to the HTTP request.
467
+ #
468
+ #
469
+ def revert(resource_group_name, namespace_name, custom_headers:nil)
470
+ response = revert_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
471
+ nil
472
+ end
473
+
474
+ #
475
+ # This operation reverts Migration
476
+ #
477
+ # @param resource_group_name [String] Name of the Resource group within the
478
+ # Azure subscription.
479
+ # @param namespace_name [String] The namespace name
480
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
481
+ # will be added to the HTTP request.
482
+ #
483
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
484
+ #
485
+ def revert_with_http_info(resource_group_name, namespace_name, custom_headers:nil)
486
+ revert_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
487
+ end
488
+
489
+ #
490
+ # This operation reverts Migration
491
+ #
492
+ # @param resource_group_name [String] Name of the Resource group within the
493
+ # Azure subscription.
494
+ # @param namespace_name [String] The namespace name
495
+ # @param [Hash{String => String}] A hash of custom headers that will be added
496
+ # to the HTTP request.
497
+ #
498
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
499
+ #
500
+ def revert_async(resource_group_name, namespace_name, custom_headers:nil)
501
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
502
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
503
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
504
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
505
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
506
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
507
+ config_name = '$default'
508
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
509
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
510
+
511
+
512
+ request_headers = {}
513
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
514
+
515
+ # Set Headers
516
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
517
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
518
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert'
519
+
520
+ request_url = @base_url || @client.base_url
521
+
522
+ options = {
523
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
524
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'configName' => config_name,'subscriptionId' => @client.subscription_id},
525
+ query_params: {'api-version' => @client.api_version},
526
+ headers: request_headers.merge(custom_headers || {}),
527
+ base_url: request_url
528
+ }
529
+ promise = @client.make_request_async(:post, path_template, options)
530
+
531
+ promise = promise.then do |result|
532
+ http_response = result.response
533
+ status_code = http_response.status
534
+ response_content = http_response.body
535
+ unless status_code == 200
536
+ error_model = JSON.load(response_content)
537
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
538
+ end
539
+
540
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
541
+
542
+ result
543
+ end
544
+
545
+ promise.execute
546
+ end
547
+
548
+ #
549
+ # Creates Migration configuration and starts migration of entities from
550
+ # Standard to Premium namespace
551
+ #
552
+ # @param resource_group_name [String] Name of the Resource group within the
553
+ # Azure subscription.
554
+ # @param namespace_name [String] The namespace name
555
+ # @param parameters [MigrationConfigProperties] Parameters required to create
556
+ # Migration Configuration
557
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
558
+ # will be added to the HTTP request.
559
+ #
560
+ # @return [MigrationConfigProperties] operation results.
561
+ #
562
+ def begin_create_and_start_migration(resource_group_name, namespace_name, parameters, custom_headers:nil)
563
+ response = begin_create_and_start_migration_async(resource_group_name, namespace_name, parameters, custom_headers:custom_headers).value!
564
+ response.body unless response.nil?
565
+ end
566
+
567
+ #
568
+ # Creates Migration configuration and starts migration of entities from
569
+ # Standard to Premium namespace
570
+ #
571
+ # @param resource_group_name [String] Name of the Resource group within the
572
+ # Azure subscription.
573
+ # @param namespace_name [String] The namespace name
574
+ # @param parameters [MigrationConfigProperties] Parameters required to create
575
+ # Migration Configuration
576
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
577
+ # will be added to the HTTP request.
578
+ #
579
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
580
+ #
581
+ def begin_create_and_start_migration_with_http_info(resource_group_name, namespace_name, parameters, custom_headers:nil)
582
+ begin_create_and_start_migration_async(resource_group_name, namespace_name, parameters, custom_headers:custom_headers).value!
583
+ end
584
+
585
+ #
586
+ # Creates Migration configuration and starts migration of entities from
587
+ # Standard to Premium namespace
588
+ #
589
+ # @param resource_group_name [String] Name of the Resource group within the
590
+ # Azure subscription.
591
+ # @param namespace_name [String] The namespace name
592
+ # @param parameters [MigrationConfigProperties] Parameters required to create
593
+ # Migration Configuration
594
+ # @param [Hash{String => String}] A hash of custom headers that will be added
595
+ # to the HTTP request.
596
+ #
597
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
598
+ #
599
+ def begin_create_and_start_migration_async(resource_group_name, namespace_name, parameters, custom_headers:nil)
600
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
601
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
602
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
603
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
604
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
605
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
606
+ config_name = '$default'
607
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
608
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
609
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
610
+
611
+
612
+ request_headers = {}
613
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
614
+
615
+ # Set Headers
616
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
617
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
618
+
619
+ # Serialize Request
620
+ request_mapper = Azure::ServiceBus::Mgmt::V2017_04_01::Models::MigrationConfigProperties.mapper()
621
+ request_content = @client.serialize(request_mapper, parameters)
622
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
623
+
624
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'
625
+
626
+ request_url = @base_url || @client.base_url
627
+
628
+ options = {
629
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
630
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'configName' => config_name,'subscriptionId' => @client.subscription_id},
631
+ query_params: {'api-version' => @client.api_version},
632
+ body: request_content,
633
+ headers: request_headers.merge(custom_headers || {}),
634
+ base_url: request_url
635
+ }
636
+ promise = @client.make_request_async(:put, path_template, options)
637
+
638
+ promise = promise.then do |result|
639
+ http_response = result.response
640
+ status_code = http_response.status
641
+ response_content = http_response.body
642
+ unless status_code == 200 || status_code == 201
643
+ error_model = JSON.load(response_content)
644
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
645
+ end
646
+
647
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
648
+ # Deserialize Response
649
+ if status_code == 200
650
+ begin
651
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
652
+ result_mapper = Azure::ServiceBus::Mgmt::V2017_04_01::Models::MigrationConfigProperties.mapper()
653
+ result.body = @client.deserialize(result_mapper, parsed_response)
654
+ rescue Exception => e
655
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
656
+ end
657
+ end
658
+
659
+ result
660
+ end
661
+
662
+ promise.execute
663
+ end
664
+
665
+ #
666
+ # Gets all migrationConfigurations
667
+ #
668
+ # @param next_page_link [String] The NextLink from the previous successful call
669
+ # to List operation.
670
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
671
+ # will be added to the HTTP request.
672
+ #
673
+ # @return [MigrationConfigListResult] operation results.
674
+ #
675
+ def list_next(next_page_link, custom_headers:nil)
676
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
677
+ response.body unless response.nil?
678
+ end
679
+
680
+ #
681
+ # Gets all migrationConfigurations
682
+ #
683
+ # @param next_page_link [String] The NextLink from the previous successful call
684
+ # to List operation.
685
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
686
+ # will be added to the HTTP request.
687
+ #
688
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
689
+ #
690
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
691
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
692
+ end
693
+
694
+ #
695
+ # Gets all migrationConfigurations
696
+ #
697
+ # @param next_page_link [String] The NextLink from the previous successful call
698
+ # to List operation.
699
+ # @param [Hash{String => String}] A hash of custom headers that will be added
700
+ # to the HTTP request.
701
+ #
702
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
703
+ #
704
+ def list_next_async(next_page_link, custom_headers:nil)
705
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
706
+
707
+
708
+ request_headers = {}
709
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
710
+
711
+ # Set Headers
712
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
713
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
714
+ path_template = '{nextLink}'
715
+
716
+ request_url = @base_url || @client.base_url
717
+
718
+ options = {
719
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
720
+ skip_encoding_path_params: {'nextLink' => next_page_link},
721
+ headers: request_headers.merge(custom_headers || {}),
722
+ base_url: request_url
723
+ }
724
+ promise = @client.make_request_async(:get, path_template, options)
725
+
726
+ promise = promise.then do |result|
727
+ http_response = result.response
728
+ status_code = http_response.status
729
+ response_content = http_response.body
730
+ unless status_code == 200
731
+ error_model = JSON.load(response_content)
732
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
733
+ end
734
+
735
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
736
+ # Deserialize Response
737
+ if status_code == 200
738
+ begin
739
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
740
+ result_mapper = Azure::ServiceBus::Mgmt::V2017_04_01::Models::MigrationConfigListResult.mapper()
741
+ result.body = @client.deserialize(result_mapper, parsed_response)
742
+ rescue Exception => e
743
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
744
+ end
745
+ end
746
+
747
+ result
748
+ end
749
+
750
+ promise.execute
751
+ end
752
+
753
+ #
754
+ # Gets all migrationConfigurations
755
+ #
756
+ # @param resource_group_name [String] Name of the Resource group within the
757
+ # Azure subscription.
758
+ # @param namespace_name [String] The namespace name
759
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
760
+ # will be added to the HTTP request.
761
+ #
762
+ # @return [MigrationConfigListResult] which provide lazy access to pages of the
763
+ # response.
764
+ #
765
+ def list_as_lazy(resource_group_name, namespace_name, custom_headers:nil)
766
+ response = list_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
767
+ unless response.nil?
768
+ page = response.body
769
+ page.next_method = Proc.new do |next_page_link|
770
+ list_next_async(next_page_link, custom_headers:custom_headers)
771
+ end
772
+ page
773
+ end
774
+ end
775
+
776
+ end
777
+ end