cloudz

package
v0.0.0-...-66d1a48 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: MIT Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIPluginDisplayName       = "API"
	APIPluginName              = "api"
	APIRefAPI                  = CloudRef("api")
	APIRefPermission           = CloudRef("perm")
	APIRefDomainName           = CloudRef("dn")
	APIRefRecordSet            = CloudRef("rs")
	APIRefStage                = CloudRef("stg")
	APIRefAPIMapping           = CloudRef("dnmap")
	APIRefIntegration          = CloudRef("intg")
	APIAttAPIEndpoint          = CloudAtt("ApiEndpoint")
	APIAttRegionalDomainName   = CloudAtt("RegionalDomainName")
	APIAttRegionalHostedZoneID = CloudAtt("RegionalHostedZoneId")
)

API constants.

View Source
const (
	BucketPluginDisplayName      = "Bucket"
	BucketPluginName             = "bucket"
	BucketRefBucket              = CloudRef("b")
	BucketRefBucketPolicyPublic  = CloudRef("bp-pub")
	BucketAttARN                 = CloudAtt("Arn")
	BucketAttDomainName          = CloudAtt("DomainName")
	BucketAttDualStackDomainName = CloudAtt("DualStackDomainName")
	BucketAttRegionalDomainName  = CloudAtt("RegionalDomainName")
)

Bucket constants.

View Source
const (
	CertificatePluginDisplayName = "Certificate"
	CertificatePluginName        = "certificate"
	CertificateRefCertificate    = CloudRef("c")
)

Certificate constants.

View Source
const (
	FunctionPluginDisplayName = "Function"
	FunctionPluginName        = "function"
	FunctionRefRole           = CloudRef("r")
	FunctionRefLogGroup       = CloudRef("lg")
	FunctionRefFunction       = CloudRef("f")
	FunctionAttARN            = CloudAtt("Arn")
	FunctionAttRoleID         = CloudAtt("RoleId")

	FunctionHandlerFileName = "handler"
	FunctionPackageFileName = "function.zip"
)

Function constants.

View Source
const (
	HasuraPluginDisplayName      = "Hasura"
	HasuraPluginName             = "hasura"
	HasuraRefLogGroup            = CloudRef("lg")
	HasuraRefRoleExecution       = CloudRef("r-ex")
	HasuraRefRoleTask            = CloudRef("r-tk")
	HasuraRefTaskDefinition      = CloudRef("td")
	HasuraRefTargetGroup         = CloudRef("tg")
	HasuraRefListenerRule        = CloudRef("lr")
	HasuraRefCluster             = CloudRef("cl")
	HasuraRefService             = CloudRef("svc")
	HasuraRefRecordSet           = CloudRef("rs")
	HasuraAttARN                 = CloudAtt("Arn")
	HasuraAttName                = CloudAtt("Name")
	HasuraAttRoleID              = CloudAtt("RoleId")
	HasuraAttRuleARN             = CloudAtt("RuleArn")
	HasuraAttTargetGroupFullName = CloudAtt("TargetGroupFullName")
	HasuraAttTargetGroupName     = CloudAtt("TargetGroupName")
)

Hasura constants.

View Source
const (
	ImageRepositoryPluginDisplayName = "ImageRepository"
	ImageRepositoryPluginName        = "image-repository"
	ImageRepositoryRefRepository     = CloudRef("r")
	ImageRepositoryAttARN            = CloudAtt("Arn")
	ImageRepositoryAttRepositoryURI  = CloudAtt("RepositoryUri")
)

Image repository constants.

View Source
const (
	LoadBalancerPluginDisplayName            = "Load Balancer"
	LoadBalancerPluginName                   = "load-balancer"
	LoadBalancerRefLoadBalancer              = CloudRef("lb")
	LoadBalancerRefListenerHTTP              = CloudRef("l")
	LoadBalancerRefListenerHTTPS             = CloudRef("l-s")
	LoadBalancerRefSecurityGroupIngressHTTP  = CloudRef("sgi")
	LoadBalancerRefSecurityGroupIngressHTTPS = CloudRef("sgi-s")
	LoadBalancerAttCanonicalHostedZoneID     = CloudAtt("CanonicalHostedZoneID")
	LoadBalancerAttDNSName                   = CloudAtt("DNSName")
	LoadBalancerAttLoadBalancerFullName      = CloudAtt("LoadBalancerFullName")
	LoadBalancerAttLoadBalancerName          = CloudAtt("LoadBalancerName")
	LoadBalancerAttListenerArn               = CloudAtt("ListenerArn")
)

Load balancer constants.

View Source
const (
	MailPluginDisplayName = "Mail"
	MailPluginName        = "mail"
)

Mail constants.

View Source
const (
	NetworkPluginDisplayName                      = "Network"
	NetworkPluginName                             = "network"
	NetworkRefVPC                                 = CloudRef("v")
	NetworkRefInternetGateway                     = CloudRef("ig")
	NetworkRefVPCGatewayAttachment                = CloudRef("vig")
	NetworkRefRouteTablePublic                    = CloudRef("rt-pub")
	NetworkRefRoutePublic                         = CloudRef("r-pub")
	NetworkRefSubnetPublicA                       = CloudRef("s-pub-a")
	NetworkRefSubnetRouteTableAssociationPublicA  = CloudRef("srt-pub-a")
	NetworkRefSubnetPublicB                       = CloudRef("s-pub-b")
	NetworkRefSubnetRouteTableAssociationPublicB  = CloudRef("srt-pub-b")
	NetworkRefEIPA                                = CloudRef("eip-a")
	NetworkRefNATGatewayA                         = CloudRef("ng-a")
	NetworkRefRouteTablePrivateA                  = CloudRef("rt-pri-a")
	NetworkRefRoutePrivateA                       = CloudRef("r-pri-a")
	NetworkRefSubnetPrivateA                      = CloudRef("s-pri-a")
	NetworkRefSubnetRouteTableAssociationPrivateA = CloudRef("s-rt-pri-a")
	NetworkRefEIPB                                = CloudRef("eip-b")
	NetworkRefNATGatewayB                         = CloudRef("ng-b")
	NetworkRefRouteTablePrivateB                  = CloudRef("rt-pri-b")
	NetworkRefRoutePrivateB                       = CloudRef("r-pri-b")
	NetworkRefSubnetPrivateB                      = CloudRef("s-pri-b")
	NetworkRefSubnetRouteTableAssociationPrivateB = CloudRef("srt-pri-b")
	NetworkRefSecurityGroup                       = CloudRef("sg")
	NetworkRefSecurityGroupIngress                = CloudRef("sgi")
	NetworkAttAllocationID                        = CloudAtt("AllocationId")
	NetworkAttCIDRBlock                           = CloudAtt("CidrBlock")
	NetworkAttDefaultNetworkACL                   = CloudAtt("DefaultNetworkAcl")
	NetworkAttDefaultSecurityGroup                = CloudAtt("DefaultSecurityGroup")
	NetworkAttGroupID                             = CloudAtt("GroupId")
	NetworkAttID                                  = CloudAtt("Id")
	NetworkAttInternetGatewayID                   = CloudAtt("InternetGatewayId")
	NetworkAttNetworkACLAssociationID             = CloudAtt("NetworkAclAssociationId")
	NetworkAttRouteTableID                        = CloudAtt("RouteTableId")
	NetworkAttSubnetID                            = CloudAtt("SubnetId")
	NetworkAttVPCID                               = CloudAtt("VpcId")

	CIDRAllDestinations = "0.0.0.0/0"
	CIDRVPC             = "10.0.0.0/16"
	CIDRSubnetPublicA   = "10.0.0.0/19"
	CIDRSubnetPublicB   = "10.0.32.0/19"
	CIDRSubnetPrivateA  = "10.0.64.0/19"
	CIDRSubnetPrivateB  = "10.0.96.0/19"
)

Network constants.

View Source
const (
	PostgresPluginDisplayName   = "Postgres"
	PostgresPluginName          = "postgres"
	PostgresRefDBParameterGroup = CloudRef("pg")
	PostgresRefDBSubnetGroup    = CloudRef("sg")
	PostgresRefLogGroup         = CloudRef("lg")
	PostgresRefRoleMonitoring   = CloudRef("r-mon")
	PostgresRefDBInstance       = CloudRef("i")
	PostgresAttARN              = CloudAtt("Arn")
	PostgresAttRoleID           = CloudAtt("RoleId")
	PostgresAttEndpointAddress  = CloudAtt("Endpoint.Address")
	PostgresAttEndpointPort     = CloudAtt("Endpoint.Port")
)

Postgres constants.

View Source
const (
	PostgresProxyPluginDisplayName     = "PostgresProxy"
	PostgresProxyPluginName            = "postgres-proxy"
	PostgresProxyRefSecret             = CloudRef("s")
	PostgresProxyRefRole               = CloudRef("r")
	PostgresProxyRefLogGroup           = CloudRef("lg")
	PostgresProxyRefDBProxy            = CloudRef("p")
	PostgresProxyRefDBProxyTargetGroup = CloudRef("tg")
	PostgresProxyAttARN                = CloudAtt("Arn")
	PostgresProxyAttRoleID             = CloudAtt("RoleId")
	PostgresProxyAttDBProxyARN         = CloudAtt("DBProxyArn")
	PostgresProxyAttEndpoint           = CloudAtt("Endpoint")
)

Postgres proxy constants.

View Source
const (
	LocalAWSAccessKeyID     = "aws-access-key-id"
	LocalAWSSecretAccessKey = "aws-secret-access-key"
	LocalPassword           = "password"
	LocalSecret             = "secret"
)

Pseudo-secret values used for local services.

Variables

This section is empty.

Functions

func CloudAddExpGetAtt

func CloudAddExpGetAtt(tpl *gocf.Template, p Plugin, ref CloudRef, att CloudAtt)

CloudAddExpGetAtt adds a get attribute export to the given template.

func CloudAddExpRef

func CloudAddExpRef(tpl *gocf.Template, p Plugin, ref CloudRef)

CloudAddExpRef adds a reference export to the given template.

func CloudGetDefaultTags

func CloudGetDefaultTags(name string) *[]gotags.Tag

CloudGetDefaultTags returns a set of default tags.

func CloudGetStackName

func CloudGetStackName(p Plugin) string

CloudGetStackName generates a stack name for the given plugin.

func CloudGetTaskDefinitionKeyValuePairs

func CloudGetTaskDefinitionKeyValuePairs(m map[string]string) *[]goecs.TaskDefinition_KeyValuePair

CloudGetTaskDefinitionKeyValuePairs converts a map of strings to a slice of TaskDefinition_KeyValuePair.

func LocalGetContainerName

func LocalGetContainerName(p Plugin, additionalParts ...string) string

LocalGetContainerName generates a container name for the given plugin.

func NewAssumeRolePolicyDocument

func NewAssumeRolePolicyDocument(service string) interface{}

NewAssumeRolePolicyDocument generates a new assume role policy document.

func NewPolicyDocument

func NewPolicyDocument(statements ...*PolicyStatement) interface{}

NewPolicyDocument generates a new policy document.

Types

type API

type API interface {
	Plugin
	GetConfig() *APIConfig
	GetLocalMetadata() *APILocalMetadata
	GetCloudMetadata(require bool) *APICloudMetadata
}

API describes an api.

func NewAPI

func NewAPI(cfgFunc APIConfigFunc, deps *APIDependencies) API

NewAPI initializes a new API.

type APICloudMetadata

type APICloudMetadata struct {
	Exports CloudExports
	URL     *url.URL
}

APICloudMetadata describes the api cloud metadata.

type APIConfig

type APIConfig struct {
	Stage     Stage    `validate:"required"`
	Name      string   `validate:"required,resource-name"`
	RouteKeys []string `validate:"required"`
	Local     *APIConfigLocal
	Cloud     *APIConfigCloud
	EventHook APIEventHookFunc
}

APIConfig describes the api config.

func (*APIConfig) MustValidate

func (c *APIConfig) MustValidate(stageTarget StageTarget)

MustValidate validates the api config.

type APIConfigCloud

type APIConfigCloud struct {
	DomainName string `validate:"required,fqdn"`
	CORSDomain string `validate:"required,fqdn"`
}

APIConfigCloud describes part of the api config.

type APIConfigFunc

type APIConfigFunc func(Stage, *APIDependencies) *APIConfig

APIConfigFunc returns the api config for a given Stage.

type APIConfigLocal

type APIConfigLocal struct {
	ExternalPort uint16 `validate:"required"`
}

APIConfigLocal describes part of the api config.

type APIDependencies

type APIDependencies struct {
	Certificate       Certificate `validate:"required"`
	Function          Function    `validate:"required"`
	OtherDependencies OtherDependencies
}

APIDependencies describes the api dependencies.

func (*APIDependencies) MustValidate

func (d *APIDependencies) MustValidate()

MustValidate validates the function dependencies.

type APIEventHookFunc

type APIEventHookFunc func(API, Event, string)

APIEventHookFunc describes an api event hook.

type APILocalMetadata

type APILocalMetadata struct {
	ExternalURL *url.URL
	InternalURL *url.URL
}

APILocalMetadata describes the api local metadata.

type App

type App interface {
	GetConfig() *AppConfig
	GetOperations() opz.Operations
	GetSortedPlugins() [][]Plugin
}

App describes an App.

func NewApp

func NewApp(cfg *AppConfig) App

NewApp initializes a new App.

type AppConfig

type AppConfig struct {
	DisplayName   string      `validate:"required"`
	Name          string      `validate:"required,resource-name"`
	ConfigDirPath string      `validate:"required,dir"`
	BuildDirPath  string      `validate:"required,parent-dir"`
	AWSConfig     *aws.Config `validate:"required"`
	Plugins       []Plugin    `validate:"required"`
}

AppConfig describes the app config.

func (*AppConfig) GetBuildDirPath

func (c *AppConfig) GetBuildDirPath(additionalParts ...string) string

GetBuildDirPath returns the build dir path.

func (*AppConfig) GetBuildDirPathForPlugin

func (c *AppConfig) GetBuildDirPathForPlugin(p Plugin, additionalParts ...string) string

GetBuildDirPathForPlugin returns a build dir path for the given plugin.

func (*AppConfig) GetConfigDirPath

func (c *AppConfig) GetConfigDirPath(additionalParts ...string) string

GetConfigDirPath returns the config dir path.

func (*AppConfig) GetConfigDirPathForPlugin

func (c *AppConfig) GetConfigDirPathForPlugin(p Plugin, additionalParts ...string) string

GetConfigDirPathForPlugin returns a config dir path for the given plugin.

func (*AppConfig) MustValidate

func (c *AppConfig) MustValidate()

MustValidate validates the app config.

type Bucket

type Bucket interface {
	Plugin
	GetConfig() *BucketConfig
	GetLocalMetadata() *BucketLocalMetadata
	GetCloudMetadata(require bool) *BucketCloudMetadata
}

Bucket describes a bucket.

func NewBucket

func NewBucket(cfgFunc BucketConfigFunc, deps *BucketDependencies) Bucket

NewBucket initializes a new Bucket.

type BucketCloudMetadata

type BucketCloudMetadata struct {
	Exports    CloudExports
	BucketName string
	BucketURL  *url.URL
}

BucketCloudMetadata describes the bucket cloud metadata.

func (*BucketCloudMetadata) GetName

func (m *BucketCloudMetadata) GetName() string

GetName returns the bucket name.

type BucketConfig

type BucketConfig struct {
	Stage                 Stage  `validate:"required"`
	Name                  string `validate:"required,resource-name"`
	IsPublicAccessEnabled bool
	Local                 *BucketConfigLocal
	Cloud                 *BucketConfigCloud
	EventHook             BucketEventHookFunc
}

BucketConfig describes the bucket config.

func (*BucketConfig) MustValidate

func (c *BucketConfig) MustValidate(stageTarget StageTarget)

MustValidate validates the bucket config.

type BucketConfigCloud

type BucketConfigCloud struct {
	IsVersioningEnabled                   bool
	DeleteObjectsAfterDays                *uint16
	DeletePreviousObjectVersionsAfterDays *uint16
}

BucketConfigCloud describes part of the bucket config.

type BucketConfigFunc

type BucketConfigFunc func(Stage, *BucketDependencies) *BucketConfig

BucketConfigFunc returns the bucket config for a given Stage.

type BucketConfigLocal

type BucketConfigLocal struct {
	ExternalPort        uint16 `validate:"required"`
	ConsoleExternalPort uint16 `validate:"required"`
}

BucketConfigLocal describes part of the bucket config.

type BucketDependencies

type BucketDependencies struct {
	OtherDependencies OtherDependencies
}

BucketDependencies describes the bucket dependencies.

func (*BucketDependencies) MustValidate

func (d *BucketDependencies) MustValidate()

MustValidate validates the bucket dependencies.

type BucketEventHookFunc

type BucketEventHookFunc func(Bucket, Event, string)

BucketEventHookFunc describes a bucket event hook.

type BucketLocalMetadata

type BucketLocalMetadata struct {
	ContainerName      string
	AccessKey          string
	SecretKey          string
	BucketName         string
	ExternalURL        *url.URL
	InternalURL        *url.URL
	ConsoleExternalURL *url.URL
}

BucketLocalMetadata describes the bucket local metadata.

type Certificate

type Certificate interface {
	Plugin
	GetConfig() *CertificateConfig
	GetCloudMetadata(require bool) *CertificateCloudMetadata
}

Certificate describes a certificate.

func NewCertificate

func NewCertificate(cfgFunc CertificateConfigFunc, deps *CertificateDependencies) Certificate

NewCertificate initializes a new Certificate.

type CertificateCloudMetadata

type CertificateCloudMetadata struct {
	Exports CloudExports
	ARN     string
}

CertificateCloudMetadata describes the certificate cloud metadata.

type CertificateConfig

type CertificateConfig struct {
	Stage     Stage  `validate:"required"`
	Name      string `validate:"required,resource-name"`
	Cloud     *CertificateConfigCloud
	EventHook CertificateEventHookFunc
}

CertificateConfig describes the certificate config.

func (*CertificateConfig) MustValidate

func (c *CertificateConfig) MustValidate(stageTarget StageTarget)

MustValidate validates the certificate config.

type CertificateConfigCloud

type CertificateConfigCloud struct {
	DomainName   string `validate:"required"`
	HostedZoneID string `validate:"required"`
}

CertificateConfigCloud describes part of the certificate config.

type CertificateConfigFunc

type CertificateConfigFunc func(Stage, *CertificateDependencies) *CertificateConfig

CertificateConfigFunc returns the certificate for a given Stage.

type CertificateDependencies

type CertificateDependencies struct {
	OtherDependencies OtherDependencies
}

CertificateDependencies describes the certificate dependencies.

func (*CertificateDependencies) MustValidate

func (d *CertificateDependencies) MustValidate()

MustValidate validates the certificate dependencies.

type CertificateEventHookFunc

type CertificateEventHookFunc func(Certificate, Event, string)

CertificateEventHookFunc describes a certificate event hook.

type CloudAtt

type CloudAtt string

CloudAtt describes a cloud attribute.

func (CloudAtt) Name

func (a CloudAtt) Name() string

Name returns a name.

func (CloudAtt) Ref

func (a CloudAtt) Ref() string

Ref returns a reference.

type CloudExports

type CloudExports interface {
	GetRef(ref CloudRef) string
	GetAtt(ref CloudRef, att CloudAtt) string
}

CloudExports describes a set of cloud exports.

func NewCloudExports

func NewCloudExports(stack *awscft.Stack) CloudExports

NewCloudExports initializes a new set of cloud exports.

type CloudRef

type CloudRef string

CloudRef describes a cloud reference.

func (CloudRef) ExpAttName

func (r CloudRef) ExpAttName(p Plugin, att CloudAtt) string

ExpAttName returns a name for an attribute export.

func (CloudRef) ExpAttRef

func (r CloudRef) ExpAttRef(att CloudAtt) string

ExpAttRef returns a reference to an attribute export.

func (CloudRef) ExpRefName

func (r CloudRef) ExpRefName(p Plugin) string

ExpRefName returns a name for a reference export.

func (CloudRef) ExpRefRef

func (r CloudRef) ExpRefRef() string

ExpRefRef returns a reference to a reference export.

func (CloudRef) Name

func (r CloudRef) Name(p Plugin) string

Name returns a name.

func (CloudRef) Ref

func (r CloudRef) Ref() string

Ref returns a reference.

type CloudStage

type CloudStage interface {
	Stage
	GetCloudConfig() *CloudStageConfig
	GetArtifactsKeyPrefix(p Plugin, additionalParts ...string) string
	IsDeployed() bool
	Deploy()
}

CloudStage describes a cloud Stage.

func NewCloudStage

func NewCloudStage(cfg *CloudStageConfig) CloudStage

NewCloudStage initializes a new CloudStage.

type CloudStageConfig

type CloudStageConfig struct {
	*StageConfig `validate:"required"`
	Name         string    `validate:"required,resource-name"`
	Version      string    `validate:"required"`
	Mode         StageMode `validate:"required,oneof=prod staging"`
}

CloudStageConfig describes the Stage cloud config.

func (*CloudStageConfig) MustValidate

func (c *CloudStageConfig) MustValidate()

MustValidate validates the cloud stage config.

type Event

type Event string

Event describes an event.

const (
	LocalBeforeCreateEvent Event = "localBeforeCreate"
	LocalAfterCreateEvent  Event = "localAfterCreate"
	CloudBeforeDeployEvent Event = "cloudBeforeDeploy"
	CloudAfterDeployEvent  Event = "cloudAfterDeploy"
)

Known events.

type Function

type Function interface {
	Plugin
	GetConfig() *FunctionConfig
	GetDependencies() *FunctionDependencies
	GetLocalMetadata() *FunctionLocalMetadata
	GetCloudMetadata(require bool) *FunctionCloudMetadata
}

Function describes a function.

func NewFunction

func NewFunction(cfgFunc FunctionConfigFunc, deps *FunctionDependencies) Function

NewFunction initializes a new Function.

type FunctionBuilder

type FunctionBuilder interface {
	GetLocalServiceConfigVolumes(p Function, buildDirPath string) []dctypes.ServiceVolumeConfig
	LocalBeforeCreateEventHook(p Function, buildDirPath string)
	GetCloudRuntime(p Function) string
	BuildCloudPackage(p Function, buildDirPath string)
}

FunctionBuilder describes a function builder.

func NewGoFunctionBuilder

func NewGoFunctionBuilder(workDirPath, packageName string, injectValues map[string]string) FunctionBuilder

NewGoFunctionBuilder initializes a new Go function builder.

type FunctionCloudMetadata

type FunctionCloudMetadata struct {
	Exports      CloudExports
	FunctionName string
}

FunctionCloudMetadata describes the function cloud metadata.

func (*FunctionCloudMetadata) GetARN

func (m *FunctionCloudMetadata) GetARN() string

GetARN returns the function ARN.

func (*FunctionCloudMetadata) GetName

func (m *FunctionCloudMetadata) GetName() string

GetName returns the function name.

type FunctionConfig

type FunctionConfig struct {
	Stage          Stage           `validate:"required"`
	Name           string          `validate:"required"`
	Builder        FunctionBuilder `validate:"required"`
	TimeoutSeconds uint16          `validate:"required"`
	Environment    map[string]string
	Local          *FunctionConfigLocal
	Cloud          *FunctionConfigCloud
	EventHook      FunctionEventHookFunc
}

FunctionConfig describes the function config.

func (*FunctionConfig) MustValidate

func (c *FunctionConfig) MustValidate(stageTarget StageTarget)

MustValidate validates the function config.

type FunctionConfigCloud

type FunctionConfigCloud struct {
	Memory       int `validate:"required"`
	RolePolicies []goiam.Role_Policy
}

FunctionConfigCloud describes part of the function config.

type FunctionConfigFunc

type FunctionConfigFunc func(Stage, *FunctionDependencies) *FunctionConfig

FunctionConfigFunc returns the function config for a given Stage.

type FunctionConfigLocal

type FunctionConfigLocal struct {
	ExternalPort     uint16
	WatchExcludeDirs []string
}

FunctionConfigLocal describes part of the function config.

type FunctionDependencies

type FunctionDependencies struct {
	ArtifactsBucket   Bucket `validate:"required"`
	Network           Network
	OtherDependencies OtherDependencies
}

FunctionDependencies describes the function dependencies.

func (*FunctionDependencies) MustValidate

func (d *FunctionDependencies) MustValidate()

MustValidate validates the function dependencies.

type FunctionEventHookFunc

type FunctionEventHookFunc func(Function, Event, string)

FunctionEventHookFunc describes a function event hook.

type FunctionLocalMetadata

type FunctionLocalMetadata struct {
	ExternalURL *url.URL
	InternalURL *url.URL
}

FunctionLocalMetadata describes the function local metadata.

type Hasura

type Hasura interface {
	Plugin
	GetConfig() *HasuraConfig
	GetDependencies() *HasuraDependencies
	GetLocalMetadata() *HasuraLocalMetadata
	GetCloudMetadata(require bool) *HasuraCloudMetadata
	ApplyLocalMetadata()
}

Hasura describes a hasura.

func NewHasura

func NewHasura(cfgFunc HasuraConfigFunc, deps *HasuraDependencies) Hasura

NewHasura initializes a new Hasura.

type HasuraCloudMetadata

type HasuraCloudMetadata struct {
	Exports CloudExports
	URL     *url.URL
}

HasuraCloudMetadata describes the hasura cloud metadata.

type HasuraConfig

type HasuraConfig struct {
	Stage            Stage `validate:"required"`
	EnableAllowList  bool
	UnauthorizedRole *string
	JWT              *HasuraConfigJWT `validate:"required"`
	Environment      map[string]string
	Local            *HasuraConfigLocal
	Cloud            *HasuraConfigCloud
	EventHook        HasuraEventHookFunc
}

HasuraConfig describes the hasura config.

func (*HasuraConfig) MustValidate

func (c *HasuraConfig) MustValidate(stageTarget StageTarget)

MustValidate validates the hasura config.

type HasuraConfigCloud

type HasuraConfigCloud struct {
	DomainName  string `validate:"required"`
	Replicas    int    `validate:"required"`
	CPU         int    `validate:"required"`
	Memory      int    `validate:"required"`
	AdminSecret string `validate:"required,min=16"`
	CORSDomain  *string
}

HasuraConfigCloud describes part of the hasura config.

type HasuraConfigFunc

type HasuraConfigFunc func(Stage, *HasuraDependencies) *HasuraConfig

HasuraConfigFunc returns the hasura config for a given Stage.

type HasuraConfigJWT

type HasuraConfigJWT struct {
	PublicKey *rsa.PublicKey `validate:"required"`
	Issuer    string         `validate:"required"`
	Audience  string         `validate:"required"`
}

HasuraConfigJWT describes part of the hasura config.

type HasuraConfigLocal

type HasuraConfigLocal struct {
	ExternalPort           uint16 `validate:"required"`
	ConsoleExternalPort    uint16 `validate:"required"`
	ConsoleAPIExternalPort uint16 `validate:"required"`
}

HasuraConfigLocal describes part of the hasura config.

type HasuraDependencies

type HasuraDependencies struct {
	Certificate       Certificate     `validate:"required"`
	ImageRepository   ImageRepository `validate:"required"`
	LoadBalancer      LoadBalancer    `validate:"required"`
	Network           Network         `validate:"required"`
	Postgres          Postgres        `validate:"required"`
	OtherDependencies OtherDependencies
}

HasuraDependencies describes the hasura dependencies.

func (*HasuraDependencies) MustValidate

func (d *HasuraDependencies) MustValidate()

MustValidate validates the hasura dependencies.

type HasuraEventHookFunc

type HasuraEventHookFunc func(Hasura, Event, string)

HasuraEventHookFunc describes a hasura event hook.

type HasuraLocalMetadata

type HasuraLocalMetadata struct {
	ContainerName        string
	ConsoleContainerName string
	AdminSecret          string
	ExternalURL          *url.URL
	InternalURL          *url.URL
	ConsoleExternalURL   *url.URL
}

HasuraLocalMetadata describes the hasura local metadata.

type ImageRepository

type ImageRepository interface {
	Plugin
	GetConfig() *ImageRepositoryConfig
	GetLocalMetadata() *ImageRepositoryLocalMetadata
	GetCloudMetadata(require bool) *ImageRepositoryCloudMetadata
}

ImageRepository describes an image repository.

func NewImageRepository

NewImageRepository initializes a new ImageRepository.

type ImageRepositoryCloudMetadata

type ImageRepositoryCloudMetadata struct {
	Exports   CloudExports
	ImageName string
}

ImageRepositoryCloudMetadata describes the image repository cloud metadata.

type ImageRepositoryConfig

type ImageRepositoryConfig struct {
	Stage     Stage  `validate:"required"`
	Name      string `validate:"required,resource-name"`
	Cloud     *ImageRepositoryConfigCloud
	EventHook ImageRepositoryEventHookFunc
}

ImageRepositoryConfig describes the image repository config.

func (*ImageRepositoryConfig) MustValidate

func (c *ImageRepositoryConfig) MustValidate(stageTarget StageTarget)

MustValidate validates the image repository config.

type ImageRepositoryConfigCloud

type ImageRepositoryConfigCloud struct {
	IsScanOnPushEnabled  bool
	AreTagsMutable       bool
	TaggedImagesPolicy   *ImageRepositoryConfigTaggedImagesPolicy
	UntaggedImagesPolicy *ImageRepositoryConfigUntaggedImagesPolicy
}

ImageRepositoryConfigCloud describes part of the image repository config.

type ImageRepositoryConfigFunc

type ImageRepositoryConfigFunc func(Stage, *ImageRepositoryDependencies) *ImageRepositoryConfig

ImageRepositoryConfigFunc returns the image repository config for a given Stage.

type ImageRepositoryConfigTaggedImagesPolicy

type ImageRepositoryConfigTaggedImagesPolicy struct {
	TagPrefixes  []string `validate:"required"`
	MaximumCount int      `validate:"required"`
}

ImageRepositoryConfigTaggedImagesPolicy describes part of the image repository config.

type ImageRepositoryConfigUntaggedImagesPolicy

type ImageRepositoryConfigUntaggedImagesPolicy struct {
	DeleteAfterDays int `validate:"required"`
}

ImageRepositoryConfigUntaggedImagesPolicy describes part of the image repository config.

type ImageRepositoryDependencies

type ImageRepositoryDependencies struct {
	OtherDependencies OtherDependencies
}

ImageRepositoryDependencies describes the image repository dependencies.

func (*ImageRepositoryDependencies) MustValidate

func (d *ImageRepositoryDependencies) MustValidate()

MustValidate validates the image repository dependencies.

type ImageRepositoryEventHookFunc

type ImageRepositoryEventHookFunc func(ImageRepository, Event, string)

ImageRepositoryEventHookFunc describes a image repository event hook.

type ImageRepositoryLocalMetadata

type ImageRepositoryLocalMetadata struct {
	ImageName string
}

ImageRepositoryLocalMetadata describes the image repository local metadata.

type LoadBalancer

type LoadBalancer interface {
	Plugin
	GetConfig() *LoadBalancerConfig
	GetDependencies() *LoadBalancerDependencies
	GetCloudMetadata(require bool) *LoadBalancerCloudMetadata
}

LoadBalancer describes a load balancer.

func NewLoadBalancer

func NewLoadBalancer(cfgFunc LoadBalancerConfigFunc, deps *LoadBalancerDependencies) LoadBalancer

NewLoadBalancer initializes a new LoadBalancer.

type LoadBalancerCloudMetadata

type LoadBalancerCloudMetadata struct {
	Exports CloudExports
}

LoadBalancerCloudMetadata describes the load balancer cloud metadata.

type LoadBalancerConfig

type LoadBalancerConfig struct {
	Stage     Stage `validate:"required"`
	EventHook LoadBalancerEventHookFunc
}

LoadBalancerConfig describes the load balancer config.

func (*LoadBalancerConfig) MustValidate

func (c *LoadBalancerConfig) MustValidate(_ StageTarget)

MustValidate validates the load balancer config.

type LoadBalancerConfigFunc

type LoadBalancerConfigFunc func(Stage, *LoadBalancerDependencies) *LoadBalancerConfig

LoadBalancerConfigFunc returns the load balancer config for a given Stage.

type LoadBalancerDependencies

type LoadBalancerDependencies struct {
	Certificate       Certificate `validate:"required"`
	Network           Network     `validate:"required"`
	OtherDependencies OtherDependencies
}

LoadBalancerDependencies describes the load balancer dependencies.

func (*LoadBalancerDependencies) MustValidate

func (d *LoadBalancerDependencies) MustValidate()

MustValidate validates the load balancer dependencies.

type LoadBalancerEventHookFunc

type LoadBalancerEventHookFunc func(LoadBalancer, Event, string)

LoadBalancerEventHookFunc describes a load balancer event hook.

type LocalStage

type LocalStage interface {
	Stage
	GetLocalConfig() *LocalStageConfig
	GetServiceNetworkConfig() map[string]*dctypes.ServiceNetworkConfig
	Create()
	Destroy()
}

LocalStage describes a local Stage.

func NewLocalStage

func NewLocalStage(cfg *LocalStageConfig) LocalStage

NewLocalStage initializes a new LocalStage.

type LocalStageConfig

type LocalStageConfig struct {
	*StageConfig `validate:"required"`
}

LocalStageConfig describes the local Stage config.

func (*LocalStageConfig) MustValidate

func (c *LocalStageConfig) MustValidate()

MustValidate validates the local stage config.

type Mail

type Mail interface {
	Plugin
	GetConfig() *MailConfig
	GetDependencies() *MailDependencies
	GetLocalMetadata() *MailLocalMetadata
}

Mail describes a mail.

func NewMail

func NewMail(cfgFunc MailConfigFunc, deps *MailDependencies) Mail

NewMail initializes a new Mail.

type MailConfig

type MailConfig struct {
	Stage     Stage `validate:"required"`
	Local     *MailConfigLocal
	EventHook MailEventHookFunc
}

MailConfig describes the mail config.

func (*MailConfig) MustValidate

func (c *MailConfig) MustValidate(stageTarget StageTarget)

MustValidate validates the mail config.

type MailConfigFunc

type MailConfigFunc func(Stage, *MailDependencies) *MailConfig

MailConfigFunc returns the mail config for a given Stage.

type MailConfigLocal

type MailConfigLocal struct {
	ExternalPort     uint16 `validate:"required"`
	SMTPExternalPort uint16 `validate:"required"`
}

MailConfigLocal describes part of the mail config.

type MailDependencies

type MailDependencies struct {
	OtherDependencies OtherDependencies
}

MailDependencies describes the mail dependencies.

func (*MailDependencies) MustValidate

func (d *MailDependencies) MustValidate()

MustValidate validates the mail dependencies.

type MailEventHookFunc

type MailEventHookFunc func(Mail, Event, string)

MailEventHookFunc describes a mail event hook.

type MailLocalMetadata

type MailLocalMetadata struct {
	ContainerName      string
	ExternalURL        *url.URL
	InternalURL        *url.URL
	ConsoleExternalURL *url.URL
}

MailLocalMetadata describes the mail local metadata.

type Network

type Network interface {
	Plugin
	GetConfig() *NetworkConfig
	GetCloudMetadata(require bool) *NetworkCloudMetadata
}

Network describes a network.

func NewNetwork

func NewNetwork(cfgFunc NetworkConfigFunc, deps *NetworkDependencies) Network

NewNetwork initializes a new Network.

type NetworkCloudMetadata

type NetworkCloudMetadata struct {
	Exports CloudExports
}

NetworkCloudMetadata describes the network cloud metadata.

type NetworkConfig

type NetworkConfig struct {
	Stage     Stage `validate:"required"`
	EventHook NetworkEventHookFunc
}

NetworkConfig describes the network config.

func (*NetworkConfig) MustValidate

func (c *NetworkConfig) MustValidate(_ StageTarget)

MustValidate validates the network config.

type NetworkConfigFunc

type NetworkConfigFunc func(Stage, *NetworkDependencies) *NetworkConfig

NetworkConfigFunc returns the network config for a given Stage.

type NetworkDependencies

type NetworkDependencies struct {
	OtherDependencies OtherDependencies
}

NetworkDependencies describes the network dependencies.

func (*NetworkDependencies) MustValidate

func (d *NetworkDependencies) MustValidate()

MustValidate validates the network dependencies.

type NetworkEventHookFunc

type NetworkEventHookFunc func(Network, Event, string)

NetworkEventHookFunc describes a network event hook.

type OtherDependencies

type OtherDependencies []Plugin

OtherDependencies describes a set of unstructured dependencies.

func (OtherDependencies) Find

func (d OtherDependencies) Find(name string, instanceName *string) Plugin

Find looks a dependency given plugin name and instance name. Returns nil if not found.

type Plugin

type Plugin interface {
	GetDisplayName() string
	GetName() string
	GetInstanceName() *string // nil for singleton Plugins
	GetDependenciesMap() map[Plugin]struct{}
	Configure(stage Stage)
	GetStage() Stage
	IsDeployed() bool
	UpdateLocalTemplate(tpl *dctypes.Config, buildDirPath string)
	GetCloudTemplate(buildDirPath string) *gocf.Template
	UpdateCloudMetadata(stack *awscft.Stack)
	EventHook(event Event, buildDirPath string)
}

Plugin describes a plugin, i.e. a set of behaviors, tools, and components.

type PolicyStatement

type PolicyStatement struct {
	Actions   []string
	Resources []string
	Principal interface{}
}

PolicyStatement describes a policy statement.

func NewPolicyStatement

func NewPolicyStatement() *PolicyStatement

NewPolicyStatement initializes a new PolicyStatement.

func (*PolicyStatement) AddActions

func (s *PolicyStatement) AddActions(actions ...string) *PolicyStatement

AddActions adds actions to the policy statement.

func (*PolicyStatement) AddResources

func (s *PolicyStatement) AddResources(resources ...string) *PolicyStatement

AddResources adds resources to the policy statement.

func (*PolicyStatement) Build

func (s *PolicyStatement) Build() interface{}

Build builds the policy statement.

func (*PolicyStatement) SetAnyRootAccountPrincipal

func (s *PolicyStatement) SetAnyRootAccountPrincipal() *PolicyStatement

SetAnyRootAccountPrincipal sets any root account as principal on the policy statement.

func (*PolicyStatement) SetCurrentRootAccountPrincipal

func (s *PolicyStatement) SetCurrentRootAccountPrincipal() *PolicyStatement

SetCurrentRootAccountPrincipal sets the current root account as principal on the policy statement.

func (*PolicyStatement) SetServicePrincipal

func (s *PolicyStatement) SetServicePrincipal(service string) *PolicyStatement

SetServicePrincipal sets a service as principal on the policy statement.

func (*PolicyStatement) SetWildcardPrincipal

func (s *PolicyStatement) SetWildcardPrincipal() *PolicyStatement

SetWildcardPrincipal sets a wildcard as principal on the policy statement.

type Postgres

type Postgres interface {
	Plugin
	GetConfig() *PostgresConfig
	GetDependencies() *PostgresDependencies
	GetLocalMetadata() *PostgresLocalMetadata
	GetCloudMetadata(require bool) *PostgresCloudMetadata
}

Postgres describes a postgres.

func NewPostgres

func NewPostgres(cfgFunc PostgresConfigFunc, deps *PostgresDependencies) Postgres

NewPostgres initializes a new Postgres.

type PostgresCloudMetadata

type PostgresCloudMetadata struct {
	Exports CloudExports
	URL     *url.URL
}

PostgresCloudMetadata describes the postgres cloud metadata.

type PostgresConfig

type PostgresConfig struct {
	Stage     Stage `validate:"required"`
	Local     *PostgresConfigLocal
	Cloud     *PostgresConfigCloud
	EventHook PostgresEventHookFunc
}

PostgresConfig describes the postgres config.

func (*PostgresConfig) MustValidate

func (c *PostgresConfig) MustValidate(stageTarget StageTarget)

MustValidate validates the postgres config.

type PostgresConfigCloud

type PostgresConfigCloud struct {
	Password            string `validate:"required,min=16"`
	AllocatedStorageGBs int    `validate:"required,min=5"`
	InstanceClass       string `validate:"required"`
}

PostgresConfigCloud describes part of the postgres config.

type PostgresConfigFunc

type PostgresConfigFunc func(Stage, *PostgresDependencies) *PostgresConfig

PostgresConfigFunc returns the postgres config for a given Stage.

type PostgresConfigLocal

type PostgresConfigLocal struct {
	ExternalPort      uint16 `validate:"required"`
	AdminExternalPort uint16 `validate:"required"`
}

PostgresConfigLocal describes part of the postgres config.

type PostgresDependencies

type PostgresDependencies struct {
	Network           Network `validate:"required"`
	OtherDependencies OtherDependencies
}

PostgresDependencies describes the postgres dependencies.

func (*PostgresDependencies) MustValidate

func (d *PostgresDependencies) MustValidate()

MustValidate validates the postgres dependencies.

type PostgresEventHookFunc

type PostgresEventHookFunc func(Postgres, Event, string)

PostgresEventHookFunc describes a postgres event hook.

type PostgresLocalMetadata

type PostgresLocalMetadata struct {
	ContainerName           string
	ExternalURL             *url.URL
	InternalURL             *url.URL
	AdminConsoleExternalURL *url.URL
}

PostgresLocalMetadata describes the postgres local metadata.

type PostgresProxy

type PostgresProxy interface {
	Plugin
	GetConfig() *PostgresProxyConfig
	GetLocalMetadata() *PostgresProxyLocalMetadata
	GetCloudMetadata(require bool) *PostgresProxyCloudMetadata
}

PostgresProxy describes a postgres proxy.

func NewPostgresProxy

func NewPostgresProxy(cfgFunc PostgresProxyConfigFunc, deps *PostgresProxyDependencies) PostgresProxy

NewPostgresProxy initializes a new PostgresProxy.

type PostgresProxyCloudMetadata

type PostgresProxyCloudMetadata struct {
	Exports CloudExports
	URL     *url.URL
}

PostgresProxyCloudMetadata describes the postgres proxy cloud metadata.

type PostgresProxyConfig

type PostgresProxyConfig struct {
	Stage     Stage `validate:"required"`
	EventHook PostgresProxyEventHookFunc
}

PostgresProxyConfig describes the postgres proxy config.

func (*PostgresProxyConfig) MustValidate

func (c *PostgresProxyConfig) MustValidate(_ StageTarget)

MustValidate validates the postgres proxy config.

type PostgresProxyConfigFunc

type PostgresProxyConfigFunc func(Stage, *PostgresProxyDependencies) *PostgresProxyConfig

PostgresProxyConfigFunc returns the postgres proxy config for a given Stage.

type PostgresProxyDependencies

type PostgresProxyDependencies struct {
	Network           Network  `validate:"required"`
	Postgres          Postgres `validate:"required"`
	OtherDependencies []Plugin
}

PostgresProxyDependencies describes the postgres proxy dependencies.

func (*PostgresProxyDependencies) MustValidate

func (d *PostgresProxyDependencies) MustValidate()

MustValidate validates the postgres proxy dependencies.

type PostgresProxyEventHookFunc

type PostgresProxyEventHookFunc func(PostgresProxy, Event, string)

PostgresProxyEventHookFunc describes a postgres proxy event hook.

type PostgresProxyLocalMetadata

type PostgresProxyLocalMetadata struct {
	ExternalURL *url.URL
	InternalURL *url.URL
}

PostgresProxyLocalMetadata describes the postgres proxy local metadata.

type Stage

type Stage interface {
	GetName() string
	GetTarget() StageTarget
	GetMode() StageMode
	GetConfig() *StageConfig
	AsCloudStage() CloudStage
	AsLocalStage() LocalStage
}

Stage describes a Stage.

type StageConfig

type StageConfig struct {
	App          App `validate:"required"`
	CustomConfig interface{}
}

StageConfig describes the common config for a stage.

type StageMode

type StageMode string

StageMode describes a Stage mode.

const (
	Production StageMode = "prod"
	Staging    StageMode = "staging"
)

Known Stage modes.

func (StageMode) IsProduction

func (s StageMode) IsProduction() bool

IsProduction returns true if the Stage mode is Production.

func (StageMode) IsStaging

func (s StageMode) IsStaging() bool

IsStaging returns true if the Stage mode is Staging.

func (StageMode) MustValidate

func (s StageMode) MustValidate()

MustValidate validates the StageMode.

func (StageMode) String

func (s StageMode) String() string

String implements the fmt.Stringer interface.

type StageTarget

type StageTarget string

StageTarget describes a Stage target.

const (
	Local StageTarget = "local"
	Cloud StageTarget = "cloud"
)

Known Stage targets.

func (StageTarget) IsCloud

func (s StageTarget) IsCloud() bool

IsCloud returns true if the Stage target is Cloud.

func (StageTarget) IsLocal

func (s StageTarget) IsLocal() bool

IsLocal returns true if the Stage target is Local.

func (StageTarget) MustValidate

func (s StageTarget) MustValidate()

MustValidate validates the StageTarget.

func (StageTarget) String

func (s StageTarget) String() string

String implements the fmt.Stringer interface.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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