BackupPolicy

Import

KVStore backup policy can be imported using the id, e.g.

 $ pulumi import alicloud:kvstore/backupPolicy:BackupPolicy example r-abc12345678

Example Usage

Basic Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var config = new Config();
        var creation = config.Get("creation") ?? "KVStore";
        var multiAz = config.Get("multiAz") ?? "false";
        var name = config.Get("name") ?? "kvstorebackuppolicyvpc";
        var defaultZones = Output.Create(AliCloud.GetZones.InvokeAsync(new AliCloud.GetZonesArgs
        {
            AvailableResourceCreation = creation,
        }));
        var defaultNetwork = new AliCloud.Vpc.Network("defaultNetwork", new AliCloud.Vpc.NetworkArgs
        {
            CidrBlock = "172.16.0.0/16",
        });
        var defaultSwitch = new AliCloud.Vpc.Switch("defaultSwitch", new AliCloud.Vpc.SwitchArgs
        {
            VpcId = defaultNetwork.Id,
            CidrBlock = "172.16.0.0/24",
            ZoneId = defaultZones.Apply(defaultZones => defaultZones.Zones?[0]?.Id),
        });
        var defaultInstance = new AliCloud.KVStore.Instance("defaultInstance", new AliCloud.KVStore.InstanceArgs
        {
            InstanceClass = "Memcache",
            InstanceName = name,
            VswitchId = defaultSwitch.Id,
            PrivateIp = "172.16.0.10",
            SecurityIps = 
            {
                "10.0.0.1",
            },
            InstanceType = "memcache.master.small.default",
            EngineVersion = "2.8",
        });
        var defaultBackupPolicy = new AliCloud.KVStore.BackupPolicy("defaultBackupPolicy", new AliCloud.KVStore.BackupPolicyArgs
        {
            InstanceId = defaultInstance.Id,
            BackupPeriods = 
            {
                "Tuesday",
                "Wednesday",
            },
            BackupTime = "10:00Z-11:00Z",
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/kvstore"
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		creation := "KVStore"
		if param := cfg.Get("creation"); param != "" {
			creation = param
		}
		multiAz := "false"
		if param := cfg.Get("multiAz"); param != "" {
			multiAz = param
		}
		name := "kvstorebackuppolicyvpc"
		if param := cfg.Get("name"); param != "" {
			name = param
		}
		defaultZones, err := alicloud.GetZones(ctx, &GetZonesArgs{
			AvailableResourceCreation: pulumi.StringRef(creation),
		}, nil)
		if err != nil {
			return err
		}
		defaultNetwork, err := vpc.NewNetwork(ctx, "defaultNetwork", &vpc.NetworkArgs{
			CidrBlock: pulumi.String("172.16.0.0/16"),
		})
		if err != nil {
			return err
		}
		defaultSwitch, err := vpc.NewSwitch(ctx, "defaultSwitch", &vpc.SwitchArgs{
			VpcId:     defaultNetwork.ID(),
			CidrBlock: pulumi.String("172.16.0.0/24"),
			ZoneId:    pulumi.String(defaultZones.Zones[0].Id),
		})
		if err != nil {
			return err
		}
		defaultInstance, err := kvstore.NewInstance(ctx, "defaultInstance", &kvstore.InstanceArgs{
			InstanceClass: pulumi.String("Memcache"),
			InstanceName:  pulumi.String(name),
			VswitchId:     defaultSwitch.ID(),
			PrivateIp:     pulumi.String("172.16.0.10"),
			SecurityIps: pulumi.StringArray{
				pulumi.String("10.0.0.1"),
			},
			InstanceType:  pulumi.String("memcache.master.small.default"),
			EngineVersion: pulumi.String("2.8"),
		})
		if err != nil {
			return err
		}
		_, err = kvstore.NewBackupPolicy(ctx, "defaultBackupPolicy", &kvstore.BackupPolicyArgs{
			InstanceId: defaultInstance.ID(),
			BackupPeriods: pulumi.StringArray{
				pulumi.String("Tuesday"),
				pulumi.String("Wednesday"),
			},
			BackupTime: pulumi.String("10:00Z-11:00Z"),
		})
		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.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.adb.inputs.GetZonesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.kvstore.Instance;
import com.pulumi.alicloud.kvstore.InstanceArgs;
import com.pulumi.alicloud.kvstore.BackupPolicy;
import com.pulumi.alicloud.kvstore.BackupPolicyArgs;
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 config = ctx.config();
        final var creation = config.get("creation").orElse("KVStore");
        final var multiAz = config.get("multiAz").orElse("false");
        final var name = config.get("name").orElse("kvstorebackuppolicyvpc");
        final var defaultZones = AlicloudFunctions.getZones(GetZonesArgs.builder()
            .availableResourceCreation(creation)
            .build());

        var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()        
            .cidrBlock("172.16.0.0/16")
            .build());

        var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()        
            .vpcId(defaultNetwork.id())
            .cidrBlock("172.16.0.0/24")
            .zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
            .build());

        var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()        
            .instanceClass("Memcache")
            .instanceName(name)
            .vswitchId(defaultSwitch.id())
            .privateIp("172.16.0.10")
            .securityIps("10.0.0.1")
            .instanceType("memcache.master.small.default")
            .engineVersion("2.8")
            .build());

        var defaultBackupPolicy = new BackupPolicy("defaultBackupPolicy", BackupPolicyArgs.builder()        
            .instanceId(defaultInstance.id())
            .backupPeriods(            
                "Tuesday",
                "Wednesday")
            .backupTime("10:00Z-11:00Z")
            .build());

    }
}
import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
creation = config.get("creation")
if creation is None:
    creation = "KVStore"
multi_az = config.get("multiAz")
if multi_az is None:
    multi_az = "false"
name = config.get("name")
if name is None:
    name = "kvstorebackuppolicyvpc"
default_zones = alicloud.get_zones(available_resource_creation=creation)
default_network = alicloud.vpc.Network("defaultNetwork", cidr_block="172.16.0.0/16")
default_switch = alicloud.vpc.Switch("defaultSwitch",
    vpc_id=default_network.id,
    cidr_block="172.16.0.0/24",
    zone_id=default_zones.zones[0].id)
default_instance = alicloud.kvstore.Instance("defaultInstance",
    instance_class="Memcache",
    instance_name=name,
    vswitch_id=default_switch.id,
    private_ip="172.16.0.10",
    security_ips=["10.0.0.1"],
    instance_type="memcache.master.small.default",
    engine_version="2.8")
default_backup_policy = alicloud.kvstore.BackupPolicy("defaultBackupPolicy",
    instance_id=default_instance.id,
    backup_periods=[
        "Tuesday",
        "Wednesday",
    ],
    backup_time="10:00Z-11:00Z")
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const creation = config.get("creation") || "KVStore";
const multiAz = config.get("multiAz") || "false";
const name = config.get("name") || "kvstorebackuppolicyvpc";
const defaultZones = alicloud.getZones({
    availableResourceCreation: creation,
});
const defaultNetwork = new alicloud.vpc.Network("defaultNetwork", {cidrBlock: "172.16.0.0/16"});
const defaultSwitch = new alicloud.vpc.Switch("defaultSwitch", {
    vpcId: defaultNetwork.id,
    cidrBlock: "172.16.0.0/24",
    zoneId: defaultZones.then(defaultZones => defaultZones.zones?[0]?.id),
});
const defaultInstance = new alicloud.kvstore.Instance("defaultInstance", {
    instanceClass: "Memcache",
    instanceName: name,
    vswitchId: defaultSwitch.id,
    privateIp: "172.16.0.10",
    securityIps: ["10.0.0.1"],
    instanceType: "memcache.master.small.default",
    engineVersion: "2.8",
});
const defaultBackupPolicy = new alicloud.kvstore.BackupPolicy("defaultBackupPolicy", {
    instanceId: defaultInstance.id,
    backupPeriods: [
        "Tuesday",
        "Wednesday",
    ],
    backupTime: "10:00Z-11:00Z",
});
configuration:
  creation:
    type: string
    default: KVStore
  multiAz:
    type: string
    default: false
  name:
    type: string
    default: kvstorebackuppolicyvpc
resources:
  defaultNetwork:
    type: alicloud:vpc:Network
    properties:
      cidrBlock: 172.16.0.0/16
  defaultSwitch:
    type: alicloud:vpc:Switch
    properties:
      vpcId: ${defaultNetwork.id}
      cidrBlock: 172.16.0.0/24
      zoneId: ${defaultZones.zones[0].id}
  defaultInstance:
    type: alicloud:kvstore:Instance
    properties:
      instanceClass: Memcache
      instanceName: ${name}
      vswitchId: ${defaultSwitch.id}
      privateIp: 172.16.0.10
      securityIps:
        - 10.0.0.1
      instanceType: memcache.master.small.default
      engineVersion: 2.8
  defaultBackupPolicy:
    type: alicloud:kvstore:BackupPolicy
    properties:
      instanceId: ${defaultInstance.id}
      backupPeriods:
        - Tuesday
        - Wednesday
      backupTime: 10:00Z-11:00Z
variables:
  defaultZones:
    Fn::Invoke:
      Function: alicloud:getZones
      Arguments:
        availableResourceCreation: ${creation}

Create BackupPolicy Resource

new BackupPolicy(name: string, args: BackupPolicyArgs, opts?: CustomResourceOptions);
@overload
def BackupPolicy(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 backup_periods: Optional[Sequence[str]] = None,
                 backup_time: Optional[str] = None,
                 instance_id: Optional[str] = None)
@overload
def BackupPolicy(resource_name: str,
                 args: BackupPolicyArgs,
                 opts: Optional[ResourceOptions] = None)
func NewBackupPolicy(ctx *Context, name string, args BackupPolicyArgs, opts ...ResourceOption) (*BackupPolicy, error)
public BackupPolicy(string name, BackupPolicyArgs args, CustomResourceOptions? opts = null)
public BackupPolicy(String name, BackupPolicyArgs args)
public BackupPolicy(String name, BackupPolicyArgs args, CustomResourceOptions options)
type: alicloud:kvstore:BackupPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args BackupPolicyArgs
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 BackupPolicyArgs
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 BackupPolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args BackupPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args BackupPolicyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

InstanceId string

The id of ApsaraDB for Redis or Memcache intance.

BackupPeriods List<string>

Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday

BackupTime string

Backup time, in the format of HH:mmZ- HH:mm Z

InstanceId string

The id of ApsaraDB for Redis or Memcache intance.

BackupPeriods []string

Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday

BackupTime string

Backup time, in the format of HH:mmZ- HH:mm Z

instanceId String

The id of ApsaraDB for Redis or Memcache intance.

backupPeriods List<String>

Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday

backupTime String

Backup time, in the format of HH:mmZ- HH:mm Z

instanceId string

The id of ApsaraDB for Redis or Memcache intance.

backupPeriods string[]

Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday

backupTime string

Backup time, in the format of HH:mmZ- HH:mm Z

instance_id str

The id of ApsaraDB for Redis or Memcache intance.

backup_periods Sequence[str]

Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday

backup_time str

Backup time, in the format of HH:mmZ- HH:mm Z

instanceId String

The id of ApsaraDB for Redis or Memcache intance.

backupPeriods List<String>

Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday

backupTime String

Backup time, in the format of HH:mmZ- HH:mm Z

Outputs

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

Get an existing BackupPolicy 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?: BackupPolicyState, opts?: CustomResourceOptions): BackupPolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        backup_periods: Optional[Sequence[str]] = None,
        backup_time: Optional[str] = None,
        instance_id: Optional[str] = None) -> BackupPolicy
func GetBackupPolicy(ctx *Context, name string, id IDInput, state *BackupPolicyState, opts ...ResourceOption) (*BackupPolicy, error)
public static BackupPolicy Get(string name, Input<string> id, BackupPolicyState? state, CustomResourceOptions? opts = null)
public static BackupPolicy get(String name, Output<String> id, BackupPolicyState 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:
BackupPeriods List<string>

Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday

BackupTime string

Backup time, in the format of HH:mmZ- HH:mm Z

InstanceId string

The id of ApsaraDB for Redis or Memcache intance.

BackupPeriods []string

Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday

BackupTime string

Backup time, in the format of HH:mmZ- HH:mm Z

InstanceId string

The id of ApsaraDB for Redis or Memcache intance.

backupPeriods List<String>

Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday

backupTime String

Backup time, in the format of HH:mmZ- HH:mm Z

instanceId String

The id of ApsaraDB for Redis or Memcache intance.

backupPeriods string[]

Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday

backupTime string

Backup time, in the format of HH:mmZ- HH:mm Z

instanceId string

The id of ApsaraDB for Redis or Memcache intance.

backup_periods Sequence[str]

Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday

backup_time str

Backup time, in the format of HH:mmZ- HH:mm Z

instance_id str

The id of ApsaraDB for Redis or Memcache intance.

backupPeriods List<String>

Backup Cycle. Allowed values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday

backupTime String

Backup time, in the format of HH:mmZ- HH:mm Z

instanceId String

The id of ApsaraDB for Redis or Memcache intance.

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.