github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/redshift/eventSubscription.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package redshift 5 6 import ( 7 "context" 8 "reflect" 9 10 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Provides a Redshift event subscription resource. 16 // 17 // ## Example Usage 18 // 19 // <!--Start PulumiCodeChooser --> 20 // ```go 21 // package main 22 // 23 // import ( 24 // 25 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/redshift" 26 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sns" 27 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 28 // 29 // ) 30 // 31 // func main() { 32 // pulumi.Run(func(ctx *pulumi.Context) error { 33 // _, err := redshift.NewCluster(ctx, "default", &redshift.ClusterArgs{ 34 // ClusterIdentifier: pulumi.String("default"), 35 // DatabaseName: pulumi.String("default"), 36 // }) 37 // if err != nil { 38 // return err 39 // } 40 // defaultTopic, err := sns.NewTopic(ctx, "default", &sns.TopicArgs{ 41 // Name: pulumi.String("redshift-events"), 42 // }) 43 // if err != nil { 44 // return err 45 // } 46 // _, err = redshift.NewEventSubscription(ctx, "default", &redshift.EventSubscriptionArgs{ 47 // Name: pulumi.String("redshift-event-sub"), 48 // SnsTopicArn: defaultTopic.Arn, 49 // SourceType: pulumi.String("cluster"), 50 // SourceIds: pulumi.StringArray{ 51 // _default.ID(), 52 // }, 53 // Severity: pulumi.String("INFO"), 54 // EventCategories: pulumi.StringArray{ 55 // pulumi.String("configuration"), 56 // pulumi.String("management"), 57 // pulumi.String("monitoring"), 58 // pulumi.String("security"), 59 // }, 60 // Tags: pulumi.StringMap{ 61 // "Name": pulumi.String("default"), 62 // }, 63 // }) 64 // if err != nil { 65 // return err 66 // } 67 // return nil 68 // }) 69 // } 70 // 71 // ``` 72 // <!--End PulumiCodeChooser --> 73 // 74 // ## Import 75 // 76 // Using `pulumi import`, import Redshift Event Subscriptions using the `name`. For example: 77 // 78 // ```sh 79 // $ pulumi import aws:redshift/eventSubscription:EventSubscription default redshift-event-sub 80 // ``` 81 type EventSubscription struct { 82 pulumi.CustomResourceState 83 84 // Amazon Resource Name (ARN) of the Redshift event notification subscription 85 Arn pulumi.StringOutput `pulumi:"arn"` 86 // The AWS customer account associated with the Redshift event notification subscription 87 CustomerAwsId pulumi.StringOutput `pulumi:"customerAwsId"` 88 // A boolean flag to enable/disable the subscription. Defaults to `true`. 89 Enabled pulumi.BoolPtrOutput `pulumi:"enabled"` 90 // A list of event categories for a SourceType that you want to subscribe to. See https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-event-notifications.html or run `aws redshift describe-event-categories`. 91 EventCategories pulumi.StringArrayOutput `pulumi:"eventCategories"` 92 // The name of the Redshift event subscription. 93 Name pulumi.StringOutput `pulumi:"name"` 94 // The event severity to be published by the notification subscription. Valid options are `INFO` or `ERROR`. Default value of `INFO`. 95 Severity pulumi.StringPtrOutput `pulumi:"severity"` 96 // The ARN of the SNS topic to send events to. 97 SnsTopicArn pulumi.StringOutput `pulumi:"snsTopicArn"` 98 // A list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. If specified, a `sourceType` must also be specified. 99 SourceIds pulumi.StringArrayOutput `pulumi:"sourceIds"` 100 // The type of source that will be generating the events. Valid options are `cluster`, `cluster-parameter-group`, `cluster-security-group`, `cluster-snapshot`, or `scheduled-action`. If not set, all sources will be subscribed to. 101 SourceType pulumi.StringPtrOutput `pulumi:"sourceType"` 102 Status pulumi.StringOutput `pulumi:"status"` 103 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 104 Tags pulumi.StringMapOutput `pulumi:"tags"` 105 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 106 // 107 // Deprecated: Please use `tags` instead. 108 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 109 } 110 111 // NewEventSubscription registers a new resource with the given unique name, arguments, and options. 112 func NewEventSubscription(ctx *pulumi.Context, 113 name string, args *EventSubscriptionArgs, opts ...pulumi.ResourceOption) (*EventSubscription, error) { 114 if args == nil { 115 return nil, errors.New("missing one or more required arguments") 116 } 117 118 if args.SnsTopicArn == nil { 119 return nil, errors.New("invalid value for required argument 'SnsTopicArn'") 120 } 121 opts = internal.PkgResourceDefaultOpts(opts) 122 var resource EventSubscription 123 err := ctx.RegisterResource("aws:redshift/eventSubscription:EventSubscription", name, args, &resource, opts...) 124 if err != nil { 125 return nil, err 126 } 127 return &resource, nil 128 } 129 130 // GetEventSubscription gets an existing EventSubscription resource's state with the given name, ID, and optional 131 // state properties that are used to uniquely qualify the lookup (nil if not required). 132 func GetEventSubscription(ctx *pulumi.Context, 133 name string, id pulumi.IDInput, state *EventSubscriptionState, opts ...pulumi.ResourceOption) (*EventSubscription, error) { 134 var resource EventSubscription 135 err := ctx.ReadResource("aws:redshift/eventSubscription:EventSubscription", name, id, state, &resource, opts...) 136 if err != nil { 137 return nil, err 138 } 139 return &resource, nil 140 } 141 142 // Input properties used for looking up and filtering EventSubscription resources. 143 type eventSubscriptionState struct { 144 // Amazon Resource Name (ARN) of the Redshift event notification subscription 145 Arn *string `pulumi:"arn"` 146 // The AWS customer account associated with the Redshift event notification subscription 147 CustomerAwsId *string `pulumi:"customerAwsId"` 148 // A boolean flag to enable/disable the subscription. Defaults to `true`. 149 Enabled *bool `pulumi:"enabled"` 150 // A list of event categories for a SourceType that you want to subscribe to. See https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-event-notifications.html or run `aws redshift describe-event-categories`. 151 EventCategories []string `pulumi:"eventCategories"` 152 // The name of the Redshift event subscription. 153 Name *string `pulumi:"name"` 154 // The event severity to be published by the notification subscription. Valid options are `INFO` or `ERROR`. Default value of `INFO`. 155 Severity *string `pulumi:"severity"` 156 // The ARN of the SNS topic to send events to. 157 SnsTopicArn *string `pulumi:"snsTopicArn"` 158 // A list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. If specified, a `sourceType` must also be specified. 159 SourceIds []string `pulumi:"sourceIds"` 160 // The type of source that will be generating the events. Valid options are `cluster`, `cluster-parameter-group`, `cluster-security-group`, `cluster-snapshot`, or `scheduled-action`. If not set, all sources will be subscribed to. 161 SourceType *string `pulumi:"sourceType"` 162 Status *string `pulumi:"status"` 163 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 164 Tags map[string]string `pulumi:"tags"` 165 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 166 // 167 // Deprecated: Please use `tags` instead. 168 TagsAll map[string]string `pulumi:"tagsAll"` 169 } 170 171 type EventSubscriptionState struct { 172 // Amazon Resource Name (ARN) of the Redshift event notification subscription 173 Arn pulumi.StringPtrInput 174 // The AWS customer account associated with the Redshift event notification subscription 175 CustomerAwsId pulumi.StringPtrInput 176 // A boolean flag to enable/disable the subscription. Defaults to `true`. 177 Enabled pulumi.BoolPtrInput 178 // A list of event categories for a SourceType that you want to subscribe to. See https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-event-notifications.html or run `aws redshift describe-event-categories`. 179 EventCategories pulumi.StringArrayInput 180 // The name of the Redshift event subscription. 181 Name pulumi.StringPtrInput 182 // The event severity to be published by the notification subscription. Valid options are `INFO` or `ERROR`. Default value of `INFO`. 183 Severity pulumi.StringPtrInput 184 // The ARN of the SNS topic to send events to. 185 SnsTopicArn pulumi.StringPtrInput 186 // A list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. If specified, a `sourceType` must also be specified. 187 SourceIds pulumi.StringArrayInput 188 // The type of source that will be generating the events. Valid options are `cluster`, `cluster-parameter-group`, `cluster-security-group`, `cluster-snapshot`, or `scheduled-action`. If not set, all sources will be subscribed to. 189 SourceType pulumi.StringPtrInput 190 Status pulumi.StringPtrInput 191 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 192 Tags pulumi.StringMapInput 193 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 194 // 195 // Deprecated: Please use `tags` instead. 196 TagsAll pulumi.StringMapInput 197 } 198 199 func (EventSubscriptionState) ElementType() reflect.Type { 200 return reflect.TypeOf((*eventSubscriptionState)(nil)).Elem() 201 } 202 203 type eventSubscriptionArgs struct { 204 // A boolean flag to enable/disable the subscription. Defaults to `true`. 205 Enabled *bool `pulumi:"enabled"` 206 // A list of event categories for a SourceType that you want to subscribe to. See https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-event-notifications.html or run `aws redshift describe-event-categories`. 207 EventCategories []string `pulumi:"eventCategories"` 208 // The name of the Redshift event subscription. 209 Name *string `pulumi:"name"` 210 // The event severity to be published by the notification subscription. Valid options are `INFO` or `ERROR`. Default value of `INFO`. 211 Severity *string `pulumi:"severity"` 212 // The ARN of the SNS topic to send events to. 213 SnsTopicArn string `pulumi:"snsTopicArn"` 214 // A list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. If specified, a `sourceType` must also be specified. 215 SourceIds []string `pulumi:"sourceIds"` 216 // The type of source that will be generating the events. Valid options are `cluster`, `cluster-parameter-group`, `cluster-security-group`, `cluster-snapshot`, or `scheduled-action`. If not set, all sources will be subscribed to. 217 SourceType *string `pulumi:"sourceType"` 218 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 219 Tags map[string]string `pulumi:"tags"` 220 } 221 222 // The set of arguments for constructing a EventSubscription resource. 223 type EventSubscriptionArgs struct { 224 // A boolean flag to enable/disable the subscription. Defaults to `true`. 225 Enabled pulumi.BoolPtrInput 226 // A list of event categories for a SourceType that you want to subscribe to. See https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-event-notifications.html or run `aws redshift describe-event-categories`. 227 EventCategories pulumi.StringArrayInput 228 // The name of the Redshift event subscription. 229 Name pulumi.StringPtrInput 230 // The event severity to be published by the notification subscription. Valid options are `INFO` or `ERROR`. Default value of `INFO`. 231 Severity pulumi.StringPtrInput 232 // The ARN of the SNS topic to send events to. 233 SnsTopicArn pulumi.StringInput 234 // A list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. If specified, a `sourceType` must also be specified. 235 SourceIds pulumi.StringArrayInput 236 // The type of source that will be generating the events. Valid options are `cluster`, `cluster-parameter-group`, `cluster-security-group`, `cluster-snapshot`, or `scheduled-action`. If not set, all sources will be subscribed to. 237 SourceType pulumi.StringPtrInput 238 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 239 Tags pulumi.StringMapInput 240 } 241 242 func (EventSubscriptionArgs) ElementType() reflect.Type { 243 return reflect.TypeOf((*eventSubscriptionArgs)(nil)).Elem() 244 } 245 246 type EventSubscriptionInput interface { 247 pulumi.Input 248 249 ToEventSubscriptionOutput() EventSubscriptionOutput 250 ToEventSubscriptionOutputWithContext(ctx context.Context) EventSubscriptionOutput 251 } 252 253 func (*EventSubscription) ElementType() reflect.Type { 254 return reflect.TypeOf((**EventSubscription)(nil)).Elem() 255 } 256 257 func (i *EventSubscription) ToEventSubscriptionOutput() EventSubscriptionOutput { 258 return i.ToEventSubscriptionOutputWithContext(context.Background()) 259 } 260 261 func (i *EventSubscription) ToEventSubscriptionOutputWithContext(ctx context.Context) EventSubscriptionOutput { 262 return pulumi.ToOutputWithContext(ctx, i).(EventSubscriptionOutput) 263 } 264 265 // EventSubscriptionArrayInput is an input type that accepts EventSubscriptionArray and EventSubscriptionArrayOutput values. 266 // You can construct a concrete instance of `EventSubscriptionArrayInput` via: 267 // 268 // EventSubscriptionArray{ EventSubscriptionArgs{...} } 269 type EventSubscriptionArrayInput interface { 270 pulumi.Input 271 272 ToEventSubscriptionArrayOutput() EventSubscriptionArrayOutput 273 ToEventSubscriptionArrayOutputWithContext(context.Context) EventSubscriptionArrayOutput 274 } 275 276 type EventSubscriptionArray []EventSubscriptionInput 277 278 func (EventSubscriptionArray) ElementType() reflect.Type { 279 return reflect.TypeOf((*[]*EventSubscription)(nil)).Elem() 280 } 281 282 func (i EventSubscriptionArray) ToEventSubscriptionArrayOutput() EventSubscriptionArrayOutput { 283 return i.ToEventSubscriptionArrayOutputWithContext(context.Background()) 284 } 285 286 func (i EventSubscriptionArray) ToEventSubscriptionArrayOutputWithContext(ctx context.Context) EventSubscriptionArrayOutput { 287 return pulumi.ToOutputWithContext(ctx, i).(EventSubscriptionArrayOutput) 288 } 289 290 // EventSubscriptionMapInput is an input type that accepts EventSubscriptionMap and EventSubscriptionMapOutput values. 291 // You can construct a concrete instance of `EventSubscriptionMapInput` via: 292 // 293 // EventSubscriptionMap{ "key": EventSubscriptionArgs{...} } 294 type EventSubscriptionMapInput interface { 295 pulumi.Input 296 297 ToEventSubscriptionMapOutput() EventSubscriptionMapOutput 298 ToEventSubscriptionMapOutputWithContext(context.Context) EventSubscriptionMapOutput 299 } 300 301 type EventSubscriptionMap map[string]EventSubscriptionInput 302 303 func (EventSubscriptionMap) ElementType() reflect.Type { 304 return reflect.TypeOf((*map[string]*EventSubscription)(nil)).Elem() 305 } 306 307 func (i EventSubscriptionMap) ToEventSubscriptionMapOutput() EventSubscriptionMapOutput { 308 return i.ToEventSubscriptionMapOutputWithContext(context.Background()) 309 } 310 311 func (i EventSubscriptionMap) ToEventSubscriptionMapOutputWithContext(ctx context.Context) EventSubscriptionMapOutput { 312 return pulumi.ToOutputWithContext(ctx, i).(EventSubscriptionMapOutput) 313 } 314 315 type EventSubscriptionOutput struct{ *pulumi.OutputState } 316 317 func (EventSubscriptionOutput) ElementType() reflect.Type { 318 return reflect.TypeOf((**EventSubscription)(nil)).Elem() 319 } 320 321 func (o EventSubscriptionOutput) ToEventSubscriptionOutput() EventSubscriptionOutput { 322 return o 323 } 324 325 func (o EventSubscriptionOutput) ToEventSubscriptionOutputWithContext(ctx context.Context) EventSubscriptionOutput { 326 return o 327 } 328 329 // Amazon Resource Name (ARN) of the Redshift event notification subscription 330 func (o EventSubscriptionOutput) Arn() pulumi.StringOutput { 331 return o.ApplyT(func(v *EventSubscription) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 332 } 333 334 // The AWS customer account associated with the Redshift event notification subscription 335 func (o EventSubscriptionOutput) CustomerAwsId() pulumi.StringOutput { 336 return o.ApplyT(func(v *EventSubscription) pulumi.StringOutput { return v.CustomerAwsId }).(pulumi.StringOutput) 337 } 338 339 // A boolean flag to enable/disable the subscription. Defaults to `true`. 340 func (o EventSubscriptionOutput) Enabled() pulumi.BoolPtrOutput { 341 return o.ApplyT(func(v *EventSubscription) pulumi.BoolPtrOutput { return v.Enabled }).(pulumi.BoolPtrOutput) 342 } 343 344 // A list of event categories for a SourceType that you want to subscribe to. See https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-event-notifications.html or run `aws redshift describe-event-categories`. 345 func (o EventSubscriptionOutput) EventCategories() pulumi.StringArrayOutput { 346 return o.ApplyT(func(v *EventSubscription) pulumi.StringArrayOutput { return v.EventCategories }).(pulumi.StringArrayOutput) 347 } 348 349 // The name of the Redshift event subscription. 350 func (o EventSubscriptionOutput) Name() pulumi.StringOutput { 351 return o.ApplyT(func(v *EventSubscription) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 352 } 353 354 // The event severity to be published by the notification subscription. Valid options are `INFO` or `ERROR`. Default value of `INFO`. 355 func (o EventSubscriptionOutput) Severity() pulumi.StringPtrOutput { 356 return o.ApplyT(func(v *EventSubscription) pulumi.StringPtrOutput { return v.Severity }).(pulumi.StringPtrOutput) 357 } 358 359 // The ARN of the SNS topic to send events to. 360 func (o EventSubscriptionOutput) SnsTopicArn() pulumi.StringOutput { 361 return o.ApplyT(func(v *EventSubscription) pulumi.StringOutput { return v.SnsTopicArn }).(pulumi.StringOutput) 362 } 363 364 // A list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. If specified, a `sourceType` must also be specified. 365 func (o EventSubscriptionOutput) SourceIds() pulumi.StringArrayOutput { 366 return o.ApplyT(func(v *EventSubscription) pulumi.StringArrayOutput { return v.SourceIds }).(pulumi.StringArrayOutput) 367 } 368 369 // The type of source that will be generating the events. Valid options are `cluster`, `cluster-parameter-group`, `cluster-security-group`, `cluster-snapshot`, or `scheduled-action`. If not set, all sources will be subscribed to. 370 func (o EventSubscriptionOutput) SourceType() pulumi.StringPtrOutput { 371 return o.ApplyT(func(v *EventSubscription) pulumi.StringPtrOutput { return v.SourceType }).(pulumi.StringPtrOutput) 372 } 373 374 func (o EventSubscriptionOutput) Status() pulumi.StringOutput { 375 return o.ApplyT(func(v *EventSubscription) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput) 376 } 377 378 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 379 func (o EventSubscriptionOutput) Tags() pulumi.StringMapOutput { 380 return o.ApplyT(func(v *EventSubscription) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 381 } 382 383 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 384 // 385 // Deprecated: Please use `tags` instead. 386 func (o EventSubscriptionOutput) TagsAll() pulumi.StringMapOutput { 387 return o.ApplyT(func(v *EventSubscription) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 388 } 389 390 type EventSubscriptionArrayOutput struct{ *pulumi.OutputState } 391 392 func (EventSubscriptionArrayOutput) ElementType() reflect.Type { 393 return reflect.TypeOf((*[]*EventSubscription)(nil)).Elem() 394 } 395 396 func (o EventSubscriptionArrayOutput) ToEventSubscriptionArrayOutput() EventSubscriptionArrayOutput { 397 return o 398 } 399 400 func (o EventSubscriptionArrayOutput) ToEventSubscriptionArrayOutputWithContext(ctx context.Context) EventSubscriptionArrayOutput { 401 return o 402 } 403 404 func (o EventSubscriptionArrayOutput) Index(i pulumi.IntInput) EventSubscriptionOutput { 405 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *EventSubscription { 406 return vs[0].([]*EventSubscription)[vs[1].(int)] 407 }).(EventSubscriptionOutput) 408 } 409 410 type EventSubscriptionMapOutput struct{ *pulumi.OutputState } 411 412 func (EventSubscriptionMapOutput) ElementType() reflect.Type { 413 return reflect.TypeOf((*map[string]*EventSubscription)(nil)).Elem() 414 } 415 416 func (o EventSubscriptionMapOutput) ToEventSubscriptionMapOutput() EventSubscriptionMapOutput { 417 return o 418 } 419 420 func (o EventSubscriptionMapOutput) ToEventSubscriptionMapOutputWithContext(ctx context.Context) EventSubscriptionMapOutput { 421 return o 422 } 423 424 func (o EventSubscriptionMapOutput) MapIndex(k pulumi.StringInput) EventSubscriptionOutput { 425 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *EventSubscription { 426 return vs[0].(map[string]*EventSubscription)[vs[1].(string)] 427 }).(EventSubscriptionOutput) 428 } 429 430 func init() { 431 pulumi.RegisterInputType(reflect.TypeOf((*EventSubscriptionInput)(nil)).Elem(), &EventSubscription{}) 432 pulumi.RegisterInputType(reflect.TypeOf((*EventSubscriptionArrayInput)(nil)).Elem(), EventSubscriptionArray{}) 433 pulumi.RegisterInputType(reflect.TypeOf((*EventSubscriptionMapInput)(nil)).Elem(), EventSubscriptionMap{}) 434 pulumi.RegisterOutputType(EventSubscriptionOutput{}) 435 pulumi.RegisterOutputType(EventSubscriptionArrayOutput{}) 436 pulumi.RegisterOutputType(EventSubscriptionMapOutput{}) 437 }