azure_mgmt_graph 0.2.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 (39) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/LICENSE.txt +21 -0
  4. data/Rakefile +5 -0
  5. data/azure_mgmt_graph.gemspec +35 -0
  6. data/lib/azure_mgmt_graph.rb +55 -0
  7. data/lib/azure_mgmt_graph/application_operations.rb +336 -0
  8. data/lib/azure_mgmt_graph/graph_rbac_management_client.rb +82 -0
  9. data/lib/azure_mgmt_graph/group_operations.rb +647 -0
  10. data/lib/azure_mgmt_graph/models/aadobject.rb +138 -0
  11. data/lib/azure_mgmt_graph/models/adgroup.rb +92 -0
  12. data/lib/azure_mgmt_graph/models/application.rb +122 -0
  13. data/lib/azure_mgmt_graph/models/application_create_parameters.rb +160 -0
  14. data/lib/azure_mgmt_graph/models/application_filter.rb +74 -0
  15. data/lib/azure_mgmt_graph/models/application_list_result.rb +76 -0
  16. data/lib/azure_mgmt_graph/models/get_objects_parameters.rb +77 -0
  17. data/lib/azure_mgmt_graph/models/get_objects_result.rb +85 -0
  18. data/lib/azure_mgmt_graph/models/group_add_member_parameters.rb +56 -0
  19. data/lib/azure_mgmt_graph/models/group_create_parameters.rb +86 -0
  20. data/lib/azure_mgmt_graph/models/group_get_member_groups_parameters.rb +58 -0
  21. data/lib/azure_mgmt_graph/models/group_get_member_groups_result.rb +56 -0
  22. data/lib/azure_mgmt_graph/models/group_list_result.rb +85 -0
  23. data/lib/azure_mgmt_graph/models/key_credential.rb +105 -0
  24. data/lib/azure_mgmt_graph/models/password_credential.rb +87 -0
  25. data/lib/azure_mgmt_graph/models/service_principal.rb +92 -0
  26. data/lib/azure_mgmt_graph/models/service_principal_create_parameters.rb +66 -0
  27. data/lib/azure_mgmt_graph/models/service_principal_list_result.rb +86 -0
  28. data/lib/azure_mgmt_graph/models/user.rb +101 -0
  29. data/lib/azure_mgmt_graph/models/user_create_parameters.rb +103 -0
  30. data/lib/azure_mgmt_graph/models/user_create_parameters_password_profile.rb +65 -0
  31. data/lib/azure_mgmt_graph/models/user_get_member_groups_parameters.rb +58 -0
  32. data/lib/azure_mgmt_graph/models/user_get_member_groups_result.rb +56 -0
  33. data/lib/azure_mgmt_graph/models/user_list_result.rb +85 -0
  34. data/lib/azure_mgmt_graph/module_definition.rb +8 -0
  35. data/lib/azure_mgmt_graph/object_operations.rb +217 -0
  36. data/lib/azure_mgmt_graph/service_principal_operations.rb +331 -0
  37. data/lib/azure_mgmt_graph/user_operations.rb +408 -0
  38. data/lib/azure_mgmt_graph/version.rb +8 -0
  39. metadata +166 -0
@@ -0,0 +1,82 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Graph
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class GraphRbacManagementClient < MsRestAzure::AzureServiceClient
11
+ include Azure::ARM::Graph::Models
12
+ include MsRestAzure
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Gets Azure subscription credentials.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] Client Api Version.
21
+ attr_reader :api_version
22
+
23
+ # @return [String] Gets or sets the tenant Id.
24
+ attr_accessor :tenant_id
25
+
26
+ # @return [String] Gets or sets the preferred language for the response.
27
+ attr_accessor :accept_language
28
+
29
+ # @return [Integer] Gets or sets the retry timeout in seconds for Long
30
+ # Running Operations. Default value is 30.
31
+ attr_accessor :long_running_operation_retry_timeout
32
+
33
+ # @return [Boolean] When set to true a unique x-ms-client-request-id value
34
+ # is generated and included in each request. Default is true.
35
+ attr_accessor :generate_client_request_id
36
+
37
+ # @return Subscription credentials which uniquely identify client
38
+ # subscription.
39
+ attr_accessor :credentials
40
+
41
+ # @return application_operations
42
+ attr_reader :application_operations
43
+
44
+ # @return object_operations
45
+ attr_reader :object_operations
46
+
47
+ # @return group_operations
48
+ attr_reader :group_operations
49
+
50
+ # @return service_principal_operations
51
+ attr_reader :service_principal_operations
52
+
53
+ # @return user_operations
54
+ attr_reader :user_operations
55
+
56
+ #
57
+ # Creates initializes a new instance of the GraphRbacManagementClient class.
58
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
59
+ # @param base_url [String] the base URI of the service.
60
+ # @param options [Array] filters to be applied to the HTTP requests.
61
+ #
62
+ def initialize(credentials, base_url = nil, options = nil)
63
+ super(credentials, options)
64
+ @base_url = base_url || 'https://graph.windows.net'
65
+
66
+ fail ArgumentError, 'credentials is nil' if credentials.nil?
67
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials)
68
+ @credentials = credentials
69
+
70
+ @application_operations = ApplicationOperations.new(self)
71
+ @object_operations = ObjectOperations.new(self)
72
+ @group_operations = GroupOperations.new(self)
73
+ @service_principal_operations = ServicePrincipalOperations.new(self)
74
+ @user_operations = UserOperations.new(self)
75
+ @api_version = '1.6-internal'
76
+ @accept_language = 'en-US'
77
+ @long_running_operation_retry_timeout = 30
78
+ @generate_client_request_id = true
79
+ end
80
+
81
+ end
82
+ end
@@ -0,0 +1,647 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Graph
7
+ #
8
+ # GroupOperations
9
+ #
10
+ class GroupOperations
11
+ include Azure::ARM::Graph::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the GroupOperations class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return reference to the GraphRbacManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Remove a memeber from a group. Reference:
27
+ # http://msdn.microsoft.com/en-us/library/azure/dn151607.aspx
28
+ #
29
+ # @param group_object_id [String] Group object id
30
+ # @param member_object_id [String] Member Object id
31
+ # @param [Hash{String => String}] The hash of custom headers need to be
32
+ # applied to HTTP request.
33
+ #
34
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
35
+ # response.
36
+ #
37
+ def remove_member(group_object_id, member_object_id, custom_headers = nil)
38
+ fail ArgumentError, 'group_object_id is nil' if group_object_id.nil?
39
+ fail ArgumentError, 'member_object_id is nil' if member_object_id.nil?
40
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
41
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
42
+ request_headers = {}
43
+
44
+ # Set Headers
45
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
46
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
47
+ path_template = '/{tenantID}/groups/{groupObjectId}/$links/members/{memberObjectId}'
48
+ options = {
49
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
50
+ path_params: {'tenantID' => @client.tenant_id},
51
+ skip_encoding_path_params: {'groupObjectId' => group_object_id,'memberObjectId' => member_object_id},
52
+ query_params: {'api-version' => @client.api_version},
53
+ headers: request_headers.merge(custom_headers || {})
54
+ }
55
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
56
+ promise = request.run_promise do |req|
57
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
58
+ end
59
+
60
+ promise = promise.then do |http_response|
61
+ status_code = http_response.status
62
+ response_content = http_response.body
63
+ unless status_code == 204
64
+ error_model = JSON.load(response_content)
65
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
66
+ end
67
+
68
+ # Create Result
69
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
70
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
71
+
72
+ result
73
+ end
74
+
75
+ promise.execute
76
+ end
77
+
78
+ #
79
+ # Add a memeber to a group. Reference:
80
+ # http://msdn.microsoft.com/en-us/library/azure/dn151676.aspx
81
+ #
82
+ # @param group_object_id [String] Group object id
83
+ # @param parameters [GroupAddMemberParameters] Member Object Url as
84
+ # https://graph.windows.net/contoso.onmicrosoft.com/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd
85
+ # @param [Hash{String => String}] The hash of custom headers need to be
86
+ # applied to HTTP request.
87
+ #
88
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
89
+ # response.
90
+ #
91
+ def add_member(group_object_id, parameters, custom_headers = nil)
92
+ fail ArgumentError, 'group_object_id is nil' if group_object_id.nil?
93
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
94
+ parameters.validate unless parameters.nil?
95
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
96
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
97
+ request_headers = {}
98
+
99
+ # Set Headers
100
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
101
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
102
+
103
+ # Serialize Request
104
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
105
+ unless parameters.nil?
106
+ parameters = GroupAddMemberParameters.serialize_object(parameters)
107
+ end
108
+ request_content = JSON.generate(parameters, quirks_mode: true)
109
+ path_template = '/{tenantID}/groups/{groupObjectId}/$links/members'
110
+ options = {
111
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
112
+ path_params: {'tenantID' => @client.tenant_id},
113
+ skip_encoding_path_params: {'groupObjectId' => group_object_id},
114
+ query_params: {'api-version' => @client.api_version},
115
+ body: request_content,
116
+ headers: request_headers.merge(custom_headers || {})
117
+ }
118
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
119
+ promise = request.run_promise do |req|
120
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
121
+ end
122
+
123
+ promise = promise.then do |http_response|
124
+ status_code = http_response.status
125
+ response_content = http_response.body
126
+ unless status_code == 204
127
+ error_model = JSON.load(response_content)
128
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
129
+ end
130
+
131
+ # Create Result
132
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
133
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
134
+
135
+ result
136
+ end
137
+
138
+ promise.execute
139
+ end
140
+
141
+ #
142
+ # Delete a group in the directory. Reference:
143
+ # http://msdn.microsoft.com/en-us/library/azure/dn151676.aspx
144
+ #
145
+ # @param group_object_id [String] Object id
146
+ # @param [Hash{String => String}] The hash of custom headers need to be
147
+ # applied to HTTP request.
148
+ #
149
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
150
+ # response.
151
+ #
152
+ def delete(group_object_id, custom_headers = nil)
153
+ fail ArgumentError, 'group_object_id is nil' if group_object_id.nil?
154
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
155
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
156
+ request_headers = {}
157
+
158
+ # Set Headers
159
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
160
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
161
+ path_template = '/{tenantID}/groups/{groupObjectId}'
162
+ options = {
163
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
164
+ path_params: {'tenantID' => @client.tenant_id},
165
+ skip_encoding_path_params: {'groupObjectId' => group_object_id},
166
+ query_params: {'api-version' => @client.api_version},
167
+ headers: request_headers.merge(custom_headers || {})
168
+ }
169
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
170
+ promise = request.run_promise do |req|
171
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
172
+ end
173
+
174
+ promise = promise.then do |http_response|
175
+ status_code = http_response.status
176
+ response_content = http_response.body
177
+ unless status_code == 204
178
+ error_model = JSON.load(response_content)
179
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
180
+ end
181
+
182
+ # Create Result
183
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
184
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
185
+
186
+ result
187
+ end
188
+
189
+ promise.execute
190
+ end
191
+
192
+ #
193
+ # Create a group in the directory. Reference:
194
+ # http://msdn.microsoft.com/en-us/library/azure/dn151676.aspx
195
+ #
196
+ # @param parameters [GroupCreateParameters] Parameters to create a group
197
+ # @param [Hash{String => String}] The hash of custom headers need to be
198
+ # applied to HTTP request.
199
+ #
200
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
201
+ # response.
202
+ #
203
+ def create(parameters, custom_headers = nil)
204
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
205
+ parameters.validate unless parameters.nil?
206
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
207
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
208
+ request_headers = {}
209
+
210
+ # Set Headers
211
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
212
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
213
+
214
+ # Serialize Request
215
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
216
+ unless parameters.nil?
217
+ parameters = GroupCreateParameters.serialize_object(parameters)
218
+ end
219
+ request_content = JSON.generate(parameters, quirks_mode: true)
220
+ path_template = '/{tenantID}/groups'
221
+ options = {
222
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
223
+ path_params: {'tenantID' => @client.tenant_id},
224
+ query_params: {'api-version' => @client.api_version},
225
+ body: request_content,
226
+ headers: request_headers.merge(custom_headers || {})
227
+ }
228
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
229
+ promise = request.run_promise do |req|
230
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
231
+ end
232
+
233
+ promise = promise.then do |http_response|
234
+ status_code = http_response.status
235
+ response_content = http_response.body
236
+ unless status_code == 201
237
+ error_model = JSON.load(response_content)
238
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
239
+ end
240
+
241
+ # Create Result
242
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
243
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
244
+ # Deserialize Response
245
+ if status_code == 201
246
+ begin
247
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
248
+ unless parsed_response.nil?
249
+ parsed_response = ADGroup.deserialize_object(parsed_response)
250
+ end
251
+ result.body = parsed_response
252
+ rescue Exception => e
253
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
254
+ end
255
+ end
256
+
257
+ result
258
+ end
259
+
260
+ promise.execute
261
+ end
262
+
263
+ #
264
+ # Gets list of groups for the current tenant.
265
+ #
266
+ # @param filter [String] The filter to apply on the operation.
267
+ # @param [Hash{String => String}] The hash of custom headers need to be
268
+ # applied to HTTP request.
269
+ #
270
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
271
+ # response.
272
+ #
273
+ def list(filter = nil, custom_headers = nil)
274
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
275
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
276
+ request_headers = {}
277
+
278
+ # Set Headers
279
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
280
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
281
+ path_template = '/{tenantID}/groups'
282
+ options = {
283
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
284
+ path_params: {'tenantID' => @client.tenant_id},
285
+ query_params: {'$filter' => filter,'api-version' => @client.api_version},
286
+ headers: request_headers.merge(custom_headers || {})
287
+ }
288
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
289
+ promise = request.run_promise do |req|
290
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
291
+ end
292
+
293
+ promise = promise.then do |http_response|
294
+ status_code = http_response.status
295
+ response_content = http_response.body
296
+ unless status_code == 200
297
+ error_model = JSON.load(response_content)
298
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
299
+ end
300
+
301
+ # Create Result
302
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
303
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
304
+ # Deserialize Response
305
+ if status_code == 200
306
+ begin
307
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
308
+ unless parsed_response.nil?
309
+ parsed_response = GroupListResult.deserialize_object(parsed_response)
310
+ end
311
+ result.body = parsed_response
312
+ rescue Exception => e
313
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
314
+ end
315
+ end
316
+
317
+ result
318
+ end
319
+
320
+ promise.execute
321
+ end
322
+
323
+ #
324
+ # Gets the members of a group.
325
+ #
326
+ # @param object_id [String] Group object Id who's members should be retrieved.
327
+ # @param [Hash{String => String}] The hash of custom headers need to be
328
+ # applied to HTTP request.
329
+ #
330
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
331
+ # response.
332
+ #
333
+ def get_group_members(object_id, custom_headers = nil)
334
+ fail ArgumentError, 'object_id is nil' if object_id.nil?
335
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
336
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
337
+ request_headers = {}
338
+
339
+ # Set Headers
340
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
341
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
342
+ path_template = '/{tenantID}/groups/{objectId}/members'
343
+ options = {
344
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
345
+ path_params: {'tenantID' => @client.tenant_id},
346
+ skip_encoding_path_params: {'objectId' => object_id},
347
+ query_params: {'api-version' => @client.api_version},
348
+ headers: request_headers.merge(custom_headers || {})
349
+ }
350
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
351
+ promise = request.run_promise do |req|
352
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
353
+ end
354
+
355
+ promise = promise.then do |http_response|
356
+ status_code = http_response.status
357
+ response_content = http_response.body
358
+ unless status_code == 200
359
+ error_model = JSON.load(response_content)
360
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
361
+ end
362
+
363
+ # Create Result
364
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
365
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
366
+ # Deserialize Response
367
+ if status_code == 200
368
+ begin
369
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
370
+ unless parsed_response.nil?
371
+ parsed_response = GetObjectsResult.deserialize_object(parsed_response)
372
+ end
373
+ result.body = parsed_response
374
+ rescue Exception => e
375
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
376
+ end
377
+ end
378
+
379
+ result
380
+ end
381
+
382
+ promise.execute
383
+ end
384
+
385
+ #
386
+ # Gets group information from the directory.
387
+ #
388
+ # @param object_id [String] User objectId to get group information.
389
+ # @param [Hash{String => String}] The hash of custom headers need to be
390
+ # applied to HTTP request.
391
+ #
392
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
393
+ # response.
394
+ #
395
+ def get(object_id, custom_headers = nil)
396
+ fail ArgumentError, 'object_id is nil' if object_id.nil?
397
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
398
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
399
+ request_headers = {}
400
+
401
+ # Set Headers
402
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
403
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
404
+ path_template = '/{tenantID}/groups/{objectId}'
405
+ options = {
406
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
407
+ path_params: {'tenantID' => @client.tenant_id},
408
+ skip_encoding_path_params: {'objectId' => object_id},
409
+ query_params: {'api-version' => @client.api_version},
410
+ headers: request_headers.merge(custom_headers || {})
411
+ }
412
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
413
+ promise = request.run_promise do |req|
414
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
415
+ end
416
+
417
+ promise = promise.then do |http_response|
418
+ status_code = http_response.status
419
+ response_content = http_response.body
420
+ unless status_code == 200
421
+ error_model = JSON.load(response_content)
422
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
423
+ end
424
+
425
+ # Create Result
426
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
427
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
428
+ # Deserialize Response
429
+ if status_code == 200
430
+ begin
431
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
432
+ unless parsed_response.nil?
433
+ parsed_response = ADGroup.deserialize_object(parsed_response)
434
+ end
435
+ result.body = parsed_response
436
+ rescue Exception => e
437
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
438
+ end
439
+ end
440
+
441
+ result
442
+ end
443
+
444
+ promise.execute
445
+ end
446
+
447
+ #
448
+ # Gets a collection that contains the Object IDs of the groups of which the
449
+ # group is a member.
450
+ #
451
+ # @param object_id [String] Group filtering parameters.
452
+ # @param parameters [GroupGetMemberGroupsParameters] Group filtering
453
+ # parameters.
454
+ # @param [Hash{String => String}] The hash of custom headers need to be
455
+ # applied to HTTP request.
456
+ #
457
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
458
+ # response.
459
+ #
460
+ def get_member_groups(object_id, parameters, custom_headers = nil)
461
+ fail ArgumentError, 'object_id is nil' if object_id.nil?
462
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
463
+ parameters.validate unless parameters.nil?
464
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
465
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
466
+ request_headers = {}
467
+
468
+ # Set Headers
469
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
470
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
471
+
472
+ # Serialize Request
473
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
474
+ unless parameters.nil?
475
+ parameters = GroupGetMemberGroupsParameters.serialize_object(parameters)
476
+ end
477
+ request_content = JSON.generate(parameters, quirks_mode: true)
478
+ path_template = '/{tenantID}/groups/{objectId}/getMemberGroups'
479
+ options = {
480
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
481
+ path_params: {'tenantID' => @client.tenant_id},
482
+ skip_encoding_path_params: {'objectId' => object_id},
483
+ query_params: {'api-version' => @client.api_version},
484
+ body: request_content,
485
+ headers: request_headers.merge(custom_headers || {})
486
+ }
487
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
488
+ promise = request.run_promise do |req|
489
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
490
+ end
491
+
492
+ promise = promise.then do |http_response|
493
+ status_code = http_response.status
494
+ response_content = http_response.body
495
+ unless status_code == 200
496
+ error_model = JSON.load(response_content)
497
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
498
+ end
499
+
500
+ # Create Result
501
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
502
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
503
+ # Deserialize Response
504
+ if status_code == 200
505
+ begin
506
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
507
+ unless parsed_response.nil?
508
+ parsed_response = GroupGetMemberGroupsResult.deserialize_object(parsed_response)
509
+ end
510
+ result.body = parsed_response
511
+ rescue Exception => e
512
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
513
+ end
514
+ end
515
+
516
+ result
517
+ end
518
+
519
+ promise.execute
520
+ end
521
+
522
+ #
523
+ # Gets list of groups for the current tenant.
524
+ #
525
+ # @param next_link [String] Next link for list operation.
526
+ # @param [Hash{String => String}] The hash of custom headers need to be
527
+ # applied to HTTP request.
528
+ #
529
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
530
+ # response.
531
+ #
532
+ def list_next(next_link, custom_headers = nil)
533
+ fail ArgumentError, 'next_link is nil' if next_link.nil?
534
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
535
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
536
+ request_headers = {}
537
+
538
+ # Set Headers
539
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
540
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
541
+ path_template = '/{tenantID}/{nextLink}'
542
+ options = {
543
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
544
+ path_params: {'tenantID' => @client.tenant_id},
545
+ skip_encoding_path_params: {'nextLink' => next_link},
546
+ query_params: {'api-version' => @client.api_version},
547
+ headers: request_headers.merge(custom_headers || {})
548
+ }
549
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
550
+ promise = request.run_promise do |req|
551
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
552
+ end
553
+
554
+ promise = promise.then do |http_response|
555
+ status_code = http_response.status
556
+ response_content = http_response.body
557
+ unless status_code == 200
558
+ error_model = JSON.load(response_content)
559
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
560
+ end
561
+
562
+ # Create Result
563
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
564
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
565
+ # Deserialize Response
566
+ if status_code == 200
567
+ begin
568
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
569
+ unless parsed_response.nil?
570
+ parsed_response = GroupListResult.deserialize_object(parsed_response)
571
+ end
572
+ result.body = parsed_response
573
+ rescue Exception => e
574
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
575
+ end
576
+ end
577
+
578
+ result
579
+ end
580
+
581
+ promise.execute
582
+ end
583
+
584
+ #
585
+ # Gets the members of a group.
586
+ #
587
+ # @param next_link [String] Next link for list operation.
588
+ # @param [Hash{String => String}] The hash of custom headers need to be
589
+ # applied to HTTP request.
590
+ #
591
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
592
+ # response.
593
+ #
594
+ def get_group_members_next(next_link, custom_headers = nil)
595
+ fail ArgumentError, 'next_link is nil' if next_link.nil?
596
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
597
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
598
+ request_headers = {}
599
+
600
+ # Set Headers
601
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
602
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
603
+ path_template = '/{tenantID}/{nextLink}'
604
+ options = {
605
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
606
+ path_params: {'tenantID' => @client.tenant_id},
607
+ skip_encoding_path_params: {'nextLink' => next_link},
608
+ query_params: {'api-version' => @client.api_version},
609
+ headers: request_headers.merge(custom_headers || {})
610
+ }
611
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
612
+ promise = request.run_promise do |req|
613
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
614
+ end
615
+
616
+ promise = promise.then do |http_response|
617
+ status_code = http_response.status
618
+ response_content = http_response.body
619
+ unless status_code == 200
620
+ error_model = JSON.load(response_content)
621
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
622
+ end
623
+
624
+ # Create Result
625
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
626
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
627
+ # Deserialize Response
628
+ if status_code == 200
629
+ begin
630
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
631
+ unless parsed_response.nil?
632
+ parsed_response = GetObjectsResult.deserialize_object(parsed_response)
633
+ end
634
+ result.body = parsed_response
635
+ rescue Exception => e
636
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
637
+ end
638
+ end
639
+
640
+ result
641
+ end
642
+
643
+ promise.execute
644
+ end
645
+
646
+ end
647
+ end