/
gateway.go
213 lines (178 loc) · 8.21 KB
/
gateway.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
// 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 Gateway in a given project and location.
// Auto-naming is currently not supported for this resource.
type Gateway struct {
pulumi.CustomResourceState
// Resource name of the API Config for this Gateway. Format: projects/{project}/locations/global/apis/{api}/configs/{apiConfig}
ApiConfig pulumi.StringOutput `pulumi:"apiConfig"`
// Created time.
CreateTime pulumi.StringOutput `pulumi:"createTime"`
// The default API Gateway host name of the form `{gateway_id}-{hash}.{region_code}.gateway.dev`.
DefaultHostname pulumi.StringOutput `pulumi:"defaultHostname"`
// Optional. Display name.
DisplayName pulumi.StringOutput `pulumi:"displayName"`
// Required. Identifier to assign to the Gateway. Must be unique within scope of the parent resource.
GatewayId pulumi.StringOutput `pulumi:"gatewayId"`
// Optional. Resource labels to represent user-provided metadata. Refer to cloud documentation on labels for more details. https://cloud.google.com/compute/docs/labeling-resources
Labels pulumi.StringMapOutput `pulumi:"labels"`
Location pulumi.StringOutput `pulumi:"location"`
// Resource name of the Gateway. Format: projects/{project}/locations/{location}/gateways/{gateway}
Name pulumi.StringOutput `pulumi:"name"`
Project pulumi.StringOutput `pulumi:"project"`
// The current state of the Gateway.
State pulumi.StringOutput `pulumi:"state"`
// Updated time.
UpdateTime pulumi.StringOutput `pulumi:"updateTime"`
}
// NewGateway registers a new resource with the given unique name, arguments, and options.
func NewGateway(ctx *pulumi.Context,
name string, args *GatewayArgs, opts ...pulumi.ResourceOption) (*Gateway, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ApiConfig == nil {
return nil, errors.New("invalid value for required argument 'ApiConfig'")
}
if args.GatewayId == nil {
return nil, errors.New("invalid value for required argument 'GatewayId'")
}
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
"gatewayId",
"location",
"project",
})
opts = append(opts, replaceOnChanges)
opts = internal.PkgResourceDefaultOpts(opts)
var resource Gateway
err := ctx.RegisterResource("google-native:apigateway/v1beta:Gateway", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetGateway gets an existing Gateway 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 GetGateway(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *GatewayState, opts ...pulumi.ResourceOption) (*Gateway, error) {
var resource Gateway
err := ctx.ReadResource("google-native:apigateway/v1beta:Gateway", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Gateway resources.
type gatewayState struct {
}
type GatewayState struct {
}
func (GatewayState) ElementType() reflect.Type {
return reflect.TypeOf((*gatewayState)(nil)).Elem()
}
type gatewayArgs struct {
// Resource name of the API Config for this Gateway. Format: projects/{project}/locations/global/apis/{api}/configs/{apiConfig}
ApiConfig string `pulumi:"apiConfig"`
// Optional. Display name.
DisplayName *string `pulumi:"displayName"`
// Required. Identifier to assign to the Gateway. Must be unique within scope of the parent resource.
GatewayId string `pulumi:"gatewayId"`
// Optional. Resource labels to represent user-provided metadata. Refer to cloud documentation on labels for more details. https://cloud.google.com/compute/docs/labeling-resources
Labels map[string]string `pulumi:"labels"`
Location *string `pulumi:"location"`
Project *string `pulumi:"project"`
}
// The set of arguments for constructing a Gateway resource.
type GatewayArgs struct {
// Resource name of the API Config for this Gateway. Format: projects/{project}/locations/global/apis/{api}/configs/{apiConfig}
ApiConfig pulumi.StringInput
// Optional. Display name.
DisplayName pulumi.StringPtrInput
// Required. Identifier to assign to the Gateway. Must be unique within scope of the parent resource.
GatewayId pulumi.StringInput
// Optional. Resource labels to represent user-provided metadata. Refer to cloud documentation on labels for more details. https://cloud.google.com/compute/docs/labeling-resources
Labels pulumi.StringMapInput
Location pulumi.StringPtrInput
Project pulumi.StringPtrInput
}
func (GatewayArgs) ElementType() reflect.Type {
return reflect.TypeOf((*gatewayArgs)(nil)).Elem()
}
type GatewayInput interface {
pulumi.Input
ToGatewayOutput() GatewayOutput
ToGatewayOutputWithContext(ctx context.Context) GatewayOutput
}
func (*Gateway) ElementType() reflect.Type {
return reflect.TypeOf((**Gateway)(nil)).Elem()
}
func (i *Gateway) ToGatewayOutput() GatewayOutput {
return i.ToGatewayOutputWithContext(context.Background())
}
func (i *Gateway) ToGatewayOutputWithContext(ctx context.Context) GatewayOutput {
return pulumi.ToOutputWithContext(ctx, i).(GatewayOutput)
}
type GatewayOutput struct{ *pulumi.OutputState }
func (GatewayOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Gateway)(nil)).Elem()
}
func (o GatewayOutput) ToGatewayOutput() GatewayOutput {
return o
}
func (o GatewayOutput) ToGatewayOutputWithContext(ctx context.Context) GatewayOutput {
return o
}
// Resource name of the API Config for this Gateway. Format: projects/{project}/locations/global/apis/{api}/configs/{apiConfig}
func (o GatewayOutput) ApiConfig() pulumi.StringOutput {
return o.ApplyT(func(v *Gateway) pulumi.StringOutput { return v.ApiConfig }).(pulumi.StringOutput)
}
// Created time.
func (o GatewayOutput) CreateTime() pulumi.StringOutput {
return o.ApplyT(func(v *Gateway) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)
}
// The default API Gateway host name of the form `{gateway_id}-{hash}.{region_code}.gateway.dev`.
func (o GatewayOutput) DefaultHostname() pulumi.StringOutput {
return o.ApplyT(func(v *Gateway) pulumi.StringOutput { return v.DefaultHostname }).(pulumi.StringOutput)
}
// Optional. Display name.
func (o GatewayOutput) DisplayName() pulumi.StringOutput {
return o.ApplyT(func(v *Gateway) pulumi.StringOutput { return v.DisplayName }).(pulumi.StringOutput)
}
// Required. Identifier to assign to the Gateway. Must be unique within scope of the parent resource.
func (o GatewayOutput) GatewayId() pulumi.StringOutput {
return o.ApplyT(func(v *Gateway) pulumi.StringOutput { return v.GatewayId }).(pulumi.StringOutput)
}
// Optional. Resource labels to represent user-provided metadata. Refer to cloud documentation on labels for more details. https://cloud.google.com/compute/docs/labeling-resources
func (o GatewayOutput) Labels() pulumi.StringMapOutput {
return o.ApplyT(func(v *Gateway) pulumi.StringMapOutput { return v.Labels }).(pulumi.StringMapOutput)
}
func (o GatewayOutput) Location() pulumi.StringOutput {
return o.ApplyT(func(v *Gateway) pulumi.StringOutput { return v.Location }).(pulumi.StringOutput)
}
// Resource name of the Gateway. Format: projects/{project}/locations/{location}/gateways/{gateway}
func (o GatewayOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Gateway) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
func (o GatewayOutput) Project() pulumi.StringOutput {
return o.ApplyT(func(v *Gateway) pulumi.StringOutput { return v.Project }).(pulumi.StringOutput)
}
// The current state of the Gateway.
func (o GatewayOutput) State() pulumi.StringOutput {
return o.ApplyT(func(v *Gateway) pulumi.StringOutput { return v.State }).(pulumi.StringOutput)
}
// Updated time.
func (o GatewayOutput) UpdateTime() pulumi.StringOutput {
return o.ApplyT(func(v *Gateway) pulumi.StringOutput { return v.UpdateTime }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*GatewayInput)(nil)).Elem(), &Gateway{})
pulumi.RegisterOutputType(GatewayOutput{})
}