azure_graph_rbac2 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/1.6/generated/azure_graph_rbac2/applications.rb +1131 -0
  4. data/lib/1.6/generated/azure_graph_rbac2/domains.rb +200 -0
  5. data/lib/1.6/generated/azure_graph_rbac2/graph_rbac_client.rb +151 -0
  6. data/lib/1.6/generated/azure_graph_rbac2/groups.rb +1079 -0
  7. data/lib/1.6/generated/azure_graph_rbac2/models/aadobject.rb +297 -0
  8. data/lib/1.6/generated/azure_graph_rbac2/models/adgroup.rb +116 -0
  9. data/lib/1.6/generated/azure_graph_rbac2/models/application.rb +196 -0
  10. data/lib/1.6/generated/azure_graph_rbac2/models/application_add_owner_parameters.rb +69 -0
  11. data/lib/1.6/generated/azure_graph_rbac2/models/application_create_parameters.rb +202 -0
  12. data/lib/1.6/generated/azure_graph_rbac2/models/application_list_result.rb +98 -0
  13. data/lib/1.6/generated/azure_graph_rbac2/models/application_update_parameters.rb +201 -0
  14. data/lib/1.6/generated/azure_graph_rbac2/models/check_group_membership_parameters.rb +77 -0
  15. data/lib/1.6/generated/azure_graph_rbac2/models/check_group_membership_result.rb +67 -0
  16. data/lib/1.6/generated/azure_graph_rbac2/models/directory_object.rb +92 -0
  17. data/lib/1.6/generated/azure_graph_rbac2/models/directory_object_list_result.rb +57 -0
  18. data/lib/1.6/generated/azure_graph_rbac2/models/domain.rb +101 -0
  19. data/lib/1.6/generated/azure_graph_rbac2/models/domain_list_result.rb +55 -0
  20. data/lib/1.6/generated/azure_graph_rbac2/models/get_objects_parameters.rb +104 -0
  21. data/lib/1.6/generated/azure_graph_rbac2/models/get_objects_result.rb +98 -0
  22. data/lib/1.6/generated/azure_graph_rbac2/models/graph_error.rb +57 -0
  23. data/lib/1.6/generated/azure_graph_rbac2/models/group_add_member_parameters.rb +69 -0
  24. data/lib/1.6/generated/azure_graph_rbac2/models/group_create_parameters.rb +106 -0
  25. data/lib/1.6/generated/azure_graph_rbac2/models/group_get_member_groups_parameters.rb +67 -0
  26. data/lib/1.6/generated/azure_graph_rbac2/models/group_get_member_groups_result.rb +55 -0
  27. data/lib/1.6/generated/azure_graph_rbac2/models/group_list_result.rb +98 -0
  28. data/lib/1.6/generated/azure_graph_rbac2/models/key_credential.rb +132 -0
  29. data/lib/1.6/generated/azure_graph_rbac2/models/key_credential_list_result.rb +55 -0
  30. data/lib/1.6/generated/azure_graph_rbac2/models/key_credentials_update_parameters.rb +55 -0
  31. data/lib/1.6/generated/azure_graph_rbac2/models/password_credential.rb +98 -0
  32. data/lib/1.6/generated/azure_graph_rbac2/models/password_credential_list_result.rb +56 -0
  33. data/lib/1.6/generated/azure_graph_rbac2/models/password_credentials_update_parameters.rb +56 -0
  34. data/lib/1.6/generated/azure_graph_rbac2/models/password_profile.rb +76 -0
  35. data/lib/1.6/generated/azure_graph_rbac2/models/required_resource_access.rb +94 -0
  36. data/lib/1.6/generated/azure_graph_rbac2/models/resource_access.rb +80 -0
  37. data/lib/1.6/generated/azure_graph_rbac2/models/service_principal.rb +124 -0
  38. data/lib/1.6/generated/azure_graph_rbac2/models/service_principal_create_parameters.rb +117 -0
  39. data/lib/1.6/generated/azure_graph_rbac2/models/service_principal_list_result.rb +98 -0
  40. data/lib/1.6/generated/azure_graph_rbac2/models/sign_in_name.rb +79 -0
  41. data/lib/1.6/generated/azure_graph_rbac2/models/user.rb +221 -0
  42. data/lib/1.6/generated/azure_graph_rbac2/models/user_base.rb +118 -0
  43. data/lib/1.6/generated/azure_graph_rbac2/models/user_create_parameters.rb +158 -0
  44. data/lib/1.6/generated/azure_graph_rbac2/models/user_get_member_groups_parameters.rb +67 -0
  45. data/lib/1.6/generated/azure_graph_rbac2/models/user_get_member_groups_result.rb +55 -0
  46. data/lib/1.6/generated/azure_graph_rbac2/models/user_list_result.rb +98 -0
  47. data/lib/1.6/generated/azure_graph_rbac2/models/user_type.rb +16 -0
  48. data/lib/1.6/generated/azure_graph_rbac2/models/user_update_parameters.rb +147 -0
  49. data/lib/1.6/generated/azure_graph_rbac2/module_definition.rb +8 -0
  50. data/lib/1.6/generated/azure_graph_rbac2/objects.rb +314 -0
  51. data/lib/1.6/generated/azure_graph_rbac2/service_principals.rb +949 -0
  52. data/lib/1.6/generated/azure_graph_rbac2/users.rb +686 -0
  53. data/lib/1.6/generated/azure_graph_rbac2.rb +75 -0
  54. data/lib/azure_graph_rbac2.rb +6 -0
  55. data/lib/module_definition.rb +6 -0
  56. data/lib/profiles/latest/graphrbac_latest_profile_client.rb +38 -0
  57. data/lib/profiles/latest/graphrbac_module_definition.rb +8 -0
  58. data/lib/profiles/latest/modules/graphrbac_profile_module.rb +237 -0
  59. data/lib/version.rb +7 -0
  60. metadata +190 -0
@@ -0,0 +1,686 @@
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::GraphRbac2::V1_6
7
+ #
8
+ # The Graph RBAC Management Client
9
+ #
10
+ class Users
11
+ include MsRestAzure2
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Users class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [GraphRbacClient] reference to the GraphRbacClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Create a new user.
26
+ #
27
+ # @param parameters [UserCreateParameters] Parameters to create a user.
28
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
29
+ # will be added to the HTTP request.
30
+ #
31
+ # @return [User] operation results.
32
+ #
33
+ def create(parameters, custom_headers:nil)
34
+ response = create_async(parameters, custom_headers:custom_headers).value!
35
+ response.body unless response.nil?
36
+ end
37
+
38
+ #
39
+ # Create a new user.
40
+ #
41
+ # @param parameters [UserCreateParameters] Parameters to create a user.
42
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
43
+ # will be added to the HTTP request.
44
+ #
45
+ # @return [MsRestAzure2::AzureOperationResponse] HTTP response information.
46
+ #
47
+ def create_with_http_info(parameters, custom_headers:nil)
48
+ create_async(parameters, custom_headers:custom_headers).value!
49
+ end
50
+
51
+ #
52
+ # Create a new user.
53
+ #
54
+ # @param parameters [UserCreateParameters] Parameters to create a user.
55
+ # @param [Hash{String => String}] A hash of custom headers that will be added
56
+ # to the HTTP request.
57
+ #
58
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
59
+ #
60
+ def create_async(parameters, custom_headers:nil)
61
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
62
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
63
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
64
+
65
+
66
+ request_headers = {}
67
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
68
+
69
+ # Set Headers
70
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
71
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
72
+
73
+ # Serialize Request
74
+ request_mapper = Azure::GraphRbac2::V1_6::Models::UserCreateParameters.mapper()
75
+ request_content = @client.serialize(request_mapper, parameters)
76
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
77
+
78
+ path_template = '{tenantID}/users'
79
+
80
+ request_url = @base_url || @client.base_url
81
+
82
+ options = {
83
+ middlewares: [[MsRest2::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
84
+ path_params: {'tenantID' => @client.tenant_id},
85
+ query_params: {'api-version' => @client.api_version},
86
+ body: request_content,
87
+ headers: request_headers.merge(custom_headers || {}),
88
+ base_url: request_url
89
+ }
90
+ promise = @client.make_request_async(:post, path_template, options)
91
+
92
+ promise = promise.then do |result|
93
+ http_response = result.response
94
+ status_code = http_response.status
95
+ response_content = http_response.body
96
+ unless status_code == 201
97
+ error_model = JSON.load(response_content)
98
+ fail MsRest2::HttpOperationError.new(result.request, http_response, error_model)
99
+ end
100
+
101
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
102
+ # Deserialize Response
103
+ if status_code == 201
104
+ begin
105
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
106
+ result_mapper = Azure::GraphRbac2::V1_6::Models::User.mapper()
107
+ result.body = @client.deserialize(result_mapper, parsed_response)
108
+ rescue Exception => e
109
+ fail MsRest2::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
110
+ end
111
+ end
112
+
113
+ result
114
+ end
115
+
116
+ promise.execute
117
+ end
118
+
119
+ #
120
+ # Gets list of users for the current tenant.
121
+ #
122
+ # @param filter [String] The filter to apply to the operation.
123
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
124
+ # will be added to the HTTP request.
125
+ #
126
+ # @return [Array<User>] operation results.
127
+ #
128
+ def list(filter:nil, custom_headers:nil)
129
+ first_page = list_as_lazy(filter:filter, custom_headers:custom_headers)
130
+ first_page.get_all_items
131
+ end
132
+
133
+ #
134
+ # Gets list of users for the current tenant.
135
+ #
136
+ # @param filter [String] The filter to apply to the operation.
137
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
138
+ # will be added to the HTTP request.
139
+ #
140
+ # @return [MsRestAzure2::AzureOperationResponse] HTTP response information.
141
+ #
142
+ def list_with_http_info(filter:nil, custom_headers:nil)
143
+ list_async(filter:filter, custom_headers:custom_headers).value!
144
+ end
145
+
146
+ #
147
+ # Gets list of users for the current tenant.
148
+ #
149
+ # @param filter [String] The filter to apply to the operation.
150
+ # @param [Hash{String => String}] A hash of custom headers that will be added
151
+ # to the HTTP request.
152
+ #
153
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
154
+ #
155
+ def list_async(filter:nil, custom_headers:nil)
156
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
157
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
158
+
159
+
160
+ request_headers = {}
161
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
162
+
163
+ # Set Headers
164
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
165
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
166
+ path_template = '{tenantID}/users'
167
+
168
+ request_url = @base_url || @client.base_url
169
+
170
+ options = {
171
+ middlewares: [[MsRest2::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
172
+ path_params: {'tenantID' => @client.tenant_id},
173
+ query_params: {'$filter' => filter,'api-version' => @client.api_version},
174
+ headers: request_headers.merge(custom_headers || {}),
175
+ base_url: request_url
176
+ }
177
+ promise = @client.make_request_async(:get, path_template, options)
178
+
179
+ promise = promise.then do |result|
180
+ http_response = result.response
181
+ status_code = http_response.status
182
+ response_content = http_response.body
183
+ unless status_code == 200
184
+ error_model = JSON.load(response_content)
185
+ fail MsRest2::HttpOperationError.new(result.request, http_response, error_model)
186
+ end
187
+
188
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
189
+ # Deserialize Response
190
+ if status_code == 200
191
+ begin
192
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
193
+ result_mapper = Azure::GraphRbac2::V1_6::Models::UserListResult.mapper()
194
+ result.body = @client.deserialize(result_mapper, parsed_response)
195
+ rescue Exception => e
196
+ fail MsRest2::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
197
+ end
198
+ end
199
+
200
+ result
201
+ end
202
+
203
+ promise.execute
204
+ end
205
+
206
+ #
207
+ # Gets user information from the directory.
208
+ #
209
+ # @param upn_or_object_id [String] The object ID or principal name of the user
210
+ # for which to get information.
211
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
212
+ # will be added to the HTTP request.
213
+ #
214
+ # @return [User] operation results.
215
+ #
216
+ def get(upn_or_object_id, custom_headers:nil)
217
+ response = get_async(upn_or_object_id, custom_headers:custom_headers).value!
218
+ response.body unless response.nil?
219
+ end
220
+
221
+ #
222
+ # Gets user information from the directory.
223
+ #
224
+ # @param upn_or_object_id [String] The object ID or principal name of the user
225
+ # for which to get information.
226
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
227
+ # will be added to the HTTP request.
228
+ #
229
+ # @return [MsRestAzure2::AzureOperationResponse] HTTP response information.
230
+ #
231
+ def get_with_http_info(upn_or_object_id, custom_headers:nil)
232
+ get_async(upn_or_object_id, custom_headers:custom_headers).value!
233
+ end
234
+
235
+ #
236
+ # Gets user information from the directory.
237
+ #
238
+ # @param upn_or_object_id [String] The object ID or principal name of the user
239
+ # for which to get information.
240
+ # @param [Hash{String => String}] A hash of custom headers that will be added
241
+ # to the HTTP request.
242
+ #
243
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
244
+ #
245
+ def get_async(upn_or_object_id, custom_headers:nil)
246
+ fail ArgumentError, 'upn_or_object_id is nil' if upn_or_object_id.nil?
247
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
248
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
249
+
250
+
251
+ request_headers = {}
252
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
253
+
254
+ # Set Headers
255
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
256
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
257
+ path_template = '{tenantID}/users/{upnOrObjectId}'
258
+
259
+ request_url = @base_url || @client.base_url
260
+
261
+ options = {
262
+ middlewares: [[MsRest2::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
263
+ path_params: {'upnOrObjectId' => upn_or_object_id,'tenantID' => @client.tenant_id},
264
+ query_params: {'api-version' => @client.api_version},
265
+ headers: request_headers.merge(custom_headers || {}),
266
+ base_url: request_url
267
+ }
268
+ promise = @client.make_request_async(:get, path_template, options)
269
+
270
+ promise = promise.then do |result|
271
+ http_response = result.response
272
+ status_code = http_response.status
273
+ response_content = http_response.body
274
+ unless status_code == 200
275
+ error_model = JSON.load(response_content)
276
+ fail MsRest2::HttpOperationError.new(result.request, http_response, error_model)
277
+ end
278
+
279
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
280
+ # Deserialize Response
281
+ if status_code == 200
282
+ begin
283
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
284
+ result_mapper = Azure::GraphRbac2::V1_6::Models::User.mapper()
285
+ result.body = @client.deserialize(result_mapper, parsed_response)
286
+ rescue Exception => e
287
+ fail MsRest2::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
288
+ end
289
+ end
290
+
291
+ result
292
+ end
293
+
294
+ promise.execute
295
+ end
296
+
297
+ #
298
+ # Updates a user.
299
+ #
300
+ # @param upn_or_object_id [String] The object ID or principal name of the user
301
+ # to update.
302
+ # @param parameters [UserUpdateParameters] Parameters to update an existing
303
+ # user.
304
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
305
+ # will be added to the HTTP request.
306
+ #
307
+ #
308
+ def update(upn_or_object_id, parameters, custom_headers:nil)
309
+ response = update_async(upn_or_object_id, parameters, custom_headers:custom_headers).value!
310
+ nil
311
+ end
312
+
313
+ #
314
+ # Updates a user.
315
+ #
316
+ # @param upn_or_object_id [String] The object ID or principal name of the user
317
+ # to update.
318
+ # @param parameters [UserUpdateParameters] Parameters to update an existing
319
+ # user.
320
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
321
+ # will be added to the HTTP request.
322
+ #
323
+ # @return [MsRestAzure2::AzureOperationResponse] HTTP response information.
324
+ #
325
+ def update_with_http_info(upn_or_object_id, parameters, custom_headers:nil)
326
+ update_async(upn_or_object_id, parameters, custom_headers:custom_headers).value!
327
+ end
328
+
329
+ #
330
+ # Updates a user.
331
+ #
332
+ # @param upn_or_object_id [String] The object ID or principal name of the user
333
+ # to update.
334
+ # @param parameters [UserUpdateParameters] Parameters to update an existing
335
+ # user.
336
+ # @param [Hash{String => String}] A hash of custom headers that will be added
337
+ # to the HTTP request.
338
+ #
339
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
340
+ #
341
+ def update_async(upn_or_object_id, parameters, custom_headers:nil)
342
+ fail ArgumentError, 'upn_or_object_id is nil' if upn_or_object_id.nil?
343
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
344
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
345
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
346
+
347
+
348
+ request_headers = {}
349
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
350
+
351
+ # Set Headers
352
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
353
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
354
+
355
+ # Serialize Request
356
+ request_mapper = Azure::GraphRbac2::V1_6::Models::UserUpdateParameters.mapper()
357
+ request_content = @client.serialize(request_mapper, parameters)
358
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
359
+
360
+ path_template = '{tenantID}/users/{upnOrObjectId}'
361
+
362
+ request_url = @base_url || @client.base_url
363
+
364
+ options = {
365
+ middlewares: [[MsRest2::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
366
+ path_params: {'upnOrObjectId' => upn_or_object_id,'tenantID' => @client.tenant_id},
367
+ query_params: {'api-version' => @client.api_version},
368
+ body: request_content,
369
+ headers: request_headers.merge(custom_headers || {}),
370
+ base_url: request_url
371
+ }
372
+ promise = @client.make_request_async(:patch, path_template, options)
373
+
374
+ promise = promise.then do |result|
375
+ http_response = result.response
376
+ status_code = http_response.status
377
+ response_content = http_response.body
378
+ unless status_code == 204
379
+ error_model = JSON.load(response_content)
380
+ fail MsRest2::HttpOperationError.new(result.request, http_response, error_model)
381
+ end
382
+
383
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
384
+
385
+ result
386
+ end
387
+
388
+ promise.execute
389
+ end
390
+
391
+ #
392
+ # Delete a user.
393
+ #
394
+ # @param upn_or_object_id [String] The object ID or principal name of the user
395
+ # to delete.
396
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
397
+ # will be added to the HTTP request.
398
+ #
399
+ #
400
+ def delete(upn_or_object_id, custom_headers:nil)
401
+ response = delete_async(upn_or_object_id, custom_headers:custom_headers).value!
402
+ nil
403
+ end
404
+
405
+ #
406
+ # Delete a user.
407
+ #
408
+ # @param upn_or_object_id [String] The object ID or principal name of the user
409
+ # to delete.
410
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
411
+ # will be added to the HTTP request.
412
+ #
413
+ # @return [MsRestAzure2::AzureOperationResponse] HTTP response information.
414
+ #
415
+ def delete_with_http_info(upn_or_object_id, custom_headers:nil)
416
+ delete_async(upn_or_object_id, custom_headers:custom_headers).value!
417
+ end
418
+
419
+ #
420
+ # Delete a user.
421
+ #
422
+ # @param upn_or_object_id [String] The object ID or principal name of the user
423
+ # to delete.
424
+ # @param [Hash{String => String}] A hash of custom headers that will be added
425
+ # to the HTTP request.
426
+ #
427
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
428
+ #
429
+ def delete_async(upn_or_object_id, custom_headers:nil)
430
+ fail ArgumentError, 'upn_or_object_id is nil' if upn_or_object_id.nil?
431
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
432
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
433
+
434
+
435
+ request_headers = {}
436
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
437
+
438
+ # Set Headers
439
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
440
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
441
+ path_template = '{tenantID}/users/{upnOrObjectId}'
442
+
443
+ request_url = @base_url || @client.base_url
444
+
445
+ options = {
446
+ middlewares: [[MsRest2::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
447
+ path_params: {'upnOrObjectId' => upn_or_object_id,'tenantID' => @client.tenant_id},
448
+ query_params: {'api-version' => @client.api_version},
449
+ headers: request_headers.merge(custom_headers || {}),
450
+ base_url: request_url
451
+ }
452
+ promise = @client.make_request_async(:delete, path_template, options)
453
+
454
+ promise = promise.then do |result|
455
+ http_response = result.response
456
+ status_code = http_response.status
457
+ response_content = http_response.body
458
+ unless status_code == 204
459
+ error_model = JSON.load(response_content)
460
+ fail MsRest2::HttpOperationError.new(result.request, http_response, error_model)
461
+ end
462
+
463
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
464
+
465
+ result
466
+ end
467
+
468
+ promise.execute
469
+ end
470
+
471
+ #
472
+ # Gets a collection that contains the object IDs of the groups of which the
473
+ # user is a member.
474
+ #
475
+ # @param object_id [String] The object ID of the user for which to get group
476
+ # membership.
477
+ # @param parameters [UserGetMemberGroupsParameters] User filtering parameters.
478
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
479
+ # will be added to the HTTP request.
480
+ #
481
+ # @return [UserGetMemberGroupsResult] operation results.
482
+ #
483
+ def get_member_groups(object_id, parameters, custom_headers:nil)
484
+ response = get_member_groups_async(object_id, parameters, custom_headers:custom_headers).value!
485
+ response.body unless response.nil?
486
+ end
487
+
488
+ #
489
+ # Gets a collection that contains the object IDs of the groups of which the
490
+ # user is a member.
491
+ #
492
+ # @param object_id [String] The object ID of the user for which to get group
493
+ # membership.
494
+ # @param parameters [UserGetMemberGroupsParameters] User filtering parameters.
495
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
496
+ # will be added to the HTTP request.
497
+ #
498
+ # @return [MsRestAzure2::AzureOperationResponse] HTTP response information.
499
+ #
500
+ def get_member_groups_with_http_info(object_id, parameters, custom_headers:nil)
501
+ get_member_groups_async(object_id, parameters, custom_headers:custom_headers).value!
502
+ end
503
+
504
+ #
505
+ # Gets a collection that contains the object IDs of the groups of which the
506
+ # user is a member.
507
+ #
508
+ # @param object_id [String] The object ID of the user for which to get group
509
+ # membership.
510
+ # @param parameters [UserGetMemberGroupsParameters] User filtering parameters.
511
+ # @param [Hash{String => String}] A hash of custom headers that will be added
512
+ # to the HTTP request.
513
+ #
514
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
515
+ #
516
+ def get_member_groups_async(object_id, parameters, custom_headers:nil)
517
+ fail ArgumentError, 'object_id is nil' if object_id.nil?
518
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
519
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
520
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
521
+
522
+
523
+ request_headers = {}
524
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
525
+
526
+ # Set Headers
527
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
528
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
529
+
530
+ # Serialize Request
531
+ request_mapper = Azure::GraphRbac2::V1_6::Models::UserGetMemberGroupsParameters.mapper()
532
+ request_content = @client.serialize(request_mapper, parameters)
533
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
534
+
535
+ path_template = '{tenantID}/users/{objectId}/getMemberGroups'
536
+
537
+ request_url = @base_url || @client.base_url
538
+
539
+ options = {
540
+ middlewares: [[MsRest2::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
541
+ path_params: {'objectId' => object_id,'tenantID' => @client.tenant_id},
542
+ query_params: {'api-version' => @client.api_version},
543
+ body: request_content,
544
+ headers: request_headers.merge(custom_headers || {}),
545
+ base_url: request_url
546
+ }
547
+ promise = @client.make_request_async(:post, path_template, options)
548
+
549
+ promise = promise.then do |result|
550
+ http_response = result.response
551
+ status_code = http_response.status
552
+ response_content = http_response.body
553
+ unless status_code == 200
554
+ error_model = JSON.load(response_content)
555
+ fail MsRest2::HttpOperationError.new(result.request, http_response, error_model)
556
+ end
557
+
558
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
559
+ # Deserialize Response
560
+ if status_code == 200
561
+ begin
562
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
563
+ result_mapper = Azure::GraphRbac2::V1_6::Models::UserGetMemberGroupsResult.mapper()
564
+ result.body = @client.deserialize(result_mapper, parsed_response)
565
+ rescue Exception => e
566
+ fail MsRest2::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
567
+ end
568
+ end
569
+
570
+ result
571
+ end
572
+
573
+ promise.execute
574
+ end
575
+
576
+ #
577
+ # Gets a list of users for the current tenant.
578
+ #
579
+ # @param next_link [String] Next link for the list operation.
580
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
581
+ # will be added to the HTTP request.
582
+ #
583
+ # @return [Array<User>] operation results.
584
+ #
585
+ def list_next(next_link, custom_headers:nil)
586
+ response = list_next_async(next_link, custom_headers:custom_headers).value!
587
+ response.body unless response.nil?
588
+ end
589
+
590
+ #
591
+ # Gets a list of users for the current tenant.
592
+ #
593
+ # @param next_link [String] Next link for the list operation.
594
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
595
+ # will be added to the HTTP request.
596
+ #
597
+ # @return [MsRestAzure2::AzureOperationResponse] HTTP response information.
598
+ #
599
+ def list_next_with_http_info(next_link, custom_headers:nil)
600
+ list_next_async(next_link, custom_headers:custom_headers).value!
601
+ end
602
+
603
+ #
604
+ # Gets a list of users for the current tenant.
605
+ #
606
+ # @param next_link [String] Next link for the list operation.
607
+ # @param [Hash{String => String}] A hash of custom headers that will be added
608
+ # to the HTTP request.
609
+ #
610
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
611
+ #
612
+ def list_next_async(next_link, custom_headers:nil)
613
+ fail ArgumentError, 'next_link is nil' if next_link.nil?
614
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
615
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
616
+
617
+
618
+ request_headers = {}
619
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
620
+
621
+ # Set Headers
622
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
623
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
624
+ path_template = '{tenantID}/{nextLink}'
625
+
626
+ request_url = @base_url || @client.base_url
627
+
628
+ options = {
629
+ middlewares: [[MsRest2::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
630
+ path_params: {'tenantID' => @client.tenant_id},
631
+ skip_encoding_path_params: {'nextLink' => next_link},
632
+ query_params: {'api-version' => @client.api_version},
633
+ headers: request_headers.merge(custom_headers || {}),
634
+ base_url: request_url
635
+ }
636
+ promise = @client.make_request_async(:get, path_template, options)
637
+
638
+ promise = promise.then do |result|
639
+ http_response = result.response
640
+ status_code = http_response.status
641
+ response_content = http_response.body
642
+ unless status_code == 200
643
+ error_model = JSON.load(response_content)
644
+ fail MsRest2::HttpOperationError.new(result.request, http_response, error_model)
645
+ end
646
+
647
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
648
+ # Deserialize Response
649
+ if status_code == 200
650
+ begin
651
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
652
+ result_mapper = Azure::GraphRbac2::V1_6::Models::UserListResult.mapper()
653
+ result.body = @client.deserialize(result_mapper, parsed_response)
654
+ rescue Exception => e
655
+ fail MsRest2::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
656
+ end
657
+ end
658
+
659
+ result
660
+ end
661
+
662
+ promise.execute
663
+ end
664
+
665
+ #
666
+ # Gets list of users for the current tenant.
667
+ #
668
+ # @param filter [String] The filter to apply to the operation.
669
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
670
+ # will be added to the HTTP request.
671
+ #
672
+ # @return [UserListResult] which provide lazy access to pages of the response.
673
+ #
674
+ def list_as_lazy(filter:nil, custom_headers:nil)
675
+ response = list_async(filter:filter, custom_headers:custom_headers).value!
676
+ unless response.nil?
677
+ page = response.body
678
+ page.next_method = Proc.new do |next_link|
679
+ list_next_async(next_link, custom_headers:custom_headers)
680
+ end
681
+ page
682
+ end
683
+ end
684
+
685
+ end
686
+ end