/
realtimeLogConfig.go
314 lines (268 loc) · 13.7 KB
/
realtimeLogConfig.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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
// *** 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 cloudfront
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a CloudFront real-time log configuration resource.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "fmt"
//
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/cloudfront"
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/iam"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// exampleRole, err := iam.NewRole(ctx, "exampleRole", &iam.RoleArgs{
// AssumeRolePolicy: pulumi.Any(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", " \"Version\": \"2012-10-17\",\n", " \"Statement\": [\n", " {\n", " \"Action\": \"sts:AssumeRole\",\n", " \"Principal\": {\n", " \"Service\": \"cloudfront.amazonaws.com\"\n", " },\n", " \"Effect\": \"Allow\"\n", " }\n", " ]\n", "}\n")),
// })
// if err != nil {
// return err
// }
// exampleRolePolicy, err := iam.NewRolePolicy(ctx, "exampleRolePolicy", &iam.RolePolicyArgs{
// Role: exampleRole.ID(),
// Policy: pulumi.Any(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", " \"Version\": \"2012-10-17\",\n", " \"Statement\": [\n", " {\n", " \"Effect\": \"Allow\",\n", " \"Action\": [\n", " \"kinesis:DescribeStreamSummary\",\n", " \"kinesis:DescribeStream\",\n", " \"kinesis:PutRecord\",\n", " \"kinesis:PutRecords\"\n", " ],\n", " \"Resource\": \"", aws_kinesis_stream.Example.Arn, "\"\n", " }\n", " ]\n", "}\n")),
// })
// if err != nil {
// return err
// }
// _, err = cloudfront.NewRealtimeLogConfig(ctx, "exampleRealtimeLogConfig", &cloudfront.RealtimeLogConfigArgs{
// SamplingRate: pulumi.Int(75),
// Fields: pulumi.StringArray{
// pulumi.String("timestamp"),
// pulumi.String("c-ip"),
// },
// Endpoint: &cloudfront.RealtimeLogConfigEndpointArgs{
// StreamType: pulumi.String("Kinesis"),
// KinesisStreamConfig: &cloudfront.RealtimeLogConfigEndpointKinesisStreamConfigArgs{
// RoleArn: exampleRole.Arn,
// StreamArn: pulumi.Any(aws_kinesis_stream.Example.Arn),
// },
// },
// }, pulumi.DependsOn([]pulumi.Resource{
// exampleRolePolicy,
// }))
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// CloudFront real-time log configurations can be imported using the ARN, e.g.,
//
// ```sh
// $ pulumi import aws:cloudfront/realtimeLogConfig:RealtimeLogConfig example arn:aws:cloudfront::111122223333:realtime-log-config/ExampleNameForRealtimeLogConfig
// ```
type RealtimeLogConfig struct {
pulumi.CustomResourceState
// The ARN (Amazon Resource Name) of the CloudFront real-time log configuration.
Arn pulumi.StringOutput `pulumi:"arn"`
// The Amazon Kinesis data streams where real-time log data is sent.
Endpoint RealtimeLogConfigEndpointOutput `pulumi:"endpoint"`
// The fields that are included in each real-time log record. See the [AWS documentation](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/real-time-logs.html#understand-real-time-log-config-fields) for supported values.
Fields pulumi.StringArrayOutput `pulumi:"fields"`
// The unique name to identify this real-time log configuration.
Name pulumi.StringOutput `pulumi:"name"`
// The sampling rate for this real-time log configuration. The sampling rate determines the percentage of viewer requests that are represented in the real-time log data. An integer between `1` and `100`, inclusive.
SamplingRate pulumi.IntOutput `pulumi:"samplingRate"`
}
// NewRealtimeLogConfig registers a new resource with the given unique name, arguments, and options.
func NewRealtimeLogConfig(ctx *pulumi.Context,
name string, args *RealtimeLogConfigArgs, opts ...pulumi.ResourceOption) (*RealtimeLogConfig, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Endpoint == nil {
return nil, errors.New("invalid value for required argument 'Endpoint'")
}
if args.Fields == nil {
return nil, errors.New("invalid value for required argument 'Fields'")
}
if args.SamplingRate == nil {
return nil, errors.New("invalid value for required argument 'SamplingRate'")
}
var resource RealtimeLogConfig
err := ctx.RegisterResource("aws:cloudfront/realtimeLogConfig:RealtimeLogConfig", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetRealtimeLogConfig gets an existing RealtimeLogConfig 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 GetRealtimeLogConfig(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *RealtimeLogConfigState, opts ...pulumi.ResourceOption) (*RealtimeLogConfig, error) {
var resource RealtimeLogConfig
err := ctx.ReadResource("aws:cloudfront/realtimeLogConfig:RealtimeLogConfig", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering RealtimeLogConfig resources.
type realtimeLogConfigState struct {
// The ARN (Amazon Resource Name) of the CloudFront real-time log configuration.
Arn *string `pulumi:"arn"`
// The Amazon Kinesis data streams where real-time log data is sent.
Endpoint *RealtimeLogConfigEndpoint `pulumi:"endpoint"`
// The fields that are included in each real-time log record. See the [AWS documentation](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/real-time-logs.html#understand-real-time-log-config-fields) for supported values.
Fields []string `pulumi:"fields"`
// The unique name to identify this real-time log configuration.
Name *string `pulumi:"name"`
// The sampling rate for this real-time log configuration. The sampling rate determines the percentage of viewer requests that are represented in the real-time log data. An integer between `1` and `100`, inclusive.
SamplingRate *int `pulumi:"samplingRate"`
}
type RealtimeLogConfigState struct {
// The ARN (Amazon Resource Name) of the CloudFront real-time log configuration.
Arn pulumi.StringPtrInput
// The Amazon Kinesis data streams where real-time log data is sent.
Endpoint RealtimeLogConfigEndpointPtrInput
// The fields that are included in each real-time log record. See the [AWS documentation](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/real-time-logs.html#understand-real-time-log-config-fields) for supported values.
Fields pulumi.StringArrayInput
// The unique name to identify this real-time log configuration.
Name pulumi.StringPtrInput
// The sampling rate for this real-time log configuration. The sampling rate determines the percentage of viewer requests that are represented in the real-time log data. An integer between `1` and `100`, inclusive.
SamplingRate pulumi.IntPtrInput
}
func (RealtimeLogConfigState) ElementType() reflect.Type {
return reflect.TypeOf((*realtimeLogConfigState)(nil)).Elem()
}
type realtimeLogConfigArgs struct {
// The Amazon Kinesis data streams where real-time log data is sent.
Endpoint RealtimeLogConfigEndpoint `pulumi:"endpoint"`
// The fields that are included in each real-time log record. See the [AWS documentation](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/real-time-logs.html#understand-real-time-log-config-fields) for supported values.
Fields []string `pulumi:"fields"`
// The unique name to identify this real-time log configuration.
Name *string `pulumi:"name"`
// The sampling rate for this real-time log configuration. The sampling rate determines the percentage of viewer requests that are represented in the real-time log data. An integer between `1` and `100`, inclusive.
SamplingRate int `pulumi:"samplingRate"`
}
// The set of arguments for constructing a RealtimeLogConfig resource.
type RealtimeLogConfigArgs struct {
// The Amazon Kinesis data streams where real-time log data is sent.
Endpoint RealtimeLogConfigEndpointInput
// The fields that are included in each real-time log record. See the [AWS documentation](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/real-time-logs.html#understand-real-time-log-config-fields) for supported values.
Fields pulumi.StringArrayInput
// The unique name to identify this real-time log configuration.
Name pulumi.StringPtrInput
// The sampling rate for this real-time log configuration. The sampling rate determines the percentage of viewer requests that are represented in the real-time log data. An integer between `1` and `100`, inclusive.
SamplingRate pulumi.IntInput
}
func (RealtimeLogConfigArgs) ElementType() reflect.Type {
return reflect.TypeOf((*realtimeLogConfigArgs)(nil)).Elem()
}
type RealtimeLogConfigInput interface {
pulumi.Input
ToRealtimeLogConfigOutput() RealtimeLogConfigOutput
ToRealtimeLogConfigOutputWithContext(ctx context.Context) RealtimeLogConfigOutput
}
func (*RealtimeLogConfig) ElementType() reflect.Type {
return reflect.TypeOf((**RealtimeLogConfig)(nil)).Elem()
}
func (i *RealtimeLogConfig) ToRealtimeLogConfigOutput() RealtimeLogConfigOutput {
return i.ToRealtimeLogConfigOutputWithContext(context.Background())
}
func (i *RealtimeLogConfig) ToRealtimeLogConfigOutputWithContext(ctx context.Context) RealtimeLogConfigOutput {
return pulumi.ToOutputWithContext(ctx, i).(RealtimeLogConfigOutput)
}
// RealtimeLogConfigArrayInput is an input type that accepts RealtimeLogConfigArray and RealtimeLogConfigArrayOutput values.
// You can construct a concrete instance of `RealtimeLogConfigArrayInput` via:
//
// RealtimeLogConfigArray{ RealtimeLogConfigArgs{...} }
type RealtimeLogConfigArrayInput interface {
pulumi.Input
ToRealtimeLogConfigArrayOutput() RealtimeLogConfigArrayOutput
ToRealtimeLogConfigArrayOutputWithContext(context.Context) RealtimeLogConfigArrayOutput
}
type RealtimeLogConfigArray []RealtimeLogConfigInput
func (RealtimeLogConfigArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*RealtimeLogConfig)(nil)).Elem()
}
func (i RealtimeLogConfigArray) ToRealtimeLogConfigArrayOutput() RealtimeLogConfigArrayOutput {
return i.ToRealtimeLogConfigArrayOutputWithContext(context.Background())
}
func (i RealtimeLogConfigArray) ToRealtimeLogConfigArrayOutputWithContext(ctx context.Context) RealtimeLogConfigArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(RealtimeLogConfigArrayOutput)
}
// RealtimeLogConfigMapInput is an input type that accepts RealtimeLogConfigMap and RealtimeLogConfigMapOutput values.
// You can construct a concrete instance of `RealtimeLogConfigMapInput` via:
//
// RealtimeLogConfigMap{ "key": RealtimeLogConfigArgs{...} }
type RealtimeLogConfigMapInput interface {
pulumi.Input
ToRealtimeLogConfigMapOutput() RealtimeLogConfigMapOutput
ToRealtimeLogConfigMapOutputWithContext(context.Context) RealtimeLogConfigMapOutput
}
type RealtimeLogConfigMap map[string]RealtimeLogConfigInput
func (RealtimeLogConfigMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*RealtimeLogConfig)(nil)).Elem()
}
func (i RealtimeLogConfigMap) ToRealtimeLogConfigMapOutput() RealtimeLogConfigMapOutput {
return i.ToRealtimeLogConfigMapOutputWithContext(context.Background())
}
func (i RealtimeLogConfigMap) ToRealtimeLogConfigMapOutputWithContext(ctx context.Context) RealtimeLogConfigMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(RealtimeLogConfigMapOutput)
}
type RealtimeLogConfigOutput struct{ *pulumi.OutputState }
func (RealtimeLogConfigOutput) ElementType() reflect.Type {
return reflect.TypeOf((**RealtimeLogConfig)(nil)).Elem()
}
func (o RealtimeLogConfigOutput) ToRealtimeLogConfigOutput() RealtimeLogConfigOutput {
return o
}
func (o RealtimeLogConfigOutput) ToRealtimeLogConfigOutputWithContext(ctx context.Context) RealtimeLogConfigOutput {
return o
}
type RealtimeLogConfigArrayOutput struct{ *pulumi.OutputState }
func (RealtimeLogConfigArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*RealtimeLogConfig)(nil)).Elem()
}
func (o RealtimeLogConfigArrayOutput) ToRealtimeLogConfigArrayOutput() RealtimeLogConfigArrayOutput {
return o
}
func (o RealtimeLogConfigArrayOutput) ToRealtimeLogConfigArrayOutputWithContext(ctx context.Context) RealtimeLogConfigArrayOutput {
return o
}
func (o RealtimeLogConfigArrayOutput) Index(i pulumi.IntInput) RealtimeLogConfigOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *RealtimeLogConfig {
return vs[0].([]*RealtimeLogConfig)[vs[1].(int)]
}).(RealtimeLogConfigOutput)
}
type RealtimeLogConfigMapOutput struct{ *pulumi.OutputState }
func (RealtimeLogConfigMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*RealtimeLogConfig)(nil)).Elem()
}
func (o RealtimeLogConfigMapOutput) ToRealtimeLogConfigMapOutput() RealtimeLogConfigMapOutput {
return o
}
func (o RealtimeLogConfigMapOutput) ToRealtimeLogConfigMapOutputWithContext(ctx context.Context) RealtimeLogConfigMapOutput {
return o
}
func (o RealtimeLogConfigMapOutput) MapIndex(k pulumi.StringInput) RealtimeLogConfigOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *RealtimeLogConfig {
return vs[0].(map[string]*RealtimeLogConfig)[vs[1].(string)]
}).(RealtimeLogConfigOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*RealtimeLogConfigInput)(nil)).Elem(), &RealtimeLogConfig{})
pulumi.RegisterInputType(reflect.TypeOf((*RealtimeLogConfigArrayInput)(nil)).Elem(), RealtimeLogConfigArray{})
pulumi.RegisterInputType(reflect.TypeOf((*RealtimeLogConfigMapInput)(nil)).Elem(), RealtimeLogConfigMap{})
pulumi.RegisterOutputType(RealtimeLogConfigOutput{})
pulumi.RegisterOutputType(RealtimeLogConfigArrayOutput{})
pulumi.RegisterOutputType(RealtimeLogConfigMapOutput{})
}