Open
Description
Package: github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos
Version: v1.0.0
In the armcosmos package, the DatabaseAccountsClient.ListConnectionStrings() returns a model that looks like this:
type DatabaseAccountListConnectionStringsResult struct {
ConnectionStrings []*DatabaseAccountConnectionString `json:"connectionStrings,omitempty"`
}
type DatabaseAccountConnectionString struct {
// READ-ONLY; Value of the connection string
ConnectionString *string `json:"connectionString,omitempty" azure:"ro"`
// READ-ONLY; Description of the connection string
Description *string `json:"description,omitempty" azure:"ro"`
}
The 'Description' field appears to be a human readable string (ex: Primary SQL Connection String
), which makes it difficult to programmatically pick the right one, or at least potentially fragile if the description were to change.
There's a similar API to that retrieves keys, instead of connection strings. That API has fields for each type of key, making it much easier:
type DatabaseAccountListKeysResult struct {
PrimaryMasterKey *string `json:"primaryMasterKey,omitempty" azure:"ro"`
PrimaryReadonlyMasterKey *string `json:"primaryReadonlyMasterKey,omitempty" azure:"ro"`
SecondaryMasterKey *string `json:"secondaryMasterKey,omitempty" azure:"ro"`
SecondaryReadonlyMasterKey *string `json:"secondaryReadonlyMasterKey,omitempty" azure:"ro"`
}
Is there a reason the connection string API is not built like this?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment