azure_mgmt_authorization 0.16.1 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/{2015-06-01 → 2015-06-01-preview}/generated/azure_mgmt_authorization.rb +6 -6
- data/lib/{2015-06-01 → 2015-06-01-preview}/generated/azure_mgmt_authorization/authorization_management_client.rb +2 -2
- data/lib/{2015-06-01 → 2015-06-01-preview}/generated/azure_mgmt_authorization/classic_administrators.rb +3 -3
- data/lib/{2015-06-01 → 2015-06-01-preview}/generated/azure_mgmt_authorization/models/classic_administrator.rb +1 -1
- data/lib/{2015-06-01 → 2015-06-01-preview}/generated/azure_mgmt_authorization/models/classic_administrator_list_result.rb +1 -1
- data/lib/{2015-06-01 → 2015-06-01-preview}/generated/azure_mgmt_authorization/module_definition.rb +1 -1
- data/lib/2015-07-01-preview/generated/azure_mgmt_authorization.rb +39 -0
- data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/authorization_management_client.rb +139 -0
- data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/models/permission.rb +73 -0
- data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/models/permission_get_result.rb +98 -0
- data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/models/provider_operation.rb +90 -0
- data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/models/provider_operations_metadata.rb +119 -0
- data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/models/provider_operations_metadata_list_result.rb +98 -0
- data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/models/resource_type.rb +77 -0
- data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/models/role_definition.rb +143 -0
- data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/models/role_definition_filter.rb +46 -0
- data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/models/role_definition_list_result.rb +98 -0
- data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/module_definition.rb +9 -0
- data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/permissions.rb +460 -0
- data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/provider_operations_metadata_operations.rb +323 -0
- data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/role_definitions.rb +622 -0
- data/lib/2015-07-01/generated/azure_mgmt_authorization/authorization_management_client.rb +1 -1
- data/lib/2017-10-01-preview/generated/azure_mgmt_authorization/authorization_management_client.rb +1 -1
- data/lib/2018-01-01-preview/generated/azure_mgmt_authorization/authorization_management_client.rb +1 -1
- data/lib/azure_mgmt_authorization.rb +2 -1
- data/lib/profiles/latest/modules/authorization_profile_module.rb +6 -6
- data/lib/version.rb +1 -1
- metadata +23 -8
@@ -0,0 +1,323 @@
|
|
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::Authorization::Mgmt::V2015_07_01_preview
|
7
|
+
#
|
8
|
+
# Role based access control provides you a way to apply granular level policy
|
9
|
+
# administration down to individual resources or resource groups. These
|
10
|
+
# operations enable you to manage role definitions and role assignments. A
|
11
|
+
# role definition describes the set of actions that can be performed on
|
12
|
+
# resources. A role assignment grants access to Azure Active Directory users.
|
13
|
+
#
|
14
|
+
class ProviderOperationsMetadataOperations
|
15
|
+
include MsRestAzure
|
16
|
+
|
17
|
+
#
|
18
|
+
# Creates and initializes a new instance of the ProviderOperationsMetadataOperations class.
|
19
|
+
# @param client service class for accessing basic functionality.
|
20
|
+
#
|
21
|
+
def initialize(client)
|
22
|
+
@client = client
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [AuthorizationManagementClient] reference to the AuthorizationManagementClient
|
26
|
+
attr_reader :client
|
27
|
+
|
28
|
+
#
|
29
|
+
# Gets provider operations metadata for the specified resource provider.
|
30
|
+
#
|
31
|
+
# @param resource_provider_namespace [String] The namespace of the resource
|
32
|
+
# provider.
|
33
|
+
# @param api_version [String] The API version to use for the operation.
|
34
|
+
# @param expand [String] Specifies whether to expand the values.
|
35
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
36
|
+
# will be added to the HTTP request.
|
37
|
+
#
|
38
|
+
# @return [ProviderOperationsMetadata] operation results.
|
39
|
+
#
|
40
|
+
def get(resource_provider_namespace, api_version, expand:'resourceTypes', custom_headers:nil)
|
41
|
+
response = get_async(resource_provider_namespace, api_version, expand:expand, custom_headers:custom_headers).value!
|
42
|
+
response.body unless response.nil?
|
43
|
+
end
|
44
|
+
|
45
|
+
#
|
46
|
+
# Gets provider operations metadata for the specified resource provider.
|
47
|
+
#
|
48
|
+
# @param resource_provider_namespace [String] The namespace of the resource
|
49
|
+
# provider.
|
50
|
+
# @param api_version [String] The API version to use for the operation.
|
51
|
+
# @param expand [String] Specifies whether to expand the values.
|
52
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
53
|
+
# will be added to the HTTP request.
|
54
|
+
#
|
55
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
56
|
+
#
|
57
|
+
def get_with_http_info(resource_provider_namespace, api_version, expand:'resourceTypes', custom_headers:nil)
|
58
|
+
get_async(resource_provider_namespace, api_version, expand:expand, custom_headers:custom_headers).value!
|
59
|
+
end
|
60
|
+
|
61
|
+
#
|
62
|
+
# Gets provider operations metadata for the specified resource provider.
|
63
|
+
#
|
64
|
+
# @param resource_provider_namespace [String] The namespace of the resource
|
65
|
+
# provider.
|
66
|
+
# @param api_version [String] The API version to use for the operation.
|
67
|
+
# @param expand [String] Specifies whether to expand the values.
|
68
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
69
|
+
# to the HTTP request.
|
70
|
+
#
|
71
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
72
|
+
#
|
73
|
+
def get_async(resource_provider_namespace, api_version, expand:'resourceTypes', custom_headers:nil)
|
74
|
+
fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
|
75
|
+
fail ArgumentError, 'api_version is nil' if api_version.nil?
|
76
|
+
|
77
|
+
|
78
|
+
request_headers = {}
|
79
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
80
|
+
|
81
|
+
# Set Headers
|
82
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
83
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
84
|
+
path_template = 'providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}'
|
85
|
+
|
86
|
+
request_url = @base_url || @client.base_url
|
87
|
+
|
88
|
+
options = {
|
89
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
90
|
+
path_params: {'resourceProviderNamespace' => resource_provider_namespace},
|
91
|
+
query_params: {'api-version' => api_version,'$expand' => expand},
|
92
|
+
headers: request_headers.merge(custom_headers || {}),
|
93
|
+
base_url: request_url
|
94
|
+
}
|
95
|
+
promise = @client.make_request_async(:get, path_template, options)
|
96
|
+
|
97
|
+
promise = promise.then do |result|
|
98
|
+
http_response = result.response
|
99
|
+
status_code = http_response.status
|
100
|
+
response_content = http_response.body
|
101
|
+
unless status_code == 200
|
102
|
+
error_model = JSON.load(response_content)
|
103
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
104
|
+
end
|
105
|
+
|
106
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
107
|
+
# Deserialize Response
|
108
|
+
if status_code == 200
|
109
|
+
begin
|
110
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
111
|
+
result_mapper = Azure::Authorization::Mgmt::V2015_07_01_preview::Models::ProviderOperationsMetadata.mapper()
|
112
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
113
|
+
rescue Exception => e
|
114
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
result
|
119
|
+
end
|
120
|
+
|
121
|
+
promise.execute
|
122
|
+
end
|
123
|
+
|
124
|
+
#
|
125
|
+
# Gets provider operations metadata for all resource providers.
|
126
|
+
#
|
127
|
+
# @param api_version [String] The API version to use for this operation.
|
128
|
+
# @param expand [String] Specifies whether to expand the values.
|
129
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
130
|
+
# will be added to the HTTP request.
|
131
|
+
#
|
132
|
+
# @return [Array<ProviderOperationsMetadata>] operation results.
|
133
|
+
#
|
134
|
+
def list(api_version, expand:'resourceTypes', custom_headers:nil)
|
135
|
+
first_page = list_as_lazy(api_version, expand:expand, custom_headers:custom_headers)
|
136
|
+
first_page.get_all_items
|
137
|
+
end
|
138
|
+
|
139
|
+
#
|
140
|
+
# Gets provider operations metadata for all resource providers.
|
141
|
+
#
|
142
|
+
# @param api_version [String] The API version to use for this operation.
|
143
|
+
# @param expand [String] Specifies whether to expand the values.
|
144
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
145
|
+
# will be added to the HTTP request.
|
146
|
+
#
|
147
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
148
|
+
#
|
149
|
+
def list_with_http_info(api_version, expand:'resourceTypes', custom_headers:nil)
|
150
|
+
list_async(api_version, expand:expand, custom_headers:custom_headers).value!
|
151
|
+
end
|
152
|
+
|
153
|
+
#
|
154
|
+
# Gets provider operations metadata for all resource providers.
|
155
|
+
#
|
156
|
+
# @param api_version [String] The API version to use for this operation.
|
157
|
+
# @param expand [String] Specifies whether to expand the values.
|
158
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
159
|
+
# to the HTTP request.
|
160
|
+
#
|
161
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
162
|
+
#
|
163
|
+
def list_async(api_version, expand:'resourceTypes', custom_headers:nil)
|
164
|
+
fail ArgumentError, 'api_version is nil' if api_version.nil?
|
165
|
+
|
166
|
+
|
167
|
+
request_headers = {}
|
168
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
169
|
+
|
170
|
+
# Set Headers
|
171
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
172
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
173
|
+
path_template = 'providers/Microsoft.Authorization/providerOperations'
|
174
|
+
|
175
|
+
request_url = @base_url || @client.base_url
|
176
|
+
|
177
|
+
options = {
|
178
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
179
|
+
query_params: {'api-version' => api_version,'$expand' => expand},
|
180
|
+
headers: request_headers.merge(custom_headers || {}),
|
181
|
+
base_url: request_url
|
182
|
+
}
|
183
|
+
promise = @client.make_request_async(:get, path_template, options)
|
184
|
+
|
185
|
+
promise = promise.then do |result|
|
186
|
+
http_response = result.response
|
187
|
+
status_code = http_response.status
|
188
|
+
response_content = http_response.body
|
189
|
+
unless status_code == 200
|
190
|
+
error_model = JSON.load(response_content)
|
191
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
192
|
+
end
|
193
|
+
|
194
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
195
|
+
# Deserialize Response
|
196
|
+
if status_code == 200
|
197
|
+
begin
|
198
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
199
|
+
result_mapper = Azure::Authorization::Mgmt::V2015_07_01_preview::Models::ProviderOperationsMetadataListResult.mapper()
|
200
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
201
|
+
rescue Exception => e
|
202
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
result
|
207
|
+
end
|
208
|
+
|
209
|
+
promise.execute
|
210
|
+
end
|
211
|
+
|
212
|
+
#
|
213
|
+
# Gets provider operations metadata for all resource providers.
|
214
|
+
#
|
215
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
216
|
+
# to List operation.
|
217
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
218
|
+
# will be added to the HTTP request.
|
219
|
+
#
|
220
|
+
# @return [ProviderOperationsMetadataListResult] operation results.
|
221
|
+
#
|
222
|
+
def list_next(next_page_link, custom_headers:nil)
|
223
|
+
response = list_next_async(next_page_link, custom_headers:custom_headers).value!
|
224
|
+
response.body unless response.nil?
|
225
|
+
end
|
226
|
+
|
227
|
+
#
|
228
|
+
# Gets provider operations metadata for all resource providers.
|
229
|
+
#
|
230
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
231
|
+
# to List operation.
|
232
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
233
|
+
# will be added to the HTTP request.
|
234
|
+
#
|
235
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
236
|
+
#
|
237
|
+
def list_next_with_http_info(next_page_link, custom_headers:nil)
|
238
|
+
list_next_async(next_page_link, custom_headers:custom_headers).value!
|
239
|
+
end
|
240
|
+
|
241
|
+
#
|
242
|
+
# Gets provider operations metadata for all resource providers.
|
243
|
+
#
|
244
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
245
|
+
# to List operation.
|
246
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
247
|
+
# to the HTTP request.
|
248
|
+
#
|
249
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
250
|
+
#
|
251
|
+
def list_next_async(next_page_link, custom_headers:nil)
|
252
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
253
|
+
|
254
|
+
|
255
|
+
request_headers = {}
|
256
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
257
|
+
|
258
|
+
# Set Headers
|
259
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
260
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
261
|
+
path_template = '{nextLink}'
|
262
|
+
|
263
|
+
request_url = @base_url || @client.base_url
|
264
|
+
|
265
|
+
options = {
|
266
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
267
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
268
|
+
headers: request_headers.merge(custom_headers || {}),
|
269
|
+
base_url: request_url
|
270
|
+
}
|
271
|
+
promise = @client.make_request_async(:get, path_template, options)
|
272
|
+
|
273
|
+
promise = promise.then do |result|
|
274
|
+
http_response = result.response
|
275
|
+
status_code = http_response.status
|
276
|
+
response_content = http_response.body
|
277
|
+
unless status_code == 200
|
278
|
+
error_model = JSON.load(response_content)
|
279
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
280
|
+
end
|
281
|
+
|
282
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
283
|
+
# Deserialize Response
|
284
|
+
if status_code == 200
|
285
|
+
begin
|
286
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
287
|
+
result_mapper = Azure::Authorization::Mgmt::V2015_07_01_preview::Models::ProviderOperationsMetadataListResult.mapper()
|
288
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
289
|
+
rescue Exception => e
|
290
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
result
|
295
|
+
end
|
296
|
+
|
297
|
+
promise.execute
|
298
|
+
end
|
299
|
+
|
300
|
+
#
|
301
|
+
# Gets provider operations metadata for all resource providers.
|
302
|
+
#
|
303
|
+
# @param api_version [String] The API version to use for this operation.
|
304
|
+
# @param expand [String] Specifies whether to expand the values.
|
305
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
306
|
+
# will be added to the HTTP request.
|
307
|
+
#
|
308
|
+
# @return [ProviderOperationsMetadataListResult] which provide lazy access to
|
309
|
+
# pages of the response.
|
310
|
+
#
|
311
|
+
def list_as_lazy(api_version, expand:'resourceTypes', custom_headers:nil)
|
312
|
+
response = list_async(api_version, expand:expand, custom_headers:custom_headers).value!
|
313
|
+
unless response.nil?
|
314
|
+
page = response.body
|
315
|
+
page.next_method = Proc.new do |next_page_link|
|
316
|
+
list_next_async(next_page_link, custom_headers:custom_headers)
|
317
|
+
end
|
318
|
+
page
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
end
|
323
|
+
end
|
@@ -0,0 +1,622 @@
|
|
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::Authorization::Mgmt::V2015_07_01_preview
|
7
|
+
#
|
8
|
+
# Role based access control provides you a way to apply granular level policy
|
9
|
+
# administration down to individual resources or resource groups. These
|
10
|
+
# operations enable you to manage role definitions and role assignments. A
|
11
|
+
# role definition describes the set of actions that can be performed on
|
12
|
+
# resources. A role assignment grants access to Azure Active Directory users.
|
13
|
+
#
|
14
|
+
class RoleDefinitions
|
15
|
+
include MsRestAzure
|
16
|
+
|
17
|
+
#
|
18
|
+
# Creates and initializes a new instance of the RoleDefinitions class.
|
19
|
+
# @param client service class for accessing basic functionality.
|
20
|
+
#
|
21
|
+
def initialize(client)
|
22
|
+
@client = client
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [AuthorizationManagementClient] reference to the AuthorizationManagementClient
|
26
|
+
attr_reader :client
|
27
|
+
|
28
|
+
#
|
29
|
+
# Deletes a role definition.
|
30
|
+
#
|
31
|
+
# @param scope [String] The scope of the role definition.
|
32
|
+
# @param role_definition_id [String] The ID of the role definition to delete.
|
33
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
34
|
+
# will be added to the HTTP request.
|
35
|
+
#
|
36
|
+
# @return [RoleDefinition] operation results.
|
37
|
+
#
|
38
|
+
def delete(scope, role_definition_id, custom_headers:nil)
|
39
|
+
response = delete_async(scope, role_definition_id, custom_headers:custom_headers).value!
|
40
|
+
response.body unless response.nil?
|
41
|
+
end
|
42
|
+
|
43
|
+
#
|
44
|
+
# Deletes a role definition.
|
45
|
+
#
|
46
|
+
# @param scope [String] The scope of the role definition.
|
47
|
+
# @param role_definition_id [String] The ID of the role definition to delete.
|
48
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
49
|
+
# will be added to the HTTP request.
|
50
|
+
#
|
51
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
52
|
+
#
|
53
|
+
def delete_with_http_info(scope, role_definition_id, custom_headers:nil)
|
54
|
+
delete_async(scope, role_definition_id, custom_headers:custom_headers).value!
|
55
|
+
end
|
56
|
+
|
57
|
+
#
|
58
|
+
# Deletes a role definition.
|
59
|
+
#
|
60
|
+
# @param scope [String] The scope of the role definition.
|
61
|
+
# @param role_definition_id [String] The ID of the role definition to delete.
|
62
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
63
|
+
# to the HTTP request.
|
64
|
+
#
|
65
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
66
|
+
#
|
67
|
+
def delete_async(scope, role_definition_id, custom_headers:nil)
|
68
|
+
fail ArgumentError, 'scope is nil' if scope.nil?
|
69
|
+
fail ArgumentError, 'role_definition_id is nil' if role_definition_id.nil?
|
70
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
71
|
+
|
72
|
+
|
73
|
+
request_headers = {}
|
74
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
75
|
+
|
76
|
+
# Set Headers
|
77
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
78
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
79
|
+
path_template = '{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}'
|
80
|
+
|
81
|
+
request_url = @base_url || @client.base_url
|
82
|
+
|
83
|
+
options = {
|
84
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
85
|
+
path_params: {'roleDefinitionId' => role_definition_id},
|
86
|
+
skip_encoding_path_params: {'scope' => scope},
|
87
|
+
query_params: {'api-version' => @client.api_version},
|
88
|
+
headers: request_headers.merge(custom_headers || {}),
|
89
|
+
base_url: request_url
|
90
|
+
}
|
91
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
92
|
+
|
93
|
+
promise = promise.then do |result|
|
94
|
+
http_response = result.response
|
95
|
+
status_code = http_response.status
|
96
|
+
response_content = http_response.body
|
97
|
+
unless status_code == 200
|
98
|
+
error_model = JSON.load(response_content)
|
99
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
100
|
+
end
|
101
|
+
|
102
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
103
|
+
# Deserialize Response
|
104
|
+
if status_code == 200
|
105
|
+
begin
|
106
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
107
|
+
result_mapper = Azure::Authorization::Mgmt::V2015_07_01_preview::Models::RoleDefinition.mapper()
|
108
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
109
|
+
rescue Exception => e
|
110
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
result
|
115
|
+
end
|
116
|
+
|
117
|
+
promise.execute
|
118
|
+
end
|
119
|
+
|
120
|
+
#
|
121
|
+
# Get role definition by name (GUID).
|
122
|
+
#
|
123
|
+
# @param scope [String] The scope of the role definition.
|
124
|
+
# @param role_definition_id [String] The ID of the role definition.
|
125
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
126
|
+
# will be added to the HTTP request.
|
127
|
+
#
|
128
|
+
# @return [RoleDefinition] operation results.
|
129
|
+
#
|
130
|
+
def get(scope, role_definition_id, custom_headers:nil)
|
131
|
+
response = get_async(scope, role_definition_id, custom_headers:custom_headers).value!
|
132
|
+
response.body unless response.nil?
|
133
|
+
end
|
134
|
+
|
135
|
+
#
|
136
|
+
# Get role definition by name (GUID).
|
137
|
+
#
|
138
|
+
# @param scope [String] The scope of the role definition.
|
139
|
+
# @param role_definition_id [String] The ID of the role definition.
|
140
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
141
|
+
# will be added to the HTTP request.
|
142
|
+
#
|
143
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
144
|
+
#
|
145
|
+
def get_with_http_info(scope, role_definition_id, custom_headers:nil)
|
146
|
+
get_async(scope, role_definition_id, custom_headers:custom_headers).value!
|
147
|
+
end
|
148
|
+
|
149
|
+
#
|
150
|
+
# Get role definition by name (GUID).
|
151
|
+
#
|
152
|
+
# @param scope [String] The scope of the role definition.
|
153
|
+
# @param role_definition_id [String] The ID of the role definition.
|
154
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
155
|
+
# to the HTTP request.
|
156
|
+
#
|
157
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
158
|
+
#
|
159
|
+
def get_async(scope, role_definition_id, custom_headers:nil)
|
160
|
+
fail ArgumentError, 'scope is nil' if scope.nil?
|
161
|
+
fail ArgumentError, 'role_definition_id is nil' if role_definition_id.nil?
|
162
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
163
|
+
|
164
|
+
|
165
|
+
request_headers = {}
|
166
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
167
|
+
|
168
|
+
# Set Headers
|
169
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
170
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
171
|
+
path_template = '{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}'
|
172
|
+
|
173
|
+
request_url = @base_url || @client.base_url
|
174
|
+
|
175
|
+
options = {
|
176
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
177
|
+
path_params: {'roleDefinitionId' => role_definition_id},
|
178
|
+
skip_encoding_path_params: {'scope' => scope},
|
179
|
+
query_params: {'api-version' => @client.api_version},
|
180
|
+
headers: request_headers.merge(custom_headers || {}),
|
181
|
+
base_url: request_url
|
182
|
+
}
|
183
|
+
promise = @client.make_request_async(:get, path_template, options)
|
184
|
+
|
185
|
+
promise = promise.then do |result|
|
186
|
+
http_response = result.response
|
187
|
+
status_code = http_response.status
|
188
|
+
response_content = http_response.body
|
189
|
+
unless status_code == 200
|
190
|
+
error_model = JSON.load(response_content)
|
191
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
192
|
+
end
|
193
|
+
|
194
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
195
|
+
# Deserialize Response
|
196
|
+
if status_code == 200
|
197
|
+
begin
|
198
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
199
|
+
result_mapper = Azure::Authorization::Mgmt::V2015_07_01_preview::Models::RoleDefinition.mapper()
|
200
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
201
|
+
rescue Exception => e
|
202
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
result
|
207
|
+
end
|
208
|
+
|
209
|
+
promise.execute
|
210
|
+
end
|
211
|
+
|
212
|
+
#
|
213
|
+
# Creates or updates a role definition.
|
214
|
+
#
|
215
|
+
# @param scope [String] The scope of the role definition.
|
216
|
+
# @param role_definition_id [String] The ID of the role definition.
|
217
|
+
# @param role_definition [RoleDefinition] The values for the role definition.
|
218
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
219
|
+
# will be added to the HTTP request.
|
220
|
+
#
|
221
|
+
# @return [RoleDefinition] operation results.
|
222
|
+
#
|
223
|
+
def create_or_update(scope, role_definition_id, role_definition, custom_headers:nil)
|
224
|
+
response = create_or_update_async(scope, role_definition_id, role_definition, custom_headers:custom_headers).value!
|
225
|
+
response.body unless response.nil?
|
226
|
+
end
|
227
|
+
|
228
|
+
#
|
229
|
+
# Creates or updates a role definition.
|
230
|
+
#
|
231
|
+
# @param scope [String] The scope of the role definition.
|
232
|
+
# @param role_definition_id [String] The ID of the role definition.
|
233
|
+
# @param role_definition [RoleDefinition] The values for the role definition.
|
234
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
235
|
+
# will be added to the HTTP request.
|
236
|
+
#
|
237
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
238
|
+
#
|
239
|
+
def create_or_update_with_http_info(scope, role_definition_id, role_definition, custom_headers:nil)
|
240
|
+
create_or_update_async(scope, role_definition_id, role_definition, custom_headers:custom_headers).value!
|
241
|
+
end
|
242
|
+
|
243
|
+
#
|
244
|
+
# Creates or updates a role definition.
|
245
|
+
#
|
246
|
+
# @param scope [String] The scope of the role definition.
|
247
|
+
# @param role_definition_id [String] The ID of the role definition.
|
248
|
+
# @param role_definition [RoleDefinition] The values for the role definition.
|
249
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
250
|
+
# to the HTTP request.
|
251
|
+
#
|
252
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
253
|
+
#
|
254
|
+
def create_or_update_async(scope, role_definition_id, role_definition, custom_headers:nil)
|
255
|
+
fail ArgumentError, 'scope is nil' if scope.nil?
|
256
|
+
fail ArgumentError, 'role_definition_id is nil' if role_definition_id.nil?
|
257
|
+
fail ArgumentError, 'role_definition is nil' if role_definition.nil?
|
258
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
259
|
+
|
260
|
+
|
261
|
+
request_headers = {}
|
262
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
263
|
+
|
264
|
+
# Set Headers
|
265
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
266
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
267
|
+
|
268
|
+
# Serialize Request
|
269
|
+
request_mapper = Azure::Authorization::Mgmt::V2015_07_01_preview::Models::RoleDefinition.mapper()
|
270
|
+
request_content = @client.serialize(request_mapper, role_definition)
|
271
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
272
|
+
|
273
|
+
path_template = '{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}'
|
274
|
+
|
275
|
+
request_url = @base_url || @client.base_url
|
276
|
+
|
277
|
+
options = {
|
278
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
279
|
+
path_params: {'roleDefinitionId' => role_definition_id},
|
280
|
+
skip_encoding_path_params: {'scope' => scope},
|
281
|
+
query_params: {'api-version' => @client.api_version},
|
282
|
+
body: request_content,
|
283
|
+
headers: request_headers.merge(custom_headers || {}),
|
284
|
+
base_url: request_url
|
285
|
+
}
|
286
|
+
promise = @client.make_request_async(:put, path_template, options)
|
287
|
+
|
288
|
+
promise = promise.then do |result|
|
289
|
+
http_response = result.response
|
290
|
+
status_code = http_response.status
|
291
|
+
response_content = http_response.body
|
292
|
+
unless status_code == 201
|
293
|
+
error_model = JSON.load(response_content)
|
294
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
295
|
+
end
|
296
|
+
|
297
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
298
|
+
# Deserialize Response
|
299
|
+
if status_code == 201
|
300
|
+
begin
|
301
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
302
|
+
result_mapper = Azure::Authorization::Mgmt::V2015_07_01_preview::Models::RoleDefinition.mapper()
|
303
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
304
|
+
rescue Exception => e
|
305
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
result
|
310
|
+
end
|
311
|
+
|
312
|
+
promise.execute
|
313
|
+
end
|
314
|
+
|
315
|
+
#
|
316
|
+
# Gets a role definition by ID.
|
317
|
+
#
|
318
|
+
# @param role_definition_id [String] The fully qualified role definition ID.
|
319
|
+
# Use the format,
|
320
|
+
# /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}
|
321
|
+
# for subscription level role definitions, or
|
322
|
+
# /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for
|
323
|
+
# tenant level role definitions.
|
324
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
325
|
+
# will be added to the HTTP request.
|
326
|
+
#
|
327
|
+
# @return [RoleDefinition] operation results.
|
328
|
+
#
|
329
|
+
def get_by_id(role_definition_id, custom_headers:nil)
|
330
|
+
response = get_by_id_async(role_definition_id, custom_headers:custom_headers).value!
|
331
|
+
response.body unless response.nil?
|
332
|
+
end
|
333
|
+
|
334
|
+
#
|
335
|
+
# Gets a role definition by ID.
|
336
|
+
#
|
337
|
+
# @param role_definition_id [String] The fully qualified role definition ID.
|
338
|
+
# Use the format,
|
339
|
+
# /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}
|
340
|
+
# for subscription level role definitions, or
|
341
|
+
# /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for
|
342
|
+
# tenant level role definitions.
|
343
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
344
|
+
# will be added to the HTTP request.
|
345
|
+
#
|
346
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
347
|
+
#
|
348
|
+
def get_by_id_with_http_info(role_definition_id, custom_headers:nil)
|
349
|
+
get_by_id_async(role_definition_id, custom_headers:custom_headers).value!
|
350
|
+
end
|
351
|
+
|
352
|
+
#
|
353
|
+
# Gets a role definition by ID.
|
354
|
+
#
|
355
|
+
# @param role_definition_id [String] The fully qualified role definition ID.
|
356
|
+
# Use the format,
|
357
|
+
# /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}
|
358
|
+
# for subscription level role definitions, or
|
359
|
+
# /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for
|
360
|
+
# tenant level role definitions.
|
361
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
362
|
+
# to the HTTP request.
|
363
|
+
#
|
364
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
365
|
+
#
|
366
|
+
def get_by_id_async(role_definition_id, custom_headers:nil)
|
367
|
+
fail ArgumentError, 'role_definition_id is nil' if role_definition_id.nil?
|
368
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
369
|
+
|
370
|
+
|
371
|
+
request_headers = {}
|
372
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
373
|
+
|
374
|
+
# Set Headers
|
375
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
376
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
377
|
+
path_template = '{roleDefinitionId}'
|
378
|
+
|
379
|
+
request_url = @base_url || @client.base_url
|
380
|
+
|
381
|
+
options = {
|
382
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
383
|
+
skip_encoding_path_params: {'roleDefinitionId' => role_definition_id},
|
384
|
+
query_params: {'api-version' => @client.api_version},
|
385
|
+
headers: request_headers.merge(custom_headers || {}),
|
386
|
+
base_url: request_url
|
387
|
+
}
|
388
|
+
promise = @client.make_request_async(:get, path_template, options)
|
389
|
+
|
390
|
+
promise = promise.then do |result|
|
391
|
+
http_response = result.response
|
392
|
+
status_code = http_response.status
|
393
|
+
response_content = http_response.body
|
394
|
+
unless status_code == 200
|
395
|
+
error_model = JSON.load(response_content)
|
396
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
397
|
+
end
|
398
|
+
|
399
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
400
|
+
# Deserialize Response
|
401
|
+
if status_code == 200
|
402
|
+
begin
|
403
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
404
|
+
result_mapper = Azure::Authorization::Mgmt::V2015_07_01_preview::Models::RoleDefinition.mapper()
|
405
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
406
|
+
rescue Exception => e
|
407
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
408
|
+
end
|
409
|
+
end
|
410
|
+
|
411
|
+
result
|
412
|
+
end
|
413
|
+
|
414
|
+
promise.execute
|
415
|
+
end
|
416
|
+
|
417
|
+
#
|
418
|
+
# Get all role definitions that are applicable at scope and above.
|
419
|
+
#
|
420
|
+
# @param scope [String] The scope of the role definition.
|
421
|
+
# @param filter [String] The filter to apply on the operation. Use
|
422
|
+
# atScopeAndBelow filter to search below the given scope as well.
|
423
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
424
|
+
# will be added to the HTTP request.
|
425
|
+
#
|
426
|
+
# @return [Array<RoleDefinition>] operation results.
|
427
|
+
#
|
428
|
+
def list(scope, filter:nil, custom_headers:nil)
|
429
|
+
first_page = list_as_lazy(scope, filter:filter, custom_headers:custom_headers)
|
430
|
+
first_page.get_all_items
|
431
|
+
end
|
432
|
+
|
433
|
+
#
|
434
|
+
# Get all role definitions that are applicable at scope and above.
|
435
|
+
#
|
436
|
+
# @param scope [String] The scope of the role definition.
|
437
|
+
# @param filter [String] The filter to apply on the operation. Use
|
438
|
+
# atScopeAndBelow filter to search below the given scope as well.
|
439
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
440
|
+
# will be added to the HTTP request.
|
441
|
+
#
|
442
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
443
|
+
#
|
444
|
+
def list_with_http_info(scope, filter:nil, custom_headers:nil)
|
445
|
+
list_async(scope, filter:filter, custom_headers:custom_headers).value!
|
446
|
+
end
|
447
|
+
|
448
|
+
#
|
449
|
+
# Get all role definitions that are applicable at scope and above.
|
450
|
+
#
|
451
|
+
# @param scope [String] The scope of the role definition.
|
452
|
+
# @param filter [String] The filter to apply on the operation. Use
|
453
|
+
# atScopeAndBelow filter to search below the given scope as well.
|
454
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
455
|
+
# to the HTTP request.
|
456
|
+
#
|
457
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
458
|
+
#
|
459
|
+
def list_async(scope, filter:nil, custom_headers:nil)
|
460
|
+
fail ArgumentError, 'scope is nil' if scope.nil?
|
461
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
462
|
+
|
463
|
+
|
464
|
+
request_headers = {}
|
465
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
466
|
+
|
467
|
+
# Set Headers
|
468
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
469
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
470
|
+
path_template = '{scope}/providers/Microsoft.Authorization/roleDefinitions'
|
471
|
+
|
472
|
+
request_url = @base_url || @client.base_url
|
473
|
+
|
474
|
+
options = {
|
475
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
476
|
+
skip_encoding_path_params: {'scope' => scope},
|
477
|
+
query_params: {'$filter' => filter,'api-version' => @client.api_version},
|
478
|
+
headers: request_headers.merge(custom_headers || {}),
|
479
|
+
base_url: request_url
|
480
|
+
}
|
481
|
+
promise = @client.make_request_async(:get, path_template, options)
|
482
|
+
|
483
|
+
promise = promise.then do |result|
|
484
|
+
http_response = result.response
|
485
|
+
status_code = http_response.status
|
486
|
+
response_content = http_response.body
|
487
|
+
unless status_code == 200
|
488
|
+
error_model = JSON.load(response_content)
|
489
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
490
|
+
end
|
491
|
+
|
492
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
493
|
+
# Deserialize Response
|
494
|
+
if status_code == 200
|
495
|
+
begin
|
496
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
497
|
+
result_mapper = Azure::Authorization::Mgmt::V2015_07_01_preview::Models::RoleDefinitionListResult.mapper()
|
498
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
499
|
+
rescue Exception => e
|
500
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
501
|
+
end
|
502
|
+
end
|
503
|
+
|
504
|
+
result
|
505
|
+
end
|
506
|
+
|
507
|
+
promise.execute
|
508
|
+
end
|
509
|
+
|
510
|
+
#
|
511
|
+
# Get all role definitions that are applicable at scope and above.
|
512
|
+
#
|
513
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
514
|
+
# to List operation.
|
515
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
516
|
+
# will be added to the HTTP request.
|
517
|
+
#
|
518
|
+
# @return [RoleDefinitionListResult] operation results.
|
519
|
+
#
|
520
|
+
def list_next(next_page_link, custom_headers:nil)
|
521
|
+
response = list_next_async(next_page_link, custom_headers:custom_headers).value!
|
522
|
+
response.body unless response.nil?
|
523
|
+
end
|
524
|
+
|
525
|
+
#
|
526
|
+
# Get all role definitions that are applicable at scope and above.
|
527
|
+
#
|
528
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
529
|
+
# to List operation.
|
530
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
531
|
+
# will be added to the HTTP request.
|
532
|
+
#
|
533
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
534
|
+
#
|
535
|
+
def list_next_with_http_info(next_page_link, custom_headers:nil)
|
536
|
+
list_next_async(next_page_link, custom_headers:custom_headers).value!
|
537
|
+
end
|
538
|
+
|
539
|
+
#
|
540
|
+
# Get all role definitions that are applicable at scope and above.
|
541
|
+
#
|
542
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
543
|
+
# to List operation.
|
544
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
545
|
+
# to the HTTP request.
|
546
|
+
#
|
547
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
548
|
+
#
|
549
|
+
def list_next_async(next_page_link, custom_headers:nil)
|
550
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
551
|
+
|
552
|
+
|
553
|
+
request_headers = {}
|
554
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
555
|
+
|
556
|
+
# Set Headers
|
557
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
558
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
559
|
+
path_template = '{nextLink}'
|
560
|
+
|
561
|
+
request_url = @base_url || @client.base_url
|
562
|
+
|
563
|
+
options = {
|
564
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
565
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
566
|
+
headers: request_headers.merge(custom_headers || {}),
|
567
|
+
base_url: request_url
|
568
|
+
}
|
569
|
+
promise = @client.make_request_async(:get, path_template, options)
|
570
|
+
|
571
|
+
promise = promise.then do |result|
|
572
|
+
http_response = result.response
|
573
|
+
status_code = http_response.status
|
574
|
+
response_content = http_response.body
|
575
|
+
unless status_code == 200
|
576
|
+
error_model = JSON.load(response_content)
|
577
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
578
|
+
end
|
579
|
+
|
580
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
581
|
+
# Deserialize Response
|
582
|
+
if status_code == 200
|
583
|
+
begin
|
584
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
585
|
+
result_mapper = Azure::Authorization::Mgmt::V2015_07_01_preview::Models::RoleDefinitionListResult.mapper()
|
586
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
587
|
+
rescue Exception => e
|
588
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
589
|
+
end
|
590
|
+
end
|
591
|
+
|
592
|
+
result
|
593
|
+
end
|
594
|
+
|
595
|
+
promise.execute
|
596
|
+
end
|
597
|
+
|
598
|
+
#
|
599
|
+
# Get all role definitions that are applicable at scope and above.
|
600
|
+
#
|
601
|
+
# @param scope [String] The scope of the role definition.
|
602
|
+
# @param filter [String] The filter to apply on the operation. Use
|
603
|
+
# atScopeAndBelow filter to search below the given scope as well.
|
604
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
605
|
+
# will be added to the HTTP request.
|
606
|
+
#
|
607
|
+
# @return [RoleDefinitionListResult] which provide lazy access to pages of the
|
608
|
+
# response.
|
609
|
+
#
|
610
|
+
def list_as_lazy(scope, filter:nil, custom_headers:nil)
|
611
|
+
response = list_async(scope, filter:filter, custom_headers:custom_headers).value!
|
612
|
+
unless response.nil?
|
613
|
+
page = response.body
|
614
|
+
page.next_method = Proc.new do |next_page_link|
|
615
|
+
list_next_async(next_page_link, custom_headers:custom_headers)
|
616
|
+
end
|
617
|
+
page
|
618
|
+
end
|
619
|
+
end
|
620
|
+
|
621
|
+
end
|
622
|
+
end
|