github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ses/eventDestination.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 ses
     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 an SES event destination
    16  //
    17  // ## Example Usage
    18  //
    19  // ### CloudWatch Destination
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ses"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			_, err := ses.NewEventDestination(ctx, "cloudwatch", &ses.EventDestinationArgs{
    35  //				Name:                 pulumi.String("event-destination-cloudwatch"),
    36  //				ConfigurationSetName: pulumi.Any(example.Name),
    37  //				Enabled:              pulumi.Bool(true),
    38  //				MatchingTypes: pulumi.StringArray{
    39  //					pulumi.String("bounce"),
    40  //					pulumi.String("send"),
    41  //				},
    42  //				CloudwatchDestinations: ses.EventDestinationCloudwatchDestinationArray{
    43  //					&ses.EventDestinationCloudwatchDestinationArgs{
    44  //						DefaultValue:  pulumi.String("default"),
    45  //						DimensionName: pulumi.String("dimension"),
    46  //						ValueSource:   pulumi.String("emailHeader"),
    47  //					},
    48  //				},
    49  //			})
    50  //			if err != nil {
    51  //				return err
    52  //			}
    53  //			return nil
    54  //		})
    55  //	}
    56  //
    57  // ```
    58  // <!--End PulumiCodeChooser -->
    59  //
    60  // ### Kinesis Destination
    61  //
    62  // <!--Start PulumiCodeChooser -->
    63  // ```go
    64  // package main
    65  //
    66  // import (
    67  //
    68  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ses"
    69  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    70  //
    71  // )
    72  //
    73  //	func main() {
    74  //		pulumi.Run(func(ctx *pulumi.Context) error {
    75  //			_, err := ses.NewEventDestination(ctx, "kinesis", &ses.EventDestinationArgs{
    76  //				Name:                 pulumi.String("event-destination-kinesis"),
    77  //				ConfigurationSetName: pulumi.Any(exampleAwsSesConfigurationSet.Name),
    78  //				Enabled:              pulumi.Bool(true),
    79  //				MatchingTypes: pulumi.StringArray{
    80  //					pulumi.String("bounce"),
    81  //					pulumi.String("send"),
    82  //				},
    83  //				KinesisDestination: &ses.EventDestinationKinesisDestinationArgs{
    84  //					StreamArn: pulumi.Any(exampleAwsKinesisFirehoseDeliveryStream.Arn),
    85  //					RoleArn:   pulumi.Any(example.Arn),
    86  //				},
    87  //			})
    88  //			if err != nil {
    89  //				return err
    90  //			}
    91  //			return nil
    92  //		})
    93  //	}
    94  //
    95  // ```
    96  // <!--End PulumiCodeChooser -->
    97  //
    98  // ### SNS Destination
    99  //
   100  // <!--Start PulumiCodeChooser -->
   101  // ```go
   102  // package main
   103  //
   104  // import (
   105  //
   106  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ses"
   107  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
   108  //
   109  // )
   110  //
   111  //	func main() {
   112  //		pulumi.Run(func(ctx *pulumi.Context) error {
   113  //			_, err := ses.NewEventDestination(ctx, "sns", &ses.EventDestinationArgs{
   114  //				Name:                 pulumi.String("event-destination-sns"),
   115  //				ConfigurationSetName: pulumi.Any(exampleAwsSesConfigurationSet.Name),
   116  //				Enabled:              pulumi.Bool(true),
   117  //				MatchingTypes: pulumi.StringArray{
   118  //					pulumi.String("bounce"),
   119  //					pulumi.String("send"),
   120  //				},
   121  //				SnsDestination: &ses.EventDestinationSnsDestinationArgs{
   122  //					TopicArn: pulumi.Any(example.Arn),
   123  //				},
   124  //			})
   125  //			if err != nil {
   126  //				return err
   127  //			}
   128  //			return nil
   129  //		})
   130  //	}
   131  //
   132  // ```
   133  // <!--End PulumiCodeChooser -->
   134  //
   135  // ## Import
   136  //
   137  // Using `pulumi import`, import SES event destinations using `configuration_set_name` together with the event destination's `name`. For example:
   138  //
   139  // ```sh
   140  // $ pulumi import aws:ses/eventDestination:EventDestination sns some-configuration-set-test/event-destination-sns
   141  // ```
   142  type EventDestination struct {
   143  	pulumi.CustomResourceState
   144  
   145  	// The SES event destination ARN.
   146  	Arn pulumi.StringOutput `pulumi:"arn"`
   147  	// CloudWatch destination for the events
   148  	CloudwatchDestinations EventDestinationCloudwatchDestinationArrayOutput `pulumi:"cloudwatchDestinations"`
   149  	// The name of the configuration set
   150  	ConfigurationSetName pulumi.StringOutput `pulumi:"configurationSetName"`
   151  	// If true, the event destination will be enabled
   152  	Enabled pulumi.BoolPtrOutput `pulumi:"enabled"`
   153  	// Send the events to a kinesis firehose destination
   154  	KinesisDestination EventDestinationKinesisDestinationPtrOutput `pulumi:"kinesisDestination"`
   155  	// A list of matching types. May be any of `"send"`, `"reject"`, `"bounce"`, `"complaint"`, `"delivery"`, `"open"`, `"click"`, or `"renderingFailure"`.
   156  	MatchingTypes pulumi.StringArrayOutput `pulumi:"matchingTypes"`
   157  	// The name of the event destination
   158  	Name pulumi.StringOutput `pulumi:"name"`
   159  	// Send the events to an SNS Topic destination
   160  	//
   161  	// > **NOTE:** You can specify `"cloudwatchDestination"` or `"kinesisDestination"` but not both
   162  	SnsDestination EventDestinationSnsDestinationPtrOutput `pulumi:"snsDestination"`
   163  }
   164  
   165  // NewEventDestination registers a new resource with the given unique name, arguments, and options.
   166  func NewEventDestination(ctx *pulumi.Context,
   167  	name string, args *EventDestinationArgs, opts ...pulumi.ResourceOption) (*EventDestination, error) {
   168  	if args == nil {
   169  		return nil, errors.New("missing one or more required arguments")
   170  	}
   171  
   172  	if args.ConfigurationSetName == nil {
   173  		return nil, errors.New("invalid value for required argument 'ConfigurationSetName'")
   174  	}
   175  	if args.MatchingTypes == nil {
   176  		return nil, errors.New("invalid value for required argument 'MatchingTypes'")
   177  	}
   178  	opts = internal.PkgResourceDefaultOpts(opts)
   179  	var resource EventDestination
   180  	err := ctx.RegisterResource("aws:ses/eventDestination:EventDestination", name, args, &resource, opts...)
   181  	if err != nil {
   182  		return nil, err
   183  	}
   184  	return &resource, nil
   185  }
   186  
   187  // GetEventDestination gets an existing EventDestination resource's state with the given name, ID, and optional
   188  // state properties that are used to uniquely qualify the lookup (nil if not required).
   189  func GetEventDestination(ctx *pulumi.Context,
   190  	name string, id pulumi.IDInput, state *EventDestinationState, opts ...pulumi.ResourceOption) (*EventDestination, error) {
   191  	var resource EventDestination
   192  	err := ctx.ReadResource("aws:ses/eventDestination:EventDestination", name, id, state, &resource, opts...)
   193  	if err != nil {
   194  		return nil, err
   195  	}
   196  	return &resource, nil
   197  }
   198  
   199  // Input properties used for looking up and filtering EventDestination resources.
   200  type eventDestinationState struct {
   201  	// The SES event destination ARN.
   202  	Arn *string `pulumi:"arn"`
   203  	// CloudWatch destination for the events
   204  	CloudwatchDestinations []EventDestinationCloudwatchDestination `pulumi:"cloudwatchDestinations"`
   205  	// The name of the configuration set
   206  	ConfigurationSetName *string `pulumi:"configurationSetName"`
   207  	// If true, the event destination will be enabled
   208  	Enabled *bool `pulumi:"enabled"`
   209  	// Send the events to a kinesis firehose destination
   210  	KinesisDestination *EventDestinationKinesisDestination `pulumi:"kinesisDestination"`
   211  	// A list of matching types. May be any of `"send"`, `"reject"`, `"bounce"`, `"complaint"`, `"delivery"`, `"open"`, `"click"`, or `"renderingFailure"`.
   212  	MatchingTypes []string `pulumi:"matchingTypes"`
   213  	// The name of the event destination
   214  	Name *string `pulumi:"name"`
   215  	// Send the events to an SNS Topic destination
   216  	//
   217  	// > **NOTE:** You can specify `"cloudwatchDestination"` or `"kinesisDestination"` but not both
   218  	SnsDestination *EventDestinationSnsDestination `pulumi:"snsDestination"`
   219  }
   220  
   221  type EventDestinationState struct {
   222  	// The SES event destination ARN.
   223  	Arn pulumi.StringPtrInput
   224  	// CloudWatch destination for the events
   225  	CloudwatchDestinations EventDestinationCloudwatchDestinationArrayInput
   226  	// The name of the configuration set
   227  	ConfigurationSetName pulumi.StringPtrInput
   228  	// If true, the event destination will be enabled
   229  	Enabled pulumi.BoolPtrInput
   230  	// Send the events to a kinesis firehose destination
   231  	KinesisDestination EventDestinationKinesisDestinationPtrInput
   232  	// A list of matching types. May be any of `"send"`, `"reject"`, `"bounce"`, `"complaint"`, `"delivery"`, `"open"`, `"click"`, or `"renderingFailure"`.
   233  	MatchingTypes pulumi.StringArrayInput
   234  	// The name of the event destination
   235  	Name pulumi.StringPtrInput
   236  	// Send the events to an SNS Topic destination
   237  	//
   238  	// > **NOTE:** You can specify `"cloudwatchDestination"` or `"kinesisDestination"` but not both
   239  	SnsDestination EventDestinationSnsDestinationPtrInput
   240  }
   241  
   242  func (EventDestinationState) ElementType() reflect.Type {
   243  	return reflect.TypeOf((*eventDestinationState)(nil)).Elem()
   244  }
   245  
   246  type eventDestinationArgs struct {
   247  	// CloudWatch destination for the events
   248  	CloudwatchDestinations []EventDestinationCloudwatchDestination `pulumi:"cloudwatchDestinations"`
   249  	// The name of the configuration set
   250  	ConfigurationSetName string `pulumi:"configurationSetName"`
   251  	// If true, the event destination will be enabled
   252  	Enabled *bool `pulumi:"enabled"`
   253  	// Send the events to a kinesis firehose destination
   254  	KinesisDestination *EventDestinationKinesisDestination `pulumi:"kinesisDestination"`
   255  	// A list of matching types. May be any of `"send"`, `"reject"`, `"bounce"`, `"complaint"`, `"delivery"`, `"open"`, `"click"`, or `"renderingFailure"`.
   256  	MatchingTypes []string `pulumi:"matchingTypes"`
   257  	// The name of the event destination
   258  	Name *string `pulumi:"name"`
   259  	// Send the events to an SNS Topic destination
   260  	//
   261  	// > **NOTE:** You can specify `"cloudwatchDestination"` or `"kinesisDestination"` but not both
   262  	SnsDestination *EventDestinationSnsDestination `pulumi:"snsDestination"`
   263  }
   264  
   265  // The set of arguments for constructing a EventDestination resource.
   266  type EventDestinationArgs struct {
   267  	// CloudWatch destination for the events
   268  	CloudwatchDestinations EventDestinationCloudwatchDestinationArrayInput
   269  	// The name of the configuration set
   270  	ConfigurationSetName pulumi.StringInput
   271  	// If true, the event destination will be enabled
   272  	Enabled pulumi.BoolPtrInput
   273  	// Send the events to a kinesis firehose destination
   274  	KinesisDestination EventDestinationKinesisDestinationPtrInput
   275  	// A list of matching types. May be any of `"send"`, `"reject"`, `"bounce"`, `"complaint"`, `"delivery"`, `"open"`, `"click"`, or `"renderingFailure"`.
   276  	MatchingTypes pulumi.StringArrayInput
   277  	// The name of the event destination
   278  	Name pulumi.StringPtrInput
   279  	// Send the events to an SNS Topic destination
   280  	//
   281  	// > **NOTE:** You can specify `"cloudwatchDestination"` or `"kinesisDestination"` but not both
   282  	SnsDestination EventDestinationSnsDestinationPtrInput
   283  }
   284  
   285  func (EventDestinationArgs) ElementType() reflect.Type {
   286  	return reflect.TypeOf((*eventDestinationArgs)(nil)).Elem()
   287  }
   288  
   289  type EventDestinationInput interface {
   290  	pulumi.Input
   291  
   292  	ToEventDestinationOutput() EventDestinationOutput
   293  	ToEventDestinationOutputWithContext(ctx context.Context) EventDestinationOutput
   294  }
   295  
   296  func (*EventDestination) ElementType() reflect.Type {
   297  	return reflect.TypeOf((**EventDestination)(nil)).Elem()
   298  }
   299  
   300  func (i *EventDestination) ToEventDestinationOutput() EventDestinationOutput {
   301  	return i.ToEventDestinationOutputWithContext(context.Background())
   302  }
   303  
   304  func (i *EventDestination) ToEventDestinationOutputWithContext(ctx context.Context) EventDestinationOutput {
   305  	return pulumi.ToOutputWithContext(ctx, i).(EventDestinationOutput)
   306  }
   307  
   308  // EventDestinationArrayInput is an input type that accepts EventDestinationArray and EventDestinationArrayOutput values.
   309  // You can construct a concrete instance of `EventDestinationArrayInput` via:
   310  //
   311  //	EventDestinationArray{ EventDestinationArgs{...} }
   312  type EventDestinationArrayInput interface {
   313  	pulumi.Input
   314  
   315  	ToEventDestinationArrayOutput() EventDestinationArrayOutput
   316  	ToEventDestinationArrayOutputWithContext(context.Context) EventDestinationArrayOutput
   317  }
   318  
   319  type EventDestinationArray []EventDestinationInput
   320  
   321  func (EventDestinationArray) ElementType() reflect.Type {
   322  	return reflect.TypeOf((*[]*EventDestination)(nil)).Elem()
   323  }
   324  
   325  func (i EventDestinationArray) ToEventDestinationArrayOutput() EventDestinationArrayOutput {
   326  	return i.ToEventDestinationArrayOutputWithContext(context.Background())
   327  }
   328  
   329  func (i EventDestinationArray) ToEventDestinationArrayOutputWithContext(ctx context.Context) EventDestinationArrayOutput {
   330  	return pulumi.ToOutputWithContext(ctx, i).(EventDestinationArrayOutput)
   331  }
   332  
   333  // EventDestinationMapInput is an input type that accepts EventDestinationMap and EventDestinationMapOutput values.
   334  // You can construct a concrete instance of `EventDestinationMapInput` via:
   335  //
   336  //	EventDestinationMap{ "key": EventDestinationArgs{...} }
   337  type EventDestinationMapInput interface {
   338  	pulumi.Input
   339  
   340  	ToEventDestinationMapOutput() EventDestinationMapOutput
   341  	ToEventDestinationMapOutputWithContext(context.Context) EventDestinationMapOutput
   342  }
   343  
   344  type EventDestinationMap map[string]EventDestinationInput
   345  
   346  func (EventDestinationMap) ElementType() reflect.Type {
   347  	return reflect.TypeOf((*map[string]*EventDestination)(nil)).Elem()
   348  }
   349  
   350  func (i EventDestinationMap) ToEventDestinationMapOutput() EventDestinationMapOutput {
   351  	return i.ToEventDestinationMapOutputWithContext(context.Background())
   352  }
   353  
   354  func (i EventDestinationMap) ToEventDestinationMapOutputWithContext(ctx context.Context) EventDestinationMapOutput {
   355  	return pulumi.ToOutputWithContext(ctx, i).(EventDestinationMapOutput)
   356  }
   357  
   358  type EventDestinationOutput struct{ *pulumi.OutputState }
   359  
   360  func (EventDestinationOutput) ElementType() reflect.Type {
   361  	return reflect.TypeOf((**EventDestination)(nil)).Elem()
   362  }
   363  
   364  func (o EventDestinationOutput) ToEventDestinationOutput() EventDestinationOutput {
   365  	return o
   366  }
   367  
   368  func (o EventDestinationOutput) ToEventDestinationOutputWithContext(ctx context.Context) EventDestinationOutput {
   369  	return o
   370  }
   371  
   372  // The SES event destination ARN.
   373  func (o EventDestinationOutput) Arn() pulumi.StringOutput {
   374  	return o.ApplyT(func(v *EventDestination) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   375  }
   376  
   377  // CloudWatch destination for the events
   378  func (o EventDestinationOutput) CloudwatchDestinations() EventDestinationCloudwatchDestinationArrayOutput {
   379  	return o.ApplyT(func(v *EventDestination) EventDestinationCloudwatchDestinationArrayOutput {
   380  		return v.CloudwatchDestinations
   381  	}).(EventDestinationCloudwatchDestinationArrayOutput)
   382  }
   383  
   384  // The name of the configuration set
   385  func (o EventDestinationOutput) ConfigurationSetName() pulumi.StringOutput {
   386  	return o.ApplyT(func(v *EventDestination) pulumi.StringOutput { return v.ConfigurationSetName }).(pulumi.StringOutput)
   387  }
   388  
   389  // If true, the event destination will be enabled
   390  func (o EventDestinationOutput) Enabled() pulumi.BoolPtrOutput {
   391  	return o.ApplyT(func(v *EventDestination) pulumi.BoolPtrOutput { return v.Enabled }).(pulumi.BoolPtrOutput)
   392  }
   393  
   394  // Send the events to a kinesis firehose destination
   395  func (o EventDestinationOutput) KinesisDestination() EventDestinationKinesisDestinationPtrOutput {
   396  	return o.ApplyT(func(v *EventDestination) EventDestinationKinesisDestinationPtrOutput { return v.KinesisDestination }).(EventDestinationKinesisDestinationPtrOutput)
   397  }
   398  
   399  // A list of matching types. May be any of `"send"`, `"reject"`, `"bounce"`, `"complaint"`, `"delivery"`, `"open"`, `"click"`, or `"renderingFailure"`.
   400  func (o EventDestinationOutput) MatchingTypes() pulumi.StringArrayOutput {
   401  	return o.ApplyT(func(v *EventDestination) pulumi.StringArrayOutput { return v.MatchingTypes }).(pulumi.StringArrayOutput)
   402  }
   403  
   404  // The name of the event destination
   405  func (o EventDestinationOutput) Name() pulumi.StringOutput {
   406  	return o.ApplyT(func(v *EventDestination) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   407  }
   408  
   409  // Send the events to an SNS Topic destination
   410  //
   411  // > **NOTE:** You can specify `"cloudwatchDestination"` or `"kinesisDestination"` but not both
   412  func (o EventDestinationOutput) SnsDestination() EventDestinationSnsDestinationPtrOutput {
   413  	return o.ApplyT(func(v *EventDestination) EventDestinationSnsDestinationPtrOutput { return v.SnsDestination }).(EventDestinationSnsDestinationPtrOutput)
   414  }
   415  
   416  type EventDestinationArrayOutput struct{ *pulumi.OutputState }
   417  
   418  func (EventDestinationArrayOutput) ElementType() reflect.Type {
   419  	return reflect.TypeOf((*[]*EventDestination)(nil)).Elem()
   420  }
   421  
   422  func (o EventDestinationArrayOutput) ToEventDestinationArrayOutput() EventDestinationArrayOutput {
   423  	return o
   424  }
   425  
   426  func (o EventDestinationArrayOutput) ToEventDestinationArrayOutputWithContext(ctx context.Context) EventDestinationArrayOutput {
   427  	return o
   428  }
   429  
   430  func (o EventDestinationArrayOutput) Index(i pulumi.IntInput) EventDestinationOutput {
   431  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *EventDestination {
   432  		return vs[0].([]*EventDestination)[vs[1].(int)]
   433  	}).(EventDestinationOutput)
   434  }
   435  
   436  type EventDestinationMapOutput struct{ *pulumi.OutputState }
   437  
   438  func (EventDestinationMapOutput) ElementType() reflect.Type {
   439  	return reflect.TypeOf((*map[string]*EventDestination)(nil)).Elem()
   440  }
   441  
   442  func (o EventDestinationMapOutput) ToEventDestinationMapOutput() EventDestinationMapOutput {
   443  	return o
   444  }
   445  
   446  func (o EventDestinationMapOutput) ToEventDestinationMapOutputWithContext(ctx context.Context) EventDestinationMapOutput {
   447  	return o
   448  }
   449  
   450  func (o EventDestinationMapOutput) MapIndex(k pulumi.StringInput) EventDestinationOutput {
   451  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *EventDestination {
   452  		return vs[0].(map[string]*EventDestination)[vs[1].(string)]
   453  	}).(EventDestinationOutput)
   454  }
   455  
   456  func init() {
   457  	pulumi.RegisterInputType(reflect.TypeOf((*EventDestinationInput)(nil)).Elem(), &EventDestination{})
   458  	pulumi.RegisterInputType(reflect.TypeOf((*EventDestinationArrayInput)(nil)).Elem(), EventDestinationArray{})
   459  	pulumi.RegisterInputType(reflect.TypeOf((*EventDestinationMapInput)(nil)).Elem(), EventDestinationMap{})
   460  	pulumi.RegisterOutputType(EventDestinationOutput{})
   461  	pulumi.RegisterOutputType(EventDestinationArrayOutput{})
   462  	pulumi.RegisterOutputType(EventDestinationMapOutput{})
   463  }