azure_mgmt_resources_management 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2017-08-31-preview/generated/azure_mgmt_resources_management/management_groups_api.rb +7 -6
  3. data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management.rb +1 -1
  4. data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management/management_groups.rb +28 -28
  5. data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management/management_groups_api.rb +7 -6
  6. data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management/models/{create_group_request.rb → create_management_group_request.rb} +4 -4
  7. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management.rb +56 -0
  8. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/entities.rb +257 -0
  9. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/management_group_subscriptions.rb +209 -0
  10. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/management_groups.rb +793 -0
  11. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/management_groups_api.rb +254 -0
  12. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/check_name_availability_request.rb +60 -0
  13. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/check_name_availability_result.rb +83 -0
  14. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/create_management_group_child_info.rb +131 -0
  15. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/create_management_group_details.rb +84 -0
  16. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/create_management_group_request.rb +153 -0
  17. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/create_parent_group_info.rb +72 -0
  18. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/entity_hierarchy_item.rb +118 -0
  19. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/entity_info.rb +121 -0
  20. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/entity_list_result.rb +99 -0
  21. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/entity_parent_group_info.rb +48 -0
  22. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/error_details.rb +69 -0
  23. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/error_response.rb +47 -0
  24. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/management_group.rb +150 -0
  25. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/management_group_child_info.rb +125 -0
  26. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/management_group_details.rb +81 -0
  27. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/management_group_info.rb +98 -0
  28. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/management_group_list_result.rb +99 -0
  29. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/operation.rb +59 -0
  30. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/operation_display_properties.rb +83 -0
  31. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/operation_list_result.rb +103 -0
  32. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/operation_results.rb +86 -0
  33. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/parent_group_info.rb +70 -0
  34. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/patch_management_group_request.rb +59 -0
  35. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/reason.rb +16 -0
  36. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/models/type.rb +15 -0
  37. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/module_definition.rb +9 -0
  38. data/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/operations.rb +219 -0
  39. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management.rb +58 -0
  40. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/entities.rb +381 -0
  41. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/management_group_subscriptions.rb +202 -0
  42. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/management_groups.rb +799 -0
  43. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/management_groups_api.rb +401 -0
  44. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/check_name_availability_request.rb +60 -0
  45. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/check_name_availability_result.rb +83 -0
  46. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/create_management_group_child_info.rb +131 -0
  47. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/create_management_group_details.rb +84 -0
  48. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/create_management_group_request.rb +153 -0
  49. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/create_parent_group_info.rb +72 -0
  50. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/entity_hierarchy_item.rb +118 -0
  51. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/entity_info.rb +210 -0
  52. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/entity_list_result.rb +111 -0
  53. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/entity_parent_group_info.rb +48 -0
  54. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/error_details.rb +69 -0
  55. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/error_response.rb +47 -0
  56. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/management_group.rb +150 -0
  57. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/management_group_child_info.rb +125 -0
  58. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/management_group_details.rb +81 -0
  59. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/management_group_info.rb +98 -0
  60. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/management_group_list_result.rb +99 -0
  61. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/operation.rb +59 -0
  62. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/operation_display_properties.rb +83 -0
  63. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/operation_list_result.rb +103 -0
  64. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/operation_results.rb +86 -0
  65. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/parent_group_info.rb +70 -0
  66. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/patch_management_group_request.rb +59 -0
  67. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/reason.rb +16 -0
  68. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/status.rb +20 -0
  69. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/tenant_backfill_status_result.rb +63 -0
  70. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/models/type.rb +15 -0
  71. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/module_definition.rb +9 -0
  72. data/lib/2018-03-01-preview/generated/azure_mgmt_resources_management/operations.rb +218 -0
  73. data/lib/azure_mgmt_resources_management.rb +3 -1
  74. data/lib/profiles/latest/modules/resourcesmanagement_profile_module.rb +99 -37
  75. data/lib/version.rb +1 -1
  76. metadata +72 -6
@@ -0,0 +1,799 @@
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::ResourcesManagement::Mgmt::V2018_03_01_preview
7
+ #
8
+ # The Azure Management Groups API enables consolidation of multiple
9
+ # subscriptions/resources into an organizational hierarchy and centrally
10
+ # manage access control, policies, alerting and reporting for those
11
+ # resources.
12
+ #
13
+ class ManagementGroups
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the ManagementGroups class.
18
+ # @param client service class for accessing basic functionality.
19
+ #
20
+ def initialize(client)
21
+ @client = client
22
+ end
23
+
24
+ # @return [ManagementGroupsAPI] reference to the ManagementGroupsAPI
25
+ attr_reader :client
26
+
27
+ #
28
+ # List management groups for the authenticated user.
29
+ #
30
+ # @param cache_control [String] Indicates that the request shouldn't utilize
31
+ # any caches.
32
+ # @param skiptoken [String] Page continuation token is only used if a previous
33
+ # operation returned a partial result. If a previous response contains a
34
+ # nextLink element, the value of the nextLink element will include a token
35
+ # parameter that specifies a starting point to use for subsequent calls.
36
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
37
+ # will be added to the HTTP request.
38
+ #
39
+ # @return [Array<ManagementGroupInfo>] operation results.
40
+ #
41
+ def list(cache_control:'no-cache', skiptoken:nil, custom_headers:nil)
42
+ first_page = list_as_lazy(cache_control:cache_control, skiptoken:skiptoken, custom_headers:custom_headers)
43
+ first_page.get_all_items
44
+ end
45
+
46
+ #
47
+ # List management groups for the authenticated user.
48
+ #
49
+ # @param cache_control [String] Indicates that the request shouldn't utilize
50
+ # any caches.
51
+ # @param skiptoken [String] Page continuation token is only used if a previous
52
+ # operation returned a partial result. If a previous response contains a
53
+ # nextLink element, the value of the nextLink element will include a token
54
+ # parameter that specifies a starting point to use for subsequent calls.
55
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
56
+ # will be added to the HTTP request.
57
+ #
58
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
59
+ #
60
+ def list_with_http_info(cache_control:'no-cache', skiptoken:nil, custom_headers:nil)
61
+ list_async(cache_control:cache_control, skiptoken:skiptoken, custom_headers:custom_headers).value!
62
+ end
63
+
64
+ #
65
+ # List management groups for the authenticated user.
66
+ #
67
+ # @param cache_control [String] Indicates that the request shouldn't utilize
68
+ # any caches.
69
+ # @param skiptoken [String] Page continuation token is only used if a previous
70
+ # operation returned a partial result. If a previous response contains a
71
+ # nextLink element, the value of the nextLink element will include a token
72
+ # parameter that specifies a starting point to use for subsequent calls.
73
+ # @param [Hash{String => String}] A hash of custom headers that will be added
74
+ # to the HTTP request.
75
+ #
76
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
77
+ #
78
+ def list_async(cache_control:'no-cache', skiptoken:nil, custom_headers:nil)
79
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
80
+
81
+
82
+ request_headers = {}
83
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
84
+
85
+ # Set Headers
86
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
87
+ request_headers['Cache-Control'] = cache_control unless cache_control.nil?
88
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
89
+ path_template = 'providers/Microsoft.Management/managementGroups'
90
+
91
+ request_url = @base_url || @client.base_url
92
+
93
+ options = {
94
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
95
+ query_params: {'api-version' => @client.api_version,'$skiptoken' => skiptoken},
96
+ headers: request_headers.merge(custom_headers || {}),
97
+ base_url: request_url
98
+ }
99
+ promise = @client.make_request_async(:get, path_template, options)
100
+
101
+ promise = promise.then do |result|
102
+ http_response = result.response
103
+ status_code = http_response.status
104
+ response_content = http_response.body
105
+ unless status_code == 200
106
+ error_model = JSON.load(response_content)
107
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
108
+ end
109
+
110
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
111
+ # Deserialize Response
112
+ if status_code == 200
113
+ begin
114
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
115
+ result_mapper = Azure::ResourcesManagement::Mgmt::V2018_03_01_preview::Models::ManagementGroupListResult.mapper()
116
+ result.body = @client.deserialize(result_mapper, parsed_response)
117
+ rescue Exception => e
118
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
119
+ end
120
+ end
121
+
122
+ result
123
+ end
124
+
125
+ promise.execute
126
+ end
127
+
128
+ #
129
+ # Get the details of the management group.
130
+ #
131
+ # @param group_id [String] Management Group ID.
132
+ # @param expand [Enum] The $expand=children query string parameter allows
133
+ # clients to request inclusion of children in the response payload. Possible
134
+ # values include: 'children'
135
+ # @param recurse [Boolean] The $recurse=true query string parameter allows
136
+ # clients to request inclusion of entire hierarchy in the response payload.
137
+ # Note that $expand=children must be passed up if $recurse is set to true.
138
+ # @param filter [String] A filter which allows the exclusion of subscriptions
139
+ # from results (i.e. '$filter=children.childType ne Subscription')
140
+ # @param cache_control [String] Indicates that the request shouldn't utilize
141
+ # any caches.
142
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
143
+ # will be added to the HTTP request.
144
+ #
145
+ # @return [ManagementGroup] operation results.
146
+ #
147
+ def get(group_id, expand:nil, recurse:nil, filter:nil, cache_control:'no-cache', custom_headers:nil)
148
+ response = get_async(group_id, expand:expand, recurse:recurse, filter:filter, cache_control:cache_control, custom_headers:custom_headers).value!
149
+ response.body unless response.nil?
150
+ end
151
+
152
+ #
153
+ # Get the details of the management group.
154
+ #
155
+ # @param group_id [String] Management Group ID.
156
+ # @param expand [Enum] The $expand=children query string parameter allows
157
+ # clients to request inclusion of children in the response payload. Possible
158
+ # values include: 'children'
159
+ # @param recurse [Boolean] The $recurse=true query string parameter allows
160
+ # clients to request inclusion of entire hierarchy in the response payload.
161
+ # Note that $expand=children must be passed up if $recurse is set to true.
162
+ # @param filter [String] A filter which allows the exclusion of subscriptions
163
+ # from results (i.e. '$filter=children.childType ne Subscription')
164
+ # @param cache_control [String] Indicates that the request shouldn't utilize
165
+ # any caches.
166
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
167
+ # will be added to the HTTP request.
168
+ #
169
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
170
+ #
171
+ def get_with_http_info(group_id, expand:nil, recurse:nil, filter:nil, cache_control:'no-cache', custom_headers:nil)
172
+ get_async(group_id, expand:expand, recurse:recurse, filter:filter, cache_control:cache_control, custom_headers:custom_headers).value!
173
+ end
174
+
175
+ #
176
+ # Get the details of the management group.
177
+ #
178
+ # @param group_id [String] Management Group ID.
179
+ # @param expand [Enum] The $expand=children query string parameter allows
180
+ # clients to request inclusion of children in the response payload. Possible
181
+ # values include: 'children'
182
+ # @param recurse [Boolean] The $recurse=true query string parameter allows
183
+ # clients to request inclusion of entire hierarchy in the response payload.
184
+ # Note that $expand=children must be passed up if $recurse is set to true.
185
+ # @param filter [String] A filter which allows the exclusion of subscriptions
186
+ # from results (i.e. '$filter=children.childType ne Subscription')
187
+ # @param cache_control [String] Indicates that the request shouldn't utilize
188
+ # any caches.
189
+ # @param [Hash{String => String}] A hash of custom headers that will be added
190
+ # to the HTTP request.
191
+ #
192
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
193
+ #
194
+ def get_async(group_id, expand:nil, recurse:nil, filter:nil, cache_control:'no-cache', custom_headers:nil)
195
+ fail ArgumentError, 'group_id is nil' if group_id.nil?
196
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
197
+
198
+
199
+ request_headers = {}
200
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
201
+
202
+ # Set Headers
203
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
204
+ request_headers['Cache-Control'] = cache_control unless cache_control.nil?
205
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
206
+ path_template = 'providers/Microsoft.Management/managementGroups/{groupId}'
207
+
208
+ request_url = @base_url || @client.base_url
209
+
210
+ options = {
211
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
212
+ path_params: {'groupId' => group_id},
213
+ query_params: {'api-version' => @client.api_version,'$expand' => expand,'$recurse' => recurse,'$filter' => filter},
214
+ headers: request_headers.merge(custom_headers || {}),
215
+ base_url: request_url
216
+ }
217
+ promise = @client.make_request_async(:get, path_template, options)
218
+
219
+ promise = promise.then do |result|
220
+ http_response = result.response
221
+ status_code = http_response.status
222
+ response_content = http_response.body
223
+ unless status_code == 200
224
+ error_model = JSON.load(response_content)
225
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
226
+ end
227
+
228
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-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::ResourcesManagement::Mgmt::V2018_03_01_preview::Models::ManagementGroup.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
+ # Create or update a management group. If a management group is already created
248
+ # and a subsequent create request is issued with different properties, the
249
+ # management group properties will be updated.
250
+ #
251
+ # @param group_id [String] Management Group ID.
252
+ # @param create_management_group_request [CreateManagementGroupRequest]
253
+ # Management group creation parameters.
254
+ # @param cache_control [String] Indicates that the request shouldn't utilize
255
+ # any caches.
256
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
257
+ # will be added to the HTTP request.
258
+ #
259
+ # @return [Object] operation results.
260
+ #
261
+ def create_or_update(group_id, create_management_group_request, cache_control:'no-cache', custom_headers:nil)
262
+ response = create_or_update_async(group_id, create_management_group_request, cache_control:cache_control, custom_headers:custom_headers).value!
263
+ response.body unless response.nil?
264
+ end
265
+
266
+ #
267
+ # @param group_id [String] Management Group ID.
268
+ # @param create_management_group_request [CreateManagementGroupRequest]
269
+ # Management group creation parameters.
270
+ # @param cache_control [String] Indicates that the request shouldn't utilize
271
+ # any caches.
272
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
273
+ # will be added to the HTTP request.
274
+ #
275
+ # @return [Concurrent::Promise] promise which provides async access to http
276
+ # response.
277
+ #
278
+ def create_or_update_async(group_id, create_management_group_request, cache_control:'no-cache', custom_headers:nil)
279
+ # Send request
280
+ promise = begin_create_or_update_async(group_id, create_management_group_request, cache_control:cache_control, custom_headers:custom_headers)
281
+
282
+ promise = promise.then do |response|
283
+ # Defining deserialization method.
284
+ deserialize_method = lambda do |parsed_response|
285
+ result_mapper = {
286
+ client_side_validation: true,
287
+ required: false,
288
+ serialized_name: 'parsed_response',
289
+ type: {
290
+ name: 'Object'
291
+ }
292
+ }
293
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
294
+ end
295
+
296
+ # Waiting for response.
297
+ @client.get_long_running_operation_result(response, deserialize_method)
298
+ end
299
+
300
+ promise
301
+ end
302
+
303
+ #
304
+ # Update a management group.
305
+ #
306
+ # @param group_id [String] Management Group ID.
307
+ # @param patch_group_request [PatchManagementGroupRequest] Management group
308
+ # patch parameters.
309
+ # @param cache_control [String] Indicates that the request shouldn't utilize
310
+ # any caches.
311
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
312
+ # will be added to the HTTP request.
313
+ #
314
+ # @return [ManagementGroup] operation results.
315
+ #
316
+ def update(group_id, patch_group_request, cache_control:'no-cache', custom_headers:nil)
317
+ response = update_async(group_id, patch_group_request, cache_control:cache_control, custom_headers:custom_headers).value!
318
+ response.body unless response.nil?
319
+ end
320
+
321
+ #
322
+ # Update a management group.
323
+ #
324
+ # @param group_id [String] Management Group ID.
325
+ # @param patch_group_request [PatchManagementGroupRequest] Management group
326
+ # patch parameters.
327
+ # @param cache_control [String] Indicates that the request shouldn't utilize
328
+ # any caches.
329
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
330
+ # will be added to the HTTP request.
331
+ #
332
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
333
+ #
334
+ def update_with_http_info(group_id, patch_group_request, cache_control:'no-cache', custom_headers:nil)
335
+ update_async(group_id, patch_group_request, cache_control:cache_control, custom_headers:custom_headers).value!
336
+ end
337
+
338
+ #
339
+ # Update a management group.
340
+ #
341
+ # @param group_id [String] Management Group ID.
342
+ # @param patch_group_request [PatchManagementGroupRequest] Management group
343
+ # patch parameters.
344
+ # @param cache_control [String] Indicates that the request shouldn't utilize
345
+ # any caches.
346
+ # @param [Hash{String => String}] A hash of custom headers that will be added
347
+ # to the HTTP request.
348
+ #
349
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
350
+ #
351
+ def update_async(group_id, patch_group_request, cache_control:'no-cache', custom_headers:nil)
352
+ fail ArgumentError, 'group_id is nil' if group_id.nil?
353
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
354
+ fail ArgumentError, 'patch_group_request is nil' if patch_group_request.nil?
355
+
356
+
357
+ request_headers = {}
358
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
359
+
360
+ # Set Headers
361
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
362
+ request_headers['Cache-Control'] = cache_control unless cache_control.nil?
363
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
364
+
365
+ # Serialize Request
366
+ request_mapper = Azure::ResourcesManagement::Mgmt::V2018_03_01_preview::Models::PatchManagementGroupRequest.mapper()
367
+ request_content = @client.serialize(request_mapper, patch_group_request)
368
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
369
+
370
+ path_template = 'providers/Microsoft.Management/managementGroups/{groupId}'
371
+
372
+ request_url = @base_url || @client.base_url
373
+
374
+ options = {
375
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
376
+ path_params: {'groupId' => group_id},
377
+ query_params: {'api-version' => @client.api_version},
378
+ body: request_content,
379
+ headers: request_headers.merge(custom_headers || {}),
380
+ base_url: request_url
381
+ }
382
+ promise = @client.make_request_async(:patch, path_template, options)
383
+
384
+ promise = promise.then do |result|
385
+ http_response = result.response
386
+ status_code = http_response.status
387
+ response_content = http_response.body
388
+ unless status_code == 200
389
+ error_model = JSON.load(response_content)
390
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
391
+ end
392
+
393
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
394
+ # Deserialize Response
395
+ if status_code == 200
396
+ begin
397
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
398
+ result_mapper = Azure::ResourcesManagement::Mgmt::V2018_03_01_preview::Models::ManagementGroup.mapper()
399
+ result.body = @client.deserialize(result_mapper, parsed_response)
400
+ rescue Exception => e
401
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
402
+ end
403
+ end
404
+
405
+ result
406
+ end
407
+
408
+ promise.execute
409
+ end
410
+
411
+ #
412
+ # Delete management group. If a management group contains child resources, the
413
+ # request will fail.
414
+ #
415
+ # @param group_id [String] Management Group ID.
416
+ # @param cache_control [String] Indicates that the request shouldn't utilize
417
+ # any caches.
418
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
419
+ # will be added to the HTTP request.
420
+ #
421
+ # @return [OperationResults] operation results.
422
+ #
423
+ def delete(group_id, cache_control:'no-cache', custom_headers:nil)
424
+ response = delete_async(group_id, cache_control:cache_control, custom_headers:custom_headers).value!
425
+ response.body unless response.nil?
426
+ end
427
+
428
+ #
429
+ # @param group_id [String] Management Group ID.
430
+ # @param cache_control [String] Indicates that the request shouldn't utilize
431
+ # any caches.
432
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
433
+ # will be added to the HTTP request.
434
+ #
435
+ # @return [Concurrent::Promise] promise which provides async access to http
436
+ # response.
437
+ #
438
+ def delete_async(group_id, cache_control:'no-cache', custom_headers:nil)
439
+ # Send request
440
+ promise = begin_delete_async(group_id, cache_control:cache_control, custom_headers:custom_headers)
441
+
442
+ promise = promise.then do |response|
443
+ # Defining deserialization method.
444
+ deserialize_method = lambda do |parsed_response|
445
+ result_mapper = Azure::ResourcesManagement::Mgmt::V2018_03_01_preview::Models::OperationResults.mapper()
446
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
447
+ end
448
+
449
+ # Waiting for response.
450
+ @client.get_long_running_operation_result(response, deserialize_method)
451
+ end
452
+
453
+ promise
454
+ end
455
+
456
+ #
457
+ # Create or update a management group. If a management group is already created
458
+ # and a subsequent create request is issued with different properties, the
459
+ # management group properties will be updated.
460
+ #
461
+ # @param group_id [String] Management Group ID.
462
+ # @param create_management_group_request [CreateManagementGroupRequest]
463
+ # Management group creation parameters.
464
+ # @param cache_control [String] Indicates that the request shouldn't utilize
465
+ # any caches.
466
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
467
+ # will be added to the HTTP request.
468
+ #
469
+ # @return [Object] operation results.
470
+ #
471
+ def begin_create_or_update(group_id, create_management_group_request, cache_control:'no-cache', custom_headers:nil)
472
+ response = begin_create_or_update_async(group_id, create_management_group_request, cache_control:cache_control, custom_headers:custom_headers).value!
473
+ response.body unless response.nil?
474
+ end
475
+
476
+ #
477
+ # Create or update a management group. If a management group is already created
478
+ # and a subsequent create request is issued with different properties, the
479
+ # management group properties will be updated.
480
+ #
481
+ # @param group_id [String] Management Group ID.
482
+ # @param create_management_group_request [CreateManagementGroupRequest]
483
+ # Management group creation parameters.
484
+ # @param cache_control [String] Indicates that the request shouldn't utilize
485
+ # any caches.
486
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
487
+ # will be added to the HTTP request.
488
+ #
489
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
490
+ #
491
+ def begin_create_or_update_with_http_info(group_id, create_management_group_request, cache_control:'no-cache', custom_headers:nil)
492
+ begin_create_or_update_async(group_id, create_management_group_request, cache_control:cache_control, custom_headers:custom_headers).value!
493
+ end
494
+
495
+ #
496
+ # Create or update a management group. If a management group is already created
497
+ # and a subsequent create request is issued with different properties, the
498
+ # management group properties will be updated.
499
+ #
500
+ # @param group_id [String] Management Group ID.
501
+ # @param create_management_group_request [CreateManagementGroupRequest]
502
+ # Management group creation parameters.
503
+ # @param cache_control [String] Indicates that the request shouldn't utilize
504
+ # any caches.
505
+ # @param [Hash{String => String}] A hash of custom headers that will be added
506
+ # to the HTTP request.
507
+ #
508
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
509
+ #
510
+ def begin_create_or_update_async(group_id, create_management_group_request, cache_control:'no-cache', custom_headers:nil)
511
+ fail ArgumentError, 'group_id is nil' if group_id.nil?
512
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
513
+ fail ArgumentError, 'create_management_group_request is nil' if create_management_group_request.nil?
514
+
515
+
516
+ request_headers = {}
517
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
518
+
519
+ # Set Headers
520
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
521
+ request_headers['Cache-Control'] = cache_control unless cache_control.nil?
522
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
523
+
524
+ # Serialize Request
525
+ request_mapper = Azure::ResourcesManagement::Mgmt::V2018_03_01_preview::Models::CreateManagementGroupRequest.mapper()
526
+ request_content = @client.serialize(request_mapper, create_management_group_request)
527
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
528
+
529
+ path_template = 'providers/Microsoft.Management/managementGroups/{groupId}'
530
+
531
+ request_url = @base_url || @client.base_url
532
+
533
+ options = {
534
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
535
+ path_params: {'groupId' => group_id},
536
+ query_params: {'api-version' => @client.api_version},
537
+ body: request_content,
538
+ headers: request_headers.merge(custom_headers || {}),
539
+ base_url: request_url
540
+ }
541
+ promise = @client.make_request_async(:put, path_template, options)
542
+
543
+ promise = promise.then do |result|
544
+ http_response = result.response
545
+ status_code = http_response.status
546
+ response_content = http_response.body
547
+ unless status_code == 200 || status_code == 202
548
+ error_model = JSON.load(response_content)
549
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
550
+ end
551
+
552
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
553
+ # Deserialize Response
554
+ if status_code == 200
555
+ begin
556
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
557
+ result_mapper = Azure::ResourcesManagement::Mgmt::V2018_03_01_preview::Models::ManagementGroup.mapper()
558
+ result.body = @client.deserialize(result_mapper, parsed_response)
559
+ rescue Exception => e
560
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
561
+ end
562
+ end
563
+ # Deserialize Response
564
+ if status_code == 202
565
+ begin
566
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
567
+ result_mapper = Azure::ResourcesManagement::Mgmt::V2018_03_01_preview::Models::OperationResults.mapper()
568
+ result.body = @client.deserialize(result_mapper, parsed_response)
569
+ rescue Exception => e
570
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
571
+ end
572
+ end
573
+
574
+ result
575
+ end
576
+
577
+ promise.execute
578
+ end
579
+
580
+ #
581
+ # Delete management group. If a management group contains child resources, the
582
+ # request will fail.
583
+ #
584
+ # @param group_id [String] Management Group ID.
585
+ # @param cache_control [String] Indicates that the request shouldn't utilize
586
+ # any caches.
587
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
588
+ # will be added to the HTTP request.
589
+ #
590
+ # @return [OperationResults] operation results.
591
+ #
592
+ def begin_delete(group_id, cache_control:'no-cache', custom_headers:nil)
593
+ response = begin_delete_async(group_id, cache_control:cache_control, custom_headers:custom_headers).value!
594
+ response.body unless response.nil?
595
+ end
596
+
597
+ #
598
+ # Delete management group. If a management group contains child resources, the
599
+ # request will fail.
600
+ #
601
+ # @param group_id [String] Management Group ID.
602
+ # @param cache_control [String] Indicates that the request shouldn't utilize
603
+ # any caches.
604
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
605
+ # will be added to the HTTP request.
606
+ #
607
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
608
+ #
609
+ def begin_delete_with_http_info(group_id, cache_control:'no-cache', custom_headers:nil)
610
+ begin_delete_async(group_id, cache_control:cache_control, custom_headers:custom_headers).value!
611
+ end
612
+
613
+ #
614
+ # Delete management group. If a management group contains child resources, the
615
+ # request will fail.
616
+ #
617
+ # @param group_id [String] Management Group ID.
618
+ # @param cache_control [String] Indicates that the request shouldn't utilize
619
+ # any caches.
620
+ # @param [Hash{String => String}] A hash of custom headers that will be added
621
+ # to the HTTP request.
622
+ #
623
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
624
+ #
625
+ def begin_delete_async(group_id, cache_control:'no-cache', custom_headers:nil)
626
+ fail ArgumentError, 'group_id is nil' if group_id.nil?
627
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
628
+
629
+
630
+ request_headers = {}
631
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
632
+
633
+ # Set Headers
634
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
635
+ request_headers['Cache-Control'] = cache_control unless cache_control.nil?
636
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
637
+ path_template = 'providers/Microsoft.Management/managementGroups/{groupId}'
638
+
639
+ request_url = @base_url || @client.base_url
640
+
641
+ options = {
642
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
643
+ path_params: {'groupId' => group_id},
644
+ query_params: {'api-version' => @client.api_version},
645
+ headers: request_headers.merge(custom_headers || {}),
646
+ base_url: request_url
647
+ }
648
+ promise = @client.make_request_async(:delete, path_template, options)
649
+
650
+ promise = promise.then do |result|
651
+ http_response = result.response
652
+ status_code = http_response.status
653
+ response_content = http_response.body
654
+ unless status_code == 202 || status_code == 204
655
+ error_model = JSON.load(response_content)
656
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
657
+ end
658
+
659
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
660
+ # Deserialize Response
661
+ if status_code == 202
662
+ begin
663
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
664
+ result_mapper = Azure::ResourcesManagement::Mgmt::V2018_03_01_preview::Models::OperationResults.mapper()
665
+ result.body = @client.deserialize(result_mapper, parsed_response)
666
+ rescue Exception => e
667
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
668
+ end
669
+ end
670
+
671
+ result
672
+ end
673
+
674
+ promise.execute
675
+ end
676
+
677
+ #
678
+ # List management groups for the authenticated user.
679
+ #
680
+ # @param next_page_link [String] The NextLink from the previous successful call
681
+ # to List operation.
682
+ # @param cache_control [String] Indicates that the request shouldn't utilize
683
+ # any caches.
684
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
685
+ # will be added to the HTTP request.
686
+ #
687
+ # @return [ManagementGroupListResult] operation results.
688
+ #
689
+ def list_next(next_page_link, cache_control:'no-cache', custom_headers:nil)
690
+ response = list_next_async(next_page_link, cache_control:cache_control, custom_headers:custom_headers).value!
691
+ response.body unless response.nil?
692
+ end
693
+
694
+ #
695
+ # List management groups for the authenticated user.
696
+ #
697
+ # @param next_page_link [String] The NextLink from the previous successful call
698
+ # to List operation.
699
+ # @param cache_control [String] Indicates that the request shouldn't utilize
700
+ # any caches.
701
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
702
+ # will be added to the HTTP request.
703
+ #
704
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
705
+ #
706
+ def list_next_with_http_info(next_page_link, cache_control:'no-cache', custom_headers:nil)
707
+ list_next_async(next_page_link, cache_control:cache_control, custom_headers:custom_headers).value!
708
+ end
709
+
710
+ #
711
+ # List management groups for the authenticated user.
712
+ #
713
+ # @param next_page_link [String] The NextLink from the previous successful call
714
+ # to List operation.
715
+ # @param cache_control [String] Indicates that the request shouldn't utilize
716
+ # any caches.
717
+ # @param [Hash{String => String}] A hash of custom headers that will be added
718
+ # to the HTTP request.
719
+ #
720
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
721
+ #
722
+ def list_next_async(next_page_link, cache_control:'no-cache', custom_headers:nil)
723
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
724
+
725
+
726
+ request_headers = {}
727
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
728
+
729
+ # Set Headers
730
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
731
+ request_headers['Cache-Control'] = cache_control unless cache_control.nil?
732
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
733
+ path_template = '{nextLink}'
734
+
735
+ request_url = @base_url || @client.base_url
736
+
737
+ options = {
738
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
739
+ skip_encoding_path_params: {'nextLink' => next_page_link},
740
+ headers: request_headers.merge(custom_headers || {}),
741
+ base_url: request_url
742
+ }
743
+ promise = @client.make_request_async(:get, path_template, options)
744
+
745
+ promise = promise.then do |result|
746
+ http_response = result.response
747
+ status_code = http_response.status
748
+ response_content = http_response.body
749
+ unless status_code == 200
750
+ error_model = JSON.load(response_content)
751
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
752
+ end
753
+
754
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
755
+ # Deserialize Response
756
+ if status_code == 200
757
+ begin
758
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
759
+ result_mapper = Azure::ResourcesManagement::Mgmt::V2018_03_01_preview::Models::ManagementGroupListResult.mapper()
760
+ result.body = @client.deserialize(result_mapper, parsed_response)
761
+ rescue Exception => e
762
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
763
+ end
764
+ end
765
+
766
+ result
767
+ end
768
+
769
+ promise.execute
770
+ end
771
+
772
+ #
773
+ # List management groups for the authenticated user.
774
+ #
775
+ # @param cache_control [String] Indicates that the request shouldn't utilize
776
+ # any caches.
777
+ # @param skiptoken [String] Page continuation token is only used if a previous
778
+ # operation returned a partial result. If a previous response contains a
779
+ # nextLink element, the value of the nextLink element will include a token
780
+ # parameter that specifies a starting point to use for subsequent calls.
781
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
782
+ # will be added to the HTTP request.
783
+ #
784
+ # @return [ManagementGroupListResult] which provide lazy access to pages of the
785
+ # response.
786
+ #
787
+ def list_as_lazy(cache_control:'no-cache', skiptoken:nil, custom_headers:nil)
788
+ response = list_async(cache_control:cache_control, skiptoken:skiptoken, custom_headers:custom_headers).value!
789
+ unless response.nil?
790
+ page = response.body
791
+ page.next_method = Proc.new do |next_page_link|
792
+ list_next_async(next_page_link, cache_control:cache_control, custom_headers:custom_headers)
793
+ end
794
+ page
795
+ end
796
+ end
797
+
798
+ end
799
+ end