Documentation
¶
Index ¶
- Variables
- func Parse(ctx context.Context, v any, options ...Option) error
- type AppConfigurationAccessKey
- type Authentication
- type Entra
- type Error
- type HTTPClient
- type Option
- func WithAppConfiguration(appConfiguration string) Option
- func WithAppConfigurationAccessKey(id, secret string) Option
- func WithAppConfigurationConnectionString(connectionString string) Option
- func WithAzureCLICredential() Option
- func WithClientAssertionCredential(tenantID, clientID string, assertion func() (string, error)) Option
- func WithClientCertificateCredential(tenantID, clientID string, certificates []*x509.Certificate, ...) Option
- func WithClientID(clientID string) Option
- func WithClientSecretCredential(tenantID, clientID, clientSecret string) Option
- func WithCloud(c cloud.Cloud) Option
- func WithConcurrency(c int) Option
- func WithCredential(cred auth.Credential) Option
- func WithHTTPClient(client HTTPClient) Option
- func WithKeyVault(keyVault string) Option
- func WithManagedIdentity() Option
- func WithManagedIdentityIMDSDialTimeout(d time.Duration) Option
- func WithRetryPolicy(r RetryPolicy) Option
- func WithSecretClient(c SecretClient) Option
- func WithSecretsVersions(versions map[string]string) Option
- func WithSettingClient(c SettingClient) Option
- func WithSettingsLabel(label string) Option
- func WithSettingsLabels(labels map[string]string) Option
- func WithTimeout(d time.Duration) Option
- type Options
- type Parser
- type RequiredFieldsError
- type RetryPolicy
- type Secret
- type SecretClient
- type SecretOption
- type SecretOptions
- type Setting
- type SettingClient
- type SettingOption
- type SettingOptions
Constants ¶
This section is empty.
Variables ¶
var ( // ErrSetValue is returned when a value cannot be set. ErrSetValue = errors.New("set value") // ErrCredential is returned when a credential error occurs. ErrCredential = errors.New("credential") // ErrSecretClient is returned when a secret client error occurs. ErrSecretClient = errors.New("secret client") // ErrSecretRetrieval is returned when a secret retrieval error occurs. ErrSecretRetrieval = errors.New("secret retrieval") // ErrSettingClient is returned when a setting client error occurs. ErrSettingClient = errors.New("setting client") // ErrSettingRetrieval is returned when a setting retrieval error occurs. ErrSettingRetrieval = errors.New("setting retrieval") )
var ( identity.ErrIMDSEndpointUnavailable // ErrParseConnectionString is returned when a connection string cannot be parsed. ErrParseConnectionString = setting.ErrParseConnectionString )ErrIMDSEndpointUnavailable =
Functions ¶
Types ¶
type AppConfigurationAccessKey ¶ added in v0.17.0
AppConfigurationAccessKey contains ID and secret for an App Configuration access key.
type Authentication ¶ added in v0.17.0
type Authentication struct { AppConfigurationAccessKey AppConfigurationAccessKey AppConfigurationConnectionString string Entra Entra }
Authentication contains authentication settings for the parser.
type Entra ¶ added in v0.17.0
type Entra struct { // Assertion is an assertion function for a client assertion credential. Assertion func() (string, error) // PrivateKey to be used with the certificates for the Service Principal // with access to target Key Vault and/or App Configuration. PrivateKey *rsa.PrivateKey // TenantID of the Service Principal with access to target // Key Vault and/or App Configuration. TenantID string // ClientID of the Service Principal or user assigned managed identity // with access to target Key Vault and/or App Configuration. ClientID string // ClientSecret of the Service Principal with access to target Key Vault // and/or App Configuration. ClientSecret string // Certificates for the Service Principal with access to target Key Vault // and/or App Configuration. Certificates []*x509.Certificate // ManagedIdentity sets the use of a managed identity. To use a user assigned // managed identity, use together with ClientID. ManagedIdentity bool // AzureCLICredential sets the use of Azure CLI credentials. AzureCLICredential bool // ManagedIdentityIMDSDialTimeout sets the dial timeout for testing the // IMDS endpoint for managed identities that makes use of IMDS. // Examples are Azure Virtual Machines and Container Instances. // Defaults to 3 seconds. ManagedIdentityIMDSDialTimeout time.Duration // contains filtered or unexported fields }
Entra contains authentication settings for Microsoft Entra authentication for the parser.
type Error ¶ added in v0.18.0
type Error struct {
// contains filtered or unexported fields
}
Error represents a general error type that can contain multiple errors for azcfg.
type HTTPClient ¶ added in v0.22.0
HTTPClient is an HTTP client with a Do method.
type Option ¶ added in v0.7.0
type Option func(o *Options)
Option is a function that sets Options.
func WithAppConfiguration ¶ added in v0.10.0
WithAppConfiguration sets the App Configuration for the parser.
func WithAppConfigurationAccessKey ¶ added in v0.17.0
WithAppConfigurationAccessKey sets the parser to use an App Configuration access key for authentication to the App Configuration.
func WithAppConfigurationConnectionString ¶ added in v0.17.0
WithAppConfigurationConnectionString sets the parser to use an App Configuration connection string for authentication to the App Configuration.
func WithAzureCLICredential ¶ added in v0.13.0
func WithAzureCLICredential() Option
WithAzureCLICredential sets the parser to use Azure CLI credential.
func WithClientAssertionCredential ¶ added in v0.13.0
func WithClientAssertionCredential(tenantID, clientID string, assertion func() (string, error)) Option
WithClientAssertionCredential sets the parser to use client credential with an assertion. The assertion should be a function that returns a JWT from an identity provider.
func WithClientCertificateCredential ¶ added in v0.11.0
func WithClientCertificateCredential(tenantID, clientID string, certificates []*x509.Certificate, key *rsa.PrivateKey) Option
WithClientCertificateCredential sets the parser to use client credential with a certificate (client certificate credential).
func WithClientID ¶ added in v0.17.0
WithClientID sets the client ID for the parser. Use together with option WithManagedIdentity to use a user assigned identity with the provided client ID.
func WithClientSecretCredential ¶ added in v0.7.0
WithClientSecretCredential sets the parser to use client credential with a secret (client secret credential).
func WithCloud ¶ added in v0.14.0
WithCloud sets the Azure cloud to make requests to. AzurePublic (Azure), AzureGovernment (Azure Government) and AzureChina (Azure China) are supported. AzurePublic is used by default.
func WithConcurrency ¶ added in v0.7.0
WithConcurrency sets the concurrency of the parser. Shared between the secret and the setting client.
func WithCredential ¶ added in v0.7.0
func WithCredential(cred auth.Credential) Option
WithCredential sets the provided credential to the parser.
func WithHTTPClient ¶ added in v0.22.0
func WithHTTPClient(client HTTPClient) Option
WithHTTPClient sets the HTTP client for the parser.
func WithKeyVault ¶ added in v0.10.0
WithKeyVault sets the Key Vault for the parser.
func WithManagedIdentity ¶ added in v0.7.0
func WithManagedIdentity() Option
WithManagedIdentity sets the parser to use a managed identity.
func WithManagedIdentityIMDSDialTimeout ¶ added in v0.15.0
WithManagedIdentityIMDSDialTimeout sets the dial timeout for testing the IMDS endpoint for managed identities that makes use of IMDS (example Azure Virtual Machines and Container Instances).
func WithRetryPolicy ¶ added in v0.12.0
func WithRetryPolicy(r RetryPolicy) Option
WithRetryPolicy sets the retry policy for the parser.
func WithSecretClient ¶ added in v0.8.0
func WithSecretClient(c SecretClient) Option
WithSecretClient sets the client for secret retrieval.
func WithSecretsVersions ¶ added in v0.22.0
WithSecretsVersions sets the versions for secrets in Key Vault. They key of the map should be the secret name, and the value should be the version.
func WithSettingClient ¶ added in v0.10.0
func WithSettingClient(c SettingClient) Option
WithSettingClient sets the client for setting retrieval.
func WithSettingsLabel ¶ added in v0.22.0
WithSettingsLabel sets the label for settings in App Configuration.
func WithSettingsLabels ¶ added in v0.22.0
WithSettingsLabels sets labels for settings in an Azure App Configuration. The key of the map should be the setting name, and the value should be the label.
func WithTimeout ¶ added in v0.7.0
WithTimeout sets the timeout of the parser.
type Options ¶ added in v0.4.0
type Options struct { // Credential is the credential to be used with the Client. Credential auth.Credential // SecretClient is a client used to retrieve secrets. SecretClient SecretClient // SettingClient is a client used to retrieve settings. SettingClient SettingClient // Cloud is the Azure cloud to make requests to. Defaults to AzurePublic. Cloud cloud.Cloud // KeyVault is the name of the Key Vault containing secrets. KeyVault string // SecretsVersions is the versions for secrets in Key Vault. // They key of the map should be the secret name, and the value // should be the version. SecretsVersions map[string]string // AppConfiguration is the name of the App Configuration containing // settings. AppConfiguration string // SettingsLabel is the label for settings in App Configuration. SettingsLabel string // SettingsLabels is the labels for settings in an Azure App Configuration. // The key of the map should be the setting name, and the value // should be the label. SettingsLabels map[string]string // RetryPolicy is the retry policy for the clients of the parser. RetryPolicy RetryPolicy // Authentication contains authentication settings for the parser. Authentication Authentication // Concurrency is the amount of secrets/settings that will be retrieved // concurrently. Shared between the secret and the setting client. Defaults to 20. Concurrency int // Timeout is the total timeout for retrieval of secrets and settings. // Shared for all clients. Defaults to 10 seconds. Timeout time.Duration // contains filtered or unexported fields }
Options contains options for the Parser.
type RequiredFieldsError ¶ added in v0.10.0
type RequiredFieldsError struct {
// contains filtered or unexported fields
}
RequiredFieldsError represents an error when either secrets or settings are required but not set.
func (*RequiredFieldsError) Error ¶ added in v0.10.0
func (e *RequiredFieldsError) Error() string
Error returns the combined error messages from the errors contained in RequiredFieldsError.
func (*RequiredFieldsError) Missing ¶ added in v0.23.0
func (e *RequiredFieldsError) Missing() []string
Missing returns the fields that are missing the required values.
func (*RequiredFieldsError) Required ¶ added in v0.23.0
func (e *RequiredFieldsError) Required() []string
Required returns the fields that are required.
type RetryPolicy ¶ added in v0.12.0
type RetryPolicy = httpr.RetryPolicy
RetryPolicy contains rules for retries.
type SecretClient ¶ added in v1.1.0
type SecretClient interface {
GetSecrets(ctx context.Context, names []string, options ...SecretOption) (map[string]Secret, error)
}
SecretClient is the interface that wraps around method GetSecrets.
type SecretOption ¶ added in v1.1.0
SecretOption is a function that sets an option on a SecretClient.
type SecretOptions ¶ added in v1.1.0
SecretOptions contains options for SecretClient operations.
type Setting ¶ added in v0.19.0
Setting represents a setting as returned from the App Config REST API.
type SettingClient ¶ added in v1.1.0
type SettingClient interface {
GetSettings(ctx context.Context, keys []string, options ...SettingOption) (map[string]Setting, error)
}
SettingClient is the interface that wraps around method GetSettings.
type SettingOption ¶ added in v1.1.0
SettingOption is a function that sets an option on a SettingClient.
type SettingOptions ¶ added in v1.1.0
SettingOptions contains options for SettingClient operations.