Class: Azure::ARM::Graph::Users

Inherits:
Object
  • Object
show all
Includes:
Models, MsRestAzure
Defined in:
lib/generated/azure_mgmt_graph/users.rb

Overview

Composite Swagger specification for Azure Active Directory Graph RBAC management client.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Users

Creates and initializes a new instance of the Users class.

Parameters:

  • client

    service class for accessing basic functionality.



19
20
21
# File 'lib/generated/azure_mgmt_graph/users.rb', line 19

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientGraphRbacManagementClient (readonly)

Returns reference to the GraphRbacManagementClient.

Returns:



24
25
26
# File 'lib/generated/azure_mgmt_graph/users.rb', line 24

def client
  @client
end

Instance Method Details

#create(parameters, custom_headers = nil) ⇒ User

Create a new user.

will be added to the HTTP request.

Parameters:

  • parameters (UserCreateParameters)

    Parameters to create a user.

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

    A hash of custom headers that

Returns:

  • (User)

    operation results.



35
36
37
38
# File 'lib/generated/azure_mgmt_graph/users.rb', line 35

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

Create a new user.

to the HTTP request.

Parameters:

  • parameters (UserCreateParameters)

    Parameters to create a user.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



62
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
# File 'lib/generated/azure_mgmt_graph/users.rb', line 62

def create_async(parameters, custom_headers = nil)
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  api_version = '1.6'
  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 = UserCreateParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters, 'parameters')
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '/{tenantID}/users'

  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' => 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 = User.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      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

Create a new user.

will be added to the HTTP request.

Parameters:

  • parameters (UserCreateParameters)

    Parameters to create a user.

  • 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/generated/azure_mgmt_graph/users.rb', line 49

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

#delete(upn_or_object_id, custom_headers = nil) ⇒ Object

Delete a user.

to delete. will be added to the HTTP request.

Parameters:

  • upn_or_object_id (String)

    The object ID or principal name of the user

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

    A hash of custom headers that



404
405
406
407
# File 'lib/generated/azure_mgmt_graph/users.rb', line 404

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

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

Delete a user.

to delete. to the HTTP request.

Parameters:

  • upn_or_object_id (String)

    The object ID or principal name of the user

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
464
465
466
467
468
469
470
471
472
473
# File 'lib/generated/azure_mgmt_graph/users.rb', line 433

def delete_async(upn_or_object_id, custom_headers = nil)
  fail ArgumentError, 'upn_or_object_id is nil' if upn_or_object_id.nil?
  api_version = '1.6'
  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}/users/{upnOrObjectId}'

  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: {'upnOrObjectId' => upn_or_object_id},
      query_params: {'api-version' => 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(upn_or_object_id, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Delete a user.

to delete. will be added to the HTTP request.

Parameters:

  • upn_or_object_id (String)

    The object ID or principal name of the user

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



419
420
421
# File 'lib/generated/azure_mgmt_graph/users.rb', line 419

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

#get(upn_or_object_id, custom_headers = nil) ⇒ User

Gets user information from the directory.

for which to get information. will be added to the HTTP request.

Parameters:

  • upn_or_object_id (String)

    The object ID or principal name of the user

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

    A hash of custom headers that

Returns:

  • (User)

    operation results.



218
219
220
221
# File 'lib/generated/azure_mgmt_graph/users.rb', line 218

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

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

Gets user information from the directory.

for which to get information. to the HTTP request.

Parameters:

  • upn_or_object_id (String)

    The object ID or principal name of the user

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/generated/azure_mgmt_graph/users.rb', line 247

def get_async(upn_or_object_id, custom_headers = nil)
  fail ArgumentError, 'upn_or_object_id is nil' if upn_or_object_id.nil?
  api_version = '1.6'
  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}/users/{upnOrObjectId}'

  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: {'upnOrObjectId' => upn_or_object_id},
      query_params: {'api-version' => 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 = User.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      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_member_groups(object_id, parameters, custom_headers = nil) ⇒ UserGetMemberGroupsResult

Gets a collection that contains the object IDs of the groups of which the user is a member.

membership. will be added to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the user for which to get group

  • parameters (UserGetMemberGroupsParameters)

    User filtering parameters.

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

    A hash of custom headers that

Returns:



487
488
489
490
# File 'lib/generated/azure_mgmt_graph/users.rb', line 487

def get_member_groups(object_id, parameters, custom_headers = nil)
  response = get_member_groups_async(object_id, parameters, custom_headers).value!
  response.body unless response.nil?
end

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

Gets a collection that contains the object IDs of the groups of which the user is a member.

membership. to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the user for which to get group

  • parameters (UserGetMemberGroupsParameters)

    User filtering parameters.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
# File 'lib/generated/azure_mgmt_graph/users.rb', line 520

def get_member_groups_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?
  api_version = '1.6'
  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 = UserGetMemberGroupsParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters, 'parameters')
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '/{tenantID}/users/{objectId}/getMemberGroups'

  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' => 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 == 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 = UserGetMemberGroupsResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      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_member_groups_with_http_info(object_id, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a collection that contains the object IDs of the groups of which the user is a member.

membership. will be added to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the user for which to get group

  • parameters (UserGetMemberGroupsParameters)

    User filtering parameters.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



504
505
506
# File 'lib/generated/azure_mgmt_graph/users.rb', line 504

def get_member_groups_with_http_info(object_id, parameters, custom_headers = nil)
  get_member_groups_async(object_id, parameters, custom_headers).value!
end

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

Gets user information from the directory.

for which to get information. will be added to the HTTP request.

Parameters:

  • upn_or_object_id (String)

    The object ID or principal name of the user

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



233
234
235
# File 'lib/generated/azure_mgmt_graph/users.rb', line 233

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

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

Gets list of users for 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<User>)

    operation results.



131
132
133
134
# File 'lib/generated/azure_mgmt_graph/users.rb', line 131

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) ⇒ UserListResult

Gets list of users for 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:

  • (UserListResult)

    which provide lazy access to pages of the response.



679
680
681
682
683
684
685
686
687
688
# File 'lib/generated/azure_mgmt_graph/users.rb', line 679

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 list of users for 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.



158
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
# File 'lib/generated/azure_mgmt_graph/users.rb', line 158

def list_async(filter = nil, custom_headers = nil)
  api_version = '1.6'
  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}/users'

  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' => 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 = UserListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      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(next_link, custom_headers = nil) ⇒ Array<User>

Gets a list of users for 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<User>)

    operation results.



591
592
593
594
# File 'lib/generated/azure_mgmt_graph/users.rb', line 591

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 users for 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.



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
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
# File 'lib/generated/azure_mgmt_graph/users.rb', line 618

def list_next_async(next_link, custom_headers = nil)
  fail ArgumentError, 'next_link is nil' if next_link.nil?
  api_version = '1.6'
  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' => 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 = UserListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      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 users for 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.



605
606
607
# File 'lib/generated/azure_mgmt_graph/users.rb', line 605

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

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

Gets list of users for 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.



145
146
147
# File 'lib/generated/azure_mgmt_graph/users.rb', line 145

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

#update(upn_or_object_id, parameters, custom_headers = nil) ⇒ Object

Updates a user.

to update. user. will be added to the HTTP request.

Parameters:

  • upn_or_object_id (String)

    The object ID or principal name of the user

  • parameters (UserUpdateParameters)

    Parameters to update an existing

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

    A hash of custom headers that



310
311
312
313
# File 'lib/generated/azure_mgmt_graph/users.rb', line 310

def update(upn_or_object_id, parameters, custom_headers = nil)
  response = update_async(upn_or_object_id, parameters, custom_headers).value!
  nil
end

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

Updates a user.

to update. user. to the HTTP request.

Parameters:

  • upn_or_object_id (String)

    The object ID or principal name of the user

  • parameters (UserUpdateParameters)

    Parameters to update an existing

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
# File 'lib/generated/azure_mgmt_graph/users.rb', line 343

def update_async(upn_or_object_id, parameters, custom_headers = nil)
  fail ArgumentError, 'upn_or_object_id is nil' if upn_or_object_id.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  api_version = '1.6'
  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 = UserUpdateParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters, 'parameters')
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '/{tenantID}/users/{upnOrObjectId}'

  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: {'upnOrObjectId' => upn_or_object_id},
      query_params: {'api-version' => 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_with_http_info(upn_or_object_id, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Updates a user.

to update. user. will be added to the HTTP request.

Parameters:

  • upn_or_object_id (String)

    The object ID or principal name of the user

  • parameters (UserUpdateParameters)

    Parameters to update an existing

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



327
328
329
# File 'lib/generated/azure_mgmt_graph/users.rb', line 327

def update_with_http_info(upn_or_object_id, parameters, custom_headers = nil)
  update_async(upn_or_object_id, parameters, custom_headers).value!
end