gems/aws-sdk-rds/lib/aws-sdk-rds/customizations/auth_token_generator.rb
# To create a auth login token, following parameters are required:
#
# @params [required, String] :region Region the databaseis located in
# @params [required, String] :endpoint Hostname of the database with port number
#   For example: my-instance.us-west-2.rds.amazonaws.com:3306
# @params [required, String] :user_name Username to login as
#
# @return [String]
To create a auth login token, following parameters are required.
To create a auth login token following parameters are required .
def auth_token(params)
        region = params.fetch(:region)
        endpoint = params.fetch(:endpoint)
        user_name = params.fetch(:user_name)
        param_list = Aws::Query::ParamList.new
        param_list.set('Action', 'connect')
        param_list.set('DBUser', user_name)
        signer = Aws::Sigv4::Signer.new(
          service: 'rds-db',
          region: region,
          credentials_provider: @credentials
        )
        url = "https://" + endpoint + "/?#{param_list.to_s}"
        presigned_url = signer.presign_url(
          http_method: 'GET',
          url: url,
          body: '',
          expires_in: 900
        ).to_s
        presigned_url[8..-1]
      end
def auth_token ( params ) region = params . fetch ( :region ) endpoint = params . fetch ( :endpoint ) user_name = params . fetch ( :user_name ) param_list = Aws :: Query :: ParamList . new param_list . set ( 'Action' , 'connect' ) param_list . set ( 'DBUser' , user_name ) signer = Aws :: Sigv4 :: Signer . new ( service : 'rds-db' , region : region , credentials_provider : @credentials ) url = "https://" + endpoint + "/?#{param_list.to_s}" presigned_url = signer . presign_url ( http_method : 'GET' , url : url , body : '' , expires_in : 900 ) . to_s presigned_url [ 8 .. - 1 ] end
To create a auth login token, following parameters are required:
To create a auth login token following parameters are required :
# Remove extra scheme for token
None
String
params
params
[required, String] :region Region the databaseis located in
[ required String ] : region Region the databaseis located in
params
[required, String] :endpoint Hostname of the database with port number For example: my-instance.us-west-2.rds.amazonaws.com:3306
[ required String ] : endpoint Hostname of the database with port number For example : my - instance . us - west - 2 . rds . amazonaws . com : 3306
params
[required, String] :user_name Username to login as
[ required String ] : user_name Username to login as