Documentation ¶
Overview ¶
Opinionated CDK Project “Framework”
Index ¶
- func AccountContext_GetAccountConfig(scope constructs.Construct, key *string) interface{}
- func AccountContext_GetAccountId(scope constructs.Construct) *string
- func AccountContext_GetAccountType(scope constructs.Construct) *string
- func AccountContext_IsDev(scope constructs.Construct) *bool
- func AccountContext_IsMock(scope constructs.Construct) *bool
- func AccountContext_IsPreProd(scope constructs.Construct) *bool
- func AccountContext_IsProd(scope constructs.Construct) *bool
- func AccountContext_IsShared(scope constructs.Construct) *bool
- func AccountStrategy_One(props *AccountStrategyOneProps) *map[string]*Account
- func AccountStrategy_Three(props *AccountStrategyThreeProps) *map[string]*Account
- func AccountStrategy_Two(props *AccountStrategyTwoProps) *map[string]*Account
- func AccountType_Get(scope constructs.Construct) *string
- func AccountType_MatchFromEnvironment(scope constructs.Construct, accounts *map[string]*Account, ...) *string
- func AccountType_Set(scope constructs.Construct, accountType *string)
- func AccountWrapper_IsConstruct(x interface{}) *bool
- func EnvironmentContext_GetFeatureInfo(scope constructs.Construct) *string
- func EnvironmentContext_GetName(scope constructs.Construct) *string
- func EnvironmentContext_GetUrlName(scope constructs.Construct) *string
- func EnvironmentContext_IsDevelopment(scope constructs.Construct) *bool
- func EnvironmentContext_IsFeature(scope constructs.Construct) *bool
- func EnvironmentContext_IsMock(scope constructs.Construct) *bool
- func EnvironmentContext_IsStable(scope constructs.Construct) *bool
- func EnvironmentContext_IsVerification(scope constructs.Construct) *bool
- func EnvironmentType_Get(scope constructs.Construct, allowedEnvironments *[]*string) *string
- func EnvironmentType_Set(scope constructs.Construct, environmentType *string)
- func EnvironmentType_TryGet(scope constructs.Construct) *string
- func EnvironmentWrapper_IsConstruct(x interface{}) *bool
- func Name_Globally(scope constructs.Construct, baseName *string, props *NameProps) *string
- func Name_It(scope constructs.Construct, baseName *string, props *NameProps) *string
- func Name_WithProject(scope constructs.Construct, baseName *string, props *NameProps) *string
- func NewAccountContext_Override(a AccountContext)
- func NewAccountStrategy_Override(a AccountStrategy)
- func NewAccountType_Override(a AccountType)
- func NewAccountWrapper_Override(a AccountWrapper, scope constructs.Construct)
- func NewEnvRegExp_Override(e EnvRegExp, base *string)
- func NewEnvironmentContext_Override(e EnvironmentContext)
- func NewEnvironmentType_Override(e EnvironmentType)
- func NewEnvironmentWrapper_Override(e EnvironmentWrapper, scope constructs.Construct)
- func NewName_Override(n Name)
- func NewPathName_Override(p PathName)
- func NewProjectContext_Override(p ProjectContext)
- func NewProject_Override(p Project, props *ProjectProps)
- func NewSmartStack_Override(s SmartStack, scope constructs.Construct, id *string, props *awscdk.StackProps)
- func NewUrlName_Override(u UrlName)
- func PathName_Globally(scope constructs.Construct, baseName *string, props *NameProps) *string
- func PathName_It(scope constructs.Construct, baseName *string, props *NameProps) *string
- func PathName_WithProject(scope constructs.Construct, baseName *string, props *NameProps) *string
- func ProjectContext_GetAccountConfig(scope constructs.Construct, key *string, defaultValue interface{}) interface{}
- func ProjectContext_GetAccountId(scope constructs.Construct) *string
- func ProjectContext_GetAccountType(scope constructs.Construct) *string
- func ProjectContext_GetAllowedEnvironments(scope constructs.Construct) *[]*string
- func ProjectContext_GetAuthorEmail(scope constructs.Construct) *string
- func ProjectContext_GetAuthorName(scope constructs.Construct) *string
- func ProjectContext_GetAuthorOrganization(scope constructs.Construct) *string
- func ProjectContext_GetDefaultRegion(scope constructs.Construct) *string
- func ProjectContext_GetEnvironment(scope constructs.Construct) *string
- func ProjectContext_GetName(scope constructs.Construct) *string
- func ProjectContext_TryGetEnvironment(scope constructs.Construct) *string
- func Project_CONTEXT_SCOPE() *string
- func Project_IsApp(obj interface{}) *bool
- func Project_IsConstruct(x interface{}) *bool
- func Project_IsStage(x interface{}) *bool
- func Project_Of(construct constructs.IConstruct) awscdk.Stage
- func SmartStack_IsConstruct(x interface{}) *bool
- func SmartStack_IsStack(x interface{}) *bool
- func SmartStack_Of(construct constructs.IConstruct) awscdk.Stack
- func UrlName_Globally(scope constructs.Construct, baseName *string, props *NameProps) *string
- func UrlName_It(scope constructs.Construct, baseName *string, props *NameProps) *string
- func UrlName_WithProject(scope constructs.Construct, baseName *string, props *NameProps) *string
- type Account
- type AccountConfiguration
- type AccountContext
- type AccountStrategy
- type AccountStrategyOneProps
- type AccountStrategyThreeProps
- type AccountStrategyTwoProps
- type AccountType
- type AccountWrapper
- type Acknowledgeable
- type Author
- type EnvRegExp
- type EnvironmentCategory
- type EnvironmentContext
- type EnvironmentLabel
- type EnvironmentType
- type EnvironmentWrapper
- type Name
- type NameProps
- type PathName
- type Project
- type ProjectConfiguration
- type ProjectContext
- type ProjectProps
- type SmartStack
- type UrlName
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccountContext_GetAccountConfig ¶
func AccountContext_GetAccountConfig(scope constructs.Construct, key *string) interface{}
func AccountContext_GetAccountId ¶
func AccountContext_GetAccountId(scope constructs.Construct) *string
func AccountContext_GetAccountType ¶
func AccountContext_GetAccountType(scope constructs.Construct) *string
func AccountContext_IsDev ¶
func AccountContext_IsDev(scope constructs.Construct) *bool
func AccountContext_IsMock ¶
func AccountContext_IsMock(scope constructs.Construct) *bool
func AccountContext_IsPreProd ¶
func AccountContext_IsPreProd(scope constructs.Construct) *bool
func AccountContext_IsProd ¶
func AccountContext_IsProd(scope constructs.Construct) *bool
func AccountContext_IsShared ¶
func AccountContext_IsShared(scope constructs.Construct) *bool
func AccountStrategy_One ¶
func AccountStrategy_One(props *AccountStrategyOneProps) *map[string]*Account
Enables single account strategy.
1. `shared` account with environments:
- development
- feature/*
- test
- qaN
- staging
- preproduction
- production.
Example:
AccountStrategy.one({ shared: { id: '111111111111', }, }),
func AccountStrategy_Three ¶
func AccountStrategy_Three(props *AccountStrategyThreeProps) *map[string]*Account
Enables triple account strategy.
1. `dev` account with environments:
- development
- feature/*
- test
- staging
2. `preprod` account with environments:
- qaN
- preproduction
3. `prod` account with environments: - production.
Example:
AccountStrategy.three({ dev: { id: '111111111111', }, preprod: { id: '222222222222', }, prod: { id: '333333333333', }, }),
func AccountStrategy_Two ¶
func AccountStrategy_Two(props *AccountStrategyTwoProps) *map[string]*Account
Enables dual account strategy.
1. `dev` account with environments:
- development
- feature/*
- test
- qaN
- staging
2. `prod` account with environments:
- preproduction
- production.
Example:
AccountStrategy.two({ dev: { id: '111111111111', }, prod: { id: '222222222222', }, }),
func AccountType_Get ¶
func AccountType_Get(scope constructs.Construct) *string
func AccountType_Set ¶
func AccountType_Set(scope constructs.Construct, accountType *string)
func AccountWrapper_IsConstruct ¶
func AccountWrapper_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func EnvironmentContext_GetFeatureInfo ¶
func EnvironmentContext_GetFeatureInfo(scope constructs.Construct) *string
Get Feature Info.
If environment belongs to `feature` category, this will return a string describing the feature (sting after `feature/`-prefix).
If environment is not a feature environment, will return an empty string.
Returns: string indicating the feature this environment relates to, if not feature environment returns an empty string.
func EnvironmentContext_GetName ¶
func EnvironmentContext_GetName(scope constructs.Construct) *string
Get Environment Name.
Returns: Environment Name (as given via `--context environment`).
Example:
'mock1' 'mock2' 'mock3' 'development' 'feature/foo-bar' 'feature/ABC-123/new-stuff' 'test' 'staging' 'qa1' 'qa2' 'qa3' 'preproduction' 'production'
func EnvironmentContext_GetUrlName ¶
func EnvironmentContext_GetUrlName(scope constructs.Construct) *string
Get Environment URL/DNS Compatible Name.
Returns: Environment URL/DNS Compatible Name (as given via `--context environment` but `param-cased`).
Example:
'mock1' 'mock2' 'mock3' 'development' 'feature-foo-bar' 'feature-abc-123-new-stuff' 'test' 'staging' 'qa1' 'qa2' 'qa3' 'preproduction' 'production'
func EnvironmentContext_IsDevelopment ¶
func EnvironmentContext_IsDevelopment(scope constructs.Construct) *bool
Check if Environment is part of `development` category.
Returns true for `development`, otherwise `false`.
Returns: boolean indicating does Environment belong to `development` category.
func EnvironmentContext_IsFeature ¶
func EnvironmentContext_IsFeature(scope constructs.Construct) *bool
Check if Environment is part of `feature` category.
Returns `true` for environments with name beginning with `feature/`-prefix, otherwise `false`.
Returns: boolean indicating does Environment belong to `feature` category.
func EnvironmentContext_IsMock ¶
func EnvironmentContext_IsMock(scope constructs.Construct) *bool
Check if Environment is part of `mock` category.
Returns: boolean indicating does Environment belong to `mock` category.
func EnvironmentContext_IsStable ¶
func EnvironmentContext_IsStable(scope constructs.Construct) *bool
Check if Environment is part of `stable` category.
Returns `true` for `staging` & `production`, otherwise `false`.
Returns: boolean indicating does Environment belong to `stable` category.
func EnvironmentContext_IsVerification ¶
func EnvironmentContext_IsVerification(scope constructs.Construct) *bool
Check if Environment is part of `verification` category.
Returns `true` for `test` & `preproduction`, otherwise `false`.
Returns: boolean indicating does Environment belong to `verification` category.
func EnvironmentType_Get ¶
func EnvironmentType_Set ¶
func EnvironmentType_Set(scope constructs.Construct, environmentType *string)
func EnvironmentType_TryGet ¶
func EnvironmentType_TryGet(scope constructs.Construct) *string
func EnvironmentWrapper_IsConstruct ¶
func EnvironmentWrapper_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func Name_Globally ¶
PascalCase naming with global prefixes (org, project…).
func Name_WithProject ¶
func NewAccountContext_Override ¶
func NewAccountContext_Override(a AccountContext)
func NewAccountStrategy_Override ¶
func NewAccountStrategy_Override(a AccountStrategy)
func NewAccountType_Override ¶
func NewAccountType_Override(a AccountType)
func NewAccountWrapper_Override ¶
func NewAccountWrapper_Override(a AccountWrapper, scope constructs.Construct)
func NewEnvRegExp_Override ¶
func NewEnvironmentContext_Override ¶
func NewEnvironmentContext_Override(e EnvironmentContext)
func NewEnvironmentType_Override ¶
func NewEnvironmentType_Override(e EnvironmentType)
func NewEnvironmentWrapper_Override ¶
func NewEnvironmentWrapper_Override(e EnvironmentWrapper, scope constructs.Construct)
func NewName_Override ¶
func NewName_Override(n Name)
func NewPathName_Override ¶
func NewPathName_Override(p PathName)
func NewProjectContext_Override ¶
func NewProjectContext_Override(p ProjectContext)
func NewProject_Override ¶
func NewProject_Override(p Project, props *ProjectProps)
Initializes a new Project (which can be used in place of cdk.App).
func NewSmartStack_Override ¶
func NewSmartStack_Override(s SmartStack, scope constructs.Construct, id *string, props *awscdk.StackProps)
func NewUrlName_Override ¶
func NewUrlName_Override(u UrlName)
func PathName_Globally ¶
PascalCase naming with global prefixes (org, project…).
func PathName_It ¶
func PathName_WithProject ¶
func ProjectContext_GetAccountConfig ¶
func ProjectContext_GetAccountConfig(scope constructs.Construct, key *string, defaultValue interface{}) interface{}
func ProjectContext_GetAccountId ¶
func ProjectContext_GetAccountId(scope constructs.Construct) *string
func ProjectContext_GetAccountType ¶
func ProjectContext_GetAccountType(scope constructs.Construct) *string
Returns the account type given in runtime/CLI context.
func ProjectContext_GetAllowedEnvironments ¶
func ProjectContext_GetAllowedEnvironments(scope constructs.Construct) *[]*string
func ProjectContext_GetAuthorEmail ¶
func ProjectContext_GetAuthorEmail(scope constructs.Construct) *string
func ProjectContext_GetAuthorName ¶
func ProjectContext_GetAuthorName(scope constructs.Construct) *string
func ProjectContext_GetAuthorOrganization ¶
func ProjectContext_GetAuthorOrganization(scope constructs.Construct) *string
func ProjectContext_GetDefaultRegion ¶
func ProjectContext_GetDefaultRegion(scope constructs.Construct) *string
func ProjectContext_GetEnvironment ¶
func ProjectContext_GetEnvironment(scope constructs.Construct) *string
func ProjectContext_GetName ¶
func ProjectContext_GetName(scope constructs.Construct) *string
func ProjectContext_TryGetEnvironment ¶
func ProjectContext_TryGetEnvironment(scope constructs.Construct) *string
func Project_CONTEXT_SCOPE ¶
func Project_CONTEXT_SCOPE() *string
func Project_IsApp ¶
func Project_IsApp(obj interface{}) *bool
Checks if an object is an instance of the `App` class.
Returns: `true` if `obj` is an `App`.
func Project_IsConstruct ¶
func Project_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func Project_IsStage ¶
func Project_IsStage(x interface{}) *bool
Test whether the given construct is a stage.
func Project_Of ¶
func Project_Of(construct constructs.IConstruct) awscdk.Stage
Return the stage this construct is contained with, if available.
If called on a nested stage, returns its parent.
func SmartStack_IsConstruct ¶
func SmartStack_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func SmartStack_IsStack ¶
func SmartStack_IsStack(x interface{}) *bool
Return whether the given object is a Stack.
We do attribute detection since we can't reliably use 'instanceof'.
func SmartStack_Of ¶
func SmartStack_Of(construct constructs.IConstruct) awscdk.Stack
Looks up the first stack scope in which `construct` is defined.
Fails if there is no stack up the tree.
func UrlName_Globally ¶
PascalCase naming with global prefixes (org, project…).
func UrlName_It ¶
func UrlName_WithProject ¶
Types ¶
type Account ¶
type Account struct { // AWS Account ID. // // Example: // '123456789012' // Id *string `field:"required" json:"id" yaml:"id"` // AWS account specific configuration. // // For example VPC IDs (for existing VPCs), Direct Connect Gateway IDs, apex domain names (for Route53 Zone lookups), etc. Basically configuration for resources that are defined outside of this CDK application. // // Example: // { // dev: { // id: '111111111111', // config: { // baseDomain: 'example.net', // }, // }, // prod: { // id: '222222222222', // config: { // baseDomain: 'example.com', // }, // }, // }, // Config *map[string]interface{} `field:"optional" json:"config" yaml:"config"` // List of accepted environments for the given account. // // List of strings or strings representing regexp initialization (passed onto `new Regexp("^"+environment+"$", "i")`). // // Example: // ["development", "feature/.*"] // Environments *[]*string `field:"optional" json:"environments" yaml:"environments"` }
AWS account configuration.
func Project_GetAccount ¶
Return account configuration.
type AccountConfiguration ¶
type AccountConfiguration struct { Id *string `field:"required" json:"id" yaml:"id"` Config *map[string]interface{} `field:"optional" json:"config" yaml:"config"` }
Interface for a single account type configuration.
type AccountContext ¶
type AccountContext interface { }
func NewAccountContext ¶
func NewAccountContext() AccountContext
type AccountStrategy ¶
type AccountStrategy interface { }
Use static methods of `AccountStrategy` abstract class to define your account strategy.
Available strategies are: - One Account: `shared` - Two Accounts: `dev`+`prod` – _recommended_ - Three Accounts: `dev`+`preprod`+`prod`.
type AccountStrategyOneProps ¶
type AccountStrategyOneProps struct { Mock *AccountConfiguration `field:"optional" json:"mock" yaml:"mock"` }
Props `AccountStrategy.one`.
type AccountStrategyThreeProps ¶
type AccountStrategyThreeProps struct { Dev *AccountConfiguration `field:"required" json:"dev" yaml:"dev"` Preprod *AccountConfiguration `field:"required" json:"preprod" yaml:"preprod"` Prod *AccountConfiguration `field:"required" json:"prod" yaml:"prod"` Mock *AccountConfiguration `field:"optional" json:"mock" yaml:"mock"` }
Props `AccountStrategy.three`.
type AccountStrategyTwoProps ¶
type AccountStrategyTwoProps struct { Dev *AccountConfiguration `field:"required" json:"dev" yaml:"dev"` Prod *AccountConfiguration `field:"required" json:"prod" yaml:"prod"` Mock *AccountConfiguration `field:"optional" json:"mock" yaml:"mock"` }
Props `AccountStrategy.two`.
type AccountType ¶
type AccountType interface { }
Internal class to handle set/get operations for Account Type.
func NewAccountType ¶
func NewAccountType() AccountType
type AccountWrapper ¶
type AccountWrapper interface { constructs.Construct // The tree node. Node() constructs.Node // Returns a string representation of this construct. ToString() *string }
Wrapper for account-level stacks.
func NewAccountWrapper ¶
func NewAccountWrapper(scope constructs.Construct) AccountWrapper
type Acknowledgeable ¶ added in v1.0.0
type Acknowledgeable struct { Id *string `field:"required" json:"id" yaml:"id"` Message *string `field:"optional" json:"message" yaml:"message"` }
Interface for acknowledging warnings.
type Author ¶
type Author struct { // Human-readable name for the team/contact responsible for this project/service. // // Example: // 'Mad Scientists' // Name *string `field:"required" json:"name" yaml:"name"` // Email address for the team/contact responsible for this project/service. // // Example: // 'mad.scientists@acme.example.com' // Email *string `field:"optional" json:"email" yaml:"email"` // Human-readable name for the organization responsible for this project/service. // // Example: // 'Acme Corp' // Organization *string `field:"optional" json:"organization" yaml:"organization"` }
Author information.
I.e. who owns/develops this project/service.
type EnvRegExp ¶
func NewEnvRegExp ¶
type EnvironmentCategory ¶
type EnvironmentCategory string
Availalbe Enviroment Categories.
Categories are useful grouping to make distinction between `stable` environments (`staging` & `production`) from `feature` or `verification` environments (such as `test` or `preproduction`).
const ( EnvironmentCategory_MOCK EnvironmentCategory = "MOCK" EnvironmentCategory_DEVELOPMENT EnvironmentCategory = "DEVELOPMENT" EnvironmentCategory_FEATURE EnvironmentCategory = "FEATURE" EnvironmentCategory_VERIFICATION EnvironmentCategory = "VERIFICATION" EnvironmentCategory_STABLE EnvironmentCategory = "STABLE" )
func EnvironmentContext_GetCategory ¶
func EnvironmentContext_GetCategory(scope constructs.Construct) EnvironmentCategory
Get Environment Category.
Categories are useful grouping to make distinction between `stable` environments (`staging` & `production`) from `feature` or `verification` environments (such as `test` or `preproduction`).
Returns: Environment Category.
Example:
'mock' 'development' 'feature' 'verification' 'stable'
type EnvironmentContext ¶
type EnvironmentContext interface { }
func NewEnvironmentContext ¶
func NewEnvironmentContext() EnvironmentContext
type EnvironmentLabel ¶
type EnvironmentLabel string
Available Environment Labels.
Labels are useful since Environment Name can be complex, such as `feature/foo-bar` or `qa3`, but we need to be able to “label” all `feature/*` and `qaN` environments as either `feature` or `qa`.
const ( EnvironmentLabel_MOCK EnvironmentLabel = "MOCK" EnvironmentLabel_DEVELOPMENT EnvironmentLabel = "DEVELOPMENT" EnvironmentLabel_FEATURE EnvironmentLabel = "FEATURE" EnvironmentLabel_TEST EnvironmentLabel = "TEST" EnvironmentLabel_STAGING EnvironmentLabel = "STAGING" EnvironmentLabel_QA EnvironmentLabel = "QA" EnvironmentLabel_PREPRODUCTION EnvironmentLabel = "PREPRODUCTION" EnvironmentLabel_PRODUCTION EnvironmentLabel = "PRODUCTION" )
func EnvironmentContext_GetLabel ¶
func EnvironmentContext_GetLabel(scope constructs.Construct) EnvironmentLabel
Get Environment Label.
Labels are useful since Environment Name can be complex, such as `feature/foo-bar` or `qa3`, but we need to be able to “label” all `feature/*` and `qaN` environments as either `feature` or `qa`.
Returns: Environment Label.
Example:
'mock' 'development' 'feature' 'test' 'staging' 'qa' 'preproduction' 'production'
type EnvironmentType ¶
type EnvironmentType interface { }
Internal class to handle set/get operations for Environment Type.
func NewEnvironmentType ¶
func NewEnvironmentType() EnvironmentType
type EnvironmentWrapper ¶
type EnvironmentWrapper interface { constructs.Construct // The tree node. Node() constructs.Node // Returns a string representation of this construct. ToString() *string }
Wrapper for environmental stacks.
func NewEnvironmentWrapper ¶
func NewEnvironmentWrapper(scope constructs.Construct) EnvironmentWrapper
type Project ¶
type Project interface { awscdk.App // The default account for all resources defined within this stage. Account() *string // Artifact ID of the assembly if it is a nested stage. The root stage (app) will return an empty string. // // Derived from the construct path. ArtifactId() *string // The cloud assembly asset output directory. AssetOutdir() *string // The tree node. Node() constructs.Node // The cloud assembly output directory. Outdir() *string // The parent stage or `undefined` if this is the app. // // *. ParentStage() awscdk.Stage // Validation plugins to run during synthesis. // // If any plugin reports any violation, // synthesis will be interrupted and the report displayed to the user. // Default: - no validation plugins are used. // PolicyValidationBeta1() *[]awscdk.IPolicyValidationPluginBeta1 // The default region for all resources defined within this stage. Region() *string // The name of the stage. // // Based on names of the parent stages separated by // hypens. StageName() *string // Acknowledge warnings for all stacks in the project. AcknowledgeWarnings(acknowledgements *[]*Acknowledgeable) // Synthesize this stage into a cloud assembly. // // Once an assembly has been synthesized, it cannot be modified. Subsequent // calls will return the same assembly. Synth(options *awscdk.StageSynthesisOptions) cxapi.CloudAssembly // Returns a string representation of this construct. ToString() *string }
High-level wrapper for `cdk.App` with specific requirements for props.
Use it like you would `cdk.App` and assign stacks into it.
Example:
// new Project instead of new App const project = new Project({ name: 'my-cool-project', author: { organization: 'Acme Corp', name: 'Mad Scientists', email: 'mad.scientists@acme.example.com', }, defaultRegion: 'eu-west-1', // defaults to one of: $CDK_DEFAULT_REGION, $AWS_REGION or us-east-1 accounts: { dev: { id: '111111111111', environments: ['development', 'feature/.*', 'staging'], config: { baseDomain: 'example.net', }, }, prod: { id: '222222222222', environments: ['production'], config: { baseDomain: 'example.com', }, }, }, })
func NewProject ¶
func NewProject(props *ProjectProps) Project
Initializes a new Project (which can be used in place of cdk.App).
type ProjectConfiguration ¶
type ProjectConfiguration struct { // Dictionary of AWS account specific configuration. // // The key value can be anything (such as AWS Account alias), but it's recommended to keep it short such as `dev` or `prod`. // // Example: // accounts: { // dev: { // id: '111111111111', // config: { // baseDomain: 'example.net', // }, // }, // prod: { // id: '222222222222', // config: { // baseDomain: 'example.com', // }, // }, // }, // Accounts *map[string]*Account `field:"required" json:"accounts" yaml:"accounts"` // Author information. // // I.e. who owns/develops this project/service. Author *Author `field:"required" json:"author" yaml:"author"` // Name of your project/service. // // Prefer `hyphen-case`. // // Example: // 'my-cool-project' // Name *string `field:"required" json:"name" yaml:"name"` // Specify default region you wish to use. // // If left empty will default to one of the following in order: // 1. `$CDK_DEFAULT_REGION` // 2. `$AWS_REGION` // 3. 'us-east-1' DefaultRegion *string `field:"optional" json:"defaultRegion" yaml:"defaultRegion"` }
func Project_GetConfiguration ¶
func Project_GetConfiguration(scope constructs.Construct) *ProjectConfiguration
Return the project configuration as given in ProjectProps.
type ProjectContext ¶
type ProjectContext interface { }
func NewProjectContext ¶
func NewProjectContext() ProjectContext
type ProjectProps ¶
type ProjectProps struct { // Dictionary of AWS account specific configuration. // // The key value can be anything (such as AWS Account alias), but it's recommended to keep it short such as `dev` or `prod`. // // Example: // accounts: { // dev: { // id: '111111111111', // config: { // baseDomain: 'example.net', // }, // }, // prod: { // id: '222222222222', // config: { // baseDomain: 'example.com', // }, // }, // }, // Accounts *map[string]*Account `field:"required" json:"accounts" yaml:"accounts"` // Author information. // // I.e. who owns/develops this project/service. Author *Author `field:"required" json:"author" yaml:"author"` // Name of your project/service. // // Prefer `hyphen-case`. // // Example: // 'my-cool-project' // Name *string `field:"required" json:"name" yaml:"name"` // Specify default region you wish to use. // // If left empty will default to one of the following in order: // 1. `$CDK_DEFAULT_REGION` // 2. `$AWS_REGION` // 3. 'us-east-1' DefaultRegion *string `field:"optional" json:"defaultRegion" yaml:"defaultRegion"` // Include runtime versioning information in the Stacks of this app. // Default: Value of 'aws:cdk:version-reporting' context key. // AnalyticsReporting *bool `field:"optional" json:"analyticsReporting" yaml:"analyticsReporting"` // Automatically call `synth()` before the program exits. // // If you set this, you don't have to call `synth()` explicitly. Note that // this feature is only available for certain programming languages, and // calling `synth()` is still recommended. // Default: true if running via CDK CLI (`CDK_OUTDIR` is set), `false` // otherwise. // AutoSynth *bool `field:"optional" json:"autoSynth" yaml:"autoSynth"` // Additional context values for the application. // // Context set by the CLI or the `context` key in `cdk.json` has precedence. // // Context can be read from any construct using `node.getContext(key)`. // Default: - no additional context. // Context *map[string]interface{} `field:"optional" json:"context" yaml:"context"` // The stack synthesizer to use by default for all Stacks in the App. // // The Stack Synthesizer controls aspects of synthesis and deployment, // like how assets are referenced and what IAM roles to use. For more // information, see the README of the main CDK package. // Default: - A `DefaultStackSynthesizer` with default settings. // DefaultStackSynthesizer awscdk.IReusableStackSynthesizer `field:"optional" json:"defaultStackSynthesizer" yaml:"defaultStackSynthesizer"` // The output directory into which to emit synthesized artifacts. // // You should never need to set this value. By default, the value you pass to // the CLI's `--output` flag will be used, and if you change it to a different // directory the CLI will fail to pick up the generated Cloud Assembly. // // This property is intended for internal and testing use. // Default: - If this value is _not_ set, considers the environment variable `CDK_OUTDIR`. // If `CDK_OUTDIR` is not defined, uses a temp directory. // Outdir *string `field:"optional" json:"outdir" yaml:"outdir"` // Validation plugins to run after synthesis. // Default: - no validation plugins. // PolicyValidationBeta1 *[]awscdk.IPolicyValidationPluginBeta1 `field:"optional" json:"policyValidationBeta1" yaml:"policyValidationBeta1"` // Additional context values for the application. // // Context provided here has precedence over context set by: // // - The CLI via --context // - The `context` key in `cdk.json` // - The `AppProps.context` property // // This property is recommended over the `AppProps.context` property since you // can make final decision over which context value to take in your app. // // Context can be read from any construct using `node.getContext(key)`. // // Example: // // context from the CLI and from `cdk.json` are stored in the // // CDK_CONTEXT env variable // const cliContext = JSON.parse(process.env.CDK_CONTEXT!); // // // determine whether to take the context passed in the CLI or not // const determineValue = process.env.PROD ? cliContext.SOMEKEY : 'my-prod-value'; // new App({ // postCliContext: { // SOMEKEY: determineValue, // }, // }); // // Default: - no additional context. // PostCliContext *map[string]interface{} `field:"optional" json:"postCliContext" yaml:"postCliContext"` // Include construct creation stack trace in the `aws:cdk:trace` metadata key of all constructs. // Default: true stack traces are included unless `aws:cdk:disable-stack-trace` is set in the context. // StackTraces *bool `field:"optional" json:"stackTraces" yaml:"stackTraces"` // Include construct tree metadata as part of the Cloud Assembly. // Default: true. // TreeMetadata *bool `field:"optional" json:"treeMetadata" yaml:"treeMetadata"` }
Props given to `Project`.
I.e. custom props for this construct and the usual props given to `cdk.App`.
type SmartStack ¶
type SmartStack interface { awscdk.Stack // The AWS account into which this stack will be deployed. // // This value is resolved according to the following rules: // // 1. The value provided to `env.account` when the stack is defined. This can // either be a concrete account (e.g. `585695031111`) or the // `Aws.ACCOUNT_ID` token. // 3. `Aws.ACCOUNT_ID`, which represents the CloudFormation intrinsic reference // `{ "Ref": "AWS::AccountId" }` encoded as a string token. // // Preferably, you should use the return value as an opaque string and not // attempt to parse it to implement your logic. If you do, you must first // check that it is a concrete value an not an unresolved token. If this // value is an unresolved token (`Token.isUnresolved(stack.account)` returns // `true`), this implies that the user wishes that this stack will synthesize // into a **account-agnostic template**. In this case, your code should either // fail (throw an error, emit a synth error using `Annotations.of(construct).addError()`) or // implement some other region-agnostic behavior. Account() *string // The ID of the cloud assembly artifact for this stack. ArtifactId() *string // Returns the list of AZs that are available in the AWS environment (account/region) associated with this stack. // // If the stack is environment-agnostic (either account and/or region are // tokens), this property will return an array with 2 tokens that will resolve // at deploy-time to the first two availability zones returned from CloudFormation's // `Fn::GetAZs` intrinsic function. // // If they are not available in the context, returns a set of dummy values and // reports them as missing, and let the CLI resolve them by calling EC2 // `DescribeAvailabilityZones` on the target environment. // // To specify a different strategy for selecting availability zones override this method. AvailabilityZones() *[]*string // Indicates whether the stack requires bundling or not. BundlingRequired() *bool // Return the stacks this stack depends on. Dependencies() *[]awscdk.Stack // The environment coordinates in which this stack is deployed. // // In the form // `aws://account/region`. Use `stack.account` and `stack.region` to obtain // the specific values, no need to parse. // // You can use this value to determine if two stacks are targeting the same // environment. // // If either `stack.account` or `stack.region` are not concrete values (e.g. // `Aws.ACCOUNT_ID` or `Aws.REGION`) the special strings `unknown-account` and/or // `unknown-region` will be used respectively to indicate this stack is // region/account-agnostic. Environment() *string // Indicates if this is a nested stack, in which case `parentStack` will include a reference to it's parent. Nested() *bool // If this is a nested stack, returns it's parent stack. NestedStackParent() awscdk.Stack // If this is a nested stack, this represents its `AWS::CloudFormation::Stack` resource. // // `undefined` for top-level (non-nested) stacks. NestedStackResource() awscdk.CfnResource // The tree node. Node() constructs.Node // Returns the list of notification Amazon Resource Names (ARNs) for the current stack. NotificationArns() *[]*string // The partition in which this stack is defined. Partition() *string // The AWS region into which this stack will be deployed (e.g. `us-west-2`). // // This value is resolved according to the following rules: // // 1. The value provided to `env.region` when the stack is defined. This can // either be a concrete region (e.g. `us-west-2`) or the `Aws.REGION` // token. // 3. `Aws.REGION`, which is represents the CloudFormation intrinsic reference // `{ "Ref": "AWS::Region" }` encoded as a string token. // // Preferably, you should use the return value as an opaque string and not // attempt to parse it to implement your logic. If you do, you must first // check that it is a concrete value an not an unresolved token. If this // value is an unresolved token (`Token.isUnresolved(stack.region)` returns // `true`), this implies that the user wishes that this stack will synthesize // into a **region-agnostic template**. In this case, your code should either // fail (throw an error, emit a synth error using `Annotations.of(construct).addError()`) or // implement some other region-agnostic behavior. Region() *string // The ID of the stack. // // Example: // // After resolving, looks like // 'arn:aws:cloudformation:us-west-2:123456789012:stack/teststack/51af3dc0-da77-11e4-872e-1234567db123' // StackId() *string // The concrete CloudFormation physical stack name. // // This is either the name defined explicitly in the `stackName` prop or // allocated based on the stack's location in the construct tree. Stacks that // are directly defined under the app use their construct `id` as their stack // name. Stacks that are defined deeper within the tree will use a hashed naming // scheme based on the construct path to ensure uniqueness. // // If you wish to obtain the deploy-time AWS::StackName intrinsic, // you can use `Aws.STACK_NAME` directly. StackName() *string // Synthesis method for this stack. Synthesizer() awscdk.IStackSynthesizer // Tags to be applied to the stack. Tags() awscdk.TagManager // The name of the CloudFormation template file emitted to the output directory during synthesis. // // Example value: `MyStack.template.json` TemplateFile() *string // Options for CloudFormation template (like version, transform, description). TemplateOptions() awscdk.ITemplateOptions // Whether termination protection is enabled for this stack. TerminationProtection() *bool SetTerminationProtection(val *bool) // The Amazon domain suffix for the region in which this stack is defined. UrlSuffix() *string // Add a dependency between this stack and another stack. // // This can be used to define dependencies between any two stacks within an // app, and also supports nested stacks. AddDependency(target awscdk.Stack, reason *string) // Adds an arbitary key-value pair, with information you want to record about the stack. // // These get translated to the Metadata section of the generated template. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html // AddMetadata(key *string, value interface{}) // Add a Transform to this stack. A Transform is a macro that AWS CloudFormation uses to process your template. // // Duplicate values are removed when stack is synthesized. // // Example: // declare const stack: Stack; // // stack.addTransform('AWS::Serverless-2016-10-31') // // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/transform-section-structure.html // AddTransform(transform *string) // Returns the naming scheme used to allocate logical IDs. // // By default, uses // the `HashedAddressingScheme` but this method can be overridden to customize // this behavior. // // In order to make sure logical IDs are unique and stable, we hash the resource // construct tree path (i.e. toplevel/secondlevel/.../myresource) and add it as // a suffix to the path components joined without a separator (CloudFormation // IDs only allow alphanumeric characters). // // The result will be: // // <path.join(”)><md5(path.join('/')> // "human" "hash" // // If the "human" part of the ID exceeds 240 characters, we simply trim it so // the total ID doesn't exceed CloudFormation's 255 character limit. // // We only take 8 characters from the md5 hash (0.000005 chance of collision). // // Special cases: // // - If the path only contains a single component (i.e. it's a top-level // resource), we won't add the hash to it. The hash is not needed for // disambiguation and also, it allows for a more straightforward migration an // existing CloudFormation template to a CDK stack without logical ID changes // (or renames). // - For aesthetic reasons, if the last components of the path are the same // (i.e. `L1/L2/Pipeline/Pipeline`), they will be de-duplicated to make the // resulting human portion of the ID more pleasing: `L1L2Pipeline<HASH>` // instead of `L1L2PipelinePipeline<HASH>` // - If a component is named "Default" it will be omitted from the path. This // allows refactoring higher level abstractions around constructs without affecting // the IDs of already deployed resources. // - If a component is named "Resource" it will be omitted from the user-visible // path, but included in the hash. This reduces visual noise in the human readable // part of the identifier. AllocateLogicalId(cfnElement awscdk.CfnElement) *string // Create a CloudFormation Export for a string list value. // // Returns a string list representing the corresponding `Fn.importValue()` // expression for this Export. The export expression is automatically wrapped with an // `Fn::Join` and the import value with an `Fn::Split`, since CloudFormation can only // export strings. You can control the name for the export by passing the `name` option. // // If you don't supply a value for `name`, the value you're exporting must be // a Resource attribute (for example: `bucket.bucketName`) and it will be // given the same name as the automatic cross-stack reference that would be created // if you used the attribute in another Stack. // // One of the uses for this method is to *remove* the relationship between // two Stacks established by automatic cross-stack references. It will // temporarily ensure that the CloudFormation Export still exists while you // remove the reference from the consuming stack. After that, you can remove // the resource and the manual export. // // See `exportValue` for an example of this process. ExportStringListValue(exportedValue interface{}, options *awscdk.ExportValueOptions) *[]*string // Create a CloudFormation Export for a string value. // // Returns a string representing the corresponding `Fn.importValue()` // expression for this Export. You can control the name for the export by // passing the `name` option. // // If you don't supply a value for `name`, the value you're exporting must be // a Resource attribute (for example: `bucket.bucketName`) and it will be // given the same name as the automatic cross-stack reference that would be created // if you used the attribute in another Stack. // // One of the uses for this method is to *remove* the relationship between // two Stacks established by automatic cross-stack references. It will // temporarily ensure that the CloudFormation Export still exists while you // remove the reference from the consuming stack. After that, you can remove // the resource and the manual export. // // ## Example // // Here is how the process works. Let's say there are two stacks, // `producerStack` and `consumerStack`, and `producerStack` has a bucket // called `bucket`, which is referenced by `consumerStack` (perhaps because // an AWS Lambda Function writes into it, or something like that). // // It is not safe to remove `producerStack.bucket` because as the bucket is being // deleted, `consumerStack` might still be using it. // // Instead, the process takes two deployments: // // ### Deployment 1: break the relationship // // - Make sure `consumerStack` no longer references `bucket.bucketName` (maybe the consumer // stack now uses its own bucket, or it writes to an AWS DynamoDB table, or maybe you just // remove the Lambda Function altogether). // - In the `ProducerStack` class, call `this.exportValue(this.bucket.bucketName)`. This // will make sure the CloudFormation Export continues to exist while the relationship // between the two stacks is being broken. // - Deploy (this will effectively only change the `consumerStack`, but it's safe to deploy both). // // ### Deployment 2: remove the bucket resource // // - You are now free to remove the `bucket` resource from `producerStack`. // - Don't forget to remove the `exportValue()` call as well. // - Deploy again (this time only the `producerStack` will be changed -- the bucket will be deleted). ExportValue(exportedValue interface{}, options *awscdk.ExportValueOptions) *string // Creates an ARN from components. // // If `partition`, `region` or `account` are not specified, the stack's // partition, region and account will be used. // // If any component is the empty string, an empty string will be inserted // into the generated ARN at the location that component corresponds to. // // The ARN will be formatted as follows: // // arn:{partition}:{service}:{region}:{account}:{resource}{sep}{resource-name} // // The required ARN pieces that are omitted will be taken from the stack that // the 'scope' is attached to. If all ARN pieces are supplied, the supplied scope // can be 'undefined'. FormatArn(components *awscdk.ArnComponents) *string // Allocates a stack-unique CloudFormation-compatible logical identity for a specific resource. // // This method is called when a `CfnElement` is created and used to render the // initial logical identity of resources. Logical ID renames are applied at // this stage. // // This method uses the protected method `allocateLogicalId` to render the // logical ID for an element. To modify the naming scheme, extend the `Stack` // class and override this method. GetLogicalId(element awscdk.CfnElement) *string // Look up a fact value for the given fact for the region of this stack. // // Will return a definite value only if the region of the current stack is resolved. // If not, a lookup map will be added to the stack and the lookup will be done at // CDK deployment time. // // What regions will be included in the lookup map is controlled by the // `@aws-cdk/core:target-partitions` context value: it must be set to a list // of partitions, and only regions from the given partitions will be included. // If no such context key is set, all regions will be included. // // This function is intended to be used by construct library authors. Application // builders can rely on the abstractions offered by construct libraries and do // not have to worry about regional facts. // // If `defaultValue` is not given, it is an error if the fact is unknown for // the given region. RegionalFact(factName *string, defaultValue *string) *string // Rename a generated logical identities. // // To modify the naming scheme strategy, extend the `Stack` class and // override the `allocateLogicalId` method. RenameLogicalId(oldId *string, newId *string) // Indicate that a context key was expected. // // Contains instructions which will be emitted into the cloud assembly on how // the key should be supplied. ReportMissingContextKey(report *cloudassemblyschema.MissingContext) // Resolve a tokenized value in the context of the current stack. Resolve(obj interface{}) interface{} // Splits the provided ARN into its components. // // Works both if 'arn' is a string like 'arn:aws:s3:::bucket', // and a Token representing a dynamic CloudFormation expression // (in which case the returned components will also be dynamic CloudFormation expressions, // encoded as Tokens). SplitArn(arn *string, arnFormat awscdk.ArnFormat) *awscdk.ArnComponents // Convert an object, potentially containing tokens, to a JSON string. ToJsonString(obj interface{}, space *float64) *string // Returns a string representation of this construct. ToString() *string // Convert an object, potentially containing tokens, to a YAML string. ToYamlString(obj interface{}) *string }
func NewSmartStack ¶
func NewSmartStack(scope constructs.Construct, id *string, props *awscdk.StackProps) SmartStack
Source Files ¶
- Account.go
- AccountConfiguration.go
- AccountContext.go
- AccountContext__checks.go
- AccountStrategy.go
- AccountStrategyOneProps.go
- AccountStrategyThreeProps.go
- AccountStrategyTwoProps.go
- AccountStrategy__checks.go
- AccountType.go
- AccountType__checks.go
- AccountWrapper.go
- AccountWrapper__checks.go
- Acknowledgeable.go
- Author.go
- EnvRegExp.go
- EnvRegExp__checks.go
- EnvironmentCategory.go
- EnvironmentContext.go
- EnvironmentContext__checks.go
- EnvironmentLabel.go
- EnvironmentType.go
- EnvironmentType__checks.go
- EnvironmentWrapper.go
- EnvironmentWrapper__checks.go
- Name.go
- NameProps.go
- Name__checks.go
- PathName.go
- PathName__checks.go
- Project.go
- ProjectConfiguration.go
- ProjectContext.go
- ProjectContext__checks.go
- ProjectProps.go
- Project__checks.go
- SmartStack.go
- SmartStack__checks.go
- UrlName.go
- UrlName__checks.go
- main.go