ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud
ibm.getCosBucketObject
Explore with Pulumi AI
Retrieves information of an object in IBM Cloud Object Storage bucket. For more information, about an IBM Cloud Object Storage bucket, see Create some buckets to store your data.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as ibm from "@pulumi/ibm";
const cosGroup = ibm.getResourceGroup({
name: "cos-resource-group",
});
const cosInstance = cosGroup.then(cosGroup => ibm.getResourceInstance({
name: "cos-instance",
resourceGroupId: cosGroup.id,
service: "cloud-object-storage",
}));
const cosBucket = cosInstance.then(cosInstance => ibm.getCosBucket({
resourceInstanceId: cosInstance.id,
bucketName: "my-bucket",
bucketType: "region_location",
bucketRegion: "us-east",
}));
const cosObject = Promise.all([cosBucket, cosBucket]).then(([cosBucket, cosBucket1]) => ibm.getCosBucketObject({
bucketCrn: cosBucket.crn,
bucketLocation: cosBucket1.bucketRegion,
key: "object.json",
}));
import pulumi
import pulumi_ibm as ibm
cos_group = ibm.get_resource_group(name="cos-resource-group")
cos_instance = ibm.get_resource_instance(name="cos-instance",
resource_group_id=cos_group.id,
service="cloud-object-storage")
cos_bucket = ibm.get_cos_bucket(resource_instance_id=cos_instance.id,
bucket_name="my-bucket",
bucket_type="region_location",
bucket_region="us-east")
cos_object = ibm.get_cos_bucket_object(bucket_crn=cos_bucket.crn,
bucket_location=cos_bucket.bucket_region,
key="object.json")
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/ibm/ibm"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cosGroup, err := ibm.LookupResourceGroup(ctx, &ibm.LookupResourceGroupArgs{
Name: pulumi.StringRef("cos-resource-group"),
}, nil)
if err != nil {
return err
}
cosInstance, err := ibm.LookupResourceInstance(ctx, &ibm.LookupResourceInstanceArgs{
Name: pulumi.StringRef("cos-instance"),
ResourceGroupId: pulumi.StringRef(cosGroup.Id),
Service: pulumi.StringRef("cloud-object-storage"),
}, nil)
if err != nil {
return err
}
cosBucket, err := ibm.LookupCosBucket(ctx, &ibm.LookupCosBucketArgs{
ResourceInstanceId: cosInstance.Id,
BucketName: "my-bucket",
BucketType: pulumi.StringRef("region_location"),
BucketRegion: pulumi.StringRef("us-east"),
}, nil)
if err != nil {
return err
}
_, err = ibm.LookupCosBucketObject(ctx, &ibm.LookupCosBucketObjectArgs{
BucketCrn: cosBucket.Crn,
BucketLocation: cosBucket.BucketRegion,
Key: "object.json",
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ibm = Pulumi.Ibm;
return await Deployment.RunAsync(() =>
{
var cosGroup = Ibm.GetResourceGroup.Invoke(new()
{
Name = "cos-resource-group",
});
var cosInstance = Ibm.GetResourceInstance.Invoke(new()
{
Name = "cos-instance",
ResourceGroupId = cosGroup.Apply(getResourceGroupResult => getResourceGroupResult.Id),
Service = "cloud-object-storage",
});
var cosBucket = Ibm.GetCosBucket.Invoke(new()
{
ResourceInstanceId = cosInstance.Apply(getResourceInstanceResult => getResourceInstanceResult.Id),
BucketName = "my-bucket",
BucketType = "region_location",
BucketRegion = "us-east",
});
var cosObject = Ibm.GetCosBucketObject.Invoke(new()
{
BucketCrn = cosBucket.Apply(getCosBucketResult => getCosBucketResult.Crn),
BucketLocation = cosBucket.Apply(getCosBucketResult => getCosBucketResult.BucketRegion),
Key = "object.json",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ibm.IbmFunctions;
import com.pulumi.ibm.inputs.GetResourceGroupArgs;
import com.pulumi.ibm.inputs.GetResourceInstanceArgs;
import com.pulumi.ibm.inputs.GetCosBucketArgs;
import com.pulumi.ibm.inputs.GetCosBucketObjectArgs;
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 cosGroup = IbmFunctions.getResourceGroup(GetResourceGroupArgs.builder()
.name("cos-resource-group")
.build());
final var cosInstance = IbmFunctions.getResourceInstance(GetResourceInstanceArgs.builder()
.name("cos-instance")
.resourceGroupId(cosGroup.applyValue(getResourceGroupResult -> getResourceGroupResult.id()))
.service("cloud-object-storage")
.build());
final var cosBucket = IbmFunctions.getCosBucket(GetCosBucketArgs.builder()
.resourceInstanceId(cosInstance.applyValue(getResourceInstanceResult -> getResourceInstanceResult.id()))
.bucketName("my-bucket")
.bucketType("region_location")
.bucketRegion("us-east")
.build());
final var cosObject = IbmFunctions.getCosBucketObject(GetCosBucketObjectArgs.builder()
.bucketCrn(cosBucket.applyValue(getCosBucketResult -> getCosBucketResult.crn()))
.bucketLocation(cosBucket.applyValue(getCosBucketResult -> getCosBucketResult.bucketRegion()))
.key("object.json")
.build());
}
}
variables:
cosGroup:
fn::invoke:
function: ibm:getResourceGroup
arguments:
name: cos-resource-group
cosInstance:
fn::invoke:
function: ibm:getResourceInstance
arguments:
name: cos-instance
resourceGroupId: ${cosGroup.id}
service: cloud-object-storage
cosBucket:
fn::invoke:
function: ibm:getCosBucket
arguments:
resourceInstanceId: ${cosInstance.id}
bucketName: my-bucket
bucketType: region_location
bucketRegion: us-east
cosObject:
fn::invoke:
function: ibm:getCosBucketObject
arguments:
bucketCrn: ${cosBucket.crn}
bucketLocation: ${cosBucket.bucketRegion}
key: object.json
Using getCosBucketObject
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 getCosBucketObject(args: GetCosBucketObjectArgs, opts?: InvokeOptions): Promise<GetCosBucketObjectResult>
function getCosBucketObjectOutput(args: GetCosBucketObjectOutputArgs, opts?: InvokeOptions): Output<GetCosBucketObjectResult>
def get_cos_bucket_object(bucket_crn: Optional[str] = None,
bucket_location: Optional[str] = None,
endpoint_type: Optional[str] = None,
id: Optional[str] = None,
key: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetCosBucketObjectResult
def get_cos_bucket_object_output(bucket_crn: Optional[pulumi.Input[str]] = None,
bucket_location: Optional[pulumi.Input[str]] = None,
endpoint_type: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
key: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetCosBucketObjectResult]
func LookupCosBucketObject(ctx *Context, args *LookupCosBucketObjectArgs, opts ...InvokeOption) (*LookupCosBucketObjectResult, error)
func LookupCosBucketObjectOutput(ctx *Context, args *LookupCosBucketObjectOutputArgs, opts ...InvokeOption) LookupCosBucketObjectResultOutput
> Note: This function is named LookupCosBucketObject
in the Go SDK.
public static class GetCosBucketObject
{
public static Task<GetCosBucketObjectResult> InvokeAsync(GetCosBucketObjectArgs args, InvokeOptions? opts = null)
public static Output<GetCosBucketObjectResult> Invoke(GetCosBucketObjectInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetCosBucketObjectResult> getCosBucketObject(GetCosBucketObjectArgs args, InvokeOptions options)
public static Output<GetCosBucketObjectResult> getCosBucketObject(GetCosBucketObjectArgs args, InvokeOptions options)
fn::invoke:
function: ibm:index/getCosBucketObject:getCosBucketObject
arguments:
# arguments dictionary
The following arguments are supported:
- Bucket
Crn string - The CRN of the COS bucket.
- Bucket
Location string - The location of the COS bucket.
- Key string
- The name of an object in the COS bucket.
- Endpoint
Type string - The type of endpoint used to access COS. Accepted values:
public
,private
, ordirect
. Default value ispublic
. - Id string
- (String) The ID of an object.
- Bucket
Crn string - The CRN of the COS bucket.
- Bucket
Location string - The location of the COS bucket.
- Key string
- The name of an object in the COS bucket.
- Endpoint
Type string - The type of endpoint used to access COS. Accepted values:
public
,private
, ordirect
. Default value ispublic
. - Id string
- (String) The ID of an object.
- bucket
Crn String - The CRN of the COS bucket.
- bucket
Location String - The location of the COS bucket.
- key String
- The name of an object in the COS bucket.
- endpoint
Type String - The type of endpoint used to access COS. Accepted values:
public
,private
, ordirect
. Default value ispublic
. - id String
- (String) The ID of an object.
- bucket
Crn string - The CRN of the COS bucket.
- bucket
Location string - The location of the COS bucket.
- key string
- The name of an object in the COS bucket.
- endpoint
Type string - The type of endpoint used to access COS. Accepted values:
public
,private
, ordirect
. Default value ispublic
. - id string
- (String) The ID of an object.
- bucket_
crn str - The CRN of the COS bucket.
- bucket_
location str - The location of the COS bucket.
- key str
- The name of an object in the COS bucket.
- endpoint_
type str - The type of endpoint used to access COS. Accepted values:
public
,private
, ordirect
. Default value ispublic
. - id str
- (String) The ID of an object.
- bucket
Crn String - The CRN of the COS bucket.
- bucket
Location String - The location of the COS bucket.
- key String
- The name of an object in the COS bucket.
- endpoint
Type String - The type of endpoint used to access COS. Accepted values:
public
,private
, ordirect
. Default value ispublic
. - id String
- (String) The ID of an object.
getCosBucketObject Result
The following output properties are available:
- Body string
- (String) Literal string value of an object content. Only supported for
text/*
andapplication/json
content types. - Bucket
Crn string - Bucket
Location string - Content
Length double - (String) A standard MIME type describing the format of an object data.
- Content
Type string - (String) A standard MIME type describing the format of an object data.
- Etag string
- (String) Computed MD5 hexdigest of an object content.
- Id string
- (String) The ID of an object.
- Key string
- Last
Modified string - (Timestamp) Last modified date of an object in a GMT formatted date.
- Object
Lock stringLegal Hold Status - (String) If the value of this attribute is ON, then the object cannot be deleted from the COS bucket.
website_redirect
- (String) If this value is set then incoming request will be redirected to the set value..
- Object
Lock stringMode - (String) This is the retention mode for an object.
- Object
Lock stringRetain Until Date - (String) A date after which the object can be deleted from the COS bucket.
- Object
Sql stringUrl - (String) Access the object using an SQL Query instance. The SQL URL is a reference URL used inside an SQL statement. The reference URL is used to perform queries against objects storing structured data.
- Version
Id string - Website
Redirect string - Endpoint
Type string
- Body string
- (String) Literal string value of an object content. Only supported for
text/*
andapplication/json
content types. - Bucket
Crn string - Bucket
Location string - Content
Length float64 - (String) A standard MIME type describing the format of an object data.
- Content
Type string - (String) A standard MIME type describing the format of an object data.
- Etag string
- (String) Computed MD5 hexdigest of an object content.
- Id string
- (String) The ID of an object.
- Key string
- Last
Modified string - (Timestamp) Last modified date of an object in a GMT formatted date.
- Object
Lock stringLegal Hold Status - (String) If the value of this attribute is ON, then the object cannot be deleted from the COS bucket.
website_redirect
- (String) If this value is set then incoming request will be redirected to the set value..
- Object
Lock stringMode - (String) This is the retention mode for an object.
- Object
Lock stringRetain Until Date - (String) A date after which the object can be deleted from the COS bucket.
- Object
Sql stringUrl - (String) Access the object using an SQL Query instance. The SQL URL is a reference URL used inside an SQL statement. The reference URL is used to perform queries against objects storing structured data.
- Version
Id string - Website
Redirect string - Endpoint
Type string
- body String
- (String) Literal string value of an object content. Only supported for
text/*
andapplication/json
content types. - bucket
Crn String - bucket
Location String - content
Length Double - (String) A standard MIME type describing the format of an object data.
- content
Type String - (String) A standard MIME type describing the format of an object data.
- etag String
- (String) Computed MD5 hexdigest of an object content.
- id String
- (String) The ID of an object.
- key String
- last
Modified String - (Timestamp) Last modified date of an object in a GMT formatted date.
- object
Lock StringLegal Hold Status - (String) If the value of this attribute is ON, then the object cannot be deleted from the COS bucket.
website_redirect
- (String) If this value is set then incoming request will be redirected to the set value..
- object
Lock StringMode - (String) This is the retention mode for an object.
- object
Lock StringRetain Until Date - (String) A date after which the object can be deleted from the COS bucket.
- object
Sql StringUrl - (String) Access the object using an SQL Query instance. The SQL URL is a reference URL used inside an SQL statement. The reference URL is used to perform queries against objects storing structured data.
- version
Id String - website
Redirect String - endpoint
Type String
- body string
- (String) Literal string value of an object content. Only supported for
text/*
andapplication/json
content types. - bucket
Crn string - bucket
Location string - content
Length number - (String) A standard MIME type describing the format of an object data.
- content
Type string - (String) A standard MIME type describing the format of an object data.
- etag string
- (String) Computed MD5 hexdigest of an object content.
- id string
- (String) The ID of an object.
- key string
- last
Modified string - (Timestamp) Last modified date of an object in a GMT formatted date.
- object
Lock stringLegal Hold Status - (String) If the value of this attribute is ON, then the object cannot be deleted from the COS bucket.
website_redirect
- (String) If this value is set then incoming request will be redirected to the set value..
- object
Lock stringMode - (String) This is the retention mode for an object.
- object
Lock stringRetain Until Date - (String) A date after which the object can be deleted from the COS bucket.
- object
Sql stringUrl - (String) Access the object using an SQL Query instance. The SQL URL is a reference URL used inside an SQL statement. The reference URL is used to perform queries against objects storing structured data.
- version
Id string - website
Redirect string - endpoint
Type string
- body str
- (String) Literal string value of an object content. Only supported for
text/*
andapplication/json
content types. - bucket_
crn str - bucket_
location str - content_
length float - (String) A standard MIME type describing the format of an object data.
- content_
type str - (String) A standard MIME type describing the format of an object data.
- etag str
- (String) Computed MD5 hexdigest of an object content.
- id str
- (String) The ID of an object.
- key str
- last_
modified str - (Timestamp) Last modified date of an object in a GMT formatted date.
- object_
lock_ strlegal_ hold_ status - (String) If the value of this attribute is ON, then the object cannot be deleted from the COS bucket.
website_redirect
- (String) If this value is set then incoming request will be redirected to the set value..
- object_
lock_ strmode - (String) This is the retention mode for an object.
- object_
lock_ strretain_ until_ date - (String) A date after which the object can be deleted from the COS bucket.
- object_
sql_ strurl - (String) Access the object using an SQL Query instance. The SQL URL is a reference URL used inside an SQL statement. The reference URL is used to perform queries against objects storing structured data.
- version_
id str - website_
redirect str - endpoint_
type str
- body String
- (String) Literal string value of an object content. Only supported for
text/*
andapplication/json
content types. - bucket
Crn String - bucket
Location String - content
Length Number - (String) A standard MIME type describing the format of an object data.
- content
Type String - (String) A standard MIME type describing the format of an object data.
- etag String
- (String) Computed MD5 hexdigest of an object content.
- id String
- (String) The ID of an object.
- key String
- last
Modified String - (Timestamp) Last modified date of an object in a GMT formatted date.
- object
Lock StringLegal Hold Status - (String) If the value of this attribute is ON, then the object cannot be deleted from the COS bucket.
website_redirect
- (String) If this value is set then incoming request will be redirected to the set value..
- object
Lock StringMode - (String) This is the retention mode for an object.
- object
Lock StringRetain Until Date - (String) A date after which the object can be deleted from the COS bucket.
- object
Sql StringUrl - (String) Access the object using an SQL Query instance. The SQL URL is a reference URL used inside an SQL statement. The reference URL is used to perform queries against objects storing structured data.
- version
Id String - website
Redirect String - endpoint
Type String
Package Details
- Repository
- ibm ibm-cloud/terraform-provider-ibm
- License
- Notes
- This Pulumi package is based on the
ibm
Terraform Provider.