class DatadogAPIClient::V2::RolesAPI
Attributes
Public Class Methods
# File lib/datadog_api_client/v2/api/roles_api.rb, line 22 def initialize(api_client = APIClient.default) @api_client = api_client end
Public Instance Methods
Grant permission to a role Adds a permission to a role. @param role_id [String] The ID of the role. @param body [RelationshipToPermission] @param [Hash] opts the optional parameters @return [PermissionsResponse]
# File lib/datadog_api_client/v2/api/roles_api.rb, line 31 def add_permission_to_role(role_id, body, opts = {}) data, _status_code, _headers = add_permission_to_role_with_http_info(role_id, body, opts) data end
Grant permission to a role Adds a permission to a role. @param role_id [String] The ID of the role. @param body [RelationshipToPermission] @param [Hash] opts the optional parameters @return [Array<(PermissionsResponse
, Integer, Hash)>] PermissionsResponse
data, response status code and response headers
# File lib/datadog_api_client/v2/api/roles_api.rb, line 42 def add_permission_to_role_with_http_info(role_id, body, opts = {}) if @api_client.config.unstable_operations.has_key?(:add_permission_to_role) unstable_enabled = @api_client.config.unstable_operations[:add_permission_to_role] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "add_permission_to_role") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "add_permission_to_role")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RolesAPI.add_permission_to_role ...' end # verify the required parameter 'role_id' is set if @api_client.config.client_side_validation && role_id.nil? fail ArgumentError, "Missing the required parameter 'role_id' when calling RolesAPI.add_permission_to_role" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling RolesAPI.add_permission_to_role" end # resource path local_var_path = '/api/v2/roles/{role_id}/permissions'.sub('{' + 'role_id' + '}', CGI.escape(role_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'PermissionsResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :add_permission_to_role, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RolesAPI#add_permission_to_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Add a user to a role Adds a user to a role. @param role_id [String] The ID of the role. @param body [RelationshipToUser] @param [Hash] opts the optional parameters @return [UsersResponse]
# File lib/datadog_api_client/v2/api/roles_api.rb, line 112 def add_user_to_role(role_id, body, opts = {}) data, _status_code, _headers = add_user_to_role_with_http_info(role_id, body, opts) data end
Add a user to a role Adds a user to a role. @param role_id [String] The ID of the role. @param body [RelationshipToUser] @param [Hash] opts the optional parameters @return [Array<(UsersResponse
, Integer, Hash)>] UsersResponse
data, response status code and response headers
# File lib/datadog_api_client/v2/api/roles_api.rb, line 123 def add_user_to_role_with_http_info(role_id, body, opts = {}) if @api_client.config.unstable_operations.has_key?(:add_user_to_role) unstable_enabled = @api_client.config.unstable_operations[:add_user_to_role] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "add_user_to_role") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "add_user_to_role")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RolesAPI.add_user_to_role ...' end # verify the required parameter 'role_id' is set if @api_client.config.client_side_validation && role_id.nil? fail ArgumentError, "Missing the required parameter 'role_id' when calling RolesAPI.add_user_to_role" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling RolesAPI.add_user_to_role" end # resource path local_var_path = '/api/v2/roles/{role_id}/users'.sub('{' + 'role_id' + '}', CGI.escape(role_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'UsersResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :add_user_to_role, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RolesAPI#add_user_to_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Create role Create a new role for your organization. @param body [RoleCreateRequest] @param [Hash] opts the optional parameters @return [RoleCreateResponse]
# File lib/datadog_api_client/v2/api/roles_api.rb, line 192 def create_role(body, opts = {}) data, _status_code, _headers = create_role_with_http_info(body, opts) data end
Create role Create a new role for your organization. @param body [RoleCreateRequest] @param [Hash] opts the optional parameters @return [Array<(RoleCreateResponse
, Integer, Hash)>] RoleCreateResponse
data, response status code and response headers
# File lib/datadog_api_client/v2/api/roles_api.rb, line 202 def create_role_with_http_info(body, opts = {}) if @api_client.config.unstable_operations.has_key?(:create_role) unstable_enabled = @api_client.config.unstable_operations[:create_role] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "create_role") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "create_role")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RolesAPI.create_role ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling RolesAPI.create_role" end # resource path local_var_path = '/api/v2/roles' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'RoleCreateResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :create_role, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RolesAPI#create_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Delete role Disables a role. @param role_id [String] The ID of the role. @param [Hash] opts the optional parameters @return [nil]
# File lib/datadog_api_client/v2/api/roles_api.rb, line 267 def delete_role(role_id, opts = {}) delete_role_with_http_info(role_id, opts) nil end
Delete role Disables a role. @param role_id [String] The ID of the role. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
# File lib/datadog_api_client/v2/api/roles_api.rb, line 277 def delete_role_with_http_info(role_id, opts = {}) if @api_client.config.unstable_operations.has_key?(:delete_role) unstable_enabled = @api_client.config.unstable_operations[:delete_role] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "delete_role") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "delete_role")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RolesAPI.delete_role ...' end # verify the required parameter 'role_id' is set if @api_client.config.client_side_validation && role_id.nil? fail ArgumentError, "Missing the required parameter 'role_id' when calling RolesAPI.delete_role" end # resource path local_var_path = '/api/v2/roles/{role_id}'.sub('{' + 'role_id' + '}', CGI.escape(role_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :delete_role, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RolesAPI#delete_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get a role Get a role in the organization specified by the role’s `role_id`. @param role_id [String] The ID of the role. @param [Hash] opts the optional parameters @return [RoleResponse]
# File lib/datadog_api_client/v2/api/roles_api.rb, line 340 def get_role(role_id, opts = {}) data, _status_code, _headers = get_role_with_http_info(role_id, opts) data end
Get a role Get a role in the organization specified by the role’s `role_id`. @param role_id [String] The ID of the role. @param [Hash] opts the optional parameters @return [Array<(RoleResponse
, Integer, Hash)>] RoleResponse
data, response status code and response headers
# File lib/datadog_api_client/v2/api/roles_api.rb, line 350 def get_role_with_http_info(role_id, opts = {}) if @api_client.config.unstable_operations.has_key?(:get_role) unstable_enabled = @api_client.config.unstable_operations[:get_role] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "get_role") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "get_role")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RolesAPI.get_role ...' end # verify the required parameter 'role_id' is set if @api_client.config.client_side_validation && role_id.nil? fail ArgumentError, "Missing the required parameter 'role_id' when calling RolesAPI.get_role" end # resource path local_var_path = '/api/v2/roles/{role_id}'.sub('{' + 'role_id' + '}', CGI.escape(role_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'RoleResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :get_role, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RolesAPI#get_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List permissions Returns a list of all permissions, including name, description, and ID. @param [Hash] opts the optional parameters @return [PermissionsResponse]
# File lib/datadog_api_client/v2/api/roles_api.rb, line 412 def list_permissions(opts = {}) data, _status_code, _headers = list_permissions_with_http_info(opts) data end
List permissions Returns a list of all permissions, including name, description, and ID. @param [Hash] opts the optional parameters @return [Array<(PermissionsResponse
, Integer, Hash)>] PermissionsResponse
data, response status code and response headers
# File lib/datadog_api_client/v2/api/roles_api.rb, line 421 def list_permissions_with_http_info(opts = {}) if @api_client.config.unstable_operations.has_key?(:list_permissions) unstable_enabled = @api_client.config.unstable_operations[:list_permissions] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "list_permissions") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "list_permissions")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RolesAPI.list_permissions ...' end # resource path local_var_path = '/api/v2/permissions' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'PermissionsResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :list_permissions, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RolesAPI#list_permissions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List permissions for a role Returns a list of all permissions for a single role. @param role_id [String] The ID of the role. @param [Hash] opts the optional parameters @return [PermissionsResponse]
# File lib/datadog_api_client/v2/api/roles_api.rb, line 480 def list_role_permissions(role_id, opts = {}) data, _status_code, _headers = list_role_permissions_with_http_info(role_id, opts) data end
List permissions for a role Returns a list of all permissions for a single role. @param role_id [String] The ID of the role. @param [Hash] opts the optional parameters @return [Array<(PermissionsResponse
, Integer, Hash)>] PermissionsResponse
data, response status code and response headers
# File lib/datadog_api_client/v2/api/roles_api.rb, line 490 def list_role_permissions_with_http_info(role_id, opts = {}) if @api_client.config.unstable_operations.has_key?(:list_role_permissions) unstable_enabled = @api_client.config.unstable_operations[:list_role_permissions] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "list_role_permissions") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "list_role_permissions")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RolesAPI.list_role_permissions ...' end # verify the required parameter 'role_id' is set if @api_client.config.client_side_validation && role_id.nil? fail ArgumentError, "Missing the required parameter 'role_id' when calling RolesAPI.list_role_permissions" end # resource path local_var_path = '/api/v2/roles/{role_id}/permissions'.sub('{' + 'role_id' + '}', CGI.escape(role_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'PermissionsResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :list_role_permissions, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RolesAPI#list_role_permissions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get all users of a role Gets all users of a role. @param role_id [String] The ID of the role. @param [Hash] opts the optional parameters @option opts [Integer] :page_size Size for a given page. (default to 10) @option opts [Integer] :page_number Specific page number to return. (default to 0) @option opts [String] :sort User
attribute to order results by. Sort order is ascending by default. Sort order is descending if the field is prefixed by a negative sign, for example `sort=-name`. Options: `name`, `email`, `status`. (default to 'name') @option opts [String] :filter Filter all users by the given string. Defaults to no filtering. @return [UsersResponse]
# File lib/datadog_api_client/v2/api/roles_api.rb, line 557 def list_role_users(role_id, opts = {}) data, _status_code, _headers = list_role_users_with_http_info(role_id, opts) data end
Get all users of a role Gets all users of a role. @param role_id [String] The ID of the role. @param [Hash] opts the optional parameters @option opts [Integer] :page_size Size for a given page. @option opts [Integer] :page_number Specific page number to return. @option opts [String] :sort User
attribute to order results by. Sort order is ascending by default. Sort order is descending if the field is prefixed by a negative sign, for example `sort=-name`. Options: `name`, `email`, `status`. @option opts [String] :filter Filter all users by the given string. Defaults to no filtering. @return [Array<(UsersResponse
, Integer, Hash)>] UsersResponse
data, response status code and response headers
# File lib/datadog_api_client/v2/api/roles_api.rb, line 571 def list_role_users_with_http_info(role_id, opts = {}) if @api_client.config.unstable_operations.has_key?(:list_role_users) unstable_enabled = @api_client.config.unstable_operations[:list_role_users] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "list_role_users") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "list_role_users")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RolesAPI.list_role_users ...' end # verify the required parameter 'role_id' is set if @api_client.config.client_side_validation && role_id.nil? fail ArgumentError, "Missing the required parameter 'role_id' when calling RolesAPI.list_role_users" end # resource path local_var_path = '/api/v2/roles/{role_id}/users'.sub('{' + 'role_id' + '}', CGI.escape(role_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'UsersResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :list_role_users, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RolesAPI#list_role_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List roles Returns all roles, including their names and IDs. @param [Hash] opts the optional parameters @option opts [Integer] :page_size Size for a given page. (default to 10) @option opts [Integer] :page_number Specific page number to return. (default to 0) @option opts [RolesSort] :sort Sort roles depending on the given field. Sort order is ascending by default. Sort order is descending if the field is prefixed by a negative sign, for example: `sort=-name`. (default to 'name') @option opts [String] :filter Filter all roles by the given string. @return [RolesResponse]
# File lib/datadog_api_client/v2/api/roles_api.rb, line 641 def list_roles(opts = {}) data, _status_code, _headers = list_roles_with_http_info(opts) data end
List roles Returns all roles, including their names and IDs. @param [Hash] opts the optional parameters @option opts [Integer] :page_size Size for a given page. @option opts [Integer] :page_number Specific page number to return. @option opts [RolesSort] :sort Sort roles depending on the given field. Sort order is ascending by default. Sort order is descending if the field is prefixed by a negative sign, for example: `sort=-name`. @option opts [String] :filter Filter all roles by the given string. @return [Array<(RolesResponse
, Integer, Hash)>] RolesResponse
data, response status code and response headers
# File lib/datadog_api_client/v2/api/roles_api.rb, line 654 def list_roles_with_http_info(opts = {}) if @api_client.config.unstable_operations.has_key?(:list_roles) unstable_enabled = @api_client.config.unstable_operations[:list_roles] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "list_roles") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "list_roles")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RolesAPI.list_roles ...' end # resource path local_var_path = '/api/v2/roles' # query parameters query_params = opts[:query_params] || {} query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'RolesResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :list_roles, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RolesAPI#list_roles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Revoke permission Removes a permission from a role. @param role_id [String] The ID of the role. @param body [RelationshipToPermission] @param [Hash] opts the optional parameters @return [PermissionsResponse]
# File lib/datadog_api_client/v2/api/roles_api.rb, line 718 def remove_permission_from_role(role_id, body, opts = {}) data, _status_code, _headers = remove_permission_from_role_with_http_info(role_id, body, opts) data end
Revoke permission Removes a permission from a role. @param role_id [String] The ID of the role. @param body [RelationshipToPermission] @param [Hash] opts the optional parameters @return [Array<(PermissionsResponse
, Integer, Hash)>] PermissionsResponse
data, response status code and response headers
# File lib/datadog_api_client/v2/api/roles_api.rb, line 729 def remove_permission_from_role_with_http_info(role_id, body, opts = {}) if @api_client.config.unstable_operations.has_key?(:remove_permission_from_role) unstable_enabled = @api_client.config.unstable_operations[:remove_permission_from_role] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "remove_permission_from_role") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "remove_permission_from_role")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RolesAPI.remove_permission_from_role ...' end # verify the required parameter 'role_id' is set if @api_client.config.client_side_validation && role_id.nil? fail ArgumentError, "Missing the required parameter 'role_id' when calling RolesAPI.remove_permission_from_role" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling RolesAPI.remove_permission_from_role" end # resource path local_var_path = '/api/v2/roles/{role_id}/permissions'.sub('{' + 'role_id' + '}', CGI.escape(role_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'PermissionsResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :remove_permission_from_role, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RolesAPI#remove_permission_from_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Remove a user from a role Removes a user from a role. @param role_id [String] The ID of the role. @param body [RelationshipToUser] @param [Hash] opts the optional parameters @return [UsersResponse]
# File lib/datadog_api_client/v2/api/roles_api.rb, line 799 def remove_user_from_role(role_id, body, opts = {}) data, _status_code, _headers = remove_user_from_role_with_http_info(role_id, body, opts) data end
Remove a user from a role Removes a user from a role. @param role_id [String] The ID of the role. @param body [RelationshipToUser] @param [Hash] opts the optional parameters @return [Array<(UsersResponse
, Integer, Hash)>] UsersResponse
data, response status code and response headers
# File lib/datadog_api_client/v2/api/roles_api.rb, line 810 def remove_user_from_role_with_http_info(role_id, body, opts = {}) if @api_client.config.unstable_operations.has_key?(:remove_user_from_role) unstable_enabled = @api_client.config.unstable_operations[:remove_user_from_role] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "remove_user_from_role") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "remove_user_from_role")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RolesAPI.remove_user_from_role ...' end # verify the required parameter 'role_id' is set if @api_client.config.client_side_validation && role_id.nil? fail ArgumentError, "Missing the required parameter 'role_id' when calling RolesAPI.remove_user_from_role" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling RolesAPI.remove_user_from_role" end # resource path local_var_path = '/api/v2/roles/{role_id}/users'.sub('{' + 'role_id' + '}', CGI.escape(role_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'UsersResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :remove_user_from_role, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RolesAPI#remove_user_from_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Update a role Edit a role. Can only be used with application keys belonging to administrators. @param role_id [String] The ID of the role. @param body [RoleUpdateRequest] @param [Hash] opts the optional parameters @return [RoleUpdateResponse]
# File lib/datadog_api_client/v2/api/roles_api.rb, line 880 def update_role(role_id, body, opts = {}) data, _status_code, _headers = update_role_with_http_info(role_id, body, opts) data end
Update a role Edit a role. Can only be used with application keys belonging to administrators. @param role_id [String] The ID of the role. @param body [RoleUpdateRequest] @param [Hash] opts the optional parameters @return [Array<(RoleUpdateResponse
, Integer, Hash)>] RoleUpdateResponse
data, response status code and response headers
# File lib/datadog_api_client/v2/api/roles_api.rb, line 891 def update_role_with_http_info(role_id, body, opts = {}) if @api_client.config.unstable_operations.has_key?(:update_role) unstable_enabled = @api_client.config.unstable_operations[:update_role] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "update_role") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "update_role")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RolesAPI.update_role ...' end # verify the required parameter 'role_id' is set if @api_client.config.client_side_validation && role_id.nil? fail ArgumentError, "Missing the required parameter 'role_id' when calling RolesAPI.update_role" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling RolesAPI.update_role" end # resource path local_var_path = '/api/v2/roles/{role_id}'.sub('{' + 'role_id' + '}', CGI.escape(role_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'RoleUpdateResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :update_role, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RolesAPI#update_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end