azure_mgmt_resources 0.2.1 → 0.3.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 +13 -5
- data/README.md +1 -27
- data/azure_mgmt_resources.gemspec +1 -1
- data/lib/azure_mgmt_resources.rb +7 -10
- data/lib/azure_mgmt_resources/deployment_operations.rb +117 -16
- data/lib/azure_mgmt_resources/deployments.rb +416 -51
- data/lib/azure_mgmt_resources/models/basic_dependency.rb +1 -1
- data/lib/azure_mgmt_resources/models/debug_setting.rb +56 -0
- data/lib/azure_mgmt_resources/models/dependency.rb +1 -1
- data/lib/azure_mgmt_resources/models/deployment.rb +1 -1
- data/lib/azure_mgmt_resources/models/deployment_export_result.rb +56 -0
- data/lib/azure_mgmt_resources/models/deployment_extended.rb +1 -1
- data/lib/azure_mgmt_resources/models/deployment_extended_filter.rb +1 -1
- data/lib/azure_mgmt_resources/models/deployment_list_result.rb +1 -1
- data/lib/azure_mgmt_resources/models/deployment_mode.rb +1 -1
- data/lib/azure_mgmt_resources/models/deployment_operation.rb +1 -1
- data/lib/azure_mgmt_resources/models/deployment_operation_properties.rb +42 -1
- data/lib/azure_mgmt_resources/models/deployment_operations_list_result.rb +1 -1
- data/lib/azure_mgmt_resources/models/deployment_properties.rb +18 -1
- data/lib/azure_mgmt_resources/models/deployment_properties_extended.rb +18 -1
- data/lib/azure_mgmt_resources/models/deployment_validate_result.rb +1 -1
- data/lib/azure_mgmt_resources/models/export_template_request.rb +69 -0
- data/lib/azure_mgmt_resources/models/generic_resource.rb +1 -1
- data/lib/azure_mgmt_resources/models/generic_resource_filter.rb +1 -1
- data/lib/azure_mgmt_resources/models/http_message.rb +56 -0
- data/lib/azure_mgmt_resources/models/parameters_link.rb +1 -1
- data/lib/azure_mgmt_resources/models/plan.rb +1 -1
- data/lib/azure_mgmt_resources/models/provider.rb +1 -1
- data/lib/azure_mgmt_resources/models/provider_list_result.rb +1 -1
- data/lib/azure_mgmt_resources/models/provider_resource_type.rb +1 -1
- data/lib/azure_mgmt_resources/models/resource_group.rb +1 -1
- data/lib/azure_mgmt_resources/models/resource_group_export_result.rb +71 -0
- data/lib/azure_mgmt_resources/models/resource_group_filter.rb +1 -1
- data/lib/azure_mgmt_resources/models/resource_group_list_result.rb +1 -1
- data/lib/azure_mgmt_resources/models/resource_group_properties.rb +1 -1
- data/lib/azure_mgmt_resources/models/resource_list_result.rb +1 -1
- data/lib/azure_mgmt_resources/models/resource_management_error_with_details.rb +18 -5
- data/lib/azure_mgmt_resources/models/resource_provider_operation_definition.rb +1 -1
- data/lib/azure_mgmt_resources/models/resource_provider_operation_detail_list_result.rb +1 -1
- data/lib/azure_mgmt_resources/models/resource_provider_operation_display_properties.rb +1 -1
- data/lib/azure_mgmt_resources/models/resources_move_info.rb +1 -1
- data/lib/azure_mgmt_resources/models/tag_count.rb +1 -1
- data/lib/azure_mgmt_resources/models/tag_details.rb +1 -1
- data/lib/azure_mgmt_resources/models/tag_value.rb +1 -1
- data/lib/azure_mgmt_resources/models/tags_list_result.rb +1 -1
- data/lib/azure_mgmt_resources/models/target_resource.rb +1 -1
- data/lib/azure_mgmt_resources/models/template_link.rb +1 -1
- data/lib/azure_mgmt_resources/module_definition.rb +1 -1
- data/lib/azure_mgmt_resources/providers.rb +181 -26
- data/lib/azure_mgmt_resources/resource_groups.rb +461 -54
- data/lib/azure_mgmt_resources/resource_management_client.rb +2 -10
- data/lib/azure_mgmt_resources/resource_provider_operation_details.rb +73 -11
- data/lib/azure_mgmt_resources/resources.rb +306 -57
- data/lib/azure_mgmt_resources/tags.rb +207 -31
- data/lib/azure_mgmt_resources/version.rb +2 -2
- metadata +31 -29
- data/lib/azure_mgmt_resources/models/policy_assignment.rb +0 -72
- data/lib/azure_mgmt_resources/models/policy_assignment_list_result.rb +0 -86
- data/lib/azure_mgmt_resources/models/policy_assignment_properties.rb +0 -74
- data/lib/azure_mgmt_resources/models/policy_definition.rb +0 -72
- data/lib/azure_mgmt_resources/models/policy_definition_properties.rb +0 -74
- data/lib/azure_mgmt_resources/models/resource_management_error.rb +0 -76
- data/lib/azure_mgmt_resources/policy_assignments.rb +0 -922
- data/lib/azure_mgmt_resources/policy_definitions.rb +0 -208
@@ -1,922 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
-
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
-
# regenerated.
|
5
|
-
|
6
|
-
module Azure::ARM::Resources
|
7
|
-
#
|
8
|
-
# PolicyAssignments
|
9
|
-
#
|
10
|
-
class PolicyAssignments
|
11
|
-
include Azure::ARM::Resources::Models
|
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 reference to the ResourceManagementClient
|
23
|
-
attr_reader :client
|
24
|
-
|
25
|
-
#
|
26
|
-
# Gets policy assignments of the resource.
|
27
|
-
#
|
28
|
-
# @param resource_group_name [String] The name of the resource group.
|
29
|
-
# @param resource_provider_namespace [String] The name of the resource
|
30
|
-
# provider.
|
31
|
-
# @param parent_resource_path [String] The parent resource path.
|
32
|
-
# @param resource_type [String] The resource type.
|
33
|
-
# @param resource_name [String] The resource name.
|
34
|
-
# @param filter [String] The filter to apply on the operation.
|
35
|
-
# @param [Hash{String => String}] The hash of custom headers need to be
|
36
|
-
# applied to HTTP request.
|
37
|
-
#
|
38
|
-
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
39
|
-
# response.
|
40
|
-
#
|
41
|
-
def list_for_resource(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter = nil, custom_headers = nil)
|
42
|
-
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
43
|
-
fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
|
44
|
-
fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
|
45
|
-
fail ArgumentError, 'resource_type is nil' if resource_type.nil?
|
46
|
-
fail ArgumentError, 'resource_name is nil' if resource_name.nil?
|
47
|
-
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
48
|
-
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
49
|
-
request_headers = {}
|
50
|
-
|
51
|
-
# Set Headers
|
52
|
-
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
53
|
-
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
54
|
-
path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}providers/Microsoft.Authorization/policyAssignments'
|
55
|
-
options = {
|
56
|
-
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
57
|
-
path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'parentResourcePath' => parent_resource_path,'resourceType' => resource_type,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
|
58
|
-
query_params: {'api-version' => @client.api_version},
|
59
|
-
skip_encoding_query_params: {'$filter' => filter},
|
60
|
-
headers: request_headers.merge(custom_headers || {})
|
61
|
-
}
|
62
|
-
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
63
|
-
promise = request.run_promise do |req|
|
64
|
-
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
65
|
-
end
|
66
|
-
|
67
|
-
promise = promise.then do |http_response|
|
68
|
-
status_code = http_response.status
|
69
|
-
response_content = http_response.body
|
70
|
-
unless status_code == 200
|
71
|
-
error_model = JSON.load(response_content)
|
72
|
-
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
73
|
-
end
|
74
|
-
|
75
|
-
# Create Result
|
76
|
-
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
77
|
-
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
78
|
-
# Deserialize Response
|
79
|
-
if status_code == 200
|
80
|
-
begin
|
81
|
-
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
82
|
-
unless parsed_response.nil?
|
83
|
-
parsed_response = PolicyAssignmentListResult.deserialize_object(parsed_response)
|
84
|
-
end
|
85
|
-
result.body = parsed_response
|
86
|
-
rescue Exception => e
|
87
|
-
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
result
|
92
|
-
end
|
93
|
-
|
94
|
-
promise.execute
|
95
|
-
end
|
96
|
-
|
97
|
-
#
|
98
|
-
# Gets policy assignments of the resource group.
|
99
|
-
#
|
100
|
-
# @param resource_group_name [String] Resource group name.
|
101
|
-
# @param filter [String] The filter to apply on the operation.
|
102
|
-
# @param [Hash{String => String}] The hash of custom headers need to be
|
103
|
-
# applied to HTTP request.
|
104
|
-
#
|
105
|
-
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
106
|
-
# response.
|
107
|
-
#
|
108
|
-
def list_for_resource_group(resource_group_name, filter = nil, custom_headers = nil)
|
109
|
-
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
110
|
-
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
111
|
-
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
112
|
-
request_headers = {}
|
113
|
-
|
114
|
-
# Set Headers
|
115
|
-
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
116
|
-
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
117
|
-
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments'
|
118
|
-
options = {
|
119
|
-
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
120
|
-
path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
121
|
-
query_params: {'api-version' => @client.api_version},
|
122
|
-
skip_encoding_query_params: {'$filter' => filter},
|
123
|
-
headers: request_headers.merge(custom_headers || {})
|
124
|
-
}
|
125
|
-
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
126
|
-
promise = request.run_promise do |req|
|
127
|
-
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
128
|
-
end
|
129
|
-
|
130
|
-
promise = promise.then do |http_response|
|
131
|
-
status_code = http_response.status
|
132
|
-
response_content = http_response.body
|
133
|
-
unless status_code == 200
|
134
|
-
error_model = JSON.load(response_content)
|
135
|
-
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
136
|
-
end
|
137
|
-
|
138
|
-
# Create Result
|
139
|
-
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
140
|
-
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
141
|
-
# Deserialize Response
|
142
|
-
if status_code == 200
|
143
|
-
begin
|
144
|
-
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
145
|
-
unless parsed_response.nil?
|
146
|
-
parsed_response = PolicyAssignmentListResult.deserialize_object(parsed_response)
|
147
|
-
end
|
148
|
-
result.body = parsed_response
|
149
|
-
rescue Exception => e
|
150
|
-
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
result
|
155
|
-
end
|
156
|
-
|
157
|
-
promise.execute
|
158
|
-
end
|
159
|
-
|
160
|
-
#
|
161
|
-
# Delete policy assignment.
|
162
|
-
#
|
163
|
-
# @param scope [String] Scope.
|
164
|
-
# @param policy_assignment_name [String] Policy assignment name.
|
165
|
-
# @param [Hash{String => String}] The hash of custom headers need to be
|
166
|
-
# applied to HTTP request.
|
167
|
-
#
|
168
|
-
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
169
|
-
# response.
|
170
|
-
#
|
171
|
-
def delete(scope, policy_assignment_name, custom_headers = nil)
|
172
|
-
fail ArgumentError, 'scope is nil' if scope.nil?
|
173
|
-
fail ArgumentError, 'policy_assignment_name is nil' if policy_assignment_name.nil?
|
174
|
-
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
175
|
-
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
176
|
-
request_headers = {}
|
177
|
-
|
178
|
-
# Set Headers
|
179
|
-
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
180
|
-
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
181
|
-
path_template = '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'
|
182
|
-
options = {
|
183
|
-
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
184
|
-
path_params: {'policyAssignmentName' => policy_assignment_name,'subscriptionId' => @client.subscription_id},
|
185
|
-
skip_encoding_path_params: {'scope' => scope},
|
186
|
-
query_params: {'api-version' => @client.api_version},
|
187
|
-
headers: request_headers.merge(custom_headers || {})
|
188
|
-
}
|
189
|
-
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
|
190
|
-
promise = request.run_promise do |req|
|
191
|
-
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
192
|
-
end
|
193
|
-
|
194
|
-
promise = promise.then do |http_response|
|
195
|
-
status_code = http_response.status
|
196
|
-
response_content = http_response.body
|
197
|
-
unless status_code == 200
|
198
|
-
error_model = JSON.load(response_content)
|
199
|
-
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
200
|
-
end
|
201
|
-
|
202
|
-
# Create Result
|
203
|
-
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
204
|
-
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
205
|
-
# Deserialize Response
|
206
|
-
if status_code == 200
|
207
|
-
begin
|
208
|
-
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
209
|
-
unless parsed_response.nil?
|
210
|
-
parsed_response = PolicyAssignment.deserialize_object(parsed_response)
|
211
|
-
end
|
212
|
-
result.body = parsed_response
|
213
|
-
rescue Exception => e
|
214
|
-
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
215
|
-
end
|
216
|
-
end
|
217
|
-
|
218
|
-
result
|
219
|
-
end
|
220
|
-
|
221
|
-
promise.execute
|
222
|
-
end
|
223
|
-
|
224
|
-
#
|
225
|
-
# Create policy assignment.
|
226
|
-
#
|
227
|
-
# @param scope [String] Scope.
|
228
|
-
# @param policy_assignment_name [String] Policy assignment name.
|
229
|
-
# @param parameters [PolicyAssignment] Policy assignment.
|
230
|
-
# @param [Hash{String => String}] The hash of custom headers need to be
|
231
|
-
# applied to HTTP request.
|
232
|
-
#
|
233
|
-
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
234
|
-
# response.
|
235
|
-
#
|
236
|
-
def create(scope, policy_assignment_name, parameters, custom_headers = nil)
|
237
|
-
fail ArgumentError, 'scope is nil' if scope.nil?
|
238
|
-
fail ArgumentError, 'policy_assignment_name is nil' if policy_assignment_name.nil?
|
239
|
-
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
240
|
-
parameters.validate unless parameters.nil?
|
241
|
-
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
242
|
-
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
243
|
-
request_headers = {}
|
244
|
-
|
245
|
-
# Set Headers
|
246
|
-
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
247
|
-
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
248
|
-
|
249
|
-
# Serialize Request
|
250
|
-
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
251
|
-
unless parameters.nil?
|
252
|
-
parameters = PolicyAssignment.serialize_object(parameters)
|
253
|
-
end
|
254
|
-
request_content = JSON.generate(parameters, quirks_mode: true)
|
255
|
-
path_template = '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'
|
256
|
-
options = {
|
257
|
-
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
258
|
-
path_params: {'policyAssignmentName' => policy_assignment_name,'subscriptionId' => @client.subscription_id},
|
259
|
-
skip_encoding_path_params: {'scope' => scope},
|
260
|
-
query_params: {'api-version' => @client.api_version},
|
261
|
-
body: request_content,
|
262
|
-
headers: request_headers.merge(custom_headers || {})
|
263
|
-
}
|
264
|
-
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
|
265
|
-
promise = request.run_promise do |req|
|
266
|
-
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
267
|
-
end
|
268
|
-
|
269
|
-
promise = promise.then do |http_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 MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
275
|
-
end
|
276
|
-
|
277
|
-
# Create Result
|
278
|
-
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
279
|
-
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
280
|
-
# Deserialize Response
|
281
|
-
if status_code == 201
|
282
|
-
begin
|
283
|
-
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
284
|
-
unless parsed_response.nil?
|
285
|
-
parsed_response = PolicyAssignment.deserialize_object(parsed_response)
|
286
|
-
end
|
287
|
-
result.body = parsed_response
|
288
|
-
rescue Exception => e
|
289
|
-
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
290
|
-
end
|
291
|
-
end
|
292
|
-
|
293
|
-
result
|
294
|
-
end
|
295
|
-
|
296
|
-
promise.execute
|
297
|
-
end
|
298
|
-
|
299
|
-
#
|
300
|
-
# Get single policy assignment.
|
301
|
-
#
|
302
|
-
# @param scope [String] Scope.
|
303
|
-
# @param policy_assignment_name [String] Policy assignment name.
|
304
|
-
# @param [Hash{String => String}] The hash of custom headers need to be
|
305
|
-
# applied to HTTP request.
|
306
|
-
#
|
307
|
-
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
308
|
-
# response.
|
309
|
-
#
|
310
|
-
def get(scope, policy_assignment_name, custom_headers = nil)
|
311
|
-
fail ArgumentError, 'scope is nil' if scope.nil?
|
312
|
-
fail ArgumentError, 'policy_assignment_name is nil' if policy_assignment_name.nil?
|
313
|
-
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
314
|
-
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
315
|
-
request_headers = {}
|
316
|
-
|
317
|
-
# Set Headers
|
318
|
-
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
319
|
-
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
320
|
-
path_template = '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'
|
321
|
-
options = {
|
322
|
-
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
323
|
-
path_params: {'policyAssignmentName' => policy_assignment_name,'subscriptionId' => @client.subscription_id},
|
324
|
-
skip_encoding_path_params: {'scope' => scope},
|
325
|
-
query_params: {'api-version' => @client.api_version},
|
326
|
-
headers: request_headers.merge(custom_headers || {})
|
327
|
-
}
|
328
|
-
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
329
|
-
promise = request.run_promise do |req|
|
330
|
-
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
331
|
-
end
|
332
|
-
|
333
|
-
promise = promise.then do |http_response|
|
334
|
-
status_code = http_response.status
|
335
|
-
response_content = http_response.body
|
336
|
-
unless status_code == 200
|
337
|
-
error_model = JSON.load(response_content)
|
338
|
-
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
339
|
-
end
|
340
|
-
|
341
|
-
# Create Result
|
342
|
-
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
343
|
-
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
344
|
-
# Deserialize Response
|
345
|
-
if status_code == 200
|
346
|
-
begin
|
347
|
-
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
348
|
-
unless parsed_response.nil?
|
349
|
-
parsed_response = PolicyAssignment.deserialize_object(parsed_response)
|
350
|
-
end
|
351
|
-
result.body = parsed_response
|
352
|
-
rescue Exception => e
|
353
|
-
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
354
|
-
end
|
355
|
-
end
|
356
|
-
|
357
|
-
result
|
358
|
-
end
|
359
|
-
|
360
|
-
promise.execute
|
361
|
-
end
|
362
|
-
|
363
|
-
#
|
364
|
-
# Delete policy assignment.
|
365
|
-
#
|
366
|
-
# @param policy_assignment_id [String] Policy assignment Id
|
367
|
-
# @param [Hash{String => String}] The hash of custom headers need to be
|
368
|
-
# applied to HTTP request.
|
369
|
-
#
|
370
|
-
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
371
|
-
# response.
|
372
|
-
#
|
373
|
-
def delete_by_id(policy_assignment_id, custom_headers = nil)
|
374
|
-
fail ArgumentError, 'policy_assignment_id is nil' if policy_assignment_id.nil?
|
375
|
-
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
376
|
-
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
377
|
-
request_headers = {}
|
378
|
-
|
379
|
-
# Set Headers
|
380
|
-
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
381
|
-
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
382
|
-
path_template = '/{policyAssignmentId}'
|
383
|
-
options = {
|
384
|
-
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
385
|
-
path_params: {'subscriptionId' => @client.subscription_id},
|
386
|
-
skip_encoding_path_params: {'policyAssignmentId' => policy_assignment_id},
|
387
|
-
query_params: {'api-version' => @client.api_version},
|
388
|
-
headers: request_headers.merge(custom_headers || {})
|
389
|
-
}
|
390
|
-
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
|
391
|
-
promise = request.run_promise do |req|
|
392
|
-
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
393
|
-
end
|
394
|
-
|
395
|
-
promise = promise.then do |http_response|
|
396
|
-
status_code = http_response.status
|
397
|
-
response_content = http_response.body
|
398
|
-
unless status_code == 200
|
399
|
-
error_model = JSON.load(response_content)
|
400
|
-
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
401
|
-
end
|
402
|
-
|
403
|
-
# Create Result
|
404
|
-
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
405
|
-
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
406
|
-
# Deserialize Response
|
407
|
-
if status_code == 200
|
408
|
-
begin
|
409
|
-
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
410
|
-
unless parsed_response.nil?
|
411
|
-
parsed_response = PolicyAssignment.deserialize_object(parsed_response)
|
412
|
-
end
|
413
|
-
result.body = parsed_response
|
414
|
-
rescue Exception => e
|
415
|
-
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
416
|
-
end
|
417
|
-
end
|
418
|
-
|
419
|
-
result
|
420
|
-
end
|
421
|
-
|
422
|
-
promise.execute
|
423
|
-
end
|
424
|
-
|
425
|
-
#
|
426
|
-
# Create policy assignment by Id.
|
427
|
-
#
|
428
|
-
# @param policy_assignment_id [String] Policy assignment Id
|
429
|
-
# @param parameters [PolicyAssignment] Policy assignment.
|
430
|
-
# @param [Hash{String => String}] The hash of custom headers need to be
|
431
|
-
# applied to HTTP request.
|
432
|
-
#
|
433
|
-
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
434
|
-
# response.
|
435
|
-
#
|
436
|
-
def create_by_id(policy_assignment_id, parameters, custom_headers = nil)
|
437
|
-
fail ArgumentError, 'policy_assignment_id is nil' if policy_assignment_id.nil?
|
438
|
-
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
439
|
-
parameters.validate unless parameters.nil?
|
440
|
-
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
441
|
-
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
442
|
-
request_headers = {}
|
443
|
-
|
444
|
-
# Set Headers
|
445
|
-
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
446
|
-
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
447
|
-
|
448
|
-
# Serialize Request
|
449
|
-
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
450
|
-
unless parameters.nil?
|
451
|
-
parameters = PolicyAssignment.serialize_object(parameters)
|
452
|
-
end
|
453
|
-
request_content = JSON.generate(parameters, quirks_mode: true)
|
454
|
-
path_template = '/{policyAssignmentId}'
|
455
|
-
options = {
|
456
|
-
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
457
|
-
path_params: {'subscriptionId' => @client.subscription_id},
|
458
|
-
skip_encoding_path_params: {'policyAssignmentId' => policy_assignment_id},
|
459
|
-
query_params: {'api-version' => @client.api_version},
|
460
|
-
body: request_content,
|
461
|
-
headers: request_headers.merge(custom_headers || {})
|
462
|
-
}
|
463
|
-
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
|
464
|
-
promise = request.run_promise do |req|
|
465
|
-
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
466
|
-
end
|
467
|
-
|
468
|
-
promise = promise.then do |http_response|
|
469
|
-
status_code = http_response.status
|
470
|
-
response_content = http_response.body
|
471
|
-
unless status_code == 201
|
472
|
-
error_model = JSON.load(response_content)
|
473
|
-
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
474
|
-
end
|
475
|
-
|
476
|
-
# Create Result
|
477
|
-
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
478
|
-
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
479
|
-
# Deserialize Response
|
480
|
-
if status_code == 201
|
481
|
-
begin
|
482
|
-
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
483
|
-
unless parsed_response.nil?
|
484
|
-
parsed_response = PolicyAssignment.deserialize_object(parsed_response)
|
485
|
-
end
|
486
|
-
result.body = parsed_response
|
487
|
-
rescue Exception => e
|
488
|
-
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
489
|
-
end
|
490
|
-
end
|
491
|
-
|
492
|
-
result
|
493
|
-
end
|
494
|
-
|
495
|
-
promise.execute
|
496
|
-
end
|
497
|
-
|
498
|
-
#
|
499
|
-
# Get single policy assignment.
|
500
|
-
#
|
501
|
-
# @param policy_assignment_id [String] Policy assignment Id
|
502
|
-
# @param [Hash{String => String}] The hash of custom headers need to be
|
503
|
-
# applied to HTTP request.
|
504
|
-
#
|
505
|
-
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
506
|
-
# response.
|
507
|
-
#
|
508
|
-
def get_by_id(policy_assignment_id, custom_headers = nil)
|
509
|
-
fail ArgumentError, 'policy_assignment_id is nil' if policy_assignment_id.nil?
|
510
|
-
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
511
|
-
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
512
|
-
request_headers = {}
|
513
|
-
|
514
|
-
# Set Headers
|
515
|
-
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
516
|
-
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
517
|
-
path_template = '/{policyAssignmentId}'
|
518
|
-
options = {
|
519
|
-
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
520
|
-
path_params: {'subscriptionId' => @client.subscription_id},
|
521
|
-
skip_encoding_path_params: {'policyAssignmentId' => policy_assignment_id},
|
522
|
-
query_params: {'api-version' => @client.api_version},
|
523
|
-
headers: request_headers.merge(custom_headers || {})
|
524
|
-
}
|
525
|
-
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
526
|
-
promise = request.run_promise do |req|
|
527
|
-
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
528
|
-
end
|
529
|
-
|
530
|
-
promise = promise.then do |http_response|
|
531
|
-
status_code = http_response.status
|
532
|
-
response_content = http_response.body
|
533
|
-
unless status_code == 200
|
534
|
-
error_model = JSON.load(response_content)
|
535
|
-
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
536
|
-
end
|
537
|
-
|
538
|
-
# Create Result
|
539
|
-
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
540
|
-
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
541
|
-
# Deserialize Response
|
542
|
-
if status_code == 200
|
543
|
-
begin
|
544
|
-
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
545
|
-
unless parsed_response.nil?
|
546
|
-
parsed_response = PolicyAssignment.deserialize_object(parsed_response)
|
547
|
-
end
|
548
|
-
result.body = parsed_response
|
549
|
-
rescue Exception => e
|
550
|
-
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
551
|
-
end
|
552
|
-
end
|
553
|
-
|
554
|
-
result
|
555
|
-
end
|
556
|
-
|
557
|
-
promise.execute
|
558
|
-
end
|
559
|
-
|
560
|
-
#
|
561
|
-
# Gets policy assignments of the subscription.
|
562
|
-
#
|
563
|
-
# @param filter [String] The filter to apply on the operation.
|
564
|
-
# @param [Hash{String => String}] The hash of custom headers need to be
|
565
|
-
# applied to HTTP request.
|
566
|
-
#
|
567
|
-
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
568
|
-
# response.
|
569
|
-
#
|
570
|
-
def list(filter = nil, custom_headers = nil)
|
571
|
-
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
572
|
-
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
573
|
-
request_headers = {}
|
574
|
-
|
575
|
-
# Set Headers
|
576
|
-
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
577
|
-
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
578
|
-
path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments'
|
579
|
-
options = {
|
580
|
-
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
581
|
-
path_params: {'subscriptionId' => @client.subscription_id},
|
582
|
-
query_params: {'api-version' => @client.api_version},
|
583
|
-
skip_encoding_query_params: {'$filter' => filter},
|
584
|
-
headers: request_headers.merge(custom_headers || {})
|
585
|
-
}
|
586
|
-
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
587
|
-
promise = request.run_promise do |req|
|
588
|
-
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
589
|
-
end
|
590
|
-
|
591
|
-
promise = promise.then do |http_response|
|
592
|
-
status_code = http_response.status
|
593
|
-
response_content = http_response.body
|
594
|
-
unless status_code == 200
|
595
|
-
error_model = JSON.load(response_content)
|
596
|
-
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
597
|
-
end
|
598
|
-
|
599
|
-
# Create Result
|
600
|
-
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
601
|
-
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
602
|
-
# Deserialize Response
|
603
|
-
if status_code == 200
|
604
|
-
begin
|
605
|
-
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
606
|
-
unless parsed_response.nil?
|
607
|
-
parsed_response = PolicyAssignmentListResult.deserialize_object(parsed_response)
|
608
|
-
end
|
609
|
-
result.body = parsed_response
|
610
|
-
rescue Exception => e
|
611
|
-
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
612
|
-
end
|
613
|
-
end
|
614
|
-
|
615
|
-
result
|
616
|
-
end
|
617
|
-
|
618
|
-
promise.execute
|
619
|
-
end
|
620
|
-
|
621
|
-
#
|
622
|
-
# Gets policy assignments of the scope.
|
623
|
-
#
|
624
|
-
# @param scope [String] Scope.
|
625
|
-
# @param filter [String] The filter to apply on the operation.
|
626
|
-
# @param [Hash{String => String}] The hash of custom headers need to be
|
627
|
-
# applied to HTTP request.
|
628
|
-
#
|
629
|
-
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
630
|
-
# response.
|
631
|
-
#
|
632
|
-
def list_for_scope(scope, filter = nil, custom_headers = nil)
|
633
|
-
fail ArgumentError, 'scope is nil' if scope.nil?
|
634
|
-
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
635
|
-
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
636
|
-
request_headers = {}
|
637
|
-
|
638
|
-
# Set Headers
|
639
|
-
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
640
|
-
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
641
|
-
path_template = '/{scope}/providers/Microsoft.Authorization/policyAssignments'
|
642
|
-
options = {
|
643
|
-
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
644
|
-
path_params: {'subscriptionId' => @client.subscription_id},
|
645
|
-
skip_encoding_path_params: {'scope' => scope},
|
646
|
-
query_params: {'api-version' => @client.api_version},
|
647
|
-
skip_encoding_query_params: {'$filter' => filter},
|
648
|
-
headers: request_headers.merge(custom_headers || {})
|
649
|
-
}
|
650
|
-
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
651
|
-
promise = request.run_promise do |req|
|
652
|
-
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
653
|
-
end
|
654
|
-
|
655
|
-
promise = promise.then do |http_response|
|
656
|
-
status_code = http_response.status
|
657
|
-
response_content = http_response.body
|
658
|
-
unless status_code == 200
|
659
|
-
error_model = JSON.load(response_content)
|
660
|
-
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
661
|
-
end
|
662
|
-
|
663
|
-
# Create Result
|
664
|
-
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
665
|
-
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
666
|
-
# Deserialize Response
|
667
|
-
if status_code == 200
|
668
|
-
begin
|
669
|
-
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
670
|
-
unless parsed_response.nil?
|
671
|
-
parsed_response = PolicyAssignmentListResult.deserialize_object(parsed_response)
|
672
|
-
end
|
673
|
-
result.body = parsed_response
|
674
|
-
rescue Exception => e
|
675
|
-
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
676
|
-
end
|
677
|
-
end
|
678
|
-
|
679
|
-
result
|
680
|
-
end
|
681
|
-
|
682
|
-
promise.execute
|
683
|
-
end
|
684
|
-
|
685
|
-
#
|
686
|
-
# Gets policy assignments of the resource.
|
687
|
-
#
|
688
|
-
# @param next_page_link [String] The NextLink from the previous successful
|
689
|
-
# call to List operation.
|
690
|
-
# @param [Hash{String => String}] The hash of custom headers need to be
|
691
|
-
# applied to HTTP request.
|
692
|
-
#
|
693
|
-
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
694
|
-
# response.
|
695
|
-
#
|
696
|
-
def list_for_resource_next(next_page_link, custom_headers = nil)
|
697
|
-
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
698
|
-
request_headers = {}
|
699
|
-
|
700
|
-
# Set Headers
|
701
|
-
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
702
|
-
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
703
|
-
path_template = '{nextLink}'
|
704
|
-
options = {
|
705
|
-
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
706
|
-
skip_encoding_path_params: {'nextLink' => next_page_link},
|
707
|
-
headers: request_headers.merge(custom_headers || {})
|
708
|
-
}
|
709
|
-
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
710
|
-
promise = request.run_promise do |req|
|
711
|
-
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
712
|
-
end
|
713
|
-
|
714
|
-
promise = promise.then do |http_response|
|
715
|
-
status_code = http_response.status
|
716
|
-
response_content = http_response.body
|
717
|
-
unless status_code == 200
|
718
|
-
error_model = JSON.load(response_content)
|
719
|
-
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
720
|
-
end
|
721
|
-
|
722
|
-
# Create Result
|
723
|
-
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
724
|
-
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
725
|
-
# Deserialize Response
|
726
|
-
if status_code == 200
|
727
|
-
begin
|
728
|
-
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
729
|
-
unless parsed_response.nil?
|
730
|
-
parsed_response = PolicyAssignmentListResult.deserialize_object(parsed_response)
|
731
|
-
end
|
732
|
-
result.body = parsed_response
|
733
|
-
rescue Exception => e
|
734
|
-
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
735
|
-
end
|
736
|
-
end
|
737
|
-
|
738
|
-
result
|
739
|
-
end
|
740
|
-
|
741
|
-
promise.execute
|
742
|
-
end
|
743
|
-
|
744
|
-
#
|
745
|
-
# Gets policy assignments of the resource group.
|
746
|
-
#
|
747
|
-
# @param next_page_link [String] The NextLink from the previous successful
|
748
|
-
# call to List operation.
|
749
|
-
# @param [Hash{String => String}] The hash of custom headers need to be
|
750
|
-
# applied to HTTP request.
|
751
|
-
#
|
752
|
-
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
753
|
-
# response.
|
754
|
-
#
|
755
|
-
def list_for_resource_group_next(next_page_link, custom_headers = nil)
|
756
|
-
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
757
|
-
request_headers = {}
|
758
|
-
|
759
|
-
# Set Headers
|
760
|
-
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
761
|
-
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
762
|
-
path_template = '{nextLink}'
|
763
|
-
options = {
|
764
|
-
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
765
|
-
skip_encoding_path_params: {'nextLink' => next_page_link},
|
766
|
-
headers: request_headers.merge(custom_headers || {})
|
767
|
-
}
|
768
|
-
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
769
|
-
promise = request.run_promise do |req|
|
770
|
-
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
771
|
-
end
|
772
|
-
|
773
|
-
promise = promise.then do |http_response|
|
774
|
-
status_code = http_response.status
|
775
|
-
response_content = http_response.body
|
776
|
-
unless status_code == 200
|
777
|
-
error_model = JSON.load(response_content)
|
778
|
-
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
779
|
-
end
|
780
|
-
|
781
|
-
# Create Result
|
782
|
-
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
783
|
-
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
784
|
-
# Deserialize Response
|
785
|
-
if status_code == 200
|
786
|
-
begin
|
787
|
-
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
788
|
-
unless parsed_response.nil?
|
789
|
-
parsed_response = PolicyAssignmentListResult.deserialize_object(parsed_response)
|
790
|
-
end
|
791
|
-
result.body = parsed_response
|
792
|
-
rescue Exception => e
|
793
|
-
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
794
|
-
end
|
795
|
-
end
|
796
|
-
|
797
|
-
result
|
798
|
-
end
|
799
|
-
|
800
|
-
promise.execute
|
801
|
-
end
|
802
|
-
|
803
|
-
#
|
804
|
-
# Gets policy assignments of the subscription.
|
805
|
-
#
|
806
|
-
# @param next_page_link [String] The NextLink from the previous successful
|
807
|
-
# call to List operation.
|
808
|
-
# @param [Hash{String => String}] The hash of custom headers need to be
|
809
|
-
# applied to HTTP request.
|
810
|
-
#
|
811
|
-
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
812
|
-
# response.
|
813
|
-
#
|
814
|
-
def list_next(next_page_link, custom_headers = nil)
|
815
|
-
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
816
|
-
request_headers = {}
|
817
|
-
|
818
|
-
# Set Headers
|
819
|
-
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
820
|
-
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
821
|
-
path_template = '{nextLink}'
|
822
|
-
options = {
|
823
|
-
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
824
|
-
skip_encoding_path_params: {'nextLink' => next_page_link},
|
825
|
-
headers: request_headers.merge(custom_headers || {})
|
826
|
-
}
|
827
|
-
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
828
|
-
promise = request.run_promise do |req|
|
829
|
-
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
830
|
-
end
|
831
|
-
|
832
|
-
promise = promise.then do |http_response|
|
833
|
-
status_code = http_response.status
|
834
|
-
response_content = http_response.body
|
835
|
-
unless status_code == 200
|
836
|
-
error_model = JSON.load(response_content)
|
837
|
-
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
838
|
-
end
|
839
|
-
|
840
|
-
# Create Result
|
841
|
-
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
842
|
-
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
843
|
-
# Deserialize Response
|
844
|
-
if status_code == 200
|
845
|
-
begin
|
846
|
-
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
847
|
-
unless parsed_response.nil?
|
848
|
-
parsed_response = PolicyAssignmentListResult.deserialize_object(parsed_response)
|
849
|
-
end
|
850
|
-
result.body = parsed_response
|
851
|
-
rescue Exception => e
|
852
|
-
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
853
|
-
end
|
854
|
-
end
|
855
|
-
|
856
|
-
result
|
857
|
-
end
|
858
|
-
|
859
|
-
promise.execute
|
860
|
-
end
|
861
|
-
|
862
|
-
#
|
863
|
-
# Gets policy assignments of the scope.
|
864
|
-
#
|
865
|
-
# @param next_page_link [String] The NextLink from the previous successful
|
866
|
-
# call to List operation.
|
867
|
-
# @param [Hash{String => String}] The hash of custom headers need to be
|
868
|
-
# applied to HTTP request.
|
869
|
-
#
|
870
|
-
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
871
|
-
# response.
|
872
|
-
#
|
873
|
-
def list_for_scope_next(next_page_link, custom_headers = nil)
|
874
|
-
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
875
|
-
request_headers = {}
|
876
|
-
|
877
|
-
# Set Headers
|
878
|
-
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
879
|
-
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
880
|
-
path_template = '{nextLink}'
|
881
|
-
options = {
|
882
|
-
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
883
|
-
skip_encoding_path_params: {'nextLink' => next_page_link},
|
884
|
-
headers: request_headers.merge(custom_headers || {})
|
885
|
-
}
|
886
|
-
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
887
|
-
promise = request.run_promise do |req|
|
888
|
-
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
889
|
-
end
|
890
|
-
|
891
|
-
promise = promise.then do |http_response|
|
892
|
-
status_code = http_response.status
|
893
|
-
response_content = http_response.body
|
894
|
-
unless status_code == 200
|
895
|
-
error_model = JSON.load(response_content)
|
896
|
-
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
897
|
-
end
|
898
|
-
|
899
|
-
# Create Result
|
900
|
-
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
901
|
-
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
902
|
-
# Deserialize Response
|
903
|
-
if status_code == 200
|
904
|
-
begin
|
905
|
-
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
906
|
-
unless parsed_response.nil?
|
907
|
-
parsed_response = PolicyAssignmentListResult.deserialize_object(parsed_response)
|
908
|
-
end
|
909
|
-
result.body = parsed_response
|
910
|
-
rescue Exception => e
|
911
|
-
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
912
|
-
end
|
913
|
-
end
|
914
|
-
|
915
|
-
result
|
916
|
-
end
|
917
|
-
|
918
|
-
promise.execute
|
919
|
-
end
|
920
|
-
|
921
|
-
end
|
922
|
-
end
|