-
Notifications
You must be signed in to change notification settings - Fork 5
/
backupPolicy.go
151 lines (127 loc) · 6.18 KB
/
backupPolicy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package polardb
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// ## Import
//
// PolarDB backup policy can be imported using the id or cluster id, e.g.
//
// ```sh
// $ pulumi import alicloud:polardb/backupPolicy:BackupPolicy example "rm-12345678"
// ```
type BackupPolicy struct {
pulumi.CustomResourceState
// Cluster backup retention days, Fixed for 7 days, not modified.
BackupRetentionPeriod pulumi.StringOutput `pulumi:"backupRetentionPeriod"`
// The Id of cluster that can run database.
DbClusterId pulumi.StringOutput `pulumi:"dbClusterId"`
// PolarDB Cluster backup period. Valid values: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]. Default to ["Tuesday", "Thursday", "Saturday"].
PreferredBackupPeriods pulumi.StringArrayOutput `pulumi:"preferredBackupPeriods"`
// PolarDB Cluster backup time, in the format of HH:mmZ- HH:mmZ. Time setting interval is one hour. Default to "02:00Z-03:00Z". China time is 8 hours behind it.
PreferredBackupTime pulumi.StringPtrOutput `pulumi:"preferredBackupTime"`
}
// NewBackupPolicy registers a new resource with the given unique name, arguments, and options.
func NewBackupPolicy(ctx *pulumi.Context,
name string, args *BackupPolicyArgs, opts ...pulumi.ResourceOption) (*BackupPolicy, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.DbClusterId == nil {
return nil, errors.New("invalid value for required argument 'DbClusterId'")
}
var resource BackupPolicy
err := ctx.RegisterResource("alicloud:polardb/backupPolicy:BackupPolicy", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetBackupPolicy gets an existing BackupPolicy resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetBackupPolicy(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *BackupPolicyState, opts ...pulumi.ResourceOption) (*BackupPolicy, error) {
var resource BackupPolicy
err := ctx.ReadResource("alicloud:polardb/backupPolicy:BackupPolicy", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering BackupPolicy resources.
type backupPolicyState struct {
// Cluster backup retention days, Fixed for 7 days, not modified.
BackupRetentionPeriod *string `pulumi:"backupRetentionPeriod"`
// The Id of cluster that can run database.
DbClusterId *string `pulumi:"dbClusterId"`
// PolarDB Cluster backup period. Valid values: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]. Default to ["Tuesday", "Thursday", "Saturday"].
PreferredBackupPeriods []string `pulumi:"preferredBackupPeriods"`
// PolarDB Cluster backup time, in the format of HH:mmZ- HH:mmZ. Time setting interval is one hour. Default to "02:00Z-03:00Z". China time is 8 hours behind it.
PreferredBackupTime *string `pulumi:"preferredBackupTime"`
}
type BackupPolicyState struct {
// Cluster backup retention days, Fixed for 7 days, not modified.
BackupRetentionPeriod pulumi.StringPtrInput
// The Id of cluster that can run database.
DbClusterId pulumi.StringPtrInput
// PolarDB Cluster backup period. Valid values: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]. Default to ["Tuesday", "Thursday", "Saturday"].
PreferredBackupPeriods pulumi.StringArrayInput
// PolarDB Cluster backup time, in the format of HH:mmZ- HH:mmZ. Time setting interval is one hour. Default to "02:00Z-03:00Z". China time is 8 hours behind it.
PreferredBackupTime pulumi.StringPtrInput
}
func (BackupPolicyState) ElementType() reflect.Type {
return reflect.TypeOf((*backupPolicyState)(nil)).Elem()
}
type backupPolicyArgs struct {
// The Id of cluster that can run database.
DbClusterId string `pulumi:"dbClusterId"`
// PolarDB Cluster backup period. Valid values: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]. Default to ["Tuesday", "Thursday", "Saturday"].
PreferredBackupPeriods []string `pulumi:"preferredBackupPeriods"`
// PolarDB Cluster backup time, in the format of HH:mmZ- HH:mmZ. Time setting interval is one hour. Default to "02:00Z-03:00Z". China time is 8 hours behind it.
PreferredBackupTime *string `pulumi:"preferredBackupTime"`
}
// The set of arguments for constructing a BackupPolicy resource.
type BackupPolicyArgs struct {
// The Id of cluster that can run database.
DbClusterId pulumi.StringInput
// PolarDB Cluster backup period. Valid values: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]. Default to ["Tuesday", "Thursday", "Saturday"].
PreferredBackupPeriods pulumi.StringArrayInput
// PolarDB Cluster backup time, in the format of HH:mmZ- HH:mmZ. Time setting interval is one hour. Default to "02:00Z-03:00Z". China time is 8 hours behind it.
PreferredBackupTime pulumi.StringPtrInput
}
func (BackupPolicyArgs) ElementType() reflect.Type {
return reflect.TypeOf((*backupPolicyArgs)(nil)).Elem()
}
type BackupPolicyInput interface {
pulumi.Input
ToBackupPolicyOutput() BackupPolicyOutput
ToBackupPolicyOutputWithContext(ctx context.Context) BackupPolicyOutput
}
func (*BackupPolicy) ElementType() reflect.Type {
return reflect.TypeOf((*BackupPolicy)(nil))
}
func (i *BackupPolicy) ToBackupPolicyOutput() BackupPolicyOutput {
return i.ToBackupPolicyOutputWithContext(context.Background())
}
func (i *BackupPolicy) ToBackupPolicyOutputWithContext(ctx context.Context) BackupPolicyOutput {
return pulumi.ToOutputWithContext(ctx, i).(BackupPolicyOutput)
}
type BackupPolicyOutput struct {
*pulumi.OutputState
}
func (BackupPolicyOutput) ElementType() reflect.Type {
return reflect.TypeOf((*BackupPolicy)(nil))
}
func (o BackupPolicyOutput) ToBackupPolicyOutput() BackupPolicyOutput {
return o
}
func (o BackupPolicyOutput) ToBackupPolicyOutputWithContext(ctx context.Context) BackupPolicyOutput {
return o
}
func init() {
pulumi.RegisterOutputType(BackupPolicyOutput{})
}