azure_mgmt_authorization 0.16.0 → 0.16.1

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