github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/dms/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 dms 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 DMS (Data Migration Service) 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/dms" 26 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 27 // 28 // ) 29 // 30 // func main() { 31 // pulumi.Run(func(ctx *pulumi.Context) error { 32 // _, err := dms.NewEventSubscription(ctx, "example", &dms.EventSubscriptionArgs{ 33 // Enabled: pulumi.Bool(true), 34 // EventCategories: pulumi.StringArray{ 35 // pulumi.String("creation"), 36 // pulumi.String("failure"), 37 // }, 38 // Name: pulumi.String("my-favorite-event-subscription"), 39 // SnsTopicArn: pulumi.Any(exampleAwsSnsTopic.Arn), 40 // SourceIds: pulumi.StringArray{ 41 // exampleAwsDmsReplicationTask.ReplicationTaskId, 42 // }, 43 // SourceType: pulumi.String("replication-task"), 44 // Tags: pulumi.StringMap{ 45 // "Name": pulumi.String("example"), 46 // }, 47 // }) 48 // if err != nil { 49 // return err 50 // } 51 // return nil 52 // }) 53 // } 54 // 55 // ``` 56 // <!--End PulumiCodeChooser --> 57 // 58 // ## Import 59 // 60 // Using `pulumi import`, import event subscriptions using the `name`. For example: 61 // 62 // ```sh 63 // $ pulumi import aws:dms/eventSubscription:EventSubscription test my-awesome-event-subscription 64 // ``` 65 type EventSubscription struct { 66 pulumi.CustomResourceState 67 68 // Amazon Resource Name (ARN) of the DMS Event Subscription. 69 Arn pulumi.StringOutput `pulumi:"arn"` 70 // Whether the event subscription should be enabled. 71 Enabled pulumi.BoolPtrOutput `pulumi:"enabled"` 72 // List of event categories to listen for, see `DescribeEventCategories` for a canonical list. 73 EventCategories pulumi.StringArrayOutput `pulumi:"eventCategories"` 74 // Name of event subscription. 75 Name pulumi.StringOutput `pulumi:"name"` 76 // SNS topic arn to send events on. 77 SnsTopicArn pulumi.StringOutput `pulumi:"snsTopicArn"` 78 // Ids of sources to listen to. If you don't specify a value, notifications are provided for all sources. 79 SourceIds pulumi.StringArrayOutput `pulumi:"sourceIds"` 80 // Type of source for events. Valid values: `replication-instance` or `replication-task` 81 SourceType pulumi.StringOutput `pulumi:"sourceType"` 82 // Map of resource 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. 83 Tags pulumi.StringMapOutput `pulumi:"tags"` 84 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 85 // 86 // Deprecated: Please use `tags` instead. 87 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 88 } 89 90 // NewEventSubscription registers a new resource with the given unique name, arguments, and options. 91 func NewEventSubscription(ctx *pulumi.Context, 92 name string, args *EventSubscriptionArgs, opts ...pulumi.ResourceOption) (*EventSubscription, error) { 93 if args == nil { 94 return nil, errors.New("missing one or more required arguments") 95 } 96 97 if args.EventCategories == nil { 98 return nil, errors.New("invalid value for required argument 'EventCategories'") 99 } 100 if args.SnsTopicArn == nil { 101 return nil, errors.New("invalid value for required argument 'SnsTopicArn'") 102 } 103 if args.SourceType == nil { 104 return nil, errors.New("invalid value for required argument 'SourceType'") 105 } 106 opts = internal.PkgResourceDefaultOpts(opts) 107 var resource EventSubscription 108 err := ctx.RegisterResource("aws:dms/eventSubscription:EventSubscription", name, args, &resource, opts...) 109 if err != nil { 110 return nil, err 111 } 112 return &resource, nil 113 } 114 115 // GetEventSubscription gets an existing EventSubscription resource's state with the given name, ID, and optional 116 // state properties that are used to uniquely qualify the lookup (nil if not required). 117 func GetEventSubscription(ctx *pulumi.Context, 118 name string, id pulumi.IDInput, state *EventSubscriptionState, opts ...pulumi.ResourceOption) (*EventSubscription, error) { 119 var resource EventSubscription 120 err := ctx.ReadResource("aws:dms/eventSubscription:EventSubscription", name, id, state, &resource, opts...) 121 if err != nil { 122 return nil, err 123 } 124 return &resource, nil 125 } 126 127 // Input properties used for looking up and filtering EventSubscription resources. 128 type eventSubscriptionState struct { 129 // Amazon Resource Name (ARN) of the DMS Event Subscription. 130 Arn *string `pulumi:"arn"` 131 // Whether the event subscription should be enabled. 132 Enabled *bool `pulumi:"enabled"` 133 // List of event categories to listen for, see `DescribeEventCategories` for a canonical list. 134 EventCategories []string `pulumi:"eventCategories"` 135 // Name of event subscription. 136 Name *string `pulumi:"name"` 137 // SNS topic arn to send events on. 138 SnsTopicArn *string `pulumi:"snsTopicArn"` 139 // Ids of sources to listen to. If you don't specify a value, notifications are provided for all sources. 140 SourceIds []string `pulumi:"sourceIds"` 141 // Type of source for events. Valid values: `replication-instance` or `replication-task` 142 SourceType *string `pulumi:"sourceType"` 143 // Map of resource 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. 144 Tags map[string]string `pulumi:"tags"` 145 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 146 // 147 // Deprecated: Please use `tags` instead. 148 TagsAll map[string]string `pulumi:"tagsAll"` 149 } 150 151 type EventSubscriptionState struct { 152 // Amazon Resource Name (ARN) of the DMS Event Subscription. 153 Arn pulumi.StringPtrInput 154 // Whether the event subscription should be enabled. 155 Enabled pulumi.BoolPtrInput 156 // List of event categories to listen for, see `DescribeEventCategories` for a canonical list. 157 EventCategories pulumi.StringArrayInput 158 // Name of event subscription. 159 Name pulumi.StringPtrInput 160 // SNS topic arn to send events on. 161 SnsTopicArn pulumi.StringPtrInput 162 // Ids of sources to listen to. If you don't specify a value, notifications are provided for all sources. 163 SourceIds pulumi.StringArrayInput 164 // Type of source for events. Valid values: `replication-instance` or `replication-task` 165 SourceType pulumi.StringPtrInput 166 // Map of resource 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. 167 Tags pulumi.StringMapInput 168 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 169 // 170 // Deprecated: Please use `tags` instead. 171 TagsAll pulumi.StringMapInput 172 } 173 174 func (EventSubscriptionState) ElementType() reflect.Type { 175 return reflect.TypeOf((*eventSubscriptionState)(nil)).Elem() 176 } 177 178 type eventSubscriptionArgs struct { 179 // Whether the event subscription should be enabled. 180 Enabled *bool `pulumi:"enabled"` 181 // List of event categories to listen for, see `DescribeEventCategories` for a canonical list. 182 EventCategories []string `pulumi:"eventCategories"` 183 // Name of event subscription. 184 Name *string `pulumi:"name"` 185 // SNS topic arn to send events on. 186 SnsTopicArn string `pulumi:"snsTopicArn"` 187 // Ids of sources to listen to. If you don't specify a value, notifications are provided for all sources. 188 SourceIds []string `pulumi:"sourceIds"` 189 // Type of source for events. Valid values: `replication-instance` or `replication-task` 190 SourceType string `pulumi:"sourceType"` 191 // Map of resource 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 map[string]string `pulumi:"tags"` 193 } 194 195 // The set of arguments for constructing a EventSubscription resource. 196 type EventSubscriptionArgs struct { 197 // Whether the event subscription should be enabled. 198 Enabled pulumi.BoolPtrInput 199 // List of event categories to listen for, see `DescribeEventCategories` for a canonical list. 200 EventCategories pulumi.StringArrayInput 201 // Name of event subscription. 202 Name pulumi.StringPtrInput 203 // SNS topic arn to send events on. 204 SnsTopicArn pulumi.StringInput 205 // Ids of sources to listen to. If you don't specify a value, notifications are provided for all sources. 206 SourceIds pulumi.StringArrayInput 207 // Type of source for events. Valid values: `replication-instance` or `replication-task` 208 SourceType pulumi.StringInput 209 // Map of resource 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. 210 Tags pulumi.StringMapInput 211 } 212 213 func (EventSubscriptionArgs) ElementType() reflect.Type { 214 return reflect.TypeOf((*eventSubscriptionArgs)(nil)).Elem() 215 } 216 217 type EventSubscriptionInput interface { 218 pulumi.Input 219 220 ToEventSubscriptionOutput() EventSubscriptionOutput 221 ToEventSubscriptionOutputWithContext(ctx context.Context) EventSubscriptionOutput 222 } 223 224 func (*EventSubscription) ElementType() reflect.Type { 225 return reflect.TypeOf((**EventSubscription)(nil)).Elem() 226 } 227 228 func (i *EventSubscription) ToEventSubscriptionOutput() EventSubscriptionOutput { 229 return i.ToEventSubscriptionOutputWithContext(context.Background()) 230 } 231 232 func (i *EventSubscription) ToEventSubscriptionOutputWithContext(ctx context.Context) EventSubscriptionOutput { 233 return pulumi.ToOutputWithContext(ctx, i).(EventSubscriptionOutput) 234 } 235 236 // EventSubscriptionArrayInput is an input type that accepts EventSubscriptionArray and EventSubscriptionArrayOutput values. 237 // You can construct a concrete instance of `EventSubscriptionArrayInput` via: 238 // 239 // EventSubscriptionArray{ EventSubscriptionArgs{...} } 240 type EventSubscriptionArrayInput interface { 241 pulumi.Input 242 243 ToEventSubscriptionArrayOutput() EventSubscriptionArrayOutput 244 ToEventSubscriptionArrayOutputWithContext(context.Context) EventSubscriptionArrayOutput 245 } 246 247 type EventSubscriptionArray []EventSubscriptionInput 248 249 func (EventSubscriptionArray) ElementType() reflect.Type { 250 return reflect.TypeOf((*[]*EventSubscription)(nil)).Elem() 251 } 252 253 func (i EventSubscriptionArray) ToEventSubscriptionArrayOutput() EventSubscriptionArrayOutput { 254 return i.ToEventSubscriptionArrayOutputWithContext(context.Background()) 255 } 256 257 func (i EventSubscriptionArray) ToEventSubscriptionArrayOutputWithContext(ctx context.Context) EventSubscriptionArrayOutput { 258 return pulumi.ToOutputWithContext(ctx, i).(EventSubscriptionArrayOutput) 259 } 260 261 // EventSubscriptionMapInput is an input type that accepts EventSubscriptionMap and EventSubscriptionMapOutput values. 262 // You can construct a concrete instance of `EventSubscriptionMapInput` via: 263 // 264 // EventSubscriptionMap{ "key": EventSubscriptionArgs{...} } 265 type EventSubscriptionMapInput interface { 266 pulumi.Input 267 268 ToEventSubscriptionMapOutput() EventSubscriptionMapOutput 269 ToEventSubscriptionMapOutputWithContext(context.Context) EventSubscriptionMapOutput 270 } 271 272 type EventSubscriptionMap map[string]EventSubscriptionInput 273 274 func (EventSubscriptionMap) ElementType() reflect.Type { 275 return reflect.TypeOf((*map[string]*EventSubscription)(nil)).Elem() 276 } 277 278 func (i EventSubscriptionMap) ToEventSubscriptionMapOutput() EventSubscriptionMapOutput { 279 return i.ToEventSubscriptionMapOutputWithContext(context.Background()) 280 } 281 282 func (i EventSubscriptionMap) ToEventSubscriptionMapOutputWithContext(ctx context.Context) EventSubscriptionMapOutput { 283 return pulumi.ToOutputWithContext(ctx, i).(EventSubscriptionMapOutput) 284 } 285 286 type EventSubscriptionOutput struct{ *pulumi.OutputState } 287 288 func (EventSubscriptionOutput) ElementType() reflect.Type { 289 return reflect.TypeOf((**EventSubscription)(nil)).Elem() 290 } 291 292 func (o EventSubscriptionOutput) ToEventSubscriptionOutput() EventSubscriptionOutput { 293 return o 294 } 295 296 func (o EventSubscriptionOutput) ToEventSubscriptionOutputWithContext(ctx context.Context) EventSubscriptionOutput { 297 return o 298 } 299 300 // Amazon Resource Name (ARN) of the DMS Event Subscription. 301 func (o EventSubscriptionOutput) Arn() pulumi.StringOutput { 302 return o.ApplyT(func(v *EventSubscription) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 303 } 304 305 // Whether the event subscription should be enabled. 306 func (o EventSubscriptionOutput) Enabled() pulumi.BoolPtrOutput { 307 return o.ApplyT(func(v *EventSubscription) pulumi.BoolPtrOutput { return v.Enabled }).(pulumi.BoolPtrOutput) 308 } 309 310 // List of event categories to listen for, see `DescribeEventCategories` for a canonical list. 311 func (o EventSubscriptionOutput) EventCategories() pulumi.StringArrayOutput { 312 return o.ApplyT(func(v *EventSubscription) pulumi.StringArrayOutput { return v.EventCategories }).(pulumi.StringArrayOutput) 313 } 314 315 // Name of event subscription. 316 func (o EventSubscriptionOutput) Name() pulumi.StringOutput { 317 return o.ApplyT(func(v *EventSubscription) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 318 } 319 320 // SNS topic arn to send events on. 321 func (o EventSubscriptionOutput) SnsTopicArn() pulumi.StringOutput { 322 return o.ApplyT(func(v *EventSubscription) pulumi.StringOutput { return v.SnsTopicArn }).(pulumi.StringOutput) 323 } 324 325 // Ids of sources to listen to. If you don't specify a value, notifications are provided for all sources. 326 func (o EventSubscriptionOutput) SourceIds() pulumi.StringArrayOutput { 327 return o.ApplyT(func(v *EventSubscription) pulumi.StringArrayOutput { return v.SourceIds }).(pulumi.StringArrayOutput) 328 } 329 330 // Type of source for events. Valid values: `replication-instance` or `replication-task` 331 func (o EventSubscriptionOutput) SourceType() pulumi.StringOutput { 332 return o.ApplyT(func(v *EventSubscription) pulumi.StringOutput { return v.SourceType }).(pulumi.StringOutput) 333 } 334 335 // Map of resource 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. 336 func (o EventSubscriptionOutput) Tags() pulumi.StringMapOutput { 337 return o.ApplyT(func(v *EventSubscription) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 338 } 339 340 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 341 // 342 // Deprecated: Please use `tags` instead. 343 func (o EventSubscriptionOutput) TagsAll() pulumi.StringMapOutput { 344 return o.ApplyT(func(v *EventSubscription) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 345 } 346 347 type EventSubscriptionArrayOutput struct{ *pulumi.OutputState } 348 349 func (EventSubscriptionArrayOutput) ElementType() reflect.Type { 350 return reflect.TypeOf((*[]*EventSubscription)(nil)).Elem() 351 } 352 353 func (o EventSubscriptionArrayOutput) ToEventSubscriptionArrayOutput() EventSubscriptionArrayOutput { 354 return o 355 } 356 357 func (o EventSubscriptionArrayOutput) ToEventSubscriptionArrayOutputWithContext(ctx context.Context) EventSubscriptionArrayOutput { 358 return o 359 } 360 361 func (o EventSubscriptionArrayOutput) Index(i pulumi.IntInput) EventSubscriptionOutput { 362 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *EventSubscription { 363 return vs[0].([]*EventSubscription)[vs[1].(int)] 364 }).(EventSubscriptionOutput) 365 } 366 367 type EventSubscriptionMapOutput struct{ *pulumi.OutputState } 368 369 func (EventSubscriptionMapOutput) ElementType() reflect.Type { 370 return reflect.TypeOf((*map[string]*EventSubscription)(nil)).Elem() 371 } 372 373 func (o EventSubscriptionMapOutput) ToEventSubscriptionMapOutput() EventSubscriptionMapOutput { 374 return o 375 } 376 377 func (o EventSubscriptionMapOutput) ToEventSubscriptionMapOutputWithContext(ctx context.Context) EventSubscriptionMapOutput { 378 return o 379 } 380 381 func (o EventSubscriptionMapOutput) MapIndex(k pulumi.StringInput) EventSubscriptionOutput { 382 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *EventSubscription { 383 return vs[0].(map[string]*EventSubscription)[vs[1].(string)] 384 }).(EventSubscriptionOutput) 385 } 386 387 func init() { 388 pulumi.RegisterInputType(reflect.TypeOf((*EventSubscriptionInput)(nil)).Elem(), &EventSubscription{}) 389 pulumi.RegisterInputType(reflect.TypeOf((*EventSubscriptionArrayInput)(nil)).Elem(), EventSubscriptionArray{}) 390 pulumi.RegisterInputType(reflect.TypeOf((*EventSubscriptionMapInput)(nil)).Elem(), EventSubscriptionMap{}) 391 pulumi.RegisterOutputType(EventSubscriptionOutput{}) 392 pulumi.RegisterOutputType(EventSubscriptionArrayOutput{}) 393 pulumi.RegisterOutputType(EventSubscriptionMapOutput{}) 394 }