azure_mgmt_authorization 0.18.1 → 0.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-06-01-preview/generated/azure_mgmt_authorization/authorization_management_client.rb +1 -1
  3. data/lib/2015-07-01-preview/generated/azure_mgmt_authorization/authorization_management_client.rb +1 -1
  4. data/lib/2015-07-01/generated/azure_mgmt_authorization/authorization_management_client.rb +1 -1
  5. data/lib/2017-10-01-preview/generated/azure_mgmt_authorization/authorization_management_client.rb +1 -1
  6. data/lib/2018-01-01-preview/generated/azure_mgmt_authorization.rb +9 -9
  7. data/lib/2018-01-01-preview/generated/azure_mgmt_authorization/authorization_management_client.rb +5 -5
  8. data/lib/2018-01-01-preview/generated/azure_mgmt_authorization/permissions.rb +1 -5
  9. data/lib/2018-01-01-preview/generated/azure_mgmt_authorization/provider_operations_metadata_operations.rb +1 -5
  10. data/lib/2018-01-01-preview/generated/azure_mgmt_authorization/role_assignments.rb +1 -5
  11. data/lib/2018-01-01-preview/generated/azure_mgmt_authorization/role_definitions.rb +1 -5
  12. data/lib/2018-07-01-preview/generated/azure_mgmt_authorization.rb +33 -0
  13. data/lib/2018-07-01-preview/generated/azure_mgmt_authorization/authorization_management_client.rb +131 -0
  14. data/lib/2018-07-01-preview/generated/azure_mgmt_authorization/deny_assignments.rb +1226 -0
  15. data/lib/2018-07-01-preview/generated/azure_mgmt_authorization/models/deny_assignment.rb +191 -0
  16. data/lib/2018-07-01-preview/generated/azure_mgmt_authorization/models/deny_assignment_filter.rb +71 -0
  17. data/lib/2018-07-01-preview/generated/azure_mgmt_authorization/models/deny_assignment_list_result.rb +98 -0
  18. data/lib/2018-07-01-preview/generated/azure_mgmt_authorization/models/deny_assignment_permission.rb +115 -0
  19. data/lib/2018-07-01-preview/generated/azure_mgmt_authorization/models/principal.rb +65 -0
  20. data/lib/2018-07-01-preview/generated/azure_mgmt_authorization/module_definition.rb +9 -0
  21. data/lib/2018-09-01-preview/generated/azure_mgmt_authorization.rb +33 -0
  22. data/lib/2018-09-01-preview/generated/azure_mgmt_authorization/authorization_management_client.rb +131 -0
  23. data/lib/2018-09-01-preview/generated/azure_mgmt_authorization/models/principal_type.rb +24 -0
  24. data/lib/2018-09-01-preview/generated/azure_mgmt_authorization/models/role_assignment.rb +115 -0
  25. data/lib/2018-09-01-preview/generated/azure_mgmt_authorization/models/role_assignment_create_parameters.rb +85 -0
  26. data/lib/2018-09-01-preview/generated/azure_mgmt_authorization/models/role_assignment_filter.rb +57 -0
  27. data/lib/2018-09-01-preview/generated/azure_mgmt_authorization/models/role_assignment_list_result.rb +98 -0
  28. data/lib/2018-09-01-preview/generated/azure_mgmt_authorization/module_definition.rb +9 -0
  29. data/lib/2018-09-01-preview/generated/azure_mgmt_authorization/role_assignments.rb +1492 -0
  30. data/lib/azure_mgmt_authorization.rb +2 -0
  31. data/lib/profiles/latest/modules/authorization_profile_module.rb +72 -30
  32. data/lib/version.rb +1 -1
  33. metadata +20 -2
@@ -0,0 +1,57 @@
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_09_01_preview
7
+ module Models
8
+ #
9
+ # Role Assignments filter
10
+ #
11
+ class RoleAssignmentFilter
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] Returns role assignment of the specific principal.
16
+ attr_accessor :principal_id
17
+
18
+ # @return [Boolean] The Delegation flag for the roleassignment
19
+ attr_accessor :can_delegate
20
+
21
+
22
+ #
23
+ # Mapper for RoleAssignmentFilter class as Ruby Hash.
24
+ # This will be used for serialization/deserialization.
25
+ #
26
+ def self.mapper()
27
+ {
28
+ client_side_validation: true,
29
+ required: false,
30
+ serialized_name: 'RoleAssignmentFilter',
31
+ type: {
32
+ name: 'Composite',
33
+ class_name: 'RoleAssignmentFilter',
34
+ model_properties: {
35
+ principal_id: {
36
+ client_side_validation: true,
37
+ required: false,
38
+ serialized_name: 'principalId',
39
+ type: {
40
+ name: 'String'
41
+ }
42
+ },
43
+ can_delegate: {
44
+ client_side_validation: true,
45
+ required: false,
46
+ serialized_name: 'canDelegate',
47
+ type: {
48
+ name: 'Boolean'
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }
54
+ end
55
+ end
56
+ end
57
+ 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::V2018_09_01_preview
7
+ module Models
8
+ #
9
+ # Role assignment list operation result.
10
+ #
11
+ class RoleAssignmentListResult
12
+
13
+ include MsRestAzure
14
+
15
+ include MsRest::JSONable
16
+ # @return [Array<RoleAssignment>] Role assignment 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<RoleAssignment>] 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 [RoleAssignmentListResult] 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 RoleAssignmentListResult 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: 'RoleAssignmentListResult',
63
+ type: {
64
+ name: 'Composite',
65
+ class_name: 'RoleAssignmentListResult',
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: 'RoleAssignmentElementType',
77
+ type: {
78
+ name: 'Composite',
79
+ class_name: 'RoleAssignment'
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_09_01_preview end
@@ -0,0 +1,1492 @@
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_09_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 assignments. A role assignment grants
11
+ # access to Azure Active Directory users.
12
+ #
13
+ class RoleAssignments
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the RoleAssignments class.
18
+ # @param client service class for accessing basic functionality.
19
+ #
20
+ def initialize(client)
21
+ @client = client
22
+ end
23
+
24
+ # @return [AuthorizationManagementClient] reference to the AuthorizationManagementClient
25
+ attr_reader :client
26
+
27
+ #
28
+ # Gets role assignments for a resource.
29
+ #
30
+ # @param resource_group_name [String] The name of the resource group.
31
+ # @param resource_provider_namespace [String] The namespace of the resource
32
+ # provider.
33
+ # @param parent_resource_path [String] The parent resource identity.
34
+ # @param resource_type [String] The resource type of the resource.
35
+ # @param resource_name [String] The name of the resource to get role
36
+ # assignments for.
37
+ # @param filter [String] The filter to apply on the operation. Use
38
+ # $filter=atScope() to return all role assignments at or above the scope. Use
39
+ # $filter=principalId eq {id} to return all role assignments at, above or below
40
+ # the scope for the specified principal.
41
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
42
+ # will be added to the HTTP request.
43
+ #
44
+ # @return [Array<RoleAssignment>] operation results.
45
+ #
46
+ def list_for_resource(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:nil, custom_headers:nil)
47
+ first_page = list_for_resource_as_lazy(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:filter, custom_headers:custom_headers)
48
+ first_page.get_all_items
49
+ end
50
+
51
+ #
52
+ # Gets role assignments for a resource.
53
+ #
54
+ # @param resource_group_name [String] The name of the resource group.
55
+ # @param resource_provider_namespace [String] The namespace of the resource
56
+ # provider.
57
+ # @param parent_resource_path [String] The parent resource identity.
58
+ # @param resource_type [String] The resource type of the resource.
59
+ # @param resource_name [String] The name of the resource to get role
60
+ # assignments for.
61
+ # @param filter [String] The filter to apply on the operation. Use
62
+ # $filter=atScope() to return all role assignments at or above the scope. Use
63
+ # $filter=principalId eq {id} to return all role assignments at, above or below
64
+ # the scope for the specified principal.
65
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
66
+ # will be added to the HTTP request.
67
+ #
68
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
69
+ #
70
+ def list_for_resource_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:nil, custom_headers:nil)
71
+ list_for_resource_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:filter, custom_headers:custom_headers).value!
72
+ end
73
+
74
+ #
75
+ # Gets role assignments for a resource.
76
+ #
77
+ # @param resource_group_name [String] The name of the resource group.
78
+ # @param resource_provider_namespace [String] The namespace of the resource
79
+ # provider.
80
+ # @param parent_resource_path [String] The parent resource identity.
81
+ # @param resource_type [String] The resource type of the resource.
82
+ # @param resource_name [String] The name of the resource to get role
83
+ # assignments for.
84
+ # @param filter [String] The filter to apply on the operation. Use
85
+ # $filter=atScope() to return all role assignments at or above the scope. Use
86
+ # $filter=principalId eq {id} to return all role assignments at, above or below
87
+ # the scope for the specified principal.
88
+ # @param [Hash{String => String}] A hash of custom headers that will be added
89
+ # to the HTTP request.
90
+ #
91
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
92
+ #
93
+ def list_for_resource_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:nil, custom_headers:nil)
94
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
95
+ fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
96
+ fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
97
+ fail ArgumentError, 'resource_type is nil' if resource_type.nil?
98
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
99
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
100
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
101
+
102
+
103
+ request_headers = {}
104
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
105
+
106
+ # Set Headers
107
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
108
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
109
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments'
110
+
111
+ request_url = @base_url || @client.base_url
112
+
113
+ options = {
114
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
115
+ path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
116
+ skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
117
+ query_params: {'$filter' => filter,'api-version' => @client.api_version},
118
+ headers: request_headers.merge(custom_headers || {}),
119
+ base_url: request_url
120
+ }
121
+ promise = @client.make_request_async(:get, path_template, options)
122
+
123
+ promise = promise.then do |result|
124
+ http_response = result.response
125
+ status_code = http_response.status
126
+ response_content = http_response.body
127
+ unless status_code == 200
128
+ error_model = JSON.load(response_content)
129
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
130
+ end
131
+
132
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
133
+ # Deserialize Response
134
+ if status_code == 200
135
+ begin
136
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
137
+ result_mapper = Azure::Authorization::Mgmt::V2018_09_01_preview::Models::RoleAssignmentListResult.mapper()
138
+ result.body = @client.deserialize(result_mapper, parsed_response)
139
+ rescue Exception => e
140
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
141
+ end
142
+ end
143
+
144
+ result
145
+ end
146
+
147
+ promise.execute
148
+ end
149
+
150
+ #
151
+ # Gets role assignments for a resource group.
152
+ #
153
+ # @param resource_group_name [String] The name of the resource group.
154
+ # @param filter [String] The filter to apply on the operation. Use
155
+ # $filter=atScope() to return all role assignments at or above the scope. Use
156
+ # $filter=principalId eq {id} to return all role assignments at, above or below
157
+ # the scope for the specified principal.
158
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
159
+ # will be added to the HTTP request.
160
+ #
161
+ # @return [Array<RoleAssignment>] operation results.
162
+ #
163
+ def list_for_resource_group(resource_group_name, filter:nil, custom_headers:nil)
164
+ first_page = list_for_resource_group_as_lazy(resource_group_name, filter:filter, custom_headers:custom_headers)
165
+ first_page.get_all_items
166
+ end
167
+
168
+ #
169
+ # Gets role assignments for a resource group.
170
+ #
171
+ # @param resource_group_name [String] The name of the resource group.
172
+ # @param filter [String] The filter to apply on the operation. Use
173
+ # $filter=atScope() to return all role assignments at or above the scope. Use
174
+ # $filter=principalId eq {id} to return all role assignments at, above or below
175
+ # the scope for the specified principal.
176
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
177
+ # will be added to the HTTP request.
178
+ #
179
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
180
+ #
181
+ def list_for_resource_group_with_http_info(resource_group_name, filter:nil, custom_headers:nil)
182
+ list_for_resource_group_async(resource_group_name, filter:filter, custom_headers:custom_headers).value!
183
+ end
184
+
185
+ #
186
+ # Gets role assignments for a resource group.
187
+ #
188
+ # @param resource_group_name [String] The name of the resource group.
189
+ # @param filter [String] The filter to apply on the operation. Use
190
+ # $filter=atScope() to return all role assignments at or above the scope. Use
191
+ # $filter=principalId eq {id} to return all role assignments at, above or below
192
+ # the scope for the specified principal.
193
+ # @param [Hash{String => String}] A hash of custom headers that will be added
194
+ # to the HTTP request.
195
+ #
196
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
197
+ #
198
+ def list_for_resource_group_async(resource_group_name, filter:nil, custom_headers:nil)
199
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
200
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
201
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
202
+
203
+
204
+ request_headers = {}
205
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
206
+
207
+ # Set Headers
208
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
209
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
210
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments'
211
+
212
+ request_url = @base_url || @client.base_url
213
+
214
+ options = {
215
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
216
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
217
+ query_params: {'$filter' => filter,'api-version' => @client.api_version},
218
+ headers: request_headers.merge(custom_headers || {}),
219
+ base_url: request_url
220
+ }
221
+ promise = @client.make_request_async(:get, path_template, options)
222
+
223
+ promise = promise.then do |result|
224
+ http_response = result.response
225
+ status_code = http_response.status
226
+ response_content = http_response.body
227
+ unless status_code == 200
228
+ error_model = JSON.load(response_content)
229
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
230
+ end
231
+
232
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
233
+ # Deserialize Response
234
+ if status_code == 200
235
+ begin
236
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
237
+ result_mapper = Azure::Authorization::Mgmt::V2018_09_01_preview::Models::RoleAssignmentListResult.mapper()
238
+ result.body = @client.deserialize(result_mapper, parsed_response)
239
+ rescue Exception => e
240
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
241
+ end
242
+ end
243
+
244
+ result
245
+ end
246
+
247
+ promise.execute
248
+ end
249
+
250
+ #
251
+ # Deletes a role assignment.
252
+ #
253
+ # @param scope [String] The scope of the role assignment to delete.
254
+ # @param role_assignment_name [String] The name of the role assignment to
255
+ # delete.
256
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
257
+ # will be added to the HTTP request.
258
+ #
259
+ # @return [RoleAssignment] operation results.
260
+ #
261
+ def delete(scope, role_assignment_name, custom_headers:nil)
262
+ response = delete_async(scope, role_assignment_name, custom_headers:custom_headers).value!
263
+ response.body unless response.nil?
264
+ end
265
+
266
+ #
267
+ # Deletes a role assignment.
268
+ #
269
+ # @param scope [String] The scope of the role assignment to delete.
270
+ # @param role_assignment_name [String] The name of the role assignment to
271
+ # delete.
272
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
273
+ # will be added to the HTTP request.
274
+ #
275
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
276
+ #
277
+ def delete_with_http_info(scope, role_assignment_name, custom_headers:nil)
278
+ delete_async(scope, role_assignment_name, custom_headers:custom_headers).value!
279
+ end
280
+
281
+ #
282
+ # Deletes a role assignment.
283
+ #
284
+ # @param scope [String] The scope of the role assignment to delete.
285
+ # @param role_assignment_name [String] The name of the role assignment to
286
+ # delete.
287
+ # @param [Hash{String => String}] A hash of custom headers that will be added
288
+ # to the HTTP request.
289
+ #
290
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
291
+ #
292
+ def delete_async(scope, role_assignment_name, custom_headers:nil)
293
+ fail ArgumentError, 'scope is nil' if scope.nil?
294
+ fail ArgumentError, 'role_assignment_name is nil' if role_assignment_name.nil?
295
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
296
+
297
+
298
+ request_headers = {}
299
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
300
+
301
+ # Set Headers
302
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
303
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
304
+ path_template = '{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}'
305
+
306
+ request_url = @base_url || @client.base_url
307
+
308
+ options = {
309
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
310
+ path_params: {'roleAssignmentName' => role_assignment_name},
311
+ skip_encoding_path_params: {'scope' => scope},
312
+ query_params: {'api-version' => @client.api_version},
313
+ headers: request_headers.merge(custom_headers || {}),
314
+ base_url: request_url
315
+ }
316
+ promise = @client.make_request_async(:delete, path_template, options)
317
+
318
+ promise = promise.then do |result|
319
+ http_response = result.response
320
+ status_code = http_response.status
321
+ response_content = http_response.body
322
+ unless status_code == 200
323
+ error_model = JSON.load(response_content)
324
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
325
+ end
326
+
327
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
328
+ # Deserialize Response
329
+ if status_code == 200
330
+ begin
331
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
332
+ result_mapper = Azure::Authorization::Mgmt::V2018_09_01_preview::Models::RoleAssignment.mapper()
333
+ result.body = @client.deserialize(result_mapper, parsed_response)
334
+ rescue Exception => e
335
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
336
+ end
337
+ end
338
+
339
+ result
340
+ end
341
+
342
+ promise.execute
343
+ end
344
+
345
+ #
346
+ # Creates a role assignment.
347
+ #
348
+ # @param scope [String] The scope of the role assignment to create. The scope
349
+ # can be any REST resource instance. For example, use
350
+ # '/subscriptions/{subscription-id}/' for a subscription,
351
+ # '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a
352
+ # resource group, and
353
+ # '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}'
354
+ # for a resource.
355
+ # @param role_assignment_name [String] The name of the role assignment to
356
+ # create. It can be any valid GUID.
357
+ # @param parameters [RoleAssignmentCreateParameters] Parameters for the role
358
+ # assignment.
359
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
360
+ # will be added to the HTTP request.
361
+ #
362
+ # @return [RoleAssignment] operation results.
363
+ #
364
+ def create(scope, role_assignment_name, parameters, custom_headers:nil)
365
+ response = create_async(scope, role_assignment_name, parameters, custom_headers:custom_headers).value!
366
+ response.body unless response.nil?
367
+ end
368
+
369
+ #
370
+ # Creates a role assignment.
371
+ #
372
+ # @param scope [String] The scope of the role assignment to create. The scope
373
+ # can be any REST resource instance. For example, use
374
+ # '/subscriptions/{subscription-id}/' for a subscription,
375
+ # '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a
376
+ # resource group, and
377
+ # '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}'
378
+ # for a resource.
379
+ # @param role_assignment_name [String] The name of the role assignment to
380
+ # create. It can be any valid GUID.
381
+ # @param parameters [RoleAssignmentCreateParameters] Parameters for the role
382
+ # assignment.
383
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
384
+ # will be added to the HTTP request.
385
+ #
386
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
387
+ #
388
+ def create_with_http_info(scope, role_assignment_name, parameters, custom_headers:nil)
389
+ create_async(scope, role_assignment_name, parameters, custom_headers:custom_headers).value!
390
+ end
391
+
392
+ #
393
+ # Creates a role assignment.
394
+ #
395
+ # @param scope [String] The scope of the role assignment to create. The scope
396
+ # can be any REST resource instance. For example, use
397
+ # '/subscriptions/{subscription-id}/' for a subscription,
398
+ # '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a
399
+ # resource group, and
400
+ # '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}'
401
+ # for a resource.
402
+ # @param role_assignment_name [String] The name of the role assignment to
403
+ # create. It can be any valid GUID.
404
+ # @param parameters [RoleAssignmentCreateParameters] Parameters for the role
405
+ # assignment.
406
+ # @param [Hash{String => String}] A hash of custom headers that will be added
407
+ # to the HTTP request.
408
+ #
409
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
410
+ #
411
+ def create_async(scope, role_assignment_name, parameters, custom_headers:nil)
412
+ fail ArgumentError, 'scope is nil' if scope.nil?
413
+ fail ArgumentError, 'role_assignment_name is nil' if role_assignment_name.nil?
414
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
415
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
416
+
417
+
418
+ request_headers = {}
419
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
420
+
421
+ # Set Headers
422
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
423
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
424
+
425
+ # Serialize Request
426
+ request_mapper = Azure::Authorization::Mgmt::V2018_09_01_preview::Models::RoleAssignmentCreateParameters.mapper()
427
+ request_content = @client.serialize(request_mapper, parameters)
428
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
429
+
430
+ path_template = '{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}'
431
+
432
+ request_url = @base_url || @client.base_url
433
+
434
+ options = {
435
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
436
+ path_params: {'roleAssignmentName' => role_assignment_name},
437
+ skip_encoding_path_params: {'scope' => scope},
438
+ query_params: {'api-version' => @client.api_version},
439
+ body: request_content,
440
+ headers: request_headers.merge(custom_headers || {}),
441
+ base_url: request_url
442
+ }
443
+ promise = @client.make_request_async(:put, path_template, options)
444
+
445
+ promise = promise.then do |result|
446
+ http_response = result.response
447
+ status_code = http_response.status
448
+ response_content = http_response.body
449
+ unless status_code == 201
450
+ error_model = JSON.load(response_content)
451
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
452
+ end
453
+
454
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
455
+ # Deserialize Response
456
+ if status_code == 201
457
+ begin
458
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
459
+ result_mapper = Azure::Authorization::Mgmt::V2018_09_01_preview::Models::RoleAssignment.mapper()
460
+ result.body = @client.deserialize(result_mapper, parsed_response)
461
+ rescue Exception => e
462
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
463
+ end
464
+ end
465
+
466
+ result
467
+ end
468
+
469
+ promise.execute
470
+ end
471
+
472
+ #
473
+ # Get the specified role assignment.
474
+ #
475
+ # @param scope [String] The scope of the role assignment.
476
+ # @param role_assignment_name [String] The name of the role assignment to get.
477
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
478
+ # will be added to the HTTP request.
479
+ #
480
+ # @return [RoleAssignment] operation results.
481
+ #
482
+ def get(scope, role_assignment_name, custom_headers:nil)
483
+ response = get_async(scope, role_assignment_name, custom_headers:custom_headers).value!
484
+ response.body unless response.nil?
485
+ end
486
+
487
+ #
488
+ # Get the specified role assignment.
489
+ #
490
+ # @param scope [String] The scope of the role assignment.
491
+ # @param role_assignment_name [String] The name of the role assignment to get.
492
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
493
+ # will be added to the HTTP request.
494
+ #
495
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
496
+ #
497
+ def get_with_http_info(scope, role_assignment_name, custom_headers:nil)
498
+ get_async(scope, role_assignment_name, custom_headers:custom_headers).value!
499
+ end
500
+
501
+ #
502
+ # Get the specified role assignment.
503
+ #
504
+ # @param scope [String] The scope of the role assignment.
505
+ # @param role_assignment_name [String] The name of the role assignment to get.
506
+ # @param [Hash{String => String}] A hash of custom headers that will be added
507
+ # to the HTTP request.
508
+ #
509
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
510
+ #
511
+ def get_async(scope, role_assignment_name, custom_headers:nil)
512
+ fail ArgumentError, 'scope is nil' if scope.nil?
513
+ fail ArgumentError, 'role_assignment_name is nil' if role_assignment_name.nil?
514
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
515
+
516
+
517
+ request_headers = {}
518
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
519
+
520
+ # Set Headers
521
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
522
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
523
+ path_template = '{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}'
524
+
525
+ request_url = @base_url || @client.base_url
526
+
527
+ options = {
528
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
529
+ path_params: {'roleAssignmentName' => role_assignment_name},
530
+ skip_encoding_path_params: {'scope' => scope},
531
+ query_params: {'api-version' => @client.api_version},
532
+ headers: request_headers.merge(custom_headers || {}),
533
+ base_url: request_url
534
+ }
535
+ promise = @client.make_request_async(:get, path_template, options)
536
+
537
+ promise = promise.then do |result|
538
+ http_response = result.response
539
+ status_code = http_response.status
540
+ response_content = http_response.body
541
+ unless status_code == 200
542
+ error_model = JSON.load(response_content)
543
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
544
+ end
545
+
546
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
547
+ # Deserialize Response
548
+ if status_code == 200
549
+ begin
550
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
551
+ result_mapper = Azure::Authorization::Mgmt::V2018_09_01_preview::Models::RoleAssignment.mapper()
552
+ result.body = @client.deserialize(result_mapper, parsed_response)
553
+ rescue Exception => e
554
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
555
+ end
556
+ end
557
+
558
+ result
559
+ end
560
+
561
+ promise.execute
562
+ end
563
+
564
+ #
565
+ # Deletes a role assignment.
566
+ #
567
+ # @param role_id [String] The ID of the role assignment to delete.
568
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
569
+ # will be added to the HTTP request.
570
+ #
571
+ # @return [RoleAssignment] operation results.
572
+ #
573
+ def delete_by_id(role_id, custom_headers:nil)
574
+ response = delete_by_id_async(role_id, custom_headers:custom_headers).value!
575
+ response.body unless response.nil?
576
+ end
577
+
578
+ #
579
+ # Deletes a role assignment.
580
+ #
581
+ # @param role_id [String] The ID of the role assignment to delete.
582
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
583
+ # will be added to the HTTP request.
584
+ #
585
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
586
+ #
587
+ def delete_by_id_with_http_info(role_id, custom_headers:nil)
588
+ delete_by_id_async(role_id, custom_headers:custom_headers).value!
589
+ end
590
+
591
+ #
592
+ # Deletes a role assignment.
593
+ #
594
+ # @param role_id [String] The ID of the role assignment to delete.
595
+ # @param [Hash{String => String}] A hash of custom headers that will be added
596
+ # to the HTTP request.
597
+ #
598
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
599
+ #
600
+ def delete_by_id_async(role_id, custom_headers:nil)
601
+ fail ArgumentError, 'role_id is nil' if role_id.nil?
602
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
603
+
604
+
605
+ request_headers = {}
606
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
607
+
608
+ # Set Headers
609
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
610
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
611
+ path_template = '{roleId}'
612
+
613
+ request_url = @base_url || @client.base_url
614
+
615
+ options = {
616
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
617
+ skip_encoding_path_params: {'roleId' => role_id},
618
+ query_params: {'api-version' => @client.api_version},
619
+ headers: request_headers.merge(custom_headers || {}),
620
+ base_url: request_url
621
+ }
622
+ promise = @client.make_request_async(:delete, path_template, options)
623
+
624
+ promise = promise.then do |result|
625
+ http_response = result.response
626
+ status_code = http_response.status
627
+ response_content = http_response.body
628
+ unless status_code == 200
629
+ error_model = JSON.load(response_content)
630
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
631
+ end
632
+
633
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
634
+ # Deserialize Response
635
+ if status_code == 200
636
+ begin
637
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
638
+ result_mapper = Azure::Authorization::Mgmt::V2018_09_01_preview::Models::RoleAssignment.mapper()
639
+ result.body = @client.deserialize(result_mapper, parsed_response)
640
+ rescue Exception => e
641
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
642
+ end
643
+ end
644
+
645
+ result
646
+ end
647
+
648
+ promise.execute
649
+ end
650
+
651
+ #
652
+ # Creates a role assignment by ID.
653
+ #
654
+ # @param role_id [String] The ID of the role assignment to create.
655
+ # @param parameters [RoleAssignmentCreateParameters] Parameters for the role
656
+ # assignment.
657
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
658
+ # will be added to the HTTP request.
659
+ #
660
+ # @return [RoleAssignment] operation results.
661
+ #
662
+ def create_by_id(role_id, parameters, custom_headers:nil)
663
+ response = create_by_id_async(role_id, parameters, custom_headers:custom_headers).value!
664
+ response.body unless response.nil?
665
+ end
666
+
667
+ #
668
+ # Creates a role assignment by ID.
669
+ #
670
+ # @param role_id [String] The ID of the role assignment to create.
671
+ # @param parameters [RoleAssignmentCreateParameters] Parameters for the role
672
+ # assignment.
673
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
674
+ # will be added to the HTTP request.
675
+ #
676
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
677
+ #
678
+ def create_by_id_with_http_info(role_id, parameters, custom_headers:nil)
679
+ create_by_id_async(role_id, parameters, custom_headers:custom_headers).value!
680
+ end
681
+
682
+ #
683
+ # Creates a role assignment by ID.
684
+ #
685
+ # @param role_id [String] The ID of the role assignment to create.
686
+ # @param parameters [RoleAssignmentCreateParameters] Parameters for the role
687
+ # assignment.
688
+ # @param [Hash{String => String}] A hash of custom headers that will be added
689
+ # to the HTTP request.
690
+ #
691
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
692
+ #
693
+ def create_by_id_async(role_id, parameters, custom_headers:nil)
694
+ fail ArgumentError, 'role_id is nil' if role_id.nil?
695
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
696
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
697
+
698
+
699
+ request_headers = {}
700
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
701
+
702
+ # Set Headers
703
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
704
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
705
+
706
+ # Serialize Request
707
+ request_mapper = Azure::Authorization::Mgmt::V2018_09_01_preview::Models::RoleAssignmentCreateParameters.mapper()
708
+ request_content = @client.serialize(request_mapper, parameters)
709
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
710
+
711
+ path_template = '{roleId}'
712
+
713
+ request_url = @base_url || @client.base_url
714
+
715
+ options = {
716
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
717
+ skip_encoding_path_params: {'roleId' => role_id},
718
+ query_params: {'api-version' => @client.api_version},
719
+ body: request_content,
720
+ headers: request_headers.merge(custom_headers || {}),
721
+ base_url: request_url
722
+ }
723
+ promise = @client.make_request_async(:put, path_template, options)
724
+
725
+ promise = promise.then do |result|
726
+ http_response = result.response
727
+ status_code = http_response.status
728
+ response_content = http_response.body
729
+ unless status_code == 201
730
+ error_model = JSON.load(response_content)
731
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
732
+ end
733
+
734
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
735
+ # Deserialize Response
736
+ if status_code == 201
737
+ begin
738
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
739
+ result_mapper = Azure::Authorization::Mgmt::V2018_09_01_preview::Models::RoleAssignment.mapper()
740
+ result.body = @client.deserialize(result_mapper, parsed_response)
741
+ rescue Exception => e
742
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
743
+ end
744
+ end
745
+
746
+ result
747
+ end
748
+
749
+ promise.execute
750
+ end
751
+
752
+ #
753
+ # Gets a role assignment by ID.
754
+ #
755
+ # @param role_id [String] The ID of the role assignment to get.
756
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
757
+ # will be added to the HTTP request.
758
+ #
759
+ # @return [RoleAssignment] operation results.
760
+ #
761
+ def get_by_id(role_id, custom_headers:nil)
762
+ response = get_by_id_async(role_id, custom_headers:custom_headers).value!
763
+ response.body unless response.nil?
764
+ end
765
+
766
+ #
767
+ # Gets a role assignment by ID.
768
+ #
769
+ # @param role_id [String] The ID of the role assignment to get.
770
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
771
+ # will be added to the HTTP request.
772
+ #
773
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
774
+ #
775
+ def get_by_id_with_http_info(role_id, custom_headers:nil)
776
+ get_by_id_async(role_id, custom_headers:custom_headers).value!
777
+ end
778
+
779
+ #
780
+ # Gets a role assignment by ID.
781
+ #
782
+ # @param role_id [String] The ID of the role assignment to get.
783
+ # @param [Hash{String => String}] A hash of custom headers that will be added
784
+ # to the HTTP request.
785
+ #
786
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
787
+ #
788
+ def get_by_id_async(role_id, custom_headers:nil)
789
+ fail ArgumentError, 'role_id is nil' if role_id.nil?
790
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
791
+
792
+
793
+ request_headers = {}
794
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
795
+
796
+ # Set Headers
797
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
798
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
799
+ path_template = '{roleId}'
800
+
801
+ request_url = @base_url || @client.base_url
802
+
803
+ options = {
804
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
805
+ skip_encoding_path_params: {'roleId' => role_id},
806
+ query_params: {'api-version' => @client.api_version},
807
+ headers: request_headers.merge(custom_headers || {}),
808
+ base_url: request_url
809
+ }
810
+ promise = @client.make_request_async(:get, path_template, options)
811
+
812
+ promise = promise.then do |result|
813
+ http_response = result.response
814
+ status_code = http_response.status
815
+ response_content = http_response.body
816
+ unless status_code == 200
817
+ error_model = JSON.load(response_content)
818
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
819
+ end
820
+
821
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
822
+ # Deserialize Response
823
+ if status_code == 200
824
+ begin
825
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
826
+ result_mapper = Azure::Authorization::Mgmt::V2018_09_01_preview::Models::RoleAssignment.mapper()
827
+ result.body = @client.deserialize(result_mapper, parsed_response)
828
+ rescue Exception => e
829
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
830
+ end
831
+ end
832
+
833
+ result
834
+ end
835
+
836
+ promise.execute
837
+ end
838
+
839
+ #
840
+ # Gets all role assignments for the subscription.
841
+ #
842
+ # @param filter [String] The filter to apply on the operation. Use
843
+ # $filter=atScope() to return all role assignments at or above the scope. Use
844
+ # $filter=principalId eq {id} to return all role assignments at, above or below
845
+ # the scope for the specified principal.
846
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
847
+ # will be added to the HTTP request.
848
+ #
849
+ # @return [Array<RoleAssignment>] operation results.
850
+ #
851
+ def list(filter:nil, custom_headers:nil)
852
+ first_page = list_as_lazy(filter:filter, custom_headers:custom_headers)
853
+ first_page.get_all_items
854
+ end
855
+
856
+ #
857
+ # Gets all role assignments for the subscription.
858
+ #
859
+ # @param filter [String] The filter to apply on the operation. Use
860
+ # $filter=atScope() to return all role assignments at or above the scope. Use
861
+ # $filter=principalId eq {id} to return all role assignments at, above or below
862
+ # the scope for the specified principal.
863
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
864
+ # will be added to the HTTP request.
865
+ #
866
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
867
+ #
868
+ def list_with_http_info(filter:nil, custom_headers:nil)
869
+ list_async(filter:filter, custom_headers:custom_headers).value!
870
+ end
871
+
872
+ #
873
+ # Gets all role assignments for the subscription.
874
+ #
875
+ # @param filter [String] The filter to apply on the operation. Use
876
+ # $filter=atScope() to return all role assignments at or above the scope. Use
877
+ # $filter=principalId eq {id} to return all role assignments at, above or below
878
+ # the scope for the specified principal.
879
+ # @param [Hash{String => String}] A hash of custom headers that will be added
880
+ # to the HTTP request.
881
+ #
882
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
883
+ #
884
+ def list_async(filter:nil, custom_headers:nil)
885
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
886
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
887
+
888
+
889
+ request_headers = {}
890
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
891
+
892
+ # Set Headers
893
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
894
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
895
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments'
896
+
897
+ request_url = @base_url || @client.base_url
898
+
899
+ options = {
900
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
901
+ path_params: {'subscriptionId' => @client.subscription_id},
902
+ query_params: {'$filter' => filter,'api-version' => @client.api_version},
903
+ headers: request_headers.merge(custom_headers || {}),
904
+ base_url: request_url
905
+ }
906
+ promise = @client.make_request_async(:get, path_template, options)
907
+
908
+ promise = promise.then do |result|
909
+ http_response = result.response
910
+ status_code = http_response.status
911
+ response_content = http_response.body
912
+ unless status_code == 200
913
+ error_model = JSON.load(response_content)
914
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
915
+ end
916
+
917
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
918
+ # Deserialize Response
919
+ if status_code == 200
920
+ begin
921
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
922
+ result_mapper = Azure::Authorization::Mgmt::V2018_09_01_preview::Models::RoleAssignmentListResult.mapper()
923
+ result.body = @client.deserialize(result_mapper, parsed_response)
924
+ rescue Exception => e
925
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
926
+ end
927
+ end
928
+
929
+ result
930
+ end
931
+
932
+ promise.execute
933
+ end
934
+
935
+ #
936
+ # Gets role assignments for a scope.
937
+ #
938
+ # @param scope [String] The scope of the role assignments.
939
+ # @param filter [String] The filter to apply on the operation. Use
940
+ # $filter=atScope() to return all role assignments at or above the scope. Use
941
+ # $filter=principalId eq {id} to return all role assignments at, above or below
942
+ # the scope for the specified principal.
943
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
944
+ # will be added to the HTTP request.
945
+ #
946
+ # @return [Array<RoleAssignment>] operation results.
947
+ #
948
+ def list_for_scope(scope, filter:nil, custom_headers:nil)
949
+ first_page = list_for_scope_as_lazy(scope, filter:filter, custom_headers:custom_headers)
950
+ first_page.get_all_items
951
+ end
952
+
953
+ #
954
+ # Gets role assignments for a scope.
955
+ #
956
+ # @param scope [String] The scope of the role assignments.
957
+ # @param filter [String] The filter to apply on the operation. Use
958
+ # $filter=atScope() to return all role assignments at or above the scope. Use
959
+ # $filter=principalId eq {id} to return all role assignments at, above or below
960
+ # the scope for the specified principal.
961
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
962
+ # will be added to the HTTP request.
963
+ #
964
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
965
+ #
966
+ def list_for_scope_with_http_info(scope, filter:nil, custom_headers:nil)
967
+ list_for_scope_async(scope, filter:filter, custom_headers:custom_headers).value!
968
+ end
969
+
970
+ #
971
+ # Gets role assignments for a scope.
972
+ #
973
+ # @param scope [String] The scope of the role assignments.
974
+ # @param filter [String] The filter to apply on the operation. Use
975
+ # $filter=atScope() to return all role assignments at or above the scope. Use
976
+ # $filter=principalId eq {id} to return all role assignments at, above or below
977
+ # the scope for the specified principal.
978
+ # @param [Hash{String => String}] A hash of custom headers that will be added
979
+ # to the HTTP request.
980
+ #
981
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
982
+ #
983
+ def list_for_scope_async(scope, filter:nil, custom_headers:nil)
984
+ fail ArgumentError, 'scope is nil' if scope.nil?
985
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
986
+
987
+
988
+ request_headers = {}
989
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
990
+
991
+ # Set Headers
992
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
993
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
994
+ path_template = '{scope}/providers/Microsoft.Authorization/roleAssignments'
995
+
996
+ request_url = @base_url || @client.base_url
997
+
998
+ options = {
999
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1000
+ skip_encoding_path_params: {'scope' => scope},
1001
+ query_params: {'$filter' => filter,'api-version' => @client.api_version},
1002
+ headers: request_headers.merge(custom_headers || {}),
1003
+ base_url: request_url
1004
+ }
1005
+ promise = @client.make_request_async(:get, path_template, options)
1006
+
1007
+ promise = promise.then do |result|
1008
+ http_response = result.response
1009
+ status_code = http_response.status
1010
+ response_content = http_response.body
1011
+ unless status_code == 200
1012
+ error_model = JSON.load(response_content)
1013
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1014
+ end
1015
+
1016
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1017
+ # Deserialize Response
1018
+ if status_code == 200
1019
+ begin
1020
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1021
+ result_mapper = Azure::Authorization::Mgmt::V2018_09_01_preview::Models::RoleAssignmentListResult.mapper()
1022
+ result.body = @client.deserialize(result_mapper, parsed_response)
1023
+ rescue Exception => e
1024
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1025
+ end
1026
+ end
1027
+
1028
+ result
1029
+ end
1030
+
1031
+ promise.execute
1032
+ end
1033
+
1034
+ #
1035
+ # Gets role assignments for a resource.
1036
+ #
1037
+ # @param next_page_link [String] The NextLink from the previous successful call
1038
+ # to List operation.
1039
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1040
+ # will be added to the HTTP request.
1041
+ #
1042
+ # @return [RoleAssignmentListResult] operation results.
1043
+ #
1044
+ def list_for_resource_next(next_page_link, custom_headers:nil)
1045
+ response = list_for_resource_next_async(next_page_link, custom_headers:custom_headers).value!
1046
+ response.body unless response.nil?
1047
+ end
1048
+
1049
+ #
1050
+ # Gets role assignments for a resource.
1051
+ #
1052
+ # @param next_page_link [String] The NextLink from the previous successful call
1053
+ # to List operation.
1054
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1055
+ # will be added to the HTTP request.
1056
+ #
1057
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1058
+ #
1059
+ def list_for_resource_next_with_http_info(next_page_link, custom_headers:nil)
1060
+ list_for_resource_next_async(next_page_link, custom_headers:custom_headers).value!
1061
+ end
1062
+
1063
+ #
1064
+ # Gets role assignments for a resource.
1065
+ #
1066
+ # @param next_page_link [String] The NextLink from the previous successful call
1067
+ # to List operation.
1068
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1069
+ # to the HTTP request.
1070
+ #
1071
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1072
+ #
1073
+ def list_for_resource_next_async(next_page_link, custom_headers:nil)
1074
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1075
+
1076
+
1077
+ request_headers = {}
1078
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1079
+
1080
+ # Set Headers
1081
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1082
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1083
+ path_template = '{nextLink}'
1084
+
1085
+ request_url = @base_url || @client.base_url
1086
+
1087
+ options = {
1088
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1089
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1090
+ headers: request_headers.merge(custom_headers || {}),
1091
+ base_url: request_url
1092
+ }
1093
+ promise = @client.make_request_async(:get, path_template, options)
1094
+
1095
+ promise = promise.then do |result|
1096
+ http_response = result.response
1097
+ status_code = http_response.status
1098
+ response_content = http_response.body
1099
+ unless status_code == 200
1100
+ error_model = JSON.load(response_content)
1101
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1102
+ end
1103
+
1104
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1105
+ # Deserialize Response
1106
+ if status_code == 200
1107
+ begin
1108
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1109
+ result_mapper = Azure::Authorization::Mgmt::V2018_09_01_preview::Models::RoleAssignmentListResult.mapper()
1110
+ result.body = @client.deserialize(result_mapper, parsed_response)
1111
+ rescue Exception => e
1112
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1113
+ end
1114
+ end
1115
+
1116
+ result
1117
+ end
1118
+
1119
+ promise.execute
1120
+ end
1121
+
1122
+ #
1123
+ # Gets role assignments for a resource group.
1124
+ #
1125
+ # @param next_page_link [String] The NextLink from the previous successful call
1126
+ # to List operation.
1127
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1128
+ # will be added to the HTTP request.
1129
+ #
1130
+ # @return [RoleAssignmentListResult] operation results.
1131
+ #
1132
+ def list_for_resource_group_next(next_page_link, custom_headers:nil)
1133
+ response = list_for_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
1134
+ response.body unless response.nil?
1135
+ end
1136
+
1137
+ #
1138
+ # Gets role assignments for a resource group.
1139
+ #
1140
+ # @param next_page_link [String] The NextLink from the previous successful call
1141
+ # to List operation.
1142
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1143
+ # will be added to the HTTP request.
1144
+ #
1145
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1146
+ #
1147
+ def list_for_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
1148
+ list_for_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
1149
+ end
1150
+
1151
+ #
1152
+ # Gets role assignments for a resource group.
1153
+ #
1154
+ # @param next_page_link [String] The NextLink from the previous successful call
1155
+ # to List operation.
1156
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1157
+ # to the HTTP request.
1158
+ #
1159
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1160
+ #
1161
+ def list_for_resource_group_next_async(next_page_link, custom_headers:nil)
1162
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1163
+
1164
+
1165
+ request_headers = {}
1166
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1167
+
1168
+ # Set Headers
1169
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1170
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1171
+ path_template = '{nextLink}'
1172
+
1173
+ request_url = @base_url || @client.base_url
1174
+
1175
+ options = {
1176
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1177
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1178
+ headers: request_headers.merge(custom_headers || {}),
1179
+ base_url: request_url
1180
+ }
1181
+ promise = @client.make_request_async(:get, path_template, options)
1182
+
1183
+ promise = promise.then do |result|
1184
+ http_response = result.response
1185
+ status_code = http_response.status
1186
+ response_content = http_response.body
1187
+ unless status_code == 200
1188
+ error_model = JSON.load(response_content)
1189
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1190
+ end
1191
+
1192
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1193
+ # Deserialize Response
1194
+ if status_code == 200
1195
+ begin
1196
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1197
+ result_mapper = Azure::Authorization::Mgmt::V2018_09_01_preview::Models::RoleAssignmentListResult.mapper()
1198
+ result.body = @client.deserialize(result_mapper, parsed_response)
1199
+ rescue Exception => e
1200
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1201
+ end
1202
+ end
1203
+
1204
+ result
1205
+ end
1206
+
1207
+ promise.execute
1208
+ end
1209
+
1210
+ #
1211
+ # Gets all role assignments for the subscription.
1212
+ #
1213
+ # @param next_page_link [String] The NextLink from the previous successful call
1214
+ # to List operation.
1215
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1216
+ # will be added to the HTTP request.
1217
+ #
1218
+ # @return [RoleAssignmentListResult] operation results.
1219
+ #
1220
+ def list_next(next_page_link, custom_headers:nil)
1221
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
1222
+ response.body unless response.nil?
1223
+ end
1224
+
1225
+ #
1226
+ # Gets all role assignments for the subscription.
1227
+ #
1228
+ # @param next_page_link [String] The NextLink from the previous successful call
1229
+ # to List operation.
1230
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1231
+ # will be added to the HTTP request.
1232
+ #
1233
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1234
+ #
1235
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
1236
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
1237
+ end
1238
+
1239
+ #
1240
+ # Gets all role assignments for the subscription.
1241
+ #
1242
+ # @param next_page_link [String] The NextLink from the previous successful call
1243
+ # to List operation.
1244
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1245
+ # to the HTTP request.
1246
+ #
1247
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1248
+ #
1249
+ def list_next_async(next_page_link, custom_headers:nil)
1250
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1251
+
1252
+
1253
+ request_headers = {}
1254
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1255
+
1256
+ # Set Headers
1257
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1258
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1259
+ path_template = '{nextLink}'
1260
+
1261
+ request_url = @base_url || @client.base_url
1262
+
1263
+ options = {
1264
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1265
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1266
+ headers: request_headers.merge(custom_headers || {}),
1267
+ base_url: request_url
1268
+ }
1269
+ promise = @client.make_request_async(:get, path_template, options)
1270
+
1271
+ promise = promise.then do |result|
1272
+ http_response = result.response
1273
+ status_code = http_response.status
1274
+ response_content = http_response.body
1275
+ unless status_code == 200
1276
+ error_model = JSON.load(response_content)
1277
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1278
+ end
1279
+
1280
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1281
+ # Deserialize Response
1282
+ if status_code == 200
1283
+ begin
1284
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1285
+ result_mapper = Azure::Authorization::Mgmt::V2018_09_01_preview::Models::RoleAssignmentListResult.mapper()
1286
+ result.body = @client.deserialize(result_mapper, parsed_response)
1287
+ rescue Exception => e
1288
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1289
+ end
1290
+ end
1291
+
1292
+ result
1293
+ end
1294
+
1295
+ promise.execute
1296
+ end
1297
+
1298
+ #
1299
+ # Gets role assignments for a scope.
1300
+ #
1301
+ # @param next_page_link [String] The NextLink from the previous successful call
1302
+ # to List operation.
1303
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1304
+ # will be added to the HTTP request.
1305
+ #
1306
+ # @return [RoleAssignmentListResult] operation results.
1307
+ #
1308
+ def list_for_scope_next(next_page_link, custom_headers:nil)
1309
+ response = list_for_scope_next_async(next_page_link, custom_headers:custom_headers).value!
1310
+ response.body unless response.nil?
1311
+ end
1312
+
1313
+ #
1314
+ # Gets role assignments for a scope.
1315
+ #
1316
+ # @param next_page_link [String] The NextLink from the previous successful call
1317
+ # to List operation.
1318
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1319
+ # will be added to the HTTP request.
1320
+ #
1321
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1322
+ #
1323
+ def list_for_scope_next_with_http_info(next_page_link, custom_headers:nil)
1324
+ list_for_scope_next_async(next_page_link, custom_headers:custom_headers).value!
1325
+ end
1326
+
1327
+ #
1328
+ # Gets role assignments for a scope.
1329
+ #
1330
+ # @param next_page_link [String] The NextLink from the previous successful call
1331
+ # to List operation.
1332
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1333
+ # to the HTTP request.
1334
+ #
1335
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1336
+ #
1337
+ def list_for_scope_next_async(next_page_link, custom_headers:nil)
1338
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1339
+
1340
+
1341
+ request_headers = {}
1342
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1343
+
1344
+ # Set Headers
1345
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1346
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1347
+ path_template = '{nextLink}'
1348
+
1349
+ request_url = @base_url || @client.base_url
1350
+
1351
+ options = {
1352
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1353
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1354
+ headers: request_headers.merge(custom_headers || {}),
1355
+ base_url: request_url
1356
+ }
1357
+ promise = @client.make_request_async(:get, path_template, options)
1358
+
1359
+ promise = promise.then do |result|
1360
+ http_response = result.response
1361
+ status_code = http_response.status
1362
+ response_content = http_response.body
1363
+ unless status_code == 200
1364
+ error_model = JSON.load(response_content)
1365
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1366
+ end
1367
+
1368
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1369
+ # Deserialize Response
1370
+ if status_code == 200
1371
+ begin
1372
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1373
+ result_mapper = Azure::Authorization::Mgmt::V2018_09_01_preview::Models::RoleAssignmentListResult.mapper()
1374
+ result.body = @client.deserialize(result_mapper, parsed_response)
1375
+ rescue Exception => e
1376
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1377
+ end
1378
+ end
1379
+
1380
+ result
1381
+ end
1382
+
1383
+ promise.execute
1384
+ end
1385
+
1386
+ #
1387
+ # Gets role assignments for a resource.
1388
+ #
1389
+ # @param resource_group_name [String] The name of the resource group.
1390
+ # @param resource_provider_namespace [String] The namespace of the resource
1391
+ # provider.
1392
+ # @param parent_resource_path [String] The parent resource identity.
1393
+ # @param resource_type [String] The resource type of the resource.
1394
+ # @param resource_name [String] The name of the resource to get role
1395
+ # assignments for.
1396
+ # @param filter [String] The filter to apply on the operation. Use
1397
+ # $filter=atScope() to return all role assignments at or above the scope. Use
1398
+ # $filter=principalId eq {id} to return all role assignments at, above or below
1399
+ # the scope for the specified principal.
1400
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1401
+ # will be added to the HTTP request.
1402
+ #
1403
+ # @return [RoleAssignmentListResult] which provide lazy access to pages of the
1404
+ # response.
1405
+ #
1406
+ def list_for_resource_as_lazy(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:nil, custom_headers:nil)
1407
+ response = list_for_resource_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:filter, custom_headers:custom_headers).value!
1408
+ unless response.nil?
1409
+ page = response.body
1410
+ page.next_method = Proc.new do |next_page_link|
1411
+ list_for_resource_next_async(next_page_link, custom_headers:custom_headers)
1412
+ end
1413
+ page
1414
+ end
1415
+ end
1416
+
1417
+ #
1418
+ # Gets role assignments for a resource group.
1419
+ #
1420
+ # @param resource_group_name [String] The name of the resource group.
1421
+ # @param filter [String] The filter to apply on the operation. Use
1422
+ # $filter=atScope() to return all role assignments at or above the scope. Use
1423
+ # $filter=principalId eq {id} to return all role assignments at, above or below
1424
+ # the scope for the specified principal.
1425
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1426
+ # will be added to the HTTP request.
1427
+ #
1428
+ # @return [RoleAssignmentListResult] which provide lazy access to pages of the
1429
+ # response.
1430
+ #
1431
+ def list_for_resource_group_as_lazy(resource_group_name, filter:nil, custom_headers:nil)
1432
+ response = list_for_resource_group_async(resource_group_name, filter:filter, custom_headers:custom_headers).value!
1433
+ unless response.nil?
1434
+ page = response.body
1435
+ page.next_method = Proc.new do |next_page_link|
1436
+ list_for_resource_group_next_async(next_page_link, custom_headers:custom_headers)
1437
+ end
1438
+ page
1439
+ end
1440
+ end
1441
+
1442
+ #
1443
+ # Gets all role assignments for the subscription.
1444
+ #
1445
+ # @param filter [String] The filter to apply on the operation. Use
1446
+ # $filter=atScope() to return all role assignments at or above the scope. Use
1447
+ # $filter=principalId eq {id} to return all role assignments at, above or below
1448
+ # the scope for the specified principal.
1449
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1450
+ # will be added to the HTTP request.
1451
+ #
1452
+ # @return [RoleAssignmentListResult] which provide lazy access to pages of the
1453
+ # response.
1454
+ #
1455
+ def list_as_lazy(filter:nil, custom_headers:nil)
1456
+ response = list_async(filter:filter, custom_headers:custom_headers).value!
1457
+ unless response.nil?
1458
+ page = response.body
1459
+ page.next_method = Proc.new do |next_page_link|
1460
+ list_next_async(next_page_link, custom_headers:custom_headers)
1461
+ end
1462
+ page
1463
+ end
1464
+ end
1465
+
1466
+ #
1467
+ # Gets role assignments for a scope.
1468
+ #
1469
+ # @param scope [String] The scope of the role assignments.
1470
+ # @param filter [String] The filter to apply on the operation. Use
1471
+ # $filter=atScope() to return all role assignments at or above the scope. Use
1472
+ # $filter=principalId eq {id} to return all role assignments at, above or below
1473
+ # the scope for the specified principal.
1474
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1475
+ # will be added to the HTTP request.
1476
+ #
1477
+ # @return [RoleAssignmentListResult] which provide lazy access to pages of the
1478
+ # response.
1479
+ #
1480
+ def list_for_scope_as_lazy(scope, filter:nil, custom_headers:nil)
1481
+ response = list_for_scope_async(scope, filter:filter, custom_headers:custom_headers).value!
1482
+ unless response.nil?
1483
+ page = response.body
1484
+ page.next_method = Proc.new do |next_page_link|
1485
+ list_for_scope_next_async(next_page_link, custom_headers:custom_headers)
1486
+ end
1487
+ page
1488
+ end
1489
+ end
1490
+
1491
+ end
1492
+ end