Documentation ¶
Index ¶
- Variables
- func NewParser(options ...Option) (*parser, error)
- func Parse(v any, options ...Option) error
- type AppConfigurationAccessKey
- type Authentication
- type Entra
- 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 WithContext(ctx context.Context) Option
- func WithCredential(cred auth.Credential) Option
- func WithKeyVault(keyVault string) Option
- func WithLabel(label string) Option
- func WithLabels(labels map[string]string) Option
- func WithManagedIdentity() Option
- func WithManagedIdentityIMDSDialTimeout(d time.Duration) Option
- func WithRetryPolicy(r RetryPolicy) Option
- func WithSecretClient(c secretClient) Option
- func WithSettingClient(c settingClient) Option
- func WithTimeout(d time.Duration) Option
- type Options
- type RequiredFieldsError
- type RetryPolicy
Constants ¶
This section is empty.
Variables ¶
var ( // ErrSetField is returned when a field cannot be set. ErrSetField = errors.New("set field error") // ErrCredential is returned when a credential error occurs. ErrCredential = errors.New("credential error") // ErrSecretClient is returned when a secret client error occurs. ErrSecretClient = errors.New("secret client error") // ErrSecretRetrieval is returned when a secret retrieval error occurs. ErrSecretRetrieval = errors.New("secret retrieval error") // ErrSettingClient is returned when a setting client error occurs. ErrSettingClient = errors.New("setting client error") // ErrSettingRetrieval is returned when a setting retrieval error occurs. ErrSettingRetrieval = errors.New("setting retrieval error") )
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 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 WithContext ¶ added in v0.13.0
WithContext sets the context for the call to Parse.
func WithCredential ¶ added in v0.7.0
func WithCredential(cred auth.Credential) Option
WithCredential sets the provided credential to the parser.
func WithKeyVault ¶ added in v0.10.0
WithKeyVault sets the Key Vault for the parser.
func WithLabels ¶ added in v0.16.0
WithLabels 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 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 WithSettingClient ¶ added in v0.10.0
func WithSettingClient(c settingClient) Option
WithSettingClient sets the client for setting retreival.
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 // Context for parsing. By default a context is created based on // the timeout set on the parser. Only applies when used together // with the Parse function or parser Parse method. Context context.Context // 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 // AppConfiguration is the name of the App Configuration containing // settings. AppConfiguration string // Label for setting in an Azure App Configuration. Label string // 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. Labels 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 }
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.
type RetryPolicy ¶ added in v0.12.0
type RetryPolicy = httpr.RetryPolicy
RetryPolicy contains rules for retries.