azure_mgmt_resources_management 0.15.2 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/2017-08-31-preview/generated/azure_mgmt_resources_management/management_groups.rb +21 -18
- data/lib/2017-08-31-preview/generated/azure_mgmt_resources_management/management_groups_api.rb +4 -1
- data/lib/2017-08-31-preview/generated/azure_mgmt_resources_management/operations.rb +15 -13
- data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management.rb +42 -0
- data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management/management_group_subscriptions.rb +209 -0
- data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management/management_groups.rb +698 -0
- data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management/management_groups_api.rb +136 -0
- data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management/models/create_group_request.rb +59 -0
- data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management/models/error_details.rb +57 -0
- data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management/models/error_response.rb +47 -0
- data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management/models/management_group.rb +130 -0
- data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management/models/management_group_child_info.rb +91 -0
- data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management/models/management_group_details.rb +81 -0
- data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management/models/management_group_info.rb +98 -0
- data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management/models/management_group_list_result.rb +99 -0
- data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management/models/operation.rb +59 -0
- data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management/models/operation_display.rb +83 -0
- data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management/models/operation_list_result.rb +103 -0
- data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management/models/parent_group_info.rb +59 -0
- data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management/module_definition.rb +9 -0
- data/lib/2017-11-01-preview/generated/azure_mgmt_resources_management/operations.rb +219 -0
- data/lib/azure_mgmt_resources_management.rb +1 -0
- data/lib/profiles/latest/modules/resourcesmanagement_profile_module.rb +82 -69
- data/lib/profiles/latest/resourcesmanagement_latest_profile_client.rb +28 -9
- data/lib/profiles/latest/resourcesmanagement_module_definition.rb +0 -1
- data/lib/version.rb +1 -1
- metadata +21 -3
@@ -0,0 +1,698 @@
|
|
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::V2017_11_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
|
+
#
|
14
|
+
class ManagementGroups
|
15
|
+
include MsRestAzure
|
16
|
+
|
17
|
+
#
|
18
|
+
# Creates and initializes a new instance of the ManagementGroups class.
|
19
|
+
# @param client service class for accessing basic functionality.
|
20
|
+
#
|
21
|
+
def initialize(client)
|
22
|
+
@client = client
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [ManagementGroupsAPI] reference to the ManagementGroupsAPI
|
26
|
+
attr_reader :client
|
27
|
+
|
28
|
+
#
|
29
|
+
# List management groups for the authenticated user.
|
30
|
+
#
|
31
|
+
#
|
32
|
+
# @param cache_control [String] Indicates that the request shouldn't utilize
|
33
|
+
# any caches.
|
34
|
+
# @param skiptoken [String] Page continuation token is only used if a previous
|
35
|
+
# operation returned a partial result.
|
36
|
+
# If a previous response contains a nextLink element, the value of the nextLink
|
37
|
+
# element will include a token parameter that specifies a starting point to use
|
38
|
+
# for subsequent calls.
|
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 [Array<ManagementGroupInfo>] operation results.
|
44
|
+
#
|
45
|
+
def list(cache_control:'no-cache', skiptoken:nil, custom_headers:nil)
|
46
|
+
first_page = list_as_lazy(cache_control:cache_control, skiptoken:skiptoken, custom_headers:custom_headers)
|
47
|
+
first_page.get_all_items
|
48
|
+
end
|
49
|
+
|
50
|
+
#
|
51
|
+
# List management groups for the authenticated user.
|
52
|
+
#
|
53
|
+
#
|
54
|
+
# @param cache_control [String] Indicates that the request shouldn't utilize
|
55
|
+
# any caches.
|
56
|
+
# @param skiptoken [String] Page continuation token is only used if a previous
|
57
|
+
# operation returned a partial result.
|
58
|
+
# If a previous response contains a nextLink element, the value of the nextLink
|
59
|
+
# element will include a token parameter that specifies a starting point to use
|
60
|
+
# for subsequent calls.
|
61
|
+
#
|
62
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
63
|
+
# will be added to the HTTP request.
|
64
|
+
#
|
65
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
66
|
+
#
|
67
|
+
def list_with_http_info(cache_control:'no-cache', skiptoken:nil, custom_headers:nil)
|
68
|
+
list_async(cache_control:cache_control, skiptoken:skiptoken, custom_headers:custom_headers).value!
|
69
|
+
end
|
70
|
+
|
71
|
+
#
|
72
|
+
# List management groups for the authenticated user.
|
73
|
+
#
|
74
|
+
#
|
75
|
+
# @param cache_control [String] Indicates that the request shouldn't utilize
|
76
|
+
# any caches.
|
77
|
+
# @param skiptoken [String] Page continuation token is only used if a previous
|
78
|
+
# operation returned a partial result.
|
79
|
+
# If a previous response contains a nextLink element, the value of the nextLink
|
80
|
+
# element will include a token parameter that specifies a starting point to use
|
81
|
+
# for subsequent calls.
|
82
|
+
#
|
83
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
84
|
+
# to the HTTP request.
|
85
|
+
#
|
86
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
87
|
+
#
|
88
|
+
def list_async(cache_control:'no-cache', skiptoken:nil, custom_headers:nil)
|
89
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
90
|
+
|
91
|
+
|
92
|
+
request_headers = {}
|
93
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
94
|
+
|
95
|
+
# Set Headers
|
96
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
97
|
+
request_headers['Cache-Control'] = cache_control unless cache_control.nil?
|
98
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
99
|
+
path_template = 'providers/Microsoft.Management/managementGroups'
|
100
|
+
|
101
|
+
request_url = @base_url || @client.base_url
|
102
|
+
|
103
|
+
options = {
|
104
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
105
|
+
query_params: {'api-version' => @client.api_version,'$skiptoken' => skiptoken},
|
106
|
+
headers: request_headers.merge(custom_headers || {}),
|
107
|
+
base_url: request_url
|
108
|
+
}
|
109
|
+
promise = @client.make_request_async(:get, path_template, options)
|
110
|
+
|
111
|
+
promise = promise.then do |result|
|
112
|
+
http_response = result.response
|
113
|
+
status_code = http_response.status
|
114
|
+
response_content = http_response.body
|
115
|
+
unless status_code == 200
|
116
|
+
error_model = JSON.load(response_content)
|
117
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
118
|
+
end
|
119
|
+
|
120
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
121
|
+
# Deserialize Response
|
122
|
+
if status_code == 200
|
123
|
+
begin
|
124
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
125
|
+
result_mapper = Azure::ResourcesManagement::Mgmt::V2017_11_01_preview::Models::ManagementGroupListResult.mapper()
|
126
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
127
|
+
rescue Exception => e
|
128
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
result
|
133
|
+
end
|
134
|
+
|
135
|
+
promise.execute
|
136
|
+
end
|
137
|
+
|
138
|
+
#
|
139
|
+
# Get the details of the management group.
|
140
|
+
#
|
141
|
+
#
|
142
|
+
# @param group_id [String] Management Group ID.
|
143
|
+
# @param expand [Enum] The $expand=children query string parameter allows
|
144
|
+
# clients to request inclusion of children in the response payload. Possible
|
145
|
+
# values include: 'children'
|
146
|
+
# @param recurse [Boolean] The $recurse=true query string parameter allows
|
147
|
+
# clients to request inclusion of entire hierarchy in the response payload.
|
148
|
+
# @param cache_control [String] Indicates that the request shouldn't utilize
|
149
|
+
# any caches.
|
150
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
151
|
+
# will be added to the HTTP request.
|
152
|
+
#
|
153
|
+
# @return [ManagementGroup] operation results.
|
154
|
+
#
|
155
|
+
def get(group_id, expand:nil, recurse:nil, cache_control:'no-cache', custom_headers:nil)
|
156
|
+
response = get_async(group_id, expand:expand, recurse:recurse, cache_control:cache_control, custom_headers:custom_headers).value!
|
157
|
+
response.body unless response.nil?
|
158
|
+
end
|
159
|
+
|
160
|
+
#
|
161
|
+
# Get the details of the management group.
|
162
|
+
#
|
163
|
+
#
|
164
|
+
# @param group_id [String] Management Group ID.
|
165
|
+
# @param expand [Enum] The $expand=children query string parameter allows
|
166
|
+
# clients to request inclusion of children in the response payload. Possible
|
167
|
+
# values include: 'children'
|
168
|
+
# @param recurse [Boolean] The $recurse=true query string parameter allows
|
169
|
+
# clients to request inclusion of entire hierarchy in the response payload.
|
170
|
+
# @param cache_control [String] Indicates that the request shouldn't utilize
|
171
|
+
# any caches.
|
172
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
173
|
+
# will be added to the HTTP request.
|
174
|
+
#
|
175
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
176
|
+
#
|
177
|
+
def get_with_http_info(group_id, expand:nil, recurse:nil, cache_control:'no-cache', custom_headers:nil)
|
178
|
+
get_async(group_id, expand:expand, recurse:recurse, cache_control:cache_control, custom_headers:custom_headers).value!
|
179
|
+
end
|
180
|
+
|
181
|
+
#
|
182
|
+
# Get the details of the management group.
|
183
|
+
#
|
184
|
+
#
|
185
|
+
# @param group_id [String] Management Group ID.
|
186
|
+
# @param expand [Enum] The $expand=children query string parameter allows
|
187
|
+
# clients to request inclusion of children in the response payload. Possible
|
188
|
+
# values include: 'children'
|
189
|
+
# @param recurse [Boolean] The $recurse=true query string parameter allows
|
190
|
+
# clients to request inclusion of entire hierarchy in the response payload.
|
191
|
+
# @param cache_control [String] Indicates that the request shouldn't utilize
|
192
|
+
# any caches.
|
193
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
194
|
+
# to the HTTP request.
|
195
|
+
#
|
196
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
197
|
+
#
|
198
|
+
def get_async(group_id, expand:nil, recurse:nil, cache_control:'no-cache', custom_headers:nil)
|
199
|
+
fail ArgumentError, 'group_id is nil' if group_id.nil?
|
200
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
201
|
+
|
202
|
+
|
203
|
+
request_headers = {}
|
204
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
205
|
+
|
206
|
+
# Set Headers
|
207
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
208
|
+
request_headers['Cache-Control'] = cache_control unless cache_control.nil?
|
209
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
210
|
+
path_template = 'providers/Microsoft.Management/managementGroups/{groupId}'
|
211
|
+
|
212
|
+
request_url = @base_url || @client.base_url
|
213
|
+
|
214
|
+
options = {
|
215
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
216
|
+
path_params: {'groupId' => group_id},
|
217
|
+
query_params: {'api-version' => @client.api_version,'$expand' => expand,'$recurse' => recurse},
|
218
|
+
headers: request_headers.merge(custom_headers || {}),
|
219
|
+
base_url: request_url
|
220
|
+
}
|
221
|
+
promise = @client.make_request_async(:get, path_template, options)
|
222
|
+
|
223
|
+
promise = promise.then do |result|
|
224
|
+
http_response = result.response
|
225
|
+
status_code = http_response.status
|
226
|
+
response_content = http_response.body
|
227
|
+
unless status_code == 200
|
228
|
+
error_model = JSON.load(response_content)
|
229
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
230
|
+
end
|
231
|
+
|
232
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
233
|
+
# Deserialize Response
|
234
|
+
if status_code == 200
|
235
|
+
begin
|
236
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
237
|
+
result_mapper = Azure::ResourcesManagement::Mgmt::V2017_11_01_preview::Models::ManagementGroup.mapper()
|
238
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
239
|
+
rescue Exception => e
|
240
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
result
|
245
|
+
end
|
246
|
+
|
247
|
+
promise.execute
|
248
|
+
end
|
249
|
+
|
250
|
+
#
|
251
|
+
# Create or update a management group.
|
252
|
+
# If a management group is already created and a subsequent create request is
|
253
|
+
# issued with different properties, the management group properties will be
|
254
|
+
# updated.
|
255
|
+
#
|
256
|
+
#
|
257
|
+
# @param group_id [String] Management Group ID.
|
258
|
+
# @param create_group_request [CreateGroupRequest] Management group creation
|
259
|
+
# parameters.
|
260
|
+
# @param cache_control [String] Indicates that the request shouldn't utilize
|
261
|
+
# any caches.
|
262
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
263
|
+
# will be added to the HTTP request.
|
264
|
+
#
|
265
|
+
# @return [ManagementGroup] operation results.
|
266
|
+
#
|
267
|
+
def create_or_update(group_id, create_group_request, cache_control:'no-cache', custom_headers:nil)
|
268
|
+
response = create_or_update_async(group_id, create_group_request, cache_control:cache_control, custom_headers:custom_headers).value!
|
269
|
+
response.body unless response.nil?
|
270
|
+
end
|
271
|
+
|
272
|
+
#
|
273
|
+
# Create or update a management group.
|
274
|
+
# If a management group is already created and a subsequent create request is
|
275
|
+
# issued with different properties, the management group properties will be
|
276
|
+
# updated.
|
277
|
+
#
|
278
|
+
#
|
279
|
+
# @param group_id [String] Management Group ID.
|
280
|
+
# @param create_group_request [CreateGroupRequest] Management group creation
|
281
|
+
# parameters.
|
282
|
+
# @param cache_control [String] Indicates that the request shouldn't utilize
|
283
|
+
# any caches.
|
284
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
285
|
+
# will be added to the HTTP request.
|
286
|
+
#
|
287
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
288
|
+
#
|
289
|
+
def create_or_update_with_http_info(group_id, create_group_request, cache_control:'no-cache', custom_headers:nil)
|
290
|
+
create_or_update_async(group_id, create_group_request, cache_control:cache_control, custom_headers:custom_headers).value!
|
291
|
+
end
|
292
|
+
|
293
|
+
#
|
294
|
+
# Create or update a management group.
|
295
|
+
# If a management group is already created and a subsequent create request is
|
296
|
+
# issued with different properties, the management group properties will be
|
297
|
+
# updated.
|
298
|
+
#
|
299
|
+
#
|
300
|
+
# @param group_id [String] Management Group ID.
|
301
|
+
# @param create_group_request [CreateGroupRequest] Management group creation
|
302
|
+
# parameters.
|
303
|
+
# @param cache_control [String] Indicates that the request shouldn't utilize
|
304
|
+
# any caches.
|
305
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
306
|
+
# to the HTTP request.
|
307
|
+
#
|
308
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
309
|
+
#
|
310
|
+
def create_or_update_async(group_id, create_group_request, cache_control:'no-cache', custom_headers:nil)
|
311
|
+
fail ArgumentError, 'group_id is nil' if group_id.nil?
|
312
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
313
|
+
fail ArgumentError, 'create_group_request is nil' if create_group_request.nil?
|
314
|
+
|
315
|
+
|
316
|
+
request_headers = {}
|
317
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
318
|
+
|
319
|
+
# Set Headers
|
320
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
321
|
+
request_headers['Cache-Control'] = cache_control unless cache_control.nil?
|
322
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
323
|
+
|
324
|
+
# Serialize Request
|
325
|
+
request_mapper = Azure::ResourcesManagement::Mgmt::V2017_11_01_preview::Models::CreateGroupRequest.mapper()
|
326
|
+
request_content = @client.serialize(request_mapper, create_group_request)
|
327
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
328
|
+
|
329
|
+
path_template = 'providers/Microsoft.Management/managementGroups/{groupId}'
|
330
|
+
|
331
|
+
request_url = @base_url || @client.base_url
|
332
|
+
|
333
|
+
options = {
|
334
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
335
|
+
path_params: {'groupId' => group_id},
|
336
|
+
query_params: {'api-version' => @client.api_version},
|
337
|
+
body: request_content,
|
338
|
+
headers: request_headers.merge(custom_headers || {}),
|
339
|
+
base_url: request_url
|
340
|
+
}
|
341
|
+
promise = @client.make_request_async(:put, path_template, options)
|
342
|
+
|
343
|
+
promise = promise.then do |result|
|
344
|
+
http_response = result.response
|
345
|
+
status_code = http_response.status
|
346
|
+
response_content = http_response.body
|
347
|
+
unless status_code == 200
|
348
|
+
error_model = JSON.load(response_content)
|
349
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
350
|
+
end
|
351
|
+
|
352
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
353
|
+
# Deserialize Response
|
354
|
+
if status_code == 200
|
355
|
+
begin
|
356
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
357
|
+
result_mapper = Azure::ResourcesManagement::Mgmt::V2017_11_01_preview::Models::ManagementGroup.mapper()
|
358
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
359
|
+
rescue Exception => e
|
360
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
361
|
+
end
|
362
|
+
end
|
363
|
+
|
364
|
+
result
|
365
|
+
end
|
366
|
+
|
367
|
+
promise.execute
|
368
|
+
end
|
369
|
+
|
370
|
+
#
|
371
|
+
# Update a management group.
|
372
|
+
#
|
373
|
+
#
|
374
|
+
# @param group_id [String] Management Group ID.
|
375
|
+
# @param create_group_request [CreateGroupRequest] Management group creation
|
376
|
+
# parameters.
|
377
|
+
# @param cache_control [String] Indicates that the request shouldn't utilize
|
378
|
+
# any caches.
|
379
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
380
|
+
# will be added to the HTTP request.
|
381
|
+
#
|
382
|
+
# @return [ManagementGroup] operation results.
|
383
|
+
#
|
384
|
+
def update(group_id, create_group_request, cache_control:'no-cache', custom_headers:nil)
|
385
|
+
response = update_async(group_id, create_group_request, cache_control:cache_control, custom_headers:custom_headers).value!
|
386
|
+
response.body unless response.nil?
|
387
|
+
end
|
388
|
+
|
389
|
+
#
|
390
|
+
# Update a management group.
|
391
|
+
#
|
392
|
+
#
|
393
|
+
# @param group_id [String] Management Group ID.
|
394
|
+
# @param create_group_request [CreateGroupRequest] Management group creation
|
395
|
+
# parameters.
|
396
|
+
# @param cache_control [String] Indicates that the request shouldn't utilize
|
397
|
+
# any caches.
|
398
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
399
|
+
# will be added to the HTTP request.
|
400
|
+
#
|
401
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
402
|
+
#
|
403
|
+
def update_with_http_info(group_id, create_group_request, cache_control:'no-cache', custom_headers:nil)
|
404
|
+
update_async(group_id, create_group_request, cache_control:cache_control, custom_headers:custom_headers).value!
|
405
|
+
end
|
406
|
+
|
407
|
+
#
|
408
|
+
# Update a management group.
|
409
|
+
#
|
410
|
+
#
|
411
|
+
# @param group_id [String] Management Group ID.
|
412
|
+
# @param create_group_request [CreateGroupRequest] Management group creation
|
413
|
+
# parameters.
|
414
|
+
# @param cache_control [String] Indicates that the request shouldn't utilize
|
415
|
+
# any caches.
|
416
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
417
|
+
# to the HTTP request.
|
418
|
+
#
|
419
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
420
|
+
#
|
421
|
+
def update_async(group_id, create_group_request, cache_control:'no-cache', custom_headers:nil)
|
422
|
+
fail ArgumentError, 'group_id is nil' if group_id.nil?
|
423
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
424
|
+
fail ArgumentError, 'create_group_request is nil' if create_group_request.nil?
|
425
|
+
|
426
|
+
|
427
|
+
request_headers = {}
|
428
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
429
|
+
|
430
|
+
# Set Headers
|
431
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
432
|
+
request_headers['Cache-Control'] = cache_control unless cache_control.nil?
|
433
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
434
|
+
|
435
|
+
# Serialize Request
|
436
|
+
request_mapper = Azure::ResourcesManagement::Mgmt::V2017_11_01_preview::Models::CreateGroupRequest.mapper()
|
437
|
+
request_content = @client.serialize(request_mapper, create_group_request)
|
438
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
439
|
+
|
440
|
+
path_template = 'providers/Microsoft.Management/managementGroups/{groupId}'
|
441
|
+
|
442
|
+
request_url = @base_url || @client.base_url
|
443
|
+
|
444
|
+
options = {
|
445
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
446
|
+
path_params: {'groupId' => group_id},
|
447
|
+
query_params: {'api-version' => @client.api_version},
|
448
|
+
body: request_content,
|
449
|
+
headers: request_headers.merge(custom_headers || {}),
|
450
|
+
base_url: request_url
|
451
|
+
}
|
452
|
+
promise = @client.make_request_async(:patch, path_template, options)
|
453
|
+
|
454
|
+
promise = promise.then do |result|
|
455
|
+
http_response = result.response
|
456
|
+
status_code = http_response.status
|
457
|
+
response_content = http_response.body
|
458
|
+
unless status_code == 200
|
459
|
+
error_model = JSON.load(response_content)
|
460
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
461
|
+
end
|
462
|
+
|
463
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
464
|
+
# Deserialize Response
|
465
|
+
if status_code == 200
|
466
|
+
begin
|
467
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
468
|
+
result_mapper = Azure::ResourcesManagement::Mgmt::V2017_11_01_preview::Models::ManagementGroup.mapper()
|
469
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
470
|
+
rescue Exception => e
|
471
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
472
|
+
end
|
473
|
+
end
|
474
|
+
|
475
|
+
result
|
476
|
+
end
|
477
|
+
|
478
|
+
promise.execute
|
479
|
+
end
|
480
|
+
|
481
|
+
#
|
482
|
+
# Delete management group.
|
483
|
+
# If a management group contains child resources, the request will fail.
|
484
|
+
#
|
485
|
+
#
|
486
|
+
# @param group_id [String] Management Group ID.
|
487
|
+
# @param cache_control [String] Indicates that the request shouldn't utilize
|
488
|
+
# any caches.
|
489
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
490
|
+
# will be added to the HTTP request.
|
491
|
+
#
|
492
|
+
#
|
493
|
+
def delete(group_id, cache_control:'no-cache', custom_headers:nil)
|
494
|
+
response = delete_async(group_id, cache_control:cache_control, custom_headers:custom_headers).value!
|
495
|
+
nil
|
496
|
+
end
|
497
|
+
|
498
|
+
#
|
499
|
+
# Delete management group.
|
500
|
+
# If a management group contains child resources, the request will fail.
|
501
|
+
#
|
502
|
+
#
|
503
|
+
# @param group_id [String] Management Group ID.
|
504
|
+
# @param cache_control [String] Indicates that the request shouldn't utilize
|
505
|
+
# any caches.
|
506
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
507
|
+
# will be added to the HTTP request.
|
508
|
+
#
|
509
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
510
|
+
#
|
511
|
+
def delete_with_http_info(group_id, cache_control:'no-cache', custom_headers:nil)
|
512
|
+
delete_async(group_id, cache_control:cache_control, custom_headers:custom_headers).value!
|
513
|
+
end
|
514
|
+
|
515
|
+
#
|
516
|
+
# Delete management group.
|
517
|
+
# If a management group contains child resources, the request will fail.
|
518
|
+
#
|
519
|
+
#
|
520
|
+
# @param group_id [String] Management Group ID.
|
521
|
+
# @param cache_control [String] Indicates that the request shouldn't utilize
|
522
|
+
# any caches.
|
523
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
524
|
+
# to the HTTP request.
|
525
|
+
#
|
526
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
527
|
+
#
|
528
|
+
def delete_async(group_id, cache_control:'no-cache', custom_headers:nil)
|
529
|
+
fail ArgumentError, 'group_id is nil' if group_id.nil?
|
530
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
531
|
+
|
532
|
+
|
533
|
+
request_headers = {}
|
534
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
535
|
+
|
536
|
+
# Set Headers
|
537
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
538
|
+
request_headers['Cache-Control'] = cache_control unless cache_control.nil?
|
539
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
540
|
+
path_template = 'providers/Microsoft.Management/managementGroups/{groupId}'
|
541
|
+
|
542
|
+
request_url = @base_url || @client.base_url
|
543
|
+
|
544
|
+
options = {
|
545
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
546
|
+
path_params: {'groupId' => group_id},
|
547
|
+
query_params: {'api-version' => @client.api_version},
|
548
|
+
headers: request_headers.merge(custom_headers || {}),
|
549
|
+
base_url: request_url
|
550
|
+
}
|
551
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
552
|
+
|
553
|
+
promise = promise.then do |result|
|
554
|
+
http_response = result.response
|
555
|
+
status_code = http_response.status
|
556
|
+
response_content = http_response.body
|
557
|
+
unless status_code == 200 || status_code == 204
|
558
|
+
error_model = JSON.load(response_content)
|
559
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
560
|
+
end
|
561
|
+
|
562
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
563
|
+
|
564
|
+
result
|
565
|
+
end
|
566
|
+
|
567
|
+
promise.execute
|
568
|
+
end
|
569
|
+
|
570
|
+
#
|
571
|
+
# List management groups for the authenticated user.
|
572
|
+
#
|
573
|
+
#
|
574
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
575
|
+
# to List operation.
|
576
|
+
# @param cache_control [String] Indicates that the request shouldn't utilize
|
577
|
+
# any caches.
|
578
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
579
|
+
# will be added to the HTTP request.
|
580
|
+
#
|
581
|
+
# @return [ManagementGroupListResult] operation results.
|
582
|
+
#
|
583
|
+
def list_next(next_page_link, cache_control:'no-cache', custom_headers:nil)
|
584
|
+
response = list_next_async(next_page_link, cache_control:cache_control, custom_headers:custom_headers).value!
|
585
|
+
response.body unless response.nil?
|
586
|
+
end
|
587
|
+
|
588
|
+
#
|
589
|
+
# List management groups for the authenticated user.
|
590
|
+
#
|
591
|
+
#
|
592
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
593
|
+
# to List operation.
|
594
|
+
# @param cache_control [String] Indicates that the request shouldn't utilize
|
595
|
+
# any caches.
|
596
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
597
|
+
# will be added to the HTTP request.
|
598
|
+
#
|
599
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
600
|
+
#
|
601
|
+
def list_next_with_http_info(next_page_link, cache_control:'no-cache', custom_headers:nil)
|
602
|
+
list_next_async(next_page_link, cache_control:cache_control, custom_headers:custom_headers).value!
|
603
|
+
end
|
604
|
+
|
605
|
+
#
|
606
|
+
# List management groups for the authenticated user.
|
607
|
+
#
|
608
|
+
#
|
609
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
610
|
+
# to List operation.
|
611
|
+
# @param cache_control [String] Indicates that the request shouldn't utilize
|
612
|
+
# any caches.
|
613
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
614
|
+
# to the HTTP request.
|
615
|
+
#
|
616
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
617
|
+
#
|
618
|
+
def list_next_async(next_page_link, cache_control:'no-cache', custom_headers:nil)
|
619
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
620
|
+
|
621
|
+
|
622
|
+
request_headers = {}
|
623
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
624
|
+
|
625
|
+
# Set Headers
|
626
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
627
|
+
request_headers['Cache-Control'] = cache_control unless cache_control.nil?
|
628
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
629
|
+
path_template = '{nextLink}'
|
630
|
+
|
631
|
+
request_url = @base_url || @client.base_url
|
632
|
+
|
633
|
+
options = {
|
634
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
635
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
636
|
+
headers: request_headers.merge(custom_headers || {}),
|
637
|
+
base_url: request_url
|
638
|
+
}
|
639
|
+
promise = @client.make_request_async(:get, path_template, options)
|
640
|
+
|
641
|
+
promise = promise.then do |result|
|
642
|
+
http_response = result.response
|
643
|
+
status_code = http_response.status
|
644
|
+
response_content = http_response.body
|
645
|
+
unless status_code == 200
|
646
|
+
error_model = JSON.load(response_content)
|
647
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
648
|
+
end
|
649
|
+
|
650
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
651
|
+
# Deserialize Response
|
652
|
+
if status_code == 200
|
653
|
+
begin
|
654
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
655
|
+
result_mapper = Azure::ResourcesManagement::Mgmt::V2017_11_01_preview::Models::ManagementGroupListResult.mapper()
|
656
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
657
|
+
rescue Exception => e
|
658
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
659
|
+
end
|
660
|
+
end
|
661
|
+
|
662
|
+
result
|
663
|
+
end
|
664
|
+
|
665
|
+
promise.execute
|
666
|
+
end
|
667
|
+
|
668
|
+
#
|
669
|
+
# List management groups for the authenticated user.
|
670
|
+
#
|
671
|
+
#
|
672
|
+
# @param cache_control [String] Indicates that the request shouldn't utilize
|
673
|
+
# any caches.
|
674
|
+
# @param skiptoken [String] Page continuation token is only used if a previous
|
675
|
+
# operation returned a partial result.
|
676
|
+
# If a previous response contains a nextLink element, the value of the nextLink
|
677
|
+
# element will include a token parameter that specifies a starting point to use
|
678
|
+
# for subsequent calls.
|
679
|
+
#
|
680
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
681
|
+
# will be added to the HTTP request.
|
682
|
+
#
|
683
|
+
# @return [ManagementGroupListResult] which provide lazy access to pages of the
|
684
|
+
# response.
|
685
|
+
#
|
686
|
+
def list_as_lazy(cache_control:'no-cache', skiptoken:nil, custom_headers:nil)
|
687
|
+
response = list_async(cache_control:cache_control, skiptoken:skiptoken, custom_headers:custom_headers).value!
|
688
|
+
unless response.nil?
|
689
|
+
page = response.body
|
690
|
+
page.next_method = Proc.new do |next_page_link|
|
691
|
+
list_next_async(next_page_link, cache_control:cache_control, custom_headers:custom_headers)
|
692
|
+
end
|
693
|
+
page
|
694
|
+
end
|
695
|
+
end
|
696
|
+
|
697
|
+
end
|
698
|
+
end
|