1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. oss
  5. getBucketObjects
Alibaba Cloud v3.52.1 published on Thursday, Apr 4, 2024 by Pulumi

alicloud.oss.getBucketObjects

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.52.1 published on Thursday, Apr 4, 2024 by Pulumi

    This data source provides the objects of an OSS bucket.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const bucketObjectsDs = alicloud.oss.getBucketObjects({
        bucketName: "sample_bucket",
        keyRegex: "sample/sample_object.txt",
    });
    export const firstObjectKey = bucketObjectsDs.then(bucketObjectsDs => bucketObjectsDs.objects?.[0]?.key);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    bucket_objects_ds = alicloud.oss.get_bucket_objects(bucket_name="sample_bucket",
        key_regex="sample/sample_object.txt")
    pulumi.export("firstObjectKey", bucket_objects_ds.objects[0].key)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/oss"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		bucketObjectsDs, err := oss.GetBucketObjects(ctx, &oss.GetBucketObjectsArgs{
    			BucketName: "sample_bucket",
    			KeyRegex:   pulumi.StringRef("sample/sample_object.txt"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("firstObjectKey", bucketObjectsDs.Objects[0].Key)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var bucketObjectsDs = AliCloud.Oss.GetBucketObjects.Invoke(new()
        {
            BucketName = "sample_bucket",
            KeyRegex = "sample/sample_object.txt",
        });
    
        return new Dictionary<string, object?>
        {
            ["firstObjectKey"] = bucketObjectsDs.Apply(getBucketObjectsResult => getBucketObjectsResult.Objects[0]?.Key),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.oss.OssFunctions;
    import com.pulumi.alicloud.oss.inputs.GetBucketObjectsArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var bucketObjectsDs = OssFunctions.getBucketObjects(GetBucketObjectsArgs.builder()
                .bucketName("sample_bucket")
                .keyRegex("sample/sample_object.txt")
                .build());
    
            ctx.export("firstObjectKey", bucketObjectsDs.applyValue(getBucketObjectsResult -> getBucketObjectsResult.objects()[0].key()));
        }
    }
    
    variables:
      bucketObjectsDs:
        fn::invoke:
          Function: alicloud:oss:getBucketObjects
          Arguments:
            bucketName: sample_bucket
            keyRegex: sample/sample_object.txt
    outputs:
      firstObjectKey: ${bucketObjectsDs.objects[0].key}
    

    Using getBucketObjects

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getBucketObjects(args: GetBucketObjectsArgs, opts?: InvokeOptions): Promise<GetBucketObjectsResult>
    function getBucketObjectsOutput(args: GetBucketObjectsOutputArgs, opts?: InvokeOptions): Output<GetBucketObjectsResult>
    def get_bucket_objects(bucket_name: Optional[str] = None,
                           key_prefix: Optional[str] = None,
                           key_regex: Optional[str] = None,
                           output_file: Optional[str] = None,
                           opts: Optional[InvokeOptions] = None) -> GetBucketObjectsResult
    def get_bucket_objects_output(bucket_name: Optional[pulumi.Input[str]] = None,
                           key_prefix: Optional[pulumi.Input[str]] = None,
                           key_regex: Optional[pulumi.Input[str]] = None,
                           output_file: Optional[pulumi.Input[str]] = None,
                           opts: Optional[InvokeOptions] = None) -> Output[GetBucketObjectsResult]
    func GetBucketObjects(ctx *Context, args *GetBucketObjectsArgs, opts ...InvokeOption) (*GetBucketObjectsResult, error)
    func GetBucketObjectsOutput(ctx *Context, args *GetBucketObjectsOutputArgs, opts ...InvokeOption) GetBucketObjectsResultOutput

    > Note: This function is named GetBucketObjects in the Go SDK.

    public static class GetBucketObjects 
    {
        public static Task<GetBucketObjectsResult> InvokeAsync(GetBucketObjectsArgs args, InvokeOptions? opts = null)
        public static Output<GetBucketObjectsResult> Invoke(GetBucketObjectsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetBucketObjectsResult> getBucketObjects(GetBucketObjectsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:oss/getBucketObjects:getBucketObjects
      arguments:
        # arguments dictionary

    The following arguments are supported:

    BucketName string
    Name of the bucket that contains the objects to find.
    KeyPrefix string
    Filter results by the given key prefix (such as "path/to/folder/logs-").
    KeyRegex string
    A regex string to filter results by key.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    BucketName string
    Name of the bucket that contains the objects to find.
    KeyPrefix string
    Filter results by the given key prefix (such as "path/to/folder/logs-").
    KeyRegex string
    A regex string to filter results by key.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    bucketName String
    Name of the bucket that contains the objects to find.
    keyPrefix String
    Filter results by the given key prefix (such as "path/to/folder/logs-").
    keyRegex String
    A regex string to filter results by key.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    bucketName string
    Name of the bucket that contains the objects to find.
    keyPrefix string
    Filter results by the given key prefix (such as "path/to/folder/logs-").
    keyRegex string
    A regex string to filter results by key.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    bucket_name str
    Name of the bucket that contains the objects to find.
    key_prefix str
    Filter results by the given key prefix (such as "path/to/folder/logs-").
    key_regex str
    A regex string to filter results by key.
    output_file str
    File name where to save data source results (after running pulumi preview).
    bucketName String
    Name of the bucket that contains the objects to find.
    keyPrefix String
    Filter results by the given key prefix (such as "path/to/folder/logs-").
    keyRegex String
    A regex string to filter results by key.
    outputFile String
    File name where to save data source results (after running pulumi preview).

    getBucketObjects Result

    The following output properties are available:

    BucketName string
    Id string
    The provider-assigned unique ID for this managed resource.
    Objects List<Pulumi.AliCloud.Oss.Outputs.GetBucketObjectsObject>
    A list of bucket objects. Each element contains the following attributes:
    KeyPrefix string
    KeyRegex string
    OutputFile string
    BucketName string
    Id string
    The provider-assigned unique ID for this managed resource.
    Objects []GetBucketObjectsObject
    A list of bucket objects. Each element contains the following attributes:
    KeyPrefix string
    KeyRegex string
    OutputFile string
    bucketName String
    id String
    The provider-assigned unique ID for this managed resource.
    objects List<GetBucketObjectsObject>
    A list of bucket objects. Each element contains the following attributes:
    keyPrefix String
    keyRegex String
    outputFile String
    bucketName string
    id string
    The provider-assigned unique ID for this managed resource.
    objects GetBucketObjectsObject[]
    A list of bucket objects. Each element contains the following attributes:
    keyPrefix string
    keyRegex string
    outputFile string
    bucket_name str
    id str
    The provider-assigned unique ID for this managed resource.
    objects Sequence[GetBucketObjectsObject]
    A list of bucket objects. Each element contains the following attributes:
    key_prefix str
    key_regex str
    output_file str
    bucketName String
    id String
    The provider-assigned unique ID for this managed resource.
    objects List<Property Map>
    A list of bucket objects. Each element contains the following attributes:
    keyPrefix String
    keyRegex String
    outputFile String

    Supporting Types

    GetBucketObjectsObject

    Acl string
    Object access control list. Possible values: default, private, public-read and public-read-write.
    CacheControl string
    Caching behavior along the request/reply chain. Read RFC2616 Cache-Control for further details.
    ContentDisposition string
    Presentational information for the object. Read RFC2616 Content-Disposition for further details.
    ContentEncoding string
    Content encodings that have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field. Read RFC2616 Content-Encoding for further details.
    ContentLength string
    Size of the object in bytes.
    ContentMd5 string
    MD5 value of the content. Read MD5 for computing method.
    ContentType string
    Standard MIME type describing the format of the object data, e.g. "application/octet-stream".
    Etag string
    ETag generated for the object (MD5 sum of the object content).
    Expires string
    Expiration date for the the request/response. Read RFC2616 Expires for further details.
    Key string
    Object key.
    LastModificationTime string
    Last modification time of the object.
    ServerSideEncryption string
    Server-side encryption of the object in OSS. It can be empty or AES256.
    SseKmsKeyId string
    If present, specifies the ID of the Key Management Service(KMS) master encryption key that was used for the object.
    StorageClass string
    Object storage type. Possible values: Standard, IA, Archive and ColdArchive.
    Acl string
    Object access control list. Possible values: default, private, public-read and public-read-write.
    CacheControl string
    Caching behavior along the request/reply chain. Read RFC2616 Cache-Control for further details.
    ContentDisposition string
    Presentational information for the object. Read RFC2616 Content-Disposition for further details.
    ContentEncoding string
    Content encodings that have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field. Read RFC2616 Content-Encoding for further details.
    ContentLength string
    Size of the object in bytes.
    ContentMd5 string
    MD5 value of the content. Read MD5 for computing method.
    ContentType string
    Standard MIME type describing the format of the object data, e.g. "application/octet-stream".
    Etag string
    ETag generated for the object (MD5 sum of the object content).
    Expires string
    Expiration date for the the request/response. Read RFC2616 Expires for further details.
    Key string
    Object key.
    LastModificationTime string
    Last modification time of the object.
    ServerSideEncryption string
    Server-side encryption of the object in OSS. It can be empty or AES256.
    SseKmsKeyId string
    If present, specifies the ID of the Key Management Service(KMS) master encryption key that was used for the object.
    StorageClass string
    Object storage type. Possible values: Standard, IA, Archive and ColdArchive.
    acl String
    Object access control list. Possible values: default, private, public-read and public-read-write.
    cacheControl String
    Caching behavior along the request/reply chain. Read RFC2616 Cache-Control for further details.
    contentDisposition String
    Presentational information for the object. Read RFC2616 Content-Disposition for further details.
    contentEncoding String
    Content encodings that have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field. Read RFC2616 Content-Encoding for further details.
    contentLength String
    Size of the object in bytes.
    contentMd5 String
    MD5 value of the content. Read MD5 for computing method.
    contentType String
    Standard MIME type describing the format of the object data, e.g. "application/octet-stream".
    etag String
    ETag generated for the object (MD5 sum of the object content).
    expires String
    Expiration date for the the request/response. Read RFC2616 Expires for further details.
    key String
    Object key.
    lastModificationTime String
    Last modification time of the object.
    serverSideEncryption String
    Server-side encryption of the object in OSS. It can be empty or AES256.
    sseKmsKeyId String
    If present, specifies the ID of the Key Management Service(KMS) master encryption key that was used for the object.
    storageClass String
    Object storage type. Possible values: Standard, IA, Archive and ColdArchive.
    acl string
    Object access control list. Possible values: default, private, public-read and public-read-write.
    cacheControl string
    Caching behavior along the request/reply chain. Read RFC2616 Cache-Control for further details.
    contentDisposition string
    Presentational information for the object. Read RFC2616 Content-Disposition for further details.
    contentEncoding string
    Content encodings that have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field. Read RFC2616 Content-Encoding for further details.
    contentLength string
    Size of the object in bytes.
    contentMd5 string
    MD5 value of the content. Read MD5 for computing method.
    contentType string
    Standard MIME type describing the format of the object data, e.g. "application/octet-stream".
    etag string
    ETag generated for the object (MD5 sum of the object content).
    expires string
    Expiration date for the the request/response. Read RFC2616 Expires for further details.
    key string
    Object key.
    lastModificationTime string
    Last modification time of the object.
    serverSideEncryption string
    Server-side encryption of the object in OSS. It can be empty or AES256.
    sseKmsKeyId string
    If present, specifies the ID of the Key Management Service(KMS) master encryption key that was used for the object.
    storageClass string
    Object storage type. Possible values: Standard, IA, Archive and ColdArchive.
    acl str
    Object access control list. Possible values: default, private, public-read and public-read-write.
    cache_control str
    Caching behavior along the request/reply chain. Read RFC2616 Cache-Control for further details.
    content_disposition str
    Presentational information for the object. Read RFC2616 Content-Disposition for further details.
    content_encoding str
    Content encodings that have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field. Read RFC2616 Content-Encoding for further details.
    content_length str
    Size of the object in bytes.
    content_md5 str
    MD5 value of the content. Read MD5 for computing method.
    content_type str
    Standard MIME type describing the format of the object data, e.g. "application/octet-stream".
    etag str
    ETag generated for the object (MD5 sum of the object content).
    expires str
    Expiration date for the the request/response. Read RFC2616 Expires for further details.
    key str
    Object key.
    last_modification_time str
    Last modification time of the object.
    server_side_encryption str
    Server-side encryption of the object in OSS. It can be empty or AES256.
    sse_kms_key_id str
    If present, specifies the ID of the Key Management Service(KMS) master encryption key that was used for the object.
    storage_class str
    Object storage type. Possible values: Standard, IA, Archive and ColdArchive.
    acl String
    Object access control list. Possible values: default, private, public-read and public-read-write.
    cacheControl String
    Caching behavior along the request/reply chain. Read RFC2616 Cache-Control for further details.
    contentDisposition String
    Presentational information for the object. Read RFC2616 Content-Disposition for further details.
    contentEncoding String
    Content encodings that have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field. Read RFC2616 Content-Encoding for further details.
    contentLength String
    Size of the object in bytes.
    contentMd5 String
    MD5 value of the content. Read MD5 for computing method.
    contentType String
    Standard MIME type describing the format of the object data, e.g. "application/octet-stream".
    etag String
    ETag generated for the object (MD5 sum of the object content).
    expires String
    Expiration date for the the request/response. Read RFC2616 Expires for further details.
    key String
    Object key.
    lastModificationTime String
    Last modification time of the object.
    serverSideEncryption String
    Server-side encryption of the object in OSS. It can be empty or AES256.
    sseKmsKeyId String
    If present, specifies the ID of the Key Management Service(KMS) master encryption key that was used for the object.
    storageClass String
    Object storage type. Possible values: Standard, IA, Archive and ColdArchive.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.52.1 published on Thursday, Apr 4, 2024 by Pulumi