github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ses/domainDkim.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 domain DKIM generation resource.
    16  //
    17  // # Domain ownership needs to be confirmed first using sesDomainIdentity Resource
    18  //
    19  // ## Example Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"fmt"
    28  //
    29  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53"
    30  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ses"
    31  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    32  //
    33  // )
    34  //
    35  //	func main() {
    36  //		pulumi.Run(func(ctx *pulumi.Context) error {
    37  //			example, err := ses.NewDomainIdentity(ctx, "example", &ses.DomainIdentityArgs{
    38  //				Domain: pulumi.String("example.com"),
    39  //			})
    40  //			if err != nil {
    41  //				return err
    42  //			}
    43  //			exampleDomainDkim, err := ses.NewDomainDkim(ctx, "example", &ses.DomainDkimArgs{
    44  //				Domain: example.Domain,
    45  //			})
    46  //			if err != nil {
    47  //				return err
    48  //			}
    49  //			var exampleAmazonsesDkimRecord []*route53.Record
    50  //			for index := 0; index < 3; index++ {
    51  //				key0 := index
    52  //				val0 := index
    53  //				__res, err := route53.NewRecord(ctx, fmt.Sprintf("example_amazonses_dkim_record-%v", key0), &route53.RecordArgs{
    54  //					ZoneId: pulumi.String("ABCDEFGHIJ123"),
    55  //					Name: exampleDomainDkim.DkimTokens.ApplyT(func(dkimTokens []string) (string, error) {
    56  //						return fmt.Sprintf("%v._domainkey", dkimTokens[val0]), nil
    57  //					}).(pulumi.StringOutput),
    58  //					Type: pulumi.String(route53.RecordTypeCNAME),
    59  //					Ttl:  pulumi.Int(600),
    60  //					Records: pulumi.StringArray{
    61  //						exampleDomainDkim.DkimTokens.ApplyT(func(dkimTokens []string) (string, error) {
    62  //							return fmt.Sprintf("%v.dkim.amazonses.com", dkimTokens[val0]), nil
    63  //						}).(pulumi.StringOutput),
    64  //					},
    65  //				})
    66  //				if err != nil {
    67  //					return err
    68  //				}
    69  //				exampleAmazonsesDkimRecord = append(exampleAmazonsesDkimRecord, __res)
    70  //			}
    71  //			return nil
    72  //		})
    73  //	}
    74  //
    75  // ```
    76  // <!--End PulumiCodeChooser -->
    77  //
    78  // ## Import
    79  //
    80  // Using `pulumi import`, import DKIM tokens using the `domain` attribute. For example:
    81  //
    82  // ```sh
    83  // $ pulumi import aws:ses/domainDkim:DomainDkim example example.com
    84  // ```
    85  type DomainDkim struct {
    86  	pulumi.CustomResourceState
    87  
    88  	// DKIM tokens generated by SES.
    89  	// These tokens should be used to create CNAME records used to verify SES Easy DKIM.
    90  	// See below for an example of how this might be achieved
    91  	// when the domain is hosted in Route 53 and managed by this provider.
    92  	// Find out more about verifying domains in Amazon SES
    93  	// in the [AWS SES docs](http://docs.aws.amazon.com/ses/latest/DeveloperGuide/easy-dkim-dns-records.html).
    94  	DkimTokens pulumi.StringArrayOutput `pulumi:"dkimTokens"`
    95  	// Verified domain name to generate DKIM tokens for.
    96  	Domain pulumi.StringOutput `pulumi:"domain"`
    97  }
    98  
    99  // NewDomainDkim registers a new resource with the given unique name, arguments, and options.
   100  func NewDomainDkim(ctx *pulumi.Context,
   101  	name string, args *DomainDkimArgs, opts ...pulumi.ResourceOption) (*DomainDkim, error) {
   102  	if args == nil {
   103  		return nil, errors.New("missing one or more required arguments")
   104  	}
   105  
   106  	if args.Domain == nil {
   107  		return nil, errors.New("invalid value for required argument 'Domain'")
   108  	}
   109  	opts = internal.PkgResourceDefaultOpts(opts)
   110  	var resource DomainDkim
   111  	err := ctx.RegisterResource("aws:ses/domainDkim:DomainDkim", name, args, &resource, opts...)
   112  	if err != nil {
   113  		return nil, err
   114  	}
   115  	return &resource, nil
   116  }
   117  
   118  // GetDomainDkim gets an existing DomainDkim resource's state with the given name, ID, and optional
   119  // state properties that are used to uniquely qualify the lookup (nil if not required).
   120  func GetDomainDkim(ctx *pulumi.Context,
   121  	name string, id pulumi.IDInput, state *DomainDkimState, opts ...pulumi.ResourceOption) (*DomainDkim, error) {
   122  	var resource DomainDkim
   123  	err := ctx.ReadResource("aws:ses/domainDkim:DomainDkim", name, id, state, &resource, opts...)
   124  	if err != nil {
   125  		return nil, err
   126  	}
   127  	return &resource, nil
   128  }
   129  
   130  // Input properties used for looking up and filtering DomainDkim resources.
   131  type domainDkimState struct {
   132  	// DKIM tokens generated by SES.
   133  	// These tokens should be used to create CNAME records used to verify SES Easy DKIM.
   134  	// See below for an example of how this might be achieved
   135  	// when the domain is hosted in Route 53 and managed by this provider.
   136  	// Find out more about verifying domains in Amazon SES
   137  	// in the [AWS SES docs](http://docs.aws.amazon.com/ses/latest/DeveloperGuide/easy-dkim-dns-records.html).
   138  	DkimTokens []string `pulumi:"dkimTokens"`
   139  	// Verified domain name to generate DKIM tokens for.
   140  	Domain *string `pulumi:"domain"`
   141  }
   142  
   143  type DomainDkimState struct {
   144  	// DKIM tokens generated by SES.
   145  	// These tokens should be used to create CNAME records used to verify SES Easy DKIM.
   146  	// See below for an example of how this might be achieved
   147  	// when the domain is hosted in Route 53 and managed by this provider.
   148  	// Find out more about verifying domains in Amazon SES
   149  	// in the [AWS SES docs](http://docs.aws.amazon.com/ses/latest/DeveloperGuide/easy-dkim-dns-records.html).
   150  	DkimTokens pulumi.StringArrayInput
   151  	// Verified domain name to generate DKIM tokens for.
   152  	Domain pulumi.StringPtrInput
   153  }
   154  
   155  func (DomainDkimState) ElementType() reflect.Type {
   156  	return reflect.TypeOf((*domainDkimState)(nil)).Elem()
   157  }
   158  
   159  type domainDkimArgs struct {
   160  	// Verified domain name to generate DKIM tokens for.
   161  	Domain string `pulumi:"domain"`
   162  }
   163  
   164  // The set of arguments for constructing a DomainDkim resource.
   165  type DomainDkimArgs struct {
   166  	// Verified domain name to generate DKIM tokens for.
   167  	Domain pulumi.StringInput
   168  }
   169  
   170  func (DomainDkimArgs) ElementType() reflect.Type {
   171  	return reflect.TypeOf((*domainDkimArgs)(nil)).Elem()
   172  }
   173  
   174  type DomainDkimInput interface {
   175  	pulumi.Input
   176  
   177  	ToDomainDkimOutput() DomainDkimOutput
   178  	ToDomainDkimOutputWithContext(ctx context.Context) DomainDkimOutput
   179  }
   180  
   181  func (*DomainDkim) ElementType() reflect.Type {
   182  	return reflect.TypeOf((**DomainDkim)(nil)).Elem()
   183  }
   184  
   185  func (i *DomainDkim) ToDomainDkimOutput() DomainDkimOutput {
   186  	return i.ToDomainDkimOutputWithContext(context.Background())
   187  }
   188  
   189  func (i *DomainDkim) ToDomainDkimOutputWithContext(ctx context.Context) DomainDkimOutput {
   190  	return pulumi.ToOutputWithContext(ctx, i).(DomainDkimOutput)
   191  }
   192  
   193  // DomainDkimArrayInput is an input type that accepts DomainDkimArray and DomainDkimArrayOutput values.
   194  // You can construct a concrete instance of `DomainDkimArrayInput` via:
   195  //
   196  //	DomainDkimArray{ DomainDkimArgs{...} }
   197  type DomainDkimArrayInput interface {
   198  	pulumi.Input
   199  
   200  	ToDomainDkimArrayOutput() DomainDkimArrayOutput
   201  	ToDomainDkimArrayOutputWithContext(context.Context) DomainDkimArrayOutput
   202  }
   203  
   204  type DomainDkimArray []DomainDkimInput
   205  
   206  func (DomainDkimArray) ElementType() reflect.Type {
   207  	return reflect.TypeOf((*[]*DomainDkim)(nil)).Elem()
   208  }
   209  
   210  func (i DomainDkimArray) ToDomainDkimArrayOutput() DomainDkimArrayOutput {
   211  	return i.ToDomainDkimArrayOutputWithContext(context.Background())
   212  }
   213  
   214  func (i DomainDkimArray) ToDomainDkimArrayOutputWithContext(ctx context.Context) DomainDkimArrayOutput {
   215  	return pulumi.ToOutputWithContext(ctx, i).(DomainDkimArrayOutput)
   216  }
   217  
   218  // DomainDkimMapInput is an input type that accepts DomainDkimMap and DomainDkimMapOutput values.
   219  // You can construct a concrete instance of `DomainDkimMapInput` via:
   220  //
   221  //	DomainDkimMap{ "key": DomainDkimArgs{...} }
   222  type DomainDkimMapInput interface {
   223  	pulumi.Input
   224  
   225  	ToDomainDkimMapOutput() DomainDkimMapOutput
   226  	ToDomainDkimMapOutputWithContext(context.Context) DomainDkimMapOutput
   227  }
   228  
   229  type DomainDkimMap map[string]DomainDkimInput
   230  
   231  func (DomainDkimMap) ElementType() reflect.Type {
   232  	return reflect.TypeOf((*map[string]*DomainDkim)(nil)).Elem()
   233  }
   234  
   235  func (i DomainDkimMap) ToDomainDkimMapOutput() DomainDkimMapOutput {
   236  	return i.ToDomainDkimMapOutputWithContext(context.Background())
   237  }
   238  
   239  func (i DomainDkimMap) ToDomainDkimMapOutputWithContext(ctx context.Context) DomainDkimMapOutput {
   240  	return pulumi.ToOutputWithContext(ctx, i).(DomainDkimMapOutput)
   241  }
   242  
   243  type DomainDkimOutput struct{ *pulumi.OutputState }
   244  
   245  func (DomainDkimOutput) ElementType() reflect.Type {
   246  	return reflect.TypeOf((**DomainDkim)(nil)).Elem()
   247  }
   248  
   249  func (o DomainDkimOutput) ToDomainDkimOutput() DomainDkimOutput {
   250  	return o
   251  }
   252  
   253  func (o DomainDkimOutput) ToDomainDkimOutputWithContext(ctx context.Context) DomainDkimOutput {
   254  	return o
   255  }
   256  
   257  // DKIM tokens generated by SES.
   258  // These tokens should be used to create CNAME records used to verify SES Easy DKIM.
   259  // See below for an example of how this might be achieved
   260  // when the domain is hosted in Route 53 and managed by this provider.
   261  // Find out more about verifying domains in Amazon SES
   262  // in the [AWS SES docs](http://docs.aws.amazon.com/ses/latest/DeveloperGuide/easy-dkim-dns-records.html).
   263  func (o DomainDkimOutput) DkimTokens() pulumi.StringArrayOutput {
   264  	return o.ApplyT(func(v *DomainDkim) pulumi.StringArrayOutput { return v.DkimTokens }).(pulumi.StringArrayOutput)
   265  }
   266  
   267  // Verified domain name to generate DKIM tokens for.
   268  func (o DomainDkimOutput) Domain() pulumi.StringOutput {
   269  	return o.ApplyT(func(v *DomainDkim) pulumi.StringOutput { return v.Domain }).(pulumi.StringOutput)
   270  }
   271  
   272  type DomainDkimArrayOutput struct{ *pulumi.OutputState }
   273  
   274  func (DomainDkimArrayOutput) ElementType() reflect.Type {
   275  	return reflect.TypeOf((*[]*DomainDkim)(nil)).Elem()
   276  }
   277  
   278  func (o DomainDkimArrayOutput) ToDomainDkimArrayOutput() DomainDkimArrayOutput {
   279  	return o
   280  }
   281  
   282  func (o DomainDkimArrayOutput) ToDomainDkimArrayOutputWithContext(ctx context.Context) DomainDkimArrayOutput {
   283  	return o
   284  }
   285  
   286  func (o DomainDkimArrayOutput) Index(i pulumi.IntInput) DomainDkimOutput {
   287  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *DomainDkim {
   288  		return vs[0].([]*DomainDkim)[vs[1].(int)]
   289  	}).(DomainDkimOutput)
   290  }
   291  
   292  type DomainDkimMapOutput struct{ *pulumi.OutputState }
   293  
   294  func (DomainDkimMapOutput) ElementType() reflect.Type {
   295  	return reflect.TypeOf((*map[string]*DomainDkim)(nil)).Elem()
   296  }
   297  
   298  func (o DomainDkimMapOutput) ToDomainDkimMapOutput() DomainDkimMapOutput {
   299  	return o
   300  }
   301  
   302  func (o DomainDkimMapOutput) ToDomainDkimMapOutputWithContext(ctx context.Context) DomainDkimMapOutput {
   303  	return o
   304  }
   305  
   306  func (o DomainDkimMapOutput) MapIndex(k pulumi.StringInput) DomainDkimOutput {
   307  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *DomainDkim {
   308  		return vs[0].(map[string]*DomainDkim)[vs[1].(string)]
   309  	}).(DomainDkimOutput)
   310  }
   311  
   312  func init() {
   313  	pulumi.RegisterInputType(reflect.TypeOf((*DomainDkimInput)(nil)).Elem(), &DomainDkim{})
   314  	pulumi.RegisterInputType(reflect.TypeOf((*DomainDkimArrayInput)(nil)).Elem(), DomainDkimArray{})
   315  	pulumi.RegisterInputType(reflect.TypeOf((*DomainDkimMapInput)(nil)).Elem(), DomainDkimMap{})
   316  	pulumi.RegisterOutputType(DomainDkimOutput{})
   317  	pulumi.RegisterOutputType(DomainDkimArrayOutput{})
   318  	pulumi.RegisterOutputType(DomainDkimMapOutput{})
   319  }