/
privateConnection.go
454 lines (397 loc) · 18.8 KB
/
privateConnection.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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package databasemigrationservice
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// The PrivateConnection resource is used to establish private connectivity between Database Migration Service and a customer's network.
//
// To get more information about PrivateConnection, see:
//
// * [API documentation](https://cloud.google.com/database-migration/docs/reference/rest/v1/projects.locations.privateConnections)
// * How-to Guides
// - [Official Documentation](https://cloud.google.com/database-migration/docs/oracle-to-postgresql/create-private-connectivity-configuration)
//
// ## Example Usage
//
// ### Database Migration Service Private Connection
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
// "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/databasemigrationservice"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _default, err := compute.LookupNetwork(ctx, &compute.LookupNetworkArgs{
// Name: "my-network",
// }, nil)
// if err != nil {
// return err
// }
// _, err = databasemigrationservice.NewPrivateConnection(ctx, "default", &databasemigrationservice.PrivateConnectionArgs{
// DisplayName: pulumi.String("dbms_pc"),
// Location: pulumi.String("us-central1"),
// PrivateConnectionId: pulumi.String("my-connection"),
// Labels: pulumi.StringMap{
// "key": pulumi.String("value"),
// },
// VpcPeeringConfig: &databasemigrationservice.PrivateConnectionVpcPeeringConfigArgs{
// VpcName: pulumi.String(_default.Id),
// Subnet: pulumi.String("10.0.0.0/29"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// PrivateConnection can be imported using any of these accepted formats:
//
// * `projects/{{project}}/locations/{{location}}/privateConnections/{{private_connection_id}}`
//
// * `{{project}}/{{location}}/{{private_connection_id}}`
//
// * `{{location}}/{{private_connection_id}}`
//
// When using the `pulumi import` command, PrivateConnection can be imported using one of the formats above. For example:
//
// ```sh
// $ pulumi import gcp:databasemigrationservice/privateConnection:PrivateConnection default projects/{{project}}/locations/{{location}}/privateConnections/{{private_connection_id}}
// ```
//
// ```sh
// $ pulumi import gcp:databasemigrationservice/privateConnection:PrivateConnection default {{project}}/{{location}}/{{private_connection_id}}
// ```
//
// ```sh
// $ pulumi import gcp:databasemigrationservice/privateConnection:PrivateConnection default {{location}}/{{private_connection_id}}
// ```
type PrivateConnection struct {
pulumi.CustomResourceState
// Display name.
DisplayName pulumi.StringOutput `pulumi:"displayName"`
// All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
EffectiveLabels pulumi.StringMapOutput `pulumi:"effectiveLabels"`
// The PrivateConnection error in case of failure.
// Structure is documented below.
Errors PrivateConnectionErrorArrayOutput `pulumi:"errors"`
// Labels. **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. Please
// refer to the field 'effective_labels' for all of the labels present on the resource.
Labels pulumi.StringMapOutput `pulumi:"labels"`
// The name of the location this private connection is located in.
Location pulumi.StringOutput `pulumi:"location"`
// The resource's name.
Name pulumi.StringOutput `pulumi:"name"`
// The private connectivity identifier.
PrivateConnectionId pulumi.StringOutput `pulumi:"privateConnectionId"`
Project pulumi.StringOutput `pulumi:"project"`
// The combination of labels configured directly on the resource
// and default labels configured on the provider.
PulumiLabels pulumi.StringMapOutput `pulumi:"pulumiLabels"`
// State of the PrivateConnection.
State pulumi.StringOutput `pulumi:"state"`
// The VPC Peering configuration is used to create VPC peering
// between databasemigrationservice and the consumer's VPC.
// Structure is documented below.
VpcPeeringConfig PrivateConnectionVpcPeeringConfigOutput `pulumi:"vpcPeeringConfig"`
}
// NewPrivateConnection registers a new resource with the given unique name, arguments, and options.
func NewPrivateConnection(ctx *pulumi.Context,
name string, args *PrivateConnectionArgs, opts ...pulumi.ResourceOption) (*PrivateConnection, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Location == nil {
return nil, errors.New("invalid value for required argument 'Location'")
}
if args.PrivateConnectionId == nil {
return nil, errors.New("invalid value for required argument 'PrivateConnectionId'")
}
if args.VpcPeeringConfig == nil {
return nil, errors.New("invalid value for required argument 'VpcPeeringConfig'")
}
secrets := pulumi.AdditionalSecretOutputs([]string{
"effectiveLabels",
"pulumiLabels",
})
opts = append(opts, secrets)
opts = internal.PkgResourceDefaultOpts(opts)
var resource PrivateConnection
err := ctx.RegisterResource("gcp:databasemigrationservice/privateConnection:PrivateConnection", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetPrivateConnection gets an existing PrivateConnection 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 GetPrivateConnection(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *PrivateConnectionState, opts ...pulumi.ResourceOption) (*PrivateConnection, error) {
var resource PrivateConnection
err := ctx.ReadResource("gcp:databasemigrationservice/privateConnection:PrivateConnection", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering PrivateConnection resources.
type privateConnectionState struct {
// Display name.
DisplayName *string `pulumi:"displayName"`
// All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
EffectiveLabels map[string]string `pulumi:"effectiveLabels"`
// The PrivateConnection error in case of failure.
// Structure is documented below.
Errors []PrivateConnectionError `pulumi:"errors"`
// Labels. **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. Please
// refer to the field 'effective_labels' for all of the labels present on the resource.
Labels map[string]string `pulumi:"labels"`
// The name of the location this private connection is located in.
Location *string `pulumi:"location"`
// The resource's name.
Name *string `pulumi:"name"`
// The private connectivity identifier.
PrivateConnectionId *string `pulumi:"privateConnectionId"`
Project *string `pulumi:"project"`
// The combination of labels configured directly on the resource
// and default labels configured on the provider.
PulumiLabels map[string]string `pulumi:"pulumiLabels"`
// State of the PrivateConnection.
State *string `pulumi:"state"`
// The VPC Peering configuration is used to create VPC peering
// between databasemigrationservice and the consumer's VPC.
// Structure is documented below.
VpcPeeringConfig *PrivateConnectionVpcPeeringConfig `pulumi:"vpcPeeringConfig"`
}
type PrivateConnectionState struct {
// Display name.
DisplayName pulumi.StringPtrInput
// All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
EffectiveLabels pulumi.StringMapInput
// The PrivateConnection error in case of failure.
// Structure is documented below.
Errors PrivateConnectionErrorArrayInput
// Labels. **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. Please
// refer to the field 'effective_labels' for all of the labels present on the resource.
Labels pulumi.StringMapInput
// The name of the location this private connection is located in.
Location pulumi.StringPtrInput
// The resource's name.
Name pulumi.StringPtrInput
// The private connectivity identifier.
PrivateConnectionId pulumi.StringPtrInput
Project pulumi.StringPtrInput
// The combination of labels configured directly on the resource
// and default labels configured on the provider.
PulumiLabels pulumi.StringMapInput
// State of the PrivateConnection.
State pulumi.StringPtrInput
// The VPC Peering configuration is used to create VPC peering
// between databasemigrationservice and the consumer's VPC.
// Structure is documented below.
VpcPeeringConfig PrivateConnectionVpcPeeringConfigPtrInput
}
func (PrivateConnectionState) ElementType() reflect.Type {
return reflect.TypeOf((*privateConnectionState)(nil)).Elem()
}
type privateConnectionArgs struct {
// Display name.
DisplayName *string `pulumi:"displayName"`
// Labels. **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. Please
// refer to the field 'effective_labels' for all of the labels present on the resource.
Labels map[string]string `pulumi:"labels"`
// The name of the location this private connection is located in.
Location string `pulumi:"location"`
// The private connectivity identifier.
PrivateConnectionId string `pulumi:"privateConnectionId"`
Project *string `pulumi:"project"`
// The VPC Peering configuration is used to create VPC peering
// between databasemigrationservice and the consumer's VPC.
// Structure is documented below.
VpcPeeringConfig PrivateConnectionVpcPeeringConfig `pulumi:"vpcPeeringConfig"`
}
// The set of arguments for constructing a PrivateConnection resource.
type PrivateConnectionArgs struct {
// Display name.
DisplayName pulumi.StringPtrInput
// Labels. **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. Please
// refer to the field 'effective_labels' for all of the labels present on the resource.
Labels pulumi.StringMapInput
// The name of the location this private connection is located in.
Location pulumi.StringInput
// The private connectivity identifier.
PrivateConnectionId pulumi.StringInput
Project pulumi.StringPtrInput
// The VPC Peering configuration is used to create VPC peering
// between databasemigrationservice and the consumer's VPC.
// Structure is documented below.
VpcPeeringConfig PrivateConnectionVpcPeeringConfigInput
}
func (PrivateConnectionArgs) ElementType() reflect.Type {
return reflect.TypeOf((*privateConnectionArgs)(nil)).Elem()
}
type PrivateConnectionInput interface {
pulumi.Input
ToPrivateConnectionOutput() PrivateConnectionOutput
ToPrivateConnectionOutputWithContext(ctx context.Context) PrivateConnectionOutput
}
func (*PrivateConnection) ElementType() reflect.Type {
return reflect.TypeOf((**PrivateConnection)(nil)).Elem()
}
func (i *PrivateConnection) ToPrivateConnectionOutput() PrivateConnectionOutput {
return i.ToPrivateConnectionOutputWithContext(context.Background())
}
func (i *PrivateConnection) ToPrivateConnectionOutputWithContext(ctx context.Context) PrivateConnectionOutput {
return pulumi.ToOutputWithContext(ctx, i).(PrivateConnectionOutput)
}
// PrivateConnectionArrayInput is an input type that accepts PrivateConnectionArray and PrivateConnectionArrayOutput values.
// You can construct a concrete instance of `PrivateConnectionArrayInput` via:
//
// PrivateConnectionArray{ PrivateConnectionArgs{...} }
type PrivateConnectionArrayInput interface {
pulumi.Input
ToPrivateConnectionArrayOutput() PrivateConnectionArrayOutput
ToPrivateConnectionArrayOutputWithContext(context.Context) PrivateConnectionArrayOutput
}
type PrivateConnectionArray []PrivateConnectionInput
func (PrivateConnectionArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*PrivateConnection)(nil)).Elem()
}
func (i PrivateConnectionArray) ToPrivateConnectionArrayOutput() PrivateConnectionArrayOutput {
return i.ToPrivateConnectionArrayOutputWithContext(context.Background())
}
func (i PrivateConnectionArray) ToPrivateConnectionArrayOutputWithContext(ctx context.Context) PrivateConnectionArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(PrivateConnectionArrayOutput)
}
// PrivateConnectionMapInput is an input type that accepts PrivateConnectionMap and PrivateConnectionMapOutput values.
// You can construct a concrete instance of `PrivateConnectionMapInput` via:
//
// PrivateConnectionMap{ "key": PrivateConnectionArgs{...} }
type PrivateConnectionMapInput interface {
pulumi.Input
ToPrivateConnectionMapOutput() PrivateConnectionMapOutput
ToPrivateConnectionMapOutputWithContext(context.Context) PrivateConnectionMapOutput
}
type PrivateConnectionMap map[string]PrivateConnectionInput
func (PrivateConnectionMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*PrivateConnection)(nil)).Elem()
}
func (i PrivateConnectionMap) ToPrivateConnectionMapOutput() PrivateConnectionMapOutput {
return i.ToPrivateConnectionMapOutputWithContext(context.Background())
}
func (i PrivateConnectionMap) ToPrivateConnectionMapOutputWithContext(ctx context.Context) PrivateConnectionMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(PrivateConnectionMapOutput)
}
type PrivateConnectionOutput struct{ *pulumi.OutputState }
func (PrivateConnectionOutput) ElementType() reflect.Type {
return reflect.TypeOf((**PrivateConnection)(nil)).Elem()
}
func (o PrivateConnectionOutput) ToPrivateConnectionOutput() PrivateConnectionOutput {
return o
}
func (o PrivateConnectionOutput) ToPrivateConnectionOutputWithContext(ctx context.Context) PrivateConnectionOutput {
return o
}
// Display name.
func (o PrivateConnectionOutput) DisplayName() pulumi.StringOutput {
return o.ApplyT(func(v *PrivateConnection) pulumi.StringOutput { return v.DisplayName }).(pulumi.StringOutput)
}
// All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
func (o PrivateConnectionOutput) EffectiveLabels() pulumi.StringMapOutput {
return o.ApplyT(func(v *PrivateConnection) pulumi.StringMapOutput { return v.EffectiveLabels }).(pulumi.StringMapOutput)
}
// The PrivateConnection error in case of failure.
// Structure is documented below.
func (o PrivateConnectionOutput) Errors() PrivateConnectionErrorArrayOutput {
return o.ApplyT(func(v *PrivateConnection) PrivateConnectionErrorArrayOutput { return v.Errors }).(PrivateConnectionErrorArrayOutput)
}
// Labels. **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. Please
// refer to the field 'effective_labels' for all of the labels present on the resource.
func (o PrivateConnectionOutput) Labels() pulumi.StringMapOutput {
return o.ApplyT(func(v *PrivateConnection) pulumi.StringMapOutput { return v.Labels }).(pulumi.StringMapOutput)
}
// The name of the location this private connection is located in.
func (o PrivateConnectionOutput) Location() pulumi.StringOutput {
return o.ApplyT(func(v *PrivateConnection) pulumi.StringOutput { return v.Location }).(pulumi.StringOutput)
}
// The resource's name.
func (o PrivateConnectionOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *PrivateConnection) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The private connectivity identifier.
func (o PrivateConnectionOutput) PrivateConnectionId() pulumi.StringOutput {
return o.ApplyT(func(v *PrivateConnection) pulumi.StringOutput { return v.PrivateConnectionId }).(pulumi.StringOutput)
}
func (o PrivateConnectionOutput) Project() pulumi.StringOutput {
return o.ApplyT(func(v *PrivateConnection) pulumi.StringOutput { return v.Project }).(pulumi.StringOutput)
}
// The combination of labels configured directly on the resource
// and default labels configured on the provider.
func (o PrivateConnectionOutput) PulumiLabels() pulumi.StringMapOutput {
return o.ApplyT(func(v *PrivateConnection) pulumi.StringMapOutput { return v.PulumiLabels }).(pulumi.StringMapOutput)
}
// State of the PrivateConnection.
func (o PrivateConnectionOutput) State() pulumi.StringOutput {
return o.ApplyT(func(v *PrivateConnection) pulumi.StringOutput { return v.State }).(pulumi.StringOutput)
}
// The VPC Peering configuration is used to create VPC peering
// between databasemigrationservice and the consumer's VPC.
// Structure is documented below.
func (o PrivateConnectionOutput) VpcPeeringConfig() PrivateConnectionVpcPeeringConfigOutput {
return o.ApplyT(func(v *PrivateConnection) PrivateConnectionVpcPeeringConfigOutput { return v.VpcPeeringConfig }).(PrivateConnectionVpcPeeringConfigOutput)
}
type PrivateConnectionArrayOutput struct{ *pulumi.OutputState }
func (PrivateConnectionArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*PrivateConnection)(nil)).Elem()
}
func (o PrivateConnectionArrayOutput) ToPrivateConnectionArrayOutput() PrivateConnectionArrayOutput {
return o
}
func (o PrivateConnectionArrayOutput) ToPrivateConnectionArrayOutputWithContext(ctx context.Context) PrivateConnectionArrayOutput {
return o
}
func (o PrivateConnectionArrayOutput) Index(i pulumi.IntInput) PrivateConnectionOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *PrivateConnection {
return vs[0].([]*PrivateConnection)[vs[1].(int)]
}).(PrivateConnectionOutput)
}
type PrivateConnectionMapOutput struct{ *pulumi.OutputState }
func (PrivateConnectionMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*PrivateConnection)(nil)).Elem()
}
func (o PrivateConnectionMapOutput) ToPrivateConnectionMapOutput() PrivateConnectionMapOutput {
return o
}
func (o PrivateConnectionMapOutput) ToPrivateConnectionMapOutputWithContext(ctx context.Context) PrivateConnectionMapOutput {
return o
}
func (o PrivateConnectionMapOutput) MapIndex(k pulumi.StringInput) PrivateConnectionOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *PrivateConnection {
return vs[0].(map[string]*PrivateConnection)[vs[1].(string)]
}).(PrivateConnectionOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*PrivateConnectionInput)(nil)).Elem(), &PrivateConnection{})
pulumi.RegisterInputType(reflect.TypeOf((*PrivateConnectionArrayInput)(nil)).Elem(), PrivateConnectionArray{})
pulumi.RegisterInputType(reflect.TypeOf((*PrivateConnectionMapInput)(nil)).Elem(), PrivateConnectionMap{})
pulumi.RegisterOutputType(PrivateConnectionOutput{})
pulumi.RegisterOutputType(PrivateConnectionArrayOutput{})
pulumi.RegisterOutputType(PrivateConnectionMapOutput{})
}