connection

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package connection provides interactive selectors for the RDS cluster, Secrets Manager secret, and database name that the rdq CLI feeds to the AWS RDS Data API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PromptDatabase

func PromptDatabase(history []string) (string, error)

PromptDatabase asks the user for a database name. With no history it falls back to a plain readline prompt; with history it shows a fuzzy picker over previous entries plus a manual-entry escape hatch.

Types

type ClusterInfo

type ClusterInfo struct {
	Identifier          string
	ARN                 string
	Engine              string
	Endpoint            string
	MasterUserSecretArn string
}

ClusterInfo is a flattened view of the RDS DescribeDBClusters output that is useful for the picker UI and downstream Data API calls.

MasterUserSecretArn captures the secret RDS auto-manages when the cluster has "Manage master user password in AWS Secrets Manager" turned on. When present it is the canonical secret to feed into the Data API, so we expose it here for the secret resolver to pre-select.

func ListClusters

func ListClusters(ctx context.Context, cfg aws.Config) ([]ClusterInfo, error)

ListClusters returns Aurora clusters in the configured region that have the RDS Data API enabled (EnableHttpEndpoint == true). Clusters without the Data API are filtered out because rdq cannot use them.

func SelectCluster

func SelectCluster(clusters []ClusterInfo) (ClusterInfo, error)

SelectCluster launches a fuzzy finder over the given clusters. Fails early if there are no clusters, or if stdin is not a TTY.

type SecretInfo

type SecretInfo struct {
	Name        string
	ARN         string
	Description string
}

SecretInfo is a flattened view of Secrets Manager ListSecrets entries.

func ListSecrets

func ListSecrets(ctx context.Context, cfg aws.Config) ([]SecretInfo, error)

ListSecrets returns all Secrets Manager secrets visible in the configured region. No filtering is applied because secret-to-cluster mapping is not expressed uniformly enough to filter safely.

func SelectSecret

func SelectSecret(secrets []SecretInfo) (SecretInfo, error)

SelectSecret launches a fuzzy finder over the given secrets. The display string includes the description when present so that users can recognize the right secret even when names are cryptic.

func SuggestSecretsForCluster

func SuggestSecretsForCluster(ctx context.Context, cfg aws.Config, cluster ClusterInfo) ([]SecretInfo, error)

SuggestSecretsForCluster returns the Secrets Manager secrets that are most likely the right credentials for the given Aurora cluster. It looks in two places, in order:

  1. The cluster's MasterUserSecret (RDS-managed password rotation). If present this is the canonical answer.
  2. Secrets tagged aws:rds:primaryDBClusterArn = <cluster ARN>, which is how RDS marks the secret it created when "Manage master user password in AWS Secrets Manager" was turned on.

Errors from one path do not abort the other so the caller still gets whatever could be found. The result is deduped by ARN.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL