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