Alibaba Cloud v3.37.0, May 15 23
Alibaba Cloud v3.37.0, May 15 23
alicloud.clickhouse.BackupPolicy
Explore with Pulumi AI
Provides a Click House Backup Policy resource.
For information about Click House Backup Policy and how to use it, see What is Backup Policy.
NOTE: Available in v1.147.0+.
NOTE: Only the cloud database ClickHouse cluster version
20.3
supports data backup.
Example Usage
Basic Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var defaultRegions = AliCloud.ClickHouse.GetRegions.Invoke(new()
{
Current = true,
});
var defaultNetworks = AliCloud.Vpc.GetNetworks.Invoke(new()
{
NameRegex = "default-NODELETING",
});
var defaultSwitches = AliCloud.Vpc.GetSwitches.Invoke(new()
{
VpcId = defaultNetworks.Apply(getNetworksResult => getNetworksResult.Ids[0]),
ZoneId = defaultRegions.Apply(getRegionsResult => getRegionsResult.Regions[0]?.ZoneIds[0]?.ZoneId),
});
var defaultDbCluster = new AliCloud.ClickHouse.DbCluster("defaultDbCluster", new()
{
DbClusterVersion = "20.3.10.75",
Status = "Running",
Category = "Basic",
DbClusterClass = "S8",
DbClusterNetworkType = "vpc",
DbClusterDescription = @var.Name,
DbNodeGroupCount = 1,
PaymentType = "PayAsYouGo",
DbNodeStorage = "500",
StorageType = "cloud_essd",
VswitchId = defaultSwitches.Apply(getSwitchesResult => getSwitchesResult.Vswitches[0]?.Id),
});
var example = new AliCloud.ClickHouse.BackupPolicy("example", new()
{
DbClusterId = defaultDbCluster.Id,
PreferredBackupPeriods = new[]
{
"Monday",
"Friday",
},
PreferredBackupTime = "00:00Z-01:00Z",
BackupRetentionPeriod = 7,
});
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/clickhouse"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
defaultRegions, err := clickhouse.GetRegions(ctx, &clickhouse.GetRegionsArgs{
Current: pulumi.BoolRef(true),
}, nil)
if err != nil {
return err
}
defaultNetworks, err := vpc.GetNetworks(ctx, &vpc.GetNetworksArgs{
NameRegex: pulumi.StringRef("default-NODELETING"),
}, nil)
if err != nil {
return err
}
defaultSwitches, err := vpc.GetSwitches(ctx, &vpc.GetSwitchesArgs{
VpcId: pulumi.StringRef(defaultNetworks.Ids[0]),
ZoneId: pulumi.StringRef(defaultRegions.Regions[0].ZoneIds[0].ZoneId),
}, nil)
if err != nil {
return err
}
defaultDbCluster, err := clickhouse.NewDbCluster(ctx, "defaultDbCluster", &clickhouse.DbClusterArgs{
DbClusterVersion: pulumi.String("20.3.10.75"),
Status: pulumi.String("Running"),
Category: pulumi.String("Basic"),
DbClusterClass: pulumi.String("S8"),
DbClusterNetworkType: pulumi.String("vpc"),
DbClusterDescription: pulumi.Any(_var.Name),
DbNodeGroupCount: pulumi.Int(1),
PaymentType: pulumi.String("PayAsYouGo"),
DbNodeStorage: pulumi.String("500"),
StorageType: pulumi.String("cloud_essd"),
VswitchId: *pulumi.String(defaultSwitches.Vswitches[0].Id),
})
if err != nil {
return err
}
_, err = clickhouse.NewBackupPolicy(ctx, "example", &clickhouse.BackupPolicyArgs{
DbClusterId: defaultDbCluster.ID(),
PreferredBackupPeriods: pulumi.StringArray{
pulumi.String("Monday"),
pulumi.String("Friday"),
},
PreferredBackupTime: pulumi.String("00:00Z-01:00Z"),
BackupRetentionPeriod: pulumi.Int(7),
})
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.clickhouse.ClickhouseFunctions;
import com.pulumi.alicloud.clickhouse.inputs.GetRegionsArgs;
import com.pulumi.alicloud.vpc.VpcFunctions;
import com.pulumi.alicloud.vpc.inputs.GetNetworksArgs;
import com.pulumi.alicloud.vpc.inputs.GetSwitchesArgs;
import com.pulumi.alicloud.clickhouse.DbCluster;
import com.pulumi.alicloud.clickhouse.DbClusterArgs;
import com.pulumi.alicloud.clickhouse.BackupPolicy;
import com.pulumi.alicloud.clickhouse.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 defaultRegions = ClickhouseFunctions.getRegions(GetRegionsArgs.builder()
.current(true)
.build());
final var defaultNetworks = VpcFunctions.getNetworks(GetNetworksArgs.builder()
.nameRegex("default-NODELETING")
.build());
final var defaultSwitches = VpcFunctions.getSwitches(GetSwitchesArgs.builder()
.vpcId(defaultNetworks.applyValue(getNetworksResult -> getNetworksResult.ids()[0]))
.zoneId(defaultRegions.applyValue(getRegionsResult -> getRegionsResult.regions()[0].zoneIds()[0].zoneId()))
.build());
var defaultDbCluster = new DbCluster("defaultDbCluster", DbClusterArgs.builder()
.dbClusterVersion("20.3.10.75")
.status("Running")
.category("Basic")
.dbClusterClass("S8")
.dbClusterNetworkType("vpc")
.dbClusterDescription(var_.name())
.dbNodeGroupCount("1")
.paymentType("PayAsYouGo")
.dbNodeStorage("500")
.storageType("cloud_essd")
.vswitchId(defaultSwitches.applyValue(getSwitchesResult -> getSwitchesResult.vswitches()[0].id()))
.build());
var example = new BackupPolicy("example", BackupPolicyArgs.builder()
.dbClusterId(defaultDbCluster.id())
.preferredBackupPeriods(
"Monday",
"Friday")
.preferredBackupTime("00:00Z-01:00Z")
.backupRetentionPeriod(7)
.build());
}
}
import pulumi
import pulumi_alicloud as alicloud
default_regions = alicloud.clickhouse.get_regions(current=True)
default_networks = alicloud.vpc.get_networks(name_regex="default-NODELETING")
default_switches = alicloud.vpc.get_switches(vpc_id=default_networks.ids[0],
zone_id=default_regions.regions[0].zone_ids[0].zone_id)
default_db_cluster = alicloud.clickhouse.DbCluster("defaultDbCluster",
db_cluster_version="20.3.10.75",
status="Running",
category="Basic",
db_cluster_class="S8",
db_cluster_network_type="vpc",
db_cluster_description=var["name"],
db_node_group_count=1,
payment_type="PayAsYouGo",
db_node_storage="500",
storage_type="cloud_essd",
vswitch_id=default_switches.vswitches[0].id)
example = alicloud.clickhouse.BackupPolicy("example",
db_cluster_id=default_db_cluster.id,
preferred_backup_periods=[
"Monday",
"Friday",
],
preferred_backup_time="00:00Z-01:00Z",
backup_retention_period=7)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const defaultRegions = alicloud.clickhouse.getRegions({
current: true,
});
const defaultNetworks = alicloud.vpc.getNetworks({
nameRegex: "default-NODELETING",
});
const defaultSwitches = Promise.all([defaultNetworks, defaultRegions]).then(([defaultNetworks, defaultRegions]) => alicloud.vpc.getSwitches({
vpcId: defaultNetworks.ids?.[0],
zoneId: defaultRegions.regions?.[0]?.zoneIds?.[0]?.zoneId,
}));
const defaultDbCluster = new alicloud.clickhouse.DbCluster("defaultDbCluster", {
dbClusterVersion: "20.3.10.75",
status: "Running",
category: "Basic",
dbClusterClass: "S8",
dbClusterNetworkType: "vpc",
dbClusterDescription: _var.name,
dbNodeGroupCount: 1,
paymentType: "PayAsYouGo",
dbNodeStorage: "500",
storageType: "cloud_essd",
vswitchId: defaultSwitches.then(defaultSwitches => defaultSwitches.vswitches?.[0]?.id),
});
const example = new alicloud.clickhouse.BackupPolicy("example", {
dbClusterId: defaultDbCluster.id,
preferredBackupPeriods: [
"Monday",
"Friday",
],
preferredBackupTime: "00:00Z-01:00Z",
backupRetentionPeriod: 7,
});
resources:
defaultDbCluster:
type: alicloud:clickhouse:DbCluster
properties:
dbClusterVersion: 20.3.10.75
status: Running
category: Basic
dbClusterClass: S8
dbClusterNetworkType: vpc
dbClusterDescription: ${var.name}
dbNodeGroupCount: '1'
paymentType: PayAsYouGo
dbNodeStorage: '500'
storageType: cloud_essd
vswitchId: ${defaultSwitches.vswitches[0].id}
example:
type: alicloud:clickhouse:BackupPolicy
properties:
dbClusterId: ${defaultDbCluster.id}
preferredBackupPeriods:
- Monday
- Friday
preferredBackupTime: 00:00Z-01:00Z
backupRetentionPeriod: 7
variables:
defaultRegions:
fn::invoke:
Function: alicloud:clickhouse:getRegions
Arguments:
current: true
defaultNetworks:
fn::invoke:
Function: alicloud:vpc:getNetworks
Arguments:
nameRegex: default-NODELETING
defaultSwitches:
fn::invoke:
Function: alicloud:vpc:getSwitches
Arguments:
vpcId: ${defaultNetworks.ids[0]}
zoneId: ${defaultRegions.regions[0].zoneIds[0].zoneId}
Create BackupPolicy Resource
new BackupPolicy(name: string, args: BackupPolicyArgs, opts?: CustomResourceOptions);
@overload
def BackupPolicy(resource_name: str,
opts: Optional[ResourceOptions] = None,
backup_retention_period: Optional[int] = None,
db_cluster_id: Optional[str] = None,
preferred_backup_periods: Optional[Sequence[str]] = None,
preferred_backup_time: 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:clickhouse: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:
- Db
Cluster stringId The id of the DBCluster.
- Preferred
Backup List<string>Periods DBCluster Backup period. A list of DBCluster Backup period. Valid values: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"].
- Preferred
Backup stringTime DBCluster backup time, in the format of
HH:mmZ-HH:mmZ
. Time setting interval is one hour. China time is 8 hours behind it.- Backup
Retention intPeriod Data backup days. Valid values:
7
to730
.
- Db
Cluster stringId The id of the DBCluster.
- Preferred
Backup []stringPeriods DBCluster Backup period. A list of DBCluster Backup period. Valid values: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"].
- Preferred
Backup stringTime DBCluster backup time, in the format of
HH:mmZ-HH:mmZ
. Time setting interval is one hour. China time is 8 hours behind it.- Backup
Retention intPeriod Data backup days. Valid values:
7
to730
.
- db
Cluster StringId The id of the DBCluster.
- preferred
Backup List<String>Periods DBCluster Backup period. A list of DBCluster Backup period. Valid values: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"].
- preferred
Backup StringTime DBCluster backup time, in the format of
HH:mmZ-HH:mmZ
. Time setting interval is one hour. China time is 8 hours behind it.- backup
Retention IntegerPeriod Data backup days. Valid values:
7
to730
.
- db
Cluster stringId The id of the DBCluster.
- preferred
Backup string[]Periods DBCluster Backup period. A list of DBCluster Backup period. Valid values: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"].
- preferred
Backup stringTime DBCluster backup time, in the format of
HH:mmZ-HH:mmZ
. Time setting interval is one hour. China time is 8 hours behind it.- backup
Retention numberPeriod Data backup days. Valid values:
7
to730
.
- db_
cluster_ strid The id of the DBCluster.
- preferred_
backup_ Sequence[str]periods DBCluster Backup period. A list of DBCluster Backup period. Valid values: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"].
- preferred_
backup_ strtime DBCluster backup time, in the format of
HH:mmZ-HH:mmZ
. Time setting interval is one hour. China time is 8 hours behind it.- backup_
retention_ intperiod Data backup days. Valid values:
7
to730
.
- db
Cluster StringId The id of the DBCluster.
- preferred
Backup List<String>Periods DBCluster Backup period. A list of DBCluster Backup period. Valid values: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"].
- preferred
Backup StringTime DBCluster backup time, in the format of
HH:mmZ-HH:mmZ
. Time setting interval is one hour. China time is 8 hours behind it.- backup
Retention NumberPeriod Data backup days. Valid values:
7
to730
.
Outputs
All input properties are implicitly available as output properties. Additionally, the BackupPolicy resource produces the following output properties:
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_retention_period: Optional[int] = None,
db_cluster_id: Optional[str] = None,
preferred_backup_periods: Optional[Sequence[str]] = None,
preferred_backup_time: Optional[str] = None,
status: 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.
- Backup
Retention intPeriod Data backup days. Valid values:
7
to730
.- Db
Cluster stringId The id of the DBCluster.
- Preferred
Backup List<string>Periods DBCluster Backup period. A list of DBCluster Backup period. Valid values: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"].
- Preferred
Backup stringTime DBCluster backup time, in the format of
HH:mmZ-HH:mmZ
. Time setting interval is one hour. China time is 8 hours behind it.- Status string
The status of the resource.
- Backup
Retention intPeriod Data backup days. Valid values:
7
to730
.- Db
Cluster stringId The id of the DBCluster.
- Preferred
Backup []stringPeriods DBCluster Backup period. A list of DBCluster Backup period. Valid values: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"].
- Preferred
Backup stringTime DBCluster backup time, in the format of
HH:mmZ-HH:mmZ
. Time setting interval is one hour. China time is 8 hours behind it.- Status string
The status of the resource.
- backup
Retention IntegerPeriod Data backup days. Valid values:
7
to730
.- db
Cluster StringId The id of the DBCluster.
- preferred
Backup List<String>Periods DBCluster Backup period. A list of DBCluster Backup period. Valid values: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"].
- preferred
Backup StringTime DBCluster backup time, in the format of
HH:mmZ-HH:mmZ
. Time setting interval is one hour. China time is 8 hours behind it.- status String
The status of the resource.
- backup
Retention numberPeriod Data backup days. Valid values:
7
to730
.- db
Cluster stringId The id of the DBCluster.
- preferred
Backup string[]Periods DBCluster Backup period. A list of DBCluster Backup period. Valid values: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"].
- preferred
Backup stringTime DBCluster backup time, in the format of
HH:mmZ-HH:mmZ
. Time setting interval is one hour. China time is 8 hours behind it.- status string
The status of the resource.
- backup_
retention_ intperiod Data backup days. Valid values:
7
to730
.- db_
cluster_ strid The id of the DBCluster.
- preferred_
backup_ Sequence[str]periods DBCluster Backup period. A list of DBCluster Backup period. Valid values: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"].
- preferred_
backup_ strtime DBCluster backup time, in the format of
HH:mmZ-HH:mmZ
. Time setting interval is one hour. China time is 8 hours behind it.- status str
The status of the resource.
- backup
Retention NumberPeriod Data backup days. Valid values:
7
to730
.- db
Cluster StringId The id of the DBCluster.
- preferred
Backup List<String>Periods DBCluster Backup period. A list of DBCluster Backup period. Valid values: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"].
- preferred
Backup StringTime DBCluster backup time, in the format of
HH:mmZ-HH:mmZ
. Time setting interval is one hour. China time is 8 hours behind it.- status String
The status of the resource.
Import
Click House Backup Policy can be imported using the id, e.g.
$ pulumi import alicloud:clickhouse/backupPolicy:BackupPolicy example <db_cluster_id>
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
alicloud
Terraform Provider.