Class: Azure::Graph::Mgmt::V1_6::Groups

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

Overview

The Graph RBAC Management Client

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Groups

Creates and initializes a new instance of the Groups class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/1.6/generated/azure_mgmt_graph/groups.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/groups.rb', line 22

def client
  @client
end

Instance Method Details

#add_member(group_object_id, parameters, custom_headers = nil) ⇒ Object

Add a member to a group.

the member. such as graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. will be added to the HTTP request.

Parameters:

  • group_object_id (String)

    The object ID of the group to which to add

  • parameters (GroupAddMemberParameters)

    The URL of the member object,

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

    A hash of custom headers that



222
223
224
225
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 222

def add_member(group_object_id, parameters, custom_headers = nil)
  response = add_member_async(group_object_id, parameters, custom_headers).value!
  nil
end

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

Parameters:

  • group_object_id (String)

    The object ID of the group to which to add

  • parameters (GroupAddMemberParameters)

    The URL of the member object,

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
298
299
300
301
302
303
304
305
306
307
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 257

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

  path_template = '{tenantID}/groups/{groupObjectId}/$links/members'

  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: {'groupObjectId' => group_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(: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 == 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

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

Add a member to a group.

the member. such as graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. will be added to the HTTP request.

Parameters:

  • group_object_id (String)

    The object ID of the group to which to add

  • parameters (GroupAddMemberParameters)

    The URL of the member object,

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



240
241
242
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 240

def add_member_with_http_info(group_object_id, parameters, custom_headers = nil)
  add_member_async(group_object_id, parameters, custom_headers).value!
end

#create(parameters, custom_headers = nil) ⇒ ADGroup

Create a group in the directory.

create. will be added to the HTTP request.

Parameters:

  • parameters (GroupCreateParameters)

    The parameters for the group to

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

    A hash of custom headers that

Returns:

  • (ADGroup)

    operation results.



396
397
398
399
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 396

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 group in the directory.

create. to the HTTP request.

Parameters:

  • parameters (GroupCreateParameters)

    The parameters for the group to

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 425

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

  path_template = '{tenantID}/groups'

  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::ADGroup.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

Create a group in the directory.

create. will be added to the HTTP request.

Parameters:

  • parameters (GroupCreateParameters)

    The parameters for the group to

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



411
412
413
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 411

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

#delete(group_object_id, custom_headers = nil) ⇒ Object

Delete a group from the directory.

will be added to the HTTP request.

Parameters:

  • group_object_id (String)

    The object ID of the group to delete.

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

    A hash of custom headers that



317
318
319
320
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 317

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

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

Delete a group from the directory.

to the HTTP request.

Parameters:

  • group_object_id (String)

    The object ID of the group to delete.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 344

def delete_async(group_object_id, custom_headers = nil)
  fail ArgumentError, 'group_object_id is nil' if group_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}/groups/{groupObjectId}'

  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: {'groupObjectId' => group_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(group_object_id, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Delete a group from the directory.

will be added to the HTTP request.

Parameters:

  • group_object_id (String)

    The object ID of the group to delete.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



331
332
333
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 331

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

#get(object_id, custom_headers = nil) ⇒ ADGroup

Gets group information from the directory.

information. will be added to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the user for which to get group

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

    A hash of custom headers that

Returns:

  • (ADGroup)

    operation results.



672
673
674
675
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 672

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 group information from the directory.

information. to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the user for which to get group

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
741
742
743
744
745
746
747
748
749
750
751
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 701

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}/groups/{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::ADGroup.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_group_members(object_id, custom_headers = nil) ⇒ Array<AADObject>

Gets the members of a group.

retrieved. will be added to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the group whose members should be

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

    A hash of custom headers that

Returns:

  • (Array<AADObject>)

    operation results.



581
582
583
584
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 581

def get_group_members(object_id, custom_headers = nil)
  first_page = get_group_members_as_lazy(object_id, custom_headers)
  first_page.get_all_items
end

#get_group_members_as_lazy(object_id, custom_headers = nil) ⇒ GetObjectsResult

Gets the members of a group.

retrieved. will be added to the HTTP request.

response.

Parameters:

  • object_id (String)

    The object ID of the group whose members should be

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

    A hash of custom headers that

Returns:

  • (GetObjectsResult)

    which provide lazy access to pages of the



1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 1070

def get_group_members_as_lazy(object_id, custom_headers = nil)
  response = get_group_members_async(object_id, custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_link|
      get_group_members_next_async(next_link, custom_headers)
    end
    page
  end
end

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

Gets the members of a group.

retrieved. to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the group whose members should be

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
648
649
650
651
652
653
654
655
656
657
658
659
660
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 610

def get_group_members_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}/groups/{objectId}/members'

  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::GetObjectsResult.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_group_members_next(next_link, custom_headers = nil) ⇒ Array<AADObject>

Gets the members of a group.

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<AADObject>)

    operation results.



960
961
962
963
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 960

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

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

Gets the members of a group.

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.



987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 987

def get_group_members_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::GetObjectsResult.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_group_members_next_with_http_info(next_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the members of a group.

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.



974
975
976
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 974

def get_group_members_next_with_http_info(next_link, custom_headers = nil)
  get_group_members_next_async(next_link, custom_headers).value!
end

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

Gets the members of a group.

retrieved. will be added to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the group whose members should be

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



596
597
598
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 596

def get_group_members_with_http_info(object_id, custom_headers = nil)
  get_group_members_async(object_id, custom_headers).value!
end

#get_member_groups(object_id, parameters, custom_headers = nil) ⇒ GroupGetMemberGroupsResult

Gets a collection of object IDs of groups of which the specified group is a member.

membership. parameters. will be added to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the group for which to get group

  • parameters (GroupGetMemberGroupsParameters)

    Group filtering

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

    A hash of custom headers that

Returns:

  • (GroupGetMemberGroupsResult)

    operation results.



766
767
768
769
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 766

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 of object IDs of groups of which the specified group is a member.

membership. parameters. to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the group for which to get group

  • parameters (GroupGetMemberGroupsParameters)

    Group filtering

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 801

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

  path_template = '{tenantID}/groups/{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' => @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 == 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::GroupGetMemberGroupsResult.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_member_groups_with_http_info(object_id, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a collection of object IDs of groups of which the specified group is a member.

membership. parameters. will be added to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the group for which to get group

  • parameters (GroupGetMemberGroupsParameters)

    Group filtering

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



784
785
786
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 784

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(object_id, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets group information from the directory.

information. will be added to the HTTP request.

Parameters:

  • object_id (String)

    The object ID of the user for which to get group

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



687
688
689
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 687

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

#is_member_of(parameters, custom_headers = nil) ⇒ CheckGroupMembershipResult

Checks whether the specified user, group, contact, or service principal is a direct or transitive member of the specified group.

parameters. will be added to the HTTP request.

Parameters:

  • parameters (CheckGroupMembershipParameters)

    The check group membership

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

    A hash of custom headers that

Returns:

  • (CheckGroupMembershipResult)

    operation results.



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

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

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

Checks whether the specified user, group, contact, or service principal is a direct or transitive member of the specified group.

parameters. to the HTTP request.

Parameters:

  • parameters (CheckGroupMembershipParameters)

    The check group membership

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
122
123
124
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 66

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

  path_template = '{tenantID}/isMemberOf'

  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 == 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::CheckGroupMembershipResult.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

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

Checks whether the specified user, group, contact, or service principal is a direct or transitive member of the specified group.

parameters. will be added to the HTTP request.

Parameters:

  • parameters (CheckGroupMembershipParameters)

    The check group membership

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



51
52
53
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 51

def is_member_of_with_http_info(parameters, custom_headers = nil)
  is_member_of_async(parameters, custom_headers).value!
end

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

Gets list of groups 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<ADGroup>)

    operation results.



494
495
496
497
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 494

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

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

  • (GroupListResult)

    which provide lazy access to pages of the response.



1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 1048

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 groups 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.



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
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 521

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}/groups'

  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::GroupListResult.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(next_link, custom_headers = nil) ⇒ Array<ADGroup>

Gets a list of groups 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<ADGroup>)

    operation results.



872
873
874
875
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 872

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 groups 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.



899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 899

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::GroupListResult.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 groups 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.



886
887
888
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 886

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 groups 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.



508
509
510
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 508

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

#remove_member(group_object_id, member_object_id, custom_headers = nil) ⇒ Object

Remove a member from a group.

remove the member. will be added to the HTTP request.

Parameters:

  • group_object_id (String)

    The object ID of the group from which to

  • member_object_id (String)

    Member object id

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

    A hash of custom headers that



136
137
138
139
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 136

def remove_member(group_object_id, member_object_id, custom_headers = nil)
  response = remove_member_async(group_object_id, member_object_id, custom_headers).value!
  nil
end

#remove_member_async(group_object_id, member_object_id, custom_headers = nil) ⇒ Concurrent::Promise

Remove a member from a group.

remove the member. to the HTTP request.

Parameters:

  • group_object_id (String)

    The object ID of the group from which to

  • member_object_id (String)

    Member object id

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
208
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 167

def remove_member_async(group_object_id, member_object_id, custom_headers = nil)
  fail ArgumentError, 'group_object_id is nil' if group_object_id.nil?
  fail ArgumentError, 'member_object_id is nil' if member_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}/groups/{groupObjectId}/$links/members/{memberObjectId}'

  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: {'groupObjectId' => group_object_id,'memberObjectId' => member_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

#remove_member_with_http_info(group_object_id, member_object_id, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Remove a member from a group.

remove the member. will be added to the HTTP request.

Parameters:

  • group_object_id (String)

    The object ID of the group from which to

  • member_object_id (String)

    Member object id

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



152
153
154
# File 'lib/1.6/generated/azure_mgmt_graph/groups.rb', line 152

def remove_member_with_http_info(group_object_id, member_object_id, custom_headers = nil)
  remove_member_async(group_object_id, member_object_id, custom_headers).value!
end