-
Notifications
You must be signed in to change notification settings - Fork 17
/
RuleScope.go
138 lines (117 loc) · 3.2 KB
/
RuleScope.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
package awsconfig
import (
_init_ "github.com/aws/aws-cdk-go/awscdk/v2/jsii"
_jsii_ "github.com/aws/jsii-runtime-go/runtime"
)
// Determines which resources trigger an evaluation of an AWS Config rule.
//
// Example:
// // Lambda function containing logic that evaluates compliance with the rule.
// evalComplianceFn := lambda.NewFunction(this, jsii.String("CustomFunction"), &FunctionProps{
// Code: lambda.AssetCode_FromInline(jsii.String("exports.handler = (event) => console.log(event);")),
// Handler: jsii.String("index.handler"),
// Runtime: lambda.Runtime_NODEJS_18_X(),
// })
//
// // A custom rule that runs on configuration changes of EC2 instances
// customRule := config.NewCustomRule(this, jsii.String("Custom"), &CustomRuleProps{
// ConfigurationChanges: jsii.Boolean(true),
// LambdaFunction: evalComplianceFn,
// RuleScope: config.RuleScope_FromResource(config.ResourceType_EC2_INSTANCE()),
// })
//
type RuleScope interface {
// tag key applied to resources that will trigger evaluation of a rule.
Key() *string
// ID of the only AWS resource that will trigger evaluation of a rule.
ResourceId() *string
// Resource types that will trigger evaluation of a rule.
ResourceTypes() *[]ResourceType
// tag value applied to resources that will trigger evaluation of a rule.
Value() *string
}
// The jsii proxy struct for RuleScope
type jsiiProxy_RuleScope struct {
_ byte // padding
}
func (j *jsiiProxy_RuleScope) Key() *string {
var returns *string
_jsii_.Get(
j,
"key",
&returns,
)
return returns
}
func (j *jsiiProxy_RuleScope) ResourceId() *string {
var returns *string
_jsii_.Get(
j,
"resourceId",
&returns,
)
return returns
}
func (j *jsiiProxy_RuleScope) ResourceTypes() *[]ResourceType {
var returns *[]ResourceType
_jsii_.Get(
j,
"resourceTypes",
&returns,
)
return returns
}
func (j *jsiiProxy_RuleScope) Value() *string {
var returns *string
_jsii_.Get(
j,
"value",
&returns,
)
return returns
}
// restricts scope of changes to a specific resource type or resource identifier.
func RuleScope_FromResource(resourceType ResourceType, resourceId *string) RuleScope {
_init_.Initialize()
if err := validateRuleScope_FromResourceParameters(resourceType); err != nil {
panic(err)
}
var returns RuleScope
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_config.RuleScope",
"fromResource",
[]interface{}{resourceType, resourceId},
&returns,
)
return returns
}
// restricts scope of changes to specific resource types.
func RuleScope_FromResources(resourceTypes *[]ResourceType) RuleScope {
_init_.Initialize()
if err := validateRuleScope_FromResourcesParameters(resourceTypes); err != nil {
panic(err)
}
var returns RuleScope
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_config.RuleScope",
"fromResources",
[]interface{}{resourceTypes},
&returns,
)
return returns
}
// restricts scope of changes to a specific tag.
func RuleScope_FromTag(key *string, value *string) RuleScope {
_init_.Initialize()
if err := validateRuleScope_FromTagParameters(key); err != nil {
panic(err)
}
var returns RuleScope
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_config.RuleScope",
"fromTag",
[]interface{}{key, value},
&returns,
)
return returns
}