github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/s3control/accessGrantsLocation.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 Access Grants location.
    16  // A location is an S3 resource (bucket or prefix) in a permission grant that the grantee can access.
    17  // The S3 data must be in the same Region as your S3 Access Grants instance.
    18  // When you register a location, you must include the IAM role that has permission to manage the S3 location that you are registering.
    19  //
    20  // ## Example Usage
    21  //
    22  // <!--Start PulumiCodeChooser -->
    23  // ```go
    24  // package main
    25  //
    26  // import (
    27  //
    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 := s3control.NewAccessGrantsInstance(ctx, "example", nil)
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			_, err = s3control.NewAccessGrantsLocation(ctx, "example", &s3control.AccessGrantsLocationArgs{
    40  //				IamRoleArn:    pulumi.Any(exampleAwsIamRole.Arn),
    41  //				LocationScope: pulumi.String("s3://"),
    42  //			}, pulumi.DependsOn([]pulumi.Resource{
    43  //				example,
    44  //			}))
    45  //			if err != nil {
    46  //				return err
    47  //			}
    48  //			return nil
    49  //		})
    50  //	}
    51  //
    52  // ```
    53  // <!--End PulumiCodeChooser -->
    54  //
    55  // ## Import
    56  //
    57  // Using `pulumi import`, import S3 Access Grants locations using the `account_id` and `access_grants_location_id`, separated by a comma (`,`). For example:
    58  //
    59  // ```sh
    60  // $ pulumi import aws:s3control/accessGrantsLocation:AccessGrantsLocation example 123456789012,default
    61  // ```
    62  type AccessGrantsLocation struct {
    63  	pulumi.CustomResourceState
    64  
    65  	// Amazon Resource Name (ARN) of the S3 Access Grants location.
    66  	AccessGrantsLocationArn pulumi.StringOutput `pulumi:"accessGrantsLocationArn"`
    67  	// Unique ID of the S3 Access Grants location.
    68  	AccessGrantsLocationId pulumi.StringOutput `pulumi:"accessGrantsLocationId"`
    69  	AccountId              pulumi.StringOutput `pulumi:"accountId"`
    70  	// The ARN of the IAM role that S3 Access Grants should use when fulfilling runtime access
    71  	// requests to the location.
    72  	IamRoleArn pulumi.StringOutput `pulumi:"iamRoleArn"`
    73  	// The default S3 URI `s3://` or the URI to a custom location, a specific bucket or prefix.
    74  	LocationScope pulumi.StringOutput `pulumi:"locationScope"`
    75  	// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    76  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    77  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    78  	//
    79  	// Deprecated: Please use `tags` instead.
    80  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    81  }
    82  
    83  // NewAccessGrantsLocation registers a new resource with the given unique name, arguments, and options.
    84  func NewAccessGrantsLocation(ctx *pulumi.Context,
    85  	name string, args *AccessGrantsLocationArgs, opts ...pulumi.ResourceOption) (*AccessGrantsLocation, error) {
    86  	if args == nil {
    87  		return nil, errors.New("missing one or more required arguments")
    88  	}
    89  
    90  	if args.IamRoleArn == nil {
    91  		return nil, errors.New("invalid value for required argument 'IamRoleArn'")
    92  	}
    93  	if args.LocationScope == nil {
    94  		return nil, errors.New("invalid value for required argument 'LocationScope'")
    95  	}
    96  	opts = internal.PkgResourceDefaultOpts(opts)
    97  	var resource AccessGrantsLocation
    98  	err := ctx.RegisterResource("aws:s3control/accessGrantsLocation:AccessGrantsLocation", name, args, &resource, opts...)
    99  	if err != nil {
   100  		return nil, err
   101  	}
   102  	return &resource, nil
   103  }
   104  
   105  // GetAccessGrantsLocation gets an existing AccessGrantsLocation resource's state with the given name, ID, and optional
   106  // state properties that are used to uniquely qualify the lookup (nil if not required).
   107  func GetAccessGrantsLocation(ctx *pulumi.Context,
   108  	name string, id pulumi.IDInput, state *AccessGrantsLocationState, opts ...pulumi.ResourceOption) (*AccessGrantsLocation, error) {
   109  	var resource AccessGrantsLocation
   110  	err := ctx.ReadResource("aws:s3control/accessGrantsLocation:AccessGrantsLocation", name, id, state, &resource, opts...)
   111  	if err != nil {
   112  		return nil, err
   113  	}
   114  	return &resource, nil
   115  }
   116  
   117  // Input properties used for looking up and filtering AccessGrantsLocation resources.
   118  type accessGrantsLocationState struct {
   119  	// Amazon Resource Name (ARN) of the S3 Access Grants location.
   120  	AccessGrantsLocationArn *string `pulumi:"accessGrantsLocationArn"`
   121  	// Unique ID of the S3 Access Grants location.
   122  	AccessGrantsLocationId *string `pulumi:"accessGrantsLocationId"`
   123  	AccountId              *string `pulumi:"accountId"`
   124  	// The ARN of the IAM role that S3 Access Grants should use when fulfilling runtime access
   125  	// requests to the location.
   126  	IamRoleArn *string `pulumi:"iamRoleArn"`
   127  	// The default S3 URI `s3://` or the URI to a custom location, a specific bucket or prefix.
   128  	LocationScope *string `pulumi:"locationScope"`
   129  	// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   130  	Tags map[string]string `pulumi:"tags"`
   131  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   132  	//
   133  	// Deprecated: Please use `tags` instead.
   134  	TagsAll map[string]string `pulumi:"tagsAll"`
   135  }
   136  
   137  type AccessGrantsLocationState struct {
   138  	// Amazon Resource Name (ARN) of the S3 Access Grants location.
   139  	AccessGrantsLocationArn pulumi.StringPtrInput
   140  	// Unique ID of the S3 Access Grants location.
   141  	AccessGrantsLocationId pulumi.StringPtrInput
   142  	AccountId              pulumi.StringPtrInput
   143  	// The ARN of the IAM role that S3 Access Grants should use when fulfilling runtime access
   144  	// requests to the location.
   145  	IamRoleArn pulumi.StringPtrInput
   146  	// The default S3 URI `s3://` or the URI to a custom location, a specific bucket or prefix.
   147  	LocationScope pulumi.StringPtrInput
   148  	// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   149  	Tags pulumi.StringMapInput
   150  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   151  	//
   152  	// Deprecated: Please use `tags` instead.
   153  	TagsAll pulumi.StringMapInput
   154  }
   155  
   156  func (AccessGrantsLocationState) ElementType() reflect.Type {
   157  	return reflect.TypeOf((*accessGrantsLocationState)(nil)).Elem()
   158  }
   159  
   160  type accessGrantsLocationArgs struct {
   161  	AccountId *string `pulumi:"accountId"`
   162  	// The ARN of the IAM role that S3 Access Grants should use when fulfilling runtime access
   163  	// requests to the location.
   164  	IamRoleArn string `pulumi:"iamRoleArn"`
   165  	// The default S3 URI `s3://` or the URI to a custom location, a specific bucket or prefix.
   166  	LocationScope string `pulumi:"locationScope"`
   167  	// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   168  	Tags map[string]string `pulumi:"tags"`
   169  }
   170  
   171  // The set of arguments for constructing a AccessGrantsLocation resource.
   172  type AccessGrantsLocationArgs struct {
   173  	AccountId pulumi.StringPtrInput
   174  	// The ARN of the IAM role that S3 Access Grants should use when fulfilling runtime access
   175  	// requests to the location.
   176  	IamRoleArn pulumi.StringInput
   177  	// The default S3 URI `s3://` or the URI to a custom location, a specific bucket or prefix.
   178  	LocationScope pulumi.StringInput
   179  	// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   180  	Tags pulumi.StringMapInput
   181  }
   182  
   183  func (AccessGrantsLocationArgs) ElementType() reflect.Type {
   184  	return reflect.TypeOf((*accessGrantsLocationArgs)(nil)).Elem()
   185  }
   186  
   187  type AccessGrantsLocationInput interface {
   188  	pulumi.Input
   189  
   190  	ToAccessGrantsLocationOutput() AccessGrantsLocationOutput
   191  	ToAccessGrantsLocationOutputWithContext(ctx context.Context) AccessGrantsLocationOutput
   192  }
   193  
   194  func (*AccessGrantsLocation) ElementType() reflect.Type {
   195  	return reflect.TypeOf((**AccessGrantsLocation)(nil)).Elem()
   196  }
   197  
   198  func (i *AccessGrantsLocation) ToAccessGrantsLocationOutput() AccessGrantsLocationOutput {
   199  	return i.ToAccessGrantsLocationOutputWithContext(context.Background())
   200  }
   201  
   202  func (i *AccessGrantsLocation) ToAccessGrantsLocationOutputWithContext(ctx context.Context) AccessGrantsLocationOutput {
   203  	return pulumi.ToOutputWithContext(ctx, i).(AccessGrantsLocationOutput)
   204  }
   205  
   206  // AccessGrantsLocationArrayInput is an input type that accepts AccessGrantsLocationArray and AccessGrantsLocationArrayOutput values.
   207  // You can construct a concrete instance of `AccessGrantsLocationArrayInput` via:
   208  //
   209  //	AccessGrantsLocationArray{ AccessGrantsLocationArgs{...} }
   210  type AccessGrantsLocationArrayInput interface {
   211  	pulumi.Input
   212  
   213  	ToAccessGrantsLocationArrayOutput() AccessGrantsLocationArrayOutput
   214  	ToAccessGrantsLocationArrayOutputWithContext(context.Context) AccessGrantsLocationArrayOutput
   215  }
   216  
   217  type AccessGrantsLocationArray []AccessGrantsLocationInput
   218  
   219  func (AccessGrantsLocationArray) ElementType() reflect.Type {
   220  	return reflect.TypeOf((*[]*AccessGrantsLocation)(nil)).Elem()
   221  }
   222  
   223  func (i AccessGrantsLocationArray) ToAccessGrantsLocationArrayOutput() AccessGrantsLocationArrayOutput {
   224  	return i.ToAccessGrantsLocationArrayOutputWithContext(context.Background())
   225  }
   226  
   227  func (i AccessGrantsLocationArray) ToAccessGrantsLocationArrayOutputWithContext(ctx context.Context) AccessGrantsLocationArrayOutput {
   228  	return pulumi.ToOutputWithContext(ctx, i).(AccessGrantsLocationArrayOutput)
   229  }
   230  
   231  // AccessGrantsLocationMapInput is an input type that accepts AccessGrantsLocationMap and AccessGrantsLocationMapOutput values.
   232  // You can construct a concrete instance of `AccessGrantsLocationMapInput` via:
   233  //
   234  //	AccessGrantsLocationMap{ "key": AccessGrantsLocationArgs{...} }
   235  type AccessGrantsLocationMapInput interface {
   236  	pulumi.Input
   237  
   238  	ToAccessGrantsLocationMapOutput() AccessGrantsLocationMapOutput
   239  	ToAccessGrantsLocationMapOutputWithContext(context.Context) AccessGrantsLocationMapOutput
   240  }
   241  
   242  type AccessGrantsLocationMap map[string]AccessGrantsLocationInput
   243  
   244  func (AccessGrantsLocationMap) ElementType() reflect.Type {
   245  	return reflect.TypeOf((*map[string]*AccessGrantsLocation)(nil)).Elem()
   246  }
   247  
   248  func (i AccessGrantsLocationMap) ToAccessGrantsLocationMapOutput() AccessGrantsLocationMapOutput {
   249  	return i.ToAccessGrantsLocationMapOutputWithContext(context.Background())
   250  }
   251  
   252  func (i AccessGrantsLocationMap) ToAccessGrantsLocationMapOutputWithContext(ctx context.Context) AccessGrantsLocationMapOutput {
   253  	return pulumi.ToOutputWithContext(ctx, i).(AccessGrantsLocationMapOutput)
   254  }
   255  
   256  type AccessGrantsLocationOutput struct{ *pulumi.OutputState }
   257  
   258  func (AccessGrantsLocationOutput) ElementType() reflect.Type {
   259  	return reflect.TypeOf((**AccessGrantsLocation)(nil)).Elem()
   260  }
   261  
   262  func (o AccessGrantsLocationOutput) ToAccessGrantsLocationOutput() AccessGrantsLocationOutput {
   263  	return o
   264  }
   265  
   266  func (o AccessGrantsLocationOutput) ToAccessGrantsLocationOutputWithContext(ctx context.Context) AccessGrantsLocationOutput {
   267  	return o
   268  }
   269  
   270  // Amazon Resource Name (ARN) of the S3 Access Grants location.
   271  func (o AccessGrantsLocationOutput) AccessGrantsLocationArn() pulumi.StringOutput {
   272  	return o.ApplyT(func(v *AccessGrantsLocation) pulumi.StringOutput { return v.AccessGrantsLocationArn }).(pulumi.StringOutput)
   273  }
   274  
   275  // Unique ID of the S3 Access Grants location.
   276  func (o AccessGrantsLocationOutput) AccessGrantsLocationId() pulumi.StringOutput {
   277  	return o.ApplyT(func(v *AccessGrantsLocation) pulumi.StringOutput { return v.AccessGrantsLocationId }).(pulumi.StringOutput)
   278  }
   279  
   280  func (o AccessGrantsLocationOutput) AccountId() pulumi.StringOutput {
   281  	return o.ApplyT(func(v *AccessGrantsLocation) pulumi.StringOutput { return v.AccountId }).(pulumi.StringOutput)
   282  }
   283  
   284  // The ARN of the IAM role that S3 Access Grants should use when fulfilling runtime access
   285  // requests to the location.
   286  func (o AccessGrantsLocationOutput) IamRoleArn() pulumi.StringOutput {
   287  	return o.ApplyT(func(v *AccessGrantsLocation) pulumi.StringOutput { return v.IamRoleArn }).(pulumi.StringOutput)
   288  }
   289  
   290  // The default S3 URI `s3://` or the URI to a custom location, a specific bucket or prefix.
   291  func (o AccessGrantsLocationOutput) LocationScope() pulumi.StringOutput {
   292  	return o.ApplyT(func(v *AccessGrantsLocation) pulumi.StringOutput { return v.LocationScope }).(pulumi.StringOutput)
   293  }
   294  
   295  // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   296  func (o AccessGrantsLocationOutput) Tags() pulumi.StringMapOutput {
   297  	return o.ApplyT(func(v *AccessGrantsLocation) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   298  }
   299  
   300  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   301  //
   302  // Deprecated: Please use `tags` instead.
   303  func (o AccessGrantsLocationOutput) TagsAll() pulumi.StringMapOutput {
   304  	return o.ApplyT(func(v *AccessGrantsLocation) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   305  }
   306  
   307  type AccessGrantsLocationArrayOutput struct{ *pulumi.OutputState }
   308  
   309  func (AccessGrantsLocationArrayOutput) ElementType() reflect.Type {
   310  	return reflect.TypeOf((*[]*AccessGrantsLocation)(nil)).Elem()
   311  }
   312  
   313  func (o AccessGrantsLocationArrayOutput) ToAccessGrantsLocationArrayOutput() AccessGrantsLocationArrayOutput {
   314  	return o
   315  }
   316  
   317  func (o AccessGrantsLocationArrayOutput) ToAccessGrantsLocationArrayOutputWithContext(ctx context.Context) AccessGrantsLocationArrayOutput {
   318  	return o
   319  }
   320  
   321  func (o AccessGrantsLocationArrayOutput) Index(i pulumi.IntInput) AccessGrantsLocationOutput {
   322  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *AccessGrantsLocation {
   323  		return vs[0].([]*AccessGrantsLocation)[vs[1].(int)]
   324  	}).(AccessGrantsLocationOutput)
   325  }
   326  
   327  type AccessGrantsLocationMapOutput struct{ *pulumi.OutputState }
   328  
   329  func (AccessGrantsLocationMapOutput) ElementType() reflect.Type {
   330  	return reflect.TypeOf((*map[string]*AccessGrantsLocation)(nil)).Elem()
   331  }
   332  
   333  func (o AccessGrantsLocationMapOutput) ToAccessGrantsLocationMapOutput() AccessGrantsLocationMapOutput {
   334  	return o
   335  }
   336  
   337  func (o AccessGrantsLocationMapOutput) ToAccessGrantsLocationMapOutputWithContext(ctx context.Context) AccessGrantsLocationMapOutput {
   338  	return o
   339  }
   340  
   341  func (o AccessGrantsLocationMapOutput) MapIndex(k pulumi.StringInput) AccessGrantsLocationOutput {
   342  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *AccessGrantsLocation {
   343  		return vs[0].(map[string]*AccessGrantsLocation)[vs[1].(string)]
   344  	}).(AccessGrantsLocationOutput)
   345  }
   346  
   347  func init() {
   348  	pulumi.RegisterInputType(reflect.TypeOf((*AccessGrantsLocationInput)(nil)).Elem(), &AccessGrantsLocation{})
   349  	pulumi.RegisterInputType(reflect.TypeOf((*AccessGrantsLocationArrayInput)(nil)).Elem(), AccessGrantsLocationArray{})
   350  	pulumi.RegisterInputType(reflect.TypeOf((*AccessGrantsLocationMapInput)(nil)).Elem(), AccessGrantsLocationMap{})
   351  	pulumi.RegisterOutputType(AccessGrantsLocationOutput{})
   352  	pulumi.RegisterOutputType(AccessGrantsLocationArrayOutput{})
   353  	pulumi.RegisterOutputType(AccessGrantsLocationMapOutput{})
   354  }