Class: PG::AWS_RDS_IAM::AuthTokenGenerator
- Inherits:
-
Object
- Object
- PG::AWS_RDS_IAM::AuthTokenGenerator
- Defined in:
- lib/pg/aws_rds_iam/auth_token_generator.rb
Overview
Generates short-lived authentication tokens for connecting to Amazon RDS instances.
Instance Method Summary collapse
-
#call(host:, port:, user:) ⇒ String
Generates an authentication token for connecting to an Amazon RDS instance.
-
#initialize(credentials:, region:) ⇒ AuthTokenGenerator
constructor
Creates a new authentication token generator.
Constructor Details
#initialize(credentials:, region:) ⇒ AuthTokenGenerator
Creates a new authentication token generator.
13 14 15 16 |
# File 'lib/pg/aws_rds_iam/auth_token_generator.rb', line 13 def initialize(credentials:, region:) @generator = Aws::RDS::AuthTokenGenerator.new(credentials:) @region = region end |
Instance Method Details
#call(host:, port:, user:) ⇒ String
Generates an authentication token for connecting to an Amazon RDS instance.
24 25 26 |
# File 'lib/pg/aws_rds_iam/auth_token_generator.rb', line 24 def call(host:, port:, user:) @generator.auth_token(region: @region, endpoint: "#{host}:#{port}", user_name: user) end |