1. Packages
  2. Volcengine
  3. API Docs
  4. redis
  5. BackupRestore
Volcengine v0.0.26 published on Friday, Sep 13, 2024 by Volcengine

volcengine.redis.BackupRestore

Explore with Pulumi AI

volcengine logo
Volcengine v0.0.26 published on Friday, Sep 13, 2024 by Volcengine

    Provides a resource to manage redis backup restore

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Volcengine = Pulumi.Volcengine;
    
    return await Deployment.RunAsync(() => 
    {
        var fooZones = Volcengine.Ecs.Zones.Invoke();
    
        var fooVpc = new Volcengine.Vpc.Vpc("fooVpc", new()
        {
            VpcName = "acc-test-vpc",
            CidrBlock = "172.16.0.0/16",
        });
    
        var fooSubnet = new Volcengine.Vpc.Subnet("fooSubnet", new()
        {
            SubnetName = "acc-test-subnet",
            CidrBlock = "172.16.0.0/24",
            ZoneId = fooZones.Apply(zonesResult => zonesResult.Zones[0]?.Id),
            VpcId = fooVpc.Id,
        });
    
        var fooInstance = new Volcengine.Redis.Instance("fooInstance", new()
        {
            ZoneIds = new[]
            {
                fooZones.Apply(zonesResult => zonesResult.Zones[0]?.Id),
            },
            InstanceName = "acc-test-tf-redis",
            ShardedCluster = 1,
            Password = "1qaz!QAZ12",
            NodeNumber = 2,
            ShardCapacity = 1024,
            ShardNumber = 2,
            EngineVersion = "5.0",
            SubnetId = fooSubnet.Id,
            DeletionProtection = "disabled",
            VpcAuthMode = "close",
            ChargeType = "PostPaid",
            Port = 6381,
            ProjectName = "default",
        });
    
        var fooBackup = new Volcengine.Redis.Backup("fooBackup", new()
        {
            InstanceId = fooInstance.Id,
        });
    
        var fooBackupRestore = new Volcengine.Redis.BackupRestore("fooBackupRestore", new()
        {
            InstanceId = fooInstance.Id,
            TimePoint = fooBackup.EndTime,
            BackupType = "Full",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/ecs"
    	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/redis"
    	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/vpc"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		fooZones, err := ecs.Zones(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		fooVpc, err := vpc.NewVpc(ctx, "fooVpc", &vpc.VpcArgs{
    			VpcName:   pulumi.String("acc-test-vpc"),
    			CidrBlock: pulumi.String("172.16.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		fooSubnet, err := vpc.NewSubnet(ctx, "fooSubnet", &vpc.SubnetArgs{
    			SubnetName: pulumi.String("acc-test-subnet"),
    			CidrBlock:  pulumi.String("172.16.0.0/24"),
    			ZoneId:     *pulumi.String(fooZones.Zones[0].Id),
    			VpcId:      fooVpc.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		fooInstance, err := redis.NewInstance(ctx, "fooInstance", &redis.InstanceArgs{
    			ZoneIds: pulumi.StringArray{
    				*pulumi.String(fooZones.Zones[0].Id),
    			},
    			InstanceName:       pulumi.String("acc-test-tf-redis"),
    			ShardedCluster:     pulumi.Int(1),
    			Password:           pulumi.String("1qaz!QAZ12"),
    			NodeNumber:         pulumi.Int(2),
    			ShardCapacity:      pulumi.Int(1024),
    			ShardNumber:        pulumi.Int(2),
    			EngineVersion:      pulumi.String("5.0"),
    			SubnetId:           fooSubnet.ID(),
    			DeletionProtection: pulumi.String("disabled"),
    			VpcAuthMode:        pulumi.String("close"),
    			ChargeType:         pulumi.String("PostPaid"),
    			Port:               pulumi.Int(6381),
    			ProjectName:        pulumi.String("default"),
    		})
    		if err != nil {
    			return err
    		}
    		fooBackup, err := redis.NewBackup(ctx, "fooBackup", &redis.BackupArgs{
    			InstanceId: fooInstance.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = redis.NewBackupRestore(ctx, "fooBackupRestore", &redis.BackupRestoreArgs{
    			InstanceId: fooInstance.ID(),
    			TimePoint:  fooBackup.EndTime,
    			BackupType: pulumi.String("Full"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.volcengine.ecs.EcsFunctions;
    import com.pulumi.volcengine.ecs.inputs.ZonesArgs;
    import com.pulumi.volcengine.vpc.Vpc;
    import com.pulumi.volcengine.vpc.VpcArgs;
    import com.pulumi.volcengine.vpc.Subnet;
    import com.pulumi.volcengine.vpc.SubnetArgs;
    import com.pulumi.volcengine.redis.Instance;
    import com.pulumi.volcengine.redis.InstanceArgs;
    import com.pulumi.volcengine.redis.Backup;
    import com.pulumi.volcengine.redis.BackupArgs;
    import com.pulumi.volcengine.redis.BackupRestore;
    import com.pulumi.volcengine.redis.BackupRestoreArgs;
    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 fooZones = EcsFunctions.Zones();
    
            var fooVpc = new Vpc("fooVpc", VpcArgs.builder()        
                .vpcName("acc-test-vpc")
                .cidrBlock("172.16.0.0/16")
                .build());
    
            var fooSubnet = new Subnet("fooSubnet", SubnetArgs.builder()        
                .subnetName("acc-test-subnet")
                .cidrBlock("172.16.0.0/24")
                .zoneId(fooZones.applyValue(zonesResult -> zonesResult.zones()[0].id()))
                .vpcId(fooVpc.id())
                .build());
    
            var fooInstance = new Instance("fooInstance", InstanceArgs.builder()        
                .zoneIds(fooZones.applyValue(zonesResult -> zonesResult.zones()[0].id()))
                .instanceName("acc-test-tf-redis")
                .shardedCluster(1)
                .password("1qaz!QAZ12")
                .nodeNumber(2)
                .shardCapacity(1024)
                .shardNumber(2)
                .engineVersion("5.0")
                .subnetId(fooSubnet.id())
                .deletionProtection("disabled")
                .vpcAuthMode("close")
                .chargeType("PostPaid")
                .port(6381)
                .projectName("default")
                .build());
    
            var fooBackup = new Backup("fooBackup", BackupArgs.builder()        
                .instanceId(fooInstance.id())
                .build());
    
            var fooBackupRestore = new BackupRestore("fooBackupRestore", BackupRestoreArgs.builder()        
                .instanceId(fooInstance.id())
                .timePoint(fooBackup.endTime())
                .backupType("Full")
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_volcengine as volcengine
    
    foo_zones = volcengine.ecs.zones()
    foo_vpc = volcengine.vpc.Vpc("fooVpc",
        vpc_name="acc-test-vpc",
        cidr_block="172.16.0.0/16")
    foo_subnet = volcengine.vpc.Subnet("fooSubnet",
        subnet_name="acc-test-subnet",
        cidr_block="172.16.0.0/24",
        zone_id=foo_zones.zones[0].id,
        vpc_id=foo_vpc.id)
    foo_instance = volcengine.redis.Instance("fooInstance",
        zone_ids=[foo_zones.zones[0].id],
        instance_name="acc-test-tf-redis",
        sharded_cluster=1,
        password="1qaz!QAZ12",
        node_number=2,
        shard_capacity=1024,
        shard_number=2,
        engine_version="5.0",
        subnet_id=foo_subnet.id,
        deletion_protection="disabled",
        vpc_auth_mode="close",
        charge_type="PostPaid",
        port=6381,
        project_name="default")
    foo_backup = volcengine.redis.Backup("fooBackup", instance_id=foo_instance.id)
    foo_backup_restore = volcengine.redis.BackupRestore("fooBackupRestore",
        instance_id=foo_instance.id,
        time_point=foo_backup.end_time,
        backup_type="Full")
    
    import * as pulumi from "@pulumi/pulumi";
    import * as volcengine from "@pulumi/volcengine";
    import * as volcengine from "@volcengine/pulumi";
    
    const fooZones = volcengine.ecs.Zones({});
    const fooVpc = new volcengine.vpc.Vpc("fooVpc", {
        vpcName: "acc-test-vpc",
        cidrBlock: "172.16.0.0/16",
    });
    const fooSubnet = new volcengine.vpc.Subnet("fooSubnet", {
        subnetName: "acc-test-subnet",
        cidrBlock: "172.16.0.0/24",
        zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
        vpcId: fooVpc.id,
    });
    const fooInstance = new volcengine.redis.Instance("fooInstance", {
        zoneIds: [fooZones.then(fooZones => fooZones.zones?.[0]?.id)],
        instanceName: "acc-test-tf-redis",
        shardedCluster: 1,
        password: "1qaz!QAZ12",
        nodeNumber: 2,
        shardCapacity: 1024,
        shardNumber: 2,
        engineVersion: "5.0",
        subnetId: fooSubnet.id,
        deletionProtection: "disabled",
        vpcAuthMode: "close",
        chargeType: "PostPaid",
        port: 6381,
        projectName: "default",
    });
    const fooBackup = new volcengine.redis.Backup("fooBackup", {instanceId: fooInstance.id});
    const fooBackupRestore = new volcengine.redis.BackupRestore("fooBackupRestore", {
        instanceId: fooInstance.id,
        timePoint: fooBackup.endTime,
        backupType: "Full",
    });
    
    resources:
      fooVpc:
        type: volcengine:vpc:Vpc
        properties:
          vpcName: acc-test-vpc
          cidrBlock: 172.16.0.0/16
      fooSubnet:
        type: volcengine:vpc:Subnet
        properties:
          subnetName: acc-test-subnet
          cidrBlock: 172.16.0.0/24
          zoneId: ${fooZones.zones[0].id}
          vpcId: ${fooVpc.id}
      fooInstance:
        type: volcengine:redis:Instance
        properties:
          zoneIds:
            - ${fooZones.zones[0].id}
          instanceName: acc-test-tf-redis
          shardedCluster: 1
          password: 1qaz!QAZ12
          nodeNumber: 2
          shardCapacity: 1024
          shardNumber: 2
          engineVersion: '5.0'
          subnetId: ${fooSubnet.id}
          deletionProtection: disabled
          vpcAuthMode: close
          chargeType: PostPaid
          port: 6381
          projectName: default
      fooBackup:
        type: volcengine:redis:Backup
        properties:
          instanceId: ${fooInstance.id}
      fooBackupRestore:
        type: volcengine:redis:BackupRestore
        properties:
          instanceId: ${fooInstance.id}
          timePoint: ${fooBackup.endTime}
          backupType: Full
    variables:
      fooZones:
        fn::invoke:
          Function: volcengine:ecs:Zones
          Arguments: {}
    

    Create BackupRestore Resource

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

    Constructor syntax

    new BackupRestore(name: string, args: BackupRestoreArgs, opts?: CustomResourceOptions);
    @overload
    def BackupRestore(resource_name: str,
                      args: BackupRestoreArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def BackupRestore(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      instance_id: Optional[str] = None,
                      time_point: Optional[str] = None,
                      backup_type: Optional[str] = None)
    func NewBackupRestore(ctx *Context, name string, args BackupRestoreArgs, opts ...ResourceOption) (*BackupRestore, error)
    public BackupRestore(string name, BackupRestoreArgs args, CustomResourceOptions? opts = null)
    public BackupRestore(String name, BackupRestoreArgs args)
    public BackupRestore(String name, BackupRestoreArgs args, CustomResourceOptions options)
    
    type: volcengine:redis:BackupRestore
    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 BackupRestoreArgs
    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 BackupRestoreArgs
    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 BackupRestoreArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args BackupRestoreArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args BackupRestoreArgs
    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 backupRestoreResource = new Volcengine.Redis.BackupRestore("backupRestoreResource", new()
    {
        InstanceId = "string",
        TimePoint = "string",
        BackupType = "string",
    });
    
    example, err := redis.NewBackupRestore(ctx, "backupRestoreResource", &redis.BackupRestoreArgs{
    	InstanceId: pulumi.String("string"),
    	TimePoint:  pulumi.String("string"),
    	BackupType: pulumi.String("string"),
    })
    
    var backupRestoreResource = new BackupRestore("backupRestoreResource", BackupRestoreArgs.builder()
        .instanceId("string")
        .timePoint("string")
        .backupType("string")
        .build());
    
    backup_restore_resource = volcengine.redis.BackupRestore("backupRestoreResource",
        instance_id="string",
        time_point="string",
        backup_type="string")
    
    const backupRestoreResource = new volcengine.redis.BackupRestore("backupRestoreResource", {
        instanceId: "string",
        timePoint: "string",
        backupType: "string",
    });
    
    type: volcengine:redis:BackupRestore
    properties:
        backupType: string
        instanceId: string
        timePoint: string
    

    BackupRestore 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 BackupRestore resource accepts the following input properties:

    InstanceId string
    Id of instance.
    TimePoint string
    Time point of backup, for example: 2021-11-09T06:07:26Z. Use lifecycle and ignore_changes in import.
    BackupType string
    The type of backup. The value can be Full or Inc.
    InstanceId string
    Id of instance.
    TimePoint string
    Time point of backup, for example: 2021-11-09T06:07:26Z. Use lifecycle and ignore_changes in import.
    BackupType string
    The type of backup. The value can be Full or Inc.
    instanceId String
    Id of instance.
    timePoint String
    Time point of backup, for example: 2021-11-09T06:07:26Z. Use lifecycle and ignore_changes in import.
    backupType String
    The type of backup. The value can be Full or Inc.
    instanceId string
    Id of instance.
    timePoint string
    Time point of backup, for example: 2021-11-09T06:07:26Z. Use lifecycle and ignore_changes in import.
    backupType string
    The type of backup. The value can be Full or Inc.
    instance_id str
    Id of instance.
    time_point str
    Time point of backup, for example: 2021-11-09T06:07:26Z. Use lifecycle and ignore_changes in import.
    backup_type str
    The type of backup. The value can be Full or Inc.
    instanceId String
    Id of instance.
    timePoint String
    Time point of backup, for example: 2021-11-09T06:07:26Z. Use lifecycle and ignore_changes in import.
    backupType String
    The type of backup. The value can be Full or Inc.

    Outputs

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

    Get an existing BackupRestore 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?: BackupRestoreState, opts?: CustomResourceOptions): BackupRestore
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            backup_type: Optional[str] = None,
            instance_id: Optional[str] = None,
            time_point: Optional[str] = None) -> BackupRestore
    func GetBackupRestore(ctx *Context, name string, id IDInput, state *BackupRestoreState, opts ...ResourceOption) (*BackupRestore, error)
    public static BackupRestore Get(string name, Input<string> id, BackupRestoreState? state, CustomResourceOptions? opts = null)
    public static BackupRestore get(String name, Output<String> id, BackupRestoreState 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:
    BackupType string
    The type of backup. The value can be Full or Inc.
    InstanceId string
    Id of instance.
    TimePoint string
    Time point of backup, for example: 2021-11-09T06:07:26Z. Use lifecycle and ignore_changes in import.
    BackupType string
    The type of backup. The value can be Full or Inc.
    InstanceId string
    Id of instance.
    TimePoint string
    Time point of backup, for example: 2021-11-09T06:07:26Z. Use lifecycle and ignore_changes in import.
    backupType String
    The type of backup. The value can be Full or Inc.
    instanceId String
    Id of instance.
    timePoint String
    Time point of backup, for example: 2021-11-09T06:07:26Z. Use lifecycle and ignore_changes in import.
    backupType string
    The type of backup. The value can be Full or Inc.
    instanceId string
    Id of instance.
    timePoint string
    Time point of backup, for example: 2021-11-09T06:07:26Z. Use lifecycle and ignore_changes in import.
    backup_type str
    The type of backup. The value can be Full or Inc.
    instance_id str
    Id of instance.
    time_point str
    Time point of backup, for example: 2021-11-09T06:07:26Z. Use lifecycle and ignore_changes in import.
    backupType String
    The type of backup. The value can be Full or Inc.
    instanceId String
    Id of instance.
    timePoint String
    Time point of backup, for example: 2021-11-09T06:07:26Z. Use lifecycle and ignore_changes in import.

    Import

    Redis Backup Restore can be imported using the restore:instanceId, e.g.

     $ pulumi import volcengine:redis/backupRestore:BackupRestore default restore:redis-asdljioeixxxx
    

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

    Package Details

    Repository
    volcengine volcengine/pulumi-volcengine
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the volcengine Terraform Provider.
    volcengine logo
    Volcengine v0.0.26 published on Friday, Sep 13, 2024 by Volcengine