-
Notifications
You must be signed in to change notification settings - Fork 17
/
InlineCode.go
146 lines (120 loc) · 3.58 KB
/
InlineCode.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
package awssynthetics
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"
"github.com/aws/aws-cdk-go/awscdk/v2/awss3assets"
"github.com/aws/constructs-go/constructs/v10"
)
// Canary code from an inline string.
//
// Example:
// // The code below shows an example of how to instantiate this type.
// // The values are placeholders you should change.
// import "github.com/aws/aws-cdk-go/awscdk"
//
// inlineCode := awscdk.Aws_synthetics.NewInlineCode(jsii.String("code"))
//
type InlineCode interface {
Code
// Called when the canary is initialized to allow this object to bind to the stack, add resources and have fun.
Bind(_scope constructs.Construct, handler *string, _family RuntimeFamily) *CodeConfig
}
// The jsii proxy struct for InlineCode
type jsiiProxy_InlineCode struct {
jsiiProxy_Code
}
func NewInlineCode(code *string) InlineCode {
_init_.Initialize()
if err := validateNewInlineCodeParameters(code); err != nil {
panic(err)
}
j := jsiiProxy_InlineCode{}
_jsii_.Create(
"aws-cdk-lib.aws_synthetics.InlineCode",
[]interface{}{code},
&j,
)
return &j
}
func NewInlineCode_Override(i InlineCode, code *string) {
_init_.Initialize()
_jsii_.Create(
"aws-cdk-lib.aws_synthetics.InlineCode",
[]interface{}{code},
i,
)
}
// Specify code from a local path.
//
// Path must include the folder structure `nodejs/node_modules/myCanaryFilename.js`.
//
// Returns: `AssetCode` associated with the specified path.
// See: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary.html#CloudWatch_Synthetics_Canaries_write_from_scratch
//
func InlineCode_FromAsset(assetPath *string, options *awss3assets.AssetOptions) AssetCode {
_init_.Initialize()
if err := validateInlineCode_FromAssetParameters(assetPath, options); err != nil {
panic(err)
}
var returns AssetCode
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_synthetics.InlineCode",
"fromAsset",
[]interface{}{assetPath, options},
&returns,
)
return returns
}
// Specify code from an s3 bucket.
//
// The object in the s3 bucket must be a .zip file that contains
// the structure `nodejs/node_modules/myCanaryFilename.js`.
//
// Returns: `S3Code` associated with the specified S3 object.
// See: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_WritingCanary.html#CloudWatch_Synthetics_Canaries_write_from_scratch
//
func InlineCode_FromBucket(bucket awss3.IBucket, key *string, objectVersion *string) S3Code {
_init_.Initialize()
if err := validateInlineCode_FromBucketParameters(bucket, key); err != nil {
panic(err)
}
var returns S3Code
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_synthetics.InlineCode",
"fromBucket",
[]interface{}{bucket, key, objectVersion},
&returns,
)
return returns
}
// Specify code inline.
//
// Returns: `InlineCode` with inline code.
func InlineCode_FromInline(code *string) InlineCode {
_init_.Initialize()
if err := validateInlineCode_FromInlineParameters(code); err != nil {
panic(err)
}
var returns InlineCode
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_synthetics.InlineCode",
"fromInline",
[]interface{}{code},
&returns,
)
return returns
}
func (i *jsiiProxy_InlineCode) Bind(_scope constructs.Construct, handler *string, _family RuntimeFamily) *CodeConfig {
if err := i.validateBindParameters(_scope, handler, _family); err != nil {
panic(err)
}
var returns *CodeConfig
_jsii_.Invoke(
i,
"bind",
[]interface{}{_scope, handler, _family},
&returns,
)
return returns
}