class DatadogAPIClient::V2::UsersAPI
Attributes
Public Class Methods
# File lib/datadog_api_client/v2/api/users_api.rb, line 22 def initialize(api_client = APIClient.default) @api_client = api_client end
Public Instance Methods
Create a user Create a user for your organization. @param body [UserCreateRequest] @param [Hash] opts the optional parameters @return [UserResponse]
# File lib/datadog_api_client/v2/api/users_api.rb, line 30 def create_user(body, opts = {}) data, _status_code, _headers = create_user_with_http_info(body, opts) data end
Create a user Create a user for your organization. @param body [UserCreateRequest] @param [Hash] opts the optional parameters @return [Array<(UserResponse
, Integer, Hash)>] UserResponse
data, response status code and response headers
# File lib/datadog_api_client/v2/api/users_api.rb, line 40 def create_user_with_http_info(body, opts = {}) if @api_client.config.unstable_operations.has_key?(:create_user) unstable_enabled = @api_client.config.unstable_operations[:create_user] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "create_user") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "create_user")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersAPI.create_user ...' 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 UsersAPI.create_user" end # resource path local_var_path = '/api/v2/users' # 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] || 'UserResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :create_user, :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: UsersAPI#create_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Disable a user Disable a user. Can only be used with an application key belonging to an administrator user. @param user_id [String] The ID of the user. @param [Hash] opts the optional parameters @return [nil]
# File lib/datadog_api_client/v2/api/users_api.rb, line 105 def disable_user(user_id, opts = {}) disable_user_with_http_info(user_id, opts) nil end
Disable a user Disable a user. Can only be used with an application key belonging to an administrator user. @param user_id [String] The ID of the user. @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/users_api.rb, line 115 def disable_user_with_http_info(user_id, opts = {}) if @api_client.config.unstable_operations.has_key?(:disable_user) unstable_enabled = @api_client.config.unstable_operations[:disable_user] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "disable_user") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "disable_user")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersAPI.disable_user ...' end # verify the required parameter 'user_id' is set if @api_client.config.client_side_validation && user_id.nil? fail ArgumentError, "Missing the required parameter 'user_id' when calling UsersAPI.disable_user" end # resource path local_var_path = '/api/v2/users/{user_id}'.sub('{' + 'user_id' + '}', CGI.escape(user_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 => :disable_user, :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: UsersAPI#disable_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get a user invitation Returns a single user invitation by its UUID. @param user_invitation_uuid [String] The UUID of the user invitation. @param [Hash] opts the optional parameters @return [UserInvitationResponse]
# File lib/datadog_api_client/v2/api/users_api.rb, line 178 def get_invitation(user_invitation_uuid, opts = {}) data, _status_code, _headers = get_invitation_with_http_info(user_invitation_uuid, opts) data end
Get a user invitation Returns a single user invitation by its UUID. @param user_invitation_uuid [String] The UUID of the user invitation. @param [Hash] opts the optional parameters @return [Array<(UserInvitationResponse
, Integer, Hash)>] UserInvitationResponse
data, response status code and response headers
# File lib/datadog_api_client/v2/api/users_api.rb, line 188 def get_invitation_with_http_info(user_invitation_uuid, opts = {}) if @api_client.config.unstable_operations.has_key?(:get_invitation) unstable_enabled = @api_client.config.unstable_operations[:get_invitation] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "get_invitation") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "get_invitation")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersAPI.get_invitation ...' end # verify the required parameter 'user_invitation_uuid' is set if @api_client.config.client_side_validation && user_invitation_uuid.nil? fail ArgumentError, "Missing the required parameter 'user_invitation_uuid' when calling UsersAPI.get_invitation" end # resource path local_var_path = '/api/v2/user_invitations/{user_invitation_uuid}'.sub('{' + 'user_invitation_uuid' + '}', CGI.escape(user_invitation_uuid.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] || 'UserInvitationResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :get_invitation, :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: UsersAPI#get_invitation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get user details Get a user in the organization specified by the user’s `user_id`. @param user_id [String] The ID of the user. @param [Hash] opts the optional parameters @return [UserResponse]
# File lib/datadog_api_client/v2/api/users_api.rb, line 251 def get_user(user_id, opts = {}) data, _status_code, _headers = get_user_with_http_info(user_id, opts) data end
Get user details Get a user in the organization specified by the user’s `user_id`. @param user_id [String] The ID of the user. @param [Hash] opts the optional parameters @return [Array<(UserResponse
, Integer, Hash)>] UserResponse
data, response status code and response headers
# File lib/datadog_api_client/v2/api/users_api.rb, line 261 def get_user_with_http_info(user_id, opts = {}) if @api_client.config.unstable_operations.has_key?(:get_user) unstable_enabled = @api_client.config.unstable_operations[:get_user] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "get_user") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "get_user")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersAPI.get_user ...' end # verify the required parameter 'user_id' is set if @api_client.config.client_side_validation && user_id.nil? fail ArgumentError, "Missing the required parameter 'user_id' when calling UsersAPI.get_user" end # resource path local_var_path = '/api/v2/users/{user_id}'.sub('{' + 'user_id' + '}', CGI.escape(user_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] || 'UserResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :get_user, :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: UsersAPI#get_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get a user organization Get a user organization. Returns the user information and all organizations joined by this user. @param user_id [String] The ID of the user. @param [Hash] opts the optional parameters @return [UserResponse]
# File lib/datadog_api_client/v2/api/users_api.rb, line 324 def list_user_organizations(user_id, opts = {}) data, _status_code, _headers = list_user_organizations_with_http_info(user_id, opts) data end
Get a user organization Get a user organization. Returns the user information and all organizations joined by this user. @param user_id [String] The ID of the user. @param [Hash] opts the optional parameters @return [Array<(UserResponse
, Integer, Hash)>] UserResponse
data, response status code and response headers
# File lib/datadog_api_client/v2/api/users_api.rb, line 334 def list_user_organizations_with_http_info(user_id, opts = {}) if @api_client.config.unstable_operations.has_key?(:list_user_organizations) unstable_enabled = @api_client.config.unstable_operations[:list_user_organizations] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "list_user_organizations") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "list_user_organizations")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersAPI.list_user_organizations ...' end # verify the required parameter 'user_id' is set if @api_client.config.client_side_validation && user_id.nil? fail ArgumentError, "Missing the required parameter 'user_id' when calling UsersAPI.list_user_organizations" end # resource path local_var_path = '/api/v2/users/{user_id}/orgs'.sub('{' + 'user_id' + '}', CGI.escape(user_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] || 'UserResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :list_user_organizations, :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: UsersAPI#list_user_organizations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get a user permissions Get a user permission set. Returns a list of the user’s permissions granted by the associated user's roles. @param user_id [String] The ID of the user. @param [Hash] opts the optional parameters @return [PermissionsResponse]
# File lib/datadog_api_client/v2/api/users_api.rb, line 397 def list_user_permissions(user_id, opts = {}) data, _status_code, _headers = list_user_permissions_with_http_info(user_id, opts) data end
Get a user permissions Get a user permission set. Returns a list of the user’s permissions granted by the associated user's roles. @param user_id [String] The ID of the user. @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/users_api.rb, line 407 def list_user_permissions_with_http_info(user_id, opts = {}) if @api_client.config.unstable_operations.has_key?(:list_user_permissions) unstable_enabled = @api_client.config.unstable_operations[:list_user_permissions] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "list_user_permissions") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "list_user_permissions")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersAPI.list_user_permissions ...' end # verify the required parameter 'user_id' is set if @api_client.config.client_side_validation && user_id.nil? fail ArgumentError, "Missing the required parameter 'user_id' when calling UsersAPI.list_user_permissions" end # resource path local_var_path = '/api/v2/users/{user_id}/permissions'.sub('{' + 'user_id' + '}', CGI.escape(user_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_user_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: UsersAPI#list_user_permissions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List all users Get the list of all users in the organization. This list includes all users even if they are deactivated or unverified. @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`, `modified_at`, `user_count`. (default to 'name') @option opts [QuerySortOrder] :sort_dir Direction of sort. Options: `asc`, `desc`. (default to 'desc') @option opts [String] :filter Filter all users by the given string. Defaults to no filtering. @option opts [String] :filter_status Filter on status attribute. Comma separated list, with possible values `Active`, `Pending`, and `Disabled`. Defaults to no filtering. @return [UsersResponse]
# File lib/datadog_api_client/v2/api/users_api.rb, line 475 def list_users(opts = {}) data, _status_code, _headers = list_users_with_http_info(opts) data end
List all users Get the list of all users in the organization. This list includes all users even if they are deactivated or unverified. @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`, `modified_at`, `user_count`. @option opts [QuerySortOrder] :sort_dir Direction of sort. Options: `asc`, `desc`. @option opts [String] :filter Filter all users by the given string. Defaults to no filtering. @option opts [String] :filter_status Filter on status attribute. Comma separated list, with possible values `Active`, `Pending`, and `Disabled`. Defaults to no filtering. @return [Array<(UsersResponse
, Integer, Hash)>] UsersResponse
data, response status code and response headers
# File lib/datadog_api_client/v2/api/users_api.rb, line 490 def list_users_with_http_info(opts = {}) if @api_client.config.unstable_operations.has_key?(:list_users) unstable_enabled = @api_client.config.unstable_operations[:list_users] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "list_users") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "list_users")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersAPI.list_users ...' end # resource path local_var_path = '/api/v2/users' # 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[:'sort_dir'] = opts[:'sort_dir'] if !opts[:'sort_dir'].nil? query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil? query_params[:'filter[status]'] = opts[:'filter_status'] if !opts[:'filter_status'].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_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: UsersAPI#list_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Send invitation emails Sends emails to one or more users inviting them to join the organization. @param body [UserInvitationsRequest] @param [Hash] opts the optional parameters @return [UserInvitationsResponse]
# File lib/datadog_api_client/v2/api/users_api.rb, line 555 def send_invitations(body, opts = {}) data, _status_code, _headers = send_invitations_with_http_info(body, opts) data end
Send invitation emails Sends emails to one or more users inviting them to join the organization. @param body [UserInvitationsRequest] @param [Hash] opts the optional parameters @return [Array<(UserInvitationsResponse
, Integer, Hash)>] UserInvitationsResponse
data, response status code and response headers
# File lib/datadog_api_client/v2/api/users_api.rb, line 565 def send_invitations_with_http_info(body, opts = {}) if @api_client.config.unstable_operations.has_key?(:send_invitations) unstable_enabled = @api_client.config.unstable_operations[:send_invitations] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "send_invitations") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "send_invitations")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersAPI.send_invitations ...' 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 UsersAPI.send_invitations" end # resource path local_var_path = '/api/v2/user_invitations' # 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] || 'UserInvitationsResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :send_invitations, :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: UsersAPI#send_invitations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Update a user Edit a user. Can only be used with an application key belonging to an administrator user. @param user_id [String] The ID of the user. @param body [UserUpdateRequest] @param [Hash] opts the optional parameters @return [UserResponse]
# File lib/datadog_api_client/v2/api/users_api.rb, line 631 def update_user(user_id, body, opts = {}) data, _status_code, _headers = update_user_with_http_info(user_id, body, opts) data end
Update a user Edit a user. Can only be used with an application key belonging to an administrator user. @param user_id [String] The ID of the user. @param body [UserUpdateRequest] @param [Hash] opts the optional parameters @return [Array<(UserResponse
, Integer, Hash)>] UserResponse
data, response status code and response headers
# File lib/datadog_api_client/v2/api/users_api.rb, line 642 def update_user_with_http_info(user_id, body, opts = {}) if @api_client.config.unstable_operations.has_key?(:update_user) unstable_enabled = @api_client.config.unstable_operations[:update_user] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "update_user") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "update_user")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersAPI.update_user ...' end # verify the required parameter 'user_id' is set if @api_client.config.client_side_validation && user_id.nil? fail ArgumentError, "Missing the required parameter 'user_id' when calling UsersAPI.update_user" 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 UsersAPI.update_user" end # resource path local_var_path = '/api/v2/users/{user_id}'.sub('{' + 'user_id' + '}', CGI.escape(user_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] || 'UserResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :update_user, :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: UsersAPI#update_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end