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 ¶
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 ¶
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 ¶
SecretInfo is a flattened view of Secrets Manager ListSecrets entries.
func ListSecrets ¶
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:
- The cluster's MasterUserSecret (RDS-managed password rotation). If present this is the canonical answer.
- 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.