azure_mgmt_policy 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/2015-10-01-preview/generated/azure_mgmt_policy/models/policy_definition.rb +1 -0
- data/lib/2015-10-01-preview/generated/azure_mgmt_policy/policy_client.rb +7 -6
- data/lib/2016-04-01/generated/azure_mgmt_policy/models/policy_definition.rb +1 -0
- data/lib/2016-04-01/generated/azure_mgmt_policy/policy_client.rb +7 -6
- data/lib/2016-12-01/generated/azure_mgmt_policy/policy_client.rb +7 -6
- data/lib/2017-06-01-preview/generated/azure_mgmt_policy/policy_client.rb +7 -6
- data/lib/2018-03-01/generated/azure_mgmt_policy.rb +41 -0
- data/lib/2018-03-01/generated/azure_mgmt_policy/models/error_response.rb +69 -0
- data/lib/2018-03-01/generated/azure_mgmt_policy/models/policy_assignment.rb +171 -0
- data/lib/2018-03-01/generated/azure_mgmt_policy/models/policy_assignment_list_result.rb +98 -0
- data/lib/2018-03-01/generated/azure_mgmt_policy/models/policy_definition.rb +153 -0
- data/lib/2018-03-01/generated/azure_mgmt_policy/models/policy_definition_list_result.rb +98 -0
- data/lib/2018-03-01/generated/azure_mgmt_policy/models/policy_definition_reference.rb +58 -0
- data/lib/2018-03-01/generated/azure_mgmt_policy/models/policy_mode.rb +17 -0
- data/lib/2018-03-01/generated/azure_mgmt_policy/models/policy_set_definition.rb +151 -0
- data/lib/2018-03-01/generated/azure_mgmt_policy/models/policy_set_definition_list_result.rb +99 -0
- data/lib/2018-03-01/generated/azure_mgmt_policy/models/policy_sku.rb +59 -0
- data/lib/2018-03-01/generated/azure_mgmt_policy/models/policy_type.rb +17 -0
- data/lib/2018-03-01/generated/azure_mgmt_policy/module_definition.rb +9 -0
- data/lib/2018-03-01/generated/azure_mgmt_policy/policy_assignments.rb +1885 -0
- data/lib/2018-03-01/generated/azure_mgmt_policy/policy_client.rb +139 -0
- data/lib/2018-03-01/generated/azure_mgmt_policy/policy_definitions.rb +1365 -0
- data/lib/2018-03-01/generated/azure_mgmt_policy/policy_set_definitions.rb +1388 -0
- data/lib/azure_mgmt_policy.rb +2 -1
- data/lib/profiles/latest/modules/policy_profile_module.rb +36 -44
- data/lib/version.rb +1 -1
- metadata +22 -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::V2018_03_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 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::V2018_03_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,17 @@
|
|
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::V2018_03_01
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Defines values for PolicyType
|
10
|
+
#
|
11
|
+
module PolicyType
|
12
|
+
NotSpecified = "NotSpecified"
|
13
|
+
BuiltIn = "BuiltIn"
|
14
|
+
Custom = "Custom"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
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::V2018_03_01 end
|
@@ -0,0 +1,1885 @@
|
|
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::V2018_03_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 MsRest::HttpOperationError.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
|
+
# Deserialize Response
|
140
|
+
if status_code == 200
|
141
|
+
begin
|
142
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
143
|
+
result_mapper = Azure::Policy::Mgmt::V2018_03_01::Models::PolicyAssignment.mapper()
|
144
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
145
|
+
rescue Exception => e
|
146
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
result
|
151
|
+
end
|
152
|
+
|
153
|
+
promise.execute
|
154
|
+
end
|
155
|
+
|
156
|
+
#
|
157
|
+
# Creates or updates a policy assignment.
|
158
|
+
#
|
159
|
+
# This operation creates or updates a policy assignment with the given scope
|
160
|
+
# and name. Policy assignments apply to all resources contained within their
|
161
|
+
# scope. For example, when you assign a policy at resource group scope, that
|
162
|
+
# policy applies to all resources in the group.
|
163
|
+
#
|
164
|
+
# @param scope [String] The scope of the policy assignment. Valid scopes are:
|
165
|
+
# management group (format:
|
166
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
167
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
168
|
+
# (format:
|
169
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
170
|
+
# resource (format:
|
171
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
|
172
|
+
# @param policy_assignment_name [String] The name of the policy assignment.
|
173
|
+
# @param parameters [PolicyAssignment] Parameters for the policy assignment.
|
174
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
175
|
+
# will be added to the HTTP request.
|
176
|
+
#
|
177
|
+
# @return [PolicyAssignment] operation results.
|
178
|
+
#
|
179
|
+
def create(scope, policy_assignment_name, parameters, custom_headers:nil)
|
180
|
+
response = create_async(scope, policy_assignment_name, parameters, custom_headers:custom_headers).value!
|
181
|
+
response.body unless response.nil?
|
182
|
+
end
|
183
|
+
|
184
|
+
#
|
185
|
+
# Creates or updates a policy assignment.
|
186
|
+
#
|
187
|
+
# This operation creates or updates a policy assignment with the given scope
|
188
|
+
# and name. Policy assignments apply to all resources contained within their
|
189
|
+
# scope. For example, when you assign a policy at resource group scope, that
|
190
|
+
# policy applies to all resources in the group.
|
191
|
+
#
|
192
|
+
# @param scope [String] The scope of the policy assignment. Valid scopes are:
|
193
|
+
# management group (format:
|
194
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
195
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
196
|
+
# (format:
|
197
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
198
|
+
# resource (format:
|
199
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
|
200
|
+
# @param policy_assignment_name [String] The name of the policy assignment.
|
201
|
+
# @param parameters [PolicyAssignment] Parameters for the policy assignment.
|
202
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
203
|
+
# will be added to the HTTP request.
|
204
|
+
#
|
205
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
206
|
+
#
|
207
|
+
def create_with_http_info(scope, policy_assignment_name, parameters, custom_headers:nil)
|
208
|
+
create_async(scope, policy_assignment_name, parameters, custom_headers:custom_headers).value!
|
209
|
+
end
|
210
|
+
|
211
|
+
#
|
212
|
+
# Creates or updates a policy assignment.
|
213
|
+
#
|
214
|
+
# This operation creates or updates a policy assignment with the given scope
|
215
|
+
# and name. Policy assignments apply to all resources contained within their
|
216
|
+
# scope. For example, when you assign a policy at resource group scope, that
|
217
|
+
# policy applies to all resources in the group.
|
218
|
+
#
|
219
|
+
# @param scope [String] The scope of the policy assignment. Valid scopes are:
|
220
|
+
# management group (format:
|
221
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
222
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
223
|
+
# (format:
|
224
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
225
|
+
# resource (format:
|
226
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
|
227
|
+
# @param policy_assignment_name [String] The name of the policy assignment.
|
228
|
+
# @param parameters [PolicyAssignment] Parameters for the policy assignment.
|
229
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
230
|
+
# to the HTTP request.
|
231
|
+
#
|
232
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
233
|
+
#
|
234
|
+
def create_async(scope, policy_assignment_name, parameters, custom_headers:nil)
|
235
|
+
fail ArgumentError, 'scope is nil' if scope.nil?
|
236
|
+
fail ArgumentError, 'policy_assignment_name is nil' if policy_assignment_name.nil?
|
237
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
238
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
239
|
+
|
240
|
+
|
241
|
+
request_headers = {}
|
242
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
243
|
+
|
244
|
+
# Set Headers
|
245
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
246
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
247
|
+
|
248
|
+
# Serialize Request
|
249
|
+
request_mapper = Azure::Policy::Mgmt::V2018_03_01::Models::PolicyAssignment.mapper()
|
250
|
+
request_content = @client.serialize(request_mapper, parameters)
|
251
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
252
|
+
|
253
|
+
path_template = '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'
|
254
|
+
|
255
|
+
request_url = @base_url || @client.base_url
|
256
|
+
|
257
|
+
options = {
|
258
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
259
|
+
path_params: {'policyAssignmentName' => policy_assignment_name},
|
260
|
+
skip_encoding_path_params: {'scope' => scope},
|
261
|
+
query_params: {'api-version' => @client.api_version},
|
262
|
+
body: request_content,
|
263
|
+
headers: request_headers.merge(custom_headers || {}),
|
264
|
+
base_url: request_url
|
265
|
+
}
|
266
|
+
promise = @client.make_request_async(:put, path_template, options)
|
267
|
+
|
268
|
+
promise = promise.then do |result|
|
269
|
+
http_response = result.response
|
270
|
+
status_code = http_response.status
|
271
|
+
response_content = http_response.body
|
272
|
+
unless status_code == 201
|
273
|
+
error_model = JSON.load(response_content)
|
274
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
275
|
+
end
|
276
|
+
|
277
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
278
|
+
# Deserialize Response
|
279
|
+
if status_code == 201
|
280
|
+
begin
|
281
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
282
|
+
result_mapper = Azure::Policy::Mgmt::V2018_03_01::Models::PolicyAssignment.mapper()
|
283
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
284
|
+
rescue Exception => e
|
285
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
result
|
290
|
+
end
|
291
|
+
|
292
|
+
promise.execute
|
293
|
+
end
|
294
|
+
|
295
|
+
#
|
296
|
+
# Retrieves a policy assignment.
|
297
|
+
#
|
298
|
+
# This operation retrieves a single policy assignment, given its name and the
|
299
|
+
# scope it was created at.
|
300
|
+
#
|
301
|
+
# @param scope [String] The scope of the policy assignment. Valid scopes are:
|
302
|
+
# management group (format:
|
303
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
304
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
305
|
+
# (format:
|
306
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
307
|
+
# resource (format:
|
308
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
|
309
|
+
# @param policy_assignment_name [String] The name of the policy assignment to
|
310
|
+
# get.
|
311
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
312
|
+
# will be added to the HTTP request.
|
313
|
+
#
|
314
|
+
# @return [PolicyAssignment] operation results.
|
315
|
+
#
|
316
|
+
def get(scope, policy_assignment_name, custom_headers:nil)
|
317
|
+
response = get_async(scope, policy_assignment_name, custom_headers:custom_headers).value!
|
318
|
+
response.body unless response.nil?
|
319
|
+
end
|
320
|
+
|
321
|
+
#
|
322
|
+
# Retrieves a policy assignment.
|
323
|
+
#
|
324
|
+
# This operation retrieves a single policy assignment, given its name and the
|
325
|
+
# scope it was created at.
|
326
|
+
#
|
327
|
+
# @param scope [String] The scope of the policy assignment. Valid scopes are:
|
328
|
+
# management group (format:
|
329
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
330
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
331
|
+
# (format:
|
332
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
333
|
+
# resource (format:
|
334
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
|
335
|
+
# @param policy_assignment_name [String] The name of the policy assignment to
|
336
|
+
# get.
|
337
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
338
|
+
# will be added to the HTTP request.
|
339
|
+
#
|
340
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
341
|
+
#
|
342
|
+
def get_with_http_info(scope, policy_assignment_name, custom_headers:nil)
|
343
|
+
get_async(scope, policy_assignment_name, custom_headers:custom_headers).value!
|
344
|
+
end
|
345
|
+
|
346
|
+
#
|
347
|
+
# Retrieves a policy assignment.
|
348
|
+
#
|
349
|
+
# This operation retrieves a single policy assignment, given its name and the
|
350
|
+
# scope it was created at.
|
351
|
+
#
|
352
|
+
# @param scope [String] The scope of the policy assignment. Valid scopes are:
|
353
|
+
# management group (format:
|
354
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
355
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
356
|
+
# (format:
|
357
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
358
|
+
# resource (format:
|
359
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
|
360
|
+
# @param policy_assignment_name [String] The name of the policy assignment to
|
361
|
+
# get.
|
362
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
363
|
+
# to the HTTP request.
|
364
|
+
#
|
365
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
366
|
+
#
|
367
|
+
def get_async(scope, policy_assignment_name, custom_headers:nil)
|
368
|
+
fail ArgumentError, 'scope is nil' if scope.nil?
|
369
|
+
fail ArgumentError, 'policy_assignment_name is nil' if policy_assignment_name.nil?
|
370
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
371
|
+
|
372
|
+
|
373
|
+
request_headers = {}
|
374
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
375
|
+
|
376
|
+
# Set Headers
|
377
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
378
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
379
|
+
path_template = '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'
|
380
|
+
|
381
|
+
request_url = @base_url || @client.base_url
|
382
|
+
|
383
|
+
options = {
|
384
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
385
|
+
path_params: {'policyAssignmentName' => policy_assignment_name},
|
386
|
+
skip_encoding_path_params: {'scope' => scope},
|
387
|
+
query_params: {'api-version' => @client.api_version},
|
388
|
+
headers: request_headers.merge(custom_headers || {}),
|
389
|
+
base_url: request_url
|
390
|
+
}
|
391
|
+
promise = @client.make_request_async(:get, path_template, options)
|
392
|
+
|
393
|
+
promise = promise.then do |result|
|
394
|
+
http_response = result.response
|
395
|
+
status_code = http_response.status
|
396
|
+
response_content = http_response.body
|
397
|
+
unless status_code == 200
|
398
|
+
error_model = JSON.load(response_content)
|
399
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
400
|
+
end
|
401
|
+
|
402
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
403
|
+
# Deserialize Response
|
404
|
+
if status_code == 200
|
405
|
+
begin
|
406
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
407
|
+
result_mapper = Azure::Policy::Mgmt::V2018_03_01::Models::PolicyAssignment.mapper()
|
408
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
409
|
+
rescue Exception => e
|
410
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
411
|
+
end
|
412
|
+
end
|
413
|
+
|
414
|
+
result
|
415
|
+
end
|
416
|
+
|
417
|
+
promise.execute
|
418
|
+
end
|
419
|
+
|
420
|
+
#
|
421
|
+
# Retrieves all policy assignments that apply to a resource group.
|
422
|
+
#
|
423
|
+
# This operation retrieves the list of all policy assignments associated with
|
424
|
+
# the given resource group in the given subscription that match the optional
|
425
|
+
# given $filter. Valid values for $filter are: 'atScope()' or
|
426
|
+
# 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered
|
427
|
+
# list includes all policy assignments associated with the resource group,
|
428
|
+
# including those that apply directly or apply from containing scopes, as well
|
429
|
+
# as any applied to resources contained within the resource group. If
|
430
|
+
# $filter=atScope() is provided, the returned list includes all policy
|
431
|
+
# assignments that apply to the resource group, which is everything in the
|
432
|
+
# unfiltered list except those applied to resources contained within the
|
433
|
+
# resource group. If $filter=policyDefinitionId eq '{value}' is provided, the
|
434
|
+
# returned list includes only policy assignments that apply to the resource
|
435
|
+
# group and assign the policy definition whose id is {value}.
|
436
|
+
#
|
437
|
+
# @param resource_group_name [String] The name of the resource group that
|
438
|
+
# contains policy assignments.
|
439
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
440
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
441
|
+
# not provided, no filtering is performed.
|
442
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
443
|
+
# will be added to the HTTP request.
|
444
|
+
#
|
445
|
+
# @return [Array<PolicyAssignment>] operation results.
|
446
|
+
#
|
447
|
+
def list_for_resource_group(resource_group_name, filter:nil, custom_headers:nil)
|
448
|
+
first_page = list_for_resource_group_as_lazy(resource_group_name, filter:filter, custom_headers:custom_headers)
|
449
|
+
first_page.get_all_items
|
450
|
+
end
|
451
|
+
|
452
|
+
#
|
453
|
+
# Retrieves all policy assignments that apply to a resource group.
|
454
|
+
#
|
455
|
+
# This operation retrieves the list of all policy assignments associated with
|
456
|
+
# the given resource group in the given subscription that match the optional
|
457
|
+
# given $filter. Valid values for $filter are: 'atScope()' or
|
458
|
+
# 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered
|
459
|
+
# list includes all policy assignments associated with the resource group,
|
460
|
+
# including those that apply directly or apply from containing scopes, as well
|
461
|
+
# as any applied to resources contained within the resource group. If
|
462
|
+
# $filter=atScope() is provided, the returned list includes all policy
|
463
|
+
# assignments that apply to the resource group, which is everything in the
|
464
|
+
# unfiltered list except those applied to resources contained within the
|
465
|
+
# resource group. If $filter=policyDefinitionId eq '{value}' is provided, the
|
466
|
+
# returned list includes only policy assignments that apply to the resource
|
467
|
+
# group and assign the policy definition whose id is {value}.
|
468
|
+
#
|
469
|
+
# @param resource_group_name [String] The name of the resource group that
|
470
|
+
# contains policy assignments.
|
471
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
472
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
473
|
+
# not provided, no filtering is performed.
|
474
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
475
|
+
# will be added to the HTTP request.
|
476
|
+
#
|
477
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
478
|
+
#
|
479
|
+
def list_for_resource_group_with_http_info(resource_group_name, filter:nil, custom_headers:nil)
|
480
|
+
list_for_resource_group_async(resource_group_name, filter:filter, custom_headers:custom_headers).value!
|
481
|
+
end
|
482
|
+
|
483
|
+
#
|
484
|
+
# Retrieves all policy assignments that apply to a resource group.
|
485
|
+
#
|
486
|
+
# This operation retrieves the list of all policy assignments associated with
|
487
|
+
# the given resource group in the given subscription that match the optional
|
488
|
+
# given $filter. Valid values for $filter are: 'atScope()' or
|
489
|
+
# 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered
|
490
|
+
# list includes all policy assignments associated with the resource group,
|
491
|
+
# including those that apply directly or apply from containing scopes, as well
|
492
|
+
# as any applied to resources contained within the resource group. If
|
493
|
+
# $filter=atScope() is provided, the returned list includes all policy
|
494
|
+
# assignments that apply to the resource group, which is everything in the
|
495
|
+
# unfiltered list except those applied to resources contained within the
|
496
|
+
# resource group. If $filter=policyDefinitionId eq '{value}' is provided, the
|
497
|
+
# returned list includes only policy assignments that apply to the resource
|
498
|
+
# group and assign the policy definition whose id is {value}.
|
499
|
+
#
|
500
|
+
# @param resource_group_name [String] The name of the resource group that
|
501
|
+
# contains policy assignments.
|
502
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
503
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
504
|
+
# not provided, no filtering is performed.
|
505
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
506
|
+
# to the HTTP request.
|
507
|
+
#
|
508
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
509
|
+
#
|
510
|
+
def list_for_resource_group_async(resource_group_name, filter:nil, custom_headers:nil)
|
511
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
512
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
|
513
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
|
514
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
|
515
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
516
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
517
|
+
|
518
|
+
|
519
|
+
request_headers = {}
|
520
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
521
|
+
|
522
|
+
# Set Headers
|
523
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
524
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
525
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments'
|
526
|
+
|
527
|
+
request_url = @base_url || @client.base_url
|
528
|
+
|
529
|
+
options = {
|
530
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
531
|
+
path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
532
|
+
query_params: {'api-version' => @client.api_version},
|
533
|
+
skip_encoding_query_params: {'$filter' => filter},
|
534
|
+
headers: request_headers.merge(custom_headers || {}),
|
535
|
+
base_url: request_url
|
536
|
+
}
|
537
|
+
promise = @client.make_request_async(:get, path_template, options)
|
538
|
+
|
539
|
+
promise = promise.then do |result|
|
540
|
+
http_response = result.response
|
541
|
+
status_code = http_response.status
|
542
|
+
response_content = http_response.body
|
543
|
+
unless status_code == 200
|
544
|
+
error_model = JSON.load(response_content)
|
545
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
546
|
+
end
|
547
|
+
|
548
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
549
|
+
# Deserialize Response
|
550
|
+
if status_code == 200
|
551
|
+
begin
|
552
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
553
|
+
result_mapper = Azure::Policy::Mgmt::V2018_03_01::Models::PolicyAssignmentListResult.mapper()
|
554
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
555
|
+
rescue Exception => e
|
556
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
557
|
+
end
|
558
|
+
end
|
559
|
+
|
560
|
+
result
|
561
|
+
end
|
562
|
+
|
563
|
+
promise.execute
|
564
|
+
end
|
565
|
+
|
566
|
+
#
|
567
|
+
# Retrieves all policy assignments that apply to a resource.
|
568
|
+
#
|
569
|
+
# This operation retrieves the list of all policy assignments associated with
|
570
|
+
# the specified resource in the given resource group and subscription that
|
571
|
+
# match the optional given $filter. Valid values for $filter are: 'atScope()'
|
572
|
+
# or 'policyDefinitionId eq '{value}''. If $filter is not provided, the
|
573
|
+
# unfiltered list includes all policy assignments associated with the resource,
|
574
|
+
# including those that apply directly or from all containing scopes, as well as
|
575
|
+
# any applied to resources contained within the resource. If $filter=atScope()
|
576
|
+
# is provided, the returned list includes all policy assignments that apply to
|
577
|
+
# the resource, which is everything in the unfiltered list except those applied
|
578
|
+
# to resources contained within the resource. If $filter=policyDefinitionId eq
|
579
|
+
# '{value}' is provided, the returned list includes only policy assignments
|
580
|
+
# that apply to the resource and assign the policy definition whose id is
|
581
|
+
# {value}. Three parameters plus the resource name are used to identify a
|
582
|
+
# specific resource. If the resource is not part of a parent resource (the more
|
583
|
+
# common case), the parent resource path should not be provided (or provided as
|
584
|
+
# ''). For example a web app could be specified as ({resourceProviderNamespace}
|
585
|
+
# == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites',
|
586
|
+
# {resourceName} == 'MyWebApp'). If the resource is part of a parent resource,
|
587
|
+
# then all parameters should be provided. For example a virtual machine DNS
|
588
|
+
# name could be specified as ({resourceProviderNamespace} ==
|
589
|
+
# 'Microsoft.Compute', {parentResourcePath} ==
|
590
|
+
# 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames',
|
591
|
+
# {resourceName} == 'MyComputerName'). A convenient alternative to providing
|
592
|
+
# the namespace and type name separately is to provide both in the
|
593
|
+
# {resourceType} parameter, format: ({resourceProviderNamespace} == '',
|
594
|
+
# {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites',
|
595
|
+
# {resourceName} == 'MyWebApp').
|
596
|
+
#
|
597
|
+
# @param resource_group_name [String] The name of the resource group containing
|
598
|
+
# the resource.
|
599
|
+
# @param resource_provider_namespace [String] The namespace of the resource
|
600
|
+
# provider. For example, the namespace of a virtual machine is
|
601
|
+
# Microsoft.Compute (from Microsoft.Compute/virtualMachines)
|
602
|
+
# @param parent_resource_path [String] The parent resource path. Use empty
|
603
|
+
# string if there is none.
|
604
|
+
# @param resource_type [String] The resource type name. For example the type
|
605
|
+
# name of a web app is 'sites' (from Microsoft.Web/sites).
|
606
|
+
# @param resource_name [String] The name of the resource.
|
607
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
608
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
609
|
+
# not provided, no filtering is performed.
|
610
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
611
|
+
# will be added to the HTTP request.
|
612
|
+
#
|
613
|
+
# @return [Array<PolicyAssignment>] operation results.
|
614
|
+
#
|
615
|
+
def list_for_resource(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:nil, custom_headers:nil)
|
616
|
+
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)
|
617
|
+
first_page.get_all_items
|
618
|
+
end
|
619
|
+
|
620
|
+
#
|
621
|
+
# Retrieves all policy assignments that apply to a resource.
|
622
|
+
#
|
623
|
+
# This operation retrieves the list of all policy assignments associated with
|
624
|
+
# the specified resource in the given resource group and subscription that
|
625
|
+
# match the optional given $filter. Valid values for $filter are: 'atScope()'
|
626
|
+
# or 'policyDefinitionId eq '{value}''. If $filter is not provided, the
|
627
|
+
# unfiltered list includes all policy assignments associated with the resource,
|
628
|
+
# including those that apply directly or from all containing scopes, as well as
|
629
|
+
# any applied to resources contained within the resource. If $filter=atScope()
|
630
|
+
# is provided, the returned list includes all policy assignments that apply to
|
631
|
+
# the resource, which is everything in the unfiltered list except those applied
|
632
|
+
# to resources contained within the resource. If $filter=policyDefinitionId eq
|
633
|
+
# '{value}' is provided, the returned list includes only policy assignments
|
634
|
+
# that apply to the resource and assign the policy definition whose id is
|
635
|
+
# {value}. Three parameters plus the resource name are used to identify a
|
636
|
+
# specific resource. If the resource is not part of a parent resource (the more
|
637
|
+
# common case), the parent resource path should not be provided (or provided as
|
638
|
+
# ''). For example a web app could be specified as ({resourceProviderNamespace}
|
639
|
+
# == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites',
|
640
|
+
# {resourceName} == 'MyWebApp'). If the resource is part of a parent resource,
|
641
|
+
# then all parameters should be provided. For example a virtual machine DNS
|
642
|
+
# name could be specified as ({resourceProviderNamespace} ==
|
643
|
+
# 'Microsoft.Compute', {parentResourcePath} ==
|
644
|
+
# 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames',
|
645
|
+
# {resourceName} == 'MyComputerName'). A convenient alternative to providing
|
646
|
+
# the namespace and type name separately is to provide both in the
|
647
|
+
# {resourceType} parameter, format: ({resourceProviderNamespace} == '',
|
648
|
+
# {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites',
|
649
|
+
# {resourceName} == 'MyWebApp').
|
650
|
+
#
|
651
|
+
# @param resource_group_name [String] The name of the resource group containing
|
652
|
+
# the resource.
|
653
|
+
# @param resource_provider_namespace [String] The namespace of the resource
|
654
|
+
# provider. For example, the namespace of a virtual machine is
|
655
|
+
# Microsoft.Compute (from Microsoft.Compute/virtualMachines)
|
656
|
+
# @param parent_resource_path [String] The parent resource path. Use empty
|
657
|
+
# string if there is none.
|
658
|
+
# @param resource_type [String] The resource type name. For example the type
|
659
|
+
# name of a web app is 'sites' (from Microsoft.Web/sites).
|
660
|
+
# @param resource_name [String] The name of the resource.
|
661
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
662
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
663
|
+
# not provided, no filtering is performed.
|
664
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
665
|
+
# will be added to the HTTP request.
|
666
|
+
#
|
667
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
668
|
+
#
|
669
|
+
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)
|
670
|
+
list_for_resource_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:filter, custom_headers:custom_headers).value!
|
671
|
+
end
|
672
|
+
|
673
|
+
#
|
674
|
+
# Retrieves all policy assignments that apply to a resource.
|
675
|
+
#
|
676
|
+
# This operation retrieves the list of all policy assignments associated with
|
677
|
+
# the specified resource in the given resource group and subscription that
|
678
|
+
# match the optional given $filter. Valid values for $filter are: 'atScope()'
|
679
|
+
# or 'policyDefinitionId eq '{value}''. If $filter is not provided, the
|
680
|
+
# unfiltered list includes all policy assignments associated with the resource,
|
681
|
+
# including those that apply directly or from all containing scopes, as well as
|
682
|
+
# any applied to resources contained within the resource. If $filter=atScope()
|
683
|
+
# is provided, the returned list includes all policy assignments that apply to
|
684
|
+
# the resource, which is everything in the unfiltered list except those applied
|
685
|
+
# to resources contained within the resource. If $filter=policyDefinitionId eq
|
686
|
+
# '{value}' is provided, the returned list includes only policy assignments
|
687
|
+
# that apply to the resource and assign the policy definition whose id is
|
688
|
+
# {value}. Three parameters plus the resource name are used to identify a
|
689
|
+
# specific resource. If the resource is not part of a parent resource (the more
|
690
|
+
# common case), the parent resource path should not be provided (or provided as
|
691
|
+
# ''). For example a web app could be specified as ({resourceProviderNamespace}
|
692
|
+
# == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites',
|
693
|
+
# {resourceName} == 'MyWebApp'). If the resource is part of a parent resource,
|
694
|
+
# then all parameters should be provided. For example a virtual machine DNS
|
695
|
+
# name could be specified as ({resourceProviderNamespace} ==
|
696
|
+
# 'Microsoft.Compute', {parentResourcePath} ==
|
697
|
+
# 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames',
|
698
|
+
# {resourceName} == 'MyComputerName'). A convenient alternative to providing
|
699
|
+
# the namespace and type name separately is to provide both in the
|
700
|
+
# {resourceType} parameter, format: ({resourceProviderNamespace} == '',
|
701
|
+
# {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites',
|
702
|
+
# {resourceName} == 'MyWebApp').
|
703
|
+
#
|
704
|
+
# @param resource_group_name [String] The name of the resource group containing
|
705
|
+
# the resource.
|
706
|
+
# @param resource_provider_namespace [String] The namespace of the resource
|
707
|
+
# provider. For example, the namespace of a virtual machine is
|
708
|
+
# Microsoft.Compute (from Microsoft.Compute/virtualMachines)
|
709
|
+
# @param parent_resource_path [String] The parent resource path. Use empty
|
710
|
+
# string if there is none.
|
711
|
+
# @param resource_type [String] The resource type name. For example the type
|
712
|
+
# name of a web app is 'sites' (from Microsoft.Web/sites).
|
713
|
+
# @param resource_name [String] The name of the resource.
|
714
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
715
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
716
|
+
# not provided, no filtering is performed.
|
717
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
718
|
+
# to the HTTP request.
|
719
|
+
#
|
720
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
721
|
+
#
|
722
|
+
def list_for_resource_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:nil, custom_headers:nil)
|
723
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
724
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
|
725
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
|
726
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
|
727
|
+
fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
|
728
|
+
fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
|
729
|
+
fail ArgumentError, 'resource_type is nil' if resource_type.nil?
|
730
|
+
fail ArgumentError, 'resource_name is nil' if resource_name.nil?
|
731
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
732
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
733
|
+
|
734
|
+
|
735
|
+
request_headers = {}
|
736
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
737
|
+
|
738
|
+
# Set Headers
|
739
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
740
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
741
|
+
path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments'
|
742
|
+
|
743
|
+
request_url = @base_url || @client.base_url
|
744
|
+
|
745
|
+
options = {
|
746
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
747
|
+
path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
|
748
|
+
skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
|
749
|
+
query_params: {'$filter' => filter,'api-version' => @client.api_version},
|
750
|
+
headers: request_headers.merge(custom_headers || {}),
|
751
|
+
base_url: request_url
|
752
|
+
}
|
753
|
+
promise = @client.make_request_async(:get, path_template, options)
|
754
|
+
|
755
|
+
promise = promise.then do |result|
|
756
|
+
http_response = result.response
|
757
|
+
status_code = http_response.status
|
758
|
+
response_content = http_response.body
|
759
|
+
unless status_code == 200
|
760
|
+
error_model = JSON.load(response_content)
|
761
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
762
|
+
end
|
763
|
+
|
764
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
765
|
+
# Deserialize Response
|
766
|
+
if status_code == 200
|
767
|
+
begin
|
768
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
769
|
+
result_mapper = Azure::Policy::Mgmt::V2018_03_01::Models::PolicyAssignmentListResult.mapper()
|
770
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
771
|
+
rescue Exception => e
|
772
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
773
|
+
end
|
774
|
+
end
|
775
|
+
|
776
|
+
result
|
777
|
+
end
|
778
|
+
|
779
|
+
promise.execute
|
780
|
+
end
|
781
|
+
|
782
|
+
#
|
783
|
+
# Retrieves all policy assignments that apply to a subscription.
|
784
|
+
#
|
785
|
+
# This operation retrieves the list of all policy assignments associated with
|
786
|
+
# the given subscription that match the optional given $filter. Valid values
|
787
|
+
# for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter
|
788
|
+
# is not provided, the unfiltered list includes all policy assignments
|
789
|
+
# associated with the subscription, including those that apply directly or from
|
790
|
+
# management groups that contain the given subscription, as well as any applied
|
791
|
+
# to objects contained within the subscription. If $filter=atScope() is
|
792
|
+
# provided, the returned list includes all policy assignments that apply to the
|
793
|
+
# subscription, which is everything in the unfiltered list except those applied
|
794
|
+
# to objects contained within the subscription. If $filter=policyDefinitionId
|
795
|
+
# eq '{value}' is provided, the returned list includes only policy assignments
|
796
|
+
# that apply to the subscription and assign the policy definition whose id is
|
797
|
+
# {value}.
|
798
|
+
#
|
799
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
800
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
801
|
+
# not provided, no filtering is performed.
|
802
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
803
|
+
# will be added to the HTTP request.
|
804
|
+
#
|
805
|
+
# @return [Array<PolicyAssignment>] operation results.
|
806
|
+
#
|
807
|
+
def list(filter:nil, custom_headers:nil)
|
808
|
+
first_page = list_as_lazy(filter:filter, custom_headers:custom_headers)
|
809
|
+
first_page.get_all_items
|
810
|
+
end
|
811
|
+
|
812
|
+
#
|
813
|
+
# Retrieves all policy assignments that apply to a subscription.
|
814
|
+
#
|
815
|
+
# This operation retrieves the list of all policy assignments associated with
|
816
|
+
# the given subscription that match the optional given $filter. Valid values
|
817
|
+
# for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter
|
818
|
+
# is not provided, the unfiltered list includes all policy assignments
|
819
|
+
# associated with the subscription, including those that apply directly or from
|
820
|
+
# management groups that contain the given subscription, as well as any applied
|
821
|
+
# to objects contained within the subscription. If $filter=atScope() is
|
822
|
+
# provided, the returned list includes all policy assignments that apply to the
|
823
|
+
# subscription, which is everything in the unfiltered list except those applied
|
824
|
+
# to objects contained within the subscription. If $filter=policyDefinitionId
|
825
|
+
# eq '{value}' is provided, the returned list includes only policy assignments
|
826
|
+
# that apply to the subscription and assign the policy definition whose id is
|
827
|
+
# {value}.
|
828
|
+
#
|
829
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
830
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
831
|
+
# not provided, no filtering is performed.
|
832
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
833
|
+
# will be added to the HTTP request.
|
834
|
+
#
|
835
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
836
|
+
#
|
837
|
+
def list_with_http_info(filter:nil, custom_headers:nil)
|
838
|
+
list_async(filter:filter, custom_headers:custom_headers).value!
|
839
|
+
end
|
840
|
+
|
841
|
+
#
|
842
|
+
# Retrieves all policy assignments that apply to a subscription.
|
843
|
+
#
|
844
|
+
# This operation retrieves the list of all policy assignments associated with
|
845
|
+
# the given subscription that match the optional given $filter. Valid values
|
846
|
+
# for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter
|
847
|
+
# is not provided, the unfiltered list includes all policy assignments
|
848
|
+
# associated with the subscription, including those that apply directly or from
|
849
|
+
# management groups that contain the given subscription, as well as any applied
|
850
|
+
# to objects contained within the subscription. If $filter=atScope() is
|
851
|
+
# provided, the returned list includes all policy assignments that apply to the
|
852
|
+
# subscription, which is everything in the unfiltered list except those applied
|
853
|
+
# to objects contained within the subscription. If $filter=policyDefinitionId
|
854
|
+
# eq '{value}' is provided, the returned list includes only policy assignments
|
855
|
+
# that apply to the subscription and assign the policy definition whose id is
|
856
|
+
# {value}.
|
857
|
+
#
|
858
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
859
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
860
|
+
# not provided, no filtering is performed.
|
861
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
862
|
+
# to the HTTP request.
|
863
|
+
#
|
864
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
865
|
+
#
|
866
|
+
def list_async(filter:nil, custom_headers:nil)
|
867
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
868
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
869
|
+
|
870
|
+
|
871
|
+
request_headers = {}
|
872
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
873
|
+
|
874
|
+
# Set Headers
|
875
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
876
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
877
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments'
|
878
|
+
|
879
|
+
request_url = @base_url || @client.base_url
|
880
|
+
|
881
|
+
options = {
|
882
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
883
|
+
path_params: {'subscriptionId' => @client.subscription_id},
|
884
|
+
query_params: {'$filter' => filter,'api-version' => @client.api_version},
|
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 MsRest::HttpOperationError.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
|
+
# Deserialize Response
|
901
|
+
if status_code == 200
|
902
|
+
begin
|
903
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
904
|
+
result_mapper = Azure::Policy::Mgmt::V2018_03_01::Models::PolicyAssignmentListResult.mapper()
|
905
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
906
|
+
rescue Exception => e
|
907
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
908
|
+
end
|
909
|
+
end
|
910
|
+
|
911
|
+
result
|
912
|
+
end
|
913
|
+
|
914
|
+
promise.execute
|
915
|
+
end
|
916
|
+
|
917
|
+
#
|
918
|
+
# Deletes a policy assignment.
|
919
|
+
#
|
920
|
+
# This operation deletes the policy with the given ID. Policy assignment IDs
|
921
|
+
# have this format:
|
922
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
923
|
+
# Valid formats for {scope} are:
|
924
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'
|
925
|
+
# (management group), '/subscriptions/{subscriptionId}' (subscription),
|
926
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'
|
927
|
+
# (resource group), or
|
928
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
|
929
|
+
# (resource).
|
930
|
+
#
|
931
|
+
# @param policy_assignment_id [String] The ID of the policy assignment to
|
932
|
+
# delete. Use the format
|
933
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
934
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
935
|
+
# will be added to the HTTP request.
|
936
|
+
#
|
937
|
+
# @return [PolicyAssignment] operation results.
|
938
|
+
#
|
939
|
+
def delete_by_id(policy_assignment_id, custom_headers:nil)
|
940
|
+
response = delete_by_id_async(policy_assignment_id, custom_headers:custom_headers).value!
|
941
|
+
response.body unless response.nil?
|
942
|
+
end
|
943
|
+
|
944
|
+
#
|
945
|
+
# Deletes a policy assignment.
|
946
|
+
#
|
947
|
+
# This operation deletes the policy with the given ID. Policy assignment IDs
|
948
|
+
# have this format:
|
949
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
950
|
+
# Valid formats for {scope} are:
|
951
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'
|
952
|
+
# (management group), '/subscriptions/{subscriptionId}' (subscription),
|
953
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'
|
954
|
+
# (resource group), or
|
955
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
|
956
|
+
# (resource).
|
957
|
+
#
|
958
|
+
# @param policy_assignment_id [String] The ID of the policy assignment to
|
959
|
+
# delete. Use the format
|
960
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
961
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
962
|
+
# will be added to the HTTP request.
|
963
|
+
#
|
964
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
965
|
+
#
|
966
|
+
def delete_by_id_with_http_info(policy_assignment_id, custom_headers:nil)
|
967
|
+
delete_by_id_async(policy_assignment_id, custom_headers:custom_headers).value!
|
968
|
+
end
|
969
|
+
|
970
|
+
#
|
971
|
+
# Deletes a policy assignment.
|
972
|
+
#
|
973
|
+
# This operation deletes the policy with the given ID. Policy assignment IDs
|
974
|
+
# have this format:
|
975
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
976
|
+
# Valid formats for {scope} are:
|
977
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'
|
978
|
+
# (management group), '/subscriptions/{subscriptionId}' (subscription),
|
979
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'
|
980
|
+
# (resource group), or
|
981
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'
|
982
|
+
# (resource).
|
983
|
+
#
|
984
|
+
# @param policy_assignment_id [String] The ID of the policy assignment to
|
985
|
+
# delete. Use the format
|
986
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
987
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
988
|
+
# to the HTTP request.
|
989
|
+
#
|
990
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
991
|
+
#
|
992
|
+
def delete_by_id_async(policy_assignment_id, custom_headers:nil)
|
993
|
+
fail ArgumentError, 'policy_assignment_id is nil' if policy_assignment_id.nil?
|
994
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
995
|
+
|
996
|
+
|
997
|
+
request_headers = {}
|
998
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
999
|
+
|
1000
|
+
# Set Headers
|
1001
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1002
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1003
|
+
path_template = '{policyAssignmentId}'
|
1004
|
+
|
1005
|
+
request_url = @base_url || @client.base_url
|
1006
|
+
|
1007
|
+
options = {
|
1008
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1009
|
+
skip_encoding_path_params: {'policyAssignmentId' => policy_assignment_id},
|
1010
|
+
query_params: {'api-version' => @client.api_version},
|
1011
|
+
headers: request_headers.merge(custom_headers || {}),
|
1012
|
+
base_url: request_url
|
1013
|
+
}
|
1014
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
1015
|
+
|
1016
|
+
promise = promise.then do |result|
|
1017
|
+
http_response = result.response
|
1018
|
+
status_code = http_response.status
|
1019
|
+
response_content = http_response.body
|
1020
|
+
unless status_code == 200 || status_code == 204
|
1021
|
+
error_model = JSON.load(response_content)
|
1022
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
1023
|
+
end
|
1024
|
+
|
1025
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1026
|
+
# Deserialize Response
|
1027
|
+
if status_code == 200
|
1028
|
+
begin
|
1029
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1030
|
+
result_mapper = Azure::Policy::Mgmt::V2018_03_01::Models::PolicyAssignment.mapper()
|
1031
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1032
|
+
rescue Exception => e
|
1033
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1034
|
+
end
|
1035
|
+
end
|
1036
|
+
|
1037
|
+
result
|
1038
|
+
end
|
1039
|
+
|
1040
|
+
promise.execute
|
1041
|
+
end
|
1042
|
+
|
1043
|
+
#
|
1044
|
+
# Creates or updates a policy assignment.
|
1045
|
+
#
|
1046
|
+
# This operation creates or updates the policy assignment with the given ID.
|
1047
|
+
# Policy assignments made on a scope apply to all resources contained in that
|
1048
|
+
# scope. For example, when you assign a policy to a resource group that policy
|
1049
|
+
# applies to all resources in the group. Policy assignment IDs have this
|
1050
|
+
# format:
|
1051
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1052
|
+
# Valid scopes are: management group (format:
|
1053
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
1054
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
1055
|
+
# (format:
|
1056
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
1057
|
+
# resource (format:
|
1058
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
|
1059
|
+
#
|
1060
|
+
# @param policy_assignment_id [String] The ID of the policy assignment to
|
1061
|
+
# create. Use the format
|
1062
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1063
|
+
# @param parameters [PolicyAssignment] Parameters for policy assignment.
|
1064
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1065
|
+
# will be added to the HTTP request.
|
1066
|
+
#
|
1067
|
+
# @return [PolicyAssignment] operation results.
|
1068
|
+
#
|
1069
|
+
def create_by_id(policy_assignment_id, parameters, custom_headers:nil)
|
1070
|
+
response = create_by_id_async(policy_assignment_id, parameters, custom_headers:custom_headers).value!
|
1071
|
+
response.body unless response.nil?
|
1072
|
+
end
|
1073
|
+
|
1074
|
+
#
|
1075
|
+
# Creates or updates a policy assignment.
|
1076
|
+
#
|
1077
|
+
# This operation creates or updates the policy assignment with the given ID.
|
1078
|
+
# Policy assignments made on a scope apply to all resources contained in that
|
1079
|
+
# scope. For example, when you assign a policy to a resource group that policy
|
1080
|
+
# applies to all resources in the group. Policy assignment IDs have this
|
1081
|
+
# format:
|
1082
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1083
|
+
# Valid scopes are: management group (format:
|
1084
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
1085
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
1086
|
+
# (format:
|
1087
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
1088
|
+
# resource (format:
|
1089
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
|
1090
|
+
#
|
1091
|
+
# @param policy_assignment_id [String] The ID of the policy assignment to
|
1092
|
+
# create. Use the format
|
1093
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1094
|
+
# @param parameters [PolicyAssignment] Parameters for policy assignment.
|
1095
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1096
|
+
# will be added to the HTTP request.
|
1097
|
+
#
|
1098
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
1099
|
+
#
|
1100
|
+
def create_by_id_with_http_info(policy_assignment_id, parameters, custom_headers:nil)
|
1101
|
+
create_by_id_async(policy_assignment_id, parameters, custom_headers:custom_headers).value!
|
1102
|
+
end
|
1103
|
+
|
1104
|
+
#
|
1105
|
+
# Creates or updates a policy assignment.
|
1106
|
+
#
|
1107
|
+
# This operation creates or updates the policy assignment with the given ID.
|
1108
|
+
# Policy assignments made on a scope apply to all resources contained in that
|
1109
|
+
# scope. For example, when you assign a policy to a resource group that policy
|
1110
|
+
# applies to all resources in the group. Policy assignment IDs have this
|
1111
|
+
# format:
|
1112
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1113
|
+
# Valid scopes are: management group (format:
|
1114
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
1115
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
1116
|
+
# (format:
|
1117
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
1118
|
+
# resource (format:
|
1119
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
|
1120
|
+
#
|
1121
|
+
# @param policy_assignment_id [String] The ID of the policy assignment to
|
1122
|
+
# create. Use the format
|
1123
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1124
|
+
# @param parameters [PolicyAssignment] Parameters for policy assignment.
|
1125
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
1126
|
+
# to the HTTP request.
|
1127
|
+
#
|
1128
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
1129
|
+
#
|
1130
|
+
def create_by_id_async(policy_assignment_id, parameters, custom_headers:nil)
|
1131
|
+
fail ArgumentError, 'policy_assignment_id is nil' if policy_assignment_id.nil?
|
1132
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
1133
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
1134
|
+
|
1135
|
+
|
1136
|
+
request_headers = {}
|
1137
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
1138
|
+
|
1139
|
+
# Set Headers
|
1140
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1141
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1142
|
+
|
1143
|
+
# Serialize Request
|
1144
|
+
request_mapper = Azure::Policy::Mgmt::V2018_03_01::Models::PolicyAssignment.mapper()
|
1145
|
+
request_content = @client.serialize(request_mapper, parameters)
|
1146
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
1147
|
+
|
1148
|
+
path_template = '{policyAssignmentId}'
|
1149
|
+
|
1150
|
+
request_url = @base_url || @client.base_url
|
1151
|
+
|
1152
|
+
options = {
|
1153
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1154
|
+
skip_encoding_path_params: {'policyAssignmentId' => policy_assignment_id},
|
1155
|
+
query_params: {'api-version' => @client.api_version},
|
1156
|
+
body: request_content,
|
1157
|
+
headers: request_headers.merge(custom_headers || {}),
|
1158
|
+
base_url: request_url
|
1159
|
+
}
|
1160
|
+
promise = @client.make_request_async(:put, path_template, options)
|
1161
|
+
|
1162
|
+
promise = promise.then do |result|
|
1163
|
+
http_response = result.response
|
1164
|
+
status_code = http_response.status
|
1165
|
+
response_content = http_response.body
|
1166
|
+
unless status_code == 201
|
1167
|
+
error_model = JSON.load(response_content)
|
1168
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
1169
|
+
end
|
1170
|
+
|
1171
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1172
|
+
# Deserialize Response
|
1173
|
+
if status_code == 201
|
1174
|
+
begin
|
1175
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1176
|
+
result_mapper = Azure::Policy::Mgmt::V2018_03_01::Models::PolicyAssignment.mapper()
|
1177
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1178
|
+
rescue Exception => e
|
1179
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1180
|
+
end
|
1181
|
+
end
|
1182
|
+
|
1183
|
+
result
|
1184
|
+
end
|
1185
|
+
|
1186
|
+
promise.execute
|
1187
|
+
end
|
1188
|
+
|
1189
|
+
#
|
1190
|
+
# Retrieves the policy assignment with the given ID.
|
1191
|
+
#
|
1192
|
+
# The operation retrieves the policy assignment with the given ID. Policy
|
1193
|
+
# assignment IDs have this format:
|
1194
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1195
|
+
# Valid scopes are: management group (format:
|
1196
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
1197
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
1198
|
+
# (format:
|
1199
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
1200
|
+
# resource (format:
|
1201
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
|
1202
|
+
#
|
1203
|
+
# @param policy_assignment_id [String] The ID of the policy assignment to get.
|
1204
|
+
# Use the format
|
1205
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1206
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1207
|
+
# will be added to the HTTP request.
|
1208
|
+
#
|
1209
|
+
# @return [PolicyAssignment] operation results.
|
1210
|
+
#
|
1211
|
+
def get_by_id(policy_assignment_id, custom_headers:nil)
|
1212
|
+
response = get_by_id_async(policy_assignment_id, custom_headers:custom_headers).value!
|
1213
|
+
response.body unless response.nil?
|
1214
|
+
end
|
1215
|
+
|
1216
|
+
#
|
1217
|
+
# Retrieves the policy assignment with the given ID.
|
1218
|
+
#
|
1219
|
+
# The operation retrieves the policy assignment with the given ID. Policy
|
1220
|
+
# assignment IDs have this format:
|
1221
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1222
|
+
# Valid scopes are: management group (format:
|
1223
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
1224
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
1225
|
+
# (format:
|
1226
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
1227
|
+
# resource (format:
|
1228
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
|
1229
|
+
#
|
1230
|
+
# @param policy_assignment_id [String] The ID of the policy assignment to get.
|
1231
|
+
# Use the format
|
1232
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
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 get_by_id_with_http_info(policy_assignment_id, custom_headers:nil)
|
1239
|
+
get_by_id_async(policy_assignment_id, custom_headers:custom_headers).value!
|
1240
|
+
end
|
1241
|
+
|
1242
|
+
#
|
1243
|
+
# Retrieves the policy assignment with the given ID.
|
1244
|
+
#
|
1245
|
+
# The operation retrieves the policy assignment with the given ID. Policy
|
1246
|
+
# assignment IDs have this format:
|
1247
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1248
|
+
# Valid scopes are: management group (format:
|
1249
|
+
# '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
|
1250
|
+
# subscription (format: '/subscriptions/{subscriptionId}'), resource group
|
1251
|
+
# (format:
|
1252
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or
|
1253
|
+
# resource (format:
|
1254
|
+
# '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.
|
1255
|
+
#
|
1256
|
+
# @param policy_assignment_id [String] The ID of the policy assignment to get.
|
1257
|
+
# Use the format
|
1258
|
+
# '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.
|
1259
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
1260
|
+
# to the HTTP request.
|
1261
|
+
#
|
1262
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
1263
|
+
#
|
1264
|
+
def get_by_id_async(policy_assignment_id, custom_headers:nil)
|
1265
|
+
fail ArgumentError, 'policy_assignment_id is nil' if policy_assignment_id.nil?
|
1266
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
1267
|
+
|
1268
|
+
|
1269
|
+
request_headers = {}
|
1270
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
1271
|
+
|
1272
|
+
# Set Headers
|
1273
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1274
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1275
|
+
path_template = '{policyAssignmentId}'
|
1276
|
+
|
1277
|
+
request_url = @base_url || @client.base_url
|
1278
|
+
|
1279
|
+
options = {
|
1280
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1281
|
+
skip_encoding_path_params: {'policyAssignmentId' => policy_assignment_id},
|
1282
|
+
query_params: {'api-version' => @client.api_version},
|
1283
|
+
headers: request_headers.merge(custom_headers || {}),
|
1284
|
+
base_url: request_url
|
1285
|
+
}
|
1286
|
+
promise = @client.make_request_async(:get, path_template, options)
|
1287
|
+
|
1288
|
+
promise = promise.then do |result|
|
1289
|
+
http_response = result.response
|
1290
|
+
status_code = http_response.status
|
1291
|
+
response_content = http_response.body
|
1292
|
+
unless status_code == 200
|
1293
|
+
error_model = JSON.load(response_content)
|
1294
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
1295
|
+
end
|
1296
|
+
|
1297
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1298
|
+
# Deserialize Response
|
1299
|
+
if status_code == 200
|
1300
|
+
begin
|
1301
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1302
|
+
result_mapper = Azure::Policy::Mgmt::V2018_03_01::Models::PolicyAssignment.mapper()
|
1303
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1304
|
+
rescue Exception => e
|
1305
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1306
|
+
end
|
1307
|
+
end
|
1308
|
+
|
1309
|
+
result
|
1310
|
+
end
|
1311
|
+
|
1312
|
+
promise.execute
|
1313
|
+
end
|
1314
|
+
|
1315
|
+
#
|
1316
|
+
# Retrieves all policy assignments that apply to a resource group.
|
1317
|
+
#
|
1318
|
+
# This operation retrieves the list of all policy assignments associated with
|
1319
|
+
# the given resource group in the given subscription that match the optional
|
1320
|
+
# given $filter. Valid values for $filter are: 'atScope()' or
|
1321
|
+
# 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered
|
1322
|
+
# list includes all policy assignments associated with the resource group,
|
1323
|
+
# including those that apply directly or apply from containing scopes, as well
|
1324
|
+
# as any applied to resources contained within the resource group. If
|
1325
|
+
# $filter=atScope() is provided, the returned list includes all policy
|
1326
|
+
# assignments that apply to the resource group, which is everything in the
|
1327
|
+
# unfiltered list except those applied to resources contained within the
|
1328
|
+
# resource group. If $filter=policyDefinitionId eq '{value}' is provided, the
|
1329
|
+
# returned list includes only policy assignments that apply to the resource
|
1330
|
+
# group and assign the policy definition whose id is {value}.
|
1331
|
+
#
|
1332
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1333
|
+
# to List operation.
|
1334
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1335
|
+
# will be added to the HTTP request.
|
1336
|
+
#
|
1337
|
+
# @return [PolicyAssignmentListResult] operation results.
|
1338
|
+
#
|
1339
|
+
def list_for_resource_group_next(next_page_link, custom_headers:nil)
|
1340
|
+
response = list_for_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
|
1341
|
+
response.body unless response.nil?
|
1342
|
+
end
|
1343
|
+
|
1344
|
+
#
|
1345
|
+
# Retrieves all policy assignments that apply to a resource group.
|
1346
|
+
#
|
1347
|
+
# This operation retrieves the list of all policy assignments associated with
|
1348
|
+
# the given resource group in the given subscription that match the optional
|
1349
|
+
# given $filter. Valid values for $filter are: 'atScope()' or
|
1350
|
+
# 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered
|
1351
|
+
# list includes all policy assignments associated with the resource group,
|
1352
|
+
# including those that apply directly or apply from containing scopes, as well
|
1353
|
+
# as any applied to resources contained within the resource group. If
|
1354
|
+
# $filter=atScope() is provided, the returned list includes all policy
|
1355
|
+
# assignments that apply to the resource group, which is everything in the
|
1356
|
+
# unfiltered list except those applied to resources contained within the
|
1357
|
+
# resource group. If $filter=policyDefinitionId eq '{value}' is provided, the
|
1358
|
+
# returned list includes only policy assignments that apply to the resource
|
1359
|
+
# group and assign the policy definition whose id is {value}.
|
1360
|
+
#
|
1361
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1362
|
+
# to List operation.
|
1363
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1364
|
+
# will be added to the HTTP request.
|
1365
|
+
#
|
1366
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
1367
|
+
#
|
1368
|
+
def list_for_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
|
1369
|
+
list_for_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
|
1370
|
+
end
|
1371
|
+
|
1372
|
+
#
|
1373
|
+
# Retrieves all policy assignments that apply to a resource group.
|
1374
|
+
#
|
1375
|
+
# This operation retrieves the list of all policy assignments associated with
|
1376
|
+
# the given resource group in the given subscription that match the optional
|
1377
|
+
# given $filter. Valid values for $filter are: 'atScope()' or
|
1378
|
+
# 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered
|
1379
|
+
# list includes all policy assignments associated with the resource group,
|
1380
|
+
# including those that apply directly or apply from containing scopes, as well
|
1381
|
+
# as any applied to resources contained within the resource group. If
|
1382
|
+
# $filter=atScope() is provided, the returned list includes all policy
|
1383
|
+
# assignments that apply to the resource group, which is everything in the
|
1384
|
+
# unfiltered list except those applied to resources contained within the
|
1385
|
+
# resource group. If $filter=policyDefinitionId eq '{value}' is provided, the
|
1386
|
+
# returned list includes only policy assignments that apply to the resource
|
1387
|
+
# group and assign the policy definition whose id is {value}.
|
1388
|
+
#
|
1389
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1390
|
+
# to List operation.
|
1391
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
1392
|
+
# to the HTTP request.
|
1393
|
+
#
|
1394
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
1395
|
+
#
|
1396
|
+
def list_for_resource_group_next_async(next_page_link, custom_headers:nil)
|
1397
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
1398
|
+
|
1399
|
+
|
1400
|
+
request_headers = {}
|
1401
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
1402
|
+
|
1403
|
+
# Set Headers
|
1404
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1405
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1406
|
+
path_template = '{nextLink}'
|
1407
|
+
|
1408
|
+
request_url = @base_url || @client.base_url
|
1409
|
+
|
1410
|
+
options = {
|
1411
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1412
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
1413
|
+
headers: request_headers.merge(custom_headers || {}),
|
1414
|
+
base_url: request_url
|
1415
|
+
}
|
1416
|
+
promise = @client.make_request_async(:get, path_template, options)
|
1417
|
+
|
1418
|
+
promise = promise.then do |result|
|
1419
|
+
http_response = result.response
|
1420
|
+
status_code = http_response.status
|
1421
|
+
response_content = http_response.body
|
1422
|
+
unless status_code == 200
|
1423
|
+
error_model = JSON.load(response_content)
|
1424
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
1425
|
+
end
|
1426
|
+
|
1427
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1428
|
+
# Deserialize Response
|
1429
|
+
if status_code == 200
|
1430
|
+
begin
|
1431
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1432
|
+
result_mapper = Azure::Policy::Mgmt::V2018_03_01::Models::PolicyAssignmentListResult.mapper()
|
1433
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1434
|
+
rescue Exception => e
|
1435
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1436
|
+
end
|
1437
|
+
end
|
1438
|
+
|
1439
|
+
result
|
1440
|
+
end
|
1441
|
+
|
1442
|
+
promise.execute
|
1443
|
+
end
|
1444
|
+
|
1445
|
+
#
|
1446
|
+
# Retrieves all policy assignments that apply to a resource.
|
1447
|
+
#
|
1448
|
+
# This operation retrieves the list of all policy assignments associated with
|
1449
|
+
# the specified resource in the given resource group and subscription that
|
1450
|
+
# match the optional given $filter. Valid values for $filter are: 'atScope()'
|
1451
|
+
# or 'policyDefinitionId eq '{value}''. If $filter is not provided, the
|
1452
|
+
# unfiltered list includes all policy assignments associated with the resource,
|
1453
|
+
# including those that apply directly or from all containing scopes, as well as
|
1454
|
+
# any applied to resources contained within the resource. If $filter=atScope()
|
1455
|
+
# is provided, the returned list includes all policy assignments that apply to
|
1456
|
+
# the resource, which is everything in the unfiltered list except those applied
|
1457
|
+
# to resources contained within the resource. If $filter=policyDefinitionId eq
|
1458
|
+
# '{value}' is provided, the returned list includes only policy assignments
|
1459
|
+
# that apply to the resource and assign the policy definition whose id is
|
1460
|
+
# {value}. Three parameters plus the resource name are used to identify a
|
1461
|
+
# specific resource. If the resource is not part of a parent resource (the more
|
1462
|
+
# common case), the parent resource path should not be provided (or provided as
|
1463
|
+
# ''). For example a web app could be specified as ({resourceProviderNamespace}
|
1464
|
+
# == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites',
|
1465
|
+
# {resourceName} == 'MyWebApp'). If the resource is part of a parent resource,
|
1466
|
+
# then all parameters should be provided. For example a virtual machine DNS
|
1467
|
+
# name could be specified as ({resourceProviderNamespace} ==
|
1468
|
+
# 'Microsoft.Compute', {parentResourcePath} ==
|
1469
|
+
# 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames',
|
1470
|
+
# {resourceName} == 'MyComputerName'). A convenient alternative to providing
|
1471
|
+
# the namespace and type name separately is to provide both in the
|
1472
|
+
# {resourceType} parameter, format: ({resourceProviderNamespace} == '',
|
1473
|
+
# {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites',
|
1474
|
+
# {resourceName} == 'MyWebApp').
|
1475
|
+
#
|
1476
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1477
|
+
# to List operation.
|
1478
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1479
|
+
# will be added to the HTTP request.
|
1480
|
+
#
|
1481
|
+
# @return [PolicyAssignmentListResult] operation results.
|
1482
|
+
#
|
1483
|
+
def list_for_resource_next(next_page_link, custom_headers:nil)
|
1484
|
+
response = list_for_resource_next_async(next_page_link, custom_headers:custom_headers).value!
|
1485
|
+
response.body unless response.nil?
|
1486
|
+
end
|
1487
|
+
|
1488
|
+
#
|
1489
|
+
# Retrieves all policy assignments that apply to a resource.
|
1490
|
+
#
|
1491
|
+
# This operation retrieves the list of all policy assignments associated with
|
1492
|
+
# the specified resource in the given resource group and subscription that
|
1493
|
+
# match the optional given $filter. Valid values for $filter are: 'atScope()'
|
1494
|
+
# or 'policyDefinitionId eq '{value}''. If $filter is not provided, the
|
1495
|
+
# unfiltered list includes all policy assignments associated with the resource,
|
1496
|
+
# including those that apply directly or from all containing scopes, as well as
|
1497
|
+
# any applied to resources contained within the resource. If $filter=atScope()
|
1498
|
+
# is provided, the returned list includes all policy assignments that apply to
|
1499
|
+
# the resource, which is everything in the unfiltered list except those applied
|
1500
|
+
# to resources contained within the resource. If $filter=policyDefinitionId eq
|
1501
|
+
# '{value}' is provided, the returned list includes only policy assignments
|
1502
|
+
# that apply to the resource and assign the policy definition whose id is
|
1503
|
+
# {value}. Three parameters plus the resource name are used to identify a
|
1504
|
+
# specific resource. If the resource is not part of a parent resource (the more
|
1505
|
+
# common case), the parent resource path should not be provided (or provided as
|
1506
|
+
# ''). For example a web app could be specified as ({resourceProviderNamespace}
|
1507
|
+
# == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites',
|
1508
|
+
# {resourceName} == 'MyWebApp'). If the resource is part of a parent resource,
|
1509
|
+
# then all parameters should be provided. For example a virtual machine DNS
|
1510
|
+
# name could be specified as ({resourceProviderNamespace} ==
|
1511
|
+
# 'Microsoft.Compute', {parentResourcePath} ==
|
1512
|
+
# 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames',
|
1513
|
+
# {resourceName} == 'MyComputerName'). A convenient alternative to providing
|
1514
|
+
# the namespace and type name separately is to provide both in the
|
1515
|
+
# {resourceType} parameter, format: ({resourceProviderNamespace} == '',
|
1516
|
+
# {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites',
|
1517
|
+
# {resourceName} == 'MyWebApp').
|
1518
|
+
#
|
1519
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1520
|
+
# to List operation.
|
1521
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1522
|
+
# will be added to the HTTP request.
|
1523
|
+
#
|
1524
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
1525
|
+
#
|
1526
|
+
def list_for_resource_next_with_http_info(next_page_link, custom_headers:nil)
|
1527
|
+
list_for_resource_next_async(next_page_link, custom_headers:custom_headers).value!
|
1528
|
+
end
|
1529
|
+
|
1530
|
+
#
|
1531
|
+
# Retrieves all policy assignments that apply to a resource.
|
1532
|
+
#
|
1533
|
+
# This operation retrieves the list of all policy assignments associated with
|
1534
|
+
# the specified resource in the given resource group and subscription that
|
1535
|
+
# match the optional given $filter. Valid values for $filter are: 'atScope()'
|
1536
|
+
# or 'policyDefinitionId eq '{value}''. If $filter is not provided, the
|
1537
|
+
# unfiltered list includes all policy assignments associated with the resource,
|
1538
|
+
# including those that apply directly or from all containing scopes, as well as
|
1539
|
+
# any applied to resources contained within the resource. If $filter=atScope()
|
1540
|
+
# is provided, the returned list includes all policy assignments that apply to
|
1541
|
+
# the resource, which is everything in the unfiltered list except those applied
|
1542
|
+
# to resources contained within the resource. If $filter=policyDefinitionId eq
|
1543
|
+
# '{value}' is provided, the returned list includes only policy assignments
|
1544
|
+
# that apply to the resource and assign the policy definition whose id is
|
1545
|
+
# {value}. Three parameters plus the resource name are used to identify a
|
1546
|
+
# specific resource. If the resource is not part of a parent resource (the more
|
1547
|
+
# common case), the parent resource path should not be provided (or provided as
|
1548
|
+
# ''). For example a web app could be specified as ({resourceProviderNamespace}
|
1549
|
+
# == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites',
|
1550
|
+
# {resourceName} == 'MyWebApp'). If the resource is part of a parent resource,
|
1551
|
+
# then all parameters should be provided. For example a virtual machine DNS
|
1552
|
+
# name could be specified as ({resourceProviderNamespace} ==
|
1553
|
+
# 'Microsoft.Compute', {parentResourcePath} ==
|
1554
|
+
# 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames',
|
1555
|
+
# {resourceName} == 'MyComputerName'). A convenient alternative to providing
|
1556
|
+
# the namespace and type name separately is to provide both in the
|
1557
|
+
# {resourceType} parameter, format: ({resourceProviderNamespace} == '',
|
1558
|
+
# {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites',
|
1559
|
+
# {resourceName} == 'MyWebApp').
|
1560
|
+
#
|
1561
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1562
|
+
# to List operation.
|
1563
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
1564
|
+
# to the HTTP request.
|
1565
|
+
#
|
1566
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
1567
|
+
#
|
1568
|
+
def list_for_resource_next_async(next_page_link, custom_headers:nil)
|
1569
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
1570
|
+
|
1571
|
+
|
1572
|
+
request_headers = {}
|
1573
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
1574
|
+
|
1575
|
+
# Set Headers
|
1576
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1577
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1578
|
+
path_template = '{nextLink}'
|
1579
|
+
|
1580
|
+
request_url = @base_url || @client.base_url
|
1581
|
+
|
1582
|
+
options = {
|
1583
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1584
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
1585
|
+
headers: request_headers.merge(custom_headers || {}),
|
1586
|
+
base_url: request_url
|
1587
|
+
}
|
1588
|
+
promise = @client.make_request_async(:get, path_template, options)
|
1589
|
+
|
1590
|
+
promise = promise.then do |result|
|
1591
|
+
http_response = result.response
|
1592
|
+
status_code = http_response.status
|
1593
|
+
response_content = http_response.body
|
1594
|
+
unless status_code == 200
|
1595
|
+
error_model = JSON.load(response_content)
|
1596
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
1597
|
+
end
|
1598
|
+
|
1599
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1600
|
+
# Deserialize Response
|
1601
|
+
if status_code == 200
|
1602
|
+
begin
|
1603
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1604
|
+
result_mapper = Azure::Policy::Mgmt::V2018_03_01::Models::PolicyAssignmentListResult.mapper()
|
1605
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1606
|
+
rescue Exception => e
|
1607
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1608
|
+
end
|
1609
|
+
end
|
1610
|
+
|
1611
|
+
result
|
1612
|
+
end
|
1613
|
+
|
1614
|
+
promise.execute
|
1615
|
+
end
|
1616
|
+
|
1617
|
+
#
|
1618
|
+
# Retrieves all policy assignments that apply to a subscription.
|
1619
|
+
#
|
1620
|
+
# This operation retrieves the list of all policy assignments associated with
|
1621
|
+
# the given subscription that match the optional given $filter. Valid values
|
1622
|
+
# for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter
|
1623
|
+
# is not provided, the unfiltered list includes all policy assignments
|
1624
|
+
# associated with the subscription, including those that apply directly or from
|
1625
|
+
# management groups that contain the given subscription, as well as any applied
|
1626
|
+
# to objects contained within the subscription. If $filter=atScope() is
|
1627
|
+
# provided, the returned list includes all policy assignments that apply to the
|
1628
|
+
# subscription, which is everything in the unfiltered list except those applied
|
1629
|
+
# to objects contained within the subscription. If $filter=policyDefinitionId
|
1630
|
+
# eq '{value}' is provided, the returned list includes only policy assignments
|
1631
|
+
# that apply to the subscription and assign the policy definition whose id is
|
1632
|
+
# {value}.
|
1633
|
+
#
|
1634
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1635
|
+
# to List operation.
|
1636
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1637
|
+
# will be added to the HTTP request.
|
1638
|
+
#
|
1639
|
+
# @return [PolicyAssignmentListResult] operation results.
|
1640
|
+
#
|
1641
|
+
def list_next(next_page_link, custom_headers:nil)
|
1642
|
+
response = list_next_async(next_page_link, custom_headers:custom_headers).value!
|
1643
|
+
response.body unless response.nil?
|
1644
|
+
end
|
1645
|
+
|
1646
|
+
#
|
1647
|
+
# Retrieves all policy assignments that apply to a subscription.
|
1648
|
+
#
|
1649
|
+
# This operation retrieves the list of all policy assignments associated with
|
1650
|
+
# the given subscription that match the optional given $filter. Valid values
|
1651
|
+
# for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter
|
1652
|
+
# is not provided, the unfiltered list includes all policy assignments
|
1653
|
+
# associated with the subscription, including those that apply directly or from
|
1654
|
+
# management groups that contain the given subscription, as well as any applied
|
1655
|
+
# to objects contained within the subscription. If $filter=atScope() is
|
1656
|
+
# provided, the returned list includes all policy assignments that apply to the
|
1657
|
+
# subscription, which is everything in the unfiltered list except those applied
|
1658
|
+
# to objects contained within the subscription. If $filter=policyDefinitionId
|
1659
|
+
# eq '{value}' is provided, the returned list includes only policy assignments
|
1660
|
+
# that apply to the subscription and assign the policy definition whose id is
|
1661
|
+
# {value}.
|
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_next_with_http_info(next_page_link, custom_headers:nil)
|
1671
|
+
list_next_async(next_page_link, custom_headers:custom_headers).value!
|
1672
|
+
end
|
1673
|
+
|
1674
|
+
#
|
1675
|
+
# Retrieves all policy assignments that apply to a subscription.
|
1676
|
+
#
|
1677
|
+
# This operation retrieves the list of all policy assignments associated with
|
1678
|
+
# the given subscription that match the optional given $filter. Valid values
|
1679
|
+
# for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter
|
1680
|
+
# is not provided, the unfiltered list includes all policy assignments
|
1681
|
+
# associated with the subscription, including those that apply directly or from
|
1682
|
+
# management groups that contain the given subscription, as well as any applied
|
1683
|
+
# to objects contained within the subscription. If $filter=atScope() is
|
1684
|
+
# provided, the returned list includes all policy assignments that apply to the
|
1685
|
+
# subscription, which is everything in the unfiltered list except those applied
|
1686
|
+
# to objects contained within the subscription. If $filter=policyDefinitionId
|
1687
|
+
# eq '{value}' is provided, the returned list includes only policy assignments
|
1688
|
+
# that apply to the subscription and assign the policy definition whose id is
|
1689
|
+
# {value}.
|
1690
|
+
#
|
1691
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1692
|
+
# to List operation.
|
1693
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
1694
|
+
# to the HTTP request.
|
1695
|
+
#
|
1696
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
1697
|
+
#
|
1698
|
+
def list_next_async(next_page_link, custom_headers:nil)
|
1699
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
1700
|
+
|
1701
|
+
|
1702
|
+
request_headers = {}
|
1703
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
1704
|
+
|
1705
|
+
# Set Headers
|
1706
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1707
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1708
|
+
path_template = '{nextLink}'
|
1709
|
+
|
1710
|
+
request_url = @base_url || @client.base_url
|
1711
|
+
|
1712
|
+
options = {
|
1713
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1714
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
1715
|
+
headers: request_headers.merge(custom_headers || {}),
|
1716
|
+
base_url: request_url
|
1717
|
+
}
|
1718
|
+
promise = @client.make_request_async(:get, path_template, options)
|
1719
|
+
|
1720
|
+
promise = promise.then do |result|
|
1721
|
+
http_response = result.response
|
1722
|
+
status_code = http_response.status
|
1723
|
+
response_content = http_response.body
|
1724
|
+
unless status_code == 200
|
1725
|
+
error_model = JSON.load(response_content)
|
1726
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
1727
|
+
end
|
1728
|
+
|
1729
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1730
|
+
# Deserialize Response
|
1731
|
+
if status_code == 200
|
1732
|
+
begin
|
1733
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1734
|
+
result_mapper = Azure::Policy::Mgmt::V2018_03_01::Models::PolicyAssignmentListResult.mapper()
|
1735
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1736
|
+
rescue Exception => e
|
1737
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1738
|
+
end
|
1739
|
+
end
|
1740
|
+
|
1741
|
+
result
|
1742
|
+
end
|
1743
|
+
|
1744
|
+
promise.execute
|
1745
|
+
end
|
1746
|
+
|
1747
|
+
#
|
1748
|
+
# Retrieves all policy assignments that apply to a resource group.
|
1749
|
+
#
|
1750
|
+
# This operation retrieves the list of all policy assignments associated with
|
1751
|
+
# the given resource group in the given subscription that match the optional
|
1752
|
+
# given $filter. Valid values for $filter are: 'atScope()' or
|
1753
|
+
# 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered
|
1754
|
+
# list includes all policy assignments associated with the resource group,
|
1755
|
+
# including those that apply directly or apply from containing scopes, as well
|
1756
|
+
# as any applied to resources contained within the resource group. If
|
1757
|
+
# $filter=atScope() is provided, the returned list includes all policy
|
1758
|
+
# assignments that apply to the resource group, which is everything in the
|
1759
|
+
# unfiltered list except those applied to resources contained within the
|
1760
|
+
# resource group. If $filter=policyDefinitionId eq '{value}' is provided, the
|
1761
|
+
# returned list includes only policy assignments that apply to the resource
|
1762
|
+
# group and assign the policy definition whose id is {value}.
|
1763
|
+
#
|
1764
|
+
# @param resource_group_name [String] The name of the resource group that
|
1765
|
+
# contains policy assignments.
|
1766
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
1767
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
1768
|
+
# not provided, no filtering is performed.
|
1769
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1770
|
+
# will be added to the HTTP request.
|
1771
|
+
#
|
1772
|
+
# @return [PolicyAssignmentListResult] which provide lazy access to pages of
|
1773
|
+
# the response.
|
1774
|
+
#
|
1775
|
+
def list_for_resource_group_as_lazy(resource_group_name, filter:nil, custom_headers:nil)
|
1776
|
+
response = list_for_resource_group_async(resource_group_name, filter:filter, custom_headers:custom_headers).value!
|
1777
|
+
unless response.nil?
|
1778
|
+
page = response.body
|
1779
|
+
page.next_method = Proc.new do |next_page_link|
|
1780
|
+
list_for_resource_group_next_async(next_page_link, custom_headers:custom_headers)
|
1781
|
+
end
|
1782
|
+
page
|
1783
|
+
end
|
1784
|
+
end
|
1785
|
+
|
1786
|
+
#
|
1787
|
+
# Retrieves all policy assignments that apply to a resource.
|
1788
|
+
#
|
1789
|
+
# This operation retrieves the list of all policy assignments associated with
|
1790
|
+
# the specified resource in the given resource group and subscription that
|
1791
|
+
# match the optional given $filter. Valid values for $filter are: 'atScope()'
|
1792
|
+
# or 'policyDefinitionId eq '{value}''. If $filter is not provided, the
|
1793
|
+
# unfiltered list includes all policy assignments associated with the resource,
|
1794
|
+
# including those that apply directly or from all containing scopes, as well as
|
1795
|
+
# any applied to resources contained within the resource. If $filter=atScope()
|
1796
|
+
# is provided, the returned list includes all policy assignments that apply to
|
1797
|
+
# the resource, which is everything in the unfiltered list except those applied
|
1798
|
+
# to resources contained within the resource. If $filter=policyDefinitionId eq
|
1799
|
+
# '{value}' is provided, the returned list includes only policy assignments
|
1800
|
+
# that apply to the resource and assign the policy definition whose id is
|
1801
|
+
# {value}. Three parameters plus the resource name are used to identify a
|
1802
|
+
# specific resource. If the resource is not part of a parent resource (the more
|
1803
|
+
# common case), the parent resource path should not be provided (or provided as
|
1804
|
+
# ''). For example a web app could be specified as ({resourceProviderNamespace}
|
1805
|
+
# == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites',
|
1806
|
+
# {resourceName} == 'MyWebApp'). If the resource is part of a parent resource,
|
1807
|
+
# then all parameters should be provided. For example a virtual machine DNS
|
1808
|
+
# name could be specified as ({resourceProviderNamespace} ==
|
1809
|
+
# 'Microsoft.Compute', {parentResourcePath} ==
|
1810
|
+
# 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames',
|
1811
|
+
# {resourceName} == 'MyComputerName'). A convenient alternative to providing
|
1812
|
+
# the namespace and type name separately is to provide both in the
|
1813
|
+
# {resourceType} parameter, format: ({resourceProviderNamespace} == '',
|
1814
|
+
# {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites',
|
1815
|
+
# {resourceName} == 'MyWebApp').
|
1816
|
+
#
|
1817
|
+
# @param resource_group_name [String] The name of the resource group containing
|
1818
|
+
# the resource.
|
1819
|
+
# @param resource_provider_namespace [String] The namespace of the resource
|
1820
|
+
# provider. For example, the namespace of a virtual machine is
|
1821
|
+
# Microsoft.Compute (from Microsoft.Compute/virtualMachines)
|
1822
|
+
# @param parent_resource_path [String] The parent resource path. Use empty
|
1823
|
+
# string if there is none.
|
1824
|
+
# @param resource_type [String] The resource type name. For example the type
|
1825
|
+
# name of a web app is 'sites' (from Microsoft.Web/sites).
|
1826
|
+
# @param resource_name [String] The name of the resource.
|
1827
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
1828
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
1829
|
+
# not provided, no filtering is performed.
|
1830
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1831
|
+
# will be added to the HTTP request.
|
1832
|
+
#
|
1833
|
+
# @return [PolicyAssignmentListResult] which provide lazy access to pages of
|
1834
|
+
# the response.
|
1835
|
+
#
|
1836
|
+
def list_for_resource_as_lazy(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:nil, custom_headers:nil)
|
1837
|
+
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!
|
1838
|
+
unless response.nil?
|
1839
|
+
page = response.body
|
1840
|
+
page.next_method = Proc.new do |next_page_link|
|
1841
|
+
list_for_resource_next_async(next_page_link, custom_headers:custom_headers)
|
1842
|
+
end
|
1843
|
+
page
|
1844
|
+
end
|
1845
|
+
end
|
1846
|
+
|
1847
|
+
#
|
1848
|
+
# Retrieves all policy assignments that apply to a subscription.
|
1849
|
+
#
|
1850
|
+
# This operation retrieves the list of all policy assignments associated with
|
1851
|
+
# the given subscription that match the optional given $filter. Valid values
|
1852
|
+
# for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter
|
1853
|
+
# is not provided, the unfiltered list includes all policy assignments
|
1854
|
+
# associated with the subscription, including those that apply directly or from
|
1855
|
+
# management groups that contain the given subscription, as well as any applied
|
1856
|
+
# to objects contained within the subscription. If $filter=atScope() is
|
1857
|
+
# provided, the returned list includes all policy assignments that apply to the
|
1858
|
+
# subscription, which is everything in the unfiltered list except those applied
|
1859
|
+
# to objects contained within the subscription. If $filter=policyDefinitionId
|
1860
|
+
# eq '{value}' is provided, the returned list includes only policy assignments
|
1861
|
+
# that apply to the subscription and assign the policy definition whose id is
|
1862
|
+
# {value}.
|
1863
|
+
#
|
1864
|
+
# @param filter [String] The filter to apply on the operation. Valid values for
|
1865
|
+
# $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is
|
1866
|
+
# not provided, no filtering is performed.
|
1867
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1868
|
+
# will be added to the HTTP request.
|
1869
|
+
#
|
1870
|
+
# @return [PolicyAssignmentListResult] which provide lazy access to pages of
|
1871
|
+
# the response.
|
1872
|
+
#
|
1873
|
+
def list_as_lazy(filter:nil, custom_headers:nil)
|
1874
|
+
response = list_async(filter:filter, custom_headers:custom_headers).value!
|
1875
|
+
unless response.nil?
|
1876
|
+
page = response.body
|
1877
|
+
page.next_method = Proc.new do |next_page_link|
|
1878
|
+
list_next_async(next_page_link, custom_headers:custom_headers)
|
1879
|
+
end
|
1880
|
+
page
|
1881
|
+
end
|
1882
|
+
end
|
1883
|
+
|
1884
|
+
end
|
1885
|
+
end
|