class LaunchDarklyApi::AccessTokensApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/launchdarkly_api/api/access_tokens_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

delete_token(id, opts = {}) click to toggle source

Delete access token Delete an access token by ID. @param id [String] The ID of the access token to update @param [Hash] opts the optional parameters @return [nil]

# File lib/launchdarkly_api/api/access_tokens_api.rb, line 27
def delete_token(id, opts = {})
  delete_token_with_http_info(id, opts)
  nil
end
delete_token_with_http_info(id, opts = {}) click to toggle source

Delete access token Delete an access token by ID. @param id [String] The ID of the access token to update @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/launchdarkly_api/api/access_tokens_api.rb, line 37
def delete_token_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AccessTokensApi.delete_token ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling AccessTokensApi.delete_token"
  end
  # resource path
  local_var_path = '/api/v2/tokens/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}

  # 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] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"AccessTokensApi.delete_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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AccessTokensApi#delete_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_token(id, opts = {}) click to toggle source

Get access token Get a single access token by ID. @param id [String] The ID of the access token @param [Hash] opts the optional parameters @return [Token]

# File lib/launchdarkly_api/api/access_tokens_api.rb, line 88
def get_token(id, opts = {})
  data, _status_code, _headers = get_token_with_http_info(id, opts)
  data
end
get_token_with_http_info(id, opts = {}) click to toggle source

Get access token Get a single access token by ID. @param id [String] The ID of the access token @param [Hash] opts the optional parameters @return [Array<(Token, Integer, Hash)>] Token data, response status code and response headers

# File lib/launchdarkly_api/api/access_tokens_api.rb, line 98
def get_token_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AccessTokensApi.get_token ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling AccessTokensApi.get_token"
  end
  # resource path
  local_var_path = '/api/v2/tokens/{id}'.sub('{' + 'id' + '}', CGI.escape(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] || 'Token'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"AccessTokensApi.get_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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AccessTokensApi#get_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_tokens(opts = {}) click to toggle source

List access tokens Fetch a list of all access tokens. @param [Hash] opts the optional parameters @option opts [Boolean] :show_all If set to true, and the authentication access token has the &#39;Admin&#39; role, personal access tokens for all members will be retrieved. @return [Tokens]

# File lib/launchdarkly_api/api/access_tokens_api.rb, line 151
def get_tokens(opts = {})
  data, _status_code, _headers = get_tokens_with_http_info(opts)
  data
end
get_tokens_with_http_info(opts = {}) click to toggle source

List access tokens Fetch a list of all access tokens. @param [Hash] opts the optional parameters @option opts [Boolean] :show_all If set to true, and the authentication access token has the &#39;Admin&#39; role, personal access tokens for all members will be retrieved. @return [Array<(Tokens, Integer, Hash)>] Tokens data, response status code and response headers

# File lib/launchdarkly_api/api/access_tokens_api.rb, line 161
def get_tokens_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AccessTokensApi.get_tokens ...'
  end
  # resource path
  local_var_path = '/api/v2/tokens'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'showAll'] = opts[:'show_all'] if !opts[:'show_all'].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] || 'Tokens'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"AccessTokensApi.get_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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AccessTokensApi#get_tokens\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
patch_token(id, patch_operation, opts = {}) click to toggle source

Patch access token Update an access token's settings. The request should be a valid JSON Patch document describing the changes to be made to the access token. @param id [String] The ID of the access token to update @param patch_operation [Array<PatchOperation>] @param [Hash] opts the optional parameters @return [Token]

# File lib/launchdarkly_api/api/access_tokens_api.rb, line 212
def patch_token(id, patch_operation, opts = {})
  data, _status_code, _headers = patch_token_with_http_info(id, patch_operation, opts)
  data
end
patch_token_with_http_info(id, patch_operation, opts = {}) click to toggle source

Patch access token Update an access token&#39;s settings. The request should be a valid JSON Patch document describing the changes to be made to the access token. @param id [String] The ID of the access token to update @param patch_operation [Array<PatchOperation>] @param [Hash] opts the optional parameters @return [Array<(Token, Integer, Hash)>] Token data, response status code and response headers

# File lib/launchdarkly_api/api/access_tokens_api.rb, line 223
def patch_token_with_http_info(id, patch_operation, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AccessTokensApi.patch_token ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling AccessTokensApi.patch_token"
  end
  # verify the required parameter 'patch_operation' is set
  if @api_client.config.client_side_validation && patch_operation.nil?
    fail ArgumentError, "Missing the required parameter 'patch_operation' when calling AccessTokensApi.patch_token"
  end
  # resource path
  local_var_path = '/api/v2/tokens/{id}'.sub('{' + 'id' + '}', CGI.escape(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(patch_operation)

  # return_type
  return_type = opts[:debug_return_type] || 'Token'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"AccessTokensApi.patch_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(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AccessTokensApi#patch_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
post_token(access_token_post, opts = {}) click to toggle source

Create access token Create a new access token. @param access_token_post [AccessTokenPost] @param [Hash] opts the optional parameters @return [Token]

# File lib/launchdarkly_api/api/access_tokens_api.rb, line 282
def post_token(access_token_post, opts = {})
  data, _status_code, _headers = post_token_with_http_info(access_token_post, opts)
  data
end
post_token_with_http_info(access_token_post, opts = {}) click to toggle source

Create access token Create a new access token. @param access_token_post [AccessTokenPost] @param [Hash] opts the optional parameters @return [Array<(Token, Integer, Hash)>] Token data, response status code and response headers

# File lib/launchdarkly_api/api/access_tokens_api.rb, line 292
def post_token_with_http_info(access_token_post, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AccessTokensApi.post_token ...'
  end
  # verify the required parameter 'access_token_post' is set
  if @api_client.config.client_side_validation && access_token_post.nil?
    fail ArgumentError, "Missing the required parameter 'access_token_post' when calling AccessTokensApi.post_token"
  end
  # resource path
  local_var_path = '/api/v2/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'
  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(access_token_post)

  # return_type
  return_type = opts[:debug_return_type] || 'Token'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"AccessTokensApi.post_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: AccessTokensApi#post_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
reset_token(id, opts = {}) click to toggle source

Reset access token Reset an access token's secret key with an optional expiry time for the old key. @param id [String] The ID of the access token to update @param [Hash] opts the optional parameters @option opts [Integer] :expiry An expiration time for the old token key, expressed as a Unix epoch time in milliseconds. By default, the token will expire immediately. @return [Token]

# File lib/launchdarkly_api/api/access_tokens_api.rb, line 348
def reset_token(id, opts = {})
  data, _status_code, _headers = reset_token_with_http_info(id, opts)
  data
end
reset_token_with_http_info(id, opts = {}) click to toggle source

Reset access token Reset an access token&#39;s secret key with an optional expiry time for the old key. @param id [String] The ID of the access token to update @param [Hash] opts the optional parameters @option opts [Integer] :expiry An expiration time for the old token key, expressed as a Unix epoch time in milliseconds. By default, the token will expire immediately. @return [Array<(Token, Integer, Hash)>] Token data, response status code and response headers

# File lib/launchdarkly_api/api/access_tokens_api.rb, line 359
def reset_token_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AccessTokensApi.reset_token ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling AccessTokensApi.reset_token"
  end
  # resource path
  local_var_path = '/api/v2/tokens/{id}/reset'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'expiry'] = opts[:'expiry'] if !opts[:'expiry'].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] || 'Token'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"AccessTokensApi.reset_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: AccessTokensApi#reset_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end