/
api.go
243 lines (206 loc) · 12.8 KB
/
api.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
// 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 v1
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-google-native/sdk/go/google/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Creates a specified API.
type Api struct {
pulumi.CustomResourceState
// Annotations attach non-identifying metadata to resources. Annotation keys and values are less restricted than those of labels, but should be generally used for small values of broad interest. Larger, topic- specific metadata should be stored in Artifacts.
Annotations pulumi.StringMapOutput `pulumi:"annotations"`
// Required. The ID to use for the API, which will become the final component of the API's resource name. This value should be 4-63 characters, and valid characters are /a-z-/. Following AIP-162, IDs must not have the form of a UUID.
ApiId pulumi.StringOutput `pulumi:"apiId"`
// A user-definable description of the availability of this service. Format: free-form, but we expect single words that describe availability, e.g., "NONE", "TESTING", "PREVIEW", "GENERAL", "DEPRECATED", "SHUTDOWN".
Availability pulumi.StringOutput `pulumi:"availability"`
// Creation timestamp.
CreateTime pulumi.StringOutput `pulumi:"createTime"`
// A detailed description.
Description pulumi.StringOutput `pulumi:"description"`
// Human-meaningful name.
DisplayName pulumi.StringOutput `pulumi:"displayName"`
// Labels attach identifying metadata to resources. Identifying metadata can be used to filter list operations. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores, and dashes. International characters are allowed. No more than 64 user labels can be associated with one resource (System labels are excluded). See https://goo.gl/xmQnxf for more information and examples of labels. System reserved label keys are prefixed with `apigeeregistry.googleapis.com/` and cannot be changed.
Labels pulumi.StringMapOutput `pulumi:"labels"`
Location pulumi.StringOutput `pulumi:"location"`
// Resource name.
Name pulumi.StringOutput `pulumi:"name"`
Project pulumi.StringOutput `pulumi:"project"`
// The recommended deployment of the API. Format: `projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}`
RecommendedDeployment pulumi.StringOutput `pulumi:"recommendedDeployment"`
// The recommended version of the API. Format: `projects/{project}/locations/{location}/apis/{api}/versions/{version}`
RecommendedVersion pulumi.StringOutput `pulumi:"recommendedVersion"`
// Last update timestamp.
UpdateTime pulumi.StringOutput `pulumi:"updateTime"`
}
// NewApi registers a new resource with the given unique name, arguments, and options.
func NewApi(ctx *pulumi.Context,
name string, args *ApiArgs, opts ...pulumi.ResourceOption) (*Api, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ApiId == nil {
return nil, errors.New("invalid value for required argument 'ApiId'")
}
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
"apiId",
"location",
"project",
})
opts = append(opts, replaceOnChanges)
opts = internal.PkgResourceDefaultOpts(opts)
var resource Api
err := ctx.RegisterResource("google-native:apigeeregistry/v1:Api", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetApi gets an existing Api 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 GetApi(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ApiState, opts ...pulumi.ResourceOption) (*Api, error) {
var resource Api
err := ctx.ReadResource("google-native:apigeeregistry/v1:Api", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Api resources.
type apiState struct {
}
type ApiState struct {
}
func (ApiState) ElementType() reflect.Type {
return reflect.TypeOf((*apiState)(nil)).Elem()
}
type apiArgs struct {
// Annotations attach non-identifying metadata to resources. Annotation keys and values are less restricted than those of labels, but should be generally used for small values of broad interest. Larger, topic- specific metadata should be stored in Artifacts.
Annotations map[string]string `pulumi:"annotations"`
// Required. The ID to use for the API, which will become the final component of the API's resource name. This value should be 4-63 characters, and valid characters are /a-z-/. Following AIP-162, IDs must not have the form of a UUID.
ApiId string `pulumi:"apiId"`
// A user-definable description of the availability of this service. Format: free-form, but we expect single words that describe availability, e.g., "NONE", "TESTING", "PREVIEW", "GENERAL", "DEPRECATED", "SHUTDOWN".
Availability *string `pulumi:"availability"`
// A detailed description.
Description *string `pulumi:"description"`
// Human-meaningful name.
DisplayName *string `pulumi:"displayName"`
// Labels attach identifying metadata to resources. Identifying metadata can be used to filter list operations. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores, and dashes. International characters are allowed. No more than 64 user labels can be associated with one resource (System labels are excluded). See https://goo.gl/xmQnxf for more information and examples of labels. System reserved label keys are prefixed with `apigeeregistry.googleapis.com/` and cannot be changed.
Labels map[string]string `pulumi:"labels"`
Location *string `pulumi:"location"`
// Resource name.
Name *string `pulumi:"name"`
Project *string `pulumi:"project"`
// The recommended deployment of the API. Format: `projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}`
RecommendedDeployment *string `pulumi:"recommendedDeployment"`
// The recommended version of the API. Format: `projects/{project}/locations/{location}/apis/{api}/versions/{version}`
RecommendedVersion *string `pulumi:"recommendedVersion"`
}
// The set of arguments for constructing a Api resource.
type ApiArgs struct {
// Annotations attach non-identifying metadata to resources. Annotation keys and values are less restricted than those of labels, but should be generally used for small values of broad interest. Larger, topic- specific metadata should be stored in Artifacts.
Annotations pulumi.StringMapInput
// Required. The ID to use for the API, which will become the final component of the API's resource name. This value should be 4-63 characters, and valid characters are /a-z-/. Following AIP-162, IDs must not have the form of a UUID.
ApiId pulumi.StringInput
// A user-definable description of the availability of this service. Format: free-form, but we expect single words that describe availability, e.g., "NONE", "TESTING", "PREVIEW", "GENERAL", "DEPRECATED", "SHUTDOWN".
Availability pulumi.StringPtrInput
// A detailed description.
Description pulumi.StringPtrInput
// Human-meaningful name.
DisplayName pulumi.StringPtrInput
// Labels attach identifying metadata to resources. Identifying metadata can be used to filter list operations. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores, and dashes. International characters are allowed. No more than 64 user labels can be associated with one resource (System labels are excluded). See https://goo.gl/xmQnxf for more information and examples of labels. System reserved label keys are prefixed with `apigeeregistry.googleapis.com/` and cannot be changed.
Labels pulumi.StringMapInput
Location pulumi.StringPtrInput
// Resource name.
Name pulumi.StringPtrInput
Project pulumi.StringPtrInput
// The recommended deployment of the API. Format: `projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}`
RecommendedDeployment pulumi.StringPtrInput
// The recommended version of the API. Format: `projects/{project}/locations/{location}/apis/{api}/versions/{version}`
RecommendedVersion pulumi.StringPtrInput
}
func (ApiArgs) ElementType() reflect.Type {
return reflect.TypeOf((*apiArgs)(nil)).Elem()
}
type ApiInput interface {
pulumi.Input
ToApiOutput() ApiOutput
ToApiOutputWithContext(ctx context.Context) ApiOutput
}
func (*Api) ElementType() reflect.Type {
return reflect.TypeOf((**Api)(nil)).Elem()
}
func (i *Api) ToApiOutput() ApiOutput {
return i.ToApiOutputWithContext(context.Background())
}
func (i *Api) ToApiOutputWithContext(ctx context.Context) ApiOutput {
return pulumi.ToOutputWithContext(ctx, i).(ApiOutput)
}
type ApiOutput struct{ *pulumi.OutputState }
func (ApiOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Api)(nil)).Elem()
}
func (o ApiOutput) ToApiOutput() ApiOutput {
return o
}
func (o ApiOutput) ToApiOutputWithContext(ctx context.Context) ApiOutput {
return o
}
// Annotations attach non-identifying metadata to resources. Annotation keys and values are less restricted than those of labels, but should be generally used for small values of broad interest. Larger, topic- specific metadata should be stored in Artifacts.
func (o ApiOutput) Annotations() pulumi.StringMapOutput {
return o.ApplyT(func(v *Api) pulumi.StringMapOutput { return v.Annotations }).(pulumi.StringMapOutput)
}
// Required. The ID to use for the API, which will become the final component of the API's resource name. This value should be 4-63 characters, and valid characters are /a-z-/. Following AIP-162, IDs must not have the form of a UUID.
func (o ApiOutput) ApiId() pulumi.StringOutput {
return o.ApplyT(func(v *Api) pulumi.StringOutput { return v.ApiId }).(pulumi.StringOutput)
}
// A user-definable description of the availability of this service. Format: free-form, but we expect single words that describe availability, e.g., "NONE", "TESTING", "PREVIEW", "GENERAL", "DEPRECATED", "SHUTDOWN".
func (o ApiOutput) Availability() pulumi.StringOutput {
return o.ApplyT(func(v *Api) pulumi.StringOutput { return v.Availability }).(pulumi.StringOutput)
}
// Creation timestamp.
func (o ApiOutput) CreateTime() pulumi.StringOutput {
return o.ApplyT(func(v *Api) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)
}
// A detailed description.
func (o ApiOutput) Description() pulumi.StringOutput {
return o.ApplyT(func(v *Api) pulumi.StringOutput { return v.Description }).(pulumi.StringOutput)
}
// Human-meaningful name.
func (o ApiOutput) DisplayName() pulumi.StringOutput {
return o.ApplyT(func(v *Api) pulumi.StringOutput { return v.DisplayName }).(pulumi.StringOutput)
}
// Labels attach identifying metadata to resources. Identifying metadata can be used to filter list operations. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores, and dashes. International characters are allowed. No more than 64 user labels can be associated with one resource (System labels are excluded). See https://goo.gl/xmQnxf for more information and examples of labels. System reserved label keys are prefixed with `apigeeregistry.googleapis.com/` and cannot be changed.
func (o ApiOutput) Labels() pulumi.StringMapOutput {
return o.ApplyT(func(v *Api) pulumi.StringMapOutput { return v.Labels }).(pulumi.StringMapOutput)
}
func (o ApiOutput) Location() pulumi.StringOutput {
return o.ApplyT(func(v *Api) pulumi.StringOutput { return v.Location }).(pulumi.StringOutput)
}
// Resource name.
func (o ApiOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Api) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
func (o ApiOutput) Project() pulumi.StringOutput {
return o.ApplyT(func(v *Api) pulumi.StringOutput { return v.Project }).(pulumi.StringOutput)
}
// The recommended deployment of the API. Format: `projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}`
func (o ApiOutput) RecommendedDeployment() pulumi.StringOutput {
return o.ApplyT(func(v *Api) pulumi.StringOutput { return v.RecommendedDeployment }).(pulumi.StringOutput)
}
// The recommended version of the API. Format: `projects/{project}/locations/{location}/apis/{api}/versions/{version}`
func (o ApiOutput) RecommendedVersion() pulumi.StringOutput {
return o.ApplyT(func(v *Api) pulumi.StringOutput { return v.RecommendedVersion }).(pulumi.StringOutput)
}
// Last update timestamp.
func (o ApiOutput) UpdateTime() pulumi.StringOutput {
return o.ApplyT(func(v *Api) pulumi.StringOutput { return v.UpdateTime }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ApiInput)(nil)).Elem(), &Api{})
pulumi.RegisterOutputType(ApiOutput{})
}