configiface

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigurationBuilder

type ConfigurationBuilder interface {
	// Unmarshal loads configuration into the provided structure from environment variables.
	// Use the "env" tag on cfgStruct fields to indicate the corresponding environment variable to load from.
	Unmarshal(cfgStruct interface{}) error
	// Dump dumps the current config into the provided structure. Config keys are matched to
	// cfgStruct fields using the "env" tag.
	Dump(cfgStruct interface{}) error
	// WithService is a Builder Pattern method that allows you to specify services
	// for the given type.
	WithService(svc interface{}) *config.ConfigurationBuilder
	// WithEnv allows you to point to an environment variable for the value and
	// also specify a default using defaultValue
	WithEnv(key string, envVar string, defaultValue interface{}) *config.ConfigurationBuilder
	// WithParameterStoreEnv sets a config value from SSM Parameter store. The Parameter name is taken
	// from the provided environment variable. If the environment variable or SSM parameter can't be retrieved,
	// then the default value is used.
	// Requires that an SSM service of type ssmiface.SSMAPI is contained within config
	WithParameterStoreEnv(key string, envVar string, defaultValue string) *config.ConfigurationBuilder
	// WithVal allows you to hardcode string values into the configuration.
	// This is good for testing, injecting known values or values derived by means
	// outside the configuration.
	WithVal(key string, val interface{}) *config.ConfigurationBuilder
	// GetService retreives the service with the given type. An error is thrown if
	// the service is not found.
	GetService(svcFor interface{}) error
	// GetStringVal returns the value of the key as a string.
	GetStringVal(key string) (string, error)
	// GetVal returns the raw value
	GetVal(key string) (interface{}, error)
	// Build builds the configuration.
	Build() error
	// RetrieveParameterStoreVals - Get the values from the AWS Parameter Store
	RetrieveParameterStoreVals() error
}

ConfigurationBuilder makes working with the ConfigurationBuild easier

type ServiceBuilder

type ServiceBuilder interface {
	// WithSTS tells the builder to add an AWS STS service to the `DefaultConfigurater`
	WithSTS() *config.ServiceBuilder
	// WithSNS tells the builder to add an AWS SNS service to the `DefaultConfigurater`
	WithSNS() *config.ServiceBuilder
	// WithSQS tells the builder to add an AWS SQS service to the `DefaultConfigurater`
	WithSQS() *config.ServiceBuilder
	// WithDynamoDB tells the builder to add an AWS DynamoDB service to the `DefaultConfigurater`
	WithDynamoDB() *config.ServiceBuilder
	// WithS3 tells the builder to add an AWS S3 service to the `DefaultConfigurater`
	WithS3() *config.ServiceBuilder
	// WithCognito tells the builder to add an AWS Cognito service to the `DefaultConfigurater`
	WithCognito() *config.ServiceBuilder
	// WithCodeBuild tells the builder to add an AWS CodeBuild service to the `DefaultConfigurater`
	WithCodeBuild() *config.ServiceBuilder
	// WithSSM tells the builder to add an AWS SSM service to the `DefaultConfigurater`
	WithSSM() *config.ServiceBuilder
	// Build creates and returns a structue with AWS services
	Build() (*config.ConfigurationBuilder, error)
}

ServiceBuilder makes working with the ServiceBuild easier

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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