1. Packages
  2. Ibm Provider
  3. API Docs
  4. CosBucketObjectLockConfiguration
ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud

ibm.CosBucketObjectLockConfiguration

Explore with Pulumi AI

ibm logo
ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud

    Provides an Object Lock configuration resource. This resource is used to configure a default retention period for objects placed in the specified bucket. To enable Object Lock for a new bucket see ibm_cos_bucket. To configure legal hold and retention period on an object please refer ibm_cos_bucket_object.

    Note: To configure Object Lock on a bucket, you must first enable object versioning on bucket by using the Versioning objects.


    Create CosBucketObjectLockConfiguration Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new CosBucketObjectLockConfiguration(name: string, args: CosBucketObjectLockConfigurationArgs, opts?: CustomResourceOptions);
    @overload
    def CosBucketObjectLockConfiguration(resource_name: str,
                                         args: CosBucketObjectLockConfigurationArgs,
                                         opts: Optional[ResourceOptions] = None)
    
    @overload
    def CosBucketObjectLockConfiguration(resource_name: str,
                                         opts: Optional[ResourceOptions] = None,
                                         bucket_crn: Optional[str] = None,
                                         bucket_location: Optional[str] = None,
                                         object_lock_configuration: Optional[CosBucketObjectLockConfigurationObjectLockConfigurationArgs] = None,
                                         cos_bucket_object_lock_configuration_id: Optional[str] = None,
                                         endpoint_type: Optional[str] = None,
                                         timeouts: Optional[CosBucketObjectLockConfigurationTimeoutsArgs] = None)
    func NewCosBucketObjectLockConfiguration(ctx *Context, name string, args CosBucketObjectLockConfigurationArgs, opts ...ResourceOption) (*CosBucketObjectLockConfiguration, error)
    public CosBucketObjectLockConfiguration(string name, CosBucketObjectLockConfigurationArgs args, CustomResourceOptions? opts = null)
    public CosBucketObjectLockConfiguration(String name, CosBucketObjectLockConfigurationArgs args)
    public CosBucketObjectLockConfiguration(String name, CosBucketObjectLockConfigurationArgs args, CustomResourceOptions options)
    
    type: ibm:CosBucketObjectLockConfiguration
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args CosBucketObjectLockConfigurationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args CosBucketObjectLockConfigurationArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args CosBucketObjectLockConfigurationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CosBucketObjectLockConfigurationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CosBucketObjectLockConfigurationArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var cosBucketObjectLockConfigurationResource = new Ibm.CosBucketObjectLockConfiguration("cosBucketObjectLockConfigurationResource", new()
    {
        BucketCrn = "string",
        BucketLocation = "string",
        ObjectLockConfiguration = new Ibm.Inputs.CosBucketObjectLockConfigurationObjectLockConfigurationArgs
        {
            ObjectLockEnabled = "string",
            ObjectLockRule = new Ibm.Inputs.CosBucketObjectLockConfigurationObjectLockConfigurationObjectLockRuleArgs
            {
                DefaultRetention = new Ibm.Inputs.CosBucketObjectLockConfigurationObjectLockConfigurationObjectLockRuleDefaultRetentionArgs
                {
                    Mode = "string",
                    Days = 0,
                    Years = 0,
                },
            },
        },
        CosBucketObjectLockConfigurationId = "string",
        EndpointType = "string",
        Timeouts = new Ibm.Inputs.CosBucketObjectLockConfigurationTimeoutsArgs
        {
            Create = "string",
            Delete = "string",
            Update = "string",
        },
    });
    
    example, err := ibm.NewCosBucketObjectLockConfiguration(ctx, "cosBucketObjectLockConfigurationResource", &ibm.CosBucketObjectLockConfigurationArgs{
    	BucketCrn:      pulumi.String("string"),
    	BucketLocation: pulumi.String("string"),
    	ObjectLockConfiguration: &ibm.CosBucketObjectLockConfigurationObjectLockConfigurationArgs{
    		ObjectLockEnabled: pulumi.String("string"),
    		ObjectLockRule: &ibm.CosBucketObjectLockConfigurationObjectLockConfigurationObjectLockRuleArgs{
    			DefaultRetention: &ibm.CosBucketObjectLockConfigurationObjectLockConfigurationObjectLockRuleDefaultRetentionArgs{
    				Mode:  pulumi.String("string"),
    				Days:  pulumi.Float64(0),
    				Years: pulumi.Float64(0),
    			},
    		},
    	},
    	CosBucketObjectLockConfigurationId: pulumi.String("string"),
    	EndpointType:                       pulumi.String("string"),
    	Timeouts: &ibm.CosBucketObjectLockConfigurationTimeoutsArgs{
    		Create: pulumi.String("string"),
    		Delete: pulumi.String("string"),
    		Update: pulumi.String("string"),
    	},
    })
    
    var cosBucketObjectLockConfigurationResource = new CosBucketObjectLockConfiguration("cosBucketObjectLockConfigurationResource", CosBucketObjectLockConfigurationArgs.builder()
        .bucketCrn("string")
        .bucketLocation("string")
        .objectLockConfiguration(CosBucketObjectLockConfigurationObjectLockConfigurationArgs.builder()
            .objectLockEnabled("string")
            .objectLockRule(CosBucketObjectLockConfigurationObjectLockConfigurationObjectLockRuleArgs.builder()
                .defaultRetention(CosBucketObjectLockConfigurationObjectLockConfigurationObjectLockRuleDefaultRetentionArgs.builder()
                    .mode("string")
                    .days(0)
                    .years(0)
                    .build())
                .build())
            .build())
        .cosBucketObjectLockConfigurationId("string")
        .endpointType("string")
        .timeouts(CosBucketObjectLockConfigurationTimeoutsArgs.builder()
            .create("string")
            .delete("string")
            .update("string")
            .build())
        .build());
    
    cos_bucket_object_lock_configuration_resource = ibm.CosBucketObjectLockConfiguration("cosBucketObjectLockConfigurationResource",
        bucket_crn="string",
        bucket_location="string",
        object_lock_configuration={
            "object_lock_enabled": "string",
            "object_lock_rule": {
                "default_retention": {
                    "mode": "string",
                    "days": 0,
                    "years": 0,
                },
            },
        },
        cos_bucket_object_lock_configuration_id="string",
        endpoint_type="string",
        timeouts={
            "create": "string",
            "delete": "string",
            "update": "string",
        })
    
    const cosBucketObjectLockConfigurationResource = new ibm.CosBucketObjectLockConfiguration("cosBucketObjectLockConfigurationResource", {
        bucketCrn: "string",
        bucketLocation: "string",
        objectLockConfiguration: {
            objectLockEnabled: "string",
            objectLockRule: {
                defaultRetention: {
                    mode: "string",
                    days: 0,
                    years: 0,
                },
            },
        },
        cosBucketObjectLockConfigurationId: "string",
        endpointType: "string",
        timeouts: {
            create: "string",
            "delete": "string",
            update: "string",
        },
    });
    
    type: ibm:CosBucketObjectLockConfiguration
    properties:
        bucketCrn: string
        bucketLocation: string
        cosBucketObjectLockConfigurationId: string
        endpointType: string
        objectLockConfiguration:
            objectLockEnabled: string
            objectLockRule:
                defaultRetention:
                    days: 0
                    mode: string
                    years: 0
        timeouts:
            create: string
            delete: string
            update: string
    

    CosBucketObjectLockConfiguration Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The CosBucketObjectLockConfiguration resource accepts the following input properties:

    BucketCrn string
    The CRN of the COS bucket.
    BucketLocation string
    The location of the COS bucket.
    ObjectLockConfiguration CosBucketObjectLockConfigurationObjectLockConfiguration

    Nested block have the following structure:

    Nested scheme for object_lock_configuration:

    CosBucketObjectLockConfigurationId string
    (String) The ID of the bucket.
    EndpointType string
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    Timeouts CosBucketObjectLockConfigurationTimeouts
    BucketCrn string
    The CRN of the COS bucket.
    BucketLocation string
    The location of the COS bucket.
    ObjectLockConfiguration CosBucketObjectLockConfigurationObjectLockConfigurationArgs

    Nested block have the following structure:

    Nested scheme for object_lock_configuration:

    CosBucketObjectLockConfigurationId string
    (String) The ID of the bucket.
    EndpointType string
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    Timeouts CosBucketObjectLockConfigurationTimeoutsArgs
    bucketCrn String
    The CRN of the COS bucket.
    bucketLocation String
    The location of the COS bucket.
    objectLockConfiguration CosBucketObjectLockConfigurationObjectLockConfiguration

    Nested block have the following structure:

    Nested scheme for object_lock_configuration:

    cosBucketObjectLockConfigurationId String
    (String) The ID of the bucket.
    endpointType String
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    timeouts CosBucketObjectLockConfigurationTimeouts
    bucketCrn string
    The CRN of the COS bucket.
    bucketLocation string
    The location of the COS bucket.
    objectLockConfiguration CosBucketObjectLockConfigurationObjectLockConfiguration

    Nested block have the following structure:

    Nested scheme for object_lock_configuration:

    cosBucketObjectLockConfigurationId string
    (String) The ID of the bucket.
    endpointType string
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    timeouts CosBucketObjectLockConfigurationTimeouts
    bucket_crn str
    The CRN of the COS bucket.
    bucket_location str
    The location of the COS bucket.
    object_lock_configuration CosBucketObjectLockConfigurationObjectLockConfigurationArgs

    Nested block have the following structure:

    Nested scheme for object_lock_configuration:

    cos_bucket_object_lock_configuration_id str
    (String) The ID of the bucket.
    endpoint_type str
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    timeouts CosBucketObjectLockConfigurationTimeoutsArgs
    bucketCrn String
    The CRN of the COS bucket.
    bucketLocation String
    The location of the COS bucket.
    objectLockConfiguration Property Map

    Nested block have the following structure:

    Nested scheme for object_lock_configuration:

    cosBucketObjectLockConfigurationId String
    (String) The ID of the bucket.
    endpointType String
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    timeouts Property Map

    Outputs

    All input properties are implicitly available as output properties. Additionally, the CosBucketObjectLockConfiguration resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing CosBucketObjectLockConfiguration Resource

    Get an existing CosBucketObjectLockConfiguration resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: CosBucketObjectLockConfigurationState, opts?: CustomResourceOptions): CosBucketObjectLockConfiguration
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            bucket_crn: Optional[str] = None,
            bucket_location: Optional[str] = None,
            cos_bucket_object_lock_configuration_id: Optional[str] = None,
            endpoint_type: Optional[str] = None,
            object_lock_configuration: Optional[CosBucketObjectLockConfigurationObjectLockConfigurationArgs] = None,
            timeouts: Optional[CosBucketObjectLockConfigurationTimeoutsArgs] = None) -> CosBucketObjectLockConfiguration
    func GetCosBucketObjectLockConfiguration(ctx *Context, name string, id IDInput, state *CosBucketObjectLockConfigurationState, opts ...ResourceOption) (*CosBucketObjectLockConfiguration, error)
    public static CosBucketObjectLockConfiguration Get(string name, Input<string> id, CosBucketObjectLockConfigurationState? state, CustomResourceOptions? opts = null)
    public static CosBucketObjectLockConfiguration get(String name, Output<String> id, CosBucketObjectLockConfigurationState state, CustomResourceOptions options)
    resources:  _:    type: ibm:CosBucketObjectLockConfiguration    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    BucketCrn string
    The CRN of the COS bucket.
    BucketLocation string
    The location of the COS bucket.
    CosBucketObjectLockConfigurationId string
    (String) The ID of the bucket.
    EndpointType string
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    ObjectLockConfiguration CosBucketObjectLockConfigurationObjectLockConfiguration

    Nested block have the following structure:

    Nested scheme for object_lock_configuration:

    Timeouts CosBucketObjectLockConfigurationTimeouts
    BucketCrn string
    The CRN of the COS bucket.
    BucketLocation string
    The location of the COS bucket.
    CosBucketObjectLockConfigurationId string
    (String) The ID of the bucket.
    EndpointType string
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    ObjectLockConfiguration CosBucketObjectLockConfigurationObjectLockConfigurationArgs

    Nested block have the following structure:

    Nested scheme for object_lock_configuration:

    Timeouts CosBucketObjectLockConfigurationTimeoutsArgs
    bucketCrn String
    The CRN of the COS bucket.
    bucketLocation String
    The location of the COS bucket.
    cosBucketObjectLockConfigurationId String
    (String) The ID of the bucket.
    endpointType String
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    objectLockConfiguration CosBucketObjectLockConfigurationObjectLockConfiguration

    Nested block have the following structure:

    Nested scheme for object_lock_configuration:

    timeouts CosBucketObjectLockConfigurationTimeouts
    bucketCrn string
    The CRN of the COS bucket.
    bucketLocation string
    The location of the COS bucket.
    cosBucketObjectLockConfigurationId string
    (String) The ID of the bucket.
    endpointType string
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    objectLockConfiguration CosBucketObjectLockConfigurationObjectLockConfiguration

    Nested block have the following structure:

    Nested scheme for object_lock_configuration:

    timeouts CosBucketObjectLockConfigurationTimeouts
    bucket_crn str
    The CRN of the COS bucket.
    bucket_location str
    The location of the COS bucket.
    cos_bucket_object_lock_configuration_id str
    (String) The ID of the bucket.
    endpoint_type str
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    object_lock_configuration CosBucketObjectLockConfigurationObjectLockConfigurationArgs

    Nested block have the following structure:

    Nested scheme for object_lock_configuration:

    timeouts CosBucketObjectLockConfigurationTimeoutsArgs
    bucketCrn String
    The CRN of the COS bucket.
    bucketLocation String
    The location of the COS bucket.
    cosBucketObjectLockConfigurationId String
    (String) The ID of the bucket.
    endpointType String
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    objectLockConfiguration Property Map

    Nested block have the following structure:

    Nested scheme for object_lock_configuration:

    timeouts Property Map

    Supporting Types

    CosBucketObjectLockConfigurationObjectLockConfiguration, CosBucketObjectLockConfigurationObjectLockConfigurationArgs

    ObjectLockEnabled string
    Indicates whether this bucket has an Object Lock configuration enabled. Defaults to Enabled. Valid values: Enabled.
    ObjectLockRule CosBucketObjectLockConfigurationObjectLockConfigurationObjectLockRule

    Object Lock rule has following argument:

    Nested scheme for object_lock_rule:

    ObjectLockEnabled string
    Indicates whether this bucket has an Object Lock configuration enabled. Defaults to Enabled. Valid values: Enabled.
    ObjectLockRule CosBucketObjectLockConfigurationObjectLockConfigurationObjectLockRule

    Object Lock rule has following argument:

    Nested scheme for object_lock_rule:

    objectLockEnabled String
    Indicates whether this bucket has an Object Lock configuration enabled. Defaults to Enabled. Valid values: Enabled.
    objectLockRule CosBucketObjectLockConfigurationObjectLockConfigurationObjectLockRule

    Object Lock rule has following argument:

    Nested scheme for object_lock_rule:

    objectLockEnabled string
    Indicates whether this bucket has an Object Lock configuration enabled. Defaults to Enabled. Valid values: Enabled.
    objectLockRule CosBucketObjectLockConfigurationObjectLockConfigurationObjectLockRule

    Object Lock rule has following argument:

    Nested scheme for object_lock_rule:

    object_lock_enabled str
    Indicates whether this bucket has an Object Lock configuration enabled. Defaults to Enabled. Valid values: Enabled.
    object_lock_rule CosBucketObjectLockConfigurationObjectLockConfigurationObjectLockRule

    Object Lock rule has following argument:

    Nested scheme for object_lock_rule:

    objectLockEnabled String
    Indicates whether this bucket has an Object Lock configuration enabled. Defaults to Enabled. Valid values: Enabled.
    objectLockRule Property Map

    Object Lock rule has following argument:

    Nested scheme for object_lock_rule:

    CosBucketObjectLockConfigurationObjectLockConfigurationObjectLockRule, CosBucketObjectLockConfigurationObjectLockConfigurationObjectLockRuleArgs

    DefaultRetention CosBucketObjectLockConfigurationObjectLockConfigurationObjectLockRuleDefaultRetention
    An object lock configuration on the object at a bucket level, in the form of a days , years and mode that establishes a point in time after which the object can be deleted. This is applied at bucket level hence it is by default applied to all the object in the bucket unless a seperate retention period is set on the object.
    DefaultRetention CosBucketObjectLockConfigurationObjectLockConfigurationObjectLockRuleDefaultRetention
    An object lock configuration on the object at a bucket level, in the form of a days , years and mode that establishes a point in time after which the object can be deleted. This is applied at bucket level hence it is by default applied to all the object in the bucket unless a seperate retention period is set on the object.
    defaultRetention CosBucketObjectLockConfigurationObjectLockConfigurationObjectLockRuleDefaultRetention
    An object lock configuration on the object at a bucket level, in the form of a days , years and mode that establishes a point in time after which the object can be deleted. This is applied at bucket level hence it is by default applied to all the object in the bucket unless a seperate retention period is set on the object.
    defaultRetention CosBucketObjectLockConfigurationObjectLockConfigurationObjectLockRuleDefaultRetention
    An object lock configuration on the object at a bucket level, in the form of a days , years and mode that establishes a point in time after which the object can be deleted. This is applied at bucket level hence it is by default applied to all the object in the bucket unless a seperate retention period is set on the object.
    default_retention CosBucketObjectLockConfigurationObjectLockConfigurationObjectLockRuleDefaultRetention
    An object lock configuration on the object at a bucket level, in the form of a days , years and mode that establishes a point in time after which the object can be deleted. This is applied at bucket level hence it is by default applied to all the object in the bucket unless a seperate retention period is set on the object.
    defaultRetention Property Map
    An object lock configuration on the object at a bucket level, in the form of a days , years and mode that establishes a point in time after which the object can be deleted. This is applied at bucket level hence it is by default applied to all the object in the bucket unless a seperate retention period is set on the object.

    CosBucketObjectLockConfigurationObjectLockConfigurationObjectLockRuleDefaultRetention, CosBucketObjectLockConfigurationObjectLockConfigurationObjectLockRuleDefaultRetentionArgs

    Mode string
    Retention modes apply different levels of protection to the objects.
    Days double
    Retention period in terms of days after which the object can be deleted.
    Years double
    Retention period in terms of years after which the object can be deleted.
    Mode string
    Retention modes apply different levels of protection to the objects.
    Days float64
    Retention period in terms of days after which the object can be deleted.
    Years float64
    Retention period in terms of years after which the object can be deleted.
    mode String
    Retention modes apply different levels of protection to the objects.
    days Double
    Retention period in terms of days after which the object can be deleted.
    years Double
    Retention period in terms of years after which the object can be deleted.
    mode string
    Retention modes apply different levels of protection to the objects.
    days number
    Retention period in terms of days after which the object can be deleted.
    years number
    Retention period in terms of years after which the object can be deleted.
    mode str
    Retention modes apply different levels of protection to the objects.
    days float
    Retention period in terms of days after which the object can be deleted.
    years float
    Retention period in terms of years after which the object can be deleted.
    mode String
    Retention modes apply different levels of protection to the objects.
    days Number
    Retention period in terms of days after which the object can be deleted.
    years Number
    Retention period in terms of years after which the object can be deleted.

    CosBucketObjectLockConfigurationTimeouts, CosBucketObjectLockConfigurationTimeoutsArgs

    Create string
    Delete string
    Update string
    Create string
    Delete string
    Update string
    create String
    delete String
    update String
    create string
    delete string
    update string
    create str
    delete str
    update str
    create String
    delete String
    update String

    Import

    IBM COS Bucket

    The ibm.CosBucketObjectLockConfiguration resource can be imported by using the id. The ID is formed from the CRN (Cloud Resource Name). The CRN and bucket location can be found on the portal.

    id = $CRN:meta:$bucketlocation:$endpointtype

    Syntax

    $ terraform import ibm_cos_bucket_object_lock_configuration.objectlock `$CRN:meta:$bucketlocation:public`
    

    Example

    
    $ terraform import ibm_cos_bucket_object_lock_configuration.objectlock crn:v1:bluemix:public:cloud-object-storage:global:a/4ea1882a2d3401ed1e459979941966ea:31fa970d-51d0-4b05-893e-251cba75a7b3:bucket:mybucketname:meta:us-south:public
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    ibm ibm-cloud/terraform-provider-ibm
    License
    Notes
    This Pulumi package is based on the ibm Terraform Provider.
    ibm logo
    ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud