Documentation
¶
Index ¶
- Constants
- Variables
- func LoadConfigFromURL(configURL string, configStruct interface{}) error
- func ReadJSONValidate(cfgReader io.Reader, configStruct interface{}) error
- type APIEndpointConfig
- type AWSRegion
- type DynamoDBClientConfig
- type DynamoDBTableConfig
- type S3Config
- type S3EndpointExpiryConfig
- type SQSClientConfig
- type SQSQueueConfig
- type StorageConfig
- type StorageLocation
- type StorageProvider
- type Validater
Constants ¶
View Source
const ( DEFAULT_S3_EXPIRY uint = 60 DEFAULT_S3_ENDPOINT string = "" )
View Source
const (
S3_CONFIG_DEFAULT_EXPIRY uint = 60
)
View Source
const (
S3_ENDPOINT_EXPIRY_CONFIG_DEFAULT_EXPIRY uint = 60
)
Variables ¶
View Source
var AWSRegions = []AWSRegion{ AWS_REGION_US_EAST_1, AWS_REGION_US_WEST_1, AWS_REGION_US_WEST_2, AWS_REGION_US_GOV_WEST_1, AWS_REGION_EU_WEST_1, AWS_REGION_EU_CENTRAL_1, AWS_REGION_AP_SOUTHEAST_1, AWS_REGION_AP_SOUTHEAST_2, AWS_REGION_AP_NORTHEAST_1, AWS_REGION_SA_EAST_1, }
View Source
var (
ErrAWSRegionEmptyString = errors.New("Region cannot be empty")
)
Functions ¶
func LoadConfigFromURL ¶
Downloads a configuration JSON file from S3. Parses it to a particular struct type and runs a validation. URL should be of the format s3://bucket/path/file.json
func ReadJSONValidate ¶
Downloads JSON from a URL, decodes it and then validates.
Types ¶
type APIEndpointConfig ¶
type APIEndpointConfig struct {
BasePath *string `json:"base_path,omitempty"`
SubPath *string `json:"sub_path,omitempty"`
}
func (APIEndpointConfig) GetFullPath ¶
func (c APIEndpointConfig) GetFullPath() string
func (APIEndpointConfig) GetFullPathWithID ¶
func (c APIEndpointConfig) GetFullPathWithID(id string) string
type AWSRegion ¶
type AWSRegion string
const ( AWS_REGION_US_EAST_1 AWSRegion = "us-east-1" AWS_REGION_US_WEST_1 AWSRegion = "us-west-1" AWS_REGION_US_WEST_2 AWSRegion = "us-west-2" AWS_REGION_US_GOV_WEST_1 AWSRegion = "us-gov-west-1" AWS_REGION_EU_WEST_1 AWSRegion = "eu-west-1" AWS_REGION_EU_CENTRAL_1 AWSRegion = "eu-central-1" AWS_REGION_AP_SOUTHEAST_1 AWSRegion = "ap-southeast-1" AWS_REGION_AP_SOUTHEAST_2 AWSRegion = "ap-southeast-2" AWS_REGION_AP_NORTHEAST_1 AWSRegion = "ap-northeast-1" AWS_REGION_SA_EAST_1 AWSRegion = "sa-east-1" )
func (*AWSRegion) UnmarshalText ¶
type DynamoDBClientConfig ¶
type DynamoDBClientConfig struct {
Region *AWSRegion `json:"region,omitempty"`
Endpoint *string `json:"endpoint,omitempty" remoteconfig:"optional"`
DisableSSL *bool `json:"disable_ssl,omit" remoteconfig:"optional"`
}
func (DynamoDBClientConfig) GetDisableSSL ¶
func (d DynamoDBClientConfig) GetDisableSSL() bool
func (DynamoDBClientConfig) GetEndpoint ¶
func (d DynamoDBClientConfig) GetEndpoint() string
func (DynamoDBClientConfig) GetRegion ¶
func (d DynamoDBClientConfig) GetRegion() AWSRegion
type DynamoDBTableConfig ¶
type DynamoDBTableConfig struct {
TableName *string `mapstructure:"table_name" json:"table_name,omitempty"`
}
func (DynamoDBTableConfig) GetTableName ¶
func (d DynamoDBTableConfig) GetTableName() string
type S3Config ¶
type S3Config struct {
Endpoint *string `json:"endpoint,omitempty" yaml:"endpoint,omitempty" remoteconfig:"optional"`
Bucket *string `json:"bucket,omitempty" yaml:"bucket,omitempty"` // i.e. bucket
Region *AWSRegion `json:"region,omitempty" yaml:"region,omitempty"` // i.e. us-west-2
Expiry *uint `json:"expiry,omitempty" yaml:"expiry,omitempty" remoteconfig:"optional"` // i.e. 60
}
func (S3Config) GetEndpoint ¶
type S3EndpointExpiryConfig ¶
type S3EndpointExpiryConfig struct {
Endpoint *string `json:"endpoint,omitempty" yaml:"endpoint,omitempty" remoteconfig:"optional"`
Expiry *uint `json:"expiry,omitempty" yaml:"expiry,omitempty" remoteconfig:"optional"`
}
func (S3EndpointExpiryConfig) GetEndpoint ¶
func (c S3EndpointExpiryConfig) GetEndpoint() string
func (S3EndpointExpiryConfig) GetExpiry ¶
func (c S3EndpointExpiryConfig) GetExpiry() uint
type SQSClientConfig ¶
type SQSClientConfig struct {
Region *AWSRegion `json:"region,omitempty"`
Endpoint *string `json:"endpoint,omitempty" remoteconfig:"optional"`
}
func (SQSClientConfig) GetEndpoint ¶
func (s SQSClientConfig) GetEndpoint() string
func (SQSClientConfig) GetRegion ¶
func (s SQSClientConfig) GetRegion() AWSRegion
type SQSQueueConfig ¶
type SQSQueueConfig struct {
Region *AWSRegion `json:"region,omitempty"`
AWSAccountID *string `json:"aws_account_id,omitempty"`
QueueName *string `json:"queue_name,omitempty"`
}
func (SQSQueueConfig) GetURL ¶
func (s SQSQueueConfig) GetURL(endpoint string) string
Returns a full SQS queue URL.
type StorageConfig ¶
type StorageConfig struct {
Provider *StorageProvider `json:"provider,omitempty"`
Location *StorageLocation `json:"location,omitempty"`
}
func (*StorageConfig) GetLocation ¶
func (s *StorageConfig) GetLocation() StorageLocation
func (*StorageConfig) GetProvider ¶
func (s *StorageConfig) GetProvider() StorageProvider
func (StorageConfig) Validate ¶
func (s StorageConfig) Validate() error
type StorageLocation ¶
type StorageLocation string
func (*StorageLocation) UnmarshalText ¶
func (s *StorageLocation) UnmarshalText(data []byte) error
type StorageProvider ¶
type StorageProvider string
const (
STORAGE_PROVIDER_AWS StorageProvider = "aws"
)
func (*StorageProvider) UnmarshalText ¶
func (s *StorageProvider) UnmarshalText(data []byte) error
func (StorageProvider) Validate ¶
func (s StorageProvider) Validate() error
Click to show internal directories.
Click to hide internal directories.