lib/fastly/api/tokens_api.rb in fastly-5.3.1 vs lib/fastly/api/tokens_api.rb in fastly-6.0.0
- old
+ new
@@ -15,9 +15,131 @@
attr_accessor :api_client
def initialize(api_client = ApiClient.default)
@api_client = api_client
end
+ # Revoke multiple tokens
+ # Revoke Tokens in bulk format. Users may only revoke their own tokens. Superusers may revoke tokens of others.
+ # @option opts [Hash<String, Object>] :request_body
+ # @return [nil]
+ def bulk_revoke_tokens(opts = {})
+ bulk_revoke_tokens_with_http_info(opts)
+ nil
+ end
+
+ # Revoke multiple tokens
+ # Revoke Tokens in bulk format. Users may only revoke their own tokens. Superusers may revoke tokens of others.
+ # @option opts [Hash<String, Object>] :request_body
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
+ def bulk_revoke_tokens_with_http_info(opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: TokensApi.bulk_revoke_tokens ...'
+ end
+ # unbox the parameters from the hash
+ # resource path
+ local_var_path = '/tokens'
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Content-Type'
+ content_type = @api_client.select_header_content_type(['application/vnd.api+json; ext=bulk'])
+ if !content_type.nil?
+ header_params['Content-Type'] = content_type
+ end
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'request_body'])
+
+ # return_type
+ return_type = opts[:debug_return_type]
+
+ # auth_names
+ auth_names = opts[:debug_auth_names] || ['token']
+
+ new_options = opts.merge(
+ :operation => :"TokensApi.bulk_revoke_tokens",
+ :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: TokensApi#bulk_revoke_tokens\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
+ # Create a token
+ # Create an API token. If two-factor authentication is enabled for your account, review [the instructions](/reference/api/auth-tokens/user/) for including a one-time password in the request.
+ # @return [TokenCreatedResponse]
+ def create_token(opts = {})
+ data, _status_code, _headers = create_token_with_http_info(opts)
+ data
+ end
+
+ # Create a token
+ # Create an API token. If two-factor authentication is enabled for your account, review [the instructions](/reference/api/auth-tokens/user/) for including a one-time password in the request.
+ # @return [Array<(TokenCreatedResponse, Integer, Hash)>] TokenCreatedResponse data, response status code and response headers
+ def create_token_with_http_info(opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: TokensApi.create_token ...'
+ end
+ # unbox the parameters from the hash
+ # resource path
+ local_var_path = '/tokens'
+
+ # 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] || {}
+
+ # http body (model)
+ post_body = opts[:debug_body]
+
+ # return_type
+ return_type = opts[:debug_return_type] || 'TokenCreatedResponse'
+
+ # auth_names
+ auth_names = opts[:debug_auth_names] || ['token', 'username_and_password']
+
+ new_options = opts.merge(
+ :operation => :"TokensApi.create_token",
+ :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: TokensApi#create_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
# Get a token
# Get a single token by its id.
# @option opts [String] :token_id Alphanumeric string identifying a token. (required)
# @return [TokenResponse]
def get_token(opts = {})