-
Notifications
You must be signed in to change notification settings - Fork 17
/
Artifact.go
252 lines (218 loc) · 5.96 KB
/
Artifact.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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
package awscodepipeline
import (
_init_ "github.com/aws/aws-cdk-go/awscdk/v2/jsii"
_jsii_ "github.com/aws/jsii-runtime-go/runtime"
"github.com/aws/aws-cdk-go/awscdk/v2/awss3"
)
// An output artifact of an action.
//
// Artifacts can be used as input by some actions.
//
// Example:
// // later:
// var project pipelineProject
// lambdaInvokeAction := codepipeline_actions.NewLambdaInvokeAction(&LambdaInvokeActionProps{
// ActionName: jsii.String("Lambda"),
// Lambda: lambda.NewFunction(this, jsii.String("Func"), &FunctionProps{
// Runtime: lambda.Runtime_NODEJS_LATEST(),
// Handler: jsii.String("index.handler"),
// Code: lambda.Code_FromInline(jsii.String(`
// const { CodePipeline } = require('@aws-sdk/client-codepipeline');
//
// exports.handler = async function(event, context) {
// const codepipeline = new AWS.CodePipeline();
// await codepipeline.putJobSuccessResult({
// jobId: event['CodePipeline.job'].id,
// outputVariables: {
// MY_VAR: "some value",
// },
// });
// }
// `)),
// }),
// VariablesNamespace: jsii.String("MyNamespace"),
// })
// sourceOutput := codepipeline.NewArtifact()
// codepipeline_actions.NewCodeBuildAction(&CodeBuildActionProps{
// ActionName: jsii.String("CodeBuild"),
// Project: Project,
// Input: sourceOutput,
// EnvironmentVariables: map[string]buildEnvironmentVariable{
// "MyVar": &buildEnvironmentVariable{
// "value": lambdaInvokeAction.variable(jsii.String("MY_VAR")),
// },
// },
// })
//
type Artifact interface {
ArtifactName() *string
// The artifact attribute for the name of the S3 bucket where the artifact is stored.
BucketName() *string
// The artifact attribute for The name of the .zip file that contains the artifact that is generated by AWS CodePipeline, such as 1ABCyZZ.zip.
ObjectKey() *string
// Returns the location of the .zip file in S3 that this Artifact represents. Used by Lambda's `CfnParametersCode` when being deployed in a CodePipeline.
S3Location() *awss3.Location
// The artifact attribute of the Amazon Simple Storage Service (Amazon S3) URL of the artifact, such as https://s3-us-west-2.amazonaws.com/artifactstorebucket-yivczw8jma0c/test/TemplateSo/1ABCyZZ.zip.
Url() *string
// Returns an ArtifactPath for a file within this artifact.
//
// CfnOutput is in the form "<artifact-name>::<file-name>".
AtPath(fileName *string) ArtifactPath
// Retrieve the metadata stored in this artifact under the given key.
//
// If there is no metadata stored under the given key,
// null will be returned.
GetMetadata(key *string) interface{}
// Returns a token for a value inside a JSON file within this artifact.
GetParam(jsonFile *string, keyName *string) *string
// Add arbitrary extra payload to the artifact under a given key.
//
// This can be used by CodePipeline actions to communicate data between themselves.
// If metadata was already present under the given key,
// it will be overwritten with the new value.
SetMetadata(key *string, value interface{})
ToString() *string
}
// The jsii proxy struct for Artifact
type jsiiProxy_Artifact struct {
_ byte // padding
}
func (j *jsiiProxy_Artifact) ArtifactName() *string {
var returns *string
_jsii_.Get(
j,
"artifactName",
&returns,
)
return returns
}
func (j *jsiiProxy_Artifact) BucketName() *string {
var returns *string
_jsii_.Get(
j,
"bucketName",
&returns,
)
return returns
}
func (j *jsiiProxy_Artifact) ObjectKey() *string {
var returns *string
_jsii_.Get(
j,
"objectKey",
&returns,
)
return returns
}
func (j *jsiiProxy_Artifact) S3Location() *awss3.Location {
var returns *awss3.Location
_jsii_.Get(
j,
"s3Location",
&returns,
)
return returns
}
func (j *jsiiProxy_Artifact) Url() *string {
var returns *string
_jsii_.Get(
j,
"url",
&returns,
)
return returns
}
func NewArtifact(artifactName *string) Artifact {
_init_.Initialize()
j := jsiiProxy_Artifact{}
_jsii_.Create(
"aws-cdk-lib.aws_codepipeline.Artifact",
[]interface{}{artifactName},
&j,
)
return &j
}
func NewArtifact_Override(a Artifact, artifactName *string) {
_init_.Initialize()
_jsii_.Create(
"aws-cdk-lib.aws_codepipeline.Artifact",
[]interface{}{artifactName},
a,
)
}
// A static factory method used to create instances of the Artifact class.
//
// Mainly meant to be used from `decdk`.
func Artifact_Artifact(name *string) Artifact {
_init_.Initialize()
if err := validateArtifact_ArtifactParameters(name); err != nil {
panic(err)
}
var returns Artifact
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_codepipeline.Artifact",
"artifact",
[]interface{}{name},
&returns,
)
return returns
}
func (a *jsiiProxy_Artifact) AtPath(fileName *string) ArtifactPath {
if err := a.validateAtPathParameters(fileName); err != nil {
panic(err)
}
var returns ArtifactPath
_jsii_.Invoke(
a,
"atPath",
[]interface{}{fileName},
&returns,
)
return returns
}
func (a *jsiiProxy_Artifact) GetMetadata(key *string) interface{} {
if err := a.validateGetMetadataParameters(key); err != nil {
panic(err)
}
var returns interface{}
_jsii_.Invoke(
a,
"getMetadata",
[]interface{}{key},
&returns,
)
return returns
}
func (a *jsiiProxy_Artifact) GetParam(jsonFile *string, keyName *string) *string {
if err := a.validateGetParamParameters(jsonFile, keyName); err != nil {
panic(err)
}
var returns *string
_jsii_.Invoke(
a,
"getParam",
[]interface{}{jsonFile, keyName},
&returns,
)
return returns
}
func (a *jsiiProxy_Artifact) SetMetadata(key *string, value interface{}) {
if err := a.validateSetMetadataParameters(key, value); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
a,
"setMetadata",
[]interface{}{key, value},
)
}
func (a *jsiiProxy_Artifact) ToString() *string {
var returns *string
_jsii_.Invoke(
a,
"toString",
nil, // no parameters
&returns,
)
return returns
}