Class: Azure::ARM::Graph::Groups

Inherits:
Object
  • Object
show all
Includes:
Models, MsRestAzure
Defined in:
lib/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.



18
19
20
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 18

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)



23
24
25
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 23

def client
  @client
end

Instance Method Details

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



228
229
230
231
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 228

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



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
308
309
310
311
312
313
314
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 261

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 = GroupAddMemberParameters.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}/groups/{groupObjectId}/$links/members'
  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 || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

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

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    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



245
246
247
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 245

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. Reference: msdn.microsoft.com/en-us/library/azure/dn151676.aspx

will be added to the HTTP request.



409
410
411
412
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 409

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. Reference: msdn.microsoft.com/en-us/library/azure/dn151676.aspx

to the HTTP request.



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
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 438

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 = GroupCreateParameters.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}/groups'
  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 || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

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

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    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 = ADGroup.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 group in the directory. Reference: msdn.microsoft.com/en-us/library/azure/dn151676.aspx

will be added to the HTTP request.



424
425
426
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 424

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 in the directory. Reference: msdn.microsoft.com/en-us/library/azure/dn151676.aspx

will be added to the HTTP request.



325
326
327
328
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 325

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 in the directory. Reference: msdn.microsoft.com/en-us/library/azure/dn151676.aspx

to the HTTP request.



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
394
395
396
397
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 354

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}'
  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 || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

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

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    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 in the directory. Reference: msdn.microsoft.com/en-us/library/azure/dn151676.aspx

will be added to the HTTP request.



340
341
342
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 340

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.

will be added to the HTTP request.



731
732
733
734
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 731

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.

to the HTTP request.



758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
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
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 758

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}'
  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 || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

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

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    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 = ADGroup.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_group_members(object_id, custom_headers = nil) ⇒ GetObjectsResult

Gets the members of a group.

will be added to the HTTP request.



640
641
642
643
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 640

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.

will be added to the HTTP request.

response.



620
621
622
623
624
625
626
627
628
629
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 620

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.

to the HTTP request.



667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
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
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 667

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'
  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 || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

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

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    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 = GetObjectsResult.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_group_members_next(next_link, custom_headers = nil) ⇒ GetObjectsResult

Gets the members of a group.

will be added to the HTTP request.



1023
1024
1025
1026
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 1023

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.



1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 1050

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}'
  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 || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

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

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    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 = GetObjectsResult.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_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.



1037
1038
1039
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 1037

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.

will be added to the HTTP request.



654
655
656
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 654

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 that contains the Object IDs of the groups of which the group is a member.

parameters. will be added to the HTTP request.



825
826
827
828
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 825

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 group is a member.

parameters. to the HTTP request.



858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 858

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 = GroupGetMemberGroupsParameters.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}/groups/{objectId}/getMemberGroups'
  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 || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

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

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    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 = GroupGetMemberGroupsResult.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 group is a member.

parameters. will be added to the HTTP request.



842
843
844
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 842

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.

will be added to the HTTP request.



745
746
747
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 745

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 a transitive member of the specified group.

parameters. will be added to the HTTP request.



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

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 a transitive member of the specified group.

parameters. to the HTTP request.



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
125
126
127
128
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 67

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 = CheckGroupMembershipParameters.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}/isMemberOf'
  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 || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

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

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    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 = CheckGroupMembershipResult.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

#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 a transitive member of the specified group.

parameters. will be added to the HTTP request.



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

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

Gets list of groups for the current tenant.

will be added to the HTTP request.



530
531
532
533
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 530

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.



510
511
512
513
514
515
516
517
518
519
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 510

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.



557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 557

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'
  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 || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

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

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    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 = GroupListResult.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) ⇒ GroupListResult

Gets list of groups for the current tenant.

will be added to the HTTP request.



932
933
934
935
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 932

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 list of groups for the current tenant.

to the HTTP request.



959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
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
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 959

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}'
  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 || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

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

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    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 = GroupListResult.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 list of groups for the current tenant.

will be added to the HTTP request.



946
947
948
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 946

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.



544
545
546
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 544

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 memeber from a group. Reference: msdn.microsoft.com/en-us/library/azure/ad/graph/api/groups-operations#DeleteGroupMember

will be added to the HTTP request.



140
141
142
143
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 140

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 memeber from a group. Reference: msdn.microsoft.com/en-us/library/azure/ad/graph/api/groups-operations#DeleteGroupMember

to the HTTP request.



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
209
210
211
212
213
214
215
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 171

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}'
  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 || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

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

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    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 memeber from a group. Reference: msdn.microsoft.com/en-us/library/azure/ad/graph/api/groups-operations#DeleteGroupMember

will be added to the HTTP request.



156
157
158
# File 'lib/generated/azure_mgmt_graph/groups.rb', line 156

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