/
rule.go
161 lines (144 loc) · 5.69 KB
/
rule.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
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package cfg
import (
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// Provides an AWS Config Rule.
//
// > **Note:** Config Rule requires an existing [Configuration Recorder](https://www.terraform.io/docs/providers/aws/r/config_configuration_recorder.html) to be present. Use of `depends_on` is recommended (as shown below) to avoid race conditions.
type Rule struct {
s *pulumi.ResourceState
}
// NewRule registers a new resource with the given unique name, arguments, and options.
func NewRule(ctx *pulumi.Context,
name string, args *RuleArgs, opts ...pulumi.ResourceOpt) (*Rule, error) {
if args == nil || args.Source == nil {
return nil, errors.New("missing required argument 'Source'")
}
inputs := make(map[string]interface{})
if args == nil {
inputs["description"] = nil
inputs["inputParameters"] = nil
inputs["maximumExecutionFrequency"] = nil
inputs["name"] = nil
inputs["scope"] = nil
inputs["source"] = nil
} else {
inputs["description"] = args.Description
inputs["inputParameters"] = args.InputParameters
inputs["maximumExecutionFrequency"] = args.MaximumExecutionFrequency
inputs["name"] = args.Name
inputs["scope"] = args.Scope
inputs["source"] = args.Source
}
inputs["arn"] = nil
inputs["ruleId"] = nil
s, err := ctx.RegisterResource("aws:cfg/rule:Rule", name, true, inputs, opts...)
if err != nil {
return nil, err
}
return &Rule{s: s}, nil
}
// GetRule gets an existing Rule resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetRule(ctx *pulumi.Context,
name string, id pulumi.ID, state *RuleState, opts ...pulumi.ResourceOpt) (*Rule, error) {
inputs := make(map[string]interface{})
if state != nil {
inputs["arn"] = state.Arn
inputs["description"] = state.Description
inputs["inputParameters"] = state.InputParameters
inputs["maximumExecutionFrequency"] = state.MaximumExecutionFrequency
inputs["name"] = state.Name
inputs["ruleId"] = state.RuleId
inputs["scope"] = state.Scope
inputs["source"] = state.Source
}
s, err := ctx.ReadResource("aws:cfg/rule:Rule", name, id, inputs, opts...)
if err != nil {
return nil, err
}
return &Rule{s: s}, nil
}
// URN is this resource's unique name assigned by Pulumi.
func (r *Rule) URN() *pulumi.URNOutput {
return r.s.URN()
}
// ID is this resource's unique identifier assigned by its provider.
func (r *Rule) ID() *pulumi.IDOutput {
return r.s.ID()
}
// The ARN of the config rule
func (r *Rule) Arn() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["arn"])
}
// Description of the rule
func (r *Rule) Description() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["description"])
}
// A string in JSON format that is passed to the AWS Config rule Lambda function.
func (r *Rule) InputParameters() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["inputParameters"])
}
// The frequency that you want AWS Config to run evaluations for a rule that
// is triggered periodically. If specified, requires `message_type` to be `ScheduledNotification`.
func (r *Rule) MaximumExecutionFrequency() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["maximumExecutionFrequency"])
}
// The name of the rule
func (r *Rule) Name() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["name"])
}
// The ID of the config rule
func (r *Rule) RuleId() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["ruleId"])
}
// Scope defines which resources can trigger an evaluation for the rule as documented below.
func (r *Rule) Scope() *pulumi.Output {
return r.s.State["scope"]
}
// Source specifies the rule owner, the rule identifier, and the notifications that cause
// the function to evaluate your AWS resources as documented below.
func (r *Rule) Source() *pulumi.Output {
return r.s.State["source"]
}
// Input properties used for looking up and filtering Rule resources.
type RuleState struct {
// The ARN of the config rule
Arn interface{}
// Description of the rule
Description interface{}
// A string in JSON format that is passed to the AWS Config rule Lambda function.
InputParameters interface{}
// The frequency that you want AWS Config to run evaluations for a rule that
// is triggered periodically. If specified, requires `message_type` to be `ScheduledNotification`.
MaximumExecutionFrequency interface{}
// The name of the rule
Name interface{}
// The ID of the config rule
RuleId interface{}
// Scope defines which resources can trigger an evaluation for the rule as documented below.
Scope interface{}
// Source specifies the rule owner, the rule identifier, and the notifications that cause
// the function to evaluate your AWS resources as documented below.
Source interface{}
}
// The set of arguments for constructing a Rule resource.
type RuleArgs struct {
// Description of the rule
Description interface{}
// A string in JSON format that is passed to the AWS Config rule Lambda function.
InputParameters interface{}
// The frequency that you want AWS Config to run evaluations for a rule that
// is triggered periodically. If specified, requires `message_type` to be `ScheduledNotification`.
MaximumExecutionFrequency interface{}
// The name of the rule
Name interface{}
// Scope defines which resources can trigger an evaluation for the rule as documented below.
Scope interface{}
// Source specifies the rule owner, the rule identifier, and the notifications that cause
// the function to evaluate your AWS resources as documented below.
Source interface{}
}