/
endpointAttachment.go
424 lines (371 loc) · 15.9 KB
/
endpointAttachment.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
// 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 apigee
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Apigee Endpoint Attachment.
//
// To get more information about EndpointAttachment, see:
//
// * [API documentation](https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.endpointAttachments/create)
// * How-to Guides
// - [Creating an environment](https://cloud.google.com/apigee/docs/api-platform/get-started/create-environment)
//
// ## Example Usage
//
// ### Apigee Endpoint Attachment Basic
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/apigee"
// "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
// "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
// "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/servicenetworking"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// current, err := organizations.GetClientConfig(ctx, nil, nil)
// if err != nil {
// return err
// }
// apigeeNetwork, err := compute.NewNetwork(ctx, "apigee_network", &compute.NetworkArgs{
// Name: pulumi.String("apigee-network"),
// })
// if err != nil {
// return err
// }
// apigeeRange, err := compute.NewGlobalAddress(ctx, "apigee_range", &compute.GlobalAddressArgs{
// Name: pulumi.String("apigee-range"),
// Purpose: pulumi.String("VPC_PEERING"),
// AddressType: pulumi.String("INTERNAL"),
// PrefixLength: pulumi.Int(16),
// Network: apigeeNetwork.ID(),
// })
// if err != nil {
// return err
// }
// _, err = servicenetworking.NewConnection(ctx, "apigee_vpc_connection", &servicenetworking.ConnectionArgs{
// Network: apigeeNetwork.ID(),
// Service: pulumi.String("servicenetworking.googleapis.com"),
// ReservedPeeringRanges: pulumi.StringArray{
// apigeeRange.Name,
// },
// })
// if err != nil {
// return err
// }
// apigeeOrg, err := apigee.NewOrganization(ctx, "apigee_org", &apigee.OrganizationArgs{
// AnalyticsRegion: pulumi.String("us-central1"),
// ProjectId: pulumi.String(current.Project),
// AuthorizedNetwork: apigeeNetwork.ID(),
// })
// if err != nil {
// return err
// }
// _, err = apigee.NewEndpointAttachment(ctx, "apigee_endpoint_attachment", &apigee.EndpointAttachmentArgs{
// OrgId: apigeeOrg.ID(),
// EndpointAttachmentId: pulumi.String("test1"),
// Location: pulumi.String("{google_compute_service_attachment location}"),
// ServiceAttachment: pulumi.String("{google_compute_service_attachment id}"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// EndpointAttachment can be imported using any of these accepted formats:
//
// * `{{org_id}}/endpointAttachments/{{endpoint_attachment_id}}`
//
// * `{{org_id}}/{{endpoint_attachment_id}}`
//
// When using the `pulumi import` command, EndpointAttachment can be imported using one of the formats above. For example:
//
// ```sh
// $ pulumi import gcp:apigee/endpointAttachment:EndpointAttachment default {{org_id}}/endpointAttachments/{{endpoint_attachment_id}}
// ```
//
// ```sh
// $ pulumi import gcp:apigee/endpointAttachment:EndpointAttachment default {{org_id}}/{{endpoint_attachment_id}}
// ```
type EndpointAttachment struct {
pulumi.CustomResourceState
// State of the endpoint attachment connection to the service attachment.
ConnectionState pulumi.StringOutput `pulumi:"connectionState"`
// ID of the endpoint attachment.
//
// ***
EndpointAttachmentId pulumi.StringOutput `pulumi:"endpointAttachmentId"`
// Host that can be used in either HTTP Target Endpoint directly, or as the host in Target Server.
Host pulumi.StringOutput `pulumi:"host"`
// Location of the endpoint attachment.
Location pulumi.StringOutput `pulumi:"location"`
// Name of the Endpoint Attachment in the following format:
// organizations/{organization}/endpointAttachments/{endpointAttachment}.
Name pulumi.StringOutput `pulumi:"name"`
// The Apigee Organization associated with the Apigee instance,
// in the format `organizations/{{org_name}}`.
OrgId pulumi.StringOutput `pulumi:"orgId"`
// Format: projects/*/regions/*/serviceAttachments/*
ServiceAttachment pulumi.StringOutput `pulumi:"serviceAttachment"`
}
// NewEndpointAttachment registers a new resource with the given unique name, arguments, and options.
func NewEndpointAttachment(ctx *pulumi.Context,
name string, args *EndpointAttachmentArgs, opts ...pulumi.ResourceOption) (*EndpointAttachment, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.EndpointAttachmentId == nil {
return nil, errors.New("invalid value for required argument 'EndpointAttachmentId'")
}
if args.Location == nil {
return nil, errors.New("invalid value for required argument 'Location'")
}
if args.OrgId == nil {
return nil, errors.New("invalid value for required argument 'OrgId'")
}
if args.ServiceAttachment == nil {
return nil, errors.New("invalid value for required argument 'ServiceAttachment'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource EndpointAttachment
err := ctx.RegisterResource("gcp:apigee/endpointAttachment:EndpointAttachment", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetEndpointAttachment gets an existing EndpointAttachment 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 GetEndpointAttachment(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *EndpointAttachmentState, opts ...pulumi.ResourceOption) (*EndpointAttachment, error) {
var resource EndpointAttachment
err := ctx.ReadResource("gcp:apigee/endpointAttachment:EndpointAttachment", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering EndpointAttachment resources.
type endpointAttachmentState struct {
// State of the endpoint attachment connection to the service attachment.
ConnectionState *string `pulumi:"connectionState"`
// ID of the endpoint attachment.
//
// ***
EndpointAttachmentId *string `pulumi:"endpointAttachmentId"`
// Host that can be used in either HTTP Target Endpoint directly, or as the host in Target Server.
Host *string `pulumi:"host"`
// Location of the endpoint attachment.
Location *string `pulumi:"location"`
// Name of the Endpoint Attachment in the following format:
// organizations/{organization}/endpointAttachments/{endpointAttachment}.
Name *string `pulumi:"name"`
// The Apigee Organization associated with the Apigee instance,
// in the format `organizations/{{org_name}}`.
OrgId *string `pulumi:"orgId"`
// Format: projects/*/regions/*/serviceAttachments/*
ServiceAttachment *string `pulumi:"serviceAttachment"`
}
type EndpointAttachmentState struct {
// State of the endpoint attachment connection to the service attachment.
ConnectionState pulumi.StringPtrInput
// ID of the endpoint attachment.
//
// ***
EndpointAttachmentId pulumi.StringPtrInput
// Host that can be used in either HTTP Target Endpoint directly, or as the host in Target Server.
Host pulumi.StringPtrInput
// Location of the endpoint attachment.
Location pulumi.StringPtrInput
// Name of the Endpoint Attachment in the following format:
// organizations/{organization}/endpointAttachments/{endpointAttachment}.
Name pulumi.StringPtrInput
// The Apigee Organization associated with the Apigee instance,
// in the format `organizations/{{org_name}}`.
OrgId pulumi.StringPtrInput
// Format: projects/*/regions/*/serviceAttachments/*
ServiceAttachment pulumi.StringPtrInput
}
func (EndpointAttachmentState) ElementType() reflect.Type {
return reflect.TypeOf((*endpointAttachmentState)(nil)).Elem()
}
type endpointAttachmentArgs struct {
// ID of the endpoint attachment.
//
// ***
EndpointAttachmentId string `pulumi:"endpointAttachmentId"`
// Location of the endpoint attachment.
Location string `pulumi:"location"`
// The Apigee Organization associated with the Apigee instance,
// in the format `organizations/{{org_name}}`.
OrgId string `pulumi:"orgId"`
// Format: projects/*/regions/*/serviceAttachments/*
ServiceAttachment string `pulumi:"serviceAttachment"`
}
// The set of arguments for constructing a EndpointAttachment resource.
type EndpointAttachmentArgs struct {
// ID of the endpoint attachment.
//
// ***
EndpointAttachmentId pulumi.StringInput
// Location of the endpoint attachment.
Location pulumi.StringInput
// The Apigee Organization associated with the Apigee instance,
// in the format `organizations/{{org_name}}`.
OrgId pulumi.StringInput
// Format: projects/*/regions/*/serviceAttachments/*
ServiceAttachment pulumi.StringInput
}
func (EndpointAttachmentArgs) ElementType() reflect.Type {
return reflect.TypeOf((*endpointAttachmentArgs)(nil)).Elem()
}
type EndpointAttachmentInput interface {
pulumi.Input
ToEndpointAttachmentOutput() EndpointAttachmentOutput
ToEndpointAttachmentOutputWithContext(ctx context.Context) EndpointAttachmentOutput
}
func (*EndpointAttachment) ElementType() reflect.Type {
return reflect.TypeOf((**EndpointAttachment)(nil)).Elem()
}
func (i *EndpointAttachment) ToEndpointAttachmentOutput() EndpointAttachmentOutput {
return i.ToEndpointAttachmentOutputWithContext(context.Background())
}
func (i *EndpointAttachment) ToEndpointAttachmentOutputWithContext(ctx context.Context) EndpointAttachmentOutput {
return pulumi.ToOutputWithContext(ctx, i).(EndpointAttachmentOutput)
}
// EndpointAttachmentArrayInput is an input type that accepts EndpointAttachmentArray and EndpointAttachmentArrayOutput values.
// You can construct a concrete instance of `EndpointAttachmentArrayInput` via:
//
// EndpointAttachmentArray{ EndpointAttachmentArgs{...} }
type EndpointAttachmentArrayInput interface {
pulumi.Input
ToEndpointAttachmentArrayOutput() EndpointAttachmentArrayOutput
ToEndpointAttachmentArrayOutputWithContext(context.Context) EndpointAttachmentArrayOutput
}
type EndpointAttachmentArray []EndpointAttachmentInput
func (EndpointAttachmentArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*EndpointAttachment)(nil)).Elem()
}
func (i EndpointAttachmentArray) ToEndpointAttachmentArrayOutput() EndpointAttachmentArrayOutput {
return i.ToEndpointAttachmentArrayOutputWithContext(context.Background())
}
func (i EndpointAttachmentArray) ToEndpointAttachmentArrayOutputWithContext(ctx context.Context) EndpointAttachmentArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(EndpointAttachmentArrayOutput)
}
// EndpointAttachmentMapInput is an input type that accepts EndpointAttachmentMap and EndpointAttachmentMapOutput values.
// You can construct a concrete instance of `EndpointAttachmentMapInput` via:
//
// EndpointAttachmentMap{ "key": EndpointAttachmentArgs{...} }
type EndpointAttachmentMapInput interface {
pulumi.Input
ToEndpointAttachmentMapOutput() EndpointAttachmentMapOutput
ToEndpointAttachmentMapOutputWithContext(context.Context) EndpointAttachmentMapOutput
}
type EndpointAttachmentMap map[string]EndpointAttachmentInput
func (EndpointAttachmentMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*EndpointAttachment)(nil)).Elem()
}
func (i EndpointAttachmentMap) ToEndpointAttachmentMapOutput() EndpointAttachmentMapOutput {
return i.ToEndpointAttachmentMapOutputWithContext(context.Background())
}
func (i EndpointAttachmentMap) ToEndpointAttachmentMapOutputWithContext(ctx context.Context) EndpointAttachmentMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(EndpointAttachmentMapOutput)
}
type EndpointAttachmentOutput struct{ *pulumi.OutputState }
func (EndpointAttachmentOutput) ElementType() reflect.Type {
return reflect.TypeOf((**EndpointAttachment)(nil)).Elem()
}
func (o EndpointAttachmentOutput) ToEndpointAttachmentOutput() EndpointAttachmentOutput {
return o
}
func (o EndpointAttachmentOutput) ToEndpointAttachmentOutputWithContext(ctx context.Context) EndpointAttachmentOutput {
return o
}
// State of the endpoint attachment connection to the service attachment.
func (o EndpointAttachmentOutput) ConnectionState() pulumi.StringOutput {
return o.ApplyT(func(v *EndpointAttachment) pulumi.StringOutput { return v.ConnectionState }).(pulumi.StringOutput)
}
// ID of the endpoint attachment.
//
// ***
func (o EndpointAttachmentOutput) EndpointAttachmentId() pulumi.StringOutput {
return o.ApplyT(func(v *EndpointAttachment) pulumi.StringOutput { return v.EndpointAttachmentId }).(pulumi.StringOutput)
}
// Host that can be used in either HTTP Target Endpoint directly, or as the host in Target Server.
func (o EndpointAttachmentOutput) Host() pulumi.StringOutput {
return o.ApplyT(func(v *EndpointAttachment) pulumi.StringOutput { return v.Host }).(pulumi.StringOutput)
}
// Location of the endpoint attachment.
func (o EndpointAttachmentOutput) Location() pulumi.StringOutput {
return o.ApplyT(func(v *EndpointAttachment) pulumi.StringOutput { return v.Location }).(pulumi.StringOutput)
}
// Name of the Endpoint Attachment in the following format:
// organizations/{organization}/endpointAttachments/{endpointAttachment}.
func (o EndpointAttachmentOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *EndpointAttachment) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The Apigee Organization associated with the Apigee instance,
// in the format `organizations/{{org_name}}`.
func (o EndpointAttachmentOutput) OrgId() pulumi.StringOutput {
return o.ApplyT(func(v *EndpointAttachment) pulumi.StringOutput { return v.OrgId }).(pulumi.StringOutput)
}
// Format: projects/*/regions/*/serviceAttachments/*
func (o EndpointAttachmentOutput) ServiceAttachment() pulumi.StringOutput {
return o.ApplyT(func(v *EndpointAttachment) pulumi.StringOutput { return v.ServiceAttachment }).(pulumi.StringOutput)
}
type EndpointAttachmentArrayOutput struct{ *pulumi.OutputState }
func (EndpointAttachmentArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*EndpointAttachment)(nil)).Elem()
}
func (o EndpointAttachmentArrayOutput) ToEndpointAttachmentArrayOutput() EndpointAttachmentArrayOutput {
return o
}
func (o EndpointAttachmentArrayOutput) ToEndpointAttachmentArrayOutputWithContext(ctx context.Context) EndpointAttachmentArrayOutput {
return o
}
func (o EndpointAttachmentArrayOutput) Index(i pulumi.IntInput) EndpointAttachmentOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *EndpointAttachment {
return vs[0].([]*EndpointAttachment)[vs[1].(int)]
}).(EndpointAttachmentOutput)
}
type EndpointAttachmentMapOutput struct{ *pulumi.OutputState }
func (EndpointAttachmentMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*EndpointAttachment)(nil)).Elem()
}
func (o EndpointAttachmentMapOutput) ToEndpointAttachmentMapOutput() EndpointAttachmentMapOutput {
return o
}
func (o EndpointAttachmentMapOutput) ToEndpointAttachmentMapOutputWithContext(ctx context.Context) EndpointAttachmentMapOutput {
return o
}
func (o EndpointAttachmentMapOutput) MapIndex(k pulumi.StringInput) EndpointAttachmentOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *EndpointAttachment {
return vs[0].(map[string]*EndpointAttachment)[vs[1].(string)]
}).(EndpointAttachmentOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*EndpointAttachmentInput)(nil)).Elem(), &EndpointAttachment{})
pulumi.RegisterInputType(reflect.TypeOf((*EndpointAttachmentArrayInput)(nil)).Elem(), EndpointAttachmentArray{})
pulumi.RegisterInputType(reflect.TypeOf((*EndpointAttachmentMapInput)(nil)).Elem(), EndpointAttachmentMap{})
pulumi.RegisterOutputType(EndpointAttachmentOutput{})
pulumi.RegisterOutputType(EndpointAttachmentArrayOutput{})
pulumi.RegisterOutputType(EndpointAttachmentMapOutput{})
}