-
Notifications
You must be signed in to change notification settings - Fork 5
/
database.go
113 lines (100 loc) · 6.6 KB
/
database.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
// *** 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 (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Provides a PolarDB database resource. A DB database deployed in a DB cluster. A DB cluster can own multiple databases.
//
// > **NOTE:** Available in v1.66.0+.
type Database struct {
pulumi.CustomResourceState
// Character set. The value range is limited to the following: [ utf8, gbk, latin1, utf8mb4, Chinese_PRC_CI_AS, Chinese_PRC_CS_AS, SQL_Latin1_General_CP1_CI_AS, SQL_Latin1_General_CP1_CS_AS, Chinese_PRC_BIN ], default is "utf8" \(`utf8mb4` only supports versions 5.5 and 5.6\).
CharacterSetName pulumi.StringPtrOutput `pulumi:"characterSetName"`
// The Id of cluster that can run database.
DbClusterId pulumi.StringOutput `pulumi:"dbClusterId"`
// Database description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.
DbDescription pulumi.StringPtrOutput `pulumi:"dbDescription"`
// Name of the database requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letterand have no more than 64 characters.
DbName pulumi.StringOutput `pulumi:"dbName"`
}
// NewDatabase registers a new resource with the given unique name, arguments, and options.
func NewDatabase(ctx *pulumi.Context,
name string, args *DatabaseArgs, opts ...pulumi.ResourceOption) (*Database, error) {
if args == nil || args.DbClusterId == nil {
return nil, errors.New("missing required argument 'DbClusterId'")
}
if args == nil || args.DbName == nil {
return nil, errors.New("missing required argument 'DbName'")
}
if args == nil {
args = &DatabaseArgs{}
}
var resource Database
err := ctx.RegisterResource("alicloud:polardb/database:Database", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetDatabase gets an existing Database 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 GetDatabase(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *DatabaseState, opts ...pulumi.ResourceOption) (*Database, error) {
var resource Database
err := ctx.ReadResource("alicloud:polardb/database:Database", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Database resources.
type databaseState struct {
// Character set. The value range is limited to the following: [ utf8, gbk, latin1, utf8mb4, Chinese_PRC_CI_AS, Chinese_PRC_CS_AS, SQL_Latin1_General_CP1_CI_AS, SQL_Latin1_General_CP1_CS_AS, Chinese_PRC_BIN ], default is "utf8" \(`utf8mb4` only supports versions 5.5 and 5.6\).
CharacterSetName *string `pulumi:"characterSetName"`
// The Id of cluster that can run database.
DbClusterId *string `pulumi:"dbClusterId"`
// Database description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.
DbDescription *string `pulumi:"dbDescription"`
// Name of the database requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letterand have no more than 64 characters.
DbName *string `pulumi:"dbName"`
}
type DatabaseState struct {
// Character set. The value range is limited to the following: [ utf8, gbk, latin1, utf8mb4, Chinese_PRC_CI_AS, Chinese_PRC_CS_AS, SQL_Latin1_General_CP1_CI_AS, SQL_Latin1_General_CP1_CS_AS, Chinese_PRC_BIN ], default is "utf8" \(`utf8mb4` only supports versions 5.5 and 5.6\).
CharacterSetName pulumi.StringPtrInput
// The Id of cluster that can run database.
DbClusterId pulumi.StringPtrInput
// Database description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.
DbDescription pulumi.StringPtrInput
// Name of the database requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letterand have no more than 64 characters.
DbName pulumi.StringPtrInput
}
func (DatabaseState) ElementType() reflect.Type {
return reflect.TypeOf((*databaseState)(nil)).Elem()
}
type databaseArgs struct {
// Character set. The value range is limited to the following: [ utf8, gbk, latin1, utf8mb4, Chinese_PRC_CI_AS, Chinese_PRC_CS_AS, SQL_Latin1_General_CP1_CI_AS, SQL_Latin1_General_CP1_CS_AS, Chinese_PRC_BIN ], default is "utf8" \(`utf8mb4` only supports versions 5.5 and 5.6\).
CharacterSetName *string `pulumi:"characterSetName"`
// The Id of cluster that can run database.
DbClusterId string `pulumi:"dbClusterId"`
// Database description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.
DbDescription *string `pulumi:"dbDescription"`
// Name of the database requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letterand have no more than 64 characters.
DbName string `pulumi:"dbName"`
}
// The set of arguments for constructing a Database resource.
type DatabaseArgs struct {
// Character set. The value range is limited to the following: [ utf8, gbk, latin1, utf8mb4, Chinese_PRC_CI_AS, Chinese_PRC_CS_AS, SQL_Latin1_General_CP1_CI_AS, SQL_Latin1_General_CP1_CS_AS, Chinese_PRC_BIN ], default is "utf8" \(`utf8mb4` only supports versions 5.5 and 5.6\).
CharacterSetName pulumi.StringPtrInput
// The Id of cluster that can run database.
DbClusterId pulumi.StringInput
// Database description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.
DbDescription pulumi.StringPtrInput
// Name of the database requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letterand have no more than 64 characters.
DbName pulumi.StringInput
}
func (DatabaseArgs) ElementType() reflect.Type {
return reflect.TypeOf((*databaseArgs)(nil)).Elem()
}