github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/pinpoint/emailChannel.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 pinpoint
     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 Pinpoint Email Channel 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/iam"
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/pinpoint"
    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  //			app, err := pinpoint.NewApp(ctx, "app", nil)
    35  //			if err != nil {
    36  //				return err
    37  //			}
    38  //			assumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
    39  //				Statements: []iam.GetPolicyDocumentStatement{
    40  //					{
    41  //						Effect: pulumi.StringRef("Allow"),
    42  //						Principals: []iam.GetPolicyDocumentStatementPrincipal{
    43  //							{
    44  //								Type: "Service",
    45  //								Identifiers: []string{
    46  //									"pinpoint.amazonaws.com",
    47  //								},
    48  //							},
    49  //						},
    50  //						Actions: []string{
    51  //							"sts:AssumeRole",
    52  //						},
    53  //					},
    54  //				},
    55  //			}, nil)
    56  //			if err != nil {
    57  //				return err
    58  //			}
    59  //			role, err := iam.NewRole(ctx, "role", &iam.RoleArgs{
    60  //				AssumeRolePolicy: pulumi.String(assumeRole.Json),
    61  //			})
    62  //			if err != nil {
    63  //				return err
    64  //			}
    65  //			_, err = pinpoint.NewEmailChannel(ctx, "email", &pinpoint.EmailChannelArgs{
    66  //				ApplicationId: app.ApplicationId,
    67  //				FromAddress:   pulumi.String("user@example.com"),
    68  //				RoleArn:       role.Arn,
    69  //			})
    70  //			if err != nil {
    71  //				return err
    72  //			}
    73  //			_, err = ses.NewDomainIdentity(ctx, "identity", &ses.DomainIdentityArgs{
    74  //				Domain: pulumi.String("example.com"),
    75  //			})
    76  //			if err != nil {
    77  //				return err
    78  //			}
    79  //			rolePolicy, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
    80  //				Statements: []iam.GetPolicyDocumentStatement{
    81  //					{
    82  //						Effect: pulumi.StringRef("Allow"),
    83  //						Actions: []string{
    84  //							"mobileanalytics:PutEvents",
    85  //							"mobileanalytics:PutItems",
    86  //						},
    87  //						Resources: []string{
    88  //							"*",
    89  //						},
    90  //					},
    91  //				},
    92  //			}, nil)
    93  //			if err != nil {
    94  //				return err
    95  //			}
    96  //			_, err = iam.NewRolePolicy(ctx, "role_policy", &iam.RolePolicyArgs{
    97  //				Name:   pulumi.String("role_policy"),
    98  //				Role:   role.ID(),
    99  //				Policy: pulumi.String(rolePolicy.Json),
   100  //			})
   101  //			if err != nil {
   102  //				return err
   103  //			}
   104  //			return nil
   105  //		})
   106  //	}
   107  //
   108  // ```
   109  // <!--End PulumiCodeChooser -->
   110  //
   111  // ## Import
   112  //
   113  // Using `pulumi import`, import Pinpoint Email Channel using the `application-id`. For example:
   114  //
   115  // ```sh
   116  // $ pulumi import aws:pinpoint/emailChannel:EmailChannel email application-id
   117  // ```
   118  type EmailChannel struct {
   119  	pulumi.CustomResourceState
   120  
   121  	// The application ID.
   122  	ApplicationId pulumi.StringOutput `pulumi:"applicationId"`
   123  	// The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel.
   124  	ConfigurationSet pulumi.StringPtrOutput `pulumi:"configurationSet"`
   125  	// Whether the channel is enabled or disabled. Defaults to `true`.
   126  	Enabled pulumi.BoolPtrOutput `pulumi:"enabled"`
   127  	// The email address used to send emails from. You can use email only (`user@example.com`) or friendly address (`User <user@example.com>`). This field comply with [RFC 5322](https://www.ietf.org/rfc/rfc5322.txt).
   128  	FromAddress pulumi.StringOutput `pulumi:"fromAddress"`
   129  	// The ARN of an identity verified with SES.
   130  	Identity pulumi.StringOutput `pulumi:"identity"`
   131  	// Messages per second that can be sent.
   132  	MessagesPerSecond pulumi.IntOutput `pulumi:"messagesPerSecond"`
   133  	// The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service.
   134  	RoleArn pulumi.StringPtrOutput `pulumi:"roleArn"`
   135  }
   136  
   137  // NewEmailChannel registers a new resource with the given unique name, arguments, and options.
   138  func NewEmailChannel(ctx *pulumi.Context,
   139  	name string, args *EmailChannelArgs, opts ...pulumi.ResourceOption) (*EmailChannel, error) {
   140  	if args == nil {
   141  		return nil, errors.New("missing one or more required arguments")
   142  	}
   143  
   144  	if args.ApplicationId == nil {
   145  		return nil, errors.New("invalid value for required argument 'ApplicationId'")
   146  	}
   147  	if args.FromAddress == nil {
   148  		return nil, errors.New("invalid value for required argument 'FromAddress'")
   149  	}
   150  	if args.Identity == nil {
   151  		return nil, errors.New("invalid value for required argument 'Identity'")
   152  	}
   153  	opts = internal.PkgResourceDefaultOpts(opts)
   154  	var resource EmailChannel
   155  	err := ctx.RegisterResource("aws:pinpoint/emailChannel:EmailChannel", name, args, &resource, opts...)
   156  	if err != nil {
   157  		return nil, err
   158  	}
   159  	return &resource, nil
   160  }
   161  
   162  // GetEmailChannel gets an existing EmailChannel resource's state with the given name, ID, and optional
   163  // state properties that are used to uniquely qualify the lookup (nil if not required).
   164  func GetEmailChannel(ctx *pulumi.Context,
   165  	name string, id pulumi.IDInput, state *EmailChannelState, opts ...pulumi.ResourceOption) (*EmailChannel, error) {
   166  	var resource EmailChannel
   167  	err := ctx.ReadResource("aws:pinpoint/emailChannel:EmailChannel", name, id, state, &resource, opts...)
   168  	if err != nil {
   169  		return nil, err
   170  	}
   171  	return &resource, nil
   172  }
   173  
   174  // Input properties used for looking up and filtering EmailChannel resources.
   175  type emailChannelState struct {
   176  	// The application ID.
   177  	ApplicationId *string `pulumi:"applicationId"`
   178  	// The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel.
   179  	ConfigurationSet *string `pulumi:"configurationSet"`
   180  	// Whether the channel is enabled or disabled. Defaults to `true`.
   181  	Enabled *bool `pulumi:"enabled"`
   182  	// The email address used to send emails from. You can use email only (`user@example.com`) or friendly address (`User <user@example.com>`). This field comply with [RFC 5322](https://www.ietf.org/rfc/rfc5322.txt).
   183  	FromAddress *string `pulumi:"fromAddress"`
   184  	// The ARN of an identity verified with SES.
   185  	Identity *string `pulumi:"identity"`
   186  	// Messages per second that can be sent.
   187  	MessagesPerSecond *int `pulumi:"messagesPerSecond"`
   188  	// The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service.
   189  	RoleArn *string `pulumi:"roleArn"`
   190  }
   191  
   192  type EmailChannelState struct {
   193  	// The application ID.
   194  	ApplicationId pulumi.StringPtrInput
   195  	// The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel.
   196  	ConfigurationSet pulumi.StringPtrInput
   197  	// Whether the channel is enabled or disabled. Defaults to `true`.
   198  	Enabled pulumi.BoolPtrInput
   199  	// The email address used to send emails from. You can use email only (`user@example.com`) or friendly address (`User <user@example.com>`). This field comply with [RFC 5322](https://www.ietf.org/rfc/rfc5322.txt).
   200  	FromAddress pulumi.StringPtrInput
   201  	// The ARN of an identity verified with SES.
   202  	Identity pulumi.StringPtrInput
   203  	// Messages per second that can be sent.
   204  	MessagesPerSecond pulumi.IntPtrInput
   205  	// The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service.
   206  	RoleArn pulumi.StringPtrInput
   207  }
   208  
   209  func (EmailChannelState) ElementType() reflect.Type {
   210  	return reflect.TypeOf((*emailChannelState)(nil)).Elem()
   211  }
   212  
   213  type emailChannelArgs struct {
   214  	// The application ID.
   215  	ApplicationId string `pulumi:"applicationId"`
   216  	// The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel.
   217  	ConfigurationSet *string `pulumi:"configurationSet"`
   218  	// Whether the channel is enabled or disabled. Defaults to `true`.
   219  	Enabled *bool `pulumi:"enabled"`
   220  	// The email address used to send emails from. You can use email only (`user@example.com`) or friendly address (`User <user@example.com>`). This field comply with [RFC 5322](https://www.ietf.org/rfc/rfc5322.txt).
   221  	FromAddress string `pulumi:"fromAddress"`
   222  	// The ARN of an identity verified with SES.
   223  	Identity string `pulumi:"identity"`
   224  	// The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service.
   225  	RoleArn *string `pulumi:"roleArn"`
   226  }
   227  
   228  // The set of arguments for constructing a EmailChannel resource.
   229  type EmailChannelArgs struct {
   230  	// The application ID.
   231  	ApplicationId pulumi.StringInput
   232  	// The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel.
   233  	ConfigurationSet pulumi.StringPtrInput
   234  	// Whether the channel is enabled or disabled. Defaults to `true`.
   235  	Enabled pulumi.BoolPtrInput
   236  	// The email address used to send emails from. You can use email only (`user@example.com`) or friendly address (`User <user@example.com>`). This field comply with [RFC 5322](https://www.ietf.org/rfc/rfc5322.txt).
   237  	FromAddress pulumi.StringInput
   238  	// The ARN of an identity verified with SES.
   239  	Identity pulumi.StringInput
   240  	// The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service.
   241  	RoleArn pulumi.StringPtrInput
   242  }
   243  
   244  func (EmailChannelArgs) ElementType() reflect.Type {
   245  	return reflect.TypeOf((*emailChannelArgs)(nil)).Elem()
   246  }
   247  
   248  type EmailChannelInput interface {
   249  	pulumi.Input
   250  
   251  	ToEmailChannelOutput() EmailChannelOutput
   252  	ToEmailChannelOutputWithContext(ctx context.Context) EmailChannelOutput
   253  }
   254  
   255  func (*EmailChannel) ElementType() reflect.Type {
   256  	return reflect.TypeOf((**EmailChannel)(nil)).Elem()
   257  }
   258  
   259  func (i *EmailChannel) ToEmailChannelOutput() EmailChannelOutput {
   260  	return i.ToEmailChannelOutputWithContext(context.Background())
   261  }
   262  
   263  func (i *EmailChannel) ToEmailChannelOutputWithContext(ctx context.Context) EmailChannelOutput {
   264  	return pulumi.ToOutputWithContext(ctx, i).(EmailChannelOutput)
   265  }
   266  
   267  // EmailChannelArrayInput is an input type that accepts EmailChannelArray and EmailChannelArrayOutput values.
   268  // You can construct a concrete instance of `EmailChannelArrayInput` via:
   269  //
   270  //	EmailChannelArray{ EmailChannelArgs{...} }
   271  type EmailChannelArrayInput interface {
   272  	pulumi.Input
   273  
   274  	ToEmailChannelArrayOutput() EmailChannelArrayOutput
   275  	ToEmailChannelArrayOutputWithContext(context.Context) EmailChannelArrayOutput
   276  }
   277  
   278  type EmailChannelArray []EmailChannelInput
   279  
   280  func (EmailChannelArray) ElementType() reflect.Type {
   281  	return reflect.TypeOf((*[]*EmailChannel)(nil)).Elem()
   282  }
   283  
   284  func (i EmailChannelArray) ToEmailChannelArrayOutput() EmailChannelArrayOutput {
   285  	return i.ToEmailChannelArrayOutputWithContext(context.Background())
   286  }
   287  
   288  func (i EmailChannelArray) ToEmailChannelArrayOutputWithContext(ctx context.Context) EmailChannelArrayOutput {
   289  	return pulumi.ToOutputWithContext(ctx, i).(EmailChannelArrayOutput)
   290  }
   291  
   292  // EmailChannelMapInput is an input type that accepts EmailChannelMap and EmailChannelMapOutput values.
   293  // You can construct a concrete instance of `EmailChannelMapInput` via:
   294  //
   295  //	EmailChannelMap{ "key": EmailChannelArgs{...} }
   296  type EmailChannelMapInput interface {
   297  	pulumi.Input
   298  
   299  	ToEmailChannelMapOutput() EmailChannelMapOutput
   300  	ToEmailChannelMapOutputWithContext(context.Context) EmailChannelMapOutput
   301  }
   302  
   303  type EmailChannelMap map[string]EmailChannelInput
   304  
   305  func (EmailChannelMap) ElementType() reflect.Type {
   306  	return reflect.TypeOf((*map[string]*EmailChannel)(nil)).Elem()
   307  }
   308  
   309  func (i EmailChannelMap) ToEmailChannelMapOutput() EmailChannelMapOutput {
   310  	return i.ToEmailChannelMapOutputWithContext(context.Background())
   311  }
   312  
   313  func (i EmailChannelMap) ToEmailChannelMapOutputWithContext(ctx context.Context) EmailChannelMapOutput {
   314  	return pulumi.ToOutputWithContext(ctx, i).(EmailChannelMapOutput)
   315  }
   316  
   317  type EmailChannelOutput struct{ *pulumi.OutputState }
   318  
   319  func (EmailChannelOutput) ElementType() reflect.Type {
   320  	return reflect.TypeOf((**EmailChannel)(nil)).Elem()
   321  }
   322  
   323  func (o EmailChannelOutput) ToEmailChannelOutput() EmailChannelOutput {
   324  	return o
   325  }
   326  
   327  func (o EmailChannelOutput) ToEmailChannelOutputWithContext(ctx context.Context) EmailChannelOutput {
   328  	return o
   329  }
   330  
   331  // The application ID.
   332  func (o EmailChannelOutput) ApplicationId() pulumi.StringOutput {
   333  	return o.ApplyT(func(v *EmailChannel) pulumi.StringOutput { return v.ApplicationId }).(pulumi.StringOutput)
   334  }
   335  
   336  // The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel.
   337  func (o EmailChannelOutput) ConfigurationSet() pulumi.StringPtrOutput {
   338  	return o.ApplyT(func(v *EmailChannel) pulumi.StringPtrOutput { return v.ConfigurationSet }).(pulumi.StringPtrOutput)
   339  }
   340  
   341  // Whether the channel is enabled or disabled. Defaults to `true`.
   342  func (o EmailChannelOutput) Enabled() pulumi.BoolPtrOutput {
   343  	return o.ApplyT(func(v *EmailChannel) pulumi.BoolPtrOutput { return v.Enabled }).(pulumi.BoolPtrOutput)
   344  }
   345  
   346  // The email address used to send emails from. You can use email only (`user@example.com`) or friendly address (`User <user@example.com>`). This field comply with [RFC 5322](https://www.ietf.org/rfc/rfc5322.txt).
   347  func (o EmailChannelOutput) FromAddress() pulumi.StringOutput {
   348  	return o.ApplyT(func(v *EmailChannel) pulumi.StringOutput { return v.FromAddress }).(pulumi.StringOutput)
   349  }
   350  
   351  // The ARN of an identity verified with SES.
   352  func (o EmailChannelOutput) Identity() pulumi.StringOutput {
   353  	return o.ApplyT(func(v *EmailChannel) pulumi.StringOutput { return v.Identity }).(pulumi.StringOutput)
   354  }
   355  
   356  // Messages per second that can be sent.
   357  func (o EmailChannelOutput) MessagesPerSecond() pulumi.IntOutput {
   358  	return o.ApplyT(func(v *EmailChannel) pulumi.IntOutput { return v.MessagesPerSecond }).(pulumi.IntOutput)
   359  }
   360  
   361  // The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service.
   362  func (o EmailChannelOutput) RoleArn() pulumi.StringPtrOutput {
   363  	return o.ApplyT(func(v *EmailChannel) pulumi.StringPtrOutput { return v.RoleArn }).(pulumi.StringPtrOutput)
   364  }
   365  
   366  type EmailChannelArrayOutput struct{ *pulumi.OutputState }
   367  
   368  func (EmailChannelArrayOutput) ElementType() reflect.Type {
   369  	return reflect.TypeOf((*[]*EmailChannel)(nil)).Elem()
   370  }
   371  
   372  func (o EmailChannelArrayOutput) ToEmailChannelArrayOutput() EmailChannelArrayOutput {
   373  	return o
   374  }
   375  
   376  func (o EmailChannelArrayOutput) ToEmailChannelArrayOutputWithContext(ctx context.Context) EmailChannelArrayOutput {
   377  	return o
   378  }
   379  
   380  func (o EmailChannelArrayOutput) Index(i pulumi.IntInput) EmailChannelOutput {
   381  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *EmailChannel {
   382  		return vs[0].([]*EmailChannel)[vs[1].(int)]
   383  	}).(EmailChannelOutput)
   384  }
   385  
   386  type EmailChannelMapOutput struct{ *pulumi.OutputState }
   387  
   388  func (EmailChannelMapOutput) ElementType() reflect.Type {
   389  	return reflect.TypeOf((*map[string]*EmailChannel)(nil)).Elem()
   390  }
   391  
   392  func (o EmailChannelMapOutput) ToEmailChannelMapOutput() EmailChannelMapOutput {
   393  	return o
   394  }
   395  
   396  func (o EmailChannelMapOutput) ToEmailChannelMapOutputWithContext(ctx context.Context) EmailChannelMapOutput {
   397  	return o
   398  }
   399  
   400  func (o EmailChannelMapOutput) MapIndex(k pulumi.StringInput) EmailChannelOutput {
   401  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *EmailChannel {
   402  		return vs[0].(map[string]*EmailChannel)[vs[1].(string)]
   403  	}).(EmailChannelOutput)
   404  }
   405  
   406  func init() {
   407  	pulumi.RegisterInputType(reflect.TypeOf((*EmailChannelInput)(nil)).Elem(), &EmailChannel{})
   408  	pulumi.RegisterInputType(reflect.TypeOf((*EmailChannelArrayInput)(nil)).Elem(), EmailChannelArray{})
   409  	pulumi.RegisterInputType(reflect.TypeOf((*EmailChannelMapInput)(nil)).Elem(), EmailChannelMap{})
   410  	pulumi.RegisterOutputType(EmailChannelOutput{})
   411  	pulumi.RegisterOutputType(EmailChannelArrayOutput{})
   412  	pulumi.RegisterOutputType(EmailChannelMapOutput{})
   413  }