github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ses/identityPolicy.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  // Manages a SES Identity Policy. More information about SES Sending Authorization Policies can be found in the [SES Developer Guide](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-authorization-policies.html).
    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/ses"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			exampleDomainIdentity, err := ses.NewDomainIdentity(ctx, "example", &ses.DomainIdentityArgs{
    34  //				Domain: pulumi.String("example.com"),
    35  //			})
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			example := iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{
    40  //				Statements: iam.GetPolicyDocumentStatementArray{
    41  //					&iam.GetPolicyDocumentStatementArgs{
    42  //						Actions: pulumi.StringArray{
    43  //							pulumi.String("SES:SendEmail"),
    44  //							pulumi.String("SES:SendRawEmail"),
    45  //						},
    46  //						Resources: pulumi.StringArray{
    47  //							exampleDomainIdentity.Arn,
    48  //						},
    49  //						Principals: iam.GetPolicyDocumentStatementPrincipalArray{
    50  //							&iam.GetPolicyDocumentStatementPrincipalArgs{
    51  //								Identifiers: pulumi.StringArray{
    52  //									pulumi.String("*"),
    53  //								},
    54  //								Type: pulumi.String("AWS"),
    55  //							},
    56  //						},
    57  //					},
    58  //				},
    59  //			}, nil)
    60  //			_, err = ses.NewIdentityPolicy(ctx, "example", &ses.IdentityPolicyArgs{
    61  //				Identity: exampleDomainIdentity.Arn,
    62  //				Name:     pulumi.String("example"),
    63  //				Policy: example.ApplyT(func(example iam.GetPolicyDocumentResult) (*string, error) {
    64  //					return &example.Json, nil
    65  //				}).(pulumi.StringPtrOutput),
    66  //			})
    67  //			if err != nil {
    68  //				return err
    69  //			}
    70  //			return nil
    71  //		})
    72  //	}
    73  //
    74  // ```
    75  // <!--End PulumiCodeChooser -->
    76  //
    77  // ## Import
    78  //
    79  // Using `pulumi import`, import SES Identity Policies using the identity and policy name, separated by a pipe character (`|`). For example:
    80  //
    81  // ```sh
    82  // $ pulumi import aws:ses/identityPolicy:IdentityPolicy example 'example.com|example'
    83  // ```
    84  type IdentityPolicy struct {
    85  	pulumi.CustomResourceState
    86  
    87  	// Name or Amazon Resource Name (ARN) of the SES Identity.
    88  	Identity pulumi.StringOutput `pulumi:"identity"`
    89  	// Name of the policy.
    90  	Name pulumi.StringOutput `pulumi:"name"`
    91  	// JSON string of the policy.
    92  	Policy pulumi.StringOutput `pulumi:"policy"`
    93  }
    94  
    95  // NewIdentityPolicy registers a new resource with the given unique name, arguments, and options.
    96  func NewIdentityPolicy(ctx *pulumi.Context,
    97  	name string, args *IdentityPolicyArgs, opts ...pulumi.ResourceOption) (*IdentityPolicy, error) {
    98  	if args == nil {
    99  		return nil, errors.New("missing one or more required arguments")
   100  	}
   101  
   102  	if args.Identity == nil {
   103  		return nil, errors.New("invalid value for required argument 'Identity'")
   104  	}
   105  	if args.Policy == nil {
   106  		return nil, errors.New("invalid value for required argument 'Policy'")
   107  	}
   108  	opts = internal.PkgResourceDefaultOpts(opts)
   109  	var resource IdentityPolicy
   110  	err := ctx.RegisterResource("aws:ses/identityPolicy:IdentityPolicy", name, args, &resource, opts...)
   111  	if err != nil {
   112  		return nil, err
   113  	}
   114  	return &resource, nil
   115  }
   116  
   117  // GetIdentityPolicy gets an existing IdentityPolicy resource's state with the given name, ID, and optional
   118  // state properties that are used to uniquely qualify the lookup (nil if not required).
   119  func GetIdentityPolicy(ctx *pulumi.Context,
   120  	name string, id pulumi.IDInput, state *IdentityPolicyState, opts ...pulumi.ResourceOption) (*IdentityPolicy, error) {
   121  	var resource IdentityPolicy
   122  	err := ctx.ReadResource("aws:ses/identityPolicy:IdentityPolicy", name, id, state, &resource, opts...)
   123  	if err != nil {
   124  		return nil, err
   125  	}
   126  	return &resource, nil
   127  }
   128  
   129  // Input properties used for looking up and filtering IdentityPolicy resources.
   130  type identityPolicyState struct {
   131  	// Name or Amazon Resource Name (ARN) of the SES Identity.
   132  	Identity *string `pulumi:"identity"`
   133  	// Name of the policy.
   134  	Name *string `pulumi:"name"`
   135  	// JSON string of the policy.
   136  	Policy *string `pulumi:"policy"`
   137  }
   138  
   139  type IdentityPolicyState struct {
   140  	// Name or Amazon Resource Name (ARN) of the SES Identity.
   141  	Identity pulumi.StringPtrInput
   142  	// Name of the policy.
   143  	Name pulumi.StringPtrInput
   144  	// JSON string of the policy.
   145  	Policy pulumi.StringPtrInput
   146  }
   147  
   148  func (IdentityPolicyState) ElementType() reflect.Type {
   149  	return reflect.TypeOf((*identityPolicyState)(nil)).Elem()
   150  }
   151  
   152  type identityPolicyArgs struct {
   153  	// Name or Amazon Resource Name (ARN) of the SES Identity.
   154  	Identity string `pulumi:"identity"`
   155  	// Name of the policy.
   156  	Name *string `pulumi:"name"`
   157  	// JSON string of the policy.
   158  	Policy string `pulumi:"policy"`
   159  }
   160  
   161  // The set of arguments for constructing a IdentityPolicy resource.
   162  type IdentityPolicyArgs struct {
   163  	// Name or Amazon Resource Name (ARN) of the SES Identity.
   164  	Identity pulumi.StringInput
   165  	// Name of the policy.
   166  	Name pulumi.StringPtrInput
   167  	// JSON string of the policy.
   168  	Policy pulumi.StringInput
   169  }
   170  
   171  func (IdentityPolicyArgs) ElementType() reflect.Type {
   172  	return reflect.TypeOf((*identityPolicyArgs)(nil)).Elem()
   173  }
   174  
   175  type IdentityPolicyInput interface {
   176  	pulumi.Input
   177  
   178  	ToIdentityPolicyOutput() IdentityPolicyOutput
   179  	ToIdentityPolicyOutputWithContext(ctx context.Context) IdentityPolicyOutput
   180  }
   181  
   182  func (*IdentityPolicy) ElementType() reflect.Type {
   183  	return reflect.TypeOf((**IdentityPolicy)(nil)).Elem()
   184  }
   185  
   186  func (i *IdentityPolicy) ToIdentityPolicyOutput() IdentityPolicyOutput {
   187  	return i.ToIdentityPolicyOutputWithContext(context.Background())
   188  }
   189  
   190  func (i *IdentityPolicy) ToIdentityPolicyOutputWithContext(ctx context.Context) IdentityPolicyOutput {
   191  	return pulumi.ToOutputWithContext(ctx, i).(IdentityPolicyOutput)
   192  }
   193  
   194  // IdentityPolicyArrayInput is an input type that accepts IdentityPolicyArray and IdentityPolicyArrayOutput values.
   195  // You can construct a concrete instance of `IdentityPolicyArrayInput` via:
   196  //
   197  //	IdentityPolicyArray{ IdentityPolicyArgs{...} }
   198  type IdentityPolicyArrayInput interface {
   199  	pulumi.Input
   200  
   201  	ToIdentityPolicyArrayOutput() IdentityPolicyArrayOutput
   202  	ToIdentityPolicyArrayOutputWithContext(context.Context) IdentityPolicyArrayOutput
   203  }
   204  
   205  type IdentityPolicyArray []IdentityPolicyInput
   206  
   207  func (IdentityPolicyArray) ElementType() reflect.Type {
   208  	return reflect.TypeOf((*[]*IdentityPolicy)(nil)).Elem()
   209  }
   210  
   211  func (i IdentityPolicyArray) ToIdentityPolicyArrayOutput() IdentityPolicyArrayOutput {
   212  	return i.ToIdentityPolicyArrayOutputWithContext(context.Background())
   213  }
   214  
   215  func (i IdentityPolicyArray) ToIdentityPolicyArrayOutputWithContext(ctx context.Context) IdentityPolicyArrayOutput {
   216  	return pulumi.ToOutputWithContext(ctx, i).(IdentityPolicyArrayOutput)
   217  }
   218  
   219  // IdentityPolicyMapInput is an input type that accepts IdentityPolicyMap and IdentityPolicyMapOutput values.
   220  // You can construct a concrete instance of `IdentityPolicyMapInput` via:
   221  //
   222  //	IdentityPolicyMap{ "key": IdentityPolicyArgs{...} }
   223  type IdentityPolicyMapInput interface {
   224  	pulumi.Input
   225  
   226  	ToIdentityPolicyMapOutput() IdentityPolicyMapOutput
   227  	ToIdentityPolicyMapOutputWithContext(context.Context) IdentityPolicyMapOutput
   228  }
   229  
   230  type IdentityPolicyMap map[string]IdentityPolicyInput
   231  
   232  func (IdentityPolicyMap) ElementType() reflect.Type {
   233  	return reflect.TypeOf((*map[string]*IdentityPolicy)(nil)).Elem()
   234  }
   235  
   236  func (i IdentityPolicyMap) ToIdentityPolicyMapOutput() IdentityPolicyMapOutput {
   237  	return i.ToIdentityPolicyMapOutputWithContext(context.Background())
   238  }
   239  
   240  func (i IdentityPolicyMap) ToIdentityPolicyMapOutputWithContext(ctx context.Context) IdentityPolicyMapOutput {
   241  	return pulumi.ToOutputWithContext(ctx, i).(IdentityPolicyMapOutput)
   242  }
   243  
   244  type IdentityPolicyOutput struct{ *pulumi.OutputState }
   245  
   246  func (IdentityPolicyOutput) ElementType() reflect.Type {
   247  	return reflect.TypeOf((**IdentityPolicy)(nil)).Elem()
   248  }
   249  
   250  func (o IdentityPolicyOutput) ToIdentityPolicyOutput() IdentityPolicyOutput {
   251  	return o
   252  }
   253  
   254  func (o IdentityPolicyOutput) ToIdentityPolicyOutputWithContext(ctx context.Context) IdentityPolicyOutput {
   255  	return o
   256  }
   257  
   258  // Name or Amazon Resource Name (ARN) of the SES Identity.
   259  func (o IdentityPolicyOutput) Identity() pulumi.StringOutput {
   260  	return o.ApplyT(func(v *IdentityPolicy) pulumi.StringOutput { return v.Identity }).(pulumi.StringOutput)
   261  }
   262  
   263  // Name of the policy.
   264  func (o IdentityPolicyOutput) Name() pulumi.StringOutput {
   265  	return o.ApplyT(func(v *IdentityPolicy) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   266  }
   267  
   268  // JSON string of the policy.
   269  func (o IdentityPolicyOutput) Policy() pulumi.StringOutput {
   270  	return o.ApplyT(func(v *IdentityPolicy) pulumi.StringOutput { return v.Policy }).(pulumi.StringOutput)
   271  }
   272  
   273  type IdentityPolicyArrayOutput struct{ *pulumi.OutputState }
   274  
   275  func (IdentityPolicyArrayOutput) ElementType() reflect.Type {
   276  	return reflect.TypeOf((*[]*IdentityPolicy)(nil)).Elem()
   277  }
   278  
   279  func (o IdentityPolicyArrayOutput) ToIdentityPolicyArrayOutput() IdentityPolicyArrayOutput {
   280  	return o
   281  }
   282  
   283  func (o IdentityPolicyArrayOutput) ToIdentityPolicyArrayOutputWithContext(ctx context.Context) IdentityPolicyArrayOutput {
   284  	return o
   285  }
   286  
   287  func (o IdentityPolicyArrayOutput) Index(i pulumi.IntInput) IdentityPolicyOutput {
   288  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *IdentityPolicy {
   289  		return vs[0].([]*IdentityPolicy)[vs[1].(int)]
   290  	}).(IdentityPolicyOutput)
   291  }
   292  
   293  type IdentityPolicyMapOutput struct{ *pulumi.OutputState }
   294  
   295  func (IdentityPolicyMapOutput) ElementType() reflect.Type {
   296  	return reflect.TypeOf((*map[string]*IdentityPolicy)(nil)).Elem()
   297  }
   298  
   299  func (o IdentityPolicyMapOutput) ToIdentityPolicyMapOutput() IdentityPolicyMapOutput {
   300  	return o
   301  }
   302  
   303  func (o IdentityPolicyMapOutput) ToIdentityPolicyMapOutputWithContext(ctx context.Context) IdentityPolicyMapOutput {
   304  	return o
   305  }
   306  
   307  func (o IdentityPolicyMapOutput) MapIndex(k pulumi.StringInput) IdentityPolicyOutput {
   308  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *IdentityPolicy {
   309  		return vs[0].(map[string]*IdentityPolicy)[vs[1].(string)]
   310  	}).(IdentityPolicyOutput)
   311  }
   312  
   313  func init() {
   314  	pulumi.RegisterInputType(reflect.TypeOf((*IdentityPolicyInput)(nil)).Elem(), &IdentityPolicy{})
   315  	pulumi.RegisterInputType(reflect.TypeOf((*IdentityPolicyArrayInput)(nil)).Elem(), IdentityPolicyArray{})
   316  	pulumi.RegisterInputType(reflect.TypeOf((*IdentityPolicyMapInput)(nil)).Elem(), IdentityPolicyMap{})
   317  	pulumi.RegisterOutputType(IdentityPolicyOutput{})
   318  	pulumi.RegisterOutputType(IdentityPolicyArrayOutput{})
   319  	pulumi.RegisterOutputType(IdentityPolicyMapOutput{})
   320  }