github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ses/template.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  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // Provides a resource to create a SES template.
    15  //
    16  // ## Example Usage
    17  //
    18  // <!--Start PulumiCodeChooser -->
    19  // ```go
    20  // package main
    21  //
    22  // import (
    23  //
    24  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ses"
    25  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    26  //
    27  // )
    28  //
    29  //	func main() {
    30  //		pulumi.Run(func(ctx *pulumi.Context) error {
    31  //			_, err := ses.NewTemplate(ctx, "MyTemplate", &ses.TemplateArgs{
    32  //				Name:    pulumi.String("MyTemplate"),
    33  //				Subject: pulumi.String("Greetings, {{name}}!"),
    34  //				Html:    pulumi.String("<h1>Hello {{name}},</h1><p>Your favorite animal is {{favoriteanimal}}.</p>"),
    35  //				Text:    pulumi.String("Hello {{name}},\nYour favorite animal is {{favoriteanimal}}."),
    36  //			})
    37  //			if err != nil {
    38  //				return err
    39  //			}
    40  //			return nil
    41  //		})
    42  //	}
    43  //
    44  // ```
    45  // <!--End PulumiCodeChooser -->
    46  //
    47  // ## Import
    48  //
    49  // Using `pulumi import`, import SES templates using the template name. For example:
    50  //
    51  // ```sh
    52  // $ pulumi import aws:ses/template:Template MyTemplate MyTemplate
    53  // ```
    54  type Template struct {
    55  	pulumi.CustomResourceState
    56  
    57  	// The ARN of the SES template
    58  	Arn pulumi.StringOutput `pulumi:"arn"`
    59  	// The HTML body of the email. Must be less than 500KB in size, including both the text and HTML parts.
    60  	Html pulumi.StringPtrOutput `pulumi:"html"`
    61  	// The name of the template. Cannot exceed 64 characters. You will refer to this name when you send email.
    62  	Name pulumi.StringOutput `pulumi:"name"`
    63  	// The subject line of the email.
    64  	Subject pulumi.StringPtrOutput `pulumi:"subject"`
    65  	// The email body that will be visible to recipients whose email clients do not display HTML. Must be less than 500KB in size, including both the text and HTML parts.
    66  	Text pulumi.StringPtrOutput `pulumi:"text"`
    67  }
    68  
    69  // NewTemplate registers a new resource with the given unique name, arguments, and options.
    70  func NewTemplate(ctx *pulumi.Context,
    71  	name string, args *TemplateArgs, opts ...pulumi.ResourceOption) (*Template, error) {
    72  	if args == nil {
    73  		args = &TemplateArgs{}
    74  	}
    75  
    76  	opts = internal.PkgResourceDefaultOpts(opts)
    77  	var resource Template
    78  	err := ctx.RegisterResource("aws:ses/template:Template", name, args, &resource, opts...)
    79  	if err != nil {
    80  		return nil, err
    81  	}
    82  	return &resource, nil
    83  }
    84  
    85  // GetTemplate gets an existing Template resource's state with the given name, ID, and optional
    86  // state properties that are used to uniquely qualify the lookup (nil if not required).
    87  func GetTemplate(ctx *pulumi.Context,
    88  	name string, id pulumi.IDInput, state *TemplateState, opts ...pulumi.ResourceOption) (*Template, error) {
    89  	var resource Template
    90  	err := ctx.ReadResource("aws:ses/template:Template", name, id, state, &resource, opts...)
    91  	if err != nil {
    92  		return nil, err
    93  	}
    94  	return &resource, nil
    95  }
    96  
    97  // Input properties used for looking up and filtering Template resources.
    98  type templateState struct {
    99  	// The ARN of the SES template
   100  	Arn *string `pulumi:"arn"`
   101  	// The HTML body of the email. Must be less than 500KB in size, including both the text and HTML parts.
   102  	Html *string `pulumi:"html"`
   103  	// The name of the template. Cannot exceed 64 characters. You will refer to this name when you send email.
   104  	Name *string `pulumi:"name"`
   105  	// The subject line of the email.
   106  	Subject *string `pulumi:"subject"`
   107  	// The email body that will be visible to recipients whose email clients do not display HTML. Must be less than 500KB in size, including both the text and HTML parts.
   108  	Text *string `pulumi:"text"`
   109  }
   110  
   111  type TemplateState struct {
   112  	// The ARN of the SES template
   113  	Arn pulumi.StringPtrInput
   114  	// The HTML body of the email. Must be less than 500KB in size, including both the text and HTML parts.
   115  	Html pulumi.StringPtrInput
   116  	// The name of the template. Cannot exceed 64 characters. You will refer to this name when you send email.
   117  	Name pulumi.StringPtrInput
   118  	// The subject line of the email.
   119  	Subject pulumi.StringPtrInput
   120  	// The email body that will be visible to recipients whose email clients do not display HTML. Must be less than 500KB in size, including both the text and HTML parts.
   121  	Text pulumi.StringPtrInput
   122  }
   123  
   124  func (TemplateState) ElementType() reflect.Type {
   125  	return reflect.TypeOf((*templateState)(nil)).Elem()
   126  }
   127  
   128  type templateArgs struct {
   129  	// The HTML body of the email. Must be less than 500KB in size, including both the text and HTML parts.
   130  	Html *string `pulumi:"html"`
   131  	// The name of the template. Cannot exceed 64 characters. You will refer to this name when you send email.
   132  	Name *string `pulumi:"name"`
   133  	// The subject line of the email.
   134  	Subject *string `pulumi:"subject"`
   135  	// The email body that will be visible to recipients whose email clients do not display HTML. Must be less than 500KB in size, including both the text and HTML parts.
   136  	Text *string `pulumi:"text"`
   137  }
   138  
   139  // The set of arguments for constructing a Template resource.
   140  type TemplateArgs struct {
   141  	// The HTML body of the email. Must be less than 500KB in size, including both the text and HTML parts.
   142  	Html pulumi.StringPtrInput
   143  	// The name of the template. Cannot exceed 64 characters. You will refer to this name when you send email.
   144  	Name pulumi.StringPtrInput
   145  	// The subject line of the email.
   146  	Subject pulumi.StringPtrInput
   147  	// The email body that will be visible to recipients whose email clients do not display HTML. Must be less than 500KB in size, including both the text and HTML parts.
   148  	Text pulumi.StringPtrInput
   149  }
   150  
   151  func (TemplateArgs) ElementType() reflect.Type {
   152  	return reflect.TypeOf((*templateArgs)(nil)).Elem()
   153  }
   154  
   155  type TemplateInput interface {
   156  	pulumi.Input
   157  
   158  	ToTemplateOutput() TemplateOutput
   159  	ToTemplateOutputWithContext(ctx context.Context) TemplateOutput
   160  }
   161  
   162  func (*Template) ElementType() reflect.Type {
   163  	return reflect.TypeOf((**Template)(nil)).Elem()
   164  }
   165  
   166  func (i *Template) ToTemplateOutput() TemplateOutput {
   167  	return i.ToTemplateOutputWithContext(context.Background())
   168  }
   169  
   170  func (i *Template) ToTemplateOutputWithContext(ctx context.Context) TemplateOutput {
   171  	return pulumi.ToOutputWithContext(ctx, i).(TemplateOutput)
   172  }
   173  
   174  // TemplateArrayInput is an input type that accepts TemplateArray and TemplateArrayOutput values.
   175  // You can construct a concrete instance of `TemplateArrayInput` via:
   176  //
   177  //	TemplateArray{ TemplateArgs{...} }
   178  type TemplateArrayInput interface {
   179  	pulumi.Input
   180  
   181  	ToTemplateArrayOutput() TemplateArrayOutput
   182  	ToTemplateArrayOutputWithContext(context.Context) TemplateArrayOutput
   183  }
   184  
   185  type TemplateArray []TemplateInput
   186  
   187  func (TemplateArray) ElementType() reflect.Type {
   188  	return reflect.TypeOf((*[]*Template)(nil)).Elem()
   189  }
   190  
   191  func (i TemplateArray) ToTemplateArrayOutput() TemplateArrayOutput {
   192  	return i.ToTemplateArrayOutputWithContext(context.Background())
   193  }
   194  
   195  func (i TemplateArray) ToTemplateArrayOutputWithContext(ctx context.Context) TemplateArrayOutput {
   196  	return pulumi.ToOutputWithContext(ctx, i).(TemplateArrayOutput)
   197  }
   198  
   199  // TemplateMapInput is an input type that accepts TemplateMap and TemplateMapOutput values.
   200  // You can construct a concrete instance of `TemplateMapInput` via:
   201  //
   202  //	TemplateMap{ "key": TemplateArgs{...} }
   203  type TemplateMapInput interface {
   204  	pulumi.Input
   205  
   206  	ToTemplateMapOutput() TemplateMapOutput
   207  	ToTemplateMapOutputWithContext(context.Context) TemplateMapOutput
   208  }
   209  
   210  type TemplateMap map[string]TemplateInput
   211  
   212  func (TemplateMap) ElementType() reflect.Type {
   213  	return reflect.TypeOf((*map[string]*Template)(nil)).Elem()
   214  }
   215  
   216  func (i TemplateMap) ToTemplateMapOutput() TemplateMapOutput {
   217  	return i.ToTemplateMapOutputWithContext(context.Background())
   218  }
   219  
   220  func (i TemplateMap) ToTemplateMapOutputWithContext(ctx context.Context) TemplateMapOutput {
   221  	return pulumi.ToOutputWithContext(ctx, i).(TemplateMapOutput)
   222  }
   223  
   224  type TemplateOutput struct{ *pulumi.OutputState }
   225  
   226  func (TemplateOutput) ElementType() reflect.Type {
   227  	return reflect.TypeOf((**Template)(nil)).Elem()
   228  }
   229  
   230  func (o TemplateOutput) ToTemplateOutput() TemplateOutput {
   231  	return o
   232  }
   233  
   234  func (o TemplateOutput) ToTemplateOutputWithContext(ctx context.Context) TemplateOutput {
   235  	return o
   236  }
   237  
   238  // The ARN of the SES template
   239  func (o TemplateOutput) Arn() pulumi.StringOutput {
   240  	return o.ApplyT(func(v *Template) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   241  }
   242  
   243  // The HTML body of the email. Must be less than 500KB in size, including both the text and HTML parts.
   244  func (o TemplateOutput) Html() pulumi.StringPtrOutput {
   245  	return o.ApplyT(func(v *Template) pulumi.StringPtrOutput { return v.Html }).(pulumi.StringPtrOutput)
   246  }
   247  
   248  // The name of the template. Cannot exceed 64 characters. You will refer to this name when you send email.
   249  func (o TemplateOutput) Name() pulumi.StringOutput {
   250  	return o.ApplyT(func(v *Template) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   251  }
   252  
   253  // The subject line of the email.
   254  func (o TemplateOutput) Subject() pulumi.StringPtrOutput {
   255  	return o.ApplyT(func(v *Template) pulumi.StringPtrOutput { return v.Subject }).(pulumi.StringPtrOutput)
   256  }
   257  
   258  // The email body that will be visible to recipients whose email clients do not display HTML. Must be less than 500KB in size, including both the text and HTML parts.
   259  func (o TemplateOutput) Text() pulumi.StringPtrOutput {
   260  	return o.ApplyT(func(v *Template) pulumi.StringPtrOutput { return v.Text }).(pulumi.StringPtrOutput)
   261  }
   262  
   263  type TemplateArrayOutput struct{ *pulumi.OutputState }
   264  
   265  func (TemplateArrayOutput) ElementType() reflect.Type {
   266  	return reflect.TypeOf((*[]*Template)(nil)).Elem()
   267  }
   268  
   269  func (o TemplateArrayOutput) ToTemplateArrayOutput() TemplateArrayOutput {
   270  	return o
   271  }
   272  
   273  func (o TemplateArrayOutput) ToTemplateArrayOutputWithContext(ctx context.Context) TemplateArrayOutput {
   274  	return o
   275  }
   276  
   277  func (o TemplateArrayOutput) Index(i pulumi.IntInput) TemplateOutput {
   278  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Template {
   279  		return vs[0].([]*Template)[vs[1].(int)]
   280  	}).(TemplateOutput)
   281  }
   282  
   283  type TemplateMapOutput struct{ *pulumi.OutputState }
   284  
   285  func (TemplateMapOutput) ElementType() reflect.Type {
   286  	return reflect.TypeOf((*map[string]*Template)(nil)).Elem()
   287  }
   288  
   289  func (o TemplateMapOutput) ToTemplateMapOutput() TemplateMapOutput {
   290  	return o
   291  }
   292  
   293  func (o TemplateMapOutput) ToTemplateMapOutputWithContext(ctx context.Context) TemplateMapOutput {
   294  	return o
   295  }
   296  
   297  func (o TemplateMapOutput) MapIndex(k pulumi.StringInput) TemplateOutput {
   298  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Template {
   299  		return vs[0].(map[string]*Template)[vs[1].(string)]
   300  	}).(TemplateOutput)
   301  }
   302  
   303  func init() {
   304  	pulumi.RegisterInputType(reflect.TypeOf((*TemplateInput)(nil)).Elem(), &Template{})
   305  	pulumi.RegisterInputType(reflect.TypeOf((*TemplateArrayInput)(nil)).Elem(), TemplateArray{})
   306  	pulumi.RegisterInputType(reflect.TypeOf((*TemplateMapInput)(nil)).Elem(), TemplateMap{})
   307  	pulumi.RegisterOutputType(TemplateOutput{})
   308  	pulumi.RegisterOutputType(TemplateArrayOutput{})
   309  	pulumi.RegisterOutputType(TemplateMapOutput{})
   310  }