/
subscriptionFilter.go
197 lines (167 loc) · 10.2 KB
/
subscriptionFilter.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
// Code generated by pulumi-language-go DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package logs
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-aws-native/sdk/go/aws/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// The “AWS::Logs::SubscriptionFilter“ resource specifies a subscription filter and associates it with the specified log group. Subscription filters allow you to subscribe to a real-time stream of log events and have them delivered to a specific destination. Currently, the supported destinations are:
//
// - An Amazon Kinesis data stream belonging to the same account as the subscription filter, for same-account delivery.
//
// - A logical destination that belongs to a different account, for cross-account delivery.
//
// - An Amazon Kinesis Firehose delivery stream that belongs to the same account as the subscription filter, for same-account delivery.
//
// - An LAMlong function that belongs to the same account as the subscription filter, for same-account delivery.
//
// There can be as many as two subscription filters associated with a log group.
type SubscriptionFilter struct {
pulumi.CustomResourceState
// The Amazon Resource Name (ARN) of the destination.
DestinationArn pulumi.StringOutput `pulumi:"destinationArn"`
// The method used to distribute log data to the destination, which can be either random or grouped by log stream.
Distribution SubscriptionFilterDistributionPtrOutput `pulumi:"distribution"`
// The name of the subscription filter.
FilterName pulumi.StringPtrOutput `pulumi:"filterName"`
// The filtering expressions that restrict what gets delivered to the destination AWS resource. For more information about the filter pattern syntax, see [Filter and Pattern Syntax](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html).
FilterPattern pulumi.StringOutput `pulumi:"filterPattern"`
// The log group to associate with the subscription filter. All log events that are uploaded to this log group are filtered and delivered to the specified AWS resource if the filter pattern matches the log events.
LogGroupName pulumi.StringOutput `pulumi:"logGroupName"`
// The ARN of an IAM role that grants CWL permissions to deliver ingested log events to the destination stream. You don't need to provide the ARN when you are working with a logical destination for cross-account delivery.
RoleArn pulumi.StringPtrOutput `pulumi:"roleArn"`
}
// NewSubscriptionFilter registers a new resource with the given unique name, arguments, and options.
func NewSubscriptionFilter(ctx *pulumi.Context,
name string, args *SubscriptionFilterArgs, opts ...pulumi.ResourceOption) (*SubscriptionFilter, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.DestinationArn == nil {
return nil, errors.New("invalid value for required argument 'DestinationArn'")
}
if args.FilterPattern == nil {
return nil, errors.New("invalid value for required argument 'FilterPattern'")
}
if args.LogGroupName == nil {
return nil, errors.New("invalid value for required argument 'LogGroupName'")
}
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
"filterName",
"logGroupName",
})
opts = append(opts, replaceOnChanges)
opts = internal.PkgResourceDefaultOpts(opts)
var resource SubscriptionFilter
err := ctx.RegisterResource("aws-native:logs:SubscriptionFilter", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetSubscriptionFilter gets an existing SubscriptionFilter 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 GetSubscriptionFilter(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *SubscriptionFilterState, opts ...pulumi.ResourceOption) (*SubscriptionFilter, error) {
var resource SubscriptionFilter
err := ctx.ReadResource("aws-native:logs:SubscriptionFilter", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering SubscriptionFilter resources.
type subscriptionFilterState struct {
}
type SubscriptionFilterState struct {
}
func (SubscriptionFilterState) ElementType() reflect.Type {
return reflect.TypeOf((*subscriptionFilterState)(nil)).Elem()
}
type subscriptionFilterArgs struct {
// The Amazon Resource Name (ARN) of the destination.
DestinationArn string `pulumi:"destinationArn"`
// The method used to distribute log data to the destination, which can be either random or grouped by log stream.
Distribution *SubscriptionFilterDistribution `pulumi:"distribution"`
// The name of the subscription filter.
FilterName *string `pulumi:"filterName"`
// The filtering expressions that restrict what gets delivered to the destination AWS resource. For more information about the filter pattern syntax, see [Filter and Pattern Syntax](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html).
FilterPattern string `pulumi:"filterPattern"`
// The log group to associate with the subscription filter. All log events that are uploaded to this log group are filtered and delivered to the specified AWS resource if the filter pattern matches the log events.
LogGroupName string `pulumi:"logGroupName"`
// The ARN of an IAM role that grants CWL permissions to deliver ingested log events to the destination stream. You don't need to provide the ARN when you are working with a logical destination for cross-account delivery.
RoleArn *string `pulumi:"roleArn"`
}
// The set of arguments for constructing a SubscriptionFilter resource.
type SubscriptionFilterArgs struct {
// The Amazon Resource Name (ARN) of the destination.
DestinationArn pulumi.StringInput
// The method used to distribute log data to the destination, which can be either random or grouped by log stream.
Distribution SubscriptionFilterDistributionPtrInput
// The name of the subscription filter.
FilterName pulumi.StringPtrInput
// The filtering expressions that restrict what gets delivered to the destination AWS resource. For more information about the filter pattern syntax, see [Filter and Pattern Syntax](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html).
FilterPattern pulumi.StringInput
// The log group to associate with the subscription filter. All log events that are uploaded to this log group are filtered and delivered to the specified AWS resource if the filter pattern matches the log events.
LogGroupName pulumi.StringInput
// The ARN of an IAM role that grants CWL permissions to deliver ingested log events to the destination stream. You don't need to provide the ARN when you are working with a logical destination for cross-account delivery.
RoleArn pulumi.StringPtrInput
}
func (SubscriptionFilterArgs) ElementType() reflect.Type {
return reflect.TypeOf((*subscriptionFilterArgs)(nil)).Elem()
}
type SubscriptionFilterInput interface {
pulumi.Input
ToSubscriptionFilterOutput() SubscriptionFilterOutput
ToSubscriptionFilterOutputWithContext(ctx context.Context) SubscriptionFilterOutput
}
func (*SubscriptionFilter) ElementType() reflect.Type {
return reflect.TypeOf((**SubscriptionFilter)(nil)).Elem()
}
func (i *SubscriptionFilter) ToSubscriptionFilterOutput() SubscriptionFilterOutput {
return i.ToSubscriptionFilterOutputWithContext(context.Background())
}
func (i *SubscriptionFilter) ToSubscriptionFilterOutputWithContext(ctx context.Context) SubscriptionFilterOutput {
return pulumi.ToOutputWithContext(ctx, i).(SubscriptionFilterOutput)
}
type SubscriptionFilterOutput struct{ *pulumi.OutputState }
func (SubscriptionFilterOutput) ElementType() reflect.Type {
return reflect.TypeOf((**SubscriptionFilter)(nil)).Elem()
}
func (o SubscriptionFilterOutput) ToSubscriptionFilterOutput() SubscriptionFilterOutput {
return o
}
func (o SubscriptionFilterOutput) ToSubscriptionFilterOutputWithContext(ctx context.Context) SubscriptionFilterOutput {
return o
}
// The Amazon Resource Name (ARN) of the destination.
func (o SubscriptionFilterOutput) DestinationArn() pulumi.StringOutput {
return o.ApplyT(func(v *SubscriptionFilter) pulumi.StringOutput { return v.DestinationArn }).(pulumi.StringOutput)
}
// The method used to distribute log data to the destination, which can be either random or grouped by log stream.
func (o SubscriptionFilterOutput) Distribution() SubscriptionFilterDistributionPtrOutput {
return o.ApplyT(func(v *SubscriptionFilter) SubscriptionFilterDistributionPtrOutput { return v.Distribution }).(SubscriptionFilterDistributionPtrOutput)
}
// The name of the subscription filter.
func (o SubscriptionFilterOutput) FilterName() pulumi.StringPtrOutput {
return o.ApplyT(func(v *SubscriptionFilter) pulumi.StringPtrOutput { return v.FilterName }).(pulumi.StringPtrOutput)
}
// The filtering expressions that restrict what gets delivered to the destination AWS resource. For more information about the filter pattern syntax, see [Filter and Pattern Syntax](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html).
func (o SubscriptionFilterOutput) FilterPattern() pulumi.StringOutput {
return o.ApplyT(func(v *SubscriptionFilter) pulumi.StringOutput { return v.FilterPattern }).(pulumi.StringOutput)
}
// The log group to associate with the subscription filter. All log events that are uploaded to this log group are filtered and delivered to the specified AWS resource if the filter pattern matches the log events.
func (o SubscriptionFilterOutput) LogGroupName() pulumi.StringOutput {
return o.ApplyT(func(v *SubscriptionFilter) pulumi.StringOutput { return v.LogGroupName }).(pulumi.StringOutput)
}
// The ARN of an IAM role that grants CWL permissions to deliver ingested log events to the destination stream. You don't need to provide the ARN when you are working with a logical destination for cross-account delivery.
func (o SubscriptionFilterOutput) RoleArn() pulumi.StringPtrOutput {
return o.ApplyT(func(v *SubscriptionFilter) pulumi.StringPtrOutput { return v.RoleArn }).(pulumi.StringPtrOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*SubscriptionFilterInput)(nil)).Elem(), &SubscriptionFilter{})
pulumi.RegisterOutputType(SubscriptionFilterOutput{})
}