Class: Azure::Graph::Mgmt::V1_6::ServicePrincipals

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/1.6/generated/azure_mgmt_graph/service_principals.rb

Overview

The Graph RBAC Management Client

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ServicePrincipals

Creates and initializes a new instance of the ServicePrincipals class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientGraphRbacManagementClient (readonly)

Returns reference to the GraphRbacManagementClient.

Returns:



22
23
24
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 22

def client
  @client
end

Instance Method Details

#create(parameters, custom_headers = nil) ⇒ ServicePrincipal

Creates a service principal in the directory.

service principal. will be added to the HTTP request.

Parameters:

  • parameters (ServicePrincipalCreateParameters)

    Parameters to create a

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (ServicePrincipal)

    operation results.



34
35
36
37
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 34

def create(parameters, custom_headers = nil)
  response = create_async(parameters, custom_headers).value!
  response.body unless response.nil?
end

#create_async(parameters, custom_headers = nil) ⇒ Concurrent::Promise

Creates a service principal in the directory.

service principal. to the HTTP request.

Parameters:

  • parameters (ServicePrincipalCreateParameters)

    Parameters to create a

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 63

def create_async(parameters, custom_headers = nil)
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = Azure::Graph::Mgmt::V1_6::Models::ServicePrincipalCreateParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '{tenantID}/servicePrincipals'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'tenantID' => @client.tenant_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 201
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Graph::Mgmt::V1_6::Models::ServicePrincipal.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#create_with_http_info(parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Creates a service principal in the directory.

service principal. will be added to the HTTP request.

Parameters:

  • parameters (ServicePrincipalCreateParameters)

    Parameters to create a

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



49
50
51
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 49

def create_with_http_info(parameters, custom_headers = nil)
  create_async(parameters, custom_headers).value!
end

#delete(object_id, custom_headers = nil) ⇒ Object

Deletes a service principal from the directory.

will be added to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the service principal to delete.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



217
218
219
220
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 217

def delete(object_id, custom_headers = nil)
  response = delete_async(object_id, custom_headers).value!
  nil
end

#delete_async(object_id, custom_headers = nil) ⇒ Concurrent::Promise

Deletes a service principal from the directory.

to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the service principal to delete.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 244

def delete_async(object_id, custom_headers = nil)
  fail ArgumentError, 'object_id is nil' if object_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{tenantID}/servicePrincipals/{objectId}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'tenantID' => @client.tenant_id},
      skip_encoding_path_params: {'objectId' => object_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 204
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?

    result
  end

  promise.execute
end

#delete_with_http_info(object_id, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a service principal from the directory.

will be added to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the service principal to delete.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



231
232
233
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 231

def delete_with_http_info(object_id, custom_headers = nil)
  delete_async(object_id, custom_headers).value!
end

#get(object_id, custom_headers = nil) ⇒ ServicePrincipal

Gets service principal information from the directory.

will be added to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the service principal to get.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (ServicePrincipal)

    operation results.



295
296
297
298
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 295

def get(object_id, custom_headers = nil)
  response = get_async(object_id, custom_headers).value!
  response.body unless response.nil?
end

#get_async(object_id, custom_headers = nil) ⇒ Concurrent::Promise

Gets service principal information from the directory.

to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the service principal to get.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 322

def get_async(object_id, custom_headers = nil)
  fail ArgumentError, 'object_id is nil' if object_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{tenantID}/servicePrincipals/{objectId}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'tenantID' => @client.tenant_id},
      skip_encoding_path_params: {'objectId' => object_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Graph::Mgmt::V1_6::Models::ServicePrincipal.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_with_http_info(object_id, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets service principal information from the directory.

will be added to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the service principal to get.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



309
310
311
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 309

def get_with_http_info(object_id, custom_headers = nil)
  get_async(object_id, custom_headers).value!
end

#list(filter = nil, custom_headers = nil) ⇒ Array<ServicePrincipal>

Gets a list of service principals from the current tenant.

will be added to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply to the operation.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array<ServicePrincipal>)

    operation results.



132
133
134
135
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 132

def list(filter = nil, custom_headers = nil)
  first_page = list_as_lazy(filter, custom_headers)
  first_page.get_all_items
end

#list_as_lazy(filter = nil, custom_headers = nil) ⇒ ServicePrincipalListResult

Gets a list of service principals from the current tenant.

will be added to the HTTP request.

the response.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply to the operation.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (ServicePrincipalListResult)

    which provide lazy access to pages of



840
841
842
843
844
845
846
847
848
849
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 840

def list_as_lazy(filter = nil, custom_headers = nil)
  response = list_async(filter, custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_link|
      list_next_async(next_link, custom_headers)
    end
    page
  end
end

#list_async(filter = nil, custom_headers = nil) ⇒ Concurrent::Promise

Gets a list of service principals from the current tenant.

to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply to the operation.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 159

def list_async(filter = nil, custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{tenantID}/servicePrincipals'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'tenantID' => @client.tenant_id},
      query_params: {'$filter' => filter,'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Graph::Mgmt::V1_6::Models::ServicePrincipalListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_key_credentials(object_id, custom_headers = nil) ⇒ KeyCredentialListResult

Get the keyCredentials associated with the specified service principal.

get keyCredentials. will be added to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the service principal for which to

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (KeyCredentialListResult)

    operation results.



384
385
386
387
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 384

def list_key_credentials(object_id, custom_headers = nil)
  response = list_key_credentials_async(object_id, custom_headers).value!
  response.body unless response.nil?
end

#list_key_credentials_async(object_id, custom_headers = nil) ⇒ Concurrent::Promise

Get the keyCredentials associated with the specified service principal.

get keyCredentials. to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the service principal for which to

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 413

def list_key_credentials_async(object_id, custom_headers = nil)
  fail ArgumentError, 'object_id is nil' if object_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{tenantID}/servicePrincipals/{objectId}/keyCredentials'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'tenantID' => @client.tenant_id},
      skip_encoding_path_params: {'objectId' => object_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Graph::Mgmt::V1_6::Models::KeyCredentialListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_key_credentials_with_http_info(object_id, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get the keyCredentials associated with the specified service principal.

get keyCredentials. will be added to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the service principal for which to

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



399
400
401
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 399

def list_key_credentials_with_http_info(object_id, custom_headers = nil)
  list_key_credentials_async(object_id, custom_headers).value!
end

#list_next(next_link, custom_headers = nil) ⇒ Array<ServicePrincipal>

Gets a list of service principals from the current tenant.

will be added to the HTTP request.

Parameters:

  • next_link (String)

    Next link for the list operation.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array<ServicePrincipal>)

    operation results.



751
752
753
754
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 751

def list_next(next_link, custom_headers = nil)
  response = list_next_async(next_link, custom_headers).value!
  response.body unless response.nil?
end

#list_next_async(next_link, custom_headers = nil) ⇒ Concurrent::Promise

Gets a list of service principals from the current tenant.

to the HTTP request.

Parameters:

  • next_link (String)

    Next link for the list operation.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 778

def list_next_async(next_link, custom_headers = nil)
  fail ArgumentError, 'next_link is nil' if next_link.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{tenantID}/{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'tenantID' => @client.tenant_id},
      skip_encoding_path_params: {'nextLink' => next_link},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Graph::Mgmt::V1_6::Models::ServicePrincipalListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_next_with_http_info(next_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a list of service principals from the current tenant.

will be added to the HTTP request.

Parameters:

  • next_link (String)

    Next link for the list operation.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



765
766
767
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 765

def list_next_with_http_info(next_link, custom_headers = nil)
  list_next_async(next_link, custom_headers).value!
end

#list_password_credentials(object_id, custom_headers = nil) ⇒ PasswordCredentialListResult

Gets the passwordCredentials associated with a service principal.

will be added to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the service principal.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (PasswordCredentialListResult)

    operation results.



570
571
572
573
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 570

def list_password_credentials(object_id, custom_headers = nil)
  response = list_password_credentials_async(object_id, custom_headers).value!
  response.body unless response.nil?
end

#list_password_credentials_async(object_id, custom_headers = nil) ⇒ Concurrent::Promise

Gets the passwordCredentials associated with a service principal.

to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the service principal.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 597

def list_password_credentials_async(object_id, custom_headers = nil)
  fail ArgumentError, 'object_id is nil' if object_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{tenantID}/servicePrincipals/{objectId}/passwordCredentials'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'tenantID' => @client.tenant_id},
      skip_encoding_path_params: {'objectId' => object_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Graph::Mgmt::V1_6::Models::PasswordCredentialListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_password_credentials_with_http_info(object_id, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the passwordCredentials associated with a service principal.

will be added to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the service principal.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



584
585
586
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 584

def list_password_credentials_with_http_info(object_id, custom_headers = nil)
  list_password_credentials_async(object_id, custom_headers).value!
end

#list_with_http_info(filter = nil, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a list of service principals from the current tenant.

will be added to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply to the operation.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



146
147
148
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 146

def list_with_http_info(filter = nil, custom_headers = nil)
  list_async(filter, custom_headers).value!
end

#update_key_credentials(object_id, parameters, custom_headers = nil) ⇒ Object

Update the keyCredentials associated with a service principal.

information. keyCredentials of an existing service principal. will be added to the HTTP request.

Parameters:

  • object_id (String)

    The object ID for which to get service principal

  • parameters (KeyCredentialsUpdateParameters)

    Parameters to update the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



476
477
478
479
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 476

def update_key_credentials(object_id, parameters, custom_headers = nil)
  response = update_key_credentials_async(object_id, parameters, custom_headers).value!
  nil
end

#update_key_credentials_async(object_id, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Update the keyCredentials associated with a service principal.

information. keyCredentials of an existing service principal. to the HTTP request.

Parameters:

  • object_id (String)

    The object ID for which to get service principal

  • parameters (KeyCredentialsUpdateParameters)

    Parameters to update the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 509

def update_key_credentials_async(object_id, parameters, custom_headers = nil)
  fail ArgumentError, 'object_id is nil' if object_id.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = Azure::Graph::Mgmt::V1_6::Models::KeyCredentialsUpdateParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '{tenantID}/servicePrincipals/{objectId}/keyCredentials'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'tenantID' => @client.tenant_id},
      skip_encoding_path_params: {'objectId' => object_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:patch, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 204
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?

    result
  end

  promise.execute
end

#update_key_credentials_with_http_info(object_id, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Update the keyCredentials associated with a service principal.

information. keyCredentials of an existing service principal. will be added to the HTTP request.

Parameters:

  • object_id (String)

    The object ID for which to get service principal

  • parameters (KeyCredentialsUpdateParameters)

    Parameters to update the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



493
494
495
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 493

def update_key_credentials_with_http_info(object_id, parameters, custom_headers = nil)
  update_key_credentials_async(object_id, parameters, custom_headers).value!
end

#update_password_credentials(object_id, parameters, custom_headers = nil) ⇒ Object

Updates the passwordCredentials associated with a service principal.

the passwordCredentials of an existing service principal. will be added to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the service principal.

  • parameters (PasswordCredentialsUpdateParameters)

    Parameters to update

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



659
660
661
662
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 659

def update_password_credentials(object_id, parameters, custom_headers = nil)
  response = update_password_credentials_async(object_id, parameters, custom_headers).value!
  nil
end

#update_password_credentials_async(object_id, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Updates the passwordCredentials associated with a service principal.

the passwordCredentials of an existing service principal. to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the service principal.

  • parameters (PasswordCredentialsUpdateParameters)

    Parameters to update

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 690

def update_password_credentials_async(object_id, parameters, custom_headers = nil)
  fail ArgumentError, 'object_id is nil' if object_id.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = Azure::Graph::Mgmt::V1_6::Models::PasswordCredentialsUpdateParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '{tenantID}/servicePrincipals/{objectId}/passwordCredentials'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'tenantID' => @client.tenant_id},
      skip_encoding_path_params: {'objectId' => object_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:patch, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 204
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?

    result
  end

  promise.execute
end

#update_password_credentials_with_http_info(object_id, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Updates the passwordCredentials associated with a service principal.

the passwordCredentials of an existing service principal. will be added to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the service principal.

  • parameters (PasswordCredentialsUpdateParameters)

    Parameters to update

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



675
676
677
# File 'lib/1.6/generated/azure_mgmt_graph/service_principals.rb', line 675

def update_password_credentials_with_http_info(object_id, parameters, custom_headers = nil)
  update_password_credentials_async(object_id, parameters, custom_headers).value!
end