/
user.go
204 lines (171 loc) · 9.62 KB
/
user.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
// Code generated by the Pulumi SDK Generator DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package v1beta
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-google-native/sdk/go/google/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Creates a new User in a given project, location, and cluster.
// Auto-naming is currently not supported for this resource.
type User struct {
pulumi.CustomResourceState
ClusterId pulumi.StringOutput `pulumi:"clusterId"`
// Optional. List of database roles this user has. The database role strings are subject to the PostgreSQL naming conventions.
DatabaseRoles pulumi.StringArrayOutput `pulumi:"databaseRoles"`
Location pulumi.StringOutput `pulumi:"location"`
// Name of the resource in the form of projects/{project}/locations/{location}/cluster/{cluster}/users/{user}.
Name pulumi.StringOutput `pulumi:"name"`
// Input only. Password for the user.
Password pulumi.StringOutput `pulumi:"password"`
Project pulumi.StringOutput `pulumi:"project"`
// Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
RequestId pulumi.StringPtrOutput `pulumi:"requestId"`
// Required. ID of the requesting object.
UserId pulumi.StringOutput `pulumi:"userId"`
// Optional. Type of this user.
UserType pulumi.StringOutput `pulumi:"userType"`
}
// NewUser registers a new resource with the given unique name, arguments, and options.
func NewUser(ctx *pulumi.Context,
name string, args *UserArgs, opts ...pulumi.ResourceOption) (*User, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ClusterId == nil {
return nil, errors.New("invalid value for required argument 'ClusterId'")
}
if args.UserId == nil {
return nil, errors.New("invalid value for required argument 'UserId'")
}
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
"clusterId",
"location",
"project",
"userId",
})
opts = append(opts, replaceOnChanges)
opts = internal.PkgResourceDefaultOpts(opts)
var resource User
err := ctx.RegisterResource("google-native:alloydb/v1beta:User", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetUser gets an existing User 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 GetUser(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *UserState, opts ...pulumi.ResourceOption) (*User, error) {
var resource User
err := ctx.ReadResource("google-native:alloydb/v1beta:User", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering User resources.
type userState struct {
}
type UserState struct {
}
func (UserState) ElementType() reflect.Type {
return reflect.TypeOf((*userState)(nil)).Elem()
}
type userArgs struct {
ClusterId string `pulumi:"clusterId"`
// Optional. List of database roles this user has. The database role strings are subject to the PostgreSQL naming conventions.
DatabaseRoles []string `pulumi:"databaseRoles"`
Location *string `pulumi:"location"`
// Input only. Password for the user.
Password *string `pulumi:"password"`
Project *string `pulumi:"project"`
// Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
RequestId *string `pulumi:"requestId"`
// Required. ID of the requesting object.
UserId string `pulumi:"userId"`
// Optional. Type of this user.
UserType *UserUserType `pulumi:"userType"`
}
// The set of arguments for constructing a User resource.
type UserArgs struct {
ClusterId pulumi.StringInput
// Optional. List of database roles this user has. The database role strings are subject to the PostgreSQL naming conventions.
DatabaseRoles pulumi.StringArrayInput
Location pulumi.StringPtrInput
// Input only. Password for the user.
Password pulumi.StringPtrInput
Project pulumi.StringPtrInput
// Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
RequestId pulumi.StringPtrInput
// Required. ID of the requesting object.
UserId pulumi.StringInput
// Optional. Type of this user.
UserType UserUserTypePtrInput
}
func (UserArgs) ElementType() reflect.Type {
return reflect.TypeOf((*userArgs)(nil)).Elem()
}
type UserInput interface {
pulumi.Input
ToUserOutput() UserOutput
ToUserOutputWithContext(ctx context.Context) UserOutput
}
func (*User) ElementType() reflect.Type {
return reflect.TypeOf((**User)(nil)).Elem()
}
func (i *User) ToUserOutput() UserOutput {
return i.ToUserOutputWithContext(context.Background())
}
func (i *User) ToUserOutputWithContext(ctx context.Context) UserOutput {
return pulumi.ToOutputWithContext(ctx, i).(UserOutput)
}
type UserOutput struct{ *pulumi.OutputState }
func (UserOutput) ElementType() reflect.Type {
return reflect.TypeOf((**User)(nil)).Elem()
}
func (o UserOutput) ToUserOutput() UserOutput {
return o
}
func (o UserOutput) ToUserOutputWithContext(ctx context.Context) UserOutput {
return o
}
func (o UserOutput) ClusterId() pulumi.StringOutput {
return o.ApplyT(func(v *User) pulumi.StringOutput { return v.ClusterId }).(pulumi.StringOutput)
}
// Optional. List of database roles this user has. The database role strings are subject to the PostgreSQL naming conventions.
func (o UserOutput) DatabaseRoles() pulumi.StringArrayOutput {
return o.ApplyT(func(v *User) pulumi.StringArrayOutput { return v.DatabaseRoles }).(pulumi.StringArrayOutput)
}
func (o UserOutput) Location() pulumi.StringOutput {
return o.ApplyT(func(v *User) pulumi.StringOutput { return v.Location }).(pulumi.StringOutput)
}
// Name of the resource in the form of projects/{project}/locations/{location}/cluster/{cluster}/users/{user}.
func (o UserOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *User) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// Input only. Password for the user.
func (o UserOutput) Password() pulumi.StringOutput {
return o.ApplyT(func(v *User) pulumi.StringOutput { return v.Password }).(pulumi.StringOutput)
}
func (o UserOutput) Project() pulumi.StringOutput {
return o.ApplyT(func(v *User) pulumi.StringOutput { return v.Project }).(pulumi.StringOutput)
}
// Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
func (o UserOutput) RequestId() pulumi.StringPtrOutput {
return o.ApplyT(func(v *User) pulumi.StringPtrOutput { return v.RequestId }).(pulumi.StringPtrOutput)
}
// Required. ID of the requesting object.
func (o UserOutput) UserId() pulumi.StringOutput {
return o.ApplyT(func(v *User) pulumi.StringOutput { return v.UserId }).(pulumi.StringOutput)
}
// Optional. Type of this user.
func (o UserOutput) UserType() pulumi.StringOutput {
return o.ApplyT(func(v *User) pulumi.StringOutput { return v.UserType }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*UserInput)(nil)).Elem(), &User{})
pulumi.RegisterOutputType(UserOutput{})
}