-
Notifications
You must be signed in to change notification settings - Fork 17
/
awscdk_Annotations.go
146 lines (133 loc) · 3.61 KB
/
awscdk_Annotations.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
// 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"
"github.com/aws/constructs-go/constructs/v3"
)
// Includes API for attaching annotations such as warning messages to constructs.
//
// Example:
// import cdk "github.com/aws/aws-cdk-go/awscdk"
// import "github.com/aws/constructs-go/constructs"
//
// type myAspect struct {
// }
//
// func (this *myAspect) visit(node iConstruct) {
// if *node instanceof cdk.cfnResource && *node.cfnResourceType == "Foo::Bar" {
// this.error(*node, jsii.String("we do not want a Foo::Bar resource"))
// }
// }
//
// func (this *myAspect) error(node iConstruct, message *string) {
// cdk.annotations.of(*node).addError(*message)
// }
//
// type myStack struct {
// stack
// }
//
// func newMyStack(scope construct, id *string) *myStack {
// this := &myStack{}
// cdk.NewStack_Override(this, scope, id)
//
// stack := cdk.NewStack()
// cdk.NewCfnResource(stack, jsii.String("Foo"), &cfnResourceProps{
// type: jsii.String("Foo::Bar"),
// properties: map[string]interface{}{
// "Fred": jsii.String("Thud"),
// },
// })
// cdk.aspects.of(stack).add(NewMyAspect())
// return this
// }
//
// Experimental.
type Annotations interface {
// Adds a deprecation warning for a specific API.
//
// Deprecations will be added only once per construct as a warning and will be
// deduplicated based on the `api`.
//
// If the environment variable `CDK_BLOCK_DEPRECATIONS` is set, this method
// will throw an error instead with the deprecation message.
// Experimental.
AddDeprecation(api *string, message *string)
// Adds an { "error": <message> } metadata entry to this construct.
//
// The toolkit will fail deployment of any stack that has errors reported against it.
// Experimental.
AddError(message *string)
// Adds an info metadata entry to this construct.
//
// The CLI will display the info message when apps are synthesized.
// Experimental.
AddInfo(message *string)
// Adds a warning metadata entry to this construct.
//
// The CLI will display the warning when an app is synthesized, or fail if run
// in --strict mode.
// Experimental.
AddWarning(message *string)
}
// The jsii proxy struct for Annotations
type jsiiProxy_Annotations struct {
_ byte // padding
}
// Returns the annotations API for a construct scope.
// Experimental.
func Annotations_Of(scope constructs.IConstruct) Annotations {
_init_.Initialize()
if err := validateAnnotations_OfParameters(scope); err != nil {
panic(err)
}
var returns Annotations
_jsii_.StaticInvoke(
"monocdk.Annotations",
"of",
[]interface{}{scope},
&returns,
)
return returns
}
func (a *jsiiProxy_Annotations) AddDeprecation(api *string, message *string) {
if err := a.validateAddDeprecationParameters(api, message); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
a,
"addDeprecation",
[]interface{}{api, message},
)
}
func (a *jsiiProxy_Annotations) AddError(message *string) {
if err := a.validateAddErrorParameters(message); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
a,
"addError",
[]interface{}{message},
)
}
func (a *jsiiProxy_Annotations) AddInfo(message *string) {
if err := a.validateAddInfoParameters(message); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
a,
"addInfo",
[]interface{}{message},
)
}
func (a *jsiiProxy_Annotations) AddWarning(message *string) {
if err := a.validateAddWarningParameters(message); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
a,
"addWarning",
[]interface{}{message},
)
}