azure_mgmt_confluent 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2020-03-01/generated/azure_mgmt_confluent.rb +47 -0
  4. data/lib/2020-03-01/generated/azure_mgmt_confluent/confluent_management_client.rb +139 -0
  5. data/lib/2020-03-01/generated/azure_mgmt_confluent/marketplace_agreements.rb +317 -0
  6. data/lib/2020-03-01/generated/azure_mgmt_confluent/models/confluent_agreement_resource.rb +161 -0
  7. data/lib/2020-03-01/generated/azure_mgmt_confluent/models/confluent_agreement_resource_list_response.rb +100 -0
  8. data/lib/2020-03-01/generated/azure_mgmt_confluent/models/error_response_body.rb +94 -0
  9. data/lib/2020-03-01/generated/azure_mgmt_confluent/models/offer_detail.rb +119 -0
  10. data/lib/2020-03-01/generated/azure_mgmt_confluent/models/operation_display.rb +80 -0
  11. data/lib/2020-03-01/generated/azure_mgmt_confluent/models/operation_list_result.rb +100 -0
  12. data/lib/2020-03-01/generated/azure_mgmt_confluent/models/operation_result.rb +69 -0
  13. data/lib/2020-03-01/generated/azure_mgmt_confluent/models/organization_resource.rb +176 -0
  14. data/lib/2020-03-01/generated/azure_mgmt_confluent/models/organization_resource_list_result.rb +98 -0
  15. data/lib/2020-03-01/generated/azure_mgmt_confluent/models/organization_resource_properties.rb +110 -0
  16. data/lib/2020-03-01/generated/azure_mgmt_confluent/models/organization_resource_properties_offer_detail.rb +99 -0
  17. data/lib/2020-03-01/generated/azure_mgmt_confluent/models/organization_resource_properties_user_detail.rb +68 -0
  18. data/lib/2020-03-01/generated/azure_mgmt_confluent/models/organization_resource_update.rb +54 -0
  19. data/lib/2020-03-01/generated/azure_mgmt_confluent/models/provision_state.rb +23 -0
  20. data/lib/2020-03-01/generated/azure_mgmt_confluent/models/resource_provider_default_error_response.rb +50 -0
  21. data/lib/2020-03-01/generated/azure_mgmt_confluent/models/saa_soffer_status.rb +24 -0
  22. data/lib/2020-03-01/generated/azure_mgmt_confluent/models/user_detail.rb +77 -0
  23. data/lib/2020-03-01/generated/azure_mgmt_confluent/module_definition.rb +9 -0
  24. data/lib/2020-03-01/generated/azure_mgmt_confluent/organization.rb +899 -0
  25. data/lib/2020-03-01/generated/azure_mgmt_confluent/organization_operations.rb +219 -0
  26. data/lib/azure_mgmt_confluent.rb +6 -0
  27. data/lib/module_definition.rb +7 -0
  28. data/lib/profiles/latest/confluent_latest_profile_client.rb +40 -0
  29. data/lib/profiles/latest/confluent_module_definition.rb +8 -0
  30. data/lib/profiles/latest/modules/confluent_profile_module.rb +133 -0
  31. data/lib/version.rb +7 -0
  32. metadata +147 -0
@@ -0,0 +1,9 @@
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 end
7
+ module Azure::Confluent end
8
+ module Azure::Confluent::Mgmt end
9
+ module Azure::Confluent::Mgmt::V2020_03_01 end
@@ -0,0 +1,899 @@
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::Confluent::Mgmt::V2020_03_01
7
+ #
8
+ # Organization
9
+ #
10
+ class Organization
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Organization class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [ConfluentManagementClient] reference to the ConfluentManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # List all organizations under the specified subscription.
26
+ #
27
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
28
+ # will be added to the HTTP request.
29
+ #
30
+ # @return [Array<OrganizationResource>] operation results.
31
+ #
32
+ def list_by_subscription(custom_headers:nil)
33
+ first_page = list_by_subscription_as_lazy(custom_headers:custom_headers)
34
+ first_page.get_all_items
35
+ end
36
+
37
+ #
38
+ # List all organizations under the specified subscription.
39
+ #
40
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
+ # will be added to the HTTP request.
42
+ #
43
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
44
+ #
45
+ def list_by_subscription_with_http_info(custom_headers:nil)
46
+ list_by_subscription_async(custom_headers:custom_headers).value!
47
+ end
48
+
49
+ #
50
+ # List all organizations under the specified subscription.
51
+ #
52
+ # @param [Hash{String => String}] A hash of custom headers that will be added
53
+ # to the HTTP request.
54
+ #
55
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
56
+ #
57
+ def list_by_subscription_async(custom_headers:nil)
58
+ @client.api_version = '2020-03-01'
59
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
60
+
61
+
62
+ request_headers = {}
63
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
64
+
65
+ # Set Headers
66
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
67
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
68
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Confluent/organizations'
69
+
70
+ request_url = @base_url || @client.base_url
71
+
72
+ options = {
73
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
74
+ path_params: {'subscriptionId' => @client.subscription_id},
75
+ query_params: {'api-version' => @client.api_version},
76
+ headers: request_headers.merge(custom_headers || {}),
77
+ base_url: request_url
78
+ }
79
+ promise = @client.make_request_async(:get, path_template, options)
80
+
81
+ promise = promise.then do |result|
82
+ http_response = result.response
83
+ status_code = http_response.status
84
+ response_content = http_response.body
85
+ unless status_code == 200
86
+ error_model = JSON.load(response_content)
87
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
88
+ end
89
+
90
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
91
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
92
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
93
+ # Deserialize Response
94
+ if status_code == 200
95
+ begin
96
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
97
+ result_mapper = Azure::Confluent::Mgmt::V2020_03_01::Models::OrganizationResourceListResult.mapper()
98
+ result.body = @client.deserialize(result_mapper, parsed_response)
99
+ rescue Exception => e
100
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
101
+ end
102
+ end
103
+
104
+ result
105
+ end
106
+
107
+ promise.execute
108
+ end
109
+
110
+ #
111
+ # List all Organizations under the specified resource group.
112
+ #
113
+ # @param resource_group_name [String] Resource group name
114
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
115
+ # will be added to the HTTP request.
116
+ #
117
+ # @return [Array<OrganizationResource>] operation results.
118
+ #
119
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
120
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
121
+ first_page.get_all_items
122
+ end
123
+
124
+ #
125
+ # List all Organizations under the specified resource group.
126
+ #
127
+ # @param resource_group_name [String] Resource group name
128
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
129
+ # will be added to the HTTP request.
130
+ #
131
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
132
+ #
133
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
134
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
135
+ end
136
+
137
+ #
138
+ # List all Organizations under the specified resource group.
139
+ #
140
+ # @param resource_group_name [String] Resource group name
141
+ # @param [Hash{String => String}] A hash of custom headers that will be added
142
+ # to the HTTP request.
143
+ #
144
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
145
+ #
146
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
147
+ @client.api_version = '2020-03-01'
148
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
149
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
150
+
151
+
152
+ request_headers = {}
153
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
154
+
155
+ # Set Headers
156
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
157
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
158
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations'
159
+
160
+ request_url = @base_url || @client.base_url
161
+
162
+ options = {
163
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
164
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
165
+ query_params: {'api-version' => @client.api_version},
166
+ headers: request_headers.merge(custom_headers || {}),
167
+ base_url: request_url
168
+ }
169
+ promise = @client.make_request_async(:get, path_template, options)
170
+
171
+ promise = promise.then do |result|
172
+ http_response = result.response
173
+ status_code = http_response.status
174
+ response_content = http_response.body
175
+ unless status_code == 200
176
+ error_model = JSON.load(response_content)
177
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
178
+ end
179
+
180
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
181
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
182
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
183
+ # Deserialize Response
184
+ if status_code == 200
185
+ begin
186
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
187
+ result_mapper = Azure::Confluent::Mgmt::V2020_03_01::Models::OrganizationResourceListResult.mapper()
188
+ result.body = @client.deserialize(result_mapper, parsed_response)
189
+ rescue Exception => e
190
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
191
+ end
192
+ end
193
+
194
+ result
195
+ end
196
+
197
+ promise.execute
198
+ end
199
+
200
+ #
201
+ # Get the properties of a specific Organization resource.
202
+ #
203
+ # @param resource_group_name [String] Resource group name
204
+ # @param organization_name [String] Organization resource name
205
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
206
+ # will be added to the HTTP request.
207
+ #
208
+ # @return [OrganizationResource] operation results.
209
+ #
210
+ def get(resource_group_name, organization_name, custom_headers:nil)
211
+ response = get_async(resource_group_name, organization_name, custom_headers:custom_headers).value!
212
+ response.body unless response.nil?
213
+ end
214
+
215
+ #
216
+ # Get the properties of a specific Organization resource.
217
+ #
218
+ # @param resource_group_name [String] Resource group name
219
+ # @param organization_name [String] Organization resource name
220
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
221
+ # will be added to the HTTP request.
222
+ #
223
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
224
+ #
225
+ def get_with_http_info(resource_group_name, organization_name, custom_headers:nil)
226
+ get_async(resource_group_name, organization_name, custom_headers:custom_headers).value!
227
+ end
228
+
229
+ #
230
+ # Get the properties of a specific Organization resource.
231
+ #
232
+ # @param resource_group_name [String] Resource group name
233
+ # @param organization_name [String] Organization resource name
234
+ # @param [Hash{String => String}] A hash of custom headers that will be added
235
+ # to the HTTP request.
236
+ #
237
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
238
+ #
239
+ def get_async(resource_group_name, organization_name, custom_headers:nil)
240
+ @client.api_version = '2020-03-01'
241
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
242
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
243
+ fail ArgumentError, 'organization_name is nil' if organization_name.nil?
244
+
245
+
246
+ request_headers = {}
247
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
248
+
249
+ # Set Headers
250
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
251
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
252
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'
253
+
254
+ request_url = @base_url || @client.base_url
255
+
256
+ options = {
257
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
258
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'organizationName' => organization_name},
259
+ query_params: {'api-version' => @client.api_version},
260
+ headers: request_headers.merge(custom_headers || {}),
261
+ base_url: request_url
262
+ }
263
+ promise = @client.make_request_async(:get, path_template, options)
264
+
265
+ promise = promise.then do |result|
266
+ http_response = result.response
267
+ status_code = http_response.status
268
+ response_content = http_response.body
269
+ unless status_code == 200
270
+ error_model = JSON.load(response_content)
271
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
272
+ end
273
+
274
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
275
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
276
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
277
+ # Deserialize Response
278
+ if status_code == 200
279
+ begin
280
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
281
+ result_mapper = Azure::Confluent::Mgmt::V2020_03_01::Models::OrganizationResource.mapper()
282
+ result.body = @client.deserialize(result_mapper, parsed_response)
283
+ rescue Exception => e
284
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
285
+ end
286
+ end
287
+
288
+ result
289
+ end
290
+
291
+ promise.execute
292
+ end
293
+
294
+ #
295
+ # Create Organization resource
296
+ #
297
+ # @param resource_group_name [String] Resource group name
298
+ # @param organization_name [String] Organization resource name
299
+ # @param body [OrganizationResource] Organization resource model
300
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
301
+ # will be added to the HTTP request.
302
+ #
303
+ # @return [OrganizationResource] operation results.
304
+ #
305
+ def create(resource_group_name, organization_name, body:nil, custom_headers:nil)
306
+ response = create_async(resource_group_name, organization_name, body:body, custom_headers:custom_headers).value!
307
+ response.body unless response.nil?
308
+ end
309
+
310
+ #
311
+ # @param resource_group_name [String] Resource group name
312
+ # @param organization_name [String] Organization resource name
313
+ # @param body [OrganizationResource] Organization resource model
314
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
315
+ # will be added to the HTTP request.
316
+ #
317
+ # @return [Concurrent::Promise] promise which provides async access to http
318
+ # response.
319
+ #
320
+ def create_async(resource_group_name, organization_name, body:nil, custom_headers:nil)
321
+ # Send request
322
+ promise = begin_create_async(resource_group_name, organization_name, body:body, custom_headers:custom_headers)
323
+
324
+ promise = promise.then do |response|
325
+ # Defining deserialization method.
326
+ deserialize_method = lambda do |parsed_response|
327
+ result_mapper = Azure::Confluent::Mgmt::V2020_03_01::Models::OrganizationResource.mapper()
328
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
329
+ end
330
+
331
+ # Waiting for response.
332
+ @client.get_long_running_operation_result(response, deserialize_method)
333
+ end
334
+
335
+ promise
336
+ end
337
+
338
+ #
339
+ # Update Organization resource
340
+ #
341
+ # @param resource_group_name [String] Resource group name
342
+ # @param organization_name [String] Organization resource name
343
+ # @param body [OrganizationResourceUpdate] Updated Organization resource
344
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
345
+ # will be added to the HTTP request.
346
+ #
347
+ # @return [OrganizationResource] operation results.
348
+ #
349
+ def update(resource_group_name, organization_name, body:nil, custom_headers:nil)
350
+ response = update_async(resource_group_name, organization_name, body:body, custom_headers:custom_headers).value!
351
+ response.body unless response.nil?
352
+ end
353
+
354
+ #
355
+ # Update Organization resource
356
+ #
357
+ # @param resource_group_name [String] Resource group name
358
+ # @param organization_name [String] Organization resource name
359
+ # @param body [OrganizationResourceUpdate] Updated Organization resource
360
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
361
+ # will be added to the HTTP request.
362
+ #
363
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
364
+ #
365
+ def update_with_http_info(resource_group_name, organization_name, body:nil, custom_headers:nil)
366
+ update_async(resource_group_name, organization_name, body:body, custom_headers:custom_headers).value!
367
+ end
368
+
369
+ #
370
+ # Update Organization resource
371
+ #
372
+ # @param resource_group_name [String] Resource group name
373
+ # @param organization_name [String] Organization resource name
374
+ # @param body [OrganizationResourceUpdate] Updated Organization resource
375
+ # @param [Hash{String => String}] A hash of custom headers that will be added
376
+ # to the HTTP request.
377
+ #
378
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
379
+ #
380
+ def update_async(resource_group_name, organization_name, body:nil, custom_headers:nil)
381
+ @client.api_version = '2020-03-01'
382
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
383
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
384
+ fail ArgumentError, 'organization_name is nil' if organization_name.nil?
385
+
386
+
387
+ request_headers = {}
388
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
389
+
390
+ # Set Headers
391
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
392
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
393
+
394
+ # Serialize Request
395
+ request_mapper = Azure::Confluent::Mgmt::V2020_03_01::Models::OrganizationResourceUpdate.mapper()
396
+ request_content = @client.serialize(request_mapper, body)
397
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
398
+
399
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'
400
+
401
+ request_url = @base_url || @client.base_url
402
+
403
+ options = {
404
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
405
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'organizationName' => organization_name},
406
+ query_params: {'api-version' => @client.api_version},
407
+ body: request_content,
408
+ headers: request_headers.merge(custom_headers || {}),
409
+ base_url: request_url
410
+ }
411
+ promise = @client.make_request_async(:patch, path_template, options)
412
+
413
+ promise = promise.then do |result|
414
+ http_response = result.response
415
+ status_code = http_response.status
416
+ response_content = http_response.body
417
+ unless status_code == 200
418
+ error_model = JSON.load(response_content)
419
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
420
+ end
421
+
422
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
423
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
424
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
425
+ # Deserialize Response
426
+ if status_code == 200
427
+ begin
428
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
429
+ result_mapper = Azure::Confluent::Mgmt::V2020_03_01::Models::OrganizationResource.mapper()
430
+ result.body = @client.deserialize(result_mapper, parsed_response)
431
+ rescue Exception => e
432
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
433
+ end
434
+ end
435
+
436
+ result
437
+ end
438
+
439
+ promise.execute
440
+ end
441
+
442
+ #
443
+ # Delete Organization resource
444
+ #
445
+ # @param resource_group_name [String] Resource group name
446
+ # @param organization_name [String] Organization resource name
447
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
448
+ # will be added to the HTTP request.
449
+ #
450
+ def delete(resource_group_name, organization_name, custom_headers:nil)
451
+ response = delete_async(resource_group_name, organization_name, custom_headers:custom_headers).value!
452
+ nil
453
+ end
454
+
455
+ #
456
+ # @param resource_group_name [String] Resource group name
457
+ # @param organization_name [String] Organization resource name
458
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
459
+ # will be added to the HTTP request.
460
+ #
461
+ # @return [Concurrent::Promise] promise which provides async access to http
462
+ # response.
463
+ #
464
+ def delete_async(resource_group_name, organization_name, custom_headers:nil)
465
+ # Send request
466
+ promise = begin_delete_async(resource_group_name, organization_name, custom_headers:custom_headers)
467
+
468
+ promise = promise.then do |response|
469
+ # Defining deserialization method.
470
+ deserialize_method = lambda do |parsed_response|
471
+ end
472
+
473
+ # Waiting for response.
474
+ @client.get_long_running_operation_result(response, deserialize_method)
475
+ end
476
+
477
+ promise
478
+ end
479
+
480
+ #
481
+ # Create Organization resource
482
+ #
483
+ # @param resource_group_name [String] Resource group name
484
+ # @param organization_name [String] Organization resource name
485
+ # @param body [OrganizationResource] Organization resource model
486
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
487
+ # will be added to the HTTP request.
488
+ #
489
+ # @return [OrganizationResource] operation results.
490
+ #
491
+ def begin_create(resource_group_name, organization_name, body:nil, custom_headers:nil)
492
+ response = begin_create_async(resource_group_name, organization_name, body:body, custom_headers:custom_headers).value!
493
+ response.body unless response.nil?
494
+ end
495
+
496
+ #
497
+ # Create Organization resource
498
+ #
499
+ # @param resource_group_name [String] Resource group name
500
+ # @param organization_name [String] Organization resource name
501
+ # @param body [OrganizationResource] Organization resource model
502
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
503
+ # will be added to the HTTP request.
504
+ #
505
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
506
+ #
507
+ def begin_create_with_http_info(resource_group_name, organization_name, body:nil, custom_headers:nil)
508
+ begin_create_async(resource_group_name, organization_name, body:body, custom_headers:custom_headers).value!
509
+ end
510
+
511
+ #
512
+ # Create Organization resource
513
+ #
514
+ # @param resource_group_name [String] Resource group name
515
+ # @param organization_name [String] Organization resource name
516
+ # @param body [OrganizationResource] Organization resource model
517
+ # @param [Hash{String => String}] A hash of custom headers that will be added
518
+ # to the HTTP request.
519
+ #
520
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
521
+ #
522
+ def begin_create_async(resource_group_name, organization_name, body:nil, custom_headers:nil)
523
+ @client.api_version = '2020-03-01'
524
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
525
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
526
+ fail ArgumentError, 'organization_name is nil' if organization_name.nil?
527
+
528
+
529
+ request_headers = {}
530
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
531
+
532
+ # Set Headers
533
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
534
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
535
+
536
+ # Serialize Request
537
+ request_mapper = Azure::Confluent::Mgmt::V2020_03_01::Models::OrganizationResource.mapper()
538
+ request_content = @client.serialize(request_mapper, body)
539
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
540
+
541
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'
542
+
543
+ request_url = @base_url || @client.base_url
544
+
545
+ options = {
546
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
547
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'organizationName' => organization_name},
548
+ query_params: {'api-version' => @client.api_version},
549
+ body: request_content,
550
+ headers: request_headers.merge(custom_headers || {}),
551
+ base_url: request_url
552
+ }
553
+ promise = @client.make_request_async(:put, path_template, options)
554
+
555
+ promise = promise.then do |result|
556
+ http_response = result.response
557
+ status_code = http_response.status
558
+ response_content = http_response.body
559
+ unless status_code == 200 || status_code == 201
560
+ error_model = JSON.load(response_content)
561
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
562
+ end
563
+
564
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
565
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
566
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
567
+ # Deserialize Response
568
+ if status_code == 200
569
+ begin
570
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
571
+ result_mapper = Azure::Confluent::Mgmt::V2020_03_01::Models::OrganizationResource.mapper()
572
+ result.body = @client.deserialize(result_mapper, parsed_response)
573
+ rescue Exception => e
574
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
575
+ end
576
+ end
577
+ # Deserialize Response
578
+ if status_code == 201
579
+ begin
580
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
581
+ result_mapper = Azure::Confluent::Mgmt::V2020_03_01::Models::OrganizationResource.mapper()
582
+ result.body = @client.deserialize(result_mapper, parsed_response)
583
+ rescue Exception => e
584
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
585
+ end
586
+ end
587
+
588
+ result
589
+ end
590
+
591
+ promise.execute
592
+ end
593
+
594
+ #
595
+ # Delete Organization resource
596
+ #
597
+ # @param resource_group_name [String] Resource group name
598
+ # @param organization_name [String] Organization resource name
599
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
600
+ # will be added to the HTTP request.
601
+ #
602
+ #
603
+ def begin_delete(resource_group_name, organization_name, custom_headers:nil)
604
+ response = begin_delete_async(resource_group_name, organization_name, custom_headers:custom_headers).value!
605
+ nil
606
+ end
607
+
608
+ #
609
+ # Delete Organization resource
610
+ #
611
+ # @param resource_group_name [String] Resource group name
612
+ # @param organization_name [String] Organization resource name
613
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
614
+ # will be added to the HTTP request.
615
+ #
616
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
617
+ #
618
+ def begin_delete_with_http_info(resource_group_name, organization_name, custom_headers:nil)
619
+ begin_delete_async(resource_group_name, organization_name, custom_headers:custom_headers).value!
620
+ end
621
+
622
+ #
623
+ # Delete Organization resource
624
+ #
625
+ # @param resource_group_name [String] Resource group name
626
+ # @param organization_name [String] Organization resource name
627
+ # @param [Hash{String => String}] A hash of custom headers that will be added
628
+ # to the HTTP request.
629
+ #
630
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
631
+ #
632
+ def begin_delete_async(resource_group_name, organization_name, custom_headers:nil)
633
+ @client.api_version = '2020-03-01'
634
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
635
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
636
+ fail ArgumentError, 'organization_name is nil' if organization_name.nil?
637
+
638
+
639
+ request_headers = {}
640
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
641
+
642
+ # Set Headers
643
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
644
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
645
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'
646
+
647
+ request_url = @base_url || @client.base_url
648
+
649
+ options = {
650
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
651
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'organizationName' => organization_name},
652
+ query_params: {'api-version' => @client.api_version},
653
+ headers: request_headers.merge(custom_headers || {}),
654
+ base_url: request_url
655
+ }
656
+ promise = @client.make_request_async(:delete, path_template, options)
657
+
658
+ promise = promise.then do |result|
659
+ http_response = result.response
660
+ status_code = http_response.status
661
+ response_content = http_response.body
662
+ unless status_code == 200 || status_code == 202 || status_code == 204
663
+ error_model = JSON.load(response_content)
664
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
665
+ end
666
+
667
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
668
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
669
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
670
+
671
+ result
672
+ end
673
+
674
+ promise.execute
675
+ end
676
+
677
+ #
678
+ # List all organizations under the specified subscription.
679
+ #
680
+ # @param next_page_link [String] The NextLink from the previous successful call
681
+ # to List operation.
682
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
683
+ # will be added to the HTTP request.
684
+ #
685
+ # @return [OrganizationResourceListResult] operation results.
686
+ #
687
+ def list_by_subscription_next(next_page_link, custom_headers:nil)
688
+ response = list_by_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
689
+ response.body unless response.nil?
690
+ end
691
+
692
+ #
693
+ # List all organizations under the specified subscription.
694
+ #
695
+ # @param next_page_link [String] The NextLink from the previous successful call
696
+ # to List operation.
697
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
698
+ # will be added to the HTTP request.
699
+ #
700
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
701
+ #
702
+ def list_by_subscription_next_with_http_info(next_page_link, custom_headers:nil)
703
+ list_by_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
704
+ end
705
+
706
+ #
707
+ # List all organizations under the specified subscription.
708
+ #
709
+ # @param next_page_link [String] The NextLink from the previous successful call
710
+ # to List operation.
711
+ # @param [Hash{String => String}] A hash of custom headers that will be added
712
+ # to the HTTP request.
713
+ #
714
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
715
+ #
716
+ def list_by_subscription_next_async(next_page_link, custom_headers:nil)
717
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
718
+
719
+
720
+ request_headers = {}
721
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
722
+
723
+ # Set Headers
724
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
725
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
726
+ path_template = '{nextLink}'
727
+
728
+ request_url = @base_url || @client.base_url
729
+
730
+ options = {
731
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
732
+ skip_encoding_path_params: {'nextLink' => next_page_link},
733
+ headers: request_headers.merge(custom_headers || {}),
734
+ base_url: request_url
735
+ }
736
+ promise = @client.make_request_async(:get, path_template, options)
737
+
738
+ promise = promise.then do |result|
739
+ http_response = result.response
740
+ status_code = http_response.status
741
+ response_content = http_response.body
742
+ unless status_code == 200
743
+ error_model = JSON.load(response_content)
744
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
745
+ end
746
+
747
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
748
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
749
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
750
+ # Deserialize Response
751
+ if status_code == 200
752
+ begin
753
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
754
+ result_mapper = Azure::Confluent::Mgmt::V2020_03_01::Models::OrganizationResourceListResult.mapper()
755
+ result.body = @client.deserialize(result_mapper, parsed_response)
756
+ rescue Exception => e
757
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
758
+ end
759
+ end
760
+
761
+ result
762
+ end
763
+
764
+ promise.execute
765
+ end
766
+
767
+ #
768
+ # List all Organizations under the specified resource group.
769
+ #
770
+ # @param next_page_link [String] The NextLink from the previous successful call
771
+ # to List operation.
772
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
773
+ # will be added to the HTTP request.
774
+ #
775
+ # @return [OrganizationResourceListResult] operation results.
776
+ #
777
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
778
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
779
+ response.body unless response.nil?
780
+ end
781
+
782
+ #
783
+ # List all Organizations under the specified resource group.
784
+ #
785
+ # @param next_page_link [String] The NextLink from the previous successful call
786
+ # to List operation.
787
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
788
+ # will be added to the HTTP request.
789
+ #
790
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
791
+ #
792
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
793
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
794
+ end
795
+
796
+ #
797
+ # List all Organizations under the specified resource group.
798
+ #
799
+ # @param next_page_link [String] The NextLink from the previous successful call
800
+ # to List operation.
801
+ # @param [Hash{String => String}] A hash of custom headers that will be added
802
+ # to the HTTP request.
803
+ #
804
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
805
+ #
806
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
807
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
808
+
809
+
810
+ request_headers = {}
811
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
812
+
813
+ # Set Headers
814
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
815
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
816
+ path_template = '{nextLink}'
817
+
818
+ request_url = @base_url || @client.base_url
819
+
820
+ options = {
821
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
822
+ skip_encoding_path_params: {'nextLink' => next_page_link},
823
+ headers: request_headers.merge(custom_headers || {}),
824
+ base_url: request_url
825
+ }
826
+ promise = @client.make_request_async(:get, path_template, options)
827
+
828
+ promise = promise.then do |result|
829
+ http_response = result.response
830
+ status_code = http_response.status
831
+ response_content = http_response.body
832
+ unless status_code == 200
833
+ error_model = JSON.load(response_content)
834
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
835
+ end
836
+
837
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
838
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
839
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
840
+ # Deserialize Response
841
+ if status_code == 200
842
+ begin
843
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
844
+ result_mapper = Azure::Confluent::Mgmt::V2020_03_01::Models::OrganizationResourceListResult.mapper()
845
+ result.body = @client.deserialize(result_mapper, parsed_response)
846
+ rescue Exception => e
847
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
848
+ end
849
+ end
850
+
851
+ result
852
+ end
853
+
854
+ promise.execute
855
+ end
856
+
857
+ #
858
+ # List all organizations under the specified subscription.
859
+ #
860
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
861
+ # will be added to the HTTP request.
862
+ #
863
+ # @return [OrganizationResourceListResult] which provide lazy access to pages
864
+ # of the response.
865
+ #
866
+ def list_by_subscription_as_lazy(custom_headers:nil)
867
+ response = list_by_subscription_async(custom_headers:custom_headers).value!
868
+ unless response.nil?
869
+ page = response.body
870
+ page.next_method = Proc.new do |next_page_link|
871
+ list_by_subscription_next_async(next_page_link, custom_headers:custom_headers)
872
+ end
873
+ page
874
+ end
875
+ end
876
+
877
+ #
878
+ # List all Organizations under the specified resource group.
879
+ #
880
+ # @param resource_group_name [String] Resource group name
881
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
882
+ # will be added to the HTTP request.
883
+ #
884
+ # @return [OrganizationResourceListResult] which provide lazy access to pages
885
+ # of the response.
886
+ #
887
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
888
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
889
+ unless response.nil?
890
+ page = response.body
891
+ page.next_method = Proc.new do |next_page_link|
892
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
893
+ end
894
+ page
895
+ end
896
+ end
897
+
898
+ end
899
+ end