github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/s3control/objectLambdaAccessPointPolicy.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 s3control
     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 resource to manage an S3 Object Lambda Access Point resource policy.
    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/s3"
    28  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3control"
    29  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    30  //
    31  // )
    32  //
    33  //	func main() {
    34  //		pulumi.Run(func(ctx *pulumi.Context) error {
    35  //			example, err := s3.NewBucketV2(ctx, "example", &s3.BucketV2Args{
    36  //				Bucket: pulumi.String("example"),
    37  //			})
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			exampleAccessPoint, err := s3.NewAccessPoint(ctx, "example", &s3.AccessPointArgs{
    42  //				Bucket: example.ID(),
    43  //				Name:   pulumi.String("example"),
    44  //			})
    45  //			if err != nil {
    46  //				return err
    47  //			}
    48  //			exampleObjectLambdaAccessPoint, err := s3control.NewObjectLambdaAccessPoint(ctx, "example", &s3control.ObjectLambdaAccessPointArgs{
    49  //				Name: pulumi.String("example"),
    50  //				Configuration: &s3control.ObjectLambdaAccessPointConfigurationArgs{
    51  //					SupportingAccessPoint: exampleAccessPoint.Arn,
    52  //					TransformationConfigurations: s3control.ObjectLambdaAccessPointConfigurationTransformationConfigurationArray{
    53  //						&s3control.ObjectLambdaAccessPointConfigurationTransformationConfigurationArgs{
    54  //							Actions: pulumi.StringArray{
    55  //								pulumi.String("GetObject"),
    56  //							},
    57  //							ContentTransformation: &s3control.ObjectLambdaAccessPointConfigurationTransformationConfigurationContentTransformationArgs{
    58  //								AwsLambda: &s3control.ObjectLambdaAccessPointConfigurationTransformationConfigurationContentTransformationAwsLambdaArgs{
    59  //									FunctionArn: pulumi.Any(exampleAwsLambdaFunction.Arn),
    60  //								},
    61  //							},
    62  //						},
    63  //					},
    64  //				},
    65  //			})
    66  //			if err != nil {
    67  //				return err
    68  //			}
    69  //			_, err = s3control.NewObjectLambdaAccessPointPolicy(ctx, "example", &s3control.ObjectLambdaAccessPointPolicyArgs{
    70  //				Name: exampleObjectLambdaAccessPoint.Name,
    71  //				Policy: exampleObjectLambdaAccessPoint.Arn.ApplyT(func(arn string) (pulumi.String, error) {
    72  //					var _zero pulumi.String
    73  //					tmpJSON0, err := json.Marshal(map[string]interface{}{
    74  //						"Version": "2008-10-17",
    75  //						"Statement": []map[string]interface{}{
    76  //							map[string]interface{}{
    77  //								"Effect": "Allow",
    78  //								"Action": "s3-object-lambda:GetObject",
    79  //								"Principal": map[string]interface{}{
    80  //									"AWS": current.AccountId,
    81  //								},
    82  //								"Resource": arn,
    83  //							},
    84  //						},
    85  //					})
    86  //					if err != nil {
    87  //						return _zero, err
    88  //					}
    89  //					json0 := string(tmpJSON0)
    90  //					return pulumi.String(json0), nil
    91  //				}).(pulumi.StringOutput),
    92  //			})
    93  //			if err != nil {
    94  //				return err
    95  //			}
    96  //			return nil
    97  //		})
    98  //	}
    99  //
   100  // ```
   101  // <!--End PulumiCodeChooser -->
   102  //
   103  // ## Import
   104  //
   105  // Using `pulumi import`, import Object Lambda Access Point policies using the `account_id` and `name`, separated by a colon (`:`). For example:
   106  //
   107  // ```sh
   108  // $ pulumi import aws:s3control/objectLambdaAccessPointPolicy:ObjectLambdaAccessPointPolicy example 123456789012:example
   109  // ```
   110  type ObjectLambdaAccessPointPolicy struct {
   111  	pulumi.CustomResourceState
   112  
   113  	// The AWS account ID for the account that owns the Object Lambda Access Point. Defaults to automatically determined account ID of the AWS provider.
   114  	AccountId pulumi.StringOutput `pulumi:"accountId"`
   115  	// Indicates whether this access point currently has a policy that allows public access.
   116  	HasPublicAccessPolicy pulumi.BoolOutput `pulumi:"hasPublicAccessPolicy"`
   117  	// The name of the Object Lambda Access Point.
   118  	Name pulumi.StringOutput `pulumi:"name"`
   119  	// The Object Lambda Access Point resource policy document.
   120  	Policy pulumi.StringOutput `pulumi:"policy"`
   121  }
   122  
   123  // NewObjectLambdaAccessPointPolicy registers a new resource with the given unique name, arguments, and options.
   124  func NewObjectLambdaAccessPointPolicy(ctx *pulumi.Context,
   125  	name string, args *ObjectLambdaAccessPointPolicyArgs, opts ...pulumi.ResourceOption) (*ObjectLambdaAccessPointPolicy, error) {
   126  	if args == nil {
   127  		return nil, errors.New("missing one or more required arguments")
   128  	}
   129  
   130  	if args.Policy == nil {
   131  		return nil, errors.New("invalid value for required argument 'Policy'")
   132  	}
   133  	opts = internal.PkgResourceDefaultOpts(opts)
   134  	var resource ObjectLambdaAccessPointPolicy
   135  	err := ctx.RegisterResource("aws:s3control/objectLambdaAccessPointPolicy:ObjectLambdaAccessPointPolicy", name, args, &resource, opts...)
   136  	if err != nil {
   137  		return nil, err
   138  	}
   139  	return &resource, nil
   140  }
   141  
   142  // GetObjectLambdaAccessPointPolicy gets an existing ObjectLambdaAccessPointPolicy resource's state with the given name, ID, and optional
   143  // state properties that are used to uniquely qualify the lookup (nil if not required).
   144  func GetObjectLambdaAccessPointPolicy(ctx *pulumi.Context,
   145  	name string, id pulumi.IDInput, state *ObjectLambdaAccessPointPolicyState, opts ...pulumi.ResourceOption) (*ObjectLambdaAccessPointPolicy, error) {
   146  	var resource ObjectLambdaAccessPointPolicy
   147  	err := ctx.ReadResource("aws:s3control/objectLambdaAccessPointPolicy:ObjectLambdaAccessPointPolicy", name, id, state, &resource, opts...)
   148  	if err != nil {
   149  		return nil, err
   150  	}
   151  	return &resource, nil
   152  }
   153  
   154  // Input properties used for looking up and filtering ObjectLambdaAccessPointPolicy resources.
   155  type objectLambdaAccessPointPolicyState struct {
   156  	// The AWS account ID for the account that owns the Object Lambda Access Point. Defaults to automatically determined account ID of the AWS provider.
   157  	AccountId *string `pulumi:"accountId"`
   158  	// Indicates whether this access point currently has a policy that allows public access.
   159  	HasPublicAccessPolicy *bool `pulumi:"hasPublicAccessPolicy"`
   160  	// The name of the Object Lambda Access Point.
   161  	Name *string `pulumi:"name"`
   162  	// The Object Lambda Access Point resource policy document.
   163  	Policy *string `pulumi:"policy"`
   164  }
   165  
   166  type ObjectLambdaAccessPointPolicyState struct {
   167  	// The AWS account ID for the account that owns the Object Lambda Access Point. Defaults to automatically determined account ID of the AWS provider.
   168  	AccountId pulumi.StringPtrInput
   169  	// Indicates whether this access point currently has a policy that allows public access.
   170  	HasPublicAccessPolicy pulumi.BoolPtrInput
   171  	// The name of the Object Lambda Access Point.
   172  	Name pulumi.StringPtrInput
   173  	// The Object Lambda Access Point resource policy document.
   174  	Policy pulumi.StringPtrInput
   175  }
   176  
   177  func (ObjectLambdaAccessPointPolicyState) ElementType() reflect.Type {
   178  	return reflect.TypeOf((*objectLambdaAccessPointPolicyState)(nil)).Elem()
   179  }
   180  
   181  type objectLambdaAccessPointPolicyArgs struct {
   182  	// The AWS account ID for the account that owns the Object Lambda Access Point. Defaults to automatically determined account ID of the AWS provider.
   183  	AccountId *string `pulumi:"accountId"`
   184  	// The name of the Object Lambda Access Point.
   185  	Name *string `pulumi:"name"`
   186  	// The Object Lambda Access Point resource policy document.
   187  	Policy string `pulumi:"policy"`
   188  }
   189  
   190  // The set of arguments for constructing a ObjectLambdaAccessPointPolicy resource.
   191  type ObjectLambdaAccessPointPolicyArgs struct {
   192  	// The AWS account ID for the account that owns the Object Lambda Access Point. Defaults to automatically determined account ID of the AWS provider.
   193  	AccountId pulumi.StringPtrInput
   194  	// The name of the Object Lambda Access Point.
   195  	Name pulumi.StringPtrInput
   196  	// The Object Lambda Access Point resource policy document.
   197  	Policy pulumi.StringInput
   198  }
   199  
   200  func (ObjectLambdaAccessPointPolicyArgs) ElementType() reflect.Type {
   201  	return reflect.TypeOf((*objectLambdaAccessPointPolicyArgs)(nil)).Elem()
   202  }
   203  
   204  type ObjectLambdaAccessPointPolicyInput interface {
   205  	pulumi.Input
   206  
   207  	ToObjectLambdaAccessPointPolicyOutput() ObjectLambdaAccessPointPolicyOutput
   208  	ToObjectLambdaAccessPointPolicyOutputWithContext(ctx context.Context) ObjectLambdaAccessPointPolicyOutput
   209  }
   210  
   211  func (*ObjectLambdaAccessPointPolicy) ElementType() reflect.Type {
   212  	return reflect.TypeOf((**ObjectLambdaAccessPointPolicy)(nil)).Elem()
   213  }
   214  
   215  func (i *ObjectLambdaAccessPointPolicy) ToObjectLambdaAccessPointPolicyOutput() ObjectLambdaAccessPointPolicyOutput {
   216  	return i.ToObjectLambdaAccessPointPolicyOutputWithContext(context.Background())
   217  }
   218  
   219  func (i *ObjectLambdaAccessPointPolicy) ToObjectLambdaAccessPointPolicyOutputWithContext(ctx context.Context) ObjectLambdaAccessPointPolicyOutput {
   220  	return pulumi.ToOutputWithContext(ctx, i).(ObjectLambdaAccessPointPolicyOutput)
   221  }
   222  
   223  // ObjectLambdaAccessPointPolicyArrayInput is an input type that accepts ObjectLambdaAccessPointPolicyArray and ObjectLambdaAccessPointPolicyArrayOutput values.
   224  // You can construct a concrete instance of `ObjectLambdaAccessPointPolicyArrayInput` via:
   225  //
   226  //	ObjectLambdaAccessPointPolicyArray{ ObjectLambdaAccessPointPolicyArgs{...} }
   227  type ObjectLambdaAccessPointPolicyArrayInput interface {
   228  	pulumi.Input
   229  
   230  	ToObjectLambdaAccessPointPolicyArrayOutput() ObjectLambdaAccessPointPolicyArrayOutput
   231  	ToObjectLambdaAccessPointPolicyArrayOutputWithContext(context.Context) ObjectLambdaAccessPointPolicyArrayOutput
   232  }
   233  
   234  type ObjectLambdaAccessPointPolicyArray []ObjectLambdaAccessPointPolicyInput
   235  
   236  func (ObjectLambdaAccessPointPolicyArray) ElementType() reflect.Type {
   237  	return reflect.TypeOf((*[]*ObjectLambdaAccessPointPolicy)(nil)).Elem()
   238  }
   239  
   240  func (i ObjectLambdaAccessPointPolicyArray) ToObjectLambdaAccessPointPolicyArrayOutput() ObjectLambdaAccessPointPolicyArrayOutput {
   241  	return i.ToObjectLambdaAccessPointPolicyArrayOutputWithContext(context.Background())
   242  }
   243  
   244  func (i ObjectLambdaAccessPointPolicyArray) ToObjectLambdaAccessPointPolicyArrayOutputWithContext(ctx context.Context) ObjectLambdaAccessPointPolicyArrayOutput {
   245  	return pulumi.ToOutputWithContext(ctx, i).(ObjectLambdaAccessPointPolicyArrayOutput)
   246  }
   247  
   248  // ObjectLambdaAccessPointPolicyMapInput is an input type that accepts ObjectLambdaAccessPointPolicyMap and ObjectLambdaAccessPointPolicyMapOutput values.
   249  // You can construct a concrete instance of `ObjectLambdaAccessPointPolicyMapInput` via:
   250  //
   251  //	ObjectLambdaAccessPointPolicyMap{ "key": ObjectLambdaAccessPointPolicyArgs{...} }
   252  type ObjectLambdaAccessPointPolicyMapInput interface {
   253  	pulumi.Input
   254  
   255  	ToObjectLambdaAccessPointPolicyMapOutput() ObjectLambdaAccessPointPolicyMapOutput
   256  	ToObjectLambdaAccessPointPolicyMapOutputWithContext(context.Context) ObjectLambdaAccessPointPolicyMapOutput
   257  }
   258  
   259  type ObjectLambdaAccessPointPolicyMap map[string]ObjectLambdaAccessPointPolicyInput
   260  
   261  func (ObjectLambdaAccessPointPolicyMap) ElementType() reflect.Type {
   262  	return reflect.TypeOf((*map[string]*ObjectLambdaAccessPointPolicy)(nil)).Elem()
   263  }
   264  
   265  func (i ObjectLambdaAccessPointPolicyMap) ToObjectLambdaAccessPointPolicyMapOutput() ObjectLambdaAccessPointPolicyMapOutput {
   266  	return i.ToObjectLambdaAccessPointPolicyMapOutputWithContext(context.Background())
   267  }
   268  
   269  func (i ObjectLambdaAccessPointPolicyMap) ToObjectLambdaAccessPointPolicyMapOutputWithContext(ctx context.Context) ObjectLambdaAccessPointPolicyMapOutput {
   270  	return pulumi.ToOutputWithContext(ctx, i).(ObjectLambdaAccessPointPolicyMapOutput)
   271  }
   272  
   273  type ObjectLambdaAccessPointPolicyOutput struct{ *pulumi.OutputState }
   274  
   275  func (ObjectLambdaAccessPointPolicyOutput) ElementType() reflect.Type {
   276  	return reflect.TypeOf((**ObjectLambdaAccessPointPolicy)(nil)).Elem()
   277  }
   278  
   279  func (o ObjectLambdaAccessPointPolicyOutput) ToObjectLambdaAccessPointPolicyOutput() ObjectLambdaAccessPointPolicyOutput {
   280  	return o
   281  }
   282  
   283  func (o ObjectLambdaAccessPointPolicyOutput) ToObjectLambdaAccessPointPolicyOutputWithContext(ctx context.Context) ObjectLambdaAccessPointPolicyOutput {
   284  	return o
   285  }
   286  
   287  // The AWS account ID for the account that owns the Object Lambda Access Point. Defaults to automatically determined account ID of the AWS provider.
   288  func (o ObjectLambdaAccessPointPolicyOutput) AccountId() pulumi.StringOutput {
   289  	return o.ApplyT(func(v *ObjectLambdaAccessPointPolicy) pulumi.StringOutput { return v.AccountId }).(pulumi.StringOutput)
   290  }
   291  
   292  // Indicates whether this access point currently has a policy that allows public access.
   293  func (o ObjectLambdaAccessPointPolicyOutput) HasPublicAccessPolicy() pulumi.BoolOutput {
   294  	return o.ApplyT(func(v *ObjectLambdaAccessPointPolicy) pulumi.BoolOutput { return v.HasPublicAccessPolicy }).(pulumi.BoolOutput)
   295  }
   296  
   297  // The name of the Object Lambda Access Point.
   298  func (o ObjectLambdaAccessPointPolicyOutput) Name() pulumi.StringOutput {
   299  	return o.ApplyT(func(v *ObjectLambdaAccessPointPolicy) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   300  }
   301  
   302  // The Object Lambda Access Point resource policy document.
   303  func (o ObjectLambdaAccessPointPolicyOutput) Policy() pulumi.StringOutput {
   304  	return o.ApplyT(func(v *ObjectLambdaAccessPointPolicy) pulumi.StringOutput { return v.Policy }).(pulumi.StringOutput)
   305  }
   306  
   307  type ObjectLambdaAccessPointPolicyArrayOutput struct{ *pulumi.OutputState }
   308  
   309  func (ObjectLambdaAccessPointPolicyArrayOutput) ElementType() reflect.Type {
   310  	return reflect.TypeOf((*[]*ObjectLambdaAccessPointPolicy)(nil)).Elem()
   311  }
   312  
   313  func (o ObjectLambdaAccessPointPolicyArrayOutput) ToObjectLambdaAccessPointPolicyArrayOutput() ObjectLambdaAccessPointPolicyArrayOutput {
   314  	return o
   315  }
   316  
   317  func (o ObjectLambdaAccessPointPolicyArrayOutput) ToObjectLambdaAccessPointPolicyArrayOutputWithContext(ctx context.Context) ObjectLambdaAccessPointPolicyArrayOutput {
   318  	return o
   319  }
   320  
   321  func (o ObjectLambdaAccessPointPolicyArrayOutput) Index(i pulumi.IntInput) ObjectLambdaAccessPointPolicyOutput {
   322  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ObjectLambdaAccessPointPolicy {
   323  		return vs[0].([]*ObjectLambdaAccessPointPolicy)[vs[1].(int)]
   324  	}).(ObjectLambdaAccessPointPolicyOutput)
   325  }
   326  
   327  type ObjectLambdaAccessPointPolicyMapOutput struct{ *pulumi.OutputState }
   328  
   329  func (ObjectLambdaAccessPointPolicyMapOutput) ElementType() reflect.Type {
   330  	return reflect.TypeOf((*map[string]*ObjectLambdaAccessPointPolicy)(nil)).Elem()
   331  }
   332  
   333  func (o ObjectLambdaAccessPointPolicyMapOutput) ToObjectLambdaAccessPointPolicyMapOutput() ObjectLambdaAccessPointPolicyMapOutput {
   334  	return o
   335  }
   336  
   337  func (o ObjectLambdaAccessPointPolicyMapOutput) ToObjectLambdaAccessPointPolicyMapOutputWithContext(ctx context.Context) ObjectLambdaAccessPointPolicyMapOutput {
   338  	return o
   339  }
   340  
   341  func (o ObjectLambdaAccessPointPolicyMapOutput) MapIndex(k pulumi.StringInput) ObjectLambdaAccessPointPolicyOutput {
   342  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ObjectLambdaAccessPointPolicy {
   343  		return vs[0].(map[string]*ObjectLambdaAccessPointPolicy)[vs[1].(string)]
   344  	}).(ObjectLambdaAccessPointPolicyOutput)
   345  }
   346  
   347  func init() {
   348  	pulumi.RegisterInputType(reflect.TypeOf((*ObjectLambdaAccessPointPolicyInput)(nil)).Elem(), &ObjectLambdaAccessPointPolicy{})
   349  	pulumi.RegisterInputType(reflect.TypeOf((*ObjectLambdaAccessPointPolicyArrayInput)(nil)).Elem(), ObjectLambdaAccessPointPolicyArray{})
   350  	pulumi.RegisterInputType(reflect.TypeOf((*ObjectLambdaAccessPointPolicyMapInput)(nil)).Elem(), ObjectLambdaAccessPointPolicyMap{})
   351  	pulumi.RegisterOutputType(ObjectLambdaAccessPointPolicyOutput{})
   352  	pulumi.RegisterOutputType(ObjectLambdaAccessPointPolicyArrayOutput{})
   353  	pulumi.RegisterOutputType(ObjectLambdaAccessPointPolicyMapOutput{})
   354  }