github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/sesv2/emailIdentity.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 sesv2
     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  // Resource for managing an AWS SESv2 (Simple Email V2) Email Identity.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### Basic Usage
    20  //
    21  // ### Email Address Identity
    22  //
    23  // <!--Start PulumiCodeChooser -->
    24  // ```go
    25  // package main
    26  //
    27  // import (
    28  //
    29  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sesv2"
    30  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    31  //
    32  // )
    33  //
    34  //	func main() {
    35  //		pulumi.Run(func(ctx *pulumi.Context) error {
    36  //			_, err := sesv2.NewEmailIdentity(ctx, "example", &sesv2.EmailIdentityArgs{
    37  //				EmailIdentity: pulumi.String("testing@example.com"),
    38  //			})
    39  //			if err != nil {
    40  //				return err
    41  //			}
    42  //			return nil
    43  //		})
    44  //	}
    45  //
    46  // ```
    47  // <!--End PulumiCodeChooser -->
    48  //
    49  // ### Domain Identity
    50  //
    51  // <!--Start PulumiCodeChooser -->
    52  // ```go
    53  // package main
    54  //
    55  // import (
    56  //
    57  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sesv2"
    58  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    59  //
    60  // )
    61  //
    62  //	func main() {
    63  //		pulumi.Run(func(ctx *pulumi.Context) error {
    64  //			_, err := sesv2.NewEmailIdentity(ctx, "example", &sesv2.EmailIdentityArgs{
    65  //				EmailIdentity: pulumi.String("example.com"),
    66  //			})
    67  //			if err != nil {
    68  //				return err
    69  //			}
    70  //			return nil
    71  //		})
    72  //	}
    73  //
    74  // ```
    75  // <!--End PulumiCodeChooser -->
    76  //
    77  // ### Configuration Set
    78  //
    79  // <!--Start PulumiCodeChooser -->
    80  // ```go
    81  // package main
    82  //
    83  // import (
    84  //
    85  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sesv2"
    86  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    87  //
    88  // )
    89  //
    90  //	func main() {
    91  //		pulumi.Run(func(ctx *pulumi.Context) error {
    92  //			example, err := sesv2.NewConfigurationSet(ctx, "example", &sesv2.ConfigurationSetArgs{
    93  //				ConfigurationSetName: pulumi.String("example"),
    94  //			})
    95  //			if err != nil {
    96  //				return err
    97  //			}
    98  //			_, err = sesv2.NewEmailIdentity(ctx, "example", &sesv2.EmailIdentityArgs{
    99  //				EmailIdentity:        pulumi.String("example.com"),
   100  //				ConfigurationSetName: example.ConfigurationSetName,
   101  //			})
   102  //			if err != nil {
   103  //				return err
   104  //			}
   105  //			return nil
   106  //		})
   107  //	}
   108  //
   109  // ```
   110  // <!--End PulumiCodeChooser -->
   111  //
   112  // ### DKIM Signing Attributes (BYODKIM)
   113  //
   114  // <!--Start PulumiCodeChooser -->
   115  // ```go
   116  // package main
   117  //
   118  // import (
   119  //
   120  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sesv2"
   121  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
   122  //
   123  // )
   124  //
   125  //	func main() {
   126  //		pulumi.Run(func(ctx *pulumi.Context) error {
   127  //			_, err := sesv2.NewEmailIdentity(ctx, "example", &sesv2.EmailIdentityArgs{
   128  //				EmailIdentity: pulumi.String("example.com"),
   129  //				DkimSigningAttributes: &sesv2.EmailIdentityDkimSigningAttributesArgs{
   130  //					DomainSigningPrivateKey: pulumi.String("MIIJKAIBAAKCAgEA2Se7p8zvnI4yh+Gh9j2rG5e2aRXjg03Y8saiupLnadPH9xvM..."),
   131  //					DomainSigningSelector:   pulumi.String("example"),
   132  //				},
   133  //			})
   134  //			if err != nil {
   135  //				return err
   136  //			}
   137  //			return nil
   138  //		})
   139  //	}
   140  //
   141  // ```
   142  // <!--End PulumiCodeChooser -->
   143  //
   144  // ## Import
   145  //
   146  // Using `pulumi import`, import SESv2 (Simple Email V2) Email Identity using the `email_identity`. For example:
   147  //
   148  // ```sh
   149  // $ pulumi import aws:sesv2/emailIdentity:EmailIdentity example example.com
   150  // ```
   151  type EmailIdentity struct {
   152  	pulumi.CustomResourceState
   153  
   154  	// ARN of the Email Identity.
   155  	Arn pulumi.StringOutput `pulumi:"arn"`
   156  	// The configuration set to use by default when sending from this identity. Note that any configuration set defined in the email sending request takes precedence.
   157  	ConfigurationSetName pulumi.StringPtrOutput `pulumi:"configurationSetName"`
   158  	// The configuration of the DKIM authentication settings for an email domain identity.
   159  	DkimSigningAttributes EmailIdentityDkimSigningAttributesOutput `pulumi:"dkimSigningAttributes"`
   160  	// The email address or domain to verify.
   161  	//
   162  	// The following arguments are optional:
   163  	EmailIdentity pulumi.StringOutput `pulumi:"emailIdentity"`
   164  	// The email identity type. Valid values: `EMAIL_ADDRESS`, `DOMAIN`.
   165  	IdentityType pulumi.StringOutput `pulumi:"identityType"`
   166  	// Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   167  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   168  	// 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.StringMapOutput `pulumi:"tagsAll"`
   172  	// Specifies whether or not the identity is verified.
   173  	VerifiedForSendingStatus pulumi.BoolOutput `pulumi:"verifiedForSendingStatus"`
   174  }
   175  
   176  // NewEmailIdentity registers a new resource with the given unique name, arguments, and options.
   177  func NewEmailIdentity(ctx *pulumi.Context,
   178  	name string, args *EmailIdentityArgs, opts ...pulumi.ResourceOption) (*EmailIdentity, error) {
   179  	if args == nil {
   180  		return nil, errors.New("missing one or more required arguments")
   181  	}
   182  
   183  	if args.EmailIdentity == nil {
   184  		return nil, errors.New("invalid value for required argument 'EmailIdentity'")
   185  	}
   186  	opts = internal.PkgResourceDefaultOpts(opts)
   187  	var resource EmailIdentity
   188  	err := ctx.RegisterResource("aws:sesv2/emailIdentity:EmailIdentity", name, args, &resource, opts...)
   189  	if err != nil {
   190  		return nil, err
   191  	}
   192  	return &resource, nil
   193  }
   194  
   195  // GetEmailIdentity gets an existing EmailIdentity resource's state with the given name, ID, and optional
   196  // state properties that are used to uniquely qualify the lookup (nil if not required).
   197  func GetEmailIdentity(ctx *pulumi.Context,
   198  	name string, id pulumi.IDInput, state *EmailIdentityState, opts ...pulumi.ResourceOption) (*EmailIdentity, error) {
   199  	var resource EmailIdentity
   200  	err := ctx.ReadResource("aws:sesv2/emailIdentity:EmailIdentity", name, id, state, &resource, opts...)
   201  	if err != nil {
   202  		return nil, err
   203  	}
   204  	return &resource, nil
   205  }
   206  
   207  // Input properties used for looking up and filtering EmailIdentity resources.
   208  type emailIdentityState struct {
   209  	// ARN of the Email Identity.
   210  	Arn *string `pulumi:"arn"`
   211  	// The configuration set to use by default when sending from this identity. Note that any configuration set defined in the email sending request takes precedence.
   212  	ConfigurationSetName *string `pulumi:"configurationSetName"`
   213  	// The configuration of the DKIM authentication settings for an email domain identity.
   214  	DkimSigningAttributes *EmailIdentityDkimSigningAttributes `pulumi:"dkimSigningAttributes"`
   215  	// The email address or domain to verify.
   216  	//
   217  	// The following arguments are optional:
   218  	EmailIdentity *string `pulumi:"emailIdentity"`
   219  	// The email identity type. Valid values: `EMAIL_ADDRESS`, `DOMAIN`.
   220  	IdentityType *string `pulumi:"identityType"`
   221  	// Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   222  	Tags map[string]string `pulumi:"tags"`
   223  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   224  	//
   225  	// Deprecated: Please use `tags` instead.
   226  	TagsAll map[string]string `pulumi:"tagsAll"`
   227  	// Specifies whether or not the identity is verified.
   228  	VerifiedForSendingStatus *bool `pulumi:"verifiedForSendingStatus"`
   229  }
   230  
   231  type EmailIdentityState struct {
   232  	// ARN of the Email Identity.
   233  	Arn pulumi.StringPtrInput
   234  	// The configuration set to use by default when sending from this identity. Note that any configuration set defined in the email sending request takes precedence.
   235  	ConfigurationSetName pulumi.StringPtrInput
   236  	// The configuration of the DKIM authentication settings for an email domain identity.
   237  	DkimSigningAttributes EmailIdentityDkimSigningAttributesPtrInput
   238  	// The email address or domain to verify.
   239  	//
   240  	// The following arguments are optional:
   241  	EmailIdentity pulumi.StringPtrInput
   242  	// The email identity type. Valid values: `EMAIL_ADDRESS`, `DOMAIN`.
   243  	IdentityType pulumi.StringPtrInput
   244  	// Key-value mapping of resource tags. 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  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   247  	//
   248  	// Deprecated: Please use `tags` instead.
   249  	TagsAll pulumi.StringMapInput
   250  	// Specifies whether or not the identity is verified.
   251  	VerifiedForSendingStatus pulumi.BoolPtrInput
   252  }
   253  
   254  func (EmailIdentityState) ElementType() reflect.Type {
   255  	return reflect.TypeOf((*emailIdentityState)(nil)).Elem()
   256  }
   257  
   258  type emailIdentityArgs struct {
   259  	// The configuration set to use by default when sending from this identity. Note that any configuration set defined in the email sending request takes precedence.
   260  	ConfigurationSetName *string `pulumi:"configurationSetName"`
   261  	// The configuration of the DKIM authentication settings for an email domain identity.
   262  	DkimSigningAttributes *EmailIdentityDkimSigningAttributes `pulumi:"dkimSigningAttributes"`
   263  	// The email address or domain to verify.
   264  	//
   265  	// The following arguments are optional:
   266  	EmailIdentity string `pulumi:"emailIdentity"`
   267  	// Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   268  	Tags map[string]string `pulumi:"tags"`
   269  }
   270  
   271  // The set of arguments for constructing a EmailIdentity resource.
   272  type EmailIdentityArgs struct {
   273  	// The configuration set to use by default when sending from this identity. Note that any configuration set defined in the email sending request takes precedence.
   274  	ConfigurationSetName pulumi.StringPtrInput
   275  	// The configuration of the DKIM authentication settings for an email domain identity.
   276  	DkimSigningAttributes EmailIdentityDkimSigningAttributesPtrInput
   277  	// The email address or domain to verify.
   278  	//
   279  	// The following arguments are optional:
   280  	EmailIdentity pulumi.StringInput
   281  	// Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   282  	Tags pulumi.StringMapInput
   283  }
   284  
   285  func (EmailIdentityArgs) ElementType() reflect.Type {
   286  	return reflect.TypeOf((*emailIdentityArgs)(nil)).Elem()
   287  }
   288  
   289  type EmailIdentityInput interface {
   290  	pulumi.Input
   291  
   292  	ToEmailIdentityOutput() EmailIdentityOutput
   293  	ToEmailIdentityOutputWithContext(ctx context.Context) EmailIdentityOutput
   294  }
   295  
   296  func (*EmailIdentity) ElementType() reflect.Type {
   297  	return reflect.TypeOf((**EmailIdentity)(nil)).Elem()
   298  }
   299  
   300  func (i *EmailIdentity) ToEmailIdentityOutput() EmailIdentityOutput {
   301  	return i.ToEmailIdentityOutputWithContext(context.Background())
   302  }
   303  
   304  func (i *EmailIdentity) ToEmailIdentityOutputWithContext(ctx context.Context) EmailIdentityOutput {
   305  	return pulumi.ToOutputWithContext(ctx, i).(EmailIdentityOutput)
   306  }
   307  
   308  // EmailIdentityArrayInput is an input type that accepts EmailIdentityArray and EmailIdentityArrayOutput values.
   309  // You can construct a concrete instance of `EmailIdentityArrayInput` via:
   310  //
   311  //	EmailIdentityArray{ EmailIdentityArgs{...} }
   312  type EmailIdentityArrayInput interface {
   313  	pulumi.Input
   314  
   315  	ToEmailIdentityArrayOutput() EmailIdentityArrayOutput
   316  	ToEmailIdentityArrayOutputWithContext(context.Context) EmailIdentityArrayOutput
   317  }
   318  
   319  type EmailIdentityArray []EmailIdentityInput
   320  
   321  func (EmailIdentityArray) ElementType() reflect.Type {
   322  	return reflect.TypeOf((*[]*EmailIdentity)(nil)).Elem()
   323  }
   324  
   325  func (i EmailIdentityArray) ToEmailIdentityArrayOutput() EmailIdentityArrayOutput {
   326  	return i.ToEmailIdentityArrayOutputWithContext(context.Background())
   327  }
   328  
   329  func (i EmailIdentityArray) ToEmailIdentityArrayOutputWithContext(ctx context.Context) EmailIdentityArrayOutput {
   330  	return pulumi.ToOutputWithContext(ctx, i).(EmailIdentityArrayOutput)
   331  }
   332  
   333  // EmailIdentityMapInput is an input type that accepts EmailIdentityMap and EmailIdentityMapOutput values.
   334  // You can construct a concrete instance of `EmailIdentityMapInput` via:
   335  //
   336  //	EmailIdentityMap{ "key": EmailIdentityArgs{...} }
   337  type EmailIdentityMapInput interface {
   338  	pulumi.Input
   339  
   340  	ToEmailIdentityMapOutput() EmailIdentityMapOutput
   341  	ToEmailIdentityMapOutputWithContext(context.Context) EmailIdentityMapOutput
   342  }
   343  
   344  type EmailIdentityMap map[string]EmailIdentityInput
   345  
   346  func (EmailIdentityMap) ElementType() reflect.Type {
   347  	return reflect.TypeOf((*map[string]*EmailIdentity)(nil)).Elem()
   348  }
   349  
   350  func (i EmailIdentityMap) ToEmailIdentityMapOutput() EmailIdentityMapOutput {
   351  	return i.ToEmailIdentityMapOutputWithContext(context.Background())
   352  }
   353  
   354  func (i EmailIdentityMap) ToEmailIdentityMapOutputWithContext(ctx context.Context) EmailIdentityMapOutput {
   355  	return pulumi.ToOutputWithContext(ctx, i).(EmailIdentityMapOutput)
   356  }
   357  
   358  type EmailIdentityOutput struct{ *pulumi.OutputState }
   359  
   360  func (EmailIdentityOutput) ElementType() reflect.Type {
   361  	return reflect.TypeOf((**EmailIdentity)(nil)).Elem()
   362  }
   363  
   364  func (o EmailIdentityOutput) ToEmailIdentityOutput() EmailIdentityOutput {
   365  	return o
   366  }
   367  
   368  func (o EmailIdentityOutput) ToEmailIdentityOutputWithContext(ctx context.Context) EmailIdentityOutput {
   369  	return o
   370  }
   371  
   372  // ARN of the Email Identity.
   373  func (o EmailIdentityOutput) Arn() pulumi.StringOutput {
   374  	return o.ApplyT(func(v *EmailIdentity) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   375  }
   376  
   377  // The configuration set to use by default when sending from this identity. Note that any configuration set defined in the email sending request takes precedence.
   378  func (o EmailIdentityOutput) ConfigurationSetName() pulumi.StringPtrOutput {
   379  	return o.ApplyT(func(v *EmailIdentity) pulumi.StringPtrOutput { return v.ConfigurationSetName }).(pulumi.StringPtrOutput)
   380  }
   381  
   382  // The configuration of the DKIM authentication settings for an email domain identity.
   383  func (o EmailIdentityOutput) DkimSigningAttributes() EmailIdentityDkimSigningAttributesOutput {
   384  	return o.ApplyT(func(v *EmailIdentity) EmailIdentityDkimSigningAttributesOutput { return v.DkimSigningAttributes }).(EmailIdentityDkimSigningAttributesOutput)
   385  }
   386  
   387  // The email address or domain to verify.
   388  //
   389  // The following arguments are optional:
   390  func (o EmailIdentityOutput) EmailIdentity() pulumi.StringOutput {
   391  	return o.ApplyT(func(v *EmailIdentity) pulumi.StringOutput { return v.EmailIdentity }).(pulumi.StringOutput)
   392  }
   393  
   394  // The email identity type. Valid values: `EMAIL_ADDRESS`, `DOMAIN`.
   395  func (o EmailIdentityOutput) IdentityType() pulumi.StringOutput {
   396  	return o.ApplyT(func(v *EmailIdentity) pulumi.StringOutput { return v.IdentityType }).(pulumi.StringOutput)
   397  }
   398  
   399  // Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   400  func (o EmailIdentityOutput) Tags() pulumi.StringMapOutput {
   401  	return o.ApplyT(func(v *EmailIdentity) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   402  }
   403  
   404  // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   405  //
   406  // Deprecated: Please use `tags` instead.
   407  func (o EmailIdentityOutput) TagsAll() pulumi.StringMapOutput {
   408  	return o.ApplyT(func(v *EmailIdentity) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   409  }
   410  
   411  // Specifies whether or not the identity is verified.
   412  func (o EmailIdentityOutput) VerifiedForSendingStatus() pulumi.BoolOutput {
   413  	return o.ApplyT(func(v *EmailIdentity) pulumi.BoolOutput { return v.VerifiedForSendingStatus }).(pulumi.BoolOutput)
   414  }
   415  
   416  type EmailIdentityArrayOutput struct{ *pulumi.OutputState }
   417  
   418  func (EmailIdentityArrayOutput) ElementType() reflect.Type {
   419  	return reflect.TypeOf((*[]*EmailIdentity)(nil)).Elem()
   420  }
   421  
   422  func (o EmailIdentityArrayOutput) ToEmailIdentityArrayOutput() EmailIdentityArrayOutput {
   423  	return o
   424  }
   425  
   426  func (o EmailIdentityArrayOutput) ToEmailIdentityArrayOutputWithContext(ctx context.Context) EmailIdentityArrayOutput {
   427  	return o
   428  }
   429  
   430  func (o EmailIdentityArrayOutput) Index(i pulumi.IntInput) EmailIdentityOutput {
   431  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *EmailIdentity {
   432  		return vs[0].([]*EmailIdentity)[vs[1].(int)]
   433  	}).(EmailIdentityOutput)
   434  }
   435  
   436  type EmailIdentityMapOutput struct{ *pulumi.OutputState }
   437  
   438  func (EmailIdentityMapOutput) ElementType() reflect.Type {
   439  	return reflect.TypeOf((*map[string]*EmailIdentity)(nil)).Elem()
   440  }
   441  
   442  func (o EmailIdentityMapOutput) ToEmailIdentityMapOutput() EmailIdentityMapOutput {
   443  	return o
   444  }
   445  
   446  func (o EmailIdentityMapOutput) ToEmailIdentityMapOutputWithContext(ctx context.Context) EmailIdentityMapOutput {
   447  	return o
   448  }
   449  
   450  func (o EmailIdentityMapOutput) MapIndex(k pulumi.StringInput) EmailIdentityOutput {
   451  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *EmailIdentity {
   452  		return vs[0].(map[string]*EmailIdentity)[vs[1].(string)]
   453  	}).(EmailIdentityOutput)
   454  }
   455  
   456  func init() {
   457  	pulumi.RegisterInputType(reflect.TypeOf((*EmailIdentityInput)(nil)).Elem(), &EmailIdentity{})
   458  	pulumi.RegisterInputType(reflect.TypeOf((*EmailIdentityArrayInput)(nil)).Elem(), EmailIdentityArray{})
   459  	pulumi.RegisterInputType(reflect.TypeOf((*EmailIdentityMapInput)(nil)).Elem(), EmailIdentityMap{})
   460  	pulumi.RegisterOutputType(EmailIdentityOutput{})
   461  	pulumi.RegisterOutputType(EmailIdentityArrayOutput{})
   462  	pulumi.RegisterOutputType(EmailIdentityMapOutput{})
   463  }