github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/sqs/redriveAllowPolicy.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 sqs
     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 SQS Queue Redrive Allow Policy resource.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"encoding/json"
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sqs"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			example, err := sqs.NewQueue(ctx, "example", &sqs.QueueArgs{
    35  //				Name: pulumi.String("examplequeue"),
    36  //			})
    37  //			if err != nil {
    38  //				return err
    39  //			}
    40  //			src, err := sqs.NewQueue(ctx, "src", &sqs.QueueArgs{
    41  //				Name: pulumi.String("srcqueue"),
    42  //				RedrivePolicy: example.Arn.ApplyT(func(arn string) (pulumi.String, error) {
    43  //					var _zero pulumi.String
    44  //					tmpJSON0, err := json.Marshal(map[string]interface{}{
    45  //						"deadLetterTargetArn": arn,
    46  //						"maxReceiveCount":     4,
    47  //					})
    48  //					if err != nil {
    49  //						return _zero, err
    50  //					}
    51  //					json0 := string(tmpJSON0)
    52  //					return pulumi.String(json0), nil
    53  //				}).(pulumi.StringOutput),
    54  //			})
    55  //			if err != nil {
    56  //				return err
    57  //			}
    58  //			_, err = sqs.NewRedriveAllowPolicy(ctx, "example", &sqs.RedriveAllowPolicyArgs{
    59  //				QueueUrl: example.ID(),
    60  //				RedriveAllowPolicy: src.Arn.ApplyT(func(arn string) (pulumi.String, error) {
    61  //					var _zero pulumi.String
    62  //					tmpJSON1, err := json.Marshal(map[string]interface{}{
    63  //						"redrivePermission": "byQueue",
    64  //						"sourceQueueArns": []string{
    65  //							arn,
    66  //						},
    67  //					})
    68  //					if err != nil {
    69  //						return _zero, err
    70  //					}
    71  //					json1 := string(tmpJSON1)
    72  //					return pulumi.String(json1), nil
    73  //				}).(pulumi.StringOutput),
    74  //			})
    75  //			if err != nil {
    76  //				return err
    77  //			}
    78  //			return nil
    79  //		})
    80  //	}
    81  //
    82  // ```
    83  // <!--End PulumiCodeChooser -->
    84  //
    85  // ## Import
    86  //
    87  // Using `pulumi import`, import SQS Queue Redrive Allow Policies using the queue URL. For example:
    88  //
    89  // ```sh
    90  // $ pulumi import aws:sqs/redriveAllowPolicy:RedriveAllowPolicy test https://queue.amazonaws.com/0123456789012/myqueue
    91  // ```
    92  type RedriveAllowPolicy struct {
    93  	pulumi.CustomResourceState
    94  
    95  	// The URL of the SQS Queue to which to attach the policy
    96  	QueueUrl pulumi.StringOutput `pulumi:"queueUrl"`
    97  	// The JSON redrive allow policy for the SQS queue. Learn more in the [Amazon SQS dead-letter queues documentation](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html).
    98  	RedriveAllowPolicy pulumi.StringOutput `pulumi:"redriveAllowPolicy"`
    99  }
   100  
   101  // NewRedriveAllowPolicy registers a new resource with the given unique name, arguments, and options.
   102  func NewRedriveAllowPolicy(ctx *pulumi.Context,
   103  	name string, args *RedriveAllowPolicyArgs, opts ...pulumi.ResourceOption) (*RedriveAllowPolicy, error) {
   104  	if args == nil {
   105  		return nil, errors.New("missing one or more required arguments")
   106  	}
   107  
   108  	if args.QueueUrl == nil {
   109  		return nil, errors.New("invalid value for required argument 'QueueUrl'")
   110  	}
   111  	if args.RedriveAllowPolicy == nil {
   112  		return nil, errors.New("invalid value for required argument 'RedriveAllowPolicy'")
   113  	}
   114  	opts = internal.PkgResourceDefaultOpts(opts)
   115  	var resource RedriveAllowPolicy
   116  	err := ctx.RegisterResource("aws:sqs/redriveAllowPolicy:RedriveAllowPolicy", name, args, &resource, opts...)
   117  	if err != nil {
   118  		return nil, err
   119  	}
   120  	return &resource, nil
   121  }
   122  
   123  // GetRedriveAllowPolicy gets an existing RedriveAllowPolicy resource's state with the given name, ID, and optional
   124  // state properties that are used to uniquely qualify the lookup (nil if not required).
   125  func GetRedriveAllowPolicy(ctx *pulumi.Context,
   126  	name string, id pulumi.IDInput, state *RedriveAllowPolicyState, opts ...pulumi.ResourceOption) (*RedriveAllowPolicy, error) {
   127  	var resource RedriveAllowPolicy
   128  	err := ctx.ReadResource("aws:sqs/redriveAllowPolicy:RedriveAllowPolicy", name, id, state, &resource, opts...)
   129  	if err != nil {
   130  		return nil, err
   131  	}
   132  	return &resource, nil
   133  }
   134  
   135  // Input properties used for looking up and filtering RedriveAllowPolicy resources.
   136  type redriveAllowPolicyState struct {
   137  	// The URL of the SQS Queue to which to attach the policy
   138  	QueueUrl *string `pulumi:"queueUrl"`
   139  	// The JSON redrive allow policy for the SQS queue. Learn more in the [Amazon SQS dead-letter queues documentation](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html).
   140  	RedriveAllowPolicy *string `pulumi:"redriveAllowPolicy"`
   141  }
   142  
   143  type RedriveAllowPolicyState struct {
   144  	// The URL of the SQS Queue to which to attach the policy
   145  	QueueUrl pulumi.StringPtrInput
   146  	// The JSON redrive allow policy for the SQS queue. Learn more in the [Amazon SQS dead-letter queues documentation](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html).
   147  	RedriveAllowPolicy pulumi.StringPtrInput
   148  }
   149  
   150  func (RedriveAllowPolicyState) ElementType() reflect.Type {
   151  	return reflect.TypeOf((*redriveAllowPolicyState)(nil)).Elem()
   152  }
   153  
   154  type redriveAllowPolicyArgs struct {
   155  	// The URL of the SQS Queue to which to attach the policy
   156  	QueueUrl string `pulumi:"queueUrl"`
   157  	// The JSON redrive allow policy for the SQS queue. Learn more in the [Amazon SQS dead-letter queues documentation](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html).
   158  	RedriveAllowPolicy string `pulumi:"redriveAllowPolicy"`
   159  }
   160  
   161  // The set of arguments for constructing a RedriveAllowPolicy resource.
   162  type RedriveAllowPolicyArgs struct {
   163  	// The URL of the SQS Queue to which to attach the policy
   164  	QueueUrl pulumi.StringInput
   165  	// The JSON redrive allow policy for the SQS queue. Learn more in the [Amazon SQS dead-letter queues documentation](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html).
   166  	RedriveAllowPolicy pulumi.StringInput
   167  }
   168  
   169  func (RedriveAllowPolicyArgs) ElementType() reflect.Type {
   170  	return reflect.TypeOf((*redriveAllowPolicyArgs)(nil)).Elem()
   171  }
   172  
   173  type RedriveAllowPolicyInput interface {
   174  	pulumi.Input
   175  
   176  	ToRedriveAllowPolicyOutput() RedriveAllowPolicyOutput
   177  	ToRedriveAllowPolicyOutputWithContext(ctx context.Context) RedriveAllowPolicyOutput
   178  }
   179  
   180  func (*RedriveAllowPolicy) ElementType() reflect.Type {
   181  	return reflect.TypeOf((**RedriveAllowPolicy)(nil)).Elem()
   182  }
   183  
   184  func (i *RedriveAllowPolicy) ToRedriveAllowPolicyOutput() RedriveAllowPolicyOutput {
   185  	return i.ToRedriveAllowPolicyOutputWithContext(context.Background())
   186  }
   187  
   188  func (i *RedriveAllowPolicy) ToRedriveAllowPolicyOutputWithContext(ctx context.Context) RedriveAllowPolicyOutput {
   189  	return pulumi.ToOutputWithContext(ctx, i).(RedriveAllowPolicyOutput)
   190  }
   191  
   192  // RedriveAllowPolicyArrayInput is an input type that accepts RedriveAllowPolicyArray and RedriveAllowPolicyArrayOutput values.
   193  // You can construct a concrete instance of `RedriveAllowPolicyArrayInput` via:
   194  //
   195  //	RedriveAllowPolicyArray{ RedriveAllowPolicyArgs{...} }
   196  type RedriveAllowPolicyArrayInput interface {
   197  	pulumi.Input
   198  
   199  	ToRedriveAllowPolicyArrayOutput() RedriveAllowPolicyArrayOutput
   200  	ToRedriveAllowPolicyArrayOutputWithContext(context.Context) RedriveAllowPolicyArrayOutput
   201  }
   202  
   203  type RedriveAllowPolicyArray []RedriveAllowPolicyInput
   204  
   205  func (RedriveAllowPolicyArray) ElementType() reflect.Type {
   206  	return reflect.TypeOf((*[]*RedriveAllowPolicy)(nil)).Elem()
   207  }
   208  
   209  func (i RedriveAllowPolicyArray) ToRedriveAllowPolicyArrayOutput() RedriveAllowPolicyArrayOutput {
   210  	return i.ToRedriveAllowPolicyArrayOutputWithContext(context.Background())
   211  }
   212  
   213  func (i RedriveAllowPolicyArray) ToRedriveAllowPolicyArrayOutputWithContext(ctx context.Context) RedriveAllowPolicyArrayOutput {
   214  	return pulumi.ToOutputWithContext(ctx, i).(RedriveAllowPolicyArrayOutput)
   215  }
   216  
   217  // RedriveAllowPolicyMapInput is an input type that accepts RedriveAllowPolicyMap and RedriveAllowPolicyMapOutput values.
   218  // You can construct a concrete instance of `RedriveAllowPolicyMapInput` via:
   219  //
   220  //	RedriveAllowPolicyMap{ "key": RedriveAllowPolicyArgs{...} }
   221  type RedriveAllowPolicyMapInput interface {
   222  	pulumi.Input
   223  
   224  	ToRedriveAllowPolicyMapOutput() RedriveAllowPolicyMapOutput
   225  	ToRedriveAllowPolicyMapOutputWithContext(context.Context) RedriveAllowPolicyMapOutput
   226  }
   227  
   228  type RedriveAllowPolicyMap map[string]RedriveAllowPolicyInput
   229  
   230  func (RedriveAllowPolicyMap) ElementType() reflect.Type {
   231  	return reflect.TypeOf((*map[string]*RedriveAllowPolicy)(nil)).Elem()
   232  }
   233  
   234  func (i RedriveAllowPolicyMap) ToRedriveAllowPolicyMapOutput() RedriveAllowPolicyMapOutput {
   235  	return i.ToRedriveAllowPolicyMapOutputWithContext(context.Background())
   236  }
   237  
   238  func (i RedriveAllowPolicyMap) ToRedriveAllowPolicyMapOutputWithContext(ctx context.Context) RedriveAllowPolicyMapOutput {
   239  	return pulumi.ToOutputWithContext(ctx, i).(RedriveAllowPolicyMapOutput)
   240  }
   241  
   242  type RedriveAllowPolicyOutput struct{ *pulumi.OutputState }
   243  
   244  func (RedriveAllowPolicyOutput) ElementType() reflect.Type {
   245  	return reflect.TypeOf((**RedriveAllowPolicy)(nil)).Elem()
   246  }
   247  
   248  func (o RedriveAllowPolicyOutput) ToRedriveAllowPolicyOutput() RedriveAllowPolicyOutput {
   249  	return o
   250  }
   251  
   252  func (o RedriveAllowPolicyOutput) ToRedriveAllowPolicyOutputWithContext(ctx context.Context) RedriveAllowPolicyOutput {
   253  	return o
   254  }
   255  
   256  // The URL of the SQS Queue to which to attach the policy
   257  func (o RedriveAllowPolicyOutput) QueueUrl() pulumi.StringOutput {
   258  	return o.ApplyT(func(v *RedriveAllowPolicy) pulumi.StringOutput { return v.QueueUrl }).(pulumi.StringOutput)
   259  }
   260  
   261  // The JSON redrive allow policy for the SQS queue. Learn more in the [Amazon SQS dead-letter queues documentation](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html).
   262  func (o RedriveAllowPolicyOutput) RedriveAllowPolicy() pulumi.StringOutput {
   263  	return o.ApplyT(func(v *RedriveAllowPolicy) pulumi.StringOutput { return v.RedriveAllowPolicy }).(pulumi.StringOutput)
   264  }
   265  
   266  type RedriveAllowPolicyArrayOutput struct{ *pulumi.OutputState }
   267  
   268  func (RedriveAllowPolicyArrayOutput) ElementType() reflect.Type {
   269  	return reflect.TypeOf((*[]*RedriveAllowPolicy)(nil)).Elem()
   270  }
   271  
   272  func (o RedriveAllowPolicyArrayOutput) ToRedriveAllowPolicyArrayOutput() RedriveAllowPolicyArrayOutput {
   273  	return o
   274  }
   275  
   276  func (o RedriveAllowPolicyArrayOutput) ToRedriveAllowPolicyArrayOutputWithContext(ctx context.Context) RedriveAllowPolicyArrayOutput {
   277  	return o
   278  }
   279  
   280  func (o RedriveAllowPolicyArrayOutput) Index(i pulumi.IntInput) RedriveAllowPolicyOutput {
   281  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *RedriveAllowPolicy {
   282  		return vs[0].([]*RedriveAllowPolicy)[vs[1].(int)]
   283  	}).(RedriveAllowPolicyOutput)
   284  }
   285  
   286  type RedriveAllowPolicyMapOutput struct{ *pulumi.OutputState }
   287  
   288  func (RedriveAllowPolicyMapOutput) ElementType() reflect.Type {
   289  	return reflect.TypeOf((*map[string]*RedriveAllowPolicy)(nil)).Elem()
   290  }
   291  
   292  func (o RedriveAllowPolicyMapOutput) ToRedriveAllowPolicyMapOutput() RedriveAllowPolicyMapOutput {
   293  	return o
   294  }
   295  
   296  func (o RedriveAllowPolicyMapOutput) ToRedriveAllowPolicyMapOutputWithContext(ctx context.Context) RedriveAllowPolicyMapOutput {
   297  	return o
   298  }
   299  
   300  func (o RedriveAllowPolicyMapOutput) MapIndex(k pulumi.StringInput) RedriveAllowPolicyOutput {
   301  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *RedriveAllowPolicy {
   302  		return vs[0].(map[string]*RedriveAllowPolicy)[vs[1].(string)]
   303  	}).(RedriveAllowPolicyOutput)
   304  }
   305  
   306  func init() {
   307  	pulumi.RegisterInputType(reflect.TypeOf((*RedriveAllowPolicyInput)(nil)).Elem(), &RedriveAllowPolicy{})
   308  	pulumi.RegisterInputType(reflect.TypeOf((*RedriveAllowPolicyArrayInput)(nil)).Elem(), RedriveAllowPolicyArray{})
   309  	pulumi.RegisterInputType(reflect.TypeOf((*RedriveAllowPolicyMapInput)(nil)).Elem(), RedriveAllowPolicyMap{})
   310  	pulumi.RegisterOutputType(RedriveAllowPolicyOutput{})
   311  	pulumi.RegisterOutputType(RedriveAllowPolicyArrayOutput{})
   312  	pulumi.RegisterOutputType(RedriveAllowPolicyMapOutput{})
   313  }