azure_mgmt_graph 0.4.0 → 0.5.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 (30) hide show
  1. checksums.yaml +4 -4
  2. data/azure_mgmt_graph.gemspec +1 -1
  3. data/lib/generated/azure_mgmt_graph.rb +5 -0
  4. data/lib/generated/azure_mgmt_graph/applications.rb +395 -6
  5. data/lib/generated/azure_mgmt_graph/graph_rbac_management_client.rb +2 -2
  6. data/lib/generated/azure_mgmt_graph/groups.rb +16 -16
  7. data/lib/generated/azure_mgmt_graph/models/aadobject.rb +10 -11
  8. data/lib/generated/azure_mgmt_graph/models/adgroup.rb +5 -5
  9. data/lib/generated/azure_mgmt_graph/models/application.rb +7 -7
  10. data/lib/generated/azure_mgmt_graph/models/application_create_parameters.rb +4 -5
  11. data/lib/generated/azure_mgmt_graph/models/application_update_parameters.rb +14 -4
  12. data/lib/generated/azure_mgmt_graph/models/get_objects_result.rb +1 -1
  13. data/lib/generated/azure_mgmt_graph/models/graph_error.rb +54 -0
  14. data/lib/generated/azure_mgmt_graph/models/group_list_result.rb +2 -2
  15. data/lib/generated/azure_mgmt_graph/models/key_credential.rb +8 -7
  16. data/lib/generated/azure_mgmt_graph/models/key_credential_list_result.rb +52 -0
  17. data/lib/generated/azure_mgmt_graph/models/key_credentials_update_parameters.rb +52 -0
  18. data/lib/generated/azure_mgmt_graph/models/password_credential.rb +5 -5
  19. data/lib/generated/azure_mgmt_graph/models/password_credential_list_result.rb +52 -0
  20. data/lib/generated/azure_mgmt_graph/models/password_credentials_update_parameters.rb +52 -0
  21. data/lib/generated/azure_mgmt_graph/models/service_principal.rb +5 -5
  22. data/lib/generated/azure_mgmt_graph/models/service_principal_create_parameters.rb +38 -1
  23. data/lib/generated/azure_mgmt_graph/models/service_principal_list_result.rb +2 -3
  24. data/lib/generated/azure_mgmt_graph/models/user.rb +6 -6
  25. data/lib/generated/azure_mgmt_graph/models/user_list_result.rb +2 -2
  26. data/lib/generated/azure_mgmt_graph/objects.rb +2 -2
  27. data/lib/generated/azure_mgmt_graph/service_principals.rb +406 -8
  28. data/lib/generated/azure_mgmt_graph/users.rb +10 -10
  29. data/lib/generated/azure_mgmt_graph/version.rb +1 -1
  30. metadata +9 -4
@@ -0,0 +1,52 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.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
+ module Models
8
+ #
9
+ # Request parameters for KeyCredentials update operation
10
+ #
11
+ class KeyCredentialsUpdateParameters
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Array<KeyCredential>] KeyCredential list.
16
+ attr_accessor :value
17
+
18
+
19
+ #
20
+ # Mapper for KeyCredentialsUpdateParameters class as Ruby Hash.
21
+ # This will be used for serialization/deserialization.
22
+ #
23
+ def self.mapper()
24
+ {
25
+ required: false,
26
+ serialized_name: 'KeyCredentialsUpdateParameters',
27
+ type: {
28
+ name: 'Composite',
29
+ class_name: 'KeyCredentialsUpdateParameters',
30
+ model_properties: {
31
+ value: {
32
+ required: false,
33
+ serialized_name: 'value',
34
+ type: {
35
+ name: 'Sequence',
36
+ element: {
37
+ required: false,
38
+ serialized_name: 'KeyCredentialElementType',
39
+ type: {
40
+ name: 'Composite',
41
+ class_name: 'KeyCredential'
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
47
+ }
48
+ }
49
+ end
50
+ end
51
+ end
52
+ end
@@ -6,22 +6,22 @@
6
6
  module Azure::ARM::Graph
7
7
  module Models
8
8
  #
9
- # Active Directory service principal Password Credential information
9
+ # Active Directory PasswordCredential information
10
10
  #
11
11
  class PasswordCredential
12
12
 
13
13
  include MsRestAzure
14
14
 
15
- # @return [DateTime] Gets or sets start date
15
+ # @return [DateTime] start date
16
16
  attr_accessor :start_date
17
17
 
18
- # @return [DateTime] Gets or sets end date
18
+ # @return [DateTime] end date
19
19
  attr_accessor :end_date
20
20
 
21
- # @return [String] Gets or sets key Id
21
+ # @return [String] key Id
22
22
  attr_accessor :key_id
23
23
 
24
- # @return [String] Gets or sets value
24
+ # @return [String] value
25
25
  attr_accessor :value
26
26
 
27
27
 
@@ -0,0 +1,52 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.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
+ module Models
8
+ #
9
+ # PasswordCredential list operation result.
10
+ #
11
+ class PasswordCredentialListResult
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Array<PasswordCredential>] PasswordCredential list.
16
+ attr_accessor :value
17
+
18
+
19
+ #
20
+ # Mapper for PasswordCredentialListResult class as Ruby Hash.
21
+ # This will be used for serialization/deserialization.
22
+ #
23
+ def self.mapper()
24
+ {
25
+ required: false,
26
+ serialized_name: 'PasswordCredentialListResult',
27
+ type: {
28
+ name: 'Composite',
29
+ class_name: 'PasswordCredentialListResult',
30
+ model_properties: {
31
+ value: {
32
+ required: false,
33
+ serialized_name: 'value',
34
+ type: {
35
+ name: 'Sequence',
36
+ element: {
37
+ required: false,
38
+ serialized_name: 'PasswordCredentialElementType',
39
+ type: {
40
+ name: 'Composite',
41
+ class_name: 'PasswordCredential'
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
47
+ }
48
+ }
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,52 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.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
+ module Models
8
+ #
9
+ # Request paramters for PasswordCredentials update operation
10
+ #
11
+ class PasswordCredentialsUpdateParameters
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Array<PasswordCredential>] PasswordCredential list.
16
+ attr_accessor :value
17
+
18
+
19
+ #
20
+ # Mapper for PasswordCredentialsUpdateParameters class as Ruby Hash.
21
+ # This will be used for serialization/deserialization.
22
+ #
23
+ def self.mapper()
24
+ {
25
+ required: false,
26
+ serialized_name: 'PasswordCredentialsUpdateParameters',
27
+ type: {
28
+ name: 'Composite',
29
+ class_name: 'PasswordCredentialsUpdateParameters',
30
+ model_properties: {
31
+ value: {
32
+ required: false,
33
+ serialized_name: 'value',
34
+ type: {
35
+ name: 'Sequence',
36
+ element: {
37
+ required: false,
38
+ serialized_name: 'PasswordCredentialElementType',
39
+ type: {
40
+ name: 'Composite',
41
+ class_name: 'PasswordCredential'
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
47
+ }
48
+ }
49
+ end
50
+ end
51
+ end
52
+ end
@@ -12,19 +12,19 @@ module Azure::ARM::Graph
12
12
 
13
13
  include MsRestAzure
14
14
 
15
- # @return [String] Gets or sets object Id
15
+ # @return [String] object Id
16
16
  attr_accessor :object_id
17
17
 
18
- # @return [String] Gets or sets object type
18
+ # @return [String] object type
19
19
  attr_accessor :object_type
20
20
 
21
- # @return [String] Gets or sets service principal display name
21
+ # @return [String] service principal display name
22
22
  attr_accessor :display_name
23
23
 
24
- # @return [String] Gets or sets app id
24
+ # @return [String] app id
25
25
  attr_accessor :app_id
26
26
 
27
- # @return [Array<String>] Gets or sets the list of names.
27
+ # @return [Array<String>] the list of names.
28
28
  attr_accessor :service_principal_names
29
29
 
30
30
 
@@ -12,12 +12,19 @@ module Azure::ARM::Graph
12
12
 
13
13
  include MsRestAzure
14
14
 
15
- # @return [String] Gets or sets application Id
15
+ # @return [String] application Id
16
16
  attr_accessor :app_id
17
17
 
18
18
  # @return [Boolean] Specifies if the account is enabled
19
19
  attr_accessor :account_enabled
20
20
 
21
+ # @return [Array<KeyCredential>] the list of KeyCredential objects
22
+ attr_accessor :key_credentials
23
+
24
+ # @return [Array<PasswordCredential>] the list of PasswordCredential
25
+ # objects
26
+ attr_accessor :password_credentials
27
+
21
28
 
22
29
  #
23
30
  # Mapper for ServicePrincipalCreateParameters class as Ruby Hash.
@@ -44,6 +51,36 @@ module Azure::ARM::Graph
44
51
  type: {
45
52
  name: 'Boolean'
46
53
  }
54
+ },
55
+ key_credentials: {
56
+ required: false,
57
+ serialized_name: 'keyCredentials',
58
+ type: {
59
+ name: 'Sequence',
60
+ element: {
61
+ required: false,
62
+ serialized_name: 'KeyCredentialElementType',
63
+ type: {
64
+ name: 'Composite',
65
+ class_name: 'KeyCredential'
66
+ }
67
+ }
68
+ }
69
+ },
70
+ password_credentials: {
71
+ required: false,
72
+ serialized_name: 'passwordCredentials',
73
+ type: {
74
+ name: 'Sequence',
75
+ element: {
76
+ required: false,
77
+ serialized_name: 'PasswordCredentialElementType',
78
+ type: {
79
+ name: 'Composite',
80
+ class_name: 'PasswordCredential'
81
+ }
82
+ }
83
+ }
47
84
  }
48
85
  }
49
86
  }
@@ -12,11 +12,10 @@ module Azure::ARM::Graph
12
12
 
13
13
  include MsRestAzure
14
14
 
15
- # @return [Array<ServicePrincipal>] Gets or sets the list of service
16
- # principals.
15
+ # @return [Array<ServicePrincipal>] the list of service principals.
17
16
  attr_accessor :value
18
17
 
19
- # @return [String] Gets or sets the URL to get the next set of results.
18
+ # @return [String] the URL to get the next set of results.
20
19
  attr_accessor :odatanext_link
21
20
 
22
21
  # return [Proc] with next page method call.
@@ -12,22 +12,22 @@ module Azure::ARM::Graph
12
12
 
13
13
  include MsRestAzure
14
14
 
15
- # @return [String] Gets or sets object Id
15
+ # @return [String] object Id
16
16
  attr_accessor :object_id
17
17
 
18
- # @return [String] Gets or sets object type
18
+ # @return [String] object type
19
19
  attr_accessor :object_type
20
20
 
21
- # @return [String] Gets or sets user principal name
21
+ # @return [String] user principal name
22
22
  attr_accessor :user_principal_name
23
23
 
24
- # @return [String] Gets or sets user display name
24
+ # @return [String] user display name
25
25
  attr_accessor :display_name
26
26
 
27
- # @return [String] Gets or sets user signIn name
27
+ # @return [String] user signIn name
28
28
  attr_accessor :sign_in_name
29
29
 
30
- # @return [String] Gets or sets user mail
30
+ # @return [String] user mail
31
31
  attr_accessor :mail
32
32
 
33
33
  # @return [String] The mail alias for the user
@@ -12,10 +12,10 @@ module Azure::ARM::Graph
12
12
 
13
13
  include MsRestAzure
14
14
 
15
- # @return [Array<User>] Gets or sets the list of users.
15
+ # @return [Array<User>] the list of users.
16
16
  attr_accessor :value
17
17
 
18
- # @return [String] Gets or sets the URL to get the next set of results.
18
+ # @return [String] the URL to get the next set of results.
19
19
  attr_accessor :odatanext_link
20
20
 
21
21
  # return [Proc] with next page method call.
@@ -19,7 +19,7 @@ module Azure::ARM::Graph
19
19
  @client = client
20
20
  end
21
21
 
22
- # @return reference to the GraphRbacManagementClient
22
+ # @return [GraphRbacManagementClient] reference to the GraphRbacManagementClient
23
23
  attr_reader :client
24
24
 
25
25
  #
@@ -85,7 +85,7 @@ module Azure::ARM::Graph
85
85
  response_content = http_response.body
86
86
  unless status_code == 200
87
87
  error_model = JSON.load(response_content)
88
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
88
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
89
89
  end
90
90
 
91
91
  # Create Result
@@ -19,7 +19,7 @@ module Azure::ARM::Graph
19
19
  @client = client
20
20
  end
21
21
 
22
- # @return reference to the GraphRbacManagementClient
22
+ # @return [GraphRbacManagementClient] reference to the GraphRbacManagementClient
23
23
  attr_reader :client
24
24
 
25
25
  #
@@ -101,7 +101,7 @@ module Azure::ARM::Graph
101
101
  response_content = http_response.body
102
102
  unless status_code == 201
103
103
  error_model = JSON.load(response_content)
104
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
104
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
105
105
  end
106
106
 
107
107
  # Create Result
@@ -152,7 +152,7 @@ module Azure::ARM::Graph
152
152
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
153
153
  # will be added to the HTTP request.
154
154
  #
155
- # @return [ServicePrincipalListResult] operation results.
155
+ # @return [Array<ServicePrincipal>] operation results.
156
156
  #
157
157
  def list(filter = nil, custom_headers = nil)
158
158
  first_page = list_as_lazy(filter, custom_headers)
@@ -211,7 +211,7 @@ module Azure::ARM::Graph
211
211
  response_content = http_response.body
212
212
  unless status_code == 200
213
213
  error_model = JSON.load(response_content)
214
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
214
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
215
215
  end
216
216
 
217
217
  # Create Result
@@ -301,7 +301,7 @@ module Azure::ARM::Graph
301
301
  response_content = http_response.body
302
302
  unless status_code == 204
303
303
  error_model = JSON.load(response_content)
304
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
304
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
305
305
  end
306
306
 
307
307
  # Create Result
@@ -382,7 +382,7 @@ module Azure::ARM::Graph
382
382
  response_content = http_response.body
383
383
  unless status_code == 200
384
384
  error_model = JSON.load(response_content)
385
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
385
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
386
386
  end
387
387
 
388
388
  # Create Result
@@ -405,6 +405,404 @@ module Azure::ARM::Graph
405
405
  promise.execute
406
406
  end
407
407
 
408
+ #
409
+ # Get keyCredentials associated with the service principal by object Id.
410
+ # Reference:
411
+ # https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/entity-and-complex-type-reference#keycredential-type
412
+ #
413
+ # @param object_id [String] Object id to get service principal information.
414
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
415
+ # will be added to the HTTP request.
416
+ #
417
+ # @return [KeyCredentialListResult] operation results.
418
+ #
419
+ def list_key_credentials(object_id, custom_headers = nil)
420
+ response = list_key_credentials_async(object_id, custom_headers).value!
421
+ response.body unless response.nil?
422
+ end
423
+
424
+ #
425
+ # Get keyCredentials associated with the service principal by object Id.
426
+ # Reference:
427
+ # https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/entity-and-complex-type-reference#keycredential-type
428
+ #
429
+ # @param object_id [String] Object id to get service principal information.
430
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
431
+ # will be added to the HTTP request.
432
+ #
433
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
434
+ #
435
+ def list_key_credentials_with_http_info(object_id, custom_headers = nil)
436
+ list_key_credentials_async(object_id, custom_headers).value!
437
+ end
438
+
439
+ #
440
+ # Get keyCredentials associated with the service principal by object Id.
441
+ # Reference:
442
+ # https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/entity-and-complex-type-reference#keycredential-type
443
+ #
444
+ # @param object_id [String] Object id to get service principal information.
445
+ # @param [Hash{String => String}] A hash of custom headers that will be added
446
+ # to the HTTP request.
447
+ #
448
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
449
+ #
450
+ def list_key_credentials_async(object_id, custom_headers = nil)
451
+ fail ArgumentError, 'object_id is nil' if object_id.nil?
452
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
453
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
454
+
455
+
456
+ request_headers = {}
457
+
458
+ # Set Headers
459
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
460
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
461
+ path_template = '/{tenantID}/servicePrincipals/{objectId}/keyCredentials'
462
+ options = {
463
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
464
+ path_params: {'tenantID' => @client.tenant_id},
465
+ skip_encoding_path_params: {'objectId' => object_id},
466
+ query_params: {'api-version' => @client.api_version},
467
+ headers: request_headers.merge(custom_headers || {})
468
+ }
469
+
470
+ request_url = @base_url || @client.base_url
471
+
472
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
473
+ promise = request.run_promise do |req|
474
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
475
+ end
476
+
477
+ promise = promise.then do |http_response|
478
+ status_code = http_response.status
479
+ response_content = http_response.body
480
+ unless status_code == 200
481
+ error_model = JSON.load(response_content)
482
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
483
+ end
484
+
485
+ # Create Result
486
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
487
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
488
+ # Deserialize Response
489
+ if status_code == 200
490
+ begin
491
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
492
+ result_mapper = KeyCredentialListResult.mapper()
493
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
494
+ rescue Exception => e
495
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
496
+ end
497
+ end
498
+
499
+ result
500
+ end
501
+
502
+ promise.execute
503
+ end
504
+
505
+ #
506
+ # Update keyCredentials associated with an existing service principal.
507
+ # Reference:
508
+ # https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/entity-and-complex-type-reference#keycredential-type
509
+ #
510
+ # @param object_id [String] Object id to get service principal information.
511
+ # @param parameters [KeyCredentialsUpdateParameters] Parameters to update
512
+ # keyCredentials of an existing service principal.
513
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
514
+ # will be added to the HTTP request.
515
+ #
516
+ #
517
+ def update_key_credentials(object_id, parameters, custom_headers = nil)
518
+ response = update_key_credentials_async(object_id, parameters, custom_headers).value!
519
+ nil
520
+ end
521
+
522
+ #
523
+ # Update keyCredentials associated with an existing service principal.
524
+ # Reference:
525
+ # https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/entity-and-complex-type-reference#keycredential-type
526
+ #
527
+ # @param object_id [String] Object id to get service principal information.
528
+ # @param parameters [KeyCredentialsUpdateParameters] Parameters to update
529
+ # keyCredentials of an existing service principal.
530
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
531
+ # will be added to the HTTP request.
532
+ #
533
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
534
+ #
535
+ def update_key_credentials_with_http_info(object_id, parameters, custom_headers = nil)
536
+ update_key_credentials_async(object_id, parameters, custom_headers).value!
537
+ end
538
+
539
+ #
540
+ # Update keyCredentials associated with an existing service principal.
541
+ # Reference:
542
+ # https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/entity-and-complex-type-reference#keycredential-type
543
+ #
544
+ # @param object_id [String] Object id to get service principal information.
545
+ # @param parameters [KeyCredentialsUpdateParameters] Parameters to update
546
+ # keyCredentials of an existing service principal.
547
+ # @param [Hash{String => String}] A hash of custom headers that will be added
548
+ # to the HTTP request.
549
+ #
550
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
551
+ #
552
+ def update_key_credentials_async(object_id, parameters, custom_headers = nil)
553
+ fail ArgumentError, 'object_id is nil' if object_id.nil?
554
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
555
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
556
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
557
+
558
+
559
+ request_headers = {}
560
+
561
+ # Set Headers
562
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
563
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
564
+
565
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
566
+
567
+ # Serialize Request
568
+ request_mapper = KeyCredentialsUpdateParameters.mapper()
569
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
570
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
571
+
572
+ path_template = '/{tenantID}/servicePrincipals/{objectId}/keyCredentials'
573
+ options = {
574
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
575
+ path_params: {'tenantID' => @client.tenant_id},
576
+ skip_encoding_path_params: {'objectId' => object_id},
577
+ query_params: {'api-version' => @client.api_version},
578
+ body: request_content,
579
+ headers: request_headers.merge(custom_headers || {})
580
+ }
581
+
582
+ request_url = @base_url || @client.base_url
583
+
584
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :patch, options)
585
+ promise = request.run_promise do |req|
586
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
587
+ end
588
+
589
+ promise = promise.then do |http_response|
590
+ status_code = http_response.status
591
+ response_content = http_response.body
592
+ unless status_code == 204
593
+ error_model = JSON.load(response_content)
594
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
595
+ end
596
+
597
+ # Create Result
598
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
599
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
600
+
601
+ result
602
+ end
603
+
604
+ promise.execute
605
+ end
606
+
607
+ #
608
+ # Gets passwordCredentials associated with an existing service principal.
609
+ # Reference:
610
+ # https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/entity-and-complex-type-reference#passwordcredential-type
611
+ #
612
+ # @param object_id [String] Object id to get service principal information.
613
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
614
+ # will be added to the HTTP request.
615
+ #
616
+ # @return [PasswordCredentialListResult] operation results.
617
+ #
618
+ def list_password_credentials(object_id, custom_headers = nil)
619
+ response = list_password_credentials_async(object_id, custom_headers).value!
620
+ response.body unless response.nil?
621
+ end
622
+
623
+ #
624
+ # Gets passwordCredentials associated with an existing service principal.
625
+ # Reference:
626
+ # https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/entity-and-complex-type-reference#passwordcredential-type
627
+ #
628
+ # @param object_id [String] Object id to get service principal information.
629
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
630
+ # will be added to the HTTP request.
631
+ #
632
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
633
+ #
634
+ def list_password_credentials_with_http_info(object_id, custom_headers = nil)
635
+ list_password_credentials_async(object_id, custom_headers).value!
636
+ end
637
+
638
+ #
639
+ # Gets passwordCredentials associated with an existing service principal.
640
+ # Reference:
641
+ # https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/entity-and-complex-type-reference#passwordcredential-type
642
+ #
643
+ # @param object_id [String] Object id to get service principal information.
644
+ # @param [Hash{String => String}] A hash of custom headers that will be added
645
+ # to the HTTP request.
646
+ #
647
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
648
+ #
649
+ def list_password_credentials_async(object_id, custom_headers = nil)
650
+ fail ArgumentError, 'object_id is nil' if object_id.nil?
651
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
652
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
653
+
654
+
655
+ request_headers = {}
656
+
657
+ # Set Headers
658
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
659
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
660
+ path_template = '/{tenantID}/servicePrincipals/{objectId}/passwordCredentials'
661
+ options = {
662
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
663
+ path_params: {'tenantID' => @client.tenant_id},
664
+ skip_encoding_path_params: {'objectId' => object_id},
665
+ query_params: {'api-version' => @client.api_version},
666
+ headers: request_headers.merge(custom_headers || {})
667
+ }
668
+
669
+ request_url = @base_url || @client.base_url
670
+
671
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
672
+ promise = request.run_promise do |req|
673
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
674
+ end
675
+
676
+ promise = promise.then do |http_response|
677
+ status_code = http_response.status
678
+ response_content = http_response.body
679
+ unless status_code == 200
680
+ error_model = JSON.load(response_content)
681
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
682
+ end
683
+
684
+ # Create Result
685
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
686
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
687
+ # Deserialize Response
688
+ if status_code == 200
689
+ begin
690
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
691
+ result_mapper = PasswordCredentialListResult.mapper()
692
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
693
+ rescue Exception => e
694
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
695
+ end
696
+ end
697
+
698
+ result
699
+ end
700
+
701
+ promise.execute
702
+ end
703
+
704
+ #
705
+ # Updates passwordCredentials associated with an existing service principal.
706
+ # Reference:
707
+ # https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/entity-and-complex-type-reference#passwordcredential-type
708
+ #
709
+ # @param object_id [String] Object id to get service principal information.
710
+ # @param parameters [PasswordCredentialsUpdateParameters] Parameters to update
711
+ # passwordCredentials of an existing service principal.
712
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
713
+ # will be added to the HTTP request.
714
+ #
715
+ #
716
+ def update_password_credentials(object_id, parameters, custom_headers = nil)
717
+ response = update_password_credentials_async(object_id, parameters, custom_headers).value!
718
+ nil
719
+ end
720
+
721
+ #
722
+ # Updates passwordCredentials associated with an existing service principal.
723
+ # Reference:
724
+ # https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/entity-and-complex-type-reference#passwordcredential-type
725
+ #
726
+ # @param object_id [String] Object id to get service principal information.
727
+ # @param parameters [PasswordCredentialsUpdateParameters] Parameters to update
728
+ # passwordCredentials of an existing service principal.
729
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
730
+ # will be added to the HTTP request.
731
+ #
732
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
733
+ #
734
+ def update_password_credentials_with_http_info(object_id, parameters, custom_headers = nil)
735
+ update_password_credentials_async(object_id, parameters, custom_headers).value!
736
+ end
737
+
738
+ #
739
+ # Updates passwordCredentials associated with an existing service principal.
740
+ # Reference:
741
+ # https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/entity-and-complex-type-reference#passwordcredential-type
742
+ #
743
+ # @param object_id [String] Object id to get service principal information.
744
+ # @param parameters [PasswordCredentialsUpdateParameters] Parameters to update
745
+ # passwordCredentials of an existing service principal.
746
+ # @param [Hash{String => String}] A hash of custom headers that will be added
747
+ # to the HTTP request.
748
+ #
749
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
750
+ #
751
+ def update_password_credentials_async(object_id, parameters, custom_headers = nil)
752
+ fail ArgumentError, 'object_id is nil' if object_id.nil?
753
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
754
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
755
+ fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
756
+
757
+
758
+ request_headers = {}
759
+
760
+ # Set Headers
761
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
762
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
763
+
764
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
765
+
766
+ # Serialize Request
767
+ request_mapper = PasswordCredentialsUpdateParameters.mapper()
768
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
769
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
770
+
771
+ path_template = '/{tenantID}/servicePrincipals/{objectId}/passwordCredentials'
772
+ options = {
773
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
774
+ path_params: {'tenantID' => @client.tenant_id},
775
+ skip_encoding_path_params: {'objectId' => object_id},
776
+ query_params: {'api-version' => @client.api_version},
777
+ body: request_content,
778
+ headers: request_headers.merge(custom_headers || {})
779
+ }
780
+
781
+ request_url = @base_url || @client.base_url
782
+
783
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :patch, options)
784
+ promise = request.run_promise do |req|
785
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
786
+ end
787
+
788
+ promise = promise.then do |http_response|
789
+ status_code = http_response.status
790
+ response_content = http_response.body
791
+ unless status_code == 204
792
+ error_model = JSON.load(response_content)
793
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
794
+ end
795
+
796
+ # Create Result
797
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
798
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
799
+
800
+ result
801
+ end
802
+
803
+ promise.execute
804
+ end
805
+
408
806
  #
409
807
  # Gets list of service principals from the current tenant.
410
808
  #
@@ -412,7 +810,7 @@ module Azure::ARM::Graph
412
810
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
413
811
  # will be added to the HTTP request.
414
812
  #
415
- # @return [ServicePrincipalListResult] operation results.
813
+ # @return [Array<ServicePrincipal>] operation results.
416
814
  #
417
815
  def list_next(next_link, custom_headers = nil)
418
816
  response = list_next_async(next_link, custom_headers).value!
@@ -473,7 +871,7 @@ module Azure::ARM::Graph
473
871
  response_content = http_response.body
474
872
  unless status_code == 200
475
873
  error_model = JSON.load(response_content)
476
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
874
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
477
875
  end
478
876
 
479
877
  # Create Result