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.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/lib/{2015-06-01 → 2015-06-01-preview}/generated/azure_mgmt_authorization.rb +6 -6
  3. data/lib/{2015-06-01 → 2015-06-01-preview}/generated/azure_mgmt_authorization/authorization_management_client.rb +2 -2
  4. data/lib/{2015-06-01 → 2015-06-01-preview}/generated/azure_mgmt_authorization/classic_administrators.rb +3 -3
  5. data/lib/{2015-06-01 → 2015-06-01-preview}/generated/azure_mgmt_authorization/models/classic_administrator.rb +1 -1
  6. data/lib/{2015-06-01 → 2015-06-01-preview}/generated/azure_mgmt_authorization/models/classic_administrator_list_result.rb +1 -1
  7. data/lib/{2015-06-01 → 2015-06-01-preview}/generated/azure_mgmt_authorization/module_definition.rb +1 -1
  8. data/lib/2015-07-01-preview/generated/azure_mgmt_authorization.rb +39 -0
  9. data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/authorization_management_client.rb +139 -0
  10. data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/models/permission.rb +73 -0
  11. data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/models/permission_get_result.rb +98 -0
  12. data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/models/provider_operation.rb +90 -0
  13. data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/models/provider_operations_metadata.rb +119 -0
  14. data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/models/provider_operations_metadata_list_result.rb +98 -0
  15. data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/models/resource_type.rb +77 -0
  16. data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/models/role_definition.rb +143 -0
  17. data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/models/role_definition_filter.rb +46 -0
  18. data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/models/role_definition_list_result.rb +98 -0
  19. data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/module_definition.rb +9 -0
  20. data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/permissions.rb +460 -0
  21. data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/provider_operations_metadata_operations.rb +323 -0
  22. data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/role_definitions.rb +622 -0
  23. data/lib/2015-07-01/generated/azure_mgmt_authorization/authorization_management_client.rb +1 -1
  24. data/lib/2017-10-01-preview/generated/azure_mgmt_authorization/authorization_management_client.rb +1 -1
  25. data/lib/2018-01-01-preview/generated/azure_mgmt_authorization/authorization_management_client.rb +1 -1
  26. data/lib/azure_mgmt_authorization.rb +2 -1
  27. data/lib/profiles/latest/modules/authorization_profile_module.rb +6 -6
  28. data/lib/version.rb +1 -1
  29. metadata +23 -8
@@ -0,0 +1,46 @@
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
+ module Models
8
+ #
9
+ # Role Definitions filter
10
+ #
11
+ class RoleDefinitionFilter
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] Returns role definition with the specific name.
16
+ attr_accessor :role_name
17
+
18
+
19
+ #
20
+ # Mapper for RoleDefinitionFilter class as Ruby Hash.
21
+ # This will be used for serialization/deserialization.
22
+ #
23
+ def self.mapper()
24
+ {
25
+ client_side_validation: true,
26
+ required: false,
27
+ serialized_name: 'RoleDefinitionFilter',
28
+ type: {
29
+ name: 'Composite',
30
+ class_name: 'RoleDefinitionFilter',
31
+ model_properties: {
32
+ role_name: {
33
+ client_side_validation: true,
34
+ required: false,
35
+ serialized_name: 'roleName',
36
+ type: {
37
+ name: 'String'
38
+ }
39
+ }
40
+ }
41
+ }
42
+ }
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,98 @@
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
+ module Models
8
+ #
9
+ # Role definition list operation result.
10
+ #
11
+ class RoleDefinitionListResult
12
+
13
+ include MsRestAzure
14
+
15
+ include MsRest::JSONable
16
+ # @return [Array<RoleDefinition>] Role definition list.
17
+ attr_accessor :value
18
+
19
+ # @return [String] The URL to use for getting the next set of results.
20
+ attr_accessor :next_link
21
+
22
+ # return [Proc] with next page method call.
23
+ attr_accessor :next_method
24
+
25
+ #
26
+ # Gets the rest of the items for the request, enabling auto-pagination.
27
+ #
28
+ # @return [Array<RoleDefinition>] operation results.
29
+ #
30
+ def get_all_items
31
+ items = @value
32
+ page = self
33
+ while page.next_link != nil do
34
+ page = page.get_next_page
35
+ items.concat(page.value)
36
+ end
37
+ items
38
+ end
39
+
40
+ #
41
+ # Gets the next page of results.
42
+ #
43
+ # @return [RoleDefinitionListResult] with next page content.
44
+ #
45
+ def get_next_page
46
+ response = @next_method.call(@next_link).value! unless @next_method.nil?
47
+ unless response.nil?
48
+ @next_link = response.body.next_link
49
+ @value = response.body.value
50
+ self
51
+ end
52
+ end
53
+
54
+ #
55
+ # Mapper for RoleDefinitionListResult class as Ruby Hash.
56
+ # This will be used for serialization/deserialization.
57
+ #
58
+ def self.mapper()
59
+ {
60
+ client_side_validation: true,
61
+ required: false,
62
+ serialized_name: 'RoleDefinitionListResult',
63
+ type: {
64
+ name: 'Composite',
65
+ class_name: 'RoleDefinitionListResult',
66
+ model_properties: {
67
+ value: {
68
+ client_side_validation: true,
69
+ required: false,
70
+ serialized_name: 'value',
71
+ type: {
72
+ name: 'Sequence',
73
+ element: {
74
+ client_side_validation: true,
75
+ required: false,
76
+ serialized_name: 'RoleDefinitionElementType',
77
+ type: {
78
+ name: 'Composite',
79
+ class_name: 'RoleDefinition'
80
+ }
81
+ }
82
+ }
83
+ },
84
+ next_link: {
85
+ client_side_validation: true,
86
+ required: false,
87
+ serialized_name: 'nextLink',
88
+ type: {
89
+ name: 'String'
90
+ }
91
+ }
92
+ }
93
+ }
94
+ }
95
+ end
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure end
7
+ module Azure::Authorization end
8
+ module Azure::Authorization::Mgmt end
9
+ module Azure::Authorization::Mgmt::V2015_07_01_preview end
@@ -0,0 +1,460 @@
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 Permissions
15
+ include MsRestAzure
16
+
17
+ #
18
+ # Creates and initializes a new instance of the Permissions 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 all permissions the caller has for a resource group.
30
+ #
31
+ # @param resource_group_name [String] The name of the resource group to get the
32
+ # permissions for. The name is case insensitive.
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
+ #
36
+ # @return [Array<Permission>] operation results.
37
+ #
38
+ def list_for_resource_group(resource_group_name, custom_headers:nil)
39
+ first_page = list_for_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
40
+ first_page.get_all_items
41
+ end
42
+
43
+ #
44
+ # Gets all permissions the caller has for a resource group.
45
+ #
46
+ # @param resource_group_name [String] The name of the resource group to get the
47
+ # permissions for. The name is case insensitive.
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 list_for_resource_group_with_http_info(resource_group_name, custom_headers:nil)
54
+ list_for_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
55
+ end
56
+
57
+ #
58
+ # Gets all permissions the caller has for a resource group.
59
+ #
60
+ # @param resource_group_name [String] The name of the resource group to get the
61
+ # permissions for. The name is case insensitive.
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 list_for_resource_group_async(resource_group_name, custom_headers:nil)
68
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
69
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
70
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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 = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions'
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: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
86
+ query_params: {'api-version' => @client.api_version},
87
+ headers: request_headers.merge(custom_headers || {}),
88
+ base_url: request_url
89
+ }
90
+ promise = @client.make_request_async(:get, path_template, options)
91
+
92
+ promise = promise.then do |result|
93
+ http_response = result.response
94
+ status_code = http_response.status
95
+ response_content = http_response.body
96
+ unless status_code == 200
97
+ error_model = JSON.load(response_content)
98
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
99
+ end
100
+
101
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
102
+ # Deserialize Response
103
+ if status_code == 200
104
+ begin
105
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
106
+ result_mapper = Azure::Authorization::Mgmt::V2015_07_01_preview::Models::PermissionGetResult.mapper()
107
+ result.body = @client.deserialize(result_mapper, parsed_response)
108
+ rescue Exception => e
109
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
110
+ end
111
+ end
112
+
113
+ result
114
+ end
115
+
116
+ promise.execute
117
+ end
118
+
119
+ #
120
+ # Gets all permissions the caller has for a resource.
121
+ #
122
+ # @param resource_group_name [String] The name of the resource group containing
123
+ # the resource. The name is case insensitive.
124
+ # @param resource_provider_namespace [String] The namespace of the resource
125
+ # provider.
126
+ # @param parent_resource_path [String] The parent resource identity.
127
+ # @param resource_type [String] The resource type of the resource.
128
+ # @param resource_name [String] The name of the resource to get the permissions
129
+ # for.
130
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
131
+ # will be added to the HTTP request.
132
+ #
133
+ # @return [Array<Permission>] operation results.
134
+ #
135
+ def list_for_resource(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, custom_headers:nil)
136
+ first_page = list_for_resource_as_lazy(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, custom_headers:custom_headers)
137
+ first_page.get_all_items
138
+ end
139
+
140
+ #
141
+ # Gets all permissions the caller has for a resource.
142
+ #
143
+ # @param resource_group_name [String] The name of the resource group containing
144
+ # the resource. The name is case insensitive.
145
+ # @param resource_provider_namespace [String] The namespace of the resource
146
+ # provider.
147
+ # @param parent_resource_path [String] The parent resource identity.
148
+ # @param resource_type [String] The resource type of the resource.
149
+ # @param resource_name [String] The name of the resource to get the permissions
150
+ # for.
151
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
152
+ # will be added to the HTTP request.
153
+ #
154
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
155
+ #
156
+ def list_for_resource_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, custom_headers:nil)
157
+ list_for_resource_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, custom_headers:custom_headers).value!
158
+ end
159
+
160
+ #
161
+ # Gets all permissions the caller has for a resource.
162
+ #
163
+ # @param resource_group_name [String] The name of the resource group containing
164
+ # the resource. The name is case insensitive.
165
+ # @param resource_provider_namespace [String] The namespace of the resource
166
+ # provider.
167
+ # @param parent_resource_path [String] The parent resource identity.
168
+ # @param resource_type [String] The resource type of the resource.
169
+ # @param resource_name [String] The name of the resource to get the permissions
170
+ # for.
171
+ # @param [Hash{String => String}] A hash of custom headers that will be added
172
+ # to the HTTP request.
173
+ #
174
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
175
+ #
176
+ def list_for_resource_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, custom_headers:nil)
177
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
178
+ fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
179
+ fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
180
+ fail ArgumentError, 'resource_type is nil' if resource_type.nil?
181
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
182
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
183
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
184
+
185
+
186
+ request_headers = {}
187
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
188
+
189
+ # Set Headers
190
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
191
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
192
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions'
193
+
194
+ request_url = @base_url || @client.base_url
195
+
196
+ options = {
197
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
198
+ path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
199
+ skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
200
+ query_params: {'api-version' => @client.api_version},
201
+ headers: request_headers.merge(custom_headers || {}),
202
+ base_url: request_url
203
+ }
204
+ promise = @client.make_request_async(:get, path_template, options)
205
+
206
+ promise = promise.then do |result|
207
+ http_response = result.response
208
+ status_code = http_response.status
209
+ response_content = http_response.body
210
+ unless status_code == 200
211
+ error_model = JSON.load(response_content)
212
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
213
+ end
214
+
215
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
216
+ # Deserialize Response
217
+ if status_code == 200
218
+ begin
219
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
220
+ result_mapper = Azure::Authorization::Mgmt::V2015_07_01_preview::Models::PermissionGetResult.mapper()
221
+ result.body = @client.deserialize(result_mapper, parsed_response)
222
+ rescue Exception => e
223
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
224
+ end
225
+ end
226
+
227
+ result
228
+ end
229
+
230
+ promise.execute
231
+ end
232
+
233
+ #
234
+ # Gets all permissions the caller has for a resource group.
235
+ #
236
+ # @param next_page_link [String] The NextLink from the previous successful call
237
+ # to List operation.
238
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
239
+ # will be added to the HTTP request.
240
+ #
241
+ # @return [PermissionGetResult] operation results.
242
+ #
243
+ def list_for_resource_group_next(next_page_link, custom_headers:nil)
244
+ response = list_for_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
245
+ response.body unless response.nil?
246
+ end
247
+
248
+ #
249
+ # Gets all permissions the caller has for a resource group.
250
+ #
251
+ # @param next_page_link [String] The NextLink from the previous successful call
252
+ # to List operation.
253
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
254
+ # will be added to the HTTP request.
255
+ #
256
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
257
+ #
258
+ def list_for_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
259
+ list_for_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
260
+ end
261
+
262
+ #
263
+ # Gets all permissions the caller has for a resource group.
264
+ #
265
+ # @param next_page_link [String] The NextLink from the previous successful call
266
+ # to List operation.
267
+ # @param [Hash{String => String}] A hash of custom headers that will be added
268
+ # to the HTTP request.
269
+ #
270
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
271
+ #
272
+ def list_for_resource_group_next_async(next_page_link, custom_headers:nil)
273
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
274
+
275
+
276
+ request_headers = {}
277
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
278
+
279
+ # Set Headers
280
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
281
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
282
+ path_template = '{nextLink}'
283
+
284
+ request_url = @base_url || @client.base_url
285
+
286
+ options = {
287
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
288
+ skip_encoding_path_params: {'nextLink' => next_page_link},
289
+ headers: request_headers.merge(custom_headers || {}),
290
+ base_url: request_url
291
+ }
292
+ promise = @client.make_request_async(:get, path_template, options)
293
+
294
+ promise = promise.then do |result|
295
+ http_response = result.response
296
+ status_code = http_response.status
297
+ response_content = http_response.body
298
+ unless status_code == 200
299
+ error_model = JSON.load(response_content)
300
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
301
+ end
302
+
303
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
304
+ # Deserialize Response
305
+ if status_code == 200
306
+ begin
307
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
308
+ result_mapper = Azure::Authorization::Mgmt::V2015_07_01_preview::Models::PermissionGetResult.mapper()
309
+ result.body = @client.deserialize(result_mapper, parsed_response)
310
+ rescue Exception => e
311
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
312
+ end
313
+ end
314
+
315
+ result
316
+ end
317
+
318
+ promise.execute
319
+ end
320
+
321
+ #
322
+ # Gets all permissions the caller has for a resource.
323
+ #
324
+ # @param next_page_link [String] The NextLink from the previous successful call
325
+ # to List operation.
326
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
327
+ # will be added to the HTTP request.
328
+ #
329
+ # @return [PermissionGetResult] operation results.
330
+ #
331
+ def list_for_resource_next(next_page_link, custom_headers:nil)
332
+ response = list_for_resource_next_async(next_page_link, custom_headers:custom_headers).value!
333
+ response.body unless response.nil?
334
+ end
335
+
336
+ #
337
+ # Gets all permissions the caller has for a resource.
338
+ #
339
+ # @param next_page_link [String] The NextLink from the previous successful call
340
+ # to List operation.
341
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
342
+ # will be added to the HTTP request.
343
+ #
344
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
345
+ #
346
+ def list_for_resource_next_with_http_info(next_page_link, custom_headers:nil)
347
+ list_for_resource_next_async(next_page_link, custom_headers:custom_headers).value!
348
+ end
349
+
350
+ #
351
+ # Gets all permissions the caller has for a resource.
352
+ #
353
+ # @param next_page_link [String] The NextLink from the previous successful call
354
+ # to List operation.
355
+ # @param [Hash{String => String}] A hash of custom headers that will be added
356
+ # to the HTTP request.
357
+ #
358
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
359
+ #
360
+ def list_for_resource_next_async(next_page_link, custom_headers:nil)
361
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
362
+
363
+
364
+ request_headers = {}
365
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
366
+
367
+ # Set Headers
368
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
369
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
370
+ path_template = '{nextLink}'
371
+
372
+ request_url = @base_url || @client.base_url
373
+
374
+ options = {
375
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
376
+ skip_encoding_path_params: {'nextLink' => next_page_link},
377
+ headers: request_headers.merge(custom_headers || {}),
378
+ base_url: request_url
379
+ }
380
+ promise = @client.make_request_async(:get, path_template, options)
381
+
382
+ promise = promise.then do |result|
383
+ http_response = result.response
384
+ status_code = http_response.status
385
+ response_content = http_response.body
386
+ unless status_code == 200
387
+ error_model = JSON.load(response_content)
388
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
389
+ end
390
+
391
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
392
+ # Deserialize Response
393
+ if status_code == 200
394
+ begin
395
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
396
+ result_mapper = Azure::Authorization::Mgmt::V2015_07_01_preview::Models::PermissionGetResult.mapper()
397
+ result.body = @client.deserialize(result_mapper, parsed_response)
398
+ rescue Exception => e
399
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
400
+ end
401
+ end
402
+
403
+ result
404
+ end
405
+
406
+ promise.execute
407
+ end
408
+
409
+ #
410
+ # Gets all permissions the caller has for a resource group.
411
+ #
412
+ # @param resource_group_name [String] The name of the resource group to get the
413
+ # permissions for. The name is case insensitive.
414
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
415
+ # will be added to the HTTP request.
416
+ #
417
+ # @return [PermissionGetResult] which provide lazy access to pages of the
418
+ # response.
419
+ #
420
+ def list_for_resource_group_as_lazy(resource_group_name, custom_headers:nil)
421
+ response = list_for_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
422
+ unless response.nil?
423
+ page = response.body
424
+ page.next_method = Proc.new do |next_page_link|
425
+ list_for_resource_group_next_async(next_page_link, custom_headers:custom_headers)
426
+ end
427
+ page
428
+ end
429
+ end
430
+
431
+ #
432
+ # Gets all permissions the caller has for a resource.
433
+ #
434
+ # @param resource_group_name [String] The name of the resource group containing
435
+ # the resource. The name is case insensitive.
436
+ # @param resource_provider_namespace [String] The namespace of the resource
437
+ # provider.
438
+ # @param parent_resource_path [String] The parent resource identity.
439
+ # @param resource_type [String] The resource type of the resource.
440
+ # @param resource_name [String] The name of the resource to get the permissions
441
+ # for.
442
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
443
+ # will be added to the HTTP request.
444
+ #
445
+ # @return [PermissionGetResult] which provide lazy access to pages of the
446
+ # response.
447
+ #
448
+ def list_for_resource_as_lazy(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, custom_headers:nil)
449
+ response = list_for_resource_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, custom_headers:custom_headers).value!
450
+ unless response.nil?
451
+ page = response.body
452
+ page.next_method = Proc.new do |next_page_link|
453
+ list_for_resource_next_async(next_page_link, custom_headers:custom_headers)
454
+ end
455
+ page
456
+ end
457
+ end
458
+
459
+ end
460
+ end