github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/s3/getObjects.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 s3
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // > **NOTE on `maxKeys`:** Retrieving very large numbers of keys can adversely affect the provider's performance.
    15  //
    16  // The objects data source returns keys (i.e., file names) and other metadata about objects in an S3 bucket.
    17  func GetObjects(ctx *pulumi.Context, args *GetObjectsArgs, opts ...pulumi.InvokeOption) (*GetObjectsResult, error) {
    18  	opts = internal.PkgInvokeDefaultOpts(opts)
    19  	var rv GetObjectsResult
    20  	err := ctx.Invoke("aws:s3/getObjects:getObjects", args, &rv, opts...)
    21  	if err != nil {
    22  		return nil, err
    23  	}
    24  	return &rv, nil
    25  }
    26  
    27  // A collection of arguments for invoking getObjects.
    28  type GetObjectsArgs struct {
    29  	// Lists object keys in this S3 bucket. Alternatively, an [S3 access point](https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) ARN can be specified
    30  	Bucket string `pulumi:"bucket"`
    31  	// Character used to group keys (Default: none)
    32  	Delimiter *string `pulumi:"delimiter"`
    33  	// Encodes keys using this method (Default: none; besides none, only "url" can be used)
    34  	EncodingType *string `pulumi:"encodingType"`
    35  	// Boolean specifying whether to populate the owner list (Default: false)
    36  	FetchOwner *bool `pulumi:"fetchOwner"`
    37  	// Maximum object keys to return (Default: 1000)
    38  	MaxKeys *int `pulumi:"maxKeys"`
    39  	// Limits results to object keys with this prefix (Default: none)
    40  	Prefix *string `pulumi:"prefix"`
    41  	// Confirms that the requester knows that they will be charged for the request. Bucket owners need not specify this parameter in their requests. If included, the only valid value is `requester`.
    42  	RequestPayer *string `pulumi:"requestPayer"`
    43  	// Returns key names lexicographically after a specific object key in your bucket (Default: none; S3 lists object keys in UTF-8 character encoding in lexicographical order)
    44  	StartAfter *string `pulumi:"startAfter"`
    45  }
    46  
    47  // A collection of values returned by getObjects.
    48  type GetObjectsResult struct {
    49  	Bucket string `pulumi:"bucket"`
    50  	// List of any keys between `prefix` and the next occurrence of `delimiter` (i.e., similar to subdirectories of the `prefix` "directory"); the list is only returned when you specify `delimiter`
    51  	CommonPrefixes []string `pulumi:"commonPrefixes"`
    52  	Delimiter      *string  `pulumi:"delimiter"`
    53  	EncodingType   *string  `pulumi:"encodingType"`
    54  	FetchOwner     *bool    `pulumi:"fetchOwner"`
    55  	// The provider-assigned unique ID for this managed resource.
    56  	Id string `pulumi:"id"`
    57  	// List of strings representing object keys
    58  	Keys    []string `pulumi:"keys"`
    59  	MaxKeys *int     `pulumi:"maxKeys"`
    60  	// List of strings representing object owner IDs (see `fetchOwner` above)
    61  	Owners []string `pulumi:"owners"`
    62  	Prefix *string  `pulumi:"prefix"`
    63  	// If present, indicates that the requester was successfully charged for the request.
    64  	RequestCharged string  `pulumi:"requestCharged"`
    65  	RequestPayer   *string `pulumi:"requestPayer"`
    66  	StartAfter     *string `pulumi:"startAfter"`
    67  }
    68  
    69  func GetObjectsOutput(ctx *pulumi.Context, args GetObjectsOutputArgs, opts ...pulumi.InvokeOption) GetObjectsResultOutput {
    70  	return pulumi.ToOutputWithContext(context.Background(), args).
    71  		ApplyT(func(v interface{}) (GetObjectsResult, error) {
    72  			args := v.(GetObjectsArgs)
    73  			r, err := GetObjects(ctx, &args, opts...)
    74  			var s GetObjectsResult
    75  			if r != nil {
    76  				s = *r
    77  			}
    78  			return s, err
    79  		}).(GetObjectsResultOutput)
    80  }
    81  
    82  // A collection of arguments for invoking getObjects.
    83  type GetObjectsOutputArgs struct {
    84  	// Lists object keys in this S3 bucket. Alternatively, an [S3 access point](https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) ARN can be specified
    85  	Bucket pulumi.StringInput `pulumi:"bucket"`
    86  	// Character used to group keys (Default: none)
    87  	Delimiter pulumi.StringPtrInput `pulumi:"delimiter"`
    88  	// Encodes keys using this method (Default: none; besides none, only "url" can be used)
    89  	EncodingType pulumi.StringPtrInput `pulumi:"encodingType"`
    90  	// Boolean specifying whether to populate the owner list (Default: false)
    91  	FetchOwner pulumi.BoolPtrInput `pulumi:"fetchOwner"`
    92  	// Maximum object keys to return (Default: 1000)
    93  	MaxKeys pulumi.IntPtrInput `pulumi:"maxKeys"`
    94  	// Limits results to object keys with this prefix (Default: none)
    95  	Prefix pulumi.StringPtrInput `pulumi:"prefix"`
    96  	// Confirms that the requester knows that they will be charged for the request. Bucket owners need not specify this parameter in their requests. If included, the only valid value is `requester`.
    97  	RequestPayer pulumi.StringPtrInput `pulumi:"requestPayer"`
    98  	// Returns key names lexicographically after a specific object key in your bucket (Default: none; S3 lists object keys in UTF-8 character encoding in lexicographical order)
    99  	StartAfter pulumi.StringPtrInput `pulumi:"startAfter"`
   100  }
   101  
   102  func (GetObjectsOutputArgs) ElementType() reflect.Type {
   103  	return reflect.TypeOf((*GetObjectsArgs)(nil)).Elem()
   104  }
   105  
   106  // A collection of values returned by getObjects.
   107  type GetObjectsResultOutput struct{ *pulumi.OutputState }
   108  
   109  func (GetObjectsResultOutput) ElementType() reflect.Type {
   110  	return reflect.TypeOf((*GetObjectsResult)(nil)).Elem()
   111  }
   112  
   113  func (o GetObjectsResultOutput) ToGetObjectsResultOutput() GetObjectsResultOutput {
   114  	return o
   115  }
   116  
   117  func (o GetObjectsResultOutput) ToGetObjectsResultOutputWithContext(ctx context.Context) GetObjectsResultOutput {
   118  	return o
   119  }
   120  
   121  func (o GetObjectsResultOutput) Bucket() pulumi.StringOutput {
   122  	return o.ApplyT(func(v GetObjectsResult) string { return v.Bucket }).(pulumi.StringOutput)
   123  }
   124  
   125  // List of any keys between `prefix` and the next occurrence of `delimiter` (i.e., similar to subdirectories of the `prefix` "directory"); the list is only returned when you specify `delimiter`
   126  func (o GetObjectsResultOutput) CommonPrefixes() pulumi.StringArrayOutput {
   127  	return o.ApplyT(func(v GetObjectsResult) []string { return v.CommonPrefixes }).(pulumi.StringArrayOutput)
   128  }
   129  
   130  func (o GetObjectsResultOutput) Delimiter() pulumi.StringPtrOutput {
   131  	return o.ApplyT(func(v GetObjectsResult) *string { return v.Delimiter }).(pulumi.StringPtrOutput)
   132  }
   133  
   134  func (o GetObjectsResultOutput) EncodingType() pulumi.StringPtrOutput {
   135  	return o.ApplyT(func(v GetObjectsResult) *string { return v.EncodingType }).(pulumi.StringPtrOutput)
   136  }
   137  
   138  func (o GetObjectsResultOutput) FetchOwner() pulumi.BoolPtrOutput {
   139  	return o.ApplyT(func(v GetObjectsResult) *bool { return v.FetchOwner }).(pulumi.BoolPtrOutput)
   140  }
   141  
   142  // The provider-assigned unique ID for this managed resource.
   143  func (o GetObjectsResultOutput) Id() pulumi.StringOutput {
   144  	return o.ApplyT(func(v GetObjectsResult) string { return v.Id }).(pulumi.StringOutput)
   145  }
   146  
   147  // List of strings representing object keys
   148  func (o GetObjectsResultOutput) Keys() pulumi.StringArrayOutput {
   149  	return o.ApplyT(func(v GetObjectsResult) []string { return v.Keys }).(pulumi.StringArrayOutput)
   150  }
   151  
   152  func (o GetObjectsResultOutput) MaxKeys() pulumi.IntPtrOutput {
   153  	return o.ApplyT(func(v GetObjectsResult) *int { return v.MaxKeys }).(pulumi.IntPtrOutput)
   154  }
   155  
   156  // List of strings representing object owner IDs (see `fetchOwner` above)
   157  func (o GetObjectsResultOutput) Owners() pulumi.StringArrayOutput {
   158  	return o.ApplyT(func(v GetObjectsResult) []string { return v.Owners }).(pulumi.StringArrayOutput)
   159  }
   160  
   161  func (o GetObjectsResultOutput) Prefix() pulumi.StringPtrOutput {
   162  	return o.ApplyT(func(v GetObjectsResult) *string { return v.Prefix }).(pulumi.StringPtrOutput)
   163  }
   164  
   165  // If present, indicates that the requester was successfully charged for the request.
   166  func (o GetObjectsResultOutput) RequestCharged() pulumi.StringOutput {
   167  	return o.ApplyT(func(v GetObjectsResult) string { return v.RequestCharged }).(pulumi.StringOutput)
   168  }
   169  
   170  func (o GetObjectsResultOutput) RequestPayer() pulumi.StringPtrOutput {
   171  	return o.ApplyT(func(v GetObjectsResult) *string { return v.RequestPayer }).(pulumi.StringPtrOutput)
   172  }
   173  
   174  func (o GetObjectsResultOutput) StartAfter() pulumi.StringPtrOutput {
   175  	return o.ApplyT(func(v GetObjectsResult) *string { return v.StartAfter }).(pulumi.StringPtrOutput)
   176  }
   177  
   178  func init() {
   179  	pulumi.RegisterOutputType(GetObjectsResultOutput{})
   180  }