github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/docdb/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 docdb 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 DocumentDB 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/docdb" 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 // example, err := docdb.NewCluster(ctx, "example", &docdb.ClusterArgs{ 34 // ClusterIdentifier: pulumi.String("example"), 35 // AvailabilityZones: pulumi.StringArray{ 36 // available.Names[0], 37 // available.Names[1], 38 // available.Names[2], 39 // }, 40 // MasterUsername: pulumi.String("foo"), 41 // MasterPassword: pulumi.String("mustbeeightcharaters"), 42 // SkipFinalSnapshot: pulumi.Bool(true), 43 // }) 44 // if err != nil { 45 // return err 46 // } 47 // exampleTopic, err := sns.NewTopic(ctx, "example", &sns.TopicArgs{ 48 // Name: pulumi.String("example-events"), 49 // }) 50 // if err != nil { 51 // return err 52 // } 53 // _, err = docdb.NewEventSubscription(ctx, "example", &docdb.EventSubscriptionArgs{ 54 // Name: pulumi.String("example"), 55 // Enabled: pulumi.Bool(true), 56 // EventCategories: pulumi.StringArray{ 57 // pulumi.String("creation"), 58 // pulumi.String("failure"), 59 // }, 60 // SourceType: pulumi.String("db-cluster"), 61 // SourceIds: pulumi.StringArray{ 62 // example.ID(), 63 // }, 64 // SnsTopicArn: exampleTopic.Arn, 65 // }) 66 // if err != nil { 67 // return err 68 // } 69 // return nil 70 // }) 71 // } 72 // 73 // ``` 74 // <!--End PulumiCodeChooser --> 75 // 76 // ## Import 77 // 78 // Using `pulumi import`, import DocumentDB Event Subscriptions using the `name`. For example: 79 // 80 // ```sh 81 // $ pulumi import aws:docdb/eventSubscription:EventSubscription example event-sub 82 // ``` 83 type EventSubscription struct { 84 pulumi.CustomResourceState 85 86 // The Amazon Resource Name of the DocumentDB event notification subscription 87 Arn pulumi.StringOutput `pulumi:"arn"` 88 // The AWS customer account associated with the DocumentDB event notification subscription 89 CustomerAwsId pulumi.StringOutput `pulumi:"customerAwsId"` 90 // A boolean flag to enable/disable the subscription. Defaults to true. 91 Enabled pulumi.BoolPtrOutput `pulumi:"enabled"` 92 // A list of event categories for a SourceType that you want to subscribe to. See https://docs.aws.amazon.com/documentdb/latest/developerguide/API_Event.html or run `aws docdb describe-event-categories`. 93 EventCategories pulumi.StringArrayOutput `pulumi:"eventCategories"` 94 // The name of the DocumentDB event subscription. By default generated by this provider. 95 Name pulumi.StringOutput `pulumi:"name"` 96 // The name of the DocumentDB event subscription. Conflicts with `name`. 97 NamePrefix pulumi.StringOutput `pulumi:"namePrefix"` 98 SnsTopicArn pulumi.StringOutput `pulumi:"snsTopicArn"` 99 // 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. 100 SourceIds pulumi.StringArrayOutput `pulumi:"sourceIds"` 101 // The type of source that will be generating the events. Valid options are `db-instance`, `db-cluster`, `db-parameter-group`, `db-security-group`,` db-cluster-snapshot `. If not set, all sources will be subscribed to. 102 SourceType pulumi.StringPtrOutput `pulumi:"sourceType"` 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:docdb/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:docdb/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 // The Amazon Resource Name of the DocumentDB event notification subscription 145 Arn *string `pulumi:"arn"` 146 // The AWS customer account associated with the DocumentDB 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/documentdb/latest/developerguide/API_Event.html or run `aws docdb describe-event-categories`. 151 EventCategories []string `pulumi:"eventCategories"` 152 // The name of the DocumentDB event subscription. By default generated by this provider. 153 Name *string `pulumi:"name"` 154 // The name of the DocumentDB event subscription. Conflicts with `name`. 155 NamePrefix *string `pulumi:"namePrefix"` 156 SnsTopicArn *string `pulumi:"snsTopicArn"` 157 // 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. 158 SourceIds []string `pulumi:"sourceIds"` 159 // The type of source that will be generating the events. Valid options are `db-instance`, `db-cluster`, `db-parameter-group`, `db-security-group`,` db-cluster-snapshot `. If not set, all sources will be subscribed to. 160 SourceType *string `pulumi:"sourceType"` 161 // 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. 162 Tags map[string]string `pulumi:"tags"` 163 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 164 // 165 // Deprecated: Please use `tags` instead. 166 TagsAll map[string]string `pulumi:"tagsAll"` 167 } 168 169 type EventSubscriptionState struct { 170 // The Amazon Resource Name of the DocumentDB event notification subscription 171 Arn pulumi.StringPtrInput 172 // The AWS customer account associated with the DocumentDB event notification subscription 173 CustomerAwsId pulumi.StringPtrInput 174 // A boolean flag to enable/disable the subscription. Defaults to true. 175 Enabled pulumi.BoolPtrInput 176 // A list of event categories for a SourceType that you want to subscribe to. See https://docs.aws.amazon.com/documentdb/latest/developerguide/API_Event.html or run `aws docdb describe-event-categories`. 177 EventCategories pulumi.StringArrayInput 178 // The name of the DocumentDB event subscription. By default generated by this provider. 179 Name pulumi.StringPtrInput 180 // The name of the DocumentDB event subscription. Conflicts with `name`. 181 NamePrefix pulumi.StringPtrInput 182 SnsTopicArn pulumi.StringPtrInput 183 // 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. 184 SourceIds pulumi.StringArrayInput 185 // The type of source that will be generating the events. Valid options are `db-instance`, `db-cluster`, `db-parameter-group`, `db-security-group`,` db-cluster-snapshot `. If not set, all sources will be subscribed to. 186 SourceType pulumi.StringPtrInput 187 // 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. 188 Tags pulumi.StringMapInput 189 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 190 // 191 // Deprecated: Please use `tags` instead. 192 TagsAll pulumi.StringMapInput 193 } 194 195 func (EventSubscriptionState) ElementType() reflect.Type { 196 return reflect.TypeOf((*eventSubscriptionState)(nil)).Elem() 197 } 198 199 type eventSubscriptionArgs struct { 200 // A boolean flag to enable/disable the subscription. Defaults to true. 201 Enabled *bool `pulumi:"enabled"` 202 // A list of event categories for a SourceType that you want to subscribe to. See https://docs.aws.amazon.com/documentdb/latest/developerguide/API_Event.html or run `aws docdb describe-event-categories`. 203 EventCategories []string `pulumi:"eventCategories"` 204 // The name of the DocumentDB event subscription. By default generated by this provider. 205 Name *string `pulumi:"name"` 206 // The name of the DocumentDB event subscription. Conflicts with `name`. 207 NamePrefix *string `pulumi:"namePrefix"` 208 SnsTopicArn string `pulumi:"snsTopicArn"` 209 // 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. 210 SourceIds []string `pulumi:"sourceIds"` 211 // The type of source that will be generating the events. Valid options are `db-instance`, `db-cluster`, `db-parameter-group`, `db-security-group`,` db-cluster-snapshot `. If not set, all sources will be subscribed to. 212 SourceType *string `pulumi:"sourceType"` 213 // 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. 214 Tags map[string]string `pulumi:"tags"` 215 } 216 217 // The set of arguments for constructing a EventSubscription resource. 218 type EventSubscriptionArgs struct { 219 // A boolean flag to enable/disable the subscription. Defaults to true. 220 Enabled pulumi.BoolPtrInput 221 // A list of event categories for a SourceType that you want to subscribe to. See https://docs.aws.amazon.com/documentdb/latest/developerguide/API_Event.html or run `aws docdb describe-event-categories`. 222 EventCategories pulumi.StringArrayInput 223 // The name of the DocumentDB event subscription. By default generated by this provider. 224 Name pulumi.StringPtrInput 225 // The name of the DocumentDB event subscription. Conflicts with `name`. 226 NamePrefix pulumi.StringPtrInput 227 SnsTopicArn pulumi.StringInput 228 // 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. 229 SourceIds pulumi.StringArrayInput 230 // The type of source that will be generating the events. Valid options are `db-instance`, `db-cluster`, `db-parameter-group`, `db-security-group`,` db-cluster-snapshot `. If not set, all sources will be subscribed to. 231 SourceType pulumi.StringPtrInput 232 // 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. 233 Tags pulumi.StringMapInput 234 } 235 236 func (EventSubscriptionArgs) ElementType() reflect.Type { 237 return reflect.TypeOf((*eventSubscriptionArgs)(nil)).Elem() 238 } 239 240 type EventSubscriptionInput interface { 241 pulumi.Input 242 243 ToEventSubscriptionOutput() EventSubscriptionOutput 244 ToEventSubscriptionOutputWithContext(ctx context.Context) EventSubscriptionOutput 245 } 246 247 func (*EventSubscription) ElementType() reflect.Type { 248 return reflect.TypeOf((**EventSubscription)(nil)).Elem() 249 } 250 251 func (i *EventSubscription) ToEventSubscriptionOutput() EventSubscriptionOutput { 252 return i.ToEventSubscriptionOutputWithContext(context.Background()) 253 } 254 255 func (i *EventSubscription) ToEventSubscriptionOutputWithContext(ctx context.Context) EventSubscriptionOutput { 256 return pulumi.ToOutputWithContext(ctx, i).(EventSubscriptionOutput) 257 } 258 259 // EventSubscriptionArrayInput is an input type that accepts EventSubscriptionArray and EventSubscriptionArrayOutput values. 260 // You can construct a concrete instance of `EventSubscriptionArrayInput` via: 261 // 262 // EventSubscriptionArray{ EventSubscriptionArgs{...} } 263 type EventSubscriptionArrayInput interface { 264 pulumi.Input 265 266 ToEventSubscriptionArrayOutput() EventSubscriptionArrayOutput 267 ToEventSubscriptionArrayOutputWithContext(context.Context) EventSubscriptionArrayOutput 268 } 269 270 type EventSubscriptionArray []EventSubscriptionInput 271 272 func (EventSubscriptionArray) ElementType() reflect.Type { 273 return reflect.TypeOf((*[]*EventSubscription)(nil)).Elem() 274 } 275 276 func (i EventSubscriptionArray) ToEventSubscriptionArrayOutput() EventSubscriptionArrayOutput { 277 return i.ToEventSubscriptionArrayOutputWithContext(context.Background()) 278 } 279 280 func (i EventSubscriptionArray) ToEventSubscriptionArrayOutputWithContext(ctx context.Context) EventSubscriptionArrayOutput { 281 return pulumi.ToOutputWithContext(ctx, i).(EventSubscriptionArrayOutput) 282 } 283 284 // EventSubscriptionMapInput is an input type that accepts EventSubscriptionMap and EventSubscriptionMapOutput values. 285 // You can construct a concrete instance of `EventSubscriptionMapInput` via: 286 // 287 // EventSubscriptionMap{ "key": EventSubscriptionArgs{...} } 288 type EventSubscriptionMapInput interface { 289 pulumi.Input 290 291 ToEventSubscriptionMapOutput() EventSubscriptionMapOutput 292 ToEventSubscriptionMapOutputWithContext(context.Context) EventSubscriptionMapOutput 293 } 294 295 type EventSubscriptionMap map[string]EventSubscriptionInput 296 297 func (EventSubscriptionMap) ElementType() reflect.Type { 298 return reflect.TypeOf((*map[string]*EventSubscription)(nil)).Elem() 299 } 300 301 func (i EventSubscriptionMap) ToEventSubscriptionMapOutput() EventSubscriptionMapOutput { 302 return i.ToEventSubscriptionMapOutputWithContext(context.Background()) 303 } 304 305 func (i EventSubscriptionMap) ToEventSubscriptionMapOutputWithContext(ctx context.Context) EventSubscriptionMapOutput { 306 return pulumi.ToOutputWithContext(ctx, i).(EventSubscriptionMapOutput) 307 } 308 309 type EventSubscriptionOutput struct{ *pulumi.OutputState } 310 311 func (EventSubscriptionOutput) ElementType() reflect.Type { 312 return reflect.TypeOf((**EventSubscription)(nil)).Elem() 313 } 314 315 func (o EventSubscriptionOutput) ToEventSubscriptionOutput() EventSubscriptionOutput { 316 return o 317 } 318 319 func (o EventSubscriptionOutput) ToEventSubscriptionOutputWithContext(ctx context.Context) EventSubscriptionOutput { 320 return o 321 } 322 323 // The Amazon Resource Name of the DocumentDB event notification subscription 324 func (o EventSubscriptionOutput) Arn() pulumi.StringOutput { 325 return o.ApplyT(func(v *EventSubscription) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 326 } 327 328 // The AWS customer account associated with the DocumentDB event notification subscription 329 func (o EventSubscriptionOutput) CustomerAwsId() pulumi.StringOutput { 330 return o.ApplyT(func(v *EventSubscription) pulumi.StringOutput { return v.CustomerAwsId }).(pulumi.StringOutput) 331 } 332 333 // A boolean flag to enable/disable the subscription. Defaults to true. 334 func (o EventSubscriptionOutput) Enabled() pulumi.BoolPtrOutput { 335 return o.ApplyT(func(v *EventSubscription) pulumi.BoolPtrOutput { return v.Enabled }).(pulumi.BoolPtrOutput) 336 } 337 338 // A list of event categories for a SourceType that you want to subscribe to. See https://docs.aws.amazon.com/documentdb/latest/developerguide/API_Event.html or run `aws docdb describe-event-categories`. 339 func (o EventSubscriptionOutput) EventCategories() pulumi.StringArrayOutput { 340 return o.ApplyT(func(v *EventSubscription) pulumi.StringArrayOutput { return v.EventCategories }).(pulumi.StringArrayOutput) 341 } 342 343 // The name of the DocumentDB event subscription. By default generated by this provider. 344 func (o EventSubscriptionOutput) Name() pulumi.StringOutput { 345 return o.ApplyT(func(v *EventSubscription) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 346 } 347 348 // The name of the DocumentDB event subscription. Conflicts with `name`. 349 func (o EventSubscriptionOutput) NamePrefix() pulumi.StringOutput { 350 return o.ApplyT(func(v *EventSubscription) pulumi.StringOutput { return v.NamePrefix }).(pulumi.StringOutput) 351 } 352 353 func (o EventSubscriptionOutput) SnsTopicArn() pulumi.StringOutput { 354 return o.ApplyT(func(v *EventSubscription) pulumi.StringOutput { return v.SnsTopicArn }).(pulumi.StringOutput) 355 } 356 357 // 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. 358 func (o EventSubscriptionOutput) SourceIds() pulumi.StringArrayOutput { 359 return o.ApplyT(func(v *EventSubscription) pulumi.StringArrayOutput { return v.SourceIds }).(pulumi.StringArrayOutput) 360 } 361 362 // The type of source that will be generating the events. Valid options are `db-instance`, `db-cluster`, `db-parameter-group`, `db-security-group`,` db-cluster-snapshot `. If not set, all sources will be subscribed to. 363 func (o EventSubscriptionOutput) SourceType() pulumi.StringPtrOutput { 364 return o.ApplyT(func(v *EventSubscription) pulumi.StringPtrOutput { return v.SourceType }).(pulumi.StringPtrOutput) 365 } 366 367 // 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. 368 func (o EventSubscriptionOutput) Tags() pulumi.StringMapOutput { 369 return o.ApplyT(func(v *EventSubscription) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 370 } 371 372 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 373 // 374 // Deprecated: Please use `tags` instead. 375 func (o EventSubscriptionOutput) TagsAll() pulumi.StringMapOutput { 376 return o.ApplyT(func(v *EventSubscription) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 377 } 378 379 type EventSubscriptionArrayOutput struct{ *pulumi.OutputState } 380 381 func (EventSubscriptionArrayOutput) ElementType() reflect.Type { 382 return reflect.TypeOf((*[]*EventSubscription)(nil)).Elem() 383 } 384 385 func (o EventSubscriptionArrayOutput) ToEventSubscriptionArrayOutput() EventSubscriptionArrayOutput { 386 return o 387 } 388 389 func (o EventSubscriptionArrayOutput) ToEventSubscriptionArrayOutputWithContext(ctx context.Context) EventSubscriptionArrayOutput { 390 return o 391 } 392 393 func (o EventSubscriptionArrayOutput) Index(i pulumi.IntInput) EventSubscriptionOutput { 394 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *EventSubscription { 395 return vs[0].([]*EventSubscription)[vs[1].(int)] 396 }).(EventSubscriptionOutput) 397 } 398 399 type EventSubscriptionMapOutput struct{ *pulumi.OutputState } 400 401 func (EventSubscriptionMapOutput) ElementType() reflect.Type { 402 return reflect.TypeOf((*map[string]*EventSubscription)(nil)).Elem() 403 } 404 405 func (o EventSubscriptionMapOutput) ToEventSubscriptionMapOutput() EventSubscriptionMapOutput { 406 return o 407 } 408 409 func (o EventSubscriptionMapOutput) ToEventSubscriptionMapOutputWithContext(ctx context.Context) EventSubscriptionMapOutput { 410 return o 411 } 412 413 func (o EventSubscriptionMapOutput) MapIndex(k pulumi.StringInput) EventSubscriptionOutput { 414 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *EventSubscription { 415 return vs[0].(map[string]*EventSubscription)[vs[1].(string)] 416 }).(EventSubscriptionOutput) 417 } 418 419 func init() { 420 pulumi.RegisterInputType(reflect.TypeOf((*EventSubscriptionInput)(nil)).Elem(), &EventSubscription{}) 421 pulumi.RegisterInputType(reflect.TypeOf((*EventSubscriptionArrayInput)(nil)).Elem(), EventSubscriptionArray{}) 422 pulumi.RegisterInputType(reflect.TypeOf((*EventSubscriptionMapInput)(nil)).Elem(), EventSubscriptionMap{}) 423 pulumi.RegisterOutputType(EventSubscriptionOutput{}) 424 pulumi.RegisterOutputType(EventSubscriptionArrayOutput{}) 425 pulumi.RegisterOutputType(EventSubscriptionMapOutput{}) 426 }