azure_mgmt_policy 0.13.0 → 0.14.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/generated/azure_mgmt_policy/models/error_response.rb +0 -1
- data/lib/generated/azure_mgmt_policy/models/policy_assignment.rb +0 -1
- data/lib/generated/azure_mgmt_policy/models/policy_definition.rb +0 -1
- data/lib/generated/azure_mgmt_policy/models/policy_definition_reference.rb +0 -1
- data/lib/generated/azure_mgmt_policy/models/policy_set_definition.rb +0 -1
- data/lib/generated/azure_mgmt_policy/models/policy_sku.rb +0 -1
- data/lib/generated/azure_mgmt_policy/policy_definitions.rb +768 -20
- data/lib/generated/azure_mgmt_policy/policy_set_definitions.rb +777 -15
- data/lib/generated/azure_mgmt_policy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce6819415ad27cd3a642c78a7f764ea4d7207ae0
|
4
|
+
data.tar.gz: cf6f949d7465de7bee2255db86c86b3070edb587
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7715e3d9e624101724e03f131d0d99c9ebed91e918d22f044b443cec62f1d475b8898e030ec431dd142986725ff85935d0b10e483ef87f0e942237e61295ca5
|
7
|
+
data.tar.gz: 248f8137e558c2d0746edb85b3a391adf3244cd151db6d162ace601382e8d75ddd00be52c32a1449265dc1c6e3a273cc06fe829c2cecb700b186e3f3eef075b8
|
@@ -12,7 +12,6 @@ module Azure::ARM::Policy
|
|
12
12
|
|
13
13
|
include MsRestAzure
|
14
14
|
|
15
|
-
include MsRest::JSONable
|
16
15
|
# @return [PolicyType] The type of policy definition. Possible values are
|
17
16
|
# NotSpecified, BuiltIn, and Custom. Possible values include:
|
18
17
|
# 'NotSpecified', 'BuiltIn', 'Custom'
|
@@ -12,7 +12,6 @@ module Azure::ARM::Policy
|
|
12
12
|
|
13
13
|
include MsRestAzure
|
14
14
|
|
15
|
-
include MsRest::JSONable
|
16
15
|
# @return [PolicyType] The type of policy definition. Possible values are
|
17
16
|
# NotSpecified, BuiltIn, and Custom. Possible values include:
|
18
17
|
# 'NotSpecified', 'BuiltIn', 'Custom'
|
@@ -84,7 +84,7 @@ module Azure::ARM::Policy
|
|
84
84
|
request_content = @client.serialize(request_mapper, parameters)
|
85
85
|
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
86
86
|
|
87
|
-
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/
|
87
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'
|
88
88
|
|
89
89
|
request_url = @base_url || @client.base_url
|
90
90
|
|
@@ -174,7 +174,7 @@ module Azure::ARM::Policy
|
|
174
174
|
# Set Headers
|
175
175
|
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
176
176
|
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
177
|
-
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/
|
177
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'
|
178
178
|
|
179
179
|
request_url = @base_url || @client.base_url
|
180
180
|
|
@@ -254,7 +254,7 @@ module Azure::ARM::Policy
|
|
254
254
|
# Set Headers
|
255
255
|
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
256
256
|
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
257
|
-
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/
|
257
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'
|
258
258
|
|
259
259
|
request_url = @base_url || @client.base_url
|
260
260
|
|
@@ -294,45 +294,579 @@ module Azure::ARM::Policy
|
|
294
294
|
promise.execute
|
295
295
|
end
|
296
296
|
|
297
|
+
#
|
298
|
+
# Gets the built in policy definition.
|
299
|
+
#
|
300
|
+
# @param policy_definition_name [String] The name of the built in policy
|
301
|
+
# definition to get.
|
302
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
303
|
+
# will be added to the HTTP request.
|
304
|
+
#
|
305
|
+
# @return [PolicyDefinition] operation results.
|
306
|
+
#
|
307
|
+
def get_built_in(policy_definition_name, custom_headers = nil)
|
308
|
+
response = get_built_in_async(policy_definition_name, custom_headers).value!
|
309
|
+
response.body unless response.nil?
|
310
|
+
end
|
311
|
+
|
312
|
+
#
|
313
|
+
# Gets the built in policy definition.
|
314
|
+
#
|
315
|
+
# @param policy_definition_name [String] The name of the built in policy
|
316
|
+
# definition to get.
|
317
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
318
|
+
# will be added to the HTTP request.
|
319
|
+
#
|
320
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
321
|
+
#
|
322
|
+
def get_built_in_with_http_info(policy_definition_name, custom_headers = nil)
|
323
|
+
get_built_in_async(policy_definition_name, custom_headers).value!
|
324
|
+
end
|
325
|
+
|
326
|
+
#
|
327
|
+
# Gets the built in policy definition.
|
328
|
+
#
|
329
|
+
# @param policy_definition_name [String] The name of the built in policy
|
330
|
+
# definition to get.
|
331
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
332
|
+
# to the HTTP request.
|
333
|
+
#
|
334
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
335
|
+
#
|
336
|
+
def get_built_in_async(policy_definition_name, custom_headers = nil)
|
337
|
+
fail ArgumentError, 'policy_definition_name is nil' if policy_definition_name.nil?
|
338
|
+
api_version = '2016-12-01'
|
339
|
+
|
340
|
+
|
341
|
+
request_headers = {}
|
342
|
+
|
343
|
+
# Set Headers
|
344
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
345
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
346
|
+
path_template = 'providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'
|
347
|
+
|
348
|
+
request_url = @base_url || @client.base_url
|
349
|
+
|
350
|
+
options = {
|
351
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
352
|
+
path_params: {'policyDefinitionName' => policy_definition_name},
|
353
|
+
query_params: {'api-version' => api_version},
|
354
|
+
headers: request_headers.merge(custom_headers || {}),
|
355
|
+
base_url: request_url
|
356
|
+
}
|
357
|
+
promise = @client.make_request_async(:get, path_template, options)
|
358
|
+
|
359
|
+
promise = promise.then do |result|
|
360
|
+
http_response = result.response
|
361
|
+
status_code = http_response.status
|
362
|
+
response_content = http_response.body
|
363
|
+
unless status_code == 200
|
364
|
+
error_model = JSON.load(response_content)
|
365
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
366
|
+
end
|
367
|
+
|
368
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
369
|
+
# Deserialize Response
|
370
|
+
if status_code == 200
|
371
|
+
begin
|
372
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
373
|
+
result_mapper = Azure::ARM::Policy::Models::PolicyDefinition.mapper()
|
374
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
375
|
+
rescue Exception => e
|
376
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
377
|
+
end
|
378
|
+
end
|
379
|
+
|
380
|
+
result
|
381
|
+
end
|
382
|
+
|
383
|
+
promise.execute
|
384
|
+
end
|
385
|
+
|
386
|
+
#
|
387
|
+
# Creates or updates a policy definition at management group level.
|
388
|
+
#
|
389
|
+
# @param policy_definition_name [String] The name of the policy definition to
|
390
|
+
# create.
|
391
|
+
# @param parameters [PolicyDefinition] The policy definition properties.
|
392
|
+
# @param management_group_id [String] The ID of the management group.
|
393
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
394
|
+
# will be added to the HTTP request.
|
395
|
+
#
|
396
|
+
# @return [PolicyDefinition] operation results.
|
397
|
+
#
|
398
|
+
def create_or_update_at_management_group(policy_definition_name, parameters, management_group_id, custom_headers = nil)
|
399
|
+
response = create_or_update_at_management_group_async(policy_definition_name, parameters, management_group_id, custom_headers).value!
|
400
|
+
response.body unless response.nil?
|
401
|
+
end
|
402
|
+
|
403
|
+
#
|
404
|
+
# Creates or updates a policy definition at management group level.
|
405
|
+
#
|
406
|
+
# @param policy_definition_name [String] The name of the policy definition to
|
407
|
+
# create.
|
408
|
+
# @param parameters [PolicyDefinition] The policy definition properties.
|
409
|
+
# @param management_group_id [String] The ID of the management group.
|
410
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
411
|
+
# will be added to the HTTP request.
|
412
|
+
#
|
413
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
414
|
+
#
|
415
|
+
def create_or_update_at_management_group_with_http_info(policy_definition_name, parameters, management_group_id, custom_headers = nil)
|
416
|
+
create_or_update_at_management_group_async(policy_definition_name, parameters, management_group_id, custom_headers).value!
|
417
|
+
end
|
418
|
+
|
419
|
+
#
|
420
|
+
# Creates or updates a policy definition at management group level.
|
421
|
+
#
|
422
|
+
# @param policy_definition_name [String] The name of the policy definition to
|
423
|
+
# create.
|
424
|
+
# @param parameters [PolicyDefinition] The policy definition properties.
|
425
|
+
# @param management_group_id [String] The ID of the management group.
|
426
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
427
|
+
# to the HTTP request.
|
428
|
+
#
|
429
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
430
|
+
#
|
431
|
+
def create_or_update_at_management_group_async(policy_definition_name, parameters, management_group_id, custom_headers = nil)
|
432
|
+
fail ArgumentError, 'policy_definition_name is nil' if policy_definition_name.nil?
|
433
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
434
|
+
api_version = '2016-12-01'
|
435
|
+
fail ArgumentError, 'management_group_id is nil' if management_group_id.nil?
|
436
|
+
|
437
|
+
|
438
|
+
request_headers = {}
|
439
|
+
|
440
|
+
# Set Headers
|
441
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
442
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
443
|
+
|
444
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
445
|
+
|
446
|
+
# Serialize Request
|
447
|
+
request_mapper = Azure::ARM::Policy::Models::PolicyDefinition.mapper()
|
448
|
+
request_content = @client.serialize(request_mapper, parameters)
|
449
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
450
|
+
|
451
|
+
path_template = 'providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'
|
452
|
+
|
453
|
+
request_url = @base_url || @client.base_url
|
454
|
+
|
455
|
+
options = {
|
456
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
457
|
+
path_params: {'policyDefinitionName' => policy_definition_name,'managementGroupId' => management_group_id},
|
458
|
+
query_params: {'api-version' => api_version},
|
459
|
+
body: request_content,
|
460
|
+
headers: request_headers.merge(custom_headers || {}),
|
461
|
+
base_url: request_url
|
462
|
+
}
|
463
|
+
promise = @client.make_request_async(:put, path_template, options)
|
464
|
+
|
465
|
+
promise = promise.then do |result|
|
466
|
+
http_response = result.response
|
467
|
+
status_code = http_response.status
|
468
|
+
response_content = http_response.body
|
469
|
+
unless status_code == 201
|
470
|
+
error_model = JSON.load(response_content)
|
471
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
472
|
+
end
|
473
|
+
|
474
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
475
|
+
# Deserialize Response
|
476
|
+
if status_code == 201
|
477
|
+
begin
|
478
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
479
|
+
result_mapper = Azure::ARM::Policy::Models::PolicyDefinition.mapper()
|
480
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
481
|
+
rescue Exception => e
|
482
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
483
|
+
end
|
484
|
+
end
|
485
|
+
|
486
|
+
result
|
487
|
+
end
|
488
|
+
|
489
|
+
promise.execute
|
490
|
+
end
|
491
|
+
|
492
|
+
#
|
493
|
+
# Deletes a policy definition at management group level.
|
494
|
+
#
|
495
|
+
# @param policy_definition_name [String] The name of the policy definition to
|
496
|
+
# delete.
|
497
|
+
# @param management_group_id [String] The ID of the management group.
|
498
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
499
|
+
# will be added to the HTTP request.
|
500
|
+
#
|
501
|
+
#
|
502
|
+
def delete_at_management_group(policy_definition_name, management_group_id, custom_headers = nil)
|
503
|
+
response = delete_at_management_group_async(policy_definition_name, management_group_id, custom_headers).value!
|
504
|
+
nil
|
505
|
+
end
|
506
|
+
|
507
|
+
#
|
508
|
+
# Deletes a policy definition at management group level.
|
509
|
+
#
|
510
|
+
# @param policy_definition_name [String] The name of the policy definition to
|
511
|
+
# delete.
|
512
|
+
# @param management_group_id [String] The ID of the management group.
|
513
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
514
|
+
# will be added to the HTTP request.
|
515
|
+
#
|
516
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
517
|
+
#
|
518
|
+
def delete_at_management_group_with_http_info(policy_definition_name, management_group_id, custom_headers = nil)
|
519
|
+
delete_at_management_group_async(policy_definition_name, management_group_id, custom_headers).value!
|
520
|
+
end
|
521
|
+
|
522
|
+
#
|
523
|
+
# Deletes a policy definition at management group level.
|
524
|
+
#
|
525
|
+
# @param policy_definition_name [String] The name of the policy definition to
|
526
|
+
# delete.
|
527
|
+
# @param management_group_id [String] The ID of the management group.
|
528
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
529
|
+
# to the HTTP request.
|
530
|
+
#
|
531
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
532
|
+
#
|
533
|
+
def delete_at_management_group_async(policy_definition_name, management_group_id, custom_headers = nil)
|
534
|
+
fail ArgumentError, 'policy_definition_name is nil' if policy_definition_name.nil?
|
535
|
+
api_version = '2016-12-01'
|
536
|
+
fail ArgumentError, 'management_group_id is nil' if management_group_id.nil?
|
537
|
+
|
538
|
+
|
539
|
+
request_headers = {}
|
540
|
+
|
541
|
+
# Set Headers
|
542
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
543
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
544
|
+
path_template = 'providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'
|
545
|
+
|
546
|
+
request_url = @base_url || @client.base_url
|
547
|
+
|
548
|
+
options = {
|
549
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
550
|
+
path_params: {'policyDefinitionName' => policy_definition_name,'managementGroupId' => management_group_id},
|
551
|
+
query_params: {'api-version' => api_version},
|
552
|
+
headers: request_headers.merge(custom_headers || {}),
|
553
|
+
base_url: request_url
|
554
|
+
}
|
555
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
556
|
+
|
557
|
+
promise = promise.then do |result|
|
558
|
+
http_response = result.response
|
559
|
+
status_code = http_response.status
|
560
|
+
response_content = http_response.body
|
561
|
+
unless status_code == 204 || status_code == 200
|
562
|
+
error_model = JSON.load(response_content)
|
563
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
564
|
+
end
|
565
|
+
|
566
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
567
|
+
|
568
|
+
result
|
569
|
+
end
|
570
|
+
|
571
|
+
promise.execute
|
572
|
+
end
|
573
|
+
|
574
|
+
#
|
575
|
+
# Gets the policy definition at management group level.
|
576
|
+
#
|
577
|
+
# @param policy_definition_name [String] The name of the policy definition to
|
578
|
+
# get.
|
579
|
+
# @param management_group_id [String] The ID of the management group.
|
580
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
581
|
+
# will be added to the HTTP request.
|
582
|
+
#
|
583
|
+
# @return [PolicyDefinition] operation results.
|
584
|
+
#
|
585
|
+
def get_at_management_group(policy_definition_name, management_group_id, custom_headers = nil)
|
586
|
+
response = get_at_management_group_async(policy_definition_name, management_group_id, custom_headers).value!
|
587
|
+
response.body unless response.nil?
|
588
|
+
end
|
589
|
+
|
590
|
+
#
|
591
|
+
# Gets the policy definition at management group level.
|
592
|
+
#
|
593
|
+
# @param policy_definition_name [String] The name of the policy definition to
|
594
|
+
# get.
|
595
|
+
# @param management_group_id [String] The ID of the management group.
|
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 get_at_management_group_with_http_info(policy_definition_name, management_group_id, custom_headers = nil)
|
602
|
+
get_at_management_group_async(policy_definition_name, management_group_id, custom_headers).value!
|
603
|
+
end
|
604
|
+
|
605
|
+
#
|
606
|
+
# Gets the policy definition at management group level.
|
607
|
+
#
|
608
|
+
# @param policy_definition_name [String] The name of the policy definition to
|
609
|
+
# get.
|
610
|
+
# @param management_group_id [String] The ID of the management group.
|
611
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
612
|
+
# to the HTTP request.
|
613
|
+
#
|
614
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
615
|
+
#
|
616
|
+
def get_at_management_group_async(policy_definition_name, management_group_id, custom_headers = nil)
|
617
|
+
fail ArgumentError, 'policy_definition_name is nil' if policy_definition_name.nil?
|
618
|
+
api_version = '2016-12-01'
|
619
|
+
fail ArgumentError, 'management_group_id is nil' if management_group_id.nil?
|
620
|
+
|
621
|
+
|
622
|
+
request_headers = {}
|
623
|
+
|
624
|
+
# Set Headers
|
625
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
626
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
627
|
+
path_template = 'providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'
|
628
|
+
|
629
|
+
request_url = @base_url || @client.base_url
|
630
|
+
|
631
|
+
options = {
|
632
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
633
|
+
path_params: {'policyDefinitionName' => policy_definition_name,'managementGroupId' => management_group_id},
|
634
|
+
query_params: {'api-version' => api_version},
|
635
|
+
headers: request_headers.merge(custom_headers || {}),
|
636
|
+
base_url: request_url
|
637
|
+
}
|
638
|
+
promise = @client.make_request_async(:get, path_template, options)
|
639
|
+
|
640
|
+
promise = promise.then do |result|
|
641
|
+
http_response = result.response
|
642
|
+
status_code = http_response.status
|
643
|
+
response_content = http_response.body
|
644
|
+
unless status_code == 200
|
645
|
+
error_model = JSON.load(response_content)
|
646
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
647
|
+
end
|
648
|
+
|
649
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
650
|
+
# Deserialize Response
|
651
|
+
if status_code == 200
|
652
|
+
begin
|
653
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
654
|
+
result_mapper = Azure::ARM::Policy::Models::PolicyDefinition.mapper()
|
655
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
656
|
+
rescue Exception => e
|
657
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
658
|
+
end
|
659
|
+
end
|
660
|
+
|
661
|
+
result
|
662
|
+
end
|
663
|
+
|
664
|
+
promise.execute
|
665
|
+
end
|
666
|
+
|
667
|
+
#
|
668
|
+
# Gets all the policy definitions for a subscription.
|
669
|
+
#
|
670
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
671
|
+
# will be added to the HTTP request.
|
672
|
+
#
|
673
|
+
# @return [Array<PolicyDefinition>] operation results.
|
674
|
+
#
|
675
|
+
def list(custom_headers = nil)
|
676
|
+
first_page = list_as_lazy(custom_headers)
|
677
|
+
first_page.get_all_items
|
678
|
+
end
|
679
|
+
|
680
|
+
#
|
681
|
+
# Gets all the policy definitions for a subscription.
|
682
|
+
#
|
683
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
684
|
+
# will be added to the HTTP request.
|
685
|
+
#
|
686
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
687
|
+
#
|
688
|
+
def list_with_http_info(custom_headers = nil)
|
689
|
+
list_async(custom_headers).value!
|
690
|
+
end
|
691
|
+
|
297
692
|
#
|
298
693
|
# Gets all the policy definitions for a subscription.
|
299
694
|
#
|
300
|
-
# @param
|
695
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
696
|
+
# to the HTTP request.
|
697
|
+
#
|
698
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
699
|
+
#
|
700
|
+
def list_async(custom_headers = nil)
|
701
|
+
api_version = '2016-12-01'
|
702
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
703
|
+
|
704
|
+
|
705
|
+
request_headers = {}
|
706
|
+
|
707
|
+
# Set Headers
|
708
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
709
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
710
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions'
|
711
|
+
|
712
|
+
request_url = @base_url || @client.base_url
|
713
|
+
|
714
|
+
options = {
|
715
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
716
|
+
path_params: {'subscriptionId' => @client.subscription_id},
|
717
|
+
query_params: {'api-version' => api_version},
|
718
|
+
headers: request_headers.merge(custom_headers || {}),
|
719
|
+
base_url: request_url
|
720
|
+
}
|
721
|
+
promise = @client.make_request_async(:get, path_template, options)
|
722
|
+
|
723
|
+
promise = promise.then do |result|
|
724
|
+
http_response = result.response
|
725
|
+
status_code = http_response.status
|
726
|
+
response_content = http_response.body
|
727
|
+
unless status_code == 200
|
728
|
+
error_model = JSON.load(response_content)
|
729
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
730
|
+
end
|
731
|
+
|
732
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
733
|
+
# Deserialize Response
|
734
|
+
if status_code == 200
|
735
|
+
begin
|
736
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
737
|
+
result_mapper = Azure::ARM::Policy::Models::PolicyDefinitionListResult.mapper()
|
738
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
739
|
+
rescue Exception => e
|
740
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
741
|
+
end
|
742
|
+
end
|
743
|
+
|
744
|
+
result
|
745
|
+
end
|
746
|
+
|
747
|
+
promise.execute
|
748
|
+
end
|
749
|
+
|
750
|
+
#
|
751
|
+
# Gets all the built in policy definitions.
|
752
|
+
#
|
753
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
754
|
+
# will be added to the HTTP request.
|
755
|
+
#
|
756
|
+
# @return [Array<PolicyDefinition>] operation results.
|
757
|
+
#
|
758
|
+
def list_built_in(custom_headers = nil)
|
759
|
+
first_page = list_built_in_as_lazy(custom_headers)
|
760
|
+
first_page.get_all_items
|
761
|
+
end
|
762
|
+
|
763
|
+
#
|
764
|
+
# Gets all the built in policy definitions.
|
765
|
+
#
|
766
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
767
|
+
# will be added to the HTTP request.
|
768
|
+
#
|
769
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
770
|
+
#
|
771
|
+
def list_built_in_with_http_info(custom_headers = nil)
|
772
|
+
list_built_in_async(custom_headers).value!
|
773
|
+
end
|
774
|
+
|
775
|
+
#
|
776
|
+
# Gets all the built in policy definitions.
|
777
|
+
#
|
778
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
779
|
+
# to the HTTP request.
|
780
|
+
#
|
781
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
782
|
+
#
|
783
|
+
def list_built_in_async(custom_headers = nil)
|
784
|
+
api_version = '2016-12-01'
|
785
|
+
|
786
|
+
|
787
|
+
request_headers = {}
|
788
|
+
|
789
|
+
# Set Headers
|
790
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
791
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
792
|
+
path_template = 'providers/Microsoft.Authorization/policyDefinitions'
|
793
|
+
|
794
|
+
request_url = @base_url || @client.base_url
|
795
|
+
|
796
|
+
options = {
|
797
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
798
|
+
query_params: {'api-version' => api_version},
|
799
|
+
headers: request_headers.merge(custom_headers || {}),
|
800
|
+
base_url: request_url
|
801
|
+
}
|
802
|
+
promise = @client.make_request_async(:get, path_template, options)
|
803
|
+
|
804
|
+
promise = promise.then do |result|
|
805
|
+
http_response = result.response
|
806
|
+
status_code = http_response.status
|
807
|
+
response_content = http_response.body
|
808
|
+
unless status_code == 200
|
809
|
+
error_model = JSON.load(response_content)
|
810
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
811
|
+
end
|
812
|
+
|
813
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
814
|
+
# Deserialize Response
|
815
|
+
if status_code == 200
|
816
|
+
begin
|
817
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
818
|
+
result_mapper = Azure::ARM::Policy::Models::PolicyDefinitionListResult.mapper()
|
819
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
820
|
+
rescue Exception => e
|
821
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
822
|
+
end
|
823
|
+
end
|
824
|
+
|
825
|
+
result
|
826
|
+
end
|
827
|
+
|
828
|
+
promise.execute
|
829
|
+
end
|
830
|
+
|
831
|
+
#
|
832
|
+
# Gets all the policy definitions for a subscription at management group level.
|
833
|
+
#
|
834
|
+
# @param management_group_id [String] The ID of the management group.
|
301
835
|
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
302
836
|
# will be added to the HTTP request.
|
303
837
|
#
|
304
838
|
# @return [Array<PolicyDefinition>] operation results.
|
305
839
|
#
|
306
|
-
def
|
307
|
-
first_page =
|
840
|
+
def list_by_management_group(management_group_id, custom_headers = nil)
|
841
|
+
first_page = list_by_management_group_as_lazy(management_group_id, custom_headers)
|
308
842
|
first_page.get_all_items
|
309
843
|
end
|
310
844
|
|
311
845
|
#
|
312
|
-
# Gets all the policy definitions for a subscription.
|
846
|
+
# Gets all the policy definitions for a subscription at management group level.
|
313
847
|
#
|
314
|
-
# @param
|
848
|
+
# @param management_group_id [String] The ID of the management group.
|
315
849
|
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
316
850
|
# will be added to the HTTP request.
|
317
851
|
#
|
318
852
|
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
319
853
|
#
|
320
|
-
def
|
321
|
-
|
854
|
+
def list_by_management_group_with_http_info(management_group_id, custom_headers = nil)
|
855
|
+
list_by_management_group_async(management_group_id, custom_headers).value!
|
322
856
|
end
|
323
857
|
|
324
858
|
#
|
325
|
-
# Gets all the policy definitions for a subscription.
|
859
|
+
# Gets all the policy definitions for a subscription at management group level.
|
326
860
|
#
|
327
|
-
# @param
|
861
|
+
# @param management_group_id [String] The ID of the management group.
|
328
862
|
# @param [Hash{String => String}] A hash of custom headers that will be added
|
329
863
|
# to the HTTP request.
|
330
864
|
#
|
331
865
|
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
332
866
|
#
|
333
|
-
def
|
867
|
+
def list_by_management_group_async(management_group_id, custom_headers = nil)
|
334
868
|
api_version = '2016-12-01'
|
335
|
-
fail ArgumentError, '
|
869
|
+
fail ArgumentError, 'management_group_id is nil' if management_group_id.nil?
|
336
870
|
|
337
871
|
|
338
872
|
request_headers = {}
|
@@ -340,14 +874,14 @@ module Azure::ARM::Policy
|
|
340
874
|
# Set Headers
|
341
875
|
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
342
876
|
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
343
|
-
path_template = '
|
877
|
+
path_template = 'providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions'
|
344
878
|
|
345
879
|
request_url = @base_url || @client.base_url
|
346
880
|
|
347
881
|
options = {
|
348
882
|
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
349
|
-
path_params: {'
|
350
|
-
query_params: {'
|
883
|
+
path_params: {'managementGroupId' => management_group_id},
|
884
|
+
query_params: {'api-version' => api_version},
|
351
885
|
headers: request_headers.merge(custom_headers || {}),
|
352
886
|
base_url: request_url
|
353
887
|
}
|
@@ -467,18 +1001,191 @@ module Azure::ARM::Policy
|
|
467
1001
|
promise.execute
|
468
1002
|
end
|
469
1003
|
|
1004
|
+
#
|
1005
|
+
# Gets all the built in policy definitions.
|
1006
|
+
#
|
1007
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1008
|
+
# to List operation.
|
1009
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1010
|
+
# will be added to the HTTP request.
|
1011
|
+
#
|
1012
|
+
# @return [PolicyDefinitionListResult] operation results.
|
1013
|
+
#
|
1014
|
+
def list_built_in_next(next_page_link, custom_headers = nil)
|
1015
|
+
response = list_built_in_next_async(next_page_link, custom_headers).value!
|
1016
|
+
response.body unless response.nil?
|
1017
|
+
end
|
1018
|
+
|
1019
|
+
#
|
1020
|
+
# Gets all the built in policy definitions.
|
1021
|
+
#
|
1022
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1023
|
+
# to List operation.
|
1024
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1025
|
+
# will be added to the HTTP request.
|
1026
|
+
#
|
1027
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
1028
|
+
#
|
1029
|
+
def list_built_in_next_with_http_info(next_page_link, custom_headers = nil)
|
1030
|
+
list_built_in_next_async(next_page_link, custom_headers).value!
|
1031
|
+
end
|
1032
|
+
|
1033
|
+
#
|
1034
|
+
# Gets all the built in policy definitions.
|
1035
|
+
#
|
1036
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1037
|
+
# to List operation.
|
1038
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
1039
|
+
# to the HTTP request.
|
1040
|
+
#
|
1041
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
1042
|
+
#
|
1043
|
+
def list_built_in_next_async(next_page_link, custom_headers = nil)
|
1044
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
1045
|
+
|
1046
|
+
|
1047
|
+
request_headers = {}
|
1048
|
+
|
1049
|
+
# Set Headers
|
1050
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1051
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1052
|
+
path_template = '{nextLink}'
|
1053
|
+
|
1054
|
+
request_url = @base_url || @client.base_url
|
1055
|
+
|
1056
|
+
options = {
|
1057
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1058
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
1059
|
+
headers: request_headers.merge(custom_headers || {}),
|
1060
|
+
base_url: request_url
|
1061
|
+
}
|
1062
|
+
promise = @client.make_request_async(:get, path_template, options)
|
1063
|
+
|
1064
|
+
promise = promise.then do |result|
|
1065
|
+
http_response = result.response
|
1066
|
+
status_code = http_response.status
|
1067
|
+
response_content = http_response.body
|
1068
|
+
unless status_code == 200
|
1069
|
+
error_model = JSON.load(response_content)
|
1070
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
1071
|
+
end
|
1072
|
+
|
1073
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1074
|
+
# Deserialize Response
|
1075
|
+
if status_code == 200
|
1076
|
+
begin
|
1077
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1078
|
+
result_mapper = Azure::ARM::Policy::Models::PolicyDefinitionListResult.mapper()
|
1079
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1080
|
+
rescue Exception => e
|
1081
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1082
|
+
end
|
1083
|
+
end
|
1084
|
+
|
1085
|
+
result
|
1086
|
+
end
|
1087
|
+
|
1088
|
+
promise.execute
|
1089
|
+
end
|
1090
|
+
|
1091
|
+
#
|
1092
|
+
# Gets all the policy definitions for a subscription at management group level.
|
1093
|
+
#
|
1094
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1095
|
+
# to List operation.
|
1096
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1097
|
+
# will be added to the HTTP request.
|
1098
|
+
#
|
1099
|
+
# @return [PolicyDefinitionListResult] operation results.
|
1100
|
+
#
|
1101
|
+
def list_by_management_group_next(next_page_link, custom_headers = nil)
|
1102
|
+
response = list_by_management_group_next_async(next_page_link, custom_headers).value!
|
1103
|
+
response.body unless response.nil?
|
1104
|
+
end
|
1105
|
+
|
1106
|
+
#
|
1107
|
+
# Gets all the policy definitions for a subscription at management group level.
|
1108
|
+
#
|
1109
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1110
|
+
# to List operation.
|
1111
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1112
|
+
# will be added to the HTTP request.
|
1113
|
+
#
|
1114
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
1115
|
+
#
|
1116
|
+
def list_by_management_group_next_with_http_info(next_page_link, custom_headers = nil)
|
1117
|
+
list_by_management_group_next_async(next_page_link, custom_headers).value!
|
1118
|
+
end
|
1119
|
+
|
1120
|
+
#
|
1121
|
+
# Gets all the policy definitions for a subscription at management group level.
|
1122
|
+
#
|
1123
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1124
|
+
# to List operation.
|
1125
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
1126
|
+
# to the HTTP request.
|
1127
|
+
#
|
1128
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
1129
|
+
#
|
1130
|
+
def list_by_management_group_next_async(next_page_link, custom_headers = nil)
|
1131
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
1132
|
+
|
1133
|
+
|
1134
|
+
request_headers = {}
|
1135
|
+
|
1136
|
+
# Set Headers
|
1137
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1138
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1139
|
+
path_template = '{nextLink}'
|
1140
|
+
|
1141
|
+
request_url = @base_url || @client.base_url
|
1142
|
+
|
1143
|
+
options = {
|
1144
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1145
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
1146
|
+
headers: request_headers.merge(custom_headers || {}),
|
1147
|
+
base_url: request_url
|
1148
|
+
}
|
1149
|
+
promise = @client.make_request_async(:get, path_template, options)
|
1150
|
+
|
1151
|
+
promise = promise.then do |result|
|
1152
|
+
http_response = result.response
|
1153
|
+
status_code = http_response.status
|
1154
|
+
response_content = http_response.body
|
1155
|
+
unless status_code == 200
|
1156
|
+
error_model = JSON.load(response_content)
|
1157
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
1158
|
+
end
|
1159
|
+
|
1160
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1161
|
+
# Deserialize Response
|
1162
|
+
if status_code == 200
|
1163
|
+
begin
|
1164
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1165
|
+
result_mapper = Azure::ARM::Policy::Models::PolicyDefinitionListResult.mapper()
|
1166
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1167
|
+
rescue Exception => e
|
1168
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1169
|
+
end
|
1170
|
+
end
|
1171
|
+
|
1172
|
+
result
|
1173
|
+
end
|
1174
|
+
|
1175
|
+
promise.execute
|
1176
|
+
end
|
1177
|
+
|
470
1178
|
#
|
471
1179
|
# Gets all the policy definitions for a subscription.
|
472
1180
|
#
|
473
|
-
# @param filter [String] The filter to apply on the operation.
|
474
1181
|
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
475
1182
|
# will be added to the HTTP request.
|
476
1183
|
#
|
477
1184
|
# @return [PolicyDefinitionListResult] which provide lazy access to pages of
|
478
1185
|
# the response.
|
479
1186
|
#
|
480
|
-
def list_as_lazy(
|
481
|
-
response = list_async(
|
1187
|
+
def list_as_lazy(custom_headers = nil)
|
1188
|
+
response = list_async(custom_headers).value!
|
482
1189
|
unless response.nil?
|
483
1190
|
page = response.body
|
484
1191
|
page.next_method = Proc.new do |next_page_link|
|
@@ -488,5 +1195,46 @@ module Azure::ARM::Policy
|
|
488
1195
|
end
|
489
1196
|
end
|
490
1197
|
|
1198
|
+
#
|
1199
|
+
# Gets all the built in policy definitions.
|
1200
|
+
#
|
1201
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1202
|
+
# will be added to the HTTP request.
|
1203
|
+
#
|
1204
|
+
# @return [PolicyDefinitionListResult] which provide lazy access to pages of
|
1205
|
+
# the response.
|
1206
|
+
#
|
1207
|
+
def list_built_in_as_lazy(custom_headers = nil)
|
1208
|
+
response = list_built_in_async(custom_headers).value!
|
1209
|
+
unless response.nil?
|
1210
|
+
page = response.body
|
1211
|
+
page.next_method = Proc.new do |next_page_link|
|
1212
|
+
list_built_in_next_async(next_page_link, custom_headers)
|
1213
|
+
end
|
1214
|
+
page
|
1215
|
+
end
|
1216
|
+
end
|
1217
|
+
|
1218
|
+
#
|
1219
|
+
# Gets all the policy definitions for a subscription at management group level.
|
1220
|
+
#
|
1221
|
+
# @param management_group_id [String] The ID of the management group.
|
1222
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1223
|
+
# will be added to the HTTP request.
|
1224
|
+
#
|
1225
|
+
# @return [PolicyDefinitionListResult] which provide lazy access to pages of
|
1226
|
+
# the response.
|
1227
|
+
#
|
1228
|
+
def list_by_management_group_as_lazy(management_group_id, custom_headers = nil)
|
1229
|
+
response = list_by_management_group_async(management_group_id, custom_headers).value!
|
1230
|
+
unless response.nil?
|
1231
|
+
page = response.body
|
1232
|
+
page.next_method = Proc.new do |next_page_link|
|
1233
|
+
list_by_management_group_next_async(next_page_link, custom_headers)
|
1234
|
+
end
|
1235
|
+
page
|
1236
|
+
end
|
1237
|
+
end
|
1238
|
+
|
491
1239
|
end
|
492
1240
|
end
|