-
Notifications
You must be signed in to change notification settings - Fork 17
/
awscdk_LegacyStackSynthesizer.go
174 lines (154 loc) · 4.89 KB
/
awscdk_LegacyStackSynthesizer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
// An experiment to bundle the entire CDK into a single module
package awscdk
import (
_init_ "github.com/aws/aws-cdk-go/awscdk/jsii"
_jsii_ "github.com/aws/jsii-runtime-go/runtime"
)
// Use the CDK classic way of referencing assets.
//
// This synthesizer will generate CloudFormation parameters for every referenced
// asset, and use the CLI's current credentials to deploy the stack.
//
// - It does not support cross-account deployment (the CLI must have credentials
// to the account you are trying to deploy to).
// - It cannot be used with **CDK Pipelines**. To deploy using CDK Pipelines,
// you must use the `DefaultStackSynthesizer`.
// - Each asset will take up a CloudFormation Parameter in your template. Keep in
// mind that there is a maximum of 200 parameters in a CloudFormation template.
// To use determinstic asset locations instead, use `CliCredentialsStackSynthesizer`.
//
// Be aware that your CLI credentials must be valid for the duration of the
// entire deployment. If you are using session credentials, make sure the
// session lifetime is long enough.
//
// This is the only StackSynthesizer that supports customizing asset behavior
// by overriding `Stack.addFileAsset()` and `Stack.addDockerImageAsset()`.
//
// Example:
// // The code below shows an example of how to instantiate this type.
// // The values are placeholders you should change.
// import monocdk "github.com/aws/aws-cdk-go/awscdk"
//
// legacyStackSynthesizer := monocdk.NewLegacyStackSynthesizer()
//
// Experimental.
type LegacyStackSynthesizer interface {
StackSynthesizer
// Register a Docker Image Asset.
//
// Returns the parameters that can be used to refer to the asset inside the template.
// Experimental.
AddDockerImageAsset(asset *DockerImageAssetSource) *DockerImageAssetLocation
// Register a File Asset.
//
// Returns the parameters that can be used to refer to the asset inside the template.
// Experimental.
AddFileAsset(asset *FileAssetSource) *FileAssetLocation
// Bind to the stack this environment is going to be used on.
//
// Must be called before any of the other methods are called.
// Experimental.
Bind(stack Stack)
// Write the stack artifact to the session.
//
// Use default settings to add a CloudFormationStackArtifact artifact to
// the given synthesis session.
// Experimental.
EmitStackArtifact(stack Stack, session ISynthesisSession, options *SynthesizeStackArtifactOptions)
// Synthesize the associated stack to the session.
// Experimental.
Synthesize(session ISynthesisSession)
// Have the stack write out its template.
// Experimental.
SynthesizeStackTemplate(stack Stack, session ISynthesisSession)
}
// The jsii proxy struct for LegacyStackSynthesizer
type jsiiProxy_LegacyStackSynthesizer struct {
jsiiProxy_StackSynthesizer
}
// Experimental.
func NewLegacyStackSynthesizer() LegacyStackSynthesizer {
_init_.Initialize()
j := jsiiProxy_LegacyStackSynthesizer{}
_jsii_.Create(
"monocdk.LegacyStackSynthesizer",
nil, // no parameters
&j,
)
return &j
}
// Experimental.
func NewLegacyStackSynthesizer_Override(l LegacyStackSynthesizer) {
_init_.Initialize()
_jsii_.Create(
"monocdk.LegacyStackSynthesizer",
nil, // no parameters
l,
)
}
func (l *jsiiProxy_LegacyStackSynthesizer) AddDockerImageAsset(asset *DockerImageAssetSource) *DockerImageAssetLocation {
if err := l.validateAddDockerImageAssetParameters(asset); err != nil {
panic(err)
}
var returns *DockerImageAssetLocation
_jsii_.Invoke(
l,
"addDockerImageAsset",
[]interface{}{asset},
&returns,
)
return returns
}
func (l *jsiiProxy_LegacyStackSynthesizer) AddFileAsset(asset *FileAssetSource) *FileAssetLocation {
if err := l.validateAddFileAssetParameters(asset); err != nil {
panic(err)
}
var returns *FileAssetLocation
_jsii_.Invoke(
l,
"addFileAsset",
[]interface{}{asset},
&returns,
)
return returns
}
func (l *jsiiProxy_LegacyStackSynthesizer) Bind(stack Stack) {
if err := l.validateBindParameters(stack); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
l,
"bind",
[]interface{}{stack},
)
}
func (l *jsiiProxy_LegacyStackSynthesizer) EmitStackArtifact(stack Stack, session ISynthesisSession, options *SynthesizeStackArtifactOptions) {
if err := l.validateEmitStackArtifactParameters(stack, session, options); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
l,
"emitStackArtifact",
[]interface{}{stack, session, options},
)
}
func (l *jsiiProxy_LegacyStackSynthesizer) Synthesize(session ISynthesisSession) {
if err := l.validateSynthesizeParameters(session); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
l,
"synthesize",
[]interface{}{session},
)
}
func (l *jsiiProxy_LegacyStackSynthesizer) SynthesizeStackTemplate(stack Stack, session ISynthesisSession) {
if err := l.validateSynthesizeStackTemplateParameters(stack, session); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
l,
"synthesizeStackTemplate",
[]interface{}{stack, session},
)
}