class Fastly::UserApi
Attributes
Public Class Methods
Source
# File lib/fastly/api/user_api.rb, line 17 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Source
# File lib/fastly/api/user_api.rb, line 31 def create_user(opts = {}) data, _status_code, _headers = create_user_with_http_info(opts) data end
Create a user Create a user. @option opts [String] :login @option opts [String] :name The real life name of the user. @option opts [Boolean] :limit_services Indicates that the user has limited access to the customer's services. @option opts [Boolean] :locked Indicates whether the is account is locked for editing or not. @option opts [Boolean] :require_new_password Indicates if a new password is required at next login. @option opts [RoleUser] :role @option opts [Boolean] :two_factor_auth_enabled Indicates if 2FA is enabled on the user. @option opts [Boolean] :two_factor_setup_required Indicates if 2FA is required by the user's customer account. @return [UserResponse]
Source
# File lib/fastly/api/user_api.rb, line 47 def create_user_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.create_user ...' end # unbox the parameters from the hash # resource path local_var_path = '/user' # 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' content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['login'] = opts[:'login'] if !opts[:'login'].nil? form_params['name'] = opts[:'name'] if !opts[:'name'].nil? form_params['limit_services'] = opts[:'limit_services'] if !opts[:'limit_services'].nil? form_params['locked'] = opts[:'locked'] if !opts[:'locked'].nil? form_params['require_new_password'] = opts[:'require_new_password'] if !opts[:'require_new_password'].nil? form_params['role'] = opts[:'role'] if !opts[:'role'].nil? form_params['two_factor_auth_enabled'] = opts[:'two_factor_auth_enabled'] if !opts[:'two_factor_auth_enabled'].nil? form_params['two_factor_setup_required'] = opts[:'two_factor_setup_required'] if !opts[:'two_factor_setup_required'].nil? # 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] || ['token'] new_options = opts.merge( :operation => :"UserApi.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: UserApi#create_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Create a user Create a user. @option opts [String] :login @option opts [String] :name The real life name of the user. @option opts [Boolean] :limit_services Indicates that the user has limited access to the customer's services. @option opts [Boolean] :locked Indicates whether the is account is locked for editing or not. @option opts [Boolean] :require_new_password Indicates if a new password is required at next login. @option opts [RoleUser] :role @option opts [Boolean] :two_factor_auth_enabled Indicates if 2FA is enabled on the user. @option opts [Boolean] :two_factor_setup_required Indicates if 2FA is required by the user's customer account. @return [Array<(UserResponse
, Integer, Hash)>] UserResponse
data, response status code and response headers
Source
# File lib/fastly/api/user_api.rb, line 109 def delete_user(opts = {}) data, _status_code, _headers = delete_user_with_http_info(opts) data end
Delete a user Delete a user. @option opts [String] :user_id Alphanumeric string identifying the user. (required) @return [InlineResponse200]
Source
# File lib/fastly/api/user_api.rb, line 118 def delete_user_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.delete_user ...' end # unbox the parameters from the hash user_id = opts[:'user_id'] # 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 UserApi.delete_user" end # resource path local_var_path = '/user/{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] || 'InlineResponse200' # auth_names auth_names = opts[:debug_auth_names] || ['token'] new_options = opts.merge( :operation => :"UserApi.delete_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: UserApi#delete_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Delete a user Delete a user. @option opts [String] :user_id Alphanumeric string identifying the user. (required) @return [Array<(InlineResponse200
, Integer, Hash)>] InlineResponse200
data, response status code and response headers
Source
# File lib/fastly/api/user_api.rb, line 171 def get_current_user(opts = {}) data, _status_code, _headers = get_current_user_with_http_info(opts) data end
Get the current user Get the logged in user. @return [UserResponse]
Source
# File lib/fastly/api/user_api.rb, line 179 def get_current_user_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.get_current_user ...' end # unbox the parameters from the hash # resource path local_var_path = '/current_user' # 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] || ['token'] new_options = opts.merge( :operation => :"UserApi.get_current_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: UserApi#get_current_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get the current user Get the logged in user. @return [Array<(UserResponse
, Integer, Hash)>] UserResponse
data, response status code and response headers
Source
# File lib/fastly/api/user_api.rb, line 228 def get_user(opts = {}) data, _status_code, _headers = get_user_with_http_info(opts) data end
Get a user Get a specific user. @option opts [String] :user_id Alphanumeric string identifying the user. (required) @return [UserResponse]
Source
# File lib/fastly/api/user_api.rb, line 237 def get_user_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.get_user ...' end # unbox the parameters from the hash user_id = opts[:'user_id'] # 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 UserApi.get_user" end # resource path local_var_path = '/user/{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] || ['token'] new_options = opts.merge( :operation => :"UserApi.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: UserApi#get_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get a user Get a specific user. @option opts [String] :user_id Alphanumeric string identifying the user. (required) @return [Array<(UserResponse
, Integer, Hash)>] UserResponse
data, response status code and response headers
Source
# File lib/fastly/api/user_api.rb, line 291 def request_password_reset(opts = {}) data, _status_code, _headers = request_password_reset_with_http_info(opts) data end
Request a password reset Requests a password reset for the specified user. @option opts [String] :user_login The login associated with the user (typically, an email address). (required) @return [InlineResponse200]
Source
# File lib/fastly/api/user_api.rb, line 300 def request_password_reset_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.request_password_reset ...' end # unbox the parameters from the hash user_login = opts[:'user_login'] # verify the required parameter 'user_login' is set if @api_client.config.client_side_validation && user_login.nil? fail ArgumentError, "Missing the required parameter 'user_login' when calling UserApi.request_password_reset" end # resource path local_var_path = '/user/{user_login}/password/request_reset'.sub('{' + 'user_login' + '}', CGI.escape(user_login.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] || 'InlineResponse200' # auth_names auth_names = opts[:debug_auth_names] || ['token'] new_options = opts.merge( :operation => :"UserApi.request_password_reset", :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: UserApi#request_password_reset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Request a password reset Requests a password reset for the specified user. @option opts [String] :user_login The login associated with the user (typically, an email address). (required) @return [Array<(InlineResponse200
, Integer, Hash)>] InlineResponse200
data, response status code and response headers
Source
# File lib/fastly/api/user_api.rb, line 362 def update_user(opts = {}) data, _status_code, _headers = update_user_with_http_info(opts) data end
Update a user Update a user. Only users with the role of ‘superuser` can make changes to other users on the account. Non-superusers may use this endpoint to make changes to their own account. Two-factor attributes are not editable via this endpoint. @option opts [String] :user_id Alphanumeric string identifying the user. (required) @option opts [String] :login @option opts [String] :name The real life name of the user. @option opts [Boolean] :limit_services Indicates that the user has limited access to the customer's services. @option opts [Boolean] :locked Indicates whether the is account is locked for editing or not. @option opts [Boolean] :require_new_password Indicates if a new password is required at next login. @option opts [RoleUser] :role @option opts [Boolean] :two_factor_auth_enabled Indicates if 2FA is enabled on the user. @option opts [Boolean] :two_factor_setup_required Indicates if 2FA is required by the user's customer account. @return [UserResponse]
Source
# File lib/fastly/api/user_api.rb, line 447 def update_user_password(opts = {}) data, _status_code, _headers = update_user_password_with_http_info(opts) data end
Update the user’s password Update the user’s password to a new one. @option opts [String] :old_password The user's current password. @option opts [String] :new_password The user's new password. @return [UserResponse]
Source
# File lib/fastly/api/user_api.rb, line 457 def update_user_password_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.update_user_password ...' end # unbox the parameters from the hash # resource path local_var_path = '/current_user/password' # 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' content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['old_password'] = opts[:'old_password'] if !opts[:'old_password'].nil? form_params['new_password'] = opts[:'new_password'] if !opts[:'new_password'].nil? # 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] || ['session_password_change'] new_options = opts.merge( :operation => :"UserApi.update_user_password", :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: UserApi#update_user_password\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Update the user's password Update the user's password to a new one. @option opts [String] :old_password The user's current password. @option opts [String] :new_password The user's new password. @return [Array<(UserResponse
, Integer, Hash)>] UserResponse
data, response status code and response headers
Source
# File lib/fastly/api/user_api.rb, line 379 def update_user_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.update_user ...' end # unbox the parameters from the hash user_id = opts[:'user_id'] # 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 UserApi.update_user" end # resource path local_var_path = '/user/{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' content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['login'] = opts[:'login'] if !opts[:'login'].nil? form_params['name'] = opts[:'name'] if !opts[:'name'].nil? form_params['limit_services'] = opts[:'limit_services'] if !opts[:'limit_services'].nil? form_params['locked'] = opts[:'locked'] if !opts[:'locked'].nil? form_params['require_new_password'] = opts[:'require_new_password'] if !opts[:'require_new_password'].nil? form_params['role'] = opts[:'role'] if !opts[:'role'].nil? form_params['two_factor_auth_enabled'] = opts[:'two_factor_auth_enabled'] if !opts[:'two_factor_auth_enabled'].nil? form_params['two_factor_setup_required'] = opts[:'two_factor_setup_required'] if !opts[:'two_factor_setup_required'].nil? # 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] || ['token'] new_options = opts.merge( :operation => :"UserApi.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(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#update_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Update a user Update a user. Only users with the role of `superuser` can make changes to other users on the account. Non-superusers may use this endpoint to make changes to their own account. Two-factor attributes are not editable via this endpoint. @option opts [String] :user_id Alphanumeric string identifying the user. (required) @option opts [String] :login @option opts [String] :name The real life name of the user. @option opts [Boolean] :limit_services Indicates that the user has limited access to the customer's services. @option opts [Boolean] :locked Indicates whether the is account is locked for editing or not. @option opts [Boolean] :require_new_password Indicates if a new password is required at next login. @option opts [RoleUser] :role @option opts [Boolean] :two_factor_auth_enabled Indicates if 2FA is enabled on the user. @option opts [Boolean] :two_factor_setup_required Indicates if 2FA is required by the user's customer account. @return [Array<(UserResponse
, Integer, Hash)>] UserResponse
data, response status code and response headers