1. Packages
  2. Scaleway
  3. API Docs
  4. ObjectBucketLockConfiguration
Scaleway v1.12.1 published on Monday, Apr 15, 2024 by pulumiverse

scaleway.ObjectBucketLockConfiguration

Explore with Pulumi AI

scaleway logo
Scaleway v1.12.1 published on Monday, Apr 15, 2024 by pulumiverse

    Provides an Object bucket lock configuration resource. For more information, see Setting up object lock.

    Example Usage

    Configure an Object Lock for a new bucket

    Please note that object_lock_enabled must be set to true before configuring the lock.

    import * as pulumi from "@pulumi/pulumi";
    import * as scaleway from "@pulumiverse/scaleway";
    
    const mainObjectBucket = new scaleway.ObjectBucket("mainObjectBucket", {
        acl: "public-read",
        objectLockEnabled: true,
    });
    const mainObjectBucketLockConfiguration = new scaleway.ObjectBucketLockConfiguration("mainObjectBucketLockConfiguration", {
        bucket: mainObjectBucket.name,
        rule: {
            defaultRetention: {
                mode: "GOVERNANCE",
                days: 1,
            },
        },
    });
    
    import pulumi
    import pulumiverse_scaleway as scaleway
    
    main_object_bucket = scaleway.ObjectBucket("mainObjectBucket",
        acl="public-read",
        object_lock_enabled=True)
    main_object_bucket_lock_configuration = scaleway.ObjectBucketLockConfiguration("mainObjectBucketLockConfiguration",
        bucket=main_object_bucket.name,
        rule=scaleway.ObjectBucketLockConfigurationRuleArgs(
            default_retention=scaleway.ObjectBucketLockConfigurationRuleDefaultRetentionArgs(
                mode="GOVERNANCE",
                days=1,
            ),
        ))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		mainObjectBucket, err := scaleway.NewObjectBucket(ctx, "mainObjectBucket", &scaleway.ObjectBucketArgs{
    			Acl:               pulumi.String("public-read"),
    			ObjectLockEnabled: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = scaleway.NewObjectBucketLockConfiguration(ctx, "mainObjectBucketLockConfiguration", &scaleway.ObjectBucketLockConfigurationArgs{
    			Bucket: mainObjectBucket.Name,
    			Rule: &scaleway.ObjectBucketLockConfigurationRuleArgs{
    				DefaultRetention: &scaleway.ObjectBucketLockConfigurationRuleDefaultRetentionArgs{
    					Mode: pulumi.String("GOVERNANCE"),
    					Days: pulumi.Int(1),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Scaleway = Pulumiverse.Scaleway;
    
    return await Deployment.RunAsync(() => 
    {
        var mainObjectBucket = new Scaleway.ObjectBucket("mainObjectBucket", new()
        {
            Acl = "public-read",
            ObjectLockEnabled = true,
        });
    
        var mainObjectBucketLockConfiguration = new Scaleway.ObjectBucketLockConfiguration("mainObjectBucketLockConfiguration", new()
        {
            Bucket = mainObjectBucket.Name,
            Rule = new Scaleway.Inputs.ObjectBucketLockConfigurationRuleArgs
            {
                DefaultRetention = new Scaleway.Inputs.ObjectBucketLockConfigurationRuleDefaultRetentionArgs
                {
                    Mode = "GOVERNANCE",
                    Days = 1,
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.scaleway.ObjectBucket;
    import com.pulumi.scaleway.ObjectBucketArgs;
    import com.pulumi.scaleway.ObjectBucketLockConfiguration;
    import com.pulumi.scaleway.ObjectBucketLockConfigurationArgs;
    import com.pulumi.scaleway.inputs.ObjectBucketLockConfigurationRuleArgs;
    import com.pulumi.scaleway.inputs.ObjectBucketLockConfigurationRuleDefaultRetentionArgs;
    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) {
            var mainObjectBucket = new ObjectBucket("mainObjectBucket", ObjectBucketArgs.builder()        
                .acl("public-read")
                .objectLockEnabled(true)
                .build());
    
            var mainObjectBucketLockConfiguration = new ObjectBucketLockConfiguration("mainObjectBucketLockConfiguration", ObjectBucketLockConfigurationArgs.builder()        
                .bucket(mainObjectBucket.name())
                .rule(ObjectBucketLockConfigurationRuleArgs.builder()
                    .defaultRetention(ObjectBucketLockConfigurationRuleDefaultRetentionArgs.builder()
                        .mode("GOVERNANCE")
                        .days(1)
                        .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      mainObjectBucket:
        type: scaleway:ObjectBucket
        properties:
          acl: public-read
          objectLockEnabled: true
      mainObjectBucketLockConfiguration:
        type: scaleway:ObjectBucketLockConfiguration
        properties:
          bucket: ${mainObjectBucket.name}
          rule:
            defaultRetention:
              mode: GOVERNANCE
              days: 1
    

    Configure an Object Lock for an existing bucket

    You should contact Scaleway support to enable object lock on an existing bucket.

    Create ObjectBucketLockConfiguration Resource

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

    Constructor syntax

    new ObjectBucketLockConfiguration(name: string, args: ObjectBucketLockConfigurationArgs, opts?: CustomResourceOptions);
    @overload
    def ObjectBucketLockConfiguration(resource_name: str,
                                      args: ObjectBucketLockConfigurationArgs,
                                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def ObjectBucketLockConfiguration(resource_name: str,
                                      opts: Optional[ResourceOptions] = None,
                                      bucket: Optional[str] = None,
                                      rule: Optional[ObjectBucketLockConfigurationRuleArgs] = None,
                                      project_id: Optional[str] = None,
                                      region: Optional[str] = None)
    func NewObjectBucketLockConfiguration(ctx *Context, name string, args ObjectBucketLockConfigurationArgs, opts ...ResourceOption) (*ObjectBucketLockConfiguration, error)
    public ObjectBucketLockConfiguration(string name, ObjectBucketLockConfigurationArgs args, CustomResourceOptions? opts = null)
    public ObjectBucketLockConfiguration(String name, ObjectBucketLockConfigurationArgs args)
    public ObjectBucketLockConfiguration(String name, ObjectBucketLockConfigurationArgs args, CustomResourceOptions options)
    
    type: scaleway:ObjectBucketLockConfiguration
    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 ObjectBucketLockConfigurationArgs
    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 ObjectBucketLockConfigurationArgs
    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 ObjectBucketLockConfigurationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ObjectBucketLockConfigurationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ObjectBucketLockConfigurationArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

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

    var objectBucketLockConfigurationResource = new Scaleway.ObjectBucketLockConfiguration("objectBucketLockConfigurationResource", new()
    {
        Bucket = "string",
        Rule = new Scaleway.Inputs.ObjectBucketLockConfigurationRuleArgs
        {
            DefaultRetention = new Scaleway.Inputs.ObjectBucketLockConfigurationRuleDefaultRetentionArgs
            {
                Mode = "string",
                Days = 0,
                Years = 0,
            },
        },
        ProjectId = "string",
        Region = "string",
    });
    
    example, err := scaleway.NewObjectBucketLockConfiguration(ctx, "objectBucketLockConfigurationResource", &scaleway.ObjectBucketLockConfigurationArgs{
    	Bucket: pulumi.String("string"),
    	Rule: &scaleway.ObjectBucketLockConfigurationRuleArgs{
    		DefaultRetention: &scaleway.ObjectBucketLockConfigurationRuleDefaultRetentionArgs{
    			Mode:  pulumi.String("string"),
    			Days:  pulumi.Int(0),
    			Years: pulumi.Int(0),
    		},
    	},
    	ProjectId: pulumi.String("string"),
    	Region:    pulumi.String("string"),
    })
    
    var objectBucketLockConfigurationResource = new ObjectBucketLockConfiguration("objectBucketLockConfigurationResource", ObjectBucketLockConfigurationArgs.builder()        
        .bucket("string")
        .rule(ObjectBucketLockConfigurationRuleArgs.builder()
            .defaultRetention(ObjectBucketLockConfigurationRuleDefaultRetentionArgs.builder()
                .mode("string")
                .days(0)
                .years(0)
                .build())
            .build())
        .projectId("string")
        .region("string")
        .build());
    
    object_bucket_lock_configuration_resource = scaleway.ObjectBucketLockConfiguration("objectBucketLockConfigurationResource",
        bucket="string",
        rule=scaleway.ObjectBucketLockConfigurationRuleArgs(
            default_retention=scaleway.ObjectBucketLockConfigurationRuleDefaultRetentionArgs(
                mode="string",
                days=0,
                years=0,
            ),
        ),
        project_id="string",
        region="string")
    
    const objectBucketLockConfigurationResource = new scaleway.ObjectBucketLockConfiguration("objectBucketLockConfigurationResource", {
        bucket: "string",
        rule: {
            defaultRetention: {
                mode: "string",
                days: 0,
                years: 0,
            },
        },
        projectId: "string",
        region: "string",
    });
    
    type: scaleway:ObjectBucketLockConfiguration
    properties:
        bucket: string
        projectId: string
        region: string
        rule:
            defaultRetention:
                days: 0
                mode: string
                years: 0
    

    ObjectBucketLockConfiguration Resource Properties

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

    Inputs

    The ObjectBucketLockConfiguration resource accepts the following input properties:

    Bucket string
    The bucket's name or regional ID.
    Rule Pulumiverse.Scaleway.Inputs.ObjectBucketLockConfigurationRule
    Specifies the Object Lock rule for the specified object.
    ProjectId string
    The project_id you want to attach the resource to
    Region string
    The region you want to attach the resource to
    Bucket string
    The bucket's name or regional ID.
    Rule ObjectBucketLockConfigurationRuleArgs
    Specifies the Object Lock rule for the specified object.
    ProjectId string
    The project_id you want to attach the resource to
    Region string
    The region you want to attach the resource to
    bucket String
    The bucket's name or regional ID.
    rule ObjectBucketLockConfigurationRule
    Specifies the Object Lock rule for the specified object.
    projectId String
    The project_id you want to attach the resource to
    region String
    The region you want to attach the resource to
    bucket string
    The bucket's name or regional ID.
    rule ObjectBucketLockConfigurationRule
    Specifies the Object Lock rule for the specified object.
    projectId string
    The project_id you want to attach the resource to
    region string
    The region you want to attach the resource to
    bucket str
    The bucket's name or regional ID.
    rule ObjectBucketLockConfigurationRuleArgs
    Specifies the Object Lock rule for the specified object.
    project_id str
    The project_id you want to attach the resource to
    region str
    The region you want to attach the resource to
    bucket String
    The bucket's name or regional ID.
    rule Property Map
    Specifies the Object Lock rule for the specified object.
    projectId String
    The project_id you want to attach the resource to
    region String
    The region you want to attach the resource to

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ObjectBucketLockConfiguration 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 ObjectBucketLockConfiguration Resource

    Get an existing ObjectBucketLockConfiguration 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?: ObjectBucketLockConfigurationState, opts?: CustomResourceOptions): ObjectBucketLockConfiguration
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            bucket: Optional[str] = None,
            project_id: Optional[str] = None,
            region: Optional[str] = None,
            rule: Optional[ObjectBucketLockConfigurationRuleArgs] = None) -> ObjectBucketLockConfiguration
    func GetObjectBucketLockConfiguration(ctx *Context, name string, id IDInput, state *ObjectBucketLockConfigurationState, opts ...ResourceOption) (*ObjectBucketLockConfiguration, error)
    public static ObjectBucketLockConfiguration Get(string name, Input<string> id, ObjectBucketLockConfigurationState? state, CustomResourceOptions? opts = null)
    public static ObjectBucketLockConfiguration get(String name, Output<String> id, ObjectBucketLockConfigurationState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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:
    Bucket string
    The bucket's name or regional ID.
    ProjectId string
    The project_id you want to attach the resource to
    Region string
    The region you want to attach the resource to
    Rule Pulumiverse.Scaleway.Inputs.ObjectBucketLockConfigurationRule
    Specifies the Object Lock rule for the specified object.
    Bucket string
    The bucket's name or regional ID.
    ProjectId string
    The project_id you want to attach the resource to
    Region string
    The region you want to attach the resource to
    Rule ObjectBucketLockConfigurationRuleArgs
    Specifies the Object Lock rule for the specified object.
    bucket String
    The bucket's name or regional ID.
    projectId String
    The project_id you want to attach the resource to
    region String
    The region you want to attach the resource to
    rule ObjectBucketLockConfigurationRule
    Specifies the Object Lock rule for the specified object.
    bucket string
    The bucket's name or regional ID.
    projectId string
    The project_id you want to attach the resource to
    region string
    The region you want to attach the resource to
    rule ObjectBucketLockConfigurationRule
    Specifies the Object Lock rule for the specified object.
    bucket str
    The bucket's name or regional ID.
    project_id str
    The project_id you want to attach the resource to
    region str
    The region you want to attach the resource to
    rule ObjectBucketLockConfigurationRuleArgs
    Specifies the Object Lock rule for the specified object.
    bucket String
    The bucket's name or regional ID.
    projectId String
    The project_id you want to attach the resource to
    region String
    The region you want to attach the resource to
    rule Property Map
    Specifies the Object Lock rule for the specified object.

    Supporting Types

    ObjectBucketLockConfigurationRule, ObjectBucketLockConfigurationRuleArgs

    defaultRetention Property Map
    The default retention for the lock.

    ObjectBucketLockConfigurationRuleDefaultRetention, ObjectBucketLockConfigurationRuleDefaultRetentionArgs

    Mode string
    The default Object Lock retention mode you want to apply to new objects placed in the specified bucket. Valid values are GOVERNANCE or COMPLIANCE. To learn more about the difference between these modes, see Object Lock retention modes.
    Days int
    The number of days that you want to specify for the default retention period.
    Years int
    The number of years that you want to specify for the default retention period.
    Mode string
    The default Object Lock retention mode you want to apply to new objects placed in the specified bucket. Valid values are GOVERNANCE or COMPLIANCE. To learn more about the difference between these modes, see Object Lock retention modes.
    Days int
    The number of days that you want to specify for the default retention period.
    Years int
    The number of years that you want to specify for the default retention period.
    mode String
    The default Object Lock retention mode you want to apply to new objects placed in the specified bucket. Valid values are GOVERNANCE or COMPLIANCE. To learn more about the difference between these modes, see Object Lock retention modes.
    days Integer
    The number of days that you want to specify for the default retention period.
    years Integer
    The number of years that you want to specify for the default retention period.
    mode string
    The default Object Lock retention mode you want to apply to new objects placed in the specified bucket. Valid values are GOVERNANCE or COMPLIANCE. To learn more about the difference between these modes, see Object Lock retention modes.
    days number
    The number of days that you want to specify for the default retention period.
    years number
    The number of years that you want to specify for the default retention period.
    mode str
    The default Object Lock retention mode you want to apply to new objects placed in the specified bucket. Valid values are GOVERNANCE or COMPLIANCE. To learn more about the difference between these modes, see Object Lock retention modes.
    days int
    The number of days that you want to specify for the default retention period.
    years int
    The number of years that you want to specify for the default retention period.
    mode String
    The default Object Lock retention mode you want to apply to new objects placed in the specified bucket. Valid values are GOVERNANCE or COMPLIANCE. To learn more about the difference between these modes, see Object Lock retention modes.
    days Number
    The number of days that you want to specify for the default retention period.
    years Number
    The number of years that you want to specify for the default retention period.

    Import

    Bucket lock configurations can be imported using the {region}/{bucketName} identifier, e.g.

    bash

    $ pulumi import scaleway:index/objectBucketLockConfiguration:ObjectBucketLockConfiguration some_bucket fr-par/some-bucket
    

    ~> Important: The project_id attribute has a particular behavior with s3 products because the s3 API is scoped by project.

    If you are using a project different from the default one, you have to specify the project ID at the end of the import command.

    bash

    $ pulumi import scaleway:index/objectBucketLockConfiguration:ObjectBucketLockConfiguration some_bucket fr-par/some-bucket@xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx
    

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

    Package Details

    Repository
    scaleway pulumiverse/pulumi-scaleway
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the scaleway Terraform Provider.
    scaleway logo
    Scaleway v1.12.1 published on Monday, Apr 15, 2024 by pulumiverse