/
database.go
214 lines (181 loc) · 7.92 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
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
205
206
207
208
209
210
211
212
213
214
// 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 v1beta4
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-google-native/sdk/go/google/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Inserts a resource containing information about a database inside a Cloud SQL instance. **Note:** You can't modify the default character set and collation.
type Database struct {
pulumi.CustomResourceState
// The Cloud SQL charset value.
Charset pulumi.StringOutput `pulumi:"charset"`
// The Cloud SQL collation value.
Collation pulumi.StringOutput `pulumi:"collation"`
// This field is deprecated and will be removed from a future version of the API.
//
// Deprecated: This field is deprecated and will be removed from a future version of the API.
Etag pulumi.StringOutput `pulumi:"etag"`
Instance pulumi.StringOutput `pulumi:"instance"`
// This is always `sql#database`.
Kind pulumi.StringOutput `pulumi:"kind"`
// The name of the database in the Cloud SQL instance. This does not include the project ID or instance name.
Name pulumi.StringOutput `pulumi:"name"`
Project pulumi.StringOutput `pulumi:"project"`
// The URI of this resource.
SelfLink pulumi.StringOutput `pulumi:"selfLink"`
SqlserverDatabaseDetails SqlServerDatabaseDetailsResponseOutput `pulumi:"sqlserverDatabaseDetails"`
}
// 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 {
return nil, errors.New("missing one or more required arguments")
}
if args.Instance == nil {
return nil, errors.New("invalid value for required argument 'Instance'")
}
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
"instance",
"project",
})
opts = append(opts, replaceOnChanges)
opts = internal.PkgResourceDefaultOpts(opts)
var resource Database
err := ctx.RegisterResource("google-native:sqladmin/v1beta4: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("google-native:sqladmin/v1beta4: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 {
}
type DatabaseState struct {
}
func (DatabaseState) ElementType() reflect.Type {
return reflect.TypeOf((*databaseState)(nil)).Elem()
}
type databaseArgs struct {
// The Cloud SQL charset value.
Charset *string `pulumi:"charset"`
// The Cloud SQL collation value.
Collation *string `pulumi:"collation"`
// This field is deprecated and will be removed from a future version of the API.
//
// Deprecated: This field is deprecated and will be removed from a future version of the API.
Etag *string `pulumi:"etag"`
// The name of the Cloud SQL instance. This does not include the project ID.
Instance string `pulumi:"instance"`
// This is always `sql#database`.
Kind *string `pulumi:"kind"`
// The name of the database in the Cloud SQL instance. This does not include the project ID or instance name.
Name *string `pulumi:"name"`
// The project ID of the project containing the Cloud SQL database. The Google apps domain is prefixed if applicable.
Project *string `pulumi:"project"`
// The URI of this resource.
SelfLink *string `pulumi:"selfLink"`
SqlserverDatabaseDetails *SqlServerDatabaseDetails `pulumi:"sqlserverDatabaseDetails"`
}
// The set of arguments for constructing a Database resource.
type DatabaseArgs struct {
// The Cloud SQL charset value.
Charset pulumi.StringPtrInput
// The Cloud SQL collation value.
Collation pulumi.StringPtrInput
// This field is deprecated and will be removed from a future version of the API.
//
// Deprecated: This field is deprecated and will be removed from a future version of the API.
Etag pulumi.StringPtrInput
// The name of the Cloud SQL instance. This does not include the project ID.
Instance pulumi.StringInput
// This is always `sql#database`.
Kind pulumi.StringPtrInput
// The name of the database in the Cloud SQL instance. This does not include the project ID or instance name.
Name pulumi.StringPtrInput
// The project ID of the project containing the Cloud SQL database. The Google apps domain is prefixed if applicable.
Project pulumi.StringPtrInput
// The URI of this resource.
SelfLink pulumi.StringPtrInput
SqlserverDatabaseDetails SqlServerDatabaseDetailsPtrInput
}
func (DatabaseArgs) ElementType() reflect.Type {
return reflect.TypeOf((*databaseArgs)(nil)).Elem()
}
type DatabaseInput interface {
pulumi.Input
ToDatabaseOutput() DatabaseOutput
ToDatabaseOutputWithContext(ctx context.Context) DatabaseOutput
}
func (*Database) ElementType() reflect.Type {
return reflect.TypeOf((**Database)(nil)).Elem()
}
func (i *Database) ToDatabaseOutput() DatabaseOutput {
return i.ToDatabaseOutputWithContext(context.Background())
}
func (i *Database) ToDatabaseOutputWithContext(ctx context.Context) DatabaseOutput {
return pulumi.ToOutputWithContext(ctx, i).(DatabaseOutput)
}
type DatabaseOutput struct{ *pulumi.OutputState }
func (DatabaseOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Database)(nil)).Elem()
}
func (o DatabaseOutput) ToDatabaseOutput() DatabaseOutput {
return o
}
func (o DatabaseOutput) ToDatabaseOutputWithContext(ctx context.Context) DatabaseOutput {
return o
}
// The Cloud SQL charset value.
func (o DatabaseOutput) Charset() pulumi.StringOutput {
return o.ApplyT(func(v *Database) pulumi.StringOutput { return v.Charset }).(pulumi.StringOutput)
}
// The Cloud SQL collation value.
func (o DatabaseOutput) Collation() pulumi.StringOutput {
return o.ApplyT(func(v *Database) pulumi.StringOutput { return v.Collation }).(pulumi.StringOutput)
}
// This field is deprecated and will be removed from a future version of the API.
//
// Deprecated: This field is deprecated and will be removed from a future version of the API.
func (o DatabaseOutput) Etag() pulumi.StringOutput {
return o.ApplyT(func(v *Database) pulumi.StringOutput { return v.Etag }).(pulumi.StringOutput)
}
func (o DatabaseOutput) Instance() pulumi.StringOutput {
return o.ApplyT(func(v *Database) pulumi.StringOutput { return v.Instance }).(pulumi.StringOutput)
}
// This is always `sql#database`.
func (o DatabaseOutput) Kind() pulumi.StringOutput {
return o.ApplyT(func(v *Database) pulumi.StringOutput { return v.Kind }).(pulumi.StringOutput)
}
// The name of the database in the Cloud SQL instance. This does not include the project ID or instance name.
func (o DatabaseOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Database) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
func (o DatabaseOutput) Project() pulumi.StringOutput {
return o.ApplyT(func(v *Database) pulumi.StringOutput { return v.Project }).(pulumi.StringOutput)
}
// The URI of this resource.
func (o DatabaseOutput) SelfLink() pulumi.StringOutput {
return o.ApplyT(func(v *Database) pulumi.StringOutput { return v.SelfLink }).(pulumi.StringOutput)
}
func (o DatabaseOutput) SqlserverDatabaseDetails() SqlServerDatabaseDetailsResponseOutput {
return o.ApplyT(func(v *Database) SqlServerDatabaseDetailsResponseOutput { return v.SqlserverDatabaseDetails }).(SqlServerDatabaseDetailsResponseOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*DatabaseInput)(nil)).Elem(), &Database{})
pulumi.RegisterOutputType(DatabaseOutput{})
}