-
Notifications
You must be signed in to change notification settings - Fork 5
/
accountPrivilege.go
116 lines (103 loc) · 4.43 KB
/
accountPrivilege.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
// *** 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 privilege resource and used to grant several database some access privilege. A database can be granted by multiple account.
//
// > **NOTE:** Available in v1.67.0+.
type AccountPrivilege struct {
pulumi.CustomResourceState
// A specified account name.
AccountName pulumi.StringOutput `pulumi:"accountName"`
// The privilege of one account access database. Valid values: ["ReadOnly", "ReadWrite"]. Default to "ReadOnly".
AccountPrivilege pulumi.StringPtrOutput `pulumi:"accountPrivilege"`
// The Id of cluster in which account belongs.
DbClusterId pulumi.StringOutput `pulumi:"dbClusterId"`
// List of specified database name.
DbNames pulumi.StringArrayOutput `pulumi:"dbNames"`
}
// NewAccountPrivilege registers a new resource with the given unique name, arguments, and options.
func NewAccountPrivilege(ctx *pulumi.Context,
name string, args *AccountPrivilegeArgs, opts ...pulumi.ResourceOption) (*AccountPrivilege, error) {
if args == nil || args.AccountName == nil {
return nil, errors.New("missing required argument 'AccountName'")
}
if args == nil || args.DbClusterId == nil {
return nil, errors.New("missing required argument 'DbClusterId'")
}
if args == nil || args.DbNames == nil {
return nil, errors.New("missing required argument 'DbNames'")
}
if args == nil {
args = &AccountPrivilegeArgs{}
}
var resource AccountPrivilege
err := ctx.RegisterResource("alicloud:polardb/accountPrivilege:AccountPrivilege", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetAccountPrivilege gets an existing AccountPrivilege 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 GetAccountPrivilege(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *AccountPrivilegeState, opts ...pulumi.ResourceOption) (*AccountPrivilege, error) {
var resource AccountPrivilege
err := ctx.ReadResource("alicloud:polardb/accountPrivilege:AccountPrivilege", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering AccountPrivilege resources.
type accountPrivilegeState struct {
// A specified account name.
AccountName *string `pulumi:"accountName"`
// The privilege of one account access database. Valid values: ["ReadOnly", "ReadWrite"]. Default to "ReadOnly".
AccountPrivilege *string `pulumi:"accountPrivilege"`
// The Id of cluster in which account belongs.
DbClusterId *string `pulumi:"dbClusterId"`
// List of specified database name.
DbNames []string `pulumi:"dbNames"`
}
type AccountPrivilegeState struct {
// A specified account name.
AccountName pulumi.StringPtrInput
// The privilege of one account access database. Valid values: ["ReadOnly", "ReadWrite"]. Default to "ReadOnly".
AccountPrivilege pulumi.StringPtrInput
// The Id of cluster in which account belongs.
DbClusterId pulumi.StringPtrInput
// List of specified database name.
DbNames pulumi.StringArrayInput
}
func (AccountPrivilegeState) ElementType() reflect.Type {
return reflect.TypeOf((*accountPrivilegeState)(nil)).Elem()
}
type accountPrivilegeArgs struct {
// A specified account name.
AccountName string `pulumi:"accountName"`
// The privilege of one account access database. Valid values: ["ReadOnly", "ReadWrite"]. Default to "ReadOnly".
AccountPrivilege *string `pulumi:"accountPrivilege"`
// The Id of cluster in which account belongs.
DbClusterId string `pulumi:"dbClusterId"`
// List of specified database name.
DbNames []string `pulumi:"dbNames"`
}
// The set of arguments for constructing a AccountPrivilege resource.
type AccountPrivilegeArgs struct {
// A specified account name.
AccountName pulumi.StringInput
// The privilege of one account access database. Valid values: ["ReadOnly", "ReadWrite"]. Default to "ReadOnly".
AccountPrivilege pulumi.StringPtrInput
// The Id of cluster in which account belongs.
DbClusterId pulumi.StringInput
// List of specified database name.
DbNames pulumi.StringArrayInput
}
func (AccountPrivilegeArgs) ElementType() reflect.Type {
return reflect.TypeOf((*accountPrivilegeArgs)(nil)).Elem()
}