Oracle Cloud Infrastructure v2.33.0 published on Thursday, May 1, 2025 by Pulumi
oci.ObjectStorage.getObject
Explore with Pulumi AI
This data source provides details about a specific Object resource in Oracle Cloud Infrastructure Object Storage service.
Gets the metadata and body of an object.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as oci from "@pulumi/oci";
const testObject = oci.ObjectStorage.getObject({
    bucket: objectBucket,
    namespace: objectNamespace,
    object: objectObject,
    httpResponseCacheControl: objectHttpResponseCacheControl,
    httpResponseContentDisposition: objectHttpResponseContentDisposition,
    httpResponseContentEncoding: objectHttpResponseContentEncoding,
    httpResponseContentLanguage: objectHttpResponseContentLanguage,
    httpResponseContentType: objectHttpResponseContentType,
    httpResponseExpires: objectHttpResponseExpires,
    versionId: testVersion.id,
});
import pulumi
import pulumi_oci as oci
test_object = oci.ObjectStorage.get_object(bucket=object_bucket,
    namespace=object_namespace,
    object=object_object,
    http_response_cache_control=object_http_response_cache_control,
    http_response_content_disposition=object_http_response_content_disposition,
    http_response_content_encoding=object_http_response_content_encoding,
    http_response_content_language=object_http_response_content_language,
    http_response_content_type=object_http_response_content_type,
    http_response_expires=object_http_response_expires,
    version_id=test_version["id"])
package main
import (
	"github.com/pulumi/pulumi-oci/sdk/v2/go/oci/objectstorage"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := objectstorage.GetObject(ctx, &objectstorage.GetObjectArgs{
			Bucket:                         objectBucket,
			Namespace:                      objectNamespace,
			Object:                         objectObject,
			HttpResponseCacheControl:       pulumi.StringRef(objectHttpResponseCacheControl),
			HttpResponseContentDisposition: pulumi.StringRef(objectHttpResponseContentDisposition),
			HttpResponseContentEncoding:    pulumi.StringRef(objectHttpResponseContentEncoding),
			HttpResponseContentLanguage:    pulumi.StringRef(objectHttpResponseContentLanguage),
			HttpResponseContentType:        pulumi.StringRef(objectHttpResponseContentType),
			HttpResponseExpires:            pulumi.StringRef(objectHttpResponseExpires),
			VersionId:                      pulumi.StringRef(testVersion.Id),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Oci = Pulumi.Oci;
return await Deployment.RunAsync(() => 
{
    var testObject = Oci.ObjectStorage.GetObject.Invoke(new()
    {
        Bucket = objectBucket,
        Namespace = objectNamespace,
        Object = objectObject,
        HttpResponseCacheControl = objectHttpResponseCacheControl,
        HttpResponseContentDisposition = objectHttpResponseContentDisposition,
        HttpResponseContentEncoding = objectHttpResponseContentEncoding,
        HttpResponseContentLanguage = objectHttpResponseContentLanguage,
        HttpResponseContentType = objectHttpResponseContentType,
        HttpResponseExpires = objectHttpResponseExpires,
        VersionId = testVersion.Id,
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.oci.ObjectStorage.ObjectStorageFunctions;
import com.pulumi.oci.ObjectStorage.inputs.GetObjectArgs;
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 testObject = ObjectStorageFunctions.getObject(GetObjectArgs.builder()
            .bucket(objectBucket)
            .namespace(objectNamespace)
            .object(objectObject)
            .httpResponseCacheControl(objectHttpResponseCacheControl)
            .httpResponseContentDisposition(objectHttpResponseContentDisposition)
            .httpResponseContentEncoding(objectHttpResponseContentEncoding)
            .httpResponseContentLanguage(objectHttpResponseContentLanguage)
            .httpResponseContentType(objectHttpResponseContentType)
            .httpResponseExpires(objectHttpResponseExpires)
            .versionId(testVersion.id())
            .build());
    }
}
variables:
  testObject:
    fn::invoke:
      function: oci:ObjectStorage:getObject
      arguments:
        bucket: ${objectBucket}
        namespace: ${objectNamespace}
        object: ${objectObject}
        httpResponseCacheControl: ${objectHttpResponseCacheControl}
        httpResponseContentDisposition: ${objectHttpResponseContentDisposition}
        httpResponseContentEncoding: ${objectHttpResponseContentEncoding}
        httpResponseContentLanguage: ${objectHttpResponseContentLanguage}
        httpResponseContentType: ${objectHttpResponseContentType}
        httpResponseExpires: ${objectHttpResponseExpires}
        versionId: ${testVersion.id}
Using getObject
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 getObject(args: GetObjectArgs, opts?: InvokeOptions): Promise<GetObjectResult>
function getObjectOutput(args: GetObjectOutputArgs, opts?: InvokeOptions): Output<GetObjectResult>def get_object(base64_encode_content: Optional[bool] = None,
               bucket: Optional[str] = None,
               content_length_limit: Optional[int] = None,
               http_response_cache_control: Optional[str] = None,
               http_response_content_disposition: Optional[str] = None,
               http_response_content_encoding: Optional[str] = None,
               http_response_content_language: Optional[str] = None,
               http_response_content_type: Optional[str] = None,
               http_response_expires: Optional[str] = None,
               namespace: Optional[str] = None,
               object: Optional[str] = None,
               version_id: Optional[str] = None,
               opts: Optional[InvokeOptions] = None) -> GetObjectResult
def get_object_output(base64_encode_content: Optional[pulumi.Input[bool]] = None,
               bucket: Optional[pulumi.Input[str]] = None,
               content_length_limit: Optional[pulumi.Input[int]] = None,
               http_response_cache_control: Optional[pulumi.Input[str]] = None,
               http_response_content_disposition: Optional[pulumi.Input[str]] = None,
               http_response_content_encoding: Optional[pulumi.Input[str]] = None,
               http_response_content_language: Optional[pulumi.Input[str]] = None,
               http_response_content_type: Optional[pulumi.Input[str]] = None,
               http_response_expires: Optional[pulumi.Input[str]] = None,
               namespace: Optional[pulumi.Input[str]] = None,
               object: Optional[pulumi.Input[str]] = None,
               version_id: Optional[pulumi.Input[str]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetObjectResult]func GetObject(ctx *Context, args *GetObjectArgs, opts ...InvokeOption) (*GetObjectResult, error)
func GetObjectOutput(ctx *Context, args *GetObjectOutputArgs, opts ...InvokeOption) GetObjectResultOutput> Note: This function is named GetObject in the Go SDK.
public static class GetObject 
{
    public static Task<GetObjectResult> InvokeAsync(GetObjectArgs args, InvokeOptions? opts = null)
    public static Output<GetObjectResult> Invoke(GetObjectInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetObjectResult> getObject(GetObjectArgs args, InvokeOptions options)
public static Output<GetObjectResult> getObject(GetObjectArgs args, InvokeOptions options)
fn::invoke:
  function: oci:ObjectStorage/getObject:getObject
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Bucket string
- The name of the bucket. Avoid entering confidential information. Example: my-new-bucket1
- Namespace string
- The Object Storage namespace used for the request.
- Object string
- The name of the object. Avoid entering confidential information. Example: test/object1.log
- Base64EncodeContent bool
- ContentLength intLimit 
- The limit of the content length of the object body to download from the object store. The default is 1Mb.
- HttpResponse stringCache Control 
- Specify this query parameter to override the Cache-Control response header in the GetObject response.
- HttpResponse stringContent Disposition 
- Specify this query parameter to override the value of the Content-Disposition response header in the GetObject response.
- HttpResponse stringContent Encoding 
- Specify this query parameter to override the Content-Encoding response header in the GetObject response.
- HttpResponse stringContent Language 
- Specify this query parameter to override the Content-Language response header in the GetObject response.
- HttpResponse stringContent Type 
- Specify this query parameter to override the Content-Type response header in the GetObject response.
- HttpResponse stringExpires 
- Specify this query parameter to override the Expires response header in the GetObject response.
- VersionId string
- VersionId used to identify a particular version of the object
- Bucket string
- The name of the bucket. Avoid entering confidential information. Example: my-new-bucket1
- Namespace string
- The Object Storage namespace used for the request.
- Object string
- The name of the object. Avoid entering confidential information. Example: test/object1.log
- Base64EncodeContent bool
- ContentLength intLimit 
- The limit of the content length of the object body to download from the object store. The default is 1Mb.
- HttpResponse stringCache Control 
- Specify this query parameter to override the Cache-Control response header in the GetObject response.
- HttpResponse stringContent Disposition 
- Specify this query parameter to override the value of the Content-Disposition response header in the GetObject response.
- HttpResponse stringContent Encoding 
- Specify this query parameter to override the Content-Encoding response header in the GetObject response.
- HttpResponse stringContent Language 
- Specify this query parameter to override the Content-Language response header in the GetObject response.
- HttpResponse stringContent Type 
- Specify this query parameter to override the Content-Type response header in the GetObject response.
- HttpResponse stringExpires 
- Specify this query parameter to override the Expires response header in the GetObject response.
- VersionId string
- VersionId used to identify a particular version of the object
- bucket String
- The name of the bucket. Avoid entering confidential information. Example: my-new-bucket1
- namespace String
- The Object Storage namespace used for the request.
- object String
- The name of the object. Avoid entering confidential information. Example: test/object1.log
- base64EncodeContent Boolean
- contentLength IntegerLimit 
- The limit of the content length of the object body to download from the object store. The default is 1Mb.
- httpResponse StringCache Control 
- Specify this query parameter to override the Cache-Control response header in the GetObject response.
- httpResponse StringContent Disposition 
- Specify this query parameter to override the value of the Content-Disposition response header in the GetObject response.
- httpResponse StringContent Encoding 
- Specify this query parameter to override the Content-Encoding response header in the GetObject response.
- httpResponse StringContent Language 
- Specify this query parameter to override the Content-Language response header in the GetObject response.
- httpResponse StringContent Type 
- Specify this query parameter to override the Content-Type response header in the GetObject response.
- httpResponse StringExpires 
- Specify this query parameter to override the Expires response header in the GetObject response.
- versionId String
- VersionId used to identify a particular version of the object
- bucket string
- The name of the bucket. Avoid entering confidential information. Example: my-new-bucket1
- namespace string
- The Object Storage namespace used for the request.
- object string
- The name of the object. Avoid entering confidential information. Example: test/object1.log
- base64EncodeContent boolean
- contentLength numberLimit 
- The limit of the content length of the object body to download from the object store. The default is 1Mb.
- httpResponse stringCache Control 
- Specify this query parameter to override the Cache-Control response header in the GetObject response.
- httpResponse stringContent Disposition 
- Specify this query parameter to override the value of the Content-Disposition response header in the GetObject response.
- httpResponse stringContent Encoding 
- Specify this query parameter to override the Content-Encoding response header in the GetObject response.
- httpResponse stringContent Language 
- Specify this query parameter to override the Content-Language response header in the GetObject response.
- httpResponse stringContent Type 
- Specify this query parameter to override the Content-Type response header in the GetObject response.
- httpResponse stringExpires 
- Specify this query parameter to override the Expires response header in the GetObject response.
- versionId string
- VersionId used to identify a particular version of the object
- bucket str
- The name of the bucket. Avoid entering confidential information. Example: my-new-bucket1
- namespace str
- The Object Storage namespace used for the request.
- object str
- The name of the object. Avoid entering confidential information. Example: test/object1.log
- base64_encode_ boolcontent 
- content_length_ intlimit 
- The limit of the content length of the object body to download from the object store. The default is 1Mb.
- http_response_ strcache_ control 
- Specify this query parameter to override the Cache-Control response header in the GetObject response.
- http_response_ strcontent_ disposition 
- Specify this query parameter to override the value of the Content-Disposition response header in the GetObject response.
- http_response_ strcontent_ encoding 
- Specify this query parameter to override the Content-Encoding response header in the GetObject response.
- http_response_ strcontent_ language 
- Specify this query parameter to override the Content-Language response header in the GetObject response.
- http_response_ strcontent_ type 
- Specify this query parameter to override the Content-Type response header in the GetObject response.
- http_response_ strexpires 
- Specify this query parameter to override the Expires response header in the GetObject response.
- version_id str
- VersionId used to identify a particular version of the object
- bucket String
- The name of the bucket. Avoid entering confidential information. Example: my-new-bucket1
- namespace String
- The Object Storage namespace used for the request.
- object String
- The name of the object. Avoid entering confidential information. Example: test/object1.log
- base64EncodeContent Boolean
- contentLength NumberLimit 
- The limit of the content length of the object body to download from the object store. The default is 1Mb.
- httpResponse StringCache Control 
- Specify this query parameter to override the Cache-Control response header in the GetObject response.
- httpResponse StringContent Disposition 
- Specify this query parameter to override the value of the Content-Disposition response header in the GetObject response.
- httpResponse StringContent Encoding 
- Specify this query parameter to override the Content-Encoding response header in the GetObject response.
- httpResponse StringContent Language 
- Specify this query parameter to override the Content-Language response header in the GetObject response.
- httpResponse StringContent Type 
- Specify this query parameter to override the Content-Type response header in the GetObject response.
- httpResponse StringExpires 
- Specify this query parameter to override the Expires response header in the GetObject response.
- versionId String
- VersionId used to identify a particular version of the object
getObject Result
The following output properties are available:
- Bucket string
- The name of the bucket. Avoid entering confidential information. Example: my-new-bucket1
- CacheControl string
- Content string
- The object to upload to the object store.
- ContentDisposition string
- ContentEncoding string
- The content encoding of the object.
- ContentLanguage string
- The content language of the object.
- ContentLength string
- The content length of the body.
- ContentMd5 string
- The base-64 encoded MD5 hash of the body.
- ContentType string
- The content type of the object. Defaults to 'application/octet-stream' if not overridden during the PutObject call.
- Id string
- The provider-assigned unique ID for this managed resource.
- Metadata Dictionary<string, string>
- Optional user-defined metadata key and value. Note: Metadata keys are case-insensitive and all returned keys will be lower case.
- Namespace string
- The top-level namespace used for the request.
- Object string
- The name of the object. Avoid entering confidential information. Example: test/object1.log
- StorageTier string
- The storage tier that the object is stored in.
- VersionId string
- Base64EncodeContent bool
- ContentLength intLimit 
- HttpResponse stringCache Control 
- HttpResponse stringContent Disposition 
- HttpResponse stringContent Encoding 
- HttpResponse stringContent Language 
- HttpResponse stringContent Type 
- HttpResponse stringExpires 
- Bucket string
- The name of the bucket. Avoid entering confidential information. Example: my-new-bucket1
- CacheControl string
- Content string
- The object to upload to the object store.
- ContentDisposition string
- ContentEncoding string
- The content encoding of the object.
- ContentLanguage string
- The content language of the object.
- ContentLength string
- The content length of the body.
- ContentMd5 string
- The base-64 encoded MD5 hash of the body.
- ContentType string
- The content type of the object. Defaults to 'application/octet-stream' if not overridden during the PutObject call.
- Id string
- The provider-assigned unique ID for this managed resource.
- Metadata map[string]string
- Optional user-defined metadata key and value. Note: Metadata keys are case-insensitive and all returned keys will be lower case.
- Namespace string
- The top-level namespace used for the request.
- Object string
- The name of the object. Avoid entering confidential information. Example: test/object1.log
- StorageTier string
- The storage tier that the object is stored in.
- VersionId string
- Base64EncodeContent bool
- ContentLength intLimit 
- HttpResponse stringCache Control 
- HttpResponse stringContent Disposition 
- HttpResponse stringContent Encoding 
- HttpResponse stringContent Language 
- HttpResponse stringContent Type 
- HttpResponse stringExpires 
- bucket String
- The name of the bucket. Avoid entering confidential information. Example: my-new-bucket1
- cacheControl String
- content String
- The object to upload to the object store.
- contentDisposition String
- contentEncoding String
- The content encoding of the object.
- contentLanguage String
- The content language of the object.
- contentLength String
- The content length of the body.
- contentMd5 String
- The base-64 encoded MD5 hash of the body.
- contentType String
- The content type of the object. Defaults to 'application/octet-stream' if not overridden during the PutObject call.
- id String
- The provider-assigned unique ID for this managed resource.
- metadata Map<String,String>
- Optional user-defined metadata key and value. Note: Metadata keys are case-insensitive and all returned keys will be lower case.
- namespace String
- The top-level namespace used for the request.
- object String
- The name of the object. Avoid entering confidential information. Example: test/object1.log
- storageTier String
- The storage tier that the object is stored in.
- versionId String
- base64EncodeContent Boolean
- contentLength IntegerLimit 
- httpResponse StringCache Control 
- httpResponse StringContent Disposition 
- httpResponse StringContent Encoding 
- httpResponse StringContent Language 
- httpResponse StringContent Type 
- httpResponse StringExpires 
- bucket string
- The name of the bucket. Avoid entering confidential information. Example: my-new-bucket1
- cacheControl string
- content string
- The object to upload to the object store.
- contentDisposition string
- contentEncoding string
- The content encoding of the object.
- contentLanguage string
- The content language of the object.
- contentLength string
- The content length of the body.
- contentMd5 string
- The base-64 encoded MD5 hash of the body.
- contentType string
- The content type of the object. Defaults to 'application/octet-stream' if not overridden during the PutObject call.
- id string
- The provider-assigned unique ID for this managed resource.
- metadata {[key: string]: string}
- Optional user-defined metadata key and value. Note: Metadata keys are case-insensitive and all returned keys will be lower case.
- namespace string
- The top-level namespace used for the request.
- object string
- The name of the object. Avoid entering confidential information. Example: test/object1.log
- storageTier string
- The storage tier that the object is stored in.
- versionId string
- base64EncodeContent boolean
- contentLength numberLimit 
- httpResponse stringCache Control 
- httpResponse stringContent Disposition 
- httpResponse stringContent Encoding 
- httpResponse stringContent Language 
- httpResponse stringContent Type 
- httpResponse stringExpires 
- bucket str
- The name of the bucket. Avoid entering confidential information. Example: my-new-bucket1
- cache_control str
- content str
- The object to upload to the object store.
- content_disposition str
- content_encoding str
- The content encoding of the object.
- content_language str
- The content language of the object.
- content_length str
- The content length of the body.
- content_md5 str
- The base-64 encoded MD5 hash of the body.
- content_type str
- The content type of the object. Defaults to 'application/octet-stream' if not overridden during the PutObject call.
- id str
- The provider-assigned unique ID for this managed resource.
- metadata Mapping[str, str]
- Optional user-defined metadata key and value. Note: Metadata keys are case-insensitive and all returned keys will be lower case.
- namespace str
- The top-level namespace used for the request.
- object str
- The name of the object. Avoid entering confidential information. Example: test/object1.log
- storage_tier str
- The storage tier that the object is stored in.
- version_id str
- base64_encode_ boolcontent 
- content_length_ intlimit 
- http_response_ strcache_ control 
- http_response_ strcontent_ disposition 
- http_response_ strcontent_ encoding 
- http_response_ strcontent_ language 
- http_response_ strcontent_ type 
- http_response_ strexpires 
- bucket String
- The name of the bucket. Avoid entering confidential information. Example: my-new-bucket1
- cacheControl String
- content String
- The object to upload to the object store.
- contentDisposition String
- contentEncoding String
- The content encoding of the object.
- contentLanguage String
- The content language of the object.
- contentLength String
- The content length of the body.
- contentMd5 String
- The base-64 encoded MD5 hash of the body.
- contentType String
- The content type of the object. Defaults to 'application/octet-stream' if not overridden during the PutObject call.
- id String
- The provider-assigned unique ID for this managed resource.
- metadata Map<String>
- Optional user-defined metadata key and value. Note: Metadata keys are case-insensitive and all returned keys will be lower case.
- namespace String
- The top-level namespace used for the request.
- object String
- The name of the object. Avoid entering confidential information. Example: test/object1.log
- storageTier String
- The storage tier that the object is stored in.
- versionId String
- base64EncodeContent Boolean
- contentLength NumberLimit 
- httpResponse StringCache Control 
- httpResponse StringContent Disposition 
- httpResponse StringContent Encoding 
- httpResponse StringContent Language 
- httpResponse StringContent Type 
- httpResponse StringExpires 
Package Details
- Repository
- oci pulumi/pulumi-oci
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the ociTerraform Provider.