class Azure::GraphRbac::V1_6::Groups
The Graph RBAC Management Client
Attributes
@return [GraphRbacClient] reference to the GraphRbacClient
Private Class Methods
Creates and initializes a new instance of the Groups
class. @param client service class for accessing basic functionality.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 17 def initialize(client) @client = client end
Private Instance Methods
Add a member to a group.
@param group_object_id [String] The object ID of the group to which to add the member. @param parameters [GroupAddMemberParameters] The URL of the member object, such as graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 221 def add_member(group_object_id, parameters, custom_headers:nil) response = add_member_async(group_object_id, parameters, custom_headers:custom_headers).value! nil end
Add a member to a group.
@param group_object_id [String] The object ID of the group to which to add the member. @param parameters [GroupAddMemberParameters] The URL of the member object, such as graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 256 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 = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::GraphRbac::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: {'groupObjectId' => group_object_id,'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 == 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 a member to a group.
@param group_object_id [String] The object ID of the group to which to add the member. @param parameters [GroupAddMemberParameters] The URL of the member object, such as graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 239 def add_member_with_http_info(group_object_id, parameters, custom_headers:nil) add_member_async(group_object_id, parameters, custom_headers:custom_headers).value! end
Create a group in the directory.
@param parameters [GroupCreateParameters] The parameters for the group to create. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [ADGroup] operation results.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 316 def create(parameters, custom_headers:nil) response = create_async(parameters, custom_headers:custom_headers).value! response.body unless response.nil? end
Create a group in the directory.
@param parameters [GroupCreateParameters] The parameters for the group to create. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 345 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 = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::GraphRbac::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::GraphRbac::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 a group in the directory.
@param parameters [GroupCreateParameters] The parameters for the group to create. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 331 def create_with_http_info(parameters, custom_headers:nil) create_async(parameters, custom_headers:custom_headers).value! end
Delete a group from the directory.
@param object_id [String] The object ID of the group to delete. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 681 def delete(object_id, custom_headers:nil) response = delete_async(object_id, custom_headers:custom_headers).value! nil end
Delete a group from the directory.
@param object_id [String] The object ID of the group to delete. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 708 def delete_async(object_id, custom_headers:nil) fail ArgumentError, 'object_id is nil' if object_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # 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: {'objectId' => object_id,'tenantID' => @client.tenant_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 a group from the directory.
@param object_id [String] The object ID of the group to delete. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 695 def delete_with_http_info(object_id, custom_headers:nil) delete_async(object_id, custom_headers:custom_headers).value! end
Gets group information from the directory.
@param object_id [String] The object ID of the user for which to get group information. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [ADGroup] operation results.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 592 def get(object_id, custom_headers:nil) response = get_async(object_id, custom_headers:custom_headers).value! response.body unless response.nil? end
Gets group information from the directory.
@param object_id [String] The object ID of the user for which to get group information. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 621 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 = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # 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: {'objectId' => object_id,'tenantID' => @client.tenant_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::GraphRbac::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
Gets the members of a group.
@param object_id [String] The object ID of the group whose members should be retrieved. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array<AADObject>] operation results.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 501 def get_group_members(object_id, custom_headers:nil) first_page = get_group_members_as_lazy(object_id, custom_headers:custom_headers) first_page.get_all_items end
Gets the members of a group.
@param object_id [String] The object ID of the group whose members should be retrieved. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [GetObjectsResult] which provide lazy access to pages of the response.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 1067 def get_group_members_as_lazy(object_id, custom_headers:nil) response = get_group_members_async(object_id, custom_headers: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:custom_headers) end page end end
Gets the members of a group.
@param object_id [String] The object ID of the group whose members should be retrieved. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 530 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 = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # 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: {'objectId' => object_id,'tenantID' => @client.tenant_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::GraphRbac::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
Gets the members of a group.
@param next_link [String] Next link for the list operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array<AADObject>] operation results.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 956 def get_group_members_next(next_link, custom_headers:nil) response = get_group_members_next_async(next_link, custom_headers:custom_headers).value! response.body unless response.nil? end
Gets the members of a group.
@param next_link [String] Next link for the list operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 983 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 = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # 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::GraphRbac::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
Gets the members of a group.
@param next_link [String] Next link for the list operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 970 def get_group_members_next_with_http_info(next_link, custom_headers:nil) get_group_members_next_async(next_link, custom_headers:custom_headers).value! end
Gets the members of a group.
@param object_id [String] The object ID of the group whose members should be retrieved. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 516 def get_group_members_with_http_info(object_id, custom_headers:nil) get_group_members_async(object_id, custom_headers:custom_headers).value! end
Gets a collection of object IDs of groups of which the specified group is a member.
@param object_id [String] The object ID of the group for which to get group membership. @param parameters [GroupGetMemberGroupsParameters] Group filtering parameters. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [GroupGetMemberGroupsResult] operation results.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 763 def get_member_groups(object_id, parameters, custom_headers:nil) response = get_member_groups_async(object_id, parameters, custom_headers:custom_headers).value! response.body unless response.nil? end
Gets a collection of object IDs of groups of which the specified group is a member.
@param object_id [String] The object ID of the group for which to get group membership. @param parameters [GroupGetMemberGroupsParameters] Group filtering parameters. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 798 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 = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::GraphRbac::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: {'objectId' => object_id,'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::GraphRbac::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
Gets a collection of object IDs of groups of which the specified group is a member.
@param object_id [String] The object ID of the group for which to get group membership. @param parameters [GroupGetMemberGroupsParameters] Group filtering parameters. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 781 def get_member_groups_with_http_info(object_id, parameters, custom_headers:nil) get_member_groups_async(object_id, parameters, custom_headers:custom_headers).value! end
Gets group information from the directory.
@param object_id [String] The object ID of the user for which to get group information. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 607 def get_with_http_info(object_id, custom_headers:nil) get_async(object_id, custom_headers:custom_headers).value! end
Checks whether the specified user, group, contact, or service principal is a direct or transitive member of the specified group.
@param parameters [CheckGroupMembershipParameters] The check group membership parameters. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [CheckGroupMembershipResult] operation results.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 35 def is_member_of(parameters, custom_headers:nil) response = is_member_of_async(parameters, custom_headers:custom_headers).value! response.body unless response.nil? end
Checks whether the specified user, group, contact, or service principal is a direct or transitive member of the specified group.
@param parameters [CheckGroupMembershipParameters] The check group membership parameters. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/1.6/generated/azure_graph_rbac/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 = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::GraphRbac::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::GraphRbac::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
Checks whether the specified user, group, contact, or service principal is a direct or transitive member of the specified group.
@param parameters [CheckGroupMembershipParameters] The check group membership parameters. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 51 def is_member_of_with_http_info(parameters, custom_headers:nil) is_member_of_async(parameters, custom_headers:custom_headers).value! end
Gets list of groups for the current tenant.
@param filter [String] The filter to apply to the operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array<ADGroup>] operation results.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 413 def list(filter:nil, custom_headers:nil) first_page = list_as_lazy(filter:filter, custom_headers:custom_headers) first_page.get_all_items end
Gets list of groups for the current tenant.
@param filter [String] The filter to apply to the operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [GroupListResult] which provide lazy access to pages of the response.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 1045 def list_as_lazy(filter:nil, custom_headers:nil) response = list_async(filter:filter, custom_headers:custom_headers).value! unless response.nil? page = response.body page.next_method = Proc.new do |next_link| list_next_async(next_link, custom_headers:custom_headers) end page end end
Gets list of groups for the current tenant.
@param filter [String] The filter to apply to the operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 440 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 = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # 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::GraphRbac::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
Gets a list of groups for the current tenant.
@param next_link [String] Next link for the list operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array<ADGroup>] operation results.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 867 def list_next(next_link, custom_headers:nil) response = list_next_async(next_link, custom_headers:custom_headers).value! response.body unless response.nil? end
Gets a list of groups for the current tenant.
@param next_link [String] Next link for the list operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 894 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 = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # 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::GraphRbac::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
Gets a list of groups for the current tenant.
@param next_link [String] Next link for the list operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 881 def list_next_with_http_info(next_link, custom_headers:nil) list_next_async(next_link, custom_headers:custom_headers).value! end
Gets list of groups for the current tenant.
@param filter [String] The filter to apply to the operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 427 def list_with_http_info(filter:nil, custom_headers:nil) list_async(filter:filter, custom_headers:custom_headers).value! end
Remove a member from a group.
@param group_object_id [String] The object ID of the group from which to remove the member. @param member_object_id [String] Member object id @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 135 def remove_member(group_object_id, member_object_id, custom_headers:nil) response = remove_member_async(group_object_id, member_object_id, custom_headers:custom_headers).value! nil end
Remove a member from a group.
@param group_object_id [String] The object ID of the group from which to remove the member. @param member_object_id [String] Member object id @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 166 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 = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # 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: {'groupObjectId' => group_object_id,'memberObjectId' => member_object_id,'tenantID' => @client.tenant_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 a member from a group.
@param group_object_id [String] The object ID of the group from which to remove the member. @param member_object_id [String] Member object id @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/1.6/generated/azure_graph_rbac/groups.rb, line 151 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:custom_headers).value! end