Class: Aws::DSQL::AuthTokenGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-dsql/customizations/auth_token_generator.rb

Overview

A utility class that generates an auth token that supports database logins for DSQL clusters. IAM credentials are used for authentication instead of the database password.

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ AuthTokenGenerator

Returns a new instance of AuthTokenGenerator.

Options Hash (options):

  • :credentials (Credentials)

    An object that responds to ‘#credentials` returning another object that responds to `#access_key_id`, `#secret_access_key`, and `#session_token`.



14
15
16
# File 'lib/aws-sdk-dsql/customizations/auth_token_generator.rb', line 14

def initialize(options = {})
  @credentials = options.fetch(:credentials)
end

Instance Method Details

#generate_db_connect_admin_auth_token(options = {}) ⇒ String

Generates an auth token for the DbConnectAdmin action.

Options Hash (options):

  • :region (String)

    The AWS region where the DSQL Cluster is hosted. Defaults to the region of the client.

  • :endpoint (String)

    The DSQL endpoint host name.

  • :expires_in (Integer) — default: 900

    The number of seconds the token is valid for.



40
41
42
# File 'lib/aws-sdk-dsql/customizations/auth_token_generator.rb', line 40

def generate_db_connect_admin_auth_token(options = {})
  presigned_token(options, 'DbConnectAdmin')
end

#generate_db_connect_auth_token(options = {}) ⇒ String

Generates an auth token for the DbConnect action.

Options Hash (options):

  • :region (String)

    The AWS region where the DSQL Cluster is hosted. Defaults to the region of the client.

  • :endpoint (String)

    The DSQL endpoint host name.

  • :expires_in (Integer) — default: 900

    The number of seconds the presigned URL is valid for.



27
28
29
# File 'lib/aws-sdk-dsql/customizations/auth_token_generator.rb', line 27

def generate_db_connect_auth_token(options = {})
  presigned_token(options, 'DbConnect')
end