github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/lakeformation/resource.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 lakeformation
     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  // Registers a Lake Formation resource (e.g., S3 bucket) as managed by the Data Catalog. In other words, the S3 path is added to the data lake.
    16  //
    17  // Choose a role that has read/write access to the chosen Amazon S3 path or use the service-linked role.
    18  // When you register the S3 path, the service-linked role and a new inline policy are created on your behalf.
    19  // Lake Formation adds the first path to the inline policy and attaches it to the service-linked role.
    20  // When you register subsequent paths, Lake Formation adds the path to the existing policy.
    21  //
    22  // ## Example Usage
    23  //
    24  // <!--Start PulumiCodeChooser -->
    25  // ```go
    26  // package main
    27  //
    28  // import (
    29  //
    30  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lakeformation"
    31  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
    32  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    33  //
    34  // )
    35  //
    36  //	func main() {
    37  //		pulumi.Run(func(ctx *pulumi.Context) error {
    38  //			example, err := s3.LookupBucket(ctx, &s3.LookupBucketArgs{
    39  //				Bucket: "an-example-bucket",
    40  //			}, nil)
    41  //			if err != nil {
    42  //				return err
    43  //			}
    44  //			_, err = lakeformation.NewResource(ctx, "example", &lakeformation.ResourceArgs{
    45  //				Arn: pulumi.String(example.Arn),
    46  //			})
    47  //			if err != nil {
    48  //				return err
    49  //			}
    50  //			return nil
    51  //		})
    52  //	}
    53  //
    54  // ```
    55  // <!--End PulumiCodeChooser -->
    56  type Resource struct {
    57  	pulumi.CustomResourceState
    58  
    59  	// Amazon Resource Name (ARN) of the resource.
    60  	//
    61  	// The following arguments are optional:
    62  	Arn pulumi.StringOutput `pulumi:"arn"`
    63  	// Flag to enable AWS LakeFormation hybrid access permission mode.
    64  	//
    65  	// > **NOTE:** AWS does not support registering an S3 location with an IAM role and subsequently updating the S3 location registration to a service-linked role.
    66  	HybridAccessEnabled pulumi.BoolOutput `pulumi:"hybridAccessEnabled"`
    67  	// Date and time the resource was last modified in [RFC 3339 format](https://tools.ietf.org/html/rfc3339#section-5.8).
    68  	LastModified pulumi.StringOutput `pulumi:"lastModified"`
    69  	// Role that has read/write access to the resource.
    70  	RoleArn pulumi.StringOutput `pulumi:"roleArn"`
    71  	// Designates an AWS Identity and Access Management (IAM) service-linked role by registering this role with the Data Catalog.
    72  	UseServiceLinkedRole pulumi.BoolPtrOutput `pulumi:"useServiceLinkedRole"`
    73  	WithFederation       pulumi.BoolOutput    `pulumi:"withFederation"`
    74  }
    75  
    76  // NewResource registers a new resource with the given unique name, arguments, and options.
    77  func NewResource(ctx *pulumi.Context,
    78  	name string, args *ResourceArgs, opts ...pulumi.ResourceOption) (*Resource, error) {
    79  	if args == nil {
    80  		return nil, errors.New("missing one or more required arguments")
    81  	}
    82  
    83  	if args.Arn == nil {
    84  		return nil, errors.New("invalid value for required argument 'Arn'")
    85  	}
    86  	opts = internal.PkgResourceDefaultOpts(opts)
    87  	var resource Resource
    88  	err := ctx.RegisterResource("aws:lakeformation/resource:Resource", name, args, &resource, opts...)
    89  	if err != nil {
    90  		return nil, err
    91  	}
    92  	return &resource, nil
    93  }
    94  
    95  // GetResource gets an existing Resource resource's state with the given name, ID, and optional
    96  // state properties that are used to uniquely qualify the lookup (nil if not required).
    97  func GetResource(ctx *pulumi.Context,
    98  	name string, id pulumi.IDInput, state *ResourceState, opts ...pulumi.ResourceOption) (*Resource, error) {
    99  	var resource Resource
   100  	err := ctx.ReadResource("aws:lakeformation/resource:Resource", name, id, state, &resource, opts...)
   101  	if err != nil {
   102  		return nil, err
   103  	}
   104  	return &resource, nil
   105  }
   106  
   107  // Input properties used for looking up and filtering Resource resources.
   108  type resourceState struct {
   109  	// Amazon Resource Name (ARN) of the resource.
   110  	//
   111  	// The following arguments are optional:
   112  	Arn *string `pulumi:"arn"`
   113  	// Flag to enable AWS LakeFormation hybrid access permission mode.
   114  	//
   115  	// > **NOTE:** AWS does not support registering an S3 location with an IAM role and subsequently updating the S3 location registration to a service-linked role.
   116  	HybridAccessEnabled *bool `pulumi:"hybridAccessEnabled"`
   117  	// Date and time the resource was last modified in [RFC 3339 format](https://tools.ietf.org/html/rfc3339#section-5.8).
   118  	LastModified *string `pulumi:"lastModified"`
   119  	// Role that has read/write access to the resource.
   120  	RoleArn *string `pulumi:"roleArn"`
   121  	// Designates an AWS Identity and Access Management (IAM) service-linked role by registering this role with the Data Catalog.
   122  	UseServiceLinkedRole *bool `pulumi:"useServiceLinkedRole"`
   123  	WithFederation       *bool `pulumi:"withFederation"`
   124  }
   125  
   126  type ResourceState struct {
   127  	// Amazon Resource Name (ARN) of the resource.
   128  	//
   129  	// The following arguments are optional:
   130  	Arn pulumi.StringPtrInput
   131  	// Flag to enable AWS LakeFormation hybrid access permission mode.
   132  	//
   133  	// > **NOTE:** AWS does not support registering an S3 location with an IAM role and subsequently updating the S3 location registration to a service-linked role.
   134  	HybridAccessEnabled pulumi.BoolPtrInput
   135  	// Date and time the resource was last modified in [RFC 3339 format](https://tools.ietf.org/html/rfc3339#section-5.8).
   136  	LastModified pulumi.StringPtrInput
   137  	// Role that has read/write access to the resource.
   138  	RoleArn pulumi.StringPtrInput
   139  	// Designates an AWS Identity and Access Management (IAM) service-linked role by registering this role with the Data Catalog.
   140  	UseServiceLinkedRole pulumi.BoolPtrInput
   141  	WithFederation       pulumi.BoolPtrInput
   142  }
   143  
   144  func (ResourceState) ElementType() reflect.Type {
   145  	return reflect.TypeOf((*resourceState)(nil)).Elem()
   146  }
   147  
   148  type resourceArgs struct {
   149  	// Amazon Resource Name (ARN) of the resource.
   150  	//
   151  	// The following arguments are optional:
   152  	Arn string `pulumi:"arn"`
   153  	// Flag to enable AWS LakeFormation hybrid access permission mode.
   154  	//
   155  	// > **NOTE:** AWS does not support registering an S3 location with an IAM role and subsequently updating the S3 location registration to a service-linked role.
   156  	HybridAccessEnabled *bool `pulumi:"hybridAccessEnabled"`
   157  	// Role that has read/write access to the resource.
   158  	RoleArn *string `pulumi:"roleArn"`
   159  	// Designates an AWS Identity and Access Management (IAM) service-linked role by registering this role with the Data Catalog.
   160  	UseServiceLinkedRole *bool `pulumi:"useServiceLinkedRole"`
   161  	WithFederation       *bool `pulumi:"withFederation"`
   162  }
   163  
   164  // The set of arguments for constructing a Resource resource.
   165  type ResourceArgs struct {
   166  	// Amazon Resource Name (ARN) of the resource.
   167  	//
   168  	// The following arguments are optional:
   169  	Arn pulumi.StringInput
   170  	// Flag to enable AWS LakeFormation hybrid access permission mode.
   171  	//
   172  	// > **NOTE:** AWS does not support registering an S3 location with an IAM role and subsequently updating the S3 location registration to a service-linked role.
   173  	HybridAccessEnabled pulumi.BoolPtrInput
   174  	// Role that has read/write access to the resource.
   175  	RoleArn pulumi.StringPtrInput
   176  	// Designates an AWS Identity and Access Management (IAM) service-linked role by registering this role with the Data Catalog.
   177  	UseServiceLinkedRole pulumi.BoolPtrInput
   178  	WithFederation       pulumi.BoolPtrInput
   179  }
   180  
   181  func (ResourceArgs) ElementType() reflect.Type {
   182  	return reflect.TypeOf((*resourceArgs)(nil)).Elem()
   183  }
   184  
   185  type ResourceInput interface {
   186  	pulumi.Input
   187  
   188  	ToResourceOutput() ResourceOutput
   189  	ToResourceOutputWithContext(ctx context.Context) ResourceOutput
   190  }
   191  
   192  func (*Resource) ElementType() reflect.Type {
   193  	return reflect.TypeOf((**Resource)(nil)).Elem()
   194  }
   195  
   196  func (i *Resource) ToResourceOutput() ResourceOutput {
   197  	return i.ToResourceOutputWithContext(context.Background())
   198  }
   199  
   200  func (i *Resource) ToResourceOutputWithContext(ctx context.Context) ResourceOutput {
   201  	return pulumi.ToOutputWithContext(ctx, i).(ResourceOutput)
   202  }
   203  
   204  // ResourceArrayInput is an input type that accepts ResourceArray and ResourceArrayOutput values.
   205  // You can construct a concrete instance of `ResourceArrayInput` via:
   206  //
   207  //	ResourceArray{ ResourceArgs{...} }
   208  type ResourceArrayInput interface {
   209  	pulumi.Input
   210  
   211  	ToResourceArrayOutput() ResourceArrayOutput
   212  	ToResourceArrayOutputWithContext(context.Context) ResourceArrayOutput
   213  }
   214  
   215  type ResourceArray []ResourceInput
   216  
   217  func (ResourceArray) ElementType() reflect.Type {
   218  	return reflect.TypeOf((*[]*Resource)(nil)).Elem()
   219  }
   220  
   221  func (i ResourceArray) ToResourceArrayOutput() ResourceArrayOutput {
   222  	return i.ToResourceArrayOutputWithContext(context.Background())
   223  }
   224  
   225  func (i ResourceArray) ToResourceArrayOutputWithContext(ctx context.Context) ResourceArrayOutput {
   226  	return pulumi.ToOutputWithContext(ctx, i).(ResourceArrayOutput)
   227  }
   228  
   229  // ResourceMapInput is an input type that accepts ResourceMap and ResourceMapOutput values.
   230  // You can construct a concrete instance of `ResourceMapInput` via:
   231  //
   232  //	ResourceMap{ "key": ResourceArgs{...} }
   233  type ResourceMapInput interface {
   234  	pulumi.Input
   235  
   236  	ToResourceMapOutput() ResourceMapOutput
   237  	ToResourceMapOutputWithContext(context.Context) ResourceMapOutput
   238  }
   239  
   240  type ResourceMap map[string]ResourceInput
   241  
   242  func (ResourceMap) ElementType() reflect.Type {
   243  	return reflect.TypeOf((*map[string]*Resource)(nil)).Elem()
   244  }
   245  
   246  func (i ResourceMap) ToResourceMapOutput() ResourceMapOutput {
   247  	return i.ToResourceMapOutputWithContext(context.Background())
   248  }
   249  
   250  func (i ResourceMap) ToResourceMapOutputWithContext(ctx context.Context) ResourceMapOutput {
   251  	return pulumi.ToOutputWithContext(ctx, i).(ResourceMapOutput)
   252  }
   253  
   254  type ResourceOutput struct{ *pulumi.OutputState }
   255  
   256  func (ResourceOutput) ElementType() reflect.Type {
   257  	return reflect.TypeOf((**Resource)(nil)).Elem()
   258  }
   259  
   260  func (o ResourceOutput) ToResourceOutput() ResourceOutput {
   261  	return o
   262  }
   263  
   264  func (o ResourceOutput) ToResourceOutputWithContext(ctx context.Context) ResourceOutput {
   265  	return o
   266  }
   267  
   268  // Amazon Resource Name (ARN) of the resource.
   269  //
   270  // The following arguments are optional:
   271  func (o ResourceOutput) Arn() pulumi.StringOutput {
   272  	return o.ApplyT(func(v *Resource) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   273  }
   274  
   275  // Flag to enable AWS LakeFormation hybrid access permission mode.
   276  //
   277  // > **NOTE:** AWS does not support registering an S3 location with an IAM role and subsequently updating the S3 location registration to a service-linked role.
   278  func (o ResourceOutput) HybridAccessEnabled() pulumi.BoolOutput {
   279  	return o.ApplyT(func(v *Resource) pulumi.BoolOutput { return v.HybridAccessEnabled }).(pulumi.BoolOutput)
   280  }
   281  
   282  // Date and time the resource was last modified in [RFC 3339 format](https://tools.ietf.org/html/rfc3339#section-5.8).
   283  func (o ResourceOutput) LastModified() pulumi.StringOutput {
   284  	return o.ApplyT(func(v *Resource) pulumi.StringOutput { return v.LastModified }).(pulumi.StringOutput)
   285  }
   286  
   287  // Role that has read/write access to the resource.
   288  func (o ResourceOutput) RoleArn() pulumi.StringOutput {
   289  	return o.ApplyT(func(v *Resource) pulumi.StringOutput { return v.RoleArn }).(pulumi.StringOutput)
   290  }
   291  
   292  // Designates an AWS Identity and Access Management (IAM) service-linked role by registering this role with the Data Catalog.
   293  func (o ResourceOutput) UseServiceLinkedRole() pulumi.BoolPtrOutput {
   294  	return o.ApplyT(func(v *Resource) pulumi.BoolPtrOutput { return v.UseServiceLinkedRole }).(pulumi.BoolPtrOutput)
   295  }
   296  
   297  func (o ResourceOutput) WithFederation() pulumi.BoolOutput {
   298  	return o.ApplyT(func(v *Resource) pulumi.BoolOutput { return v.WithFederation }).(pulumi.BoolOutput)
   299  }
   300  
   301  type ResourceArrayOutput struct{ *pulumi.OutputState }
   302  
   303  func (ResourceArrayOutput) ElementType() reflect.Type {
   304  	return reflect.TypeOf((*[]*Resource)(nil)).Elem()
   305  }
   306  
   307  func (o ResourceArrayOutput) ToResourceArrayOutput() ResourceArrayOutput {
   308  	return o
   309  }
   310  
   311  func (o ResourceArrayOutput) ToResourceArrayOutputWithContext(ctx context.Context) ResourceArrayOutput {
   312  	return o
   313  }
   314  
   315  func (o ResourceArrayOutput) Index(i pulumi.IntInput) ResourceOutput {
   316  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Resource {
   317  		return vs[0].([]*Resource)[vs[1].(int)]
   318  	}).(ResourceOutput)
   319  }
   320  
   321  type ResourceMapOutput struct{ *pulumi.OutputState }
   322  
   323  func (ResourceMapOutput) ElementType() reflect.Type {
   324  	return reflect.TypeOf((*map[string]*Resource)(nil)).Elem()
   325  }
   326  
   327  func (o ResourceMapOutput) ToResourceMapOutput() ResourceMapOutput {
   328  	return o
   329  }
   330  
   331  func (o ResourceMapOutput) ToResourceMapOutputWithContext(ctx context.Context) ResourceMapOutput {
   332  	return o
   333  }
   334  
   335  func (o ResourceMapOutput) MapIndex(k pulumi.StringInput) ResourceOutput {
   336  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Resource {
   337  		return vs[0].(map[string]*Resource)[vs[1].(string)]
   338  	}).(ResourceOutput)
   339  }
   340  
   341  func init() {
   342  	pulumi.RegisterInputType(reflect.TypeOf((*ResourceInput)(nil)).Elem(), &Resource{})
   343  	pulumi.RegisterInputType(reflect.TypeOf((*ResourceArrayInput)(nil)).Elem(), ResourceArray{})
   344  	pulumi.RegisterInputType(reflect.TypeOf((*ResourceMapInput)(nil)).Elem(), ResourceMap{})
   345  	pulumi.RegisterOutputType(ResourceOutput{})
   346  	pulumi.RegisterOutputType(ResourceArrayOutput{})
   347  	pulumi.RegisterOutputType(ResourceMapOutput{})
   348  }