-
Notifications
You must be signed in to change notification settings - Fork 5
/
account.go
146 lines (133 loc) · 8.94 KB
/
account.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
// *** 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 account resource and used to manage databases.
//
// > **NOTE:** Available in v1.67.0+.
type Account struct {
pulumi.CustomResourceState
// Account 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.
AccountDescription pulumi.StringPtrOutput `pulumi:"accountDescription"`
// Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.
AccountName pulumi.StringOutput `pulumi:"accountName"`
// Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters.
AccountPassword pulumi.StringOutput `pulumi:"accountPassword"`
// Account type, Valid values are `Normal`, `Super`, Default to `Normal`.
AccountType pulumi.StringPtrOutput `pulumi:"accountType"`
// The Id of cluster in which account belongs.
DbClusterId pulumi.StringOutput `pulumi:"dbClusterId"`
// An KMS encrypts password used to a db account. If the `accountPassword` is filled in, this field will be ignored.
KmsEncryptedPassword pulumi.StringPtrOutput `pulumi:"kmsEncryptedPassword"`
// An KMS encryption context used to decrypt `kmsEncryptedPassword` before creating or updating a db account with `kmsEncryptedPassword`. See [Encryption Context](https://www.alibabacloud.com/help/doc-detail/42975.htm). It is valid when `kmsEncryptedPassword` is set.
KmsEncryptionContext pulumi.MapOutput `pulumi:"kmsEncryptionContext"`
}
// NewAccount registers a new resource with the given unique name, arguments, and options.
func NewAccount(ctx *pulumi.Context,
name string, args *AccountArgs, opts ...pulumi.ResourceOption) (*Account, error) {
if args == nil || args.AccountName == nil {
return nil, errors.New("missing required argument 'AccountName'")
}
if args == nil || args.AccountPassword == nil {
return nil, errors.New("missing required argument 'AccountPassword'")
}
if args == nil || args.DbClusterId == nil {
return nil, errors.New("missing required argument 'DbClusterId'")
}
if args == nil {
args = &AccountArgs{}
}
var resource Account
err := ctx.RegisterResource("alicloud:polardb/account:Account", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetAccount gets an existing Account 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 GetAccount(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *AccountState, opts ...pulumi.ResourceOption) (*Account, error) {
var resource Account
err := ctx.ReadResource("alicloud:polardb/account:Account", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Account resources.
type accountState struct {
// Account 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.
AccountDescription *string `pulumi:"accountDescription"`
// Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.
AccountName *string `pulumi:"accountName"`
// Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters.
AccountPassword *string `pulumi:"accountPassword"`
// Account type, Valid values are `Normal`, `Super`, Default to `Normal`.
AccountType *string `pulumi:"accountType"`
// The Id of cluster in which account belongs.
DbClusterId *string `pulumi:"dbClusterId"`
// An KMS encrypts password used to a db account. If the `accountPassword` is filled in, this field will be ignored.
KmsEncryptedPassword *string `pulumi:"kmsEncryptedPassword"`
// An KMS encryption context used to decrypt `kmsEncryptedPassword` before creating or updating a db account with `kmsEncryptedPassword`. See [Encryption Context](https://www.alibabacloud.com/help/doc-detail/42975.htm). It is valid when `kmsEncryptedPassword` is set.
KmsEncryptionContext map[string]interface{} `pulumi:"kmsEncryptionContext"`
}
type AccountState struct {
// Account 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.
AccountDescription pulumi.StringPtrInput
// Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.
AccountName pulumi.StringPtrInput
// Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters.
AccountPassword pulumi.StringPtrInput
// Account type, Valid values are `Normal`, `Super`, Default to `Normal`.
AccountType pulumi.StringPtrInput
// The Id of cluster in which account belongs.
DbClusterId pulumi.StringPtrInput
// An KMS encrypts password used to a db account. If the `accountPassword` is filled in, this field will be ignored.
KmsEncryptedPassword pulumi.StringPtrInput
// An KMS encryption context used to decrypt `kmsEncryptedPassword` before creating or updating a db account with `kmsEncryptedPassword`. See [Encryption Context](https://www.alibabacloud.com/help/doc-detail/42975.htm). It is valid when `kmsEncryptedPassword` is set.
KmsEncryptionContext pulumi.MapInput
}
func (AccountState) ElementType() reflect.Type {
return reflect.TypeOf((*accountState)(nil)).Elem()
}
type accountArgs struct {
// Account 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.
AccountDescription *string `pulumi:"accountDescription"`
// Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.
AccountName string `pulumi:"accountName"`
// Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters.
AccountPassword string `pulumi:"accountPassword"`
// Account type, Valid values are `Normal`, `Super`, Default to `Normal`.
AccountType *string `pulumi:"accountType"`
// The Id of cluster in which account belongs.
DbClusterId string `pulumi:"dbClusterId"`
// An KMS encrypts password used to a db account. If the `accountPassword` is filled in, this field will be ignored.
KmsEncryptedPassword *string `pulumi:"kmsEncryptedPassword"`
// An KMS encryption context used to decrypt `kmsEncryptedPassword` before creating or updating a db account with `kmsEncryptedPassword`. See [Encryption Context](https://www.alibabacloud.com/help/doc-detail/42975.htm). It is valid when `kmsEncryptedPassword` is set.
KmsEncryptionContext map[string]interface{} `pulumi:"kmsEncryptionContext"`
}
// The set of arguments for constructing a Account resource.
type AccountArgs struct {
// Account 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.
AccountDescription pulumi.StringPtrInput
// Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.
AccountName pulumi.StringInput
// Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters.
AccountPassword pulumi.StringInput
// Account type, Valid values are `Normal`, `Super`, Default to `Normal`.
AccountType pulumi.StringPtrInput
// The Id of cluster in which account belongs.
DbClusterId pulumi.StringInput
// An KMS encrypts password used to a db account. If the `accountPassword` is filled in, this field will be ignored.
KmsEncryptedPassword pulumi.StringPtrInput
// An KMS encryption context used to decrypt `kmsEncryptedPassword` before creating or updating a db account with `kmsEncryptedPassword`. See [Encryption Context](https://www.alibabacloud.com/help/doc-detail/42975.htm). It is valid when `kmsEncryptedPassword` is set.
KmsEncryptionContext pulumi.MapInput
}
func (AccountArgs) ElementType() reflect.Type {
return reflect.TypeOf((*accountArgs)(nil)).Elem()
}