azure_mgmt_policy 0.17.4 → 0.17.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/2015-10-01-preview/generated/azure_mgmt_policy/policy_assignments.rb +24 -0
- data/lib/2015-10-01-preview/generated/azure_mgmt_policy/policy_client.rb +1 -1
- data/lib/2015-10-01-preview/generated/azure_mgmt_policy/policy_definitions.rb +10 -0
- data/lib/2016-04-01/generated/azure_mgmt_policy/policy_assignments.rb +24 -0
- data/lib/2016-04-01/generated/azure_mgmt_policy/policy_client.rb +1 -1
- data/lib/2016-04-01/generated/azure_mgmt_policy/policy_definitions.rb +10 -0
- data/lib/2016-12-01/generated/azure_mgmt_policy/policy_assignments.rb +24 -0
- data/lib/2016-12-01/generated/azure_mgmt_policy/policy_client.rb +1 -1
- data/lib/2016-12-01/generated/azure_mgmt_policy/policy_definitions.rb +26 -0
- data/lib/2017-06-01-preview/generated/azure_mgmt_policy/policy_assignments.rb +24 -0
- data/lib/2017-06-01-preview/generated/azure_mgmt_policy/policy_client.rb +1 -1
- data/lib/2017-06-01-preview/generated/azure_mgmt_policy/policy_set_definitions.rb +26 -0
- data/lib/2018-03-01/generated/azure_mgmt_policy/policy_assignments.rb +101 -84
- data/lib/2018-03-01/generated/azure_mgmt_policy/policy_client.rb +1 -1
- data/lib/2018-03-01/generated/azure_mgmt_policy/policy_definitions.rb +26 -0
- data/lib/2018-03-01/generated/azure_mgmt_policy/policy_set_definitions.rb +26 -0
- data/lib/2018-05-01/generated/azure_mgmt_policy/policy_assignments.rb +101 -84
- data/lib/2018-05-01/generated/azure_mgmt_policy/policy_client.rb +1 -1
- data/lib/2018-05-01/generated/azure_mgmt_policy/policy_definitions.rb +26 -0
- data/lib/2018-05-01/generated/azure_mgmt_policy/policy_set_definitions.rb +26 -0
- data/lib/2019-01-01/generated/azure_mgmt_policy.rb +42 -0
- data/lib/2019-01-01/generated/azure_mgmt_policy/models/error_response.rb +69 -0
- data/lib/2019-01-01/generated/azure_mgmt_policy/models/identity.rb +72 -0
- data/lib/2019-01-01/generated/azure_mgmt_policy/models/policy_assignment.rb +196 -0
- data/lib/2019-01-01/generated/azure_mgmt_policy/models/policy_assignment_list_result.rb +98 -0
- data/lib/2019-01-01/generated/azure_mgmt_policy/models/policy_definition.rb +152 -0
- data/lib/2019-01-01/generated/azure_mgmt_policy/models/policy_definition_list_result.rb +98 -0
- data/lib/2019-01-01/generated/azure_mgmt_policy/models/policy_definition_reference.rb +58 -0
- data/lib/2019-01-01/generated/azure_mgmt_policy/models/policy_set_definition.rb +151 -0
- data/lib/2019-01-01/generated/azure_mgmt_policy/models/policy_set_definition_list_result.rb +99 -0
- data/lib/2019-01-01/generated/azure_mgmt_policy/models/policy_sku.rb +59 -0
- data/lib/2019-01-01/generated/azure_mgmt_policy/models/policy_type.rb +17 -0
- data/lib/2019-01-01/generated/azure_mgmt_policy/models/resource_identity_type.rb +16 -0
- data/lib/2019-01-01/generated/azure_mgmt_policy/module_definition.rb +9 -0
- data/lib/2019-01-01/generated/azure_mgmt_policy/policy_assignments.rb +1902 -0
- data/lib/2019-01-01/generated/azure_mgmt_policy/policy_client.rb +139 -0
- data/lib/2019-01-01/generated/azure_mgmt_policy/policy_definitions.rb +1391 -0
- data/lib/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb +1414 -0
- data/lib/2019-06-01/generated/azure_mgmt_policy.rb +43 -0
- data/lib/2019-06-01/generated/azure_mgmt_policy/models/enforcement_mode.rb +16 -0
- data/lib/2019-06-01/generated/azure_mgmt_policy/models/error_response.rb +69 -0
- data/lib/2019-06-01/generated/azure_mgmt_policy/models/identity.rb +72 -0
- data/lib/2019-06-01/generated/azure_mgmt_policy/models/policy_assignment.rb +209 -0
- data/lib/2019-06-01/generated/azure_mgmt_policy/models/policy_assignment_list_result.rb +98 -0
- data/lib/2019-06-01/generated/azure_mgmt_policy/models/policy_definition.rb +152 -0
- data/lib/2019-06-01/generated/azure_mgmt_policy/models/policy_definition_list_result.rb +98 -0
- data/lib/2019-06-01/generated/azure_mgmt_policy/models/policy_definition_reference.rb +58 -0
- data/lib/2019-06-01/generated/azure_mgmt_policy/models/policy_set_definition.rb +151 -0
- data/lib/2019-06-01/generated/azure_mgmt_policy/models/policy_set_definition_list_result.rb +99 -0
- data/lib/2019-06-01/generated/azure_mgmt_policy/models/policy_sku.rb +59 -0
- data/lib/2019-06-01/generated/azure_mgmt_policy/models/policy_type.rb +17 -0
- data/lib/2019-06-01/generated/azure_mgmt_policy/models/resource_identity_type.rb +16 -0
- data/lib/2019-06-01/generated/azure_mgmt_policy/module_definition.rb +9 -0
- data/lib/2019-06-01/generated/azure_mgmt_policy/policy_assignments.rb +1902 -0
- data/lib/2019-06-01/generated/azure_mgmt_policy/policy_client.rb +139 -0
- data/lib/2019-06-01/generated/azure_mgmt_policy/policy_definitions.rb +1391 -0
- data/lib/2019-06-01/generated/azure_mgmt_policy/policy_set_definitions.rb +1414 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy.rb +49 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/models/enforcement_mode.rb +16 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/models/error_additional_info.rb +59 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/models/error_response.rb +113 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/models/identity.rb +73 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/models/parameter_definitions_value.rb +91 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/models/parameter_definitions_value_metadata.rb +76 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/models/parameter_type.rb +21 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/models/parameter_values_value.rb +46 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/models/policy_assignment.rb +220 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/models/policy_assignment_list_result.rb +98 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/models/policy_definition.rb +164 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/models/policy_definition_group.rb +91 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/models/policy_definition_list_result.rb +98 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/models/policy_definition_reference.rb +100 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/models/policy_set_definition.rb +182 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/models/policy_set_definition_list_result.rb +99 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/models/policy_sku.rb +59 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/models/policy_type.rb +18 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/models/resource_identity_type.rb +16 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/module_definition.rb +9 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/policy_assignments.rb +2179 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/policy_client.rb +139 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/policy_definitions.rb +1391 -0
- data/lib/2019-09-01/generated/azure_mgmt_policy/policy_set_definitions.rb +1414 -0
- data/lib/azure_mgmt_policy.rb +6 -3
- data/lib/profiles/latest/modules/policy_profile_module.rb +32 -32
- data/lib/version.rb +1 -1
- metadata +67 -5
@@ -0,0 +1,99 @@
|
|
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::Policy::Mgmt::V2019_09_01
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# List of policy set definitions.
|
10
|
+
#
|
11
|
+
class PolicySetDefinitionListResult
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
include MsRest::JSONable
|
16
|
+
# @return [Array<PolicySetDefinition>] An array of policy set
|
17
|
+
# definitions.
|
18
|
+
attr_accessor :value
|
19
|
+
|
20
|
+
# @return [String] The URL to use for getting the next set of results.
|
21
|
+
attr_accessor :next_link
|
22
|
+
|
23
|
+
# return [Proc] with next page method call.
|
24
|
+
attr_accessor :next_method
|
25
|
+
|
26
|
+
#
|
27
|
+
# Gets the rest of the items for the request, enabling auto-pagination.
|
28
|
+
#
|
29
|
+
# @return [Array<PolicySetDefinition>] operation results.
|
30
|
+
#
|
31
|
+
def get_all_items
|
32
|
+
items = @value
|
33
|
+
page = self
|
34
|
+
while page.next_link != nil && !page.next_link.strip.empty? do
|
35
|
+
page = page.get_next_page
|
36
|
+
items.concat(page.value)
|
37
|
+
end
|
38
|
+
items
|
39
|
+
end
|
40
|
+
|
41
|
+
#
|
42
|
+
# Gets the next page of results.
|
43
|
+
#
|
44
|
+
# @return [PolicySetDefinitionListResult] with next page content.
|
45
|
+
#
|
46
|
+
def get_next_page
|
47
|
+
response = @next_method.call(@next_link).value! unless @next_method.nil?
|
48
|
+
unless response.nil?
|
49
|
+
@next_link = response.body.next_link
|
50
|
+
@value = response.body.value
|
51
|
+
self
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
#
|
56
|
+
# Mapper for PolicySetDefinitionListResult class as Ruby Hash.
|
57
|
+
# This will be used for serialization/deserialization.
|
58
|
+
#
|
59
|
+
def self.mapper()
|
60
|
+
{
|
61
|
+
client_side_validation: true,
|
62
|
+
required: false,
|
63
|
+
serialized_name: 'PolicySetDefinitionListResult',
|
64
|
+
type: {
|
65
|
+
name: 'Composite',
|
66
|
+
class_name: 'PolicySetDefinitionListResult',
|
67
|
+
model_properties: {
|
68
|
+
value: {
|
69
|
+
client_side_validation: true,
|
70
|
+
required: false,
|
71
|
+
serialized_name: 'value',
|
72
|
+
type: {
|
73
|
+
name: 'Sequence',
|
74
|
+
element: {
|
75
|
+
client_side_validation: true,
|
76
|
+
required: false,
|
77
|
+
serialized_name: 'PolicySetDefinitionElementType',
|
78
|
+
type: {
|
79
|
+
name: 'Composite',
|
80
|
+
class_name: 'PolicySetDefinition'
|
81
|
+
}
|
82
|
+
}
|
83
|
+
}
|
84
|
+
},
|
85
|
+
next_link: {
|
86
|
+
client_side_validation: true,
|
87
|
+
required: false,
|
88
|
+
serialized_name: 'nextLink',
|
89
|
+
type: {
|
90
|
+
name: 'String'
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,59 @@
|
|
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::Policy::Mgmt::V2019_09_01
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# The policy sku. This property is optional, obsolete, and will be ignored.
|
10
|
+
#
|
11
|
+
class PolicySku
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [String] The name of the policy sku. Possible values are A0 and
|
16
|
+
# A1.
|
17
|
+
attr_accessor :name
|
18
|
+
|
19
|
+
# @return [String] The policy sku tier. Possible values are Free and
|
20
|
+
# Standard.
|
21
|
+
attr_accessor :tier
|
22
|
+
|
23
|
+
|
24
|
+
#
|
25
|
+
# Mapper for PolicySku class as Ruby Hash.
|
26
|
+
# This will be used for serialization/deserialization.
|
27
|
+
#
|
28
|
+
def self.mapper()
|
29
|
+
{
|
30
|
+
client_side_validation: true,
|
31
|
+
required: false,
|
32
|
+
serialized_name: 'PolicySku',
|
33
|
+
type: {
|
34
|
+
name: 'Composite',
|
35
|
+
class_name: 'PolicySku',
|
36
|
+
model_properties: {
|
37
|
+
name: {
|
38
|
+
client_side_validation: true,
|
39
|
+
required: true,
|
40
|
+
serialized_name: 'name',
|
41
|
+
type: {
|
42
|
+
name: 'String'
|
43
|
+
}
|
44
|
+
},
|
45
|
+
tier: {
|
46
|
+
client_side_validation: true,
|
47
|
+
required: false,
|
48
|
+
serialized_name: 'tier',
|
49
|
+
type: {
|
50
|
+
name: 'String'
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,18 @@
|
|
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::Policy::Mgmt::V2019_09_01
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Defines values for PolicyType
|
10
|
+
#
|
11
|
+
module PolicyType
|
12
|
+
NotSpecified = "NotSpecified"
|
13
|
+
BuiltIn = "BuiltIn"
|
14
|
+
Custom = "Custom"
|
15
|
+
Static = "Static"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,16 @@
|
|
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::Policy::Mgmt::V2019_09_01
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Defines values for ResourceIdentityType
|
10
|
+
#
|
11
|
+
module ResourceIdentityType
|
12
|
+
SystemAssigned = "SystemAssigned"
|
13
|
+
None = "None"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure end
|
7
|
+
module Azure::Policy end
|
8
|
+
module Azure::Policy::Mgmt end
|
9
|
+
module Azure::Policy::Mgmt::V2019_09_01 end
|
@@ -0,0 +1,2179 @@
|
|
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::Policy::Mgmt::V2019_09_01
|
7
|
+
#
|
8
|
+
# To manage and control access to your resources, you can define customized
|
9
|
+
# policies and assign them at a scope.
|
10
|
+
#
|
11
|
+
class PolicyAssignments
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
#
|
15
|
+
# Creates and initializes a new instance of the PolicyAssignments class.
|
16
|
+
# @param client service class for accessing basic functionality.
|
17
|
+
#
|
18
|
+
def initialize(client)
|
19
|
+
@client = client
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return [PolicyClient] reference to the PolicyClient
|
23
|
+
attr_reader :client
|
24
|
+
|
25
|
+
#
|
26
|
+
# Deletes a policy assignment.
|
27
|
+
#
|
28
|
+
# This operation deletes a policy assignment, given its name and the scope it
|
29
|
+
# was created in. The scope of a policy assignment is the part of its ID
|
30
|
+
# preceding
|
31
|
+
# '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
32
|
+
#
|
33
|
+
# @param scope [String] The scope of the policy assignment. Valid scopes are:
|
34
|
+
# management group (format:
|
35
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
36
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
37
|
+
# (format:
|
38
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
39
|
+
# resource (format:
|
40
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
|
41
|
+
# @param policy_assignment_name [String] The name of the policy assignment to
|
42
|
+
# delete.
|
43
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
44
|
+
# will be added to the HTTP request.
|
45
|
+
#
|
46
|
+
# @return [PolicyAssignment] operation results.
|
47
|
+
#
|
48
|
+
def delete(scope, policy_assignment_name, custom_headers:nil)
|
49
|
+
response = delete_async(scope, policy_assignment_name, custom_headers:custom_headers).value!
|
50
|
+
response.body unless response.nil?
|
51
|
+
end
|
52
|
+
|
53
|
+
#
|
54
|
+
# Deletes a policy assignment.
|
55
|
+
#
|
56
|
+
# This operation deletes a policy assignment, given its name and the scope it
|
57
|
+
# was created in. The scope of a policy assignment is the part of its ID
|
58
|
+
# preceding
|
59
|
+
# '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
60
|
+
#
|
61
|
+
# @param scope [String] The scope of the policy assignment. Valid scopes are:
|
62
|
+
# management group (format:
|
63
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
64
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
65
|
+
# (format:
|
66
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
67
|
+
# resource (format:
|
68
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
|
69
|
+
# @param policy_assignment_name [String] The name of the policy assignment to
|
70
|
+
# delete.
|
71
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
72
|
+
# will be added to the HTTP request.
|
73
|
+
#
|
74
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
75
|
+
#
|
76
|
+
def delete_with_http_info(scope, policy_assignment_name, custom_headers:nil)
|
77
|
+
delete_async(scope, policy_assignment_name, custom_headers:custom_headers).value!
|
78
|
+
end
|
79
|
+
|
80
|
+
#
|
81
|
+
# Deletes a policy assignment.
|
82
|
+
#
|
83
|
+
# This operation deletes a policy assignment, given its name and the scope it
|
84
|
+
# was created in. The scope of a policy assignment is the part of its ID
|
85
|
+
# preceding
|
86
|
+
# '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
87
|
+
#
|
88
|
+
# @param scope [String] The scope of the policy assignment. Valid scopes are:
|
89
|
+
# management group (format:
|
90
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
91
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
92
|
+
# (format:
|
93
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
94
|
+
# resource (format:
|
95
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
|
96
|
+
# @param policy_assignment_name [String] The name of the policy assignment to
|
97
|
+
# delete.
|
98
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
99
|
+
# to the HTTP request.
|
100
|
+
#
|
101
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
102
|
+
#
|
103
|
+
def delete_async(scope, policy_assignment_name, custom_headers:nil)
|
104
|
+
fail ArgumentError, 'scope is nil' if scope.nil?
|
105
|
+
fail ArgumentError, 'policy_assignment_name is nil' if policy_assignment_name.nil?
|
106
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
107
|
+
|
108
|
+
|
109
|
+
request_headers = {}
|
110
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
111
|
+
|
112
|
+
# Set Headers
|
113
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
114
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
115
|
+
path_template = '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'
|
116
|
+
|
117
|
+
request_url = @base_url || @client.base_url
|
118
|
+
|
119
|
+
options = {
|
120
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
121
|
+
path_params: {'policyAssignmentName' => policy_assignment_name},
|
122
|
+
skip_encoding_path_params: {'scope' => scope},
|
123
|
+
query_params: {'api-version' => @client.api_version},
|
124
|
+
headers: request_headers.merge(custom_headers || {}),
|
125
|
+
base_url: request_url
|
126
|
+
}
|
127
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
128
|
+
|
129
|
+
promise = promise.then do |result|
|
130
|
+
http_response = result.response
|
131
|
+
status_code = http_response.status
|
132
|
+
response_content = http_response.body
|
133
|
+
unless status_code == 200 || status_code == 204
|
134
|
+
error_model = JSON.load(response_content)
|
135
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
136
|
+
end
|
137
|
+
|
138
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
139
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
140
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
141
|
+
# Deserialize Response
|
142
|
+
if status_code == 200
|
143
|
+
begin
|
144
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
145
|
+
result_mapper = Azure::Policy::Mgmt::V2019_09_01::Models::PolicyAssignment.mapper()
|
146
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
147
|
+
rescue Exception => e
|
148
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
result
|
153
|
+
end
|
154
|
+
|
155
|
+
promise.execute
|
156
|
+
end
|
157
|
+
|
158
|
+
#
|
159
|
+
# Creates or updates a policy assignment.
|
160
|
+
#
|
161
|
+
# This operation creates or updates a policy assignment with the given scope
|
162
|
+
# and name. Policy assignments apply to all resources contained within their
|
163
|
+
# scope. For example, when you assign a policy at resource group scope, that
|
164
|
+
# policy applies to all resources in the group.
|
165
|
+
#
|
166
|
+
# @param scope [String] The scope of the policy assignment. Valid scopes are:
|
167
|
+
# management group (format:
|
168
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
169
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
170
|
+
# (format:
|
171
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
172
|
+
# resource (format:
|
173
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
|
174
|
+
# @param policy_assignment_name [String] The name of the policy assignment.
|
175
|
+
# @param parameters [PolicyAssignment] Parameters for the policy assignment.
|
176
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
177
|
+
# will be added to the HTTP request.
|
178
|
+
#
|
179
|
+
# @return [PolicyAssignment] operation results.
|
180
|
+
#
|
181
|
+
def create(scope, policy_assignment_name, parameters, custom_headers:nil)
|
182
|
+
response = create_async(scope, policy_assignment_name, parameters, custom_headers:custom_headers).value!
|
183
|
+
response.body unless response.nil?
|
184
|
+
end
|
185
|
+
|
186
|
+
#
|
187
|
+
# Creates or updates a policy assignment.
|
188
|
+
#
|
189
|
+
# This operation creates or updates a policy assignment with the given scope
|
190
|
+
# and name. Policy assignments apply to all resources contained within their
|
191
|
+
# scope. For example, when you assign a policy at resource group scope, that
|
192
|
+
# policy applies to all resources in the group.
|
193
|
+
#
|
194
|
+
# @param scope [String] The scope of the policy assignment. Valid scopes are:
|
195
|
+
# management group (format:
|
196
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
197
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
198
|
+
# (format:
|
199
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
200
|
+
# resource (format:
|
201
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
|
202
|
+
# @param policy_assignment_name [String] The name of the policy assignment.
|
203
|
+
# @param parameters [PolicyAssignment] Parameters for the policy assignment.
|
204
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
205
|
+
# will be added to the HTTP request.
|
206
|
+
#
|
207
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
208
|
+
#
|
209
|
+
def create_with_http_info(scope, policy_assignment_name, parameters, custom_headers:nil)
|
210
|
+
create_async(scope, policy_assignment_name, parameters, custom_headers:custom_headers).value!
|
211
|
+
end
|
212
|
+
|
213
|
+
#
|
214
|
+
# Creates or updates a policy assignment.
|
215
|
+
#
|
216
|
+
# This operation creates or updates a policy assignment with the given scope
|
217
|
+
# and name. Policy assignments apply to all resources contained within their
|
218
|
+
# scope. For example, when you assign a policy at resource group scope, that
|
219
|
+
# policy applies to all resources in the group.
|
220
|
+
#
|
221
|
+
# @param scope [String] The scope of the policy assignment. Valid scopes are:
|
222
|
+
# management group (format:
|
223
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
224
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
225
|
+
# (format:
|
226
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
227
|
+
# resource (format:
|
228
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
|
229
|
+
# @param policy_assignment_name [String] The name of the policy assignment.
|
230
|
+
# @param parameters [PolicyAssignment] Parameters for the policy assignment.
|
231
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
232
|
+
# to the HTTP request.
|
233
|
+
#
|
234
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
235
|
+
#
|
236
|
+
def create_async(scope, policy_assignment_name, parameters, custom_headers:nil)
|
237
|
+
fail ArgumentError, 'scope is nil' if scope.nil?
|
238
|
+
fail ArgumentError, 'policy_assignment_name is nil' if policy_assignment_name.nil?
|
239
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
240
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
241
|
+
|
242
|
+
|
243
|
+
request_headers = {}
|
244
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
245
|
+
|
246
|
+
# Set Headers
|
247
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
248
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
249
|
+
|
250
|
+
# Serialize Request
|
251
|
+
request_mapper = Azure::Policy::Mgmt::V2019_09_01::Models::PolicyAssignment.mapper()
|
252
|
+
request_content = @client.serialize(request_mapper, parameters)
|
253
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
254
|
+
|
255
|
+
path_template = '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'
|
256
|
+
|
257
|
+
request_url = @base_url || @client.base_url
|
258
|
+
|
259
|
+
options = {
|
260
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
261
|
+
path_params: {'policyAssignmentName' => policy_assignment_name},
|
262
|
+
skip_encoding_path_params: {'scope' => scope},
|
263
|
+
query_params: {'api-version' => @client.api_version},
|
264
|
+
body: request_content,
|
265
|
+
headers: request_headers.merge(custom_headers || {}),
|
266
|
+
base_url: request_url
|
267
|
+
}
|
268
|
+
promise = @client.make_request_async(:put, path_template, options)
|
269
|
+
|
270
|
+
promise = promise.then do |result|
|
271
|
+
http_response = result.response
|
272
|
+
status_code = http_response.status
|
273
|
+
response_content = http_response.body
|
274
|
+
unless status_code == 201
|
275
|
+
error_model = JSON.load(response_content)
|
276
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
277
|
+
end
|
278
|
+
|
279
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
280
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
281
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
282
|
+
# Deserialize Response
|
283
|
+
if status_code == 201
|
284
|
+
begin
|
285
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
286
|
+
result_mapper = Azure::Policy::Mgmt::V2019_09_01::Models::PolicyAssignment.mapper()
|
287
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
288
|
+
rescue Exception => e
|
289
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
result
|
294
|
+
end
|
295
|
+
|
296
|
+
promise.execute
|
297
|
+
end
|
298
|
+
|
299
|
+
#
|
300
|
+
# Retrieves a policy assignment.
|
301
|
+
#
|
302
|
+
# This operation retrieves a single policy assignment, given its name and the
|
303
|
+
# scope it was created at.
|
304
|
+
#
|
305
|
+
# @param scope [String] The scope of the policy assignment. Valid scopes are:
|
306
|
+
# management group (format:
|
307
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
308
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
309
|
+
# (format:
|
310
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
311
|
+
# resource (format:
|
312
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
|
313
|
+
# @param policy_assignment_name [String] The name of the policy assignment to
|
314
|
+
# get.
|
315
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
316
|
+
# will be added to the HTTP request.
|
317
|
+
#
|
318
|
+
# @return [PolicyAssignment] operation results.
|
319
|
+
#
|
320
|
+
def get(scope, policy_assignment_name, custom_headers:nil)
|
321
|
+
response = get_async(scope, policy_assignment_name, custom_headers:custom_headers).value!
|
322
|
+
response.body unless response.nil?
|
323
|
+
end
|
324
|
+
|
325
|
+
#
|
326
|
+
# Retrieves a policy assignment.
|
327
|
+
#
|
328
|
+
# This operation retrieves a single policy assignment, given its name and the
|
329
|
+
# scope it was created at.
|
330
|
+
#
|
331
|
+
# @param scope [String] The scope of the policy assignment. Valid scopes are:
|
332
|
+
# management group (format:
|
333
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
334
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
335
|
+
# (format:
|
336
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
337
|
+
# resource (format:
|
338
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
|
339
|
+
# @param policy_assignment_name [String] The name of the policy assignment to
|
340
|
+
# get.
|
341
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
342
|
+
# will be added to the HTTP request.
|
343
|
+
#
|
344
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
345
|
+
#
|
346
|
+
def get_with_http_info(scope, policy_assignment_name, custom_headers:nil)
|
347
|
+
get_async(scope, policy_assignment_name, custom_headers:custom_headers).value!
|
348
|
+
end
|
349
|
+
|
350
|
+
#
|
351
|
+
# Retrieves a policy assignment.
|
352
|
+
#
|
353
|
+
# This operation retrieves a single policy assignment, given its name and the
|
354
|
+
# scope it was created at.
|
355
|
+
#
|
356
|
+
# @param scope [String] The scope of the policy assignment. Valid scopes are:
|
357
|
+
# management group (format:
|
358
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
359
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
360
|
+
# (format:
|
361
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
362
|
+
# resource (format:
|
363
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
|
364
|
+
# @param policy_assignment_name [String] The name of the policy assignment to
|
365
|
+
# get.
|
366
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
367
|
+
# to the HTTP request.
|
368
|
+
#
|
369
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
370
|
+
#
|
371
|
+
def get_async(scope, policy_assignment_name, custom_headers:nil)
|
372
|
+
fail ArgumentError, 'scope is nil' if scope.nil?
|
373
|
+
fail ArgumentError, 'policy_assignment_name is nil' if policy_assignment_name.nil?
|
374
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
375
|
+
|
376
|
+
|
377
|
+
request_headers = {}
|
378
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
379
|
+
|
380
|
+
# Set Headers
|
381
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
382
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
383
|
+
path_template = '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'
|
384
|
+
|
385
|
+
request_url = @base_url || @client.base_url
|
386
|
+
|
387
|
+
options = {
|
388
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
389
|
+
path_params: {'policyAssignmentName' => policy_assignment_name},
|
390
|
+
skip_encoding_path_params: {'scope' => scope},
|
391
|
+
query_params: {'api-version' => @client.api_version},
|
392
|
+
headers: request_headers.merge(custom_headers || {}),
|
393
|
+
base_url: request_url
|
394
|
+
}
|
395
|
+
promise = @client.make_request_async(:get, path_template, options)
|
396
|
+
|
397
|
+
promise = promise.then do |result|
|
398
|
+
http_response = result.response
|
399
|
+
status_code = http_response.status
|
400
|
+
response_content = http_response.body
|
401
|
+
unless status_code == 200
|
402
|
+
error_model = JSON.load(response_content)
|
403
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
404
|
+
end
|
405
|
+
|
406
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
407
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
408
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
409
|
+
# Deserialize Response
|
410
|
+
if status_code == 200
|
411
|
+
begin
|
412
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
413
|
+
result_mapper = Azure::Policy::Mgmt::V2019_09_01::Models::PolicyAssignment.mapper()
|
414
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
415
|
+
rescue Exception => e
|
416
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
417
|
+
end
|
418
|
+
end
|
419
|
+
|
420
|
+
result
|
421
|
+
end
|
422
|
+
|
423
|
+
promise.execute
|
424
|
+
end
|
425
|
+
|
426
|
+
#
|
427
|
+
# Retrieves all policy assignments that apply to a resource group.
|
428
|
+
#
|
429
|
+
# This operation retrieves the list of all policy assignments associated with
|
430
|
+
# the given resource group in the given subscription that match the optional
|
431
|
+
# given $filter. Valid values for $filter are: 'atScope()' or
|
432
|
+
# 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered
|
433
|
+
# list includes all policy assignments associated with the resource group,
|
434
|
+
# including those that apply directly or apply from containing scopes, as well
|
435
|
+
# as any applied to resources contained within the resource group. If
|
436
|
+
# $filter=atScope() is provided, the returned list includes all policy
|
437
|
+
# assignments that apply to the resource group, which is everything in the
|
438
|
+
# unfiltered list except those applied to resources contained within the
|
439
|
+
# resource group. If $filter=policyDefinitionId eq '{value}' is provided, the
|
440
|
+
# returned list includes all policy assignments of the policy definition whose
|
441
|
+
# id is {value} that apply to the resource group.
|
442
|
+
#
|
443
|
+
# @param resource_group_name [String] The name of the resource group that
|
444
|
+
# contains policy assignments.
|
445
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
446
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
447
|
+
# not provided, no filtering is performed.
|
448
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
449
|
+
# will be added to the HTTP request.
|
450
|
+
#
|
451
|
+
# @return [Array<PolicyAssignment>] operation results.
|
452
|
+
#
|
453
|
+
def list_for_resource_group(resource_group_name, filter:nil, custom_headers:nil)
|
454
|
+
first_page = list_for_resource_group_as_lazy(resource_group_name, filter:filter, custom_headers:custom_headers)
|
455
|
+
first_page.get_all_items
|
456
|
+
end
|
457
|
+
|
458
|
+
#
|
459
|
+
# Retrieves all policy assignments that apply to a resource group.
|
460
|
+
#
|
461
|
+
# This operation retrieves the list of all policy assignments associated with
|
462
|
+
# the given resource group in the given subscription that match the optional
|
463
|
+
# given $filter. Valid values for $filter are: 'atScope()' or
|
464
|
+
# 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered
|
465
|
+
# list includes all policy assignments associated with the resource group,
|
466
|
+
# including those that apply directly or apply from containing scopes, as well
|
467
|
+
# as any applied to resources contained within the resource group. If
|
468
|
+
# $filter=atScope() is provided, the returned list includes all policy
|
469
|
+
# assignments that apply to the resource group, which is everything in the
|
470
|
+
# unfiltered list except those applied to resources contained within the
|
471
|
+
# resource group. If $filter=policyDefinitionId eq '{value}' is provided, the
|
472
|
+
# returned list includes all policy assignments of the policy definition whose
|
473
|
+
# id is {value} that apply to the resource group.
|
474
|
+
#
|
475
|
+
# @param resource_group_name [String] The name of the resource group that
|
476
|
+
# contains policy assignments.
|
477
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
478
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
479
|
+
# not provided, no filtering is performed.
|
480
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
481
|
+
# will be added to the HTTP request.
|
482
|
+
#
|
483
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
484
|
+
#
|
485
|
+
def list_for_resource_group_with_http_info(resource_group_name, filter:nil, custom_headers:nil)
|
486
|
+
list_for_resource_group_async(resource_group_name, filter:filter, custom_headers:custom_headers).value!
|
487
|
+
end
|
488
|
+
|
489
|
+
#
|
490
|
+
# Retrieves all policy assignments that apply to a resource group.
|
491
|
+
#
|
492
|
+
# This operation retrieves the list of all policy assignments associated with
|
493
|
+
# the given resource group in the given subscription that match the optional
|
494
|
+
# given $filter. Valid values for $filter are: 'atScope()' or
|
495
|
+
# 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered
|
496
|
+
# list includes all policy assignments associated with the resource group,
|
497
|
+
# including those that apply directly or apply from containing scopes, as well
|
498
|
+
# as any applied to resources contained within the resource group. If
|
499
|
+
# $filter=atScope() is provided, the returned list includes all policy
|
500
|
+
# assignments that apply to the resource group, which is everything in the
|
501
|
+
# unfiltered list except those applied to resources contained within the
|
502
|
+
# resource group. If $filter=policyDefinitionId eq '{value}' is provided, the
|
503
|
+
# returned list includes all policy assignments of the policy definition whose
|
504
|
+
# id is {value} that apply to the resource group.
|
505
|
+
#
|
506
|
+
# @param resource_group_name [String] The name of the resource group that
|
507
|
+
# contains policy assignments.
|
508
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
509
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
510
|
+
# not provided, no filtering is performed.
|
511
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
512
|
+
# to the HTTP request.
|
513
|
+
#
|
514
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
515
|
+
#
|
516
|
+
def list_for_resource_group_async(resource_group_name, filter:nil, custom_headers:nil)
|
517
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
518
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
|
519
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
|
520
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
|
521
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
522
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
523
|
+
|
524
|
+
|
525
|
+
request_headers = {}
|
526
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
527
|
+
|
528
|
+
# Set Headers
|
529
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
530
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
531
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments'
|
532
|
+
|
533
|
+
request_url = @base_url || @client.base_url
|
534
|
+
|
535
|
+
options = {
|
536
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
537
|
+
path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
538
|
+
query_params: {'api-version' => @client.api_version},
|
539
|
+
skip_encoding_query_params: {'$filter' => filter},
|
540
|
+
headers: request_headers.merge(custom_headers || {}),
|
541
|
+
base_url: request_url
|
542
|
+
}
|
543
|
+
promise = @client.make_request_async(:get, path_template, options)
|
544
|
+
|
545
|
+
promise = promise.then do |result|
|
546
|
+
http_response = result.response
|
547
|
+
status_code = http_response.status
|
548
|
+
response_content = http_response.body
|
549
|
+
unless status_code == 200
|
550
|
+
error_model = JSON.load(response_content)
|
551
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
552
|
+
end
|
553
|
+
|
554
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
555
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
556
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
557
|
+
# Deserialize Response
|
558
|
+
if status_code == 200
|
559
|
+
begin
|
560
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
561
|
+
result_mapper = Azure::Policy::Mgmt::V2019_09_01::Models::PolicyAssignmentListResult.mapper()
|
562
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
563
|
+
rescue Exception => e
|
564
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
565
|
+
end
|
566
|
+
end
|
567
|
+
|
568
|
+
result
|
569
|
+
end
|
570
|
+
|
571
|
+
promise.execute
|
572
|
+
end
|
573
|
+
|
574
|
+
#
|
575
|
+
# Retrieves all policy assignments that apply to a resource.
|
576
|
+
#
|
577
|
+
# This operation retrieves the list of all policy assignments associated with
|
578
|
+
# the specified resource in the given resource group and subscription that
|
579
|
+
# match the optional given $filter. Valid values for $filter are: 'atScope()'
|
580
|
+
# or 'policyDefinitionId eq '{value}''. If $filter is not provided, the
|
581
|
+
# unfiltered list includes all policy assignments associated with the resource,
|
582
|
+
# including those that apply directly or from all containing scopes, as well as
|
583
|
+
# any applied to resources contained within the resource. If $filter=atScope()
|
584
|
+
# is provided, the returned list includes all policy assignments that apply to
|
585
|
+
# the resource, which is everything in the unfiltered list except those applied
|
586
|
+
# to resources contained within the resource. If $filter=policyDefinitionId eq
|
587
|
+
# '{value}' is provided, the returned list includes all policy assignments of
|
588
|
+
# the policy definition whose id is {value} that apply to the resource. Three
|
589
|
+
# parameters plus the resource name are used to identify a specific resource.
|
590
|
+
# If the resource is not part of a parent resource (the more common case), the
|
591
|
+
# parent resource path should not be provided (or provided as ''). For example
|
592
|
+
# a web app could be specified as ({resourceProviderNamespace} ==
|
593
|
+
# 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites',
|
594
|
+
# {resourceName} == 'MyWebApp'). If the resource is part of a parent resource,
|
595
|
+
# then all parameters should be provided. For example a virtual machine DNS
|
596
|
+
# name could be specified as ({resourceProviderNamespace} ==
|
597
|
+
# 'Microsoft.Compute', {parentResourcePath} ==
|
598
|
+
# 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames',
|
599
|
+
# {resourceName} == 'MyComputerName'). A convenient alternative to providing
|
600
|
+
# the namespace and type name separately is to provide both in the
|
601
|
+
# {resourceType} parameter, format: ({resourceProviderNamespace} == '',
|
602
|
+
# {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites',
|
603
|
+
# {resourceName} == 'MyWebApp').
|
604
|
+
#
|
605
|
+
# @param resource_group_name [String] The name of the resource group containing
|
606
|
+
# the resource.
|
607
|
+
# @param resource_provider_namespace [String] The namespace of the resource
|
608
|
+
# provider. For example, the namespace of a virtual machine is
|
609
|
+
# Microsoft.Compute (from Microsoft.Compute/virtualMachines)
|
610
|
+
# @param parent_resource_path [String] The parent resource path. Use empty
|
611
|
+
# string if there is none.
|
612
|
+
# @param resource_type [String] The resource type name. For example the type
|
613
|
+
# name of a web app is 'sites' (from Microsoft.Web/sites).
|
614
|
+
# @param resource_name [String] The name of the resource.
|
615
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
616
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
617
|
+
# not provided, no filtering is performed.
|
618
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
619
|
+
# will be added to the HTTP request.
|
620
|
+
#
|
621
|
+
# @return [Array<PolicyAssignment>] operation results.
|
622
|
+
#
|
623
|
+
def list_for_resource(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:nil, custom_headers:nil)
|
624
|
+
first_page = list_for_resource_as_lazy(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:filter, custom_headers:custom_headers)
|
625
|
+
first_page.get_all_items
|
626
|
+
end
|
627
|
+
|
628
|
+
#
|
629
|
+
# Retrieves all policy assignments that apply to a resource.
|
630
|
+
#
|
631
|
+
# This operation retrieves the list of all policy assignments associated with
|
632
|
+
# the specified resource in the given resource group and subscription that
|
633
|
+
# match the optional given $filter. Valid values for $filter are: 'atScope()'
|
634
|
+
# or 'policyDefinitionId eq '{value}''. If $filter is not provided, the
|
635
|
+
# unfiltered list includes all policy assignments associated with the resource,
|
636
|
+
# including those that apply directly or from all containing scopes, as well as
|
637
|
+
# any applied to resources contained within the resource. If $filter=atScope()
|
638
|
+
# is provided, the returned list includes all policy assignments that apply to
|
639
|
+
# the resource, which is everything in the unfiltered list except those applied
|
640
|
+
# to resources contained within the resource. If $filter=policyDefinitionId eq
|
641
|
+
# '{value}' is provided, the returned list includes all policy assignments of
|
642
|
+
# the policy definition whose id is {value} that apply to the resource. Three
|
643
|
+
# parameters plus the resource name are used to identify a specific resource.
|
644
|
+
# If the resource is not part of a parent resource (the more common case), the
|
645
|
+
# parent resource path should not be provided (or provided as ''). For example
|
646
|
+
# a web app could be specified as ({resourceProviderNamespace} ==
|
647
|
+
# 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites',
|
648
|
+
# {resourceName} == 'MyWebApp'). If the resource is part of a parent resource,
|
649
|
+
# then all parameters should be provided. For example a virtual machine DNS
|
650
|
+
# name could be specified as ({resourceProviderNamespace} ==
|
651
|
+
# 'Microsoft.Compute', {parentResourcePath} ==
|
652
|
+
# 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames',
|
653
|
+
# {resourceName} == 'MyComputerName'). A convenient alternative to providing
|
654
|
+
# the namespace and type name separately is to provide both in the
|
655
|
+
# {resourceType} parameter, format: ({resourceProviderNamespace} == '',
|
656
|
+
# {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites',
|
657
|
+
# {resourceName} == 'MyWebApp').
|
658
|
+
#
|
659
|
+
# @param resource_group_name [String] The name of the resource group containing
|
660
|
+
# the resource.
|
661
|
+
# @param resource_provider_namespace [String] The namespace of the resource
|
662
|
+
# provider. For example, the namespace of a virtual machine is
|
663
|
+
# Microsoft.Compute (from Microsoft.Compute/virtualMachines)
|
664
|
+
# @param parent_resource_path [String] The parent resource path. Use empty
|
665
|
+
# string if there is none.
|
666
|
+
# @param resource_type [String] The resource type name. For example the type
|
667
|
+
# name of a web app is 'sites' (from Microsoft.Web/sites).
|
668
|
+
# @param resource_name [String] The name of the resource.
|
669
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
670
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
671
|
+
# not provided, no filtering is performed.
|
672
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
673
|
+
# will be added to the HTTP request.
|
674
|
+
#
|
675
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
676
|
+
#
|
677
|
+
def list_for_resource_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:nil, custom_headers:nil)
|
678
|
+
list_for_resource_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:filter, custom_headers:custom_headers).value!
|
679
|
+
end
|
680
|
+
|
681
|
+
#
|
682
|
+
# Retrieves all policy assignments that apply to a resource.
|
683
|
+
#
|
684
|
+
# This operation retrieves the list of all policy assignments associated with
|
685
|
+
# the specified resource in the given resource group and subscription that
|
686
|
+
# match the optional given $filter. Valid values for $filter are: 'atScope()'
|
687
|
+
# or 'policyDefinitionId eq '{value}''. If $filter is not provided, the
|
688
|
+
# unfiltered list includes all policy assignments associated with the resource,
|
689
|
+
# including those that apply directly or from all containing scopes, as well as
|
690
|
+
# any applied to resources contained within the resource. If $filter=atScope()
|
691
|
+
# is provided, the returned list includes all policy assignments that apply to
|
692
|
+
# the resource, which is everything in the unfiltered list except those applied
|
693
|
+
# to resources contained within the resource. If $filter=policyDefinitionId eq
|
694
|
+
# '{value}' is provided, the returned list includes all policy assignments of
|
695
|
+
# the policy definition whose id is {value} that apply to the resource. Three
|
696
|
+
# parameters plus the resource name are used to identify a specific resource.
|
697
|
+
# If the resource is not part of a parent resource (the more common case), the
|
698
|
+
# parent resource path should not be provided (or provided as ''). For example
|
699
|
+
# a web app could be specified as ({resourceProviderNamespace} ==
|
700
|
+
# 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites',
|
701
|
+
# {resourceName} == 'MyWebApp'). If the resource is part of a parent resource,
|
702
|
+
# then all parameters should be provided. For example a virtual machine DNS
|
703
|
+
# name could be specified as ({resourceProviderNamespace} ==
|
704
|
+
# 'Microsoft.Compute', {parentResourcePath} ==
|
705
|
+
# 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames',
|
706
|
+
# {resourceName} == 'MyComputerName'). A convenient alternative to providing
|
707
|
+
# the namespace and type name separately is to provide both in the
|
708
|
+
# {resourceType} parameter, format: ({resourceProviderNamespace} == '',
|
709
|
+
# {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites',
|
710
|
+
# {resourceName} == 'MyWebApp').
|
711
|
+
#
|
712
|
+
# @param resource_group_name [String] The name of the resource group containing
|
713
|
+
# the resource.
|
714
|
+
# @param resource_provider_namespace [String] The namespace of the resource
|
715
|
+
# provider. For example, the namespace of a virtual machine is
|
716
|
+
# Microsoft.Compute (from Microsoft.Compute/virtualMachines)
|
717
|
+
# @param parent_resource_path [String] The parent resource path. Use empty
|
718
|
+
# string if there is none.
|
719
|
+
# @param resource_type [String] The resource type name. For example the type
|
720
|
+
# name of a web app is 'sites' (from Microsoft.Web/sites).
|
721
|
+
# @param resource_name [String] The name of the resource.
|
722
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
723
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
724
|
+
# not provided, no filtering is performed.
|
725
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
726
|
+
# to the HTTP request.
|
727
|
+
#
|
728
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
729
|
+
#
|
730
|
+
def list_for_resource_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:nil, custom_headers:nil)
|
731
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
732
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
|
733
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
|
734
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
|
735
|
+
fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
|
736
|
+
fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
|
737
|
+
fail ArgumentError, 'resource_type is nil' if resource_type.nil?
|
738
|
+
fail ArgumentError, 'resource_name is nil' if resource_name.nil?
|
739
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
740
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
741
|
+
|
742
|
+
|
743
|
+
request_headers = {}
|
744
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
745
|
+
|
746
|
+
# Set Headers
|
747
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
748
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
749
|
+
path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments'
|
750
|
+
|
751
|
+
request_url = @base_url || @client.base_url
|
752
|
+
|
753
|
+
options = {
|
754
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
755
|
+
path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
|
756
|
+
skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
|
757
|
+
query_params: {'$filter' => filter,'api-version' => @client.api_version},
|
758
|
+
headers: request_headers.merge(custom_headers || {}),
|
759
|
+
base_url: request_url
|
760
|
+
}
|
761
|
+
promise = @client.make_request_async(:get, path_template, options)
|
762
|
+
|
763
|
+
promise = promise.then do |result|
|
764
|
+
http_response = result.response
|
765
|
+
status_code = http_response.status
|
766
|
+
response_content = http_response.body
|
767
|
+
unless status_code == 200
|
768
|
+
error_model = JSON.load(response_content)
|
769
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
770
|
+
end
|
771
|
+
|
772
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
773
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
774
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
775
|
+
# Deserialize Response
|
776
|
+
if status_code == 200
|
777
|
+
begin
|
778
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
779
|
+
result_mapper = Azure::Policy::Mgmt::V2019_09_01::Models::PolicyAssignmentListResult.mapper()
|
780
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
781
|
+
rescue Exception => e
|
782
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
783
|
+
end
|
784
|
+
end
|
785
|
+
|
786
|
+
result
|
787
|
+
end
|
788
|
+
|
789
|
+
promise.execute
|
790
|
+
end
|
791
|
+
|
792
|
+
#
|
793
|
+
# Retrieves all policy assignments that apply to a management group.
|
794
|
+
#
|
795
|
+
# This operation retrieves the list of all policy assignments applicable to the
|
796
|
+
# management group that match the given $filter. Valid values for $filter are:
|
797
|
+
# 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter=atScope() is
|
798
|
+
# provided, the returned list includes all policy assignments that are assigned
|
799
|
+
# to the management group or the management group's ancestors. If
|
800
|
+
# $filter=policyDefinitionId eq '{value}' is provided, the returned list
|
801
|
+
# includes all policy assignments of the policy definition whose id is {value}
|
802
|
+
# that apply to the management group.
|
803
|
+
#
|
804
|
+
# @param management_group_id [String] The ID of the management group.
|
805
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
806
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. A filter is
|
807
|
+
# required when listing policy assignments at management group scope.
|
808
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
809
|
+
# will be added to the HTTP request.
|
810
|
+
#
|
811
|
+
# @return [Array<PolicyAssignment>] operation results.
|
812
|
+
#
|
813
|
+
def list_for_management_group(management_group_id, filter, custom_headers:nil)
|
814
|
+
first_page = list_for_management_group_as_lazy(management_group_id, filter, custom_headers:custom_headers)
|
815
|
+
first_page.get_all_items
|
816
|
+
end
|
817
|
+
|
818
|
+
#
|
819
|
+
# Retrieves all policy assignments that apply to a management group.
|
820
|
+
#
|
821
|
+
# This operation retrieves the list of all policy assignments applicable to the
|
822
|
+
# management group that match the given $filter. Valid values for $filter are:
|
823
|
+
# 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter=atScope() is
|
824
|
+
# provided, the returned list includes all policy assignments that are assigned
|
825
|
+
# to the management group or the management group's ancestors. If
|
826
|
+
# $filter=policyDefinitionId eq '{value}' is provided, the returned list
|
827
|
+
# includes all policy assignments of the policy definition whose id is {value}
|
828
|
+
# that apply to the management group.
|
829
|
+
#
|
830
|
+
# @param management_group_id [String] The ID of the management group.
|
831
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
832
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. A filter is
|
833
|
+
# required when listing policy assignments at management group scope.
|
834
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
835
|
+
# will be added to the HTTP request.
|
836
|
+
#
|
837
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
838
|
+
#
|
839
|
+
def list_for_management_group_with_http_info(management_group_id, filter, custom_headers:nil)
|
840
|
+
list_for_management_group_async(management_group_id, filter, custom_headers:custom_headers).value!
|
841
|
+
end
|
842
|
+
|
843
|
+
#
|
844
|
+
# Retrieves all policy assignments that apply to a management group.
|
845
|
+
#
|
846
|
+
# This operation retrieves the list of all policy assignments applicable to the
|
847
|
+
# management group that match the given $filter. Valid values for $filter are:
|
848
|
+
# 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter=atScope() is
|
849
|
+
# provided, the returned list includes all policy assignments that are assigned
|
850
|
+
# to the management group or the management group's ancestors. If
|
851
|
+
# $filter=policyDefinitionId eq '{value}' is provided, the returned list
|
852
|
+
# includes all policy assignments of the policy definition whose id is {value}
|
853
|
+
# that apply to the management group.
|
854
|
+
#
|
855
|
+
# @param management_group_id [String] The ID of the management group.
|
856
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
857
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. A filter is
|
858
|
+
# required when listing policy assignments at management group scope.
|
859
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
860
|
+
# to the HTTP request.
|
861
|
+
#
|
862
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
863
|
+
#
|
864
|
+
def list_for_management_group_async(management_group_id, filter, custom_headers:nil)
|
865
|
+
fail ArgumentError, 'management_group_id is nil' if management_group_id.nil?
|
866
|
+
fail ArgumentError, 'filter is nil' if filter.nil?
|
867
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
868
|
+
|
869
|
+
|
870
|
+
request_headers = {}
|
871
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
872
|
+
|
873
|
+
# Set Headers
|
874
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
875
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
876
|
+
path_template = 'providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyAssignments'
|
877
|
+
|
878
|
+
request_url = @base_url || @client.base_url
|
879
|
+
|
880
|
+
options = {
|
881
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
882
|
+
path_params: {'managementGroupId' => management_group_id},
|
883
|
+
query_params: {'api-version' => @client.api_version},
|
884
|
+
skip_encoding_query_params: {'$filter' => filter},
|
885
|
+
headers: request_headers.merge(custom_headers || {}),
|
886
|
+
base_url: request_url
|
887
|
+
}
|
888
|
+
promise = @client.make_request_async(:get, path_template, options)
|
889
|
+
|
890
|
+
promise = promise.then do |result|
|
891
|
+
http_response = result.response
|
892
|
+
status_code = http_response.status
|
893
|
+
response_content = http_response.body
|
894
|
+
unless status_code == 200
|
895
|
+
error_model = JSON.load(response_content)
|
896
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
897
|
+
end
|
898
|
+
|
899
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
900
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
901
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
902
|
+
# Deserialize Response
|
903
|
+
if status_code == 200
|
904
|
+
begin
|
905
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
906
|
+
result_mapper = Azure::Policy::Mgmt::V2019_09_01::Models::PolicyAssignmentListResult.mapper()
|
907
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
908
|
+
rescue Exception => e
|
909
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
910
|
+
end
|
911
|
+
end
|
912
|
+
|
913
|
+
result
|
914
|
+
end
|
915
|
+
|
916
|
+
promise.execute
|
917
|
+
end
|
918
|
+
|
919
|
+
#
|
920
|
+
# Retrieves all policy assignments that apply to a subscription.
|
921
|
+
#
|
922
|
+
# This operation retrieves the list of all policy assignments associated with
|
923
|
+
# the given subscription that match the optional given $filter. Valid values
|
924
|
+
# for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter
|
925
|
+
# is not provided, the unfiltered list includes all policy assignments
|
926
|
+
# associated with the subscription, including those that apply directly or from
|
927
|
+
# management groups that contain the given subscription, as well as any applied
|
928
|
+
# to objects contained within the subscription. If $filter=atScope() is
|
929
|
+
# provided, the returned list includes all policy assignments that apply to the
|
930
|
+
# subscription, which is everything in the unfiltered list except those applied
|
931
|
+
# to objects contained within the subscription. If $filter=policyDefinitionId
|
932
|
+
# eq '{value}' is provided, the returned list includes all policy assignments
|
933
|
+
# of the policy definition whose id is {value}.
|
934
|
+
#
|
935
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
936
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
937
|
+
# not provided, no filtering is performed.
|
938
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
939
|
+
# will be added to the HTTP request.
|
940
|
+
#
|
941
|
+
# @return [Array<PolicyAssignment>] operation results.
|
942
|
+
#
|
943
|
+
def list(filter:nil, custom_headers:nil)
|
944
|
+
first_page = list_as_lazy(filter:filter, custom_headers:custom_headers)
|
945
|
+
first_page.get_all_items
|
946
|
+
end
|
947
|
+
|
948
|
+
#
|
949
|
+
# Retrieves all policy assignments that apply to a subscription.
|
950
|
+
#
|
951
|
+
# This operation retrieves the list of all policy assignments associated with
|
952
|
+
# the given subscription that match the optional given $filter. Valid values
|
953
|
+
# for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter
|
954
|
+
# is not provided, the unfiltered list includes all policy assignments
|
955
|
+
# associated with the subscription, including those that apply directly or from
|
956
|
+
# management groups that contain the given subscription, as well as any applied
|
957
|
+
# to objects contained within the subscription. If $filter=atScope() is
|
958
|
+
# provided, the returned list includes all policy assignments that apply to the
|
959
|
+
# subscription, which is everything in the unfiltered list except those applied
|
960
|
+
# to objects contained within the subscription. If $filter=policyDefinitionId
|
961
|
+
# eq '{value}' is provided, the returned list includes all policy assignments
|
962
|
+
# of the policy definition whose id is {value}.
|
963
|
+
#
|
964
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
965
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
966
|
+
# not provided, no filtering is performed.
|
967
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
968
|
+
# will be added to the HTTP request.
|
969
|
+
#
|
970
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
971
|
+
#
|
972
|
+
def list_with_http_info(filter:nil, custom_headers:nil)
|
973
|
+
list_async(filter:filter, custom_headers:custom_headers).value!
|
974
|
+
end
|
975
|
+
|
976
|
+
#
|
977
|
+
# Retrieves all policy assignments that apply to a subscription.
|
978
|
+
#
|
979
|
+
# This operation retrieves the list of all policy assignments associated with
|
980
|
+
# the given subscription that match the optional given $filter. Valid values
|
981
|
+
# for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter
|
982
|
+
# is not provided, the unfiltered list includes all policy assignments
|
983
|
+
# associated with the subscription, including those that apply directly or from
|
984
|
+
# management groups that contain the given subscription, as well as any applied
|
985
|
+
# to objects contained within the subscription. If $filter=atScope() is
|
986
|
+
# provided, the returned list includes all policy assignments that apply to the
|
987
|
+
# subscription, which is everything in the unfiltered list except those applied
|
988
|
+
# to objects contained within the subscription. If $filter=policyDefinitionId
|
989
|
+
# eq '{value}' is provided, the returned list includes all policy assignments
|
990
|
+
# of the policy definition whose id is {value}.
|
991
|
+
#
|
992
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
993
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
994
|
+
# not provided, no filtering is performed.
|
995
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
996
|
+
# to the HTTP request.
|
997
|
+
#
|
998
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
999
|
+
#
|
1000
|
+
def list_async(filter:nil, custom_headers:nil)
|
1001
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
1002
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
1003
|
+
|
1004
|
+
|
1005
|
+
request_headers = {}
|
1006
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
1007
|
+
|
1008
|
+
# Set Headers
|
1009
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1010
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1011
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments'
|
1012
|
+
|
1013
|
+
request_url = @base_url || @client.base_url
|
1014
|
+
|
1015
|
+
options = {
|
1016
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1017
|
+
path_params: {'subscriptionId' => @client.subscription_id},
|
1018
|
+
query_params: {'$filter' => filter,'api-version' => @client.api_version},
|
1019
|
+
headers: request_headers.merge(custom_headers || {}),
|
1020
|
+
base_url: request_url
|
1021
|
+
}
|
1022
|
+
promise = @client.make_request_async(:get, path_template, options)
|
1023
|
+
|
1024
|
+
promise = promise.then do |result|
|
1025
|
+
http_response = result.response
|
1026
|
+
status_code = http_response.status
|
1027
|
+
response_content = http_response.body
|
1028
|
+
unless status_code == 200
|
1029
|
+
error_model = JSON.load(response_content)
|
1030
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
1031
|
+
end
|
1032
|
+
|
1033
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1034
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
1035
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
1036
|
+
# Deserialize Response
|
1037
|
+
if status_code == 200
|
1038
|
+
begin
|
1039
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1040
|
+
result_mapper = Azure::Policy::Mgmt::V2019_09_01::Models::PolicyAssignmentListResult.mapper()
|
1041
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1042
|
+
rescue Exception => e
|
1043
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1044
|
+
end
|
1045
|
+
end
|
1046
|
+
|
1047
|
+
result
|
1048
|
+
end
|
1049
|
+
|
1050
|
+
promise.execute
|
1051
|
+
end
|
1052
|
+
|
1053
|
+
#
|
1054
|
+
# Deletes a policy assignment.
|
1055
|
+
#
|
1056
|
+
# This operation deletes the policy with the given ID. Policy assignment IDs
|
1057
|
+
# have this format:
|
1058
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1059
|
+
# Valid formats for {scope} are:
|
1060
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'
|
1061
|
+
# (management group), '/subscriptions/{subscriptionId}' (subscription),
|
1062
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'
|
1063
|
+
# (resource group), or
|
1064
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
|
1065
|
+
# (resource).
|
1066
|
+
#
|
1067
|
+
# @param policy_assignment_id [String] The ID of the policy assignment to
|
1068
|
+
# delete. Use the format
|
1069
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1070
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1071
|
+
# will be added to the HTTP request.
|
1072
|
+
#
|
1073
|
+
# @return [PolicyAssignment] operation results.
|
1074
|
+
#
|
1075
|
+
def delete_by_id(policy_assignment_id, custom_headers:nil)
|
1076
|
+
response = delete_by_id_async(policy_assignment_id, custom_headers:custom_headers).value!
|
1077
|
+
response.body unless response.nil?
|
1078
|
+
end
|
1079
|
+
|
1080
|
+
#
|
1081
|
+
# Deletes a policy assignment.
|
1082
|
+
#
|
1083
|
+
# This operation deletes the policy with the given ID. Policy assignment IDs
|
1084
|
+
# have this format:
|
1085
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1086
|
+
# Valid formats for {scope} are:
|
1087
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'
|
1088
|
+
# (management group), '/subscriptions/{subscriptionId}' (subscription),
|
1089
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'
|
1090
|
+
# (resource group), or
|
1091
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
|
1092
|
+
# (resource).
|
1093
|
+
#
|
1094
|
+
# @param policy_assignment_id [String] The ID of the policy assignment to
|
1095
|
+
# delete. Use the format
|
1096
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1097
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1098
|
+
# will be added to the HTTP request.
|
1099
|
+
#
|
1100
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
1101
|
+
#
|
1102
|
+
def delete_by_id_with_http_info(policy_assignment_id, custom_headers:nil)
|
1103
|
+
delete_by_id_async(policy_assignment_id, custom_headers:custom_headers).value!
|
1104
|
+
end
|
1105
|
+
|
1106
|
+
#
|
1107
|
+
# Deletes a policy assignment.
|
1108
|
+
#
|
1109
|
+
# This operation deletes the policy with the given ID. Policy assignment IDs
|
1110
|
+
# have this format:
|
1111
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1112
|
+
# Valid formats for {scope} are:
|
1113
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'
|
1114
|
+
# (management group), '/subscriptions/{subscriptionId}' (subscription),
|
1115
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'
|
1116
|
+
# (resource group), or
|
1117
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
|
1118
|
+
# (resource).
|
1119
|
+
#
|
1120
|
+
# @param policy_assignment_id [String] The ID of the policy assignment to
|
1121
|
+
# delete. Use the format
|
1122
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1123
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
1124
|
+
# to the HTTP request.
|
1125
|
+
#
|
1126
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
1127
|
+
#
|
1128
|
+
def delete_by_id_async(policy_assignment_id, custom_headers:nil)
|
1129
|
+
fail ArgumentError, 'policy_assignment_id is nil' if policy_assignment_id.nil?
|
1130
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
1131
|
+
|
1132
|
+
|
1133
|
+
request_headers = {}
|
1134
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
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 = '{policyAssignmentId}'
|
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: {'policyAssignmentId' => policy_assignment_id},
|
1146
|
+
query_params: {'api-version' => @client.api_version},
|
1147
|
+
headers: request_headers.merge(custom_headers || {}),
|
1148
|
+
base_url: request_url
|
1149
|
+
}
|
1150
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
1151
|
+
|
1152
|
+
promise = promise.then do |result|
|
1153
|
+
http_response = result.response
|
1154
|
+
status_code = http_response.status
|
1155
|
+
response_content = http_response.body
|
1156
|
+
unless status_code == 200 || status_code == 204
|
1157
|
+
error_model = JSON.load(response_content)
|
1158
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
1159
|
+
end
|
1160
|
+
|
1161
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1162
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
1163
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
1164
|
+
# Deserialize Response
|
1165
|
+
if status_code == 200
|
1166
|
+
begin
|
1167
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1168
|
+
result_mapper = Azure::Policy::Mgmt::V2019_09_01::Models::PolicyAssignment.mapper()
|
1169
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1170
|
+
rescue Exception => e
|
1171
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1172
|
+
end
|
1173
|
+
end
|
1174
|
+
|
1175
|
+
result
|
1176
|
+
end
|
1177
|
+
|
1178
|
+
promise.execute
|
1179
|
+
end
|
1180
|
+
|
1181
|
+
#
|
1182
|
+
# Creates or updates a policy assignment.
|
1183
|
+
#
|
1184
|
+
# This operation creates or updates the policy assignment with the given ID.
|
1185
|
+
# Policy assignments made on a scope apply to all resources contained in that
|
1186
|
+
# scope. For example, when you assign a policy to a resource group that policy
|
1187
|
+
# applies to all resources in the group. Policy assignment IDs have this
|
1188
|
+
# format:
|
1189
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1190
|
+
# Valid scopes are: management group (format:
|
1191
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
1192
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
1193
|
+
# (format:
|
1194
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
1195
|
+
# resource (format:
|
1196
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
|
1197
|
+
#
|
1198
|
+
# @param policy_assignment_id [String] The ID of the policy assignment to
|
1199
|
+
# create. Use the format
|
1200
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1201
|
+
# @param parameters [PolicyAssignment] Parameters for policy assignment.
|
1202
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1203
|
+
# will be added to the HTTP request.
|
1204
|
+
#
|
1205
|
+
# @return [PolicyAssignment] operation results.
|
1206
|
+
#
|
1207
|
+
def create_by_id(policy_assignment_id, parameters, custom_headers:nil)
|
1208
|
+
response = create_by_id_async(policy_assignment_id, parameters, custom_headers:custom_headers).value!
|
1209
|
+
response.body unless response.nil?
|
1210
|
+
end
|
1211
|
+
|
1212
|
+
#
|
1213
|
+
# Creates or updates a policy assignment.
|
1214
|
+
#
|
1215
|
+
# This operation creates or updates the policy assignment with the given ID.
|
1216
|
+
# Policy assignments made on a scope apply to all resources contained in that
|
1217
|
+
# scope. For example, when you assign a policy to a resource group that policy
|
1218
|
+
# applies to all resources in the group. Policy assignment IDs have this
|
1219
|
+
# format:
|
1220
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1221
|
+
# Valid scopes are: management group (format:
|
1222
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
1223
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
1224
|
+
# (format:
|
1225
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
1226
|
+
# resource (format:
|
1227
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
|
1228
|
+
#
|
1229
|
+
# @param policy_assignment_id [String] The ID of the policy assignment to
|
1230
|
+
# create. Use the format
|
1231
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1232
|
+
# @param parameters [PolicyAssignment] Parameters for policy assignment.
|
1233
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1234
|
+
# will be added to the HTTP request.
|
1235
|
+
#
|
1236
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
1237
|
+
#
|
1238
|
+
def create_by_id_with_http_info(policy_assignment_id, parameters, custom_headers:nil)
|
1239
|
+
create_by_id_async(policy_assignment_id, parameters, custom_headers:custom_headers).value!
|
1240
|
+
end
|
1241
|
+
|
1242
|
+
#
|
1243
|
+
# Creates or updates a policy assignment.
|
1244
|
+
#
|
1245
|
+
# This operation creates or updates the policy assignment with the given ID.
|
1246
|
+
# Policy assignments made on a scope apply to all resources contained in that
|
1247
|
+
# scope. For example, when you assign a policy to a resource group that policy
|
1248
|
+
# applies to all resources in the group. Policy assignment IDs have this
|
1249
|
+
# format:
|
1250
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1251
|
+
# Valid scopes are: management group (format:
|
1252
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
1253
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
1254
|
+
# (format:
|
1255
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
1256
|
+
# resource (format:
|
1257
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
|
1258
|
+
#
|
1259
|
+
# @param policy_assignment_id [String] The ID of the policy assignment to
|
1260
|
+
# create. Use the format
|
1261
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1262
|
+
# @param parameters [PolicyAssignment] Parameters for policy assignment.
|
1263
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
1264
|
+
# to the HTTP request.
|
1265
|
+
#
|
1266
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
1267
|
+
#
|
1268
|
+
def create_by_id_async(policy_assignment_id, parameters, custom_headers:nil)
|
1269
|
+
fail ArgumentError, 'policy_assignment_id is nil' if policy_assignment_id.nil?
|
1270
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
1271
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
1272
|
+
|
1273
|
+
|
1274
|
+
request_headers = {}
|
1275
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
1276
|
+
|
1277
|
+
# Set Headers
|
1278
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1279
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1280
|
+
|
1281
|
+
# Serialize Request
|
1282
|
+
request_mapper = Azure::Policy::Mgmt::V2019_09_01::Models::PolicyAssignment.mapper()
|
1283
|
+
request_content = @client.serialize(request_mapper, parameters)
|
1284
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
1285
|
+
|
1286
|
+
path_template = '{policyAssignmentId}'
|
1287
|
+
|
1288
|
+
request_url = @base_url || @client.base_url
|
1289
|
+
|
1290
|
+
options = {
|
1291
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1292
|
+
skip_encoding_path_params: {'policyAssignmentId' => policy_assignment_id},
|
1293
|
+
query_params: {'api-version' => @client.api_version},
|
1294
|
+
body: request_content,
|
1295
|
+
headers: request_headers.merge(custom_headers || {}),
|
1296
|
+
base_url: request_url
|
1297
|
+
}
|
1298
|
+
promise = @client.make_request_async(:put, path_template, options)
|
1299
|
+
|
1300
|
+
promise = promise.then do |result|
|
1301
|
+
http_response = result.response
|
1302
|
+
status_code = http_response.status
|
1303
|
+
response_content = http_response.body
|
1304
|
+
unless status_code == 201
|
1305
|
+
error_model = JSON.load(response_content)
|
1306
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
1307
|
+
end
|
1308
|
+
|
1309
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1310
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
1311
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
1312
|
+
# Deserialize Response
|
1313
|
+
if status_code == 201
|
1314
|
+
begin
|
1315
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1316
|
+
result_mapper = Azure::Policy::Mgmt::V2019_09_01::Models::PolicyAssignment.mapper()
|
1317
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1318
|
+
rescue Exception => e
|
1319
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1320
|
+
end
|
1321
|
+
end
|
1322
|
+
|
1323
|
+
result
|
1324
|
+
end
|
1325
|
+
|
1326
|
+
promise.execute
|
1327
|
+
end
|
1328
|
+
|
1329
|
+
#
|
1330
|
+
# Retrieves the policy assignment with the given ID.
|
1331
|
+
#
|
1332
|
+
# The operation retrieves the policy assignment with the given ID. Policy
|
1333
|
+
# assignment IDs have this format:
|
1334
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1335
|
+
# Valid scopes are: management group (format:
|
1336
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
1337
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
1338
|
+
# (format:
|
1339
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
1340
|
+
# resource (format:
|
1341
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
|
1342
|
+
#
|
1343
|
+
# @param policy_assignment_id [String] The ID of the policy assignment to get.
|
1344
|
+
# Use the format
|
1345
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1346
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1347
|
+
# will be added to the HTTP request.
|
1348
|
+
#
|
1349
|
+
# @return [PolicyAssignment] operation results.
|
1350
|
+
#
|
1351
|
+
def get_by_id(policy_assignment_id, custom_headers:nil)
|
1352
|
+
response = get_by_id_async(policy_assignment_id, custom_headers:custom_headers).value!
|
1353
|
+
response.body unless response.nil?
|
1354
|
+
end
|
1355
|
+
|
1356
|
+
#
|
1357
|
+
# Retrieves the policy assignment with the given ID.
|
1358
|
+
#
|
1359
|
+
# The operation retrieves the policy assignment with the given ID. Policy
|
1360
|
+
# assignment IDs have this format:
|
1361
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1362
|
+
# Valid scopes are: management group (format:
|
1363
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
1364
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
1365
|
+
# (format:
|
1366
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
1367
|
+
# resource (format:
|
1368
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
|
1369
|
+
#
|
1370
|
+
# @param policy_assignment_id [String] The ID of the policy assignment to get.
|
1371
|
+
# Use the format
|
1372
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1373
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1374
|
+
# will be added to the HTTP request.
|
1375
|
+
#
|
1376
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
1377
|
+
#
|
1378
|
+
def get_by_id_with_http_info(policy_assignment_id, custom_headers:nil)
|
1379
|
+
get_by_id_async(policy_assignment_id, custom_headers:custom_headers).value!
|
1380
|
+
end
|
1381
|
+
|
1382
|
+
#
|
1383
|
+
# Retrieves the policy assignment with the given ID.
|
1384
|
+
#
|
1385
|
+
# The operation retrieves the policy assignment with the given ID. Policy
|
1386
|
+
# assignment IDs have this format:
|
1387
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1388
|
+
# Valid scopes are: management group (format:
|
1389
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
1390
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
1391
|
+
# (format:
|
1392
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
1393
|
+
# resource (format:
|
1394
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
|
1395
|
+
#
|
1396
|
+
# @param policy_assignment_id [String] The ID of the policy assignment to get.
|
1397
|
+
# Use the format
|
1398
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1399
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
1400
|
+
# to the HTTP request.
|
1401
|
+
#
|
1402
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
1403
|
+
#
|
1404
|
+
def get_by_id_async(policy_assignment_id, custom_headers:nil)
|
1405
|
+
fail ArgumentError, 'policy_assignment_id is nil' if policy_assignment_id.nil?
|
1406
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
1407
|
+
|
1408
|
+
|
1409
|
+
request_headers = {}
|
1410
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
1411
|
+
|
1412
|
+
# Set Headers
|
1413
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1414
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1415
|
+
path_template = '{policyAssignmentId}'
|
1416
|
+
|
1417
|
+
request_url = @base_url || @client.base_url
|
1418
|
+
|
1419
|
+
options = {
|
1420
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1421
|
+
skip_encoding_path_params: {'policyAssignmentId' => policy_assignment_id},
|
1422
|
+
query_params: {'api-version' => @client.api_version},
|
1423
|
+
headers: request_headers.merge(custom_headers || {}),
|
1424
|
+
base_url: request_url
|
1425
|
+
}
|
1426
|
+
promise = @client.make_request_async(:get, path_template, options)
|
1427
|
+
|
1428
|
+
promise = promise.then do |result|
|
1429
|
+
http_response = result.response
|
1430
|
+
status_code = http_response.status
|
1431
|
+
response_content = http_response.body
|
1432
|
+
unless status_code == 200
|
1433
|
+
error_model = JSON.load(response_content)
|
1434
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
1435
|
+
end
|
1436
|
+
|
1437
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1438
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
1439
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
1440
|
+
# Deserialize Response
|
1441
|
+
if status_code == 200
|
1442
|
+
begin
|
1443
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1444
|
+
result_mapper = Azure::Policy::Mgmt::V2019_09_01::Models::PolicyAssignment.mapper()
|
1445
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1446
|
+
rescue Exception => e
|
1447
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1448
|
+
end
|
1449
|
+
end
|
1450
|
+
|
1451
|
+
result
|
1452
|
+
end
|
1453
|
+
|
1454
|
+
promise.execute
|
1455
|
+
end
|
1456
|
+
|
1457
|
+
#
|
1458
|
+
# Retrieves all policy assignments that apply to a resource group.
|
1459
|
+
#
|
1460
|
+
# This operation retrieves the list of all policy assignments associated with
|
1461
|
+
# the given resource group in the given subscription that match the optional
|
1462
|
+
# given $filter. Valid values for $filter are: 'atScope()' or
|
1463
|
+
# 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered
|
1464
|
+
# list includes all policy assignments associated with the resource group,
|
1465
|
+
# including those that apply directly or apply from containing scopes, as well
|
1466
|
+
# as any applied to resources contained within the resource group. If
|
1467
|
+
# $filter=atScope() is provided, the returned list includes all policy
|
1468
|
+
# assignments that apply to the resource group, which is everything in the
|
1469
|
+
# unfiltered list except those applied to resources contained within the
|
1470
|
+
# resource group. If $filter=policyDefinitionId eq '{value}' is provided, the
|
1471
|
+
# returned list includes all policy assignments of the policy definition whose
|
1472
|
+
# id is {value} that apply to the resource group.
|
1473
|
+
#
|
1474
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1475
|
+
# to List operation.
|
1476
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1477
|
+
# will be added to the HTTP request.
|
1478
|
+
#
|
1479
|
+
# @return [PolicyAssignmentListResult] operation results.
|
1480
|
+
#
|
1481
|
+
def list_for_resource_group_next(next_page_link, custom_headers:nil)
|
1482
|
+
response = list_for_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
|
1483
|
+
response.body unless response.nil?
|
1484
|
+
end
|
1485
|
+
|
1486
|
+
#
|
1487
|
+
# Retrieves all policy assignments that apply to a resource group.
|
1488
|
+
#
|
1489
|
+
# This operation retrieves the list of all policy assignments associated with
|
1490
|
+
# the given resource group in the given subscription that match the optional
|
1491
|
+
# given $filter. Valid values for $filter are: 'atScope()' or
|
1492
|
+
# 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered
|
1493
|
+
# list includes all policy assignments associated with the resource group,
|
1494
|
+
# including those that apply directly or apply from containing scopes, as well
|
1495
|
+
# as any applied to resources contained within the resource group. If
|
1496
|
+
# $filter=atScope() is provided, the returned list includes all policy
|
1497
|
+
# assignments that apply to the resource group, which is everything in the
|
1498
|
+
# unfiltered list except those applied to resources contained within the
|
1499
|
+
# resource group. If $filter=policyDefinitionId eq '{value}' is provided, the
|
1500
|
+
# returned list includes all policy assignments of the policy definition whose
|
1501
|
+
# id is {value} that apply to the resource group.
|
1502
|
+
#
|
1503
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1504
|
+
# to List operation.
|
1505
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1506
|
+
# will be added to the HTTP request.
|
1507
|
+
#
|
1508
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
1509
|
+
#
|
1510
|
+
def list_for_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
|
1511
|
+
list_for_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
|
1512
|
+
end
|
1513
|
+
|
1514
|
+
#
|
1515
|
+
# Retrieves all policy assignments that apply to a resource group.
|
1516
|
+
#
|
1517
|
+
# This operation retrieves the list of all policy assignments associated with
|
1518
|
+
# the given resource group in the given subscription that match the optional
|
1519
|
+
# given $filter. Valid values for $filter are: 'atScope()' or
|
1520
|
+
# 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered
|
1521
|
+
# list includes all policy assignments associated with the resource group,
|
1522
|
+
# including those that apply directly or apply from containing scopes, as well
|
1523
|
+
# as any applied to resources contained within the resource group. If
|
1524
|
+
# $filter=atScope() is provided, the returned list includes all policy
|
1525
|
+
# assignments that apply to the resource group, which is everything in the
|
1526
|
+
# unfiltered list except those applied to resources contained within the
|
1527
|
+
# resource group. If $filter=policyDefinitionId eq '{value}' is provided, the
|
1528
|
+
# returned list includes all policy assignments of the policy definition whose
|
1529
|
+
# id is {value} that apply to the resource group.
|
1530
|
+
#
|
1531
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1532
|
+
# to List operation.
|
1533
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
1534
|
+
# to the HTTP request.
|
1535
|
+
#
|
1536
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
1537
|
+
#
|
1538
|
+
def list_for_resource_group_next_async(next_page_link, custom_headers:nil)
|
1539
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
1540
|
+
|
1541
|
+
|
1542
|
+
request_headers = {}
|
1543
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
1544
|
+
|
1545
|
+
# Set Headers
|
1546
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1547
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1548
|
+
path_template = '{nextLink}'
|
1549
|
+
|
1550
|
+
request_url = @base_url || @client.base_url
|
1551
|
+
|
1552
|
+
options = {
|
1553
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1554
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
1555
|
+
headers: request_headers.merge(custom_headers || {}),
|
1556
|
+
base_url: request_url
|
1557
|
+
}
|
1558
|
+
promise = @client.make_request_async(:get, path_template, options)
|
1559
|
+
|
1560
|
+
promise = promise.then do |result|
|
1561
|
+
http_response = result.response
|
1562
|
+
status_code = http_response.status
|
1563
|
+
response_content = http_response.body
|
1564
|
+
unless status_code == 200
|
1565
|
+
error_model = JSON.load(response_content)
|
1566
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
1567
|
+
end
|
1568
|
+
|
1569
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1570
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
1571
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
1572
|
+
# Deserialize Response
|
1573
|
+
if status_code == 200
|
1574
|
+
begin
|
1575
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1576
|
+
result_mapper = Azure::Policy::Mgmt::V2019_09_01::Models::PolicyAssignmentListResult.mapper()
|
1577
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1578
|
+
rescue Exception => e
|
1579
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1580
|
+
end
|
1581
|
+
end
|
1582
|
+
|
1583
|
+
result
|
1584
|
+
end
|
1585
|
+
|
1586
|
+
promise.execute
|
1587
|
+
end
|
1588
|
+
|
1589
|
+
#
|
1590
|
+
# Retrieves all policy assignments that apply to a resource.
|
1591
|
+
#
|
1592
|
+
# This operation retrieves the list of all policy assignments associated with
|
1593
|
+
# the specified resource in the given resource group and subscription that
|
1594
|
+
# match the optional given $filter. Valid values for $filter are: 'atScope()'
|
1595
|
+
# or 'policyDefinitionId eq '{value}''. If $filter is not provided, the
|
1596
|
+
# unfiltered list includes all policy assignments associated with the resource,
|
1597
|
+
# including those that apply directly or from all containing scopes, as well as
|
1598
|
+
# any applied to resources contained within the resource. If $filter=atScope()
|
1599
|
+
# is provided, the returned list includes all policy assignments that apply to
|
1600
|
+
# the resource, which is everything in the unfiltered list except those applied
|
1601
|
+
# to resources contained within the resource. If $filter=policyDefinitionId eq
|
1602
|
+
# '{value}' is provided, the returned list includes all policy assignments of
|
1603
|
+
# the policy definition whose id is {value} that apply to the resource. Three
|
1604
|
+
# parameters plus the resource name are used to identify a specific resource.
|
1605
|
+
# If the resource is not part of a parent resource (the more common case), the
|
1606
|
+
# parent resource path should not be provided (or provided as ''). For example
|
1607
|
+
# a web app could be specified as ({resourceProviderNamespace} ==
|
1608
|
+
# 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites',
|
1609
|
+
# {resourceName} == 'MyWebApp'). If the resource is part of a parent resource,
|
1610
|
+
# then all parameters should be provided. For example a virtual machine DNS
|
1611
|
+
# name could be specified as ({resourceProviderNamespace} ==
|
1612
|
+
# 'Microsoft.Compute', {parentResourcePath} ==
|
1613
|
+
# 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames',
|
1614
|
+
# {resourceName} == 'MyComputerName'). A convenient alternative to providing
|
1615
|
+
# the namespace and type name separately is to provide both in the
|
1616
|
+
# {resourceType} parameter, format: ({resourceProviderNamespace} == '',
|
1617
|
+
# {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites',
|
1618
|
+
# {resourceName} == 'MyWebApp').
|
1619
|
+
#
|
1620
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1621
|
+
# to List operation.
|
1622
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1623
|
+
# will be added to the HTTP request.
|
1624
|
+
#
|
1625
|
+
# @return [PolicyAssignmentListResult] operation results.
|
1626
|
+
#
|
1627
|
+
def list_for_resource_next(next_page_link, custom_headers:nil)
|
1628
|
+
response = list_for_resource_next_async(next_page_link, custom_headers:custom_headers).value!
|
1629
|
+
response.body unless response.nil?
|
1630
|
+
end
|
1631
|
+
|
1632
|
+
#
|
1633
|
+
# Retrieves all policy assignments that apply to a resource.
|
1634
|
+
#
|
1635
|
+
# This operation retrieves the list of all policy assignments associated with
|
1636
|
+
# the specified resource in the given resource group and subscription that
|
1637
|
+
# match the optional given $filter. Valid values for $filter are: 'atScope()'
|
1638
|
+
# or 'policyDefinitionId eq '{value}''. If $filter is not provided, the
|
1639
|
+
# unfiltered list includes all policy assignments associated with the resource,
|
1640
|
+
# including those that apply directly or from all containing scopes, as well as
|
1641
|
+
# any applied to resources contained within the resource. If $filter=atScope()
|
1642
|
+
# is provided, the returned list includes all policy assignments that apply to
|
1643
|
+
# the resource, which is everything in the unfiltered list except those applied
|
1644
|
+
# to resources contained within the resource. If $filter=policyDefinitionId eq
|
1645
|
+
# '{value}' is provided, the returned list includes all policy assignments of
|
1646
|
+
# the policy definition whose id is {value} that apply to the resource. Three
|
1647
|
+
# parameters plus the resource name are used to identify a specific resource.
|
1648
|
+
# If the resource is not part of a parent resource (the more common case), the
|
1649
|
+
# parent resource path should not be provided (or provided as ''). For example
|
1650
|
+
# a web app could be specified as ({resourceProviderNamespace} ==
|
1651
|
+
# 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites',
|
1652
|
+
# {resourceName} == 'MyWebApp'). If the resource is part of a parent resource,
|
1653
|
+
# then all parameters should be provided. For example a virtual machine DNS
|
1654
|
+
# name could be specified as ({resourceProviderNamespace} ==
|
1655
|
+
# 'Microsoft.Compute', {parentResourcePath} ==
|
1656
|
+
# 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames',
|
1657
|
+
# {resourceName} == 'MyComputerName'). A convenient alternative to providing
|
1658
|
+
# the namespace and type name separately is to provide both in the
|
1659
|
+
# {resourceType} parameter, format: ({resourceProviderNamespace} == '',
|
1660
|
+
# {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites',
|
1661
|
+
# {resourceName} == 'MyWebApp').
|
1662
|
+
#
|
1663
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1664
|
+
# to List operation.
|
1665
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1666
|
+
# will be added to the HTTP request.
|
1667
|
+
#
|
1668
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
1669
|
+
#
|
1670
|
+
def list_for_resource_next_with_http_info(next_page_link, custom_headers:nil)
|
1671
|
+
list_for_resource_next_async(next_page_link, custom_headers:custom_headers).value!
|
1672
|
+
end
|
1673
|
+
|
1674
|
+
#
|
1675
|
+
# Retrieves all policy assignments that apply to a resource.
|
1676
|
+
#
|
1677
|
+
# This operation retrieves the list of all policy assignments associated with
|
1678
|
+
# the specified resource in the given resource group and subscription that
|
1679
|
+
# match the optional given $filter. Valid values for $filter are: 'atScope()'
|
1680
|
+
# or 'policyDefinitionId eq '{value}''. If $filter is not provided, the
|
1681
|
+
# unfiltered list includes all policy assignments associated with the resource,
|
1682
|
+
# including those that apply directly or from all containing scopes, as well as
|
1683
|
+
# any applied to resources contained within the resource. If $filter=atScope()
|
1684
|
+
# is provided, the returned list includes all policy assignments that apply to
|
1685
|
+
# the resource, which is everything in the unfiltered list except those applied
|
1686
|
+
# to resources contained within the resource. If $filter=policyDefinitionId eq
|
1687
|
+
# '{value}' is provided, the returned list includes all policy assignments of
|
1688
|
+
# the policy definition whose id is {value} that apply to the resource. Three
|
1689
|
+
# parameters plus the resource name are used to identify a specific resource.
|
1690
|
+
# If the resource is not part of a parent resource (the more common case), the
|
1691
|
+
# parent resource path should not be provided (or provided as ''). For example
|
1692
|
+
# a web app could be specified as ({resourceProviderNamespace} ==
|
1693
|
+
# 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites',
|
1694
|
+
# {resourceName} == 'MyWebApp'). If the resource is part of a parent resource,
|
1695
|
+
# then all parameters should be provided. For example a virtual machine DNS
|
1696
|
+
# name could be specified as ({resourceProviderNamespace} ==
|
1697
|
+
# 'Microsoft.Compute', {parentResourcePath} ==
|
1698
|
+
# 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames',
|
1699
|
+
# {resourceName} == 'MyComputerName'). A convenient alternative to providing
|
1700
|
+
# the namespace and type name separately is to provide both in the
|
1701
|
+
# {resourceType} parameter, format: ({resourceProviderNamespace} == '',
|
1702
|
+
# {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites',
|
1703
|
+
# {resourceName} == 'MyWebApp').
|
1704
|
+
#
|
1705
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1706
|
+
# to List operation.
|
1707
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
1708
|
+
# to the HTTP request.
|
1709
|
+
#
|
1710
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
1711
|
+
#
|
1712
|
+
def list_for_resource_next_async(next_page_link, custom_headers:nil)
|
1713
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
1714
|
+
|
1715
|
+
|
1716
|
+
request_headers = {}
|
1717
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
1718
|
+
|
1719
|
+
# Set Headers
|
1720
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1721
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1722
|
+
path_template = '{nextLink}'
|
1723
|
+
|
1724
|
+
request_url = @base_url || @client.base_url
|
1725
|
+
|
1726
|
+
options = {
|
1727
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1728
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
1729
|
+
headers: request_headers.merge(custom_headers || {}),
|
1730
|
+
base_url: request_url
|
1731
|
+
}
|
1732
|
+
promise = @client.make_request_async(:get, path_template, options)
|
1733
|
+
|
1734
|
+
promise = promise.then do |result|
|
1735
|
+
http_response = result.response
|
1736
|
+
status_code = http_response.status
|
1737
|
+
response_content = http_response.body
|
1738
|
+
unless status_code == 200
|
1739
|
+
error_model = JSON.load(response_content)
|
1740
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
1741
|
+
end
|
1742
|
+
|
1743
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1744
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
1745
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
1746
|
+
# Deserialize Response
|
1747
|
+
if status_code == 200
|
1748
|
+
begin
|
1749
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1750
|
+
result_mapper = Azure::Policy::Mgmt::V2019_09_01::Models::PolicyAssignmentListResult.mapper()
|
1751
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1752
|
+
rescue Exception => e
|
1753
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1754
|
+
end
|
1755
|
+
end
|
1756
|
+
|
1757
|
+
result
|
1758
|
+
end
|
1759
|
+
|
1760
|
+
promise.execute
|
1761
|
+
end
|
1762
|
+
|
1763
|
+
#
|
1764
|
+
# Retrieves all policy assignments that apply to a management group.
|
1765
|
+
#
|
1766
|
+
# This operation retrieves the list of all policy assignments applicable to the
|
1767
|
+
# management group that match the given $filter. Valid values for $filter are:
|
1768
|
+
# 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter=atScope() is
|
1769
|
+
# provided, the returned list includes all policy assignments that are assigned
|
1770
|
+
# to the management group or the management group's ancestors. If
|
1771
|
+
# $filter=policyDefinitionId eq '{value}' is provided, the returned list
|
1772
|
+
# includes all policy assignments of the policy definition whose id is {value}
|
1773
|
+
# that apply to the management group.
|
1774
|
+
#
|
1775
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1776
|
+
# to List operation.
|
1777
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1778
|
+
# will be added to the HTTP request.
|
1779
|
+
#
|
1780
|
+
# @return [PolicyAssignmentListResult] operation results.
|
1781
|
+
#
|
1782
|
+
def list_for_management_group_next(next_page_link, custom_headers:nil)
|
1783
|
+
response = list_for_management_group_next_async(next_page_link, custom_headers:custom_headers).value!
|
1784
|
+
response.body unless response.nil?
|
1785
|
+
end
|
1786
|
+
|
1787
|
+
#
|
1788
|
+
# Retrieves all policy assignments that apply to a management group.
|
1789
|
+
#
|
1790
|
+
# This operation retrieves the list of all policy assignments applicable to the
|
1791
|
+
# management group that match the given $filter. Valid values for $filter are:
|
1792
|
+
# 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter=atScope() is
|
1793
|
+
# provided, the returned list includes all policy assignments that are assigned
|
1794
|
+
# to the management group or the management group's ancestors. If
|
1795
|
+
# $filter=policyDefinitionId eq '{value}' is provided, the returned list
|
1796
|
+
# includes all policy assignments of the policy definition whose id is {value}
|
1797
|
+
# that apply to the management group.
|
1798
|
+
#
|
1799
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1800
|
+
# to List operation.
|
1801
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1802
|
+
# will be added to the HTTP request.
|
1803
|
+
#
|
1804
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
1805
|
+
#
|
1806
|
+
def list_for_management_group_next_with_http_info(next_page_link, custom_headers:nil)
|
1807
|
+
list_for_management_group_next_async(next_page_link, custom_headers:custom_headers).value!
|
1808
|
+
end
|
1809
|
+
|
1810
|
+
#
|
1811
|
+
# Retrieves all policy assignments that apply to a management group.
|
1812
|
+
#
|
1813
|
+
# This operation retrieves the list of all policy assignments applicable to the
|
1814
|
+
# management group that match the given $filter. Valid values for $filter are:
|
1815
|
+
# 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter=atScope() is
|
1816
|
+
# provided, the returned list includes all policy assignments that are assigned
|
1817
|
+
# to the management group or the management group's ancestors. If
|
1818
|
+
# $filter=policyDefinitionId eq '{value}' is provided, the returned list
|
1819
|
+
# includes all policy assignments of the policy definition whose id is {value}
|
1820
|
+
# that apply to the management group.
|
1821
|
+
#
|
1822
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1823
|
+
# to List operation.
|
1824
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
1825
|
+
# to the HTTP request.
|
1826
|
+
#
|
1827
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
1828
|
+
#
|
1829
|
+
def list_for_management_group_next_async(next_page_link, custom_headers:nil)
|
1830
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
1831
|
+
|
1832
|
+
|
1833
|
+
request_headers = {}
|
1834
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
1835
|
+
|
1836
|
+
# Set Headers
|
1837
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1838
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1839
|
+
path_template = '{nextLink}'
|
1840
|
+
|
1841
|
+
request_url = @base_url || @client.base_url
|
1842
|
+
|
1843
|
+
options = {
|
1844
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1845
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
1846
|
+
headers: request_headers.merge(custom_headers || {}),
|
1847
|
+
base_url: request_url
|
1848
|
+
}
|
1849
|
+
promise = @client.make_request_async(:get, path_template, options)
|
1850
|
+
|
1851
|
+
promise = promise.then do |result|
|
1852
|
+
http_response = result.response
|
1853
|
+
status_code = http_response.status
|
1854
|
+
response_content = http_response.body
|
1855
|
+
unless status_code == 200
|
1856
|
+
error_model = JSON.load(response_content)
|
1857
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
1858
|
+
end
|
1859
|
+
|
1860
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1861
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
1862
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
1863
|
+
# Deserialize Response
|
1864
|
+
if status_code == 200
|
1865
|
+
begin
|
1866
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1867
|
+
result_mapper = Azure::Policy::Mgmt::V2019_09_01::Models::PolicyAssignmentListResult.mapper()
|
1868
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1869
|
+
rescue Exception => e
|
1870
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1871
|
+
end
|
1872
|
+
end
|
1873
|
+
|
1874
|
+
result
|
1875
|
+
end
|
1876
|
+
|
1877
|
+
promise.execute
|
1878
|
+
end
|
1879
|
+
|
1880
|
+
#
|
1881
|
+
# Retrieves all policy assignments that apply to a subscription.
|
1882
|
+
#
|
1883
|
+
# This operation retrieves the list of all policy assignments associated with
|
1884
|
+
# the given subscription that match the optional given $filter. Valid values
|
1885
|
+
# for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter
|
1886
|
+
# is not provided, the unfiltered list includes all policy assignments
|
1887
|
+
# associated with the subscription, including those that apply directly or from
|
1888
|
+
# management groups that contain the given subscription, as well as any applied
|
1889
|
+
# to objects contained within the subscription. If $filter=atScope() is
|
1890
|
+
# provided, the returned list includes all policy assignments that apply to the
|
1891
|
+
# subscription, which is everything in the unfiltered list except those applied
|
1892
|
+
# to objects contained within the subscription. If $filter=policyDefinitionId
|
1893
|
+
# eq '{value}' is provided, the returned list includes all policy assignments
|
1894
|
+
# of the policy definition whose id is {value}.
|
1895
|
+
#
|
1896
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1897
|
+
# to List operation.
|
1898
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1899
|
+
# will be added to the HTTP request.
|
1900
|
+
#
|
1901
|
+
# @return [PolicyAssignmentListResult] operation results.
|
1902
|
+
#
|
1903
|
+
def list_next(next_page_link, custom_headers:nil)
|
1904
|
+
response = list_next_async(next_page_link, custom_headers:custom_headers).value!
|
1905
|
+
response.body unless response.nil?
|
1906
|
+
end
|
1907
|
+
|
1908
|
+
#
|
1909
|
+
# Retrieves all policy assignments that apply to a subscription.
|
1910
|
+
#
|
1911
|
+
# This operation retrieves the list of all policy assignments associated with
|
1912
|
+
# the given subscription that match the optional given $filter. Valid values
|
1913
|
+
# for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter
|
1914
|
+
# is not provided, the unfiltered list includes all policy assignments
|
1915
|
+
# associated with the subscription, including those that apply directly or from
|
1916
|
+
# management groups that contain the given subscription, as well as any applied
|
1917
|
+
# to objects contained within the subscription. If $filter=atScope() is
|
1918
|
+
# provided, the returned list includes all policy assignments that apply to the
|
1919
|
+
# subscription, which is everything in the unfiltered list except those applied
|
1920
|
+
# to objects contained within the subscription. If $filter=policyDefinitionId
|
1921
|
+
# eq '{value}' is provided, the returned list includes all policy assignments
|
1922
|
+
# of the policy definition whose id is {value}.
|
1923
|
+
#
|
1924
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1925
|
+
# to List operation.
|
1926
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1927
|
+
# will be added to the HTTP request.
|
1928
|
+
#
|
1929
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
1930
|
+
#
|
1931
|
+
def list_next_with_http_info(next_page_link, custom_headers:nil)
|
1932
|
+
list_next_async(next_page_link, custom_headers:custom_headers).value!
|
1933
|
+
end
|
1934
|
+
|
1935
|
+
#
|
1936
|
+
# Retrieves all policy assignments that apply to a subscription.
|
1937
|
+
#
|
1938
|
+
# This operation retrieves the list of all policy assignments associated with
|
1939
|
+
# the given subscription that match the optional given $filter. Valid values
|
1940
|
+
# for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter
|
1941
|
+
# is not provided, the unfiltered list includes all policy assignments
|
1942
|
+
# associated with the subscription, including those that apply directly or from
|
1943
|
+
# management groups that contain the given subscription, as well as any applied
|
1944
|
+
# to objects contained within the subscription. If $filter=atScope() is
|
1945
|
+
# provided, the returned list includes all policy assignments that apply to the
|
1946
|
+
# subscription, which is everything in the unfiltered list except those applied
|
1947
|
+
# to objects contained within the subscription. If $filter=policyDefinitionId
|
1948
|
+
# eq '{value}' is provided, the returned list includes all policy assignments
|
1949
|
+
# of the policy definition whose id is {value}.
|
1950
|
+
#
|
1951
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1952
|
+
# to List operation.
|
1953
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
1954
|
+
# to the HTTP request.
|
1955
|
+
#
|
1956
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
1957
|
+
#
|
1958
|
+
def list_next_async(next_page_link, custom_headers:nil)
|
1959
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
1960
|
+
|
1961
|
+
|
1962
|
+
request_headers = {}
|
1963
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
1964
|
+
|
1965
|
+
# Set Headers
|
1966
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1967
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1968
|
+
path_template = '{nextLink}'
|
1969
|
+
|
1970
|
+
request_url = @base_url || @client.base_url
|
1971
|
+
|
1972
|
+
options = {
|
1973
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1974
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
1975
|
+
headers: request_headers.merge(custom_headers || {}),
|
1976
|
+
base_url: request_url
|
1977
|
+
}
|
1978
|
+
promise = @client.make_request_async(:get, path_template, options)
|
1979
|
+
|
1980
|
+
promise = promise.then do |result|
|
1981
|
+
http_response = result.response
|
1982
|
+
status_code = http_response.status
|
1983
|
+
response_content = http_response.body
|
1984
|
+
unless status_code == 200
|
1985
|
+
error_model = JSON.load(response_content)
|
1986
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
1987
|
+
end
|
1988
|
+
|
1989
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1990
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
1991
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
1992
|
+
# Deserialize Response
|
1993
|
+
if status_code == 200
|
1994
|
+
begin
|
1995
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1996
|
+
result_mapper = Azure::Policy::Mgmt::V2019_09_01::Models::PolicyAssignmentListResult.mapper()
|
1997
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1998
|
+
rescue Exception => e
|
1999
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
2000
|
+
end
|
2001
|
+
end
|
2002
|
+
|
2003
|
+
result
|
2004
|
+
end
|
2005
|
+
|
2006
|
+
promise.execute
|
2007
|
+
end
|
2008
|
+
|
2009
|
+
#
|
2010
|
+
# Retrieves all policy assignments that apply to a resource group.
|
2011
|
+
#
|
2012
|
+
# This operation retrieves the list of all policy assignments associated with
|
2013
|
+
# the given resource group in the given subscription that match the optional
|
2014
|
+
# given $filter. Valid values for $filter are: 'atScope()' or
|
2015
|
+
# 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered
|
2016
|
+
# list includes all policy assignments associated with the resource group,
|
2017
|
+
# including those that apply directly or apply from containing scopes, as well
|
2018
|
+
# as any applied to resources contained within the resource group. If
|
2019
|
+
# $filter=atScope() is provided, the returned list includes all policy
|
2020
|
+
# assignments that apply to the resource group, which is everything in the
|
2021
|
+
# unfiltered list except those applied to resources contained within the
|
2022
|
+
# resource group. If $filter=policyDefinitionId eq '{value}' is provided, the
|
2023
|
+
# returned list includes all policy assignments of the policy definition whose
|
2024
|
+
# id is {value} that apply to the resource group.
|
2025
|
+
#
|
2026
|
+
# @param resource_group_name [String] The name of the resource group that
|
2027
|
+
# contains policy assignments.
|
2028
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
2029
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
2030
|
+
# not provided, no filtering is performed.
|
2031
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
2032
|
+
# will be added to the HTTP request.
|
2033
|
+
#
|
2034
|
+
# @return [PolicyAssignmentListResult] which provide lazy access to pages of
|
2035
|
+
# the response.
|
2036
|
+
#
|
2037
|
+
def list_for_resource_group_as_lazy(resource_group_name, filter:nil, custom_headers:nil)
|
2038
|
+
response = list_for_resource_group_async(resource_group_name, filter:filter, custom_headers:custom_headers).value!
|
2039
|
+
unless response.nil?
|
2040
|
+
page = response.body
|
2041
|
+
page.next_method = Proc.new do |next_page_link|
|
2042
|
+
list_for_resource_group_next_async(next_page_link, custom_headers:custom_headers)
|
2043
|
+
end
|
2044
|
+
page
|
2045
|
+
end
|
2046
|
+
end
|
2047
|
+
|
2048
|
+
#
|
2049
|
+
# Retrieves all policy assignments that apply to a resource.
|
2050
|
+
#
|
2051
|
+
# This operation retrieves the list of all policy assignments associated with
|
2052
|
+
# the specified resource in the given resource group and subscription that
|
2053
|
+
# match the optional given $filter. Valid values for $filter are: 'atScope()'
|
2054
|
+
# or 'policyDefinitionId eq '{value}''. If $filter is not provided, the
|
2055
|
+
# unfiltered list includes all policy assignments associated with the resource,
|
2056
|
+
# including those that apply directly or from all containing scopes, as well as
|
2057
|
+
# any applied to resources contained within the resource. If $filter=atScope()
|
2058
|
+
# is provided, the returned list includes all policy assignments that apply to
|
2059
|
+
# the resource, which is everything in the unfiltered list except those applied
|
2060
|
+
# to resources contained within the resource. If $filter=policyDefinitionId eq
|
2061
|
+
# '{value}' is provided, the returned list includes all policy assignments of
|
2062
|
+
# the policy definition whose id is {value} that apply to the resource. Three
|
2063
|
+
# parameters plus the resource name are used to identify a specific resource.
|
2064
|
+
# If the resource is not part of a parent resource (the more common case), the
|
2065
|
+
# parent resource path should not be provided (or provided as ''). For example
|
2066
|
+
# a web app could be specified as ({resourceProviderNamespace} ==
|
2067
|
+
# 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites',
|
2068
|
+
# {resourceName} == 'MyWebApp'). If the resource is part of a parent resource,
|
2069
|
+
# then all parameters should be provided. For example a virtual machine DNS
|
2070
|
+
# name could be specified as ({resourceProviderNamespace} ==
|
2071
|
+
# 'Microsoft.Compute', {parentResourcePath} ==
|
2072
|
+
# 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames',
|
2073
|
+
# {resourceName} == 'MyComputerName'). A convenient alternative to providing
|
2074
|
+
# the namespace and type name separately is to provide both in the
|
2075
|
+
# {resourceType} parameter, format: ({resourceProviderNamespace} == '',
|
2076
|
+
# {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites',
|
2077
|
+
# {resourceName} == 'MyWebApp').
|
2078
|
+
#
|
2079
|
+
# @param resource_group_name [String] The name of the resource group containing
|
2080
|
+
# the resource.
|
2081
|
+
# @param resource_provider_namespace [String] The namespace of the resource
|
2082
|
+
# provider. For example, the namespace of a virtual machine is
|
2083
|
+
# Microsoft.Compute (from Microsoft.Compute/virtualMachines)
|
2084
|
+
# @param parent_resource_path [String] The parent resource path. Use empty
|
2085
|
+
# string if there is none.
|
2086
|
+
# @param resource_type [String] The resource type name. For example the type
|
2087
|
+
# name of a web app is 'sites' (from Microsoft.Web/sites).
|
2088
|
+
# @param resource_name [String] The name of the resource.
|
2089
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
2090
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
2091
|
+
# not provided, no filtering is performed.
|
2092
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
2093
|
+
# will be added to the HTTP request.
|
2094
|
+
#
|
2095
|
+
# @return [PolicyAssignmentListResult] which provide lazy access to pages of
|
2096
|
+
# the response.
|
2097
|
+
#
|
2098
|
+
def list_for_resource_as_lazy(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:nil, custom_headers:nil)
|
2099
|
+
response = list_for_resource_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:filter, custom_headers:custom_headers).value!
|
2100
|
+
unless response.nil?
|
2101
|
+
page = response.body
|
2102
|
+
page.next_method = Proc.new do |next_page_link|
|
2103
|
+
list_for_resource_next_async(next_page_link, custom_headers:custom_headers)
|
2104
|
+
end
|
2105
|
+
page
|
2106
|
+
end
|
2107
|
+
end
|
2108
|
+
|
2109
|
+
#
|
2110
|
+
# Retrieves all policy assignments that apply to a management group.
|
2111
|
+
#
|
2112
|
+
# This operation retrieves the list of all policy assignments applicable to the
|
2113
|
+
# management group that match the given $filter. Valid values for $filter are:
|
2114
|
+
# 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter=atScope() is
|
2115
|
+
# provided, the returned list includes all policy assignments that are assigned
|
2116
|
+
# to the management group or the management group's ancestors. If
|
2117
|
+
# $filter=policyDefinitionId eq '{value}' is provided, the returned list
|
2118
|
+
# includes all policy assignments of the policy definition whose id is {value}
|
2119
|
+
# that apply to the management group.
|
2120
|
+
#
|
2121
|
+
# @param management_group_id [String] The ID of the management group.
|
2122
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
2123
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. A filter is
|
2124
|
+
# required when listing policy assignments at management group scope.
|
2125
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
2126
|
+
# will be added to the HTTP request.
|
2127
|
+
#
|
2128
|
+
# @return [PolicyAssignmentListResult] which provide lazy access to pages of
|
2129
|
+
# the response.
|
2130
|
+
#
|
2131
|
+
def list_for_management_group_as_lazy(management_group_id, filter, custom_headers:nil)
|
2132
|
+
response = list_for_management_group_async(management_group_id, filter, custom_headers:custom_headers).value!
|
2133
|
+
unless response.nil?
|
2134
|
+
page = response.body
|
2135
|
+
page.next_method = Proc.new do |next_page_link|
|
2136
|
+
list_for_management_group_next_async(next_page_link, custom_headers:custom_headers)
|
2137
|
+
end
|
2138
|
+
page
|
2139
|
+
end
|
2140
|
+
end
|
2141
|
+
|
2142
|
+
#
|
2143
|
+
# Retrieves all policy assignments that apply to a subscription.
|
2144
|
+
#
|
2145
|
+
# This operation retrieves the list of all policy assignments associated with
|
2146
|
+
# the given subscription that match the optional given $filter. Valid values
|
2147
|
+
# for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter
|
2148
|
+
# is not provided, the unfiltered list includes all policy assignments
|
2149
|
+
# associated with the subscription, including those that apply directly or from
|
2150
|
+
# management groups that contain the given subscription, as well as any applied
|
2151
|
+
# to objects contained within the subscription. If $filter=atScope() is
|
2152
|
+
# provided, the returned list includes all policy assignments that apply to the
|
2153
|
+
# subscription, which is everything in the unfiltered list except those applied
|
2154
|
+
# to objects contained within the subscription. If $filter=policyDefinitionId
|
2155
|
+
# eq '{value}' is provided, the returned list includes all policy assignments
|
2156
|
+
# of the policy definition whose id is {value}.
|
2157
|
+
#
|
2158
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
2159
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
2160
|
+
# not provided, no filtering is performed.
|
2161
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
2162
|
+
# will be added to the HTTP request.
|
2163
|
+
#
|
2164
|
+
# @return [PolicyAssignmentListResult] which provide lazy access to pages of
|
2165
|
+
# the response.
|
2166
|
+
#
|
2167
|
+
def list_as_lazy(filter:nil, custom_headers:nil)
|
2168
|
+
response = list_async(filter:filter, custom_headers:custom_headers).value!
|
2169
|
+
unless response.nil?
|
2170
|
+
page = response.body
|
2171
|
+
page.next_method = Proc.new do |next_page_link|
|
2172
|
+
list_next_async(next_page_link, custom_headers:custom_headers)
|
2173
|
+
end
|
2174
|
+
page
|
2175
|
+
end
|
2176
|
+
end
|
2177
|
+
|
2178
|
+
end
|
2179
|
+
end
|