/
apiCache.go
346 lines (294 loc) · 12.7 KB
/
apiCache.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
// 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 appsync
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides an AppSync API Cache.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v5/go/aws/appsync"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// exampleGraphQLApi, err := appsync.NewGraphQLApi(ctx, "exampleGraphQLApi", &appsync.GraphQLApiArgs{
// AuthenticationType: pulumi.String("API_KEY"),
// })
// if err != nil {
// return err
// }
// _, err = appsync.NewApiCache(ctx, "exampleApiCache", &appsync.ApiCacheArgs{
// ApiId: exampleGraphQLApi.ID(),
// ApiCachingBehavior: pulumi.String("FULL_REQUEST_CACHING"),
// Type: pulumi.String("LARGE"),
// Ttl: pulumi.Int(900),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// `aws_appsync_api_cache` can be imported using the AppSync API ID, e.g.,
//
// ```sh
//
// $ pulumi import aws:appsync/apiCache:ApiCache example xxxxx
//
// ```
type ApiCache struct {
pulumi.CustomResourceState
// Caching behavior. Valid values are `FULL_REQUEST_CACHING` and `PER_RESOLVER_CACHING`.
ApiCachingBehavior pulumi.StringOutput `pulumi:"apiCachingBehavior"`
// GraphQL API ID.
ApiId pulumi.StringOutput `pulumi:"apiId"`
// At-rest encryption flag for cache. You cannot update this setting after creation.
AtRestEncryptionEnabled pulumi.BoolPtrOutput `pulumi:"atRestEncryptionEnabled"`
// Transit encryption flag when connecting to cache. You cannot update this setting after creation.
TransitEncryptionEnabled pulumi.BoolPtrOutput `pulumi:"transitEncryptionEnabled"`
// TTL in seconds for cache entries.
Ttl pulumi.IntOutput `pulumi:"ttl"`
// Cache instance type. Valid values are `SMALL`, `MEDIUM`, `LARGE`, `XLARGE`, `LARGE_2X`, `LARGE_4X`, `LARGE_8X`, `LARGE_12X`, `T2_SMALL`, `T2_MEDIUM`, `R4_LARGE`, `R4_XLARGE`, `R4_2XLARGE`, `R4_4XLARGE`, `R4_8XLARGE`.
Type pulumi.StringOutput `pulumi:"type"`
}
// NewApiCache registers a new resource with the given unique name, arguments, and options.
func NewApiCache(ctx *pulumi.Context,
name string, args *ApiCacheArgs, opts ...pulumi.ResourceOption) (*ApiCache, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ApiCachingBehavior == nil {
return nil, errors.New("invalid value for required argument 'ApiCachingBehavior'")
}
if args.ApiId == nil {
return nil, errors.New("invalid value for required argument 'ApiId'")
}
if args.Ttl == nil {
return nil, errors.New("invalid value for required argument 'Ttl'")
}
if args.Type == nil {
return nil, errors.New("invalid value for required argument 'Type'")
}
var resource ApiCache
err := ctx.RegisterResource("aws:appsync/apiCache:ApiCache", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetApiCache gets an existing ApiCache 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 GetApiCache(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ApiCacheState, opts ...pulumi.ResourceOption) (*ApiCache, error) {
var resource ApiCache
err := ctx.ReadResource("aws:appsync/apiCache:ApiCache", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ApiCache resources.
type apiCacheState struct {
// Caching behavior. Valid values are `FULL_REQUEST_CACHING` and `PER_RESOLVER_CACHING`.
ApiCachingBehavior *string `pulumi:"apiCachingBehavior"`
// GraphQL API ID.
ApiId *string `pulumi:"apiId"`
// At-rest encryption flag for cache. You cannot update this setting after creation.
AtRestEncryptionEnabled *bool `pulumi:"atRestEncryptionEnabled"`
// Transit encryption flag when connecting to cache. You cannot update this setting after creation.
TransitEncryptionEnabled *bool `pulumi:"transitEncryptionEnabled"`
// TTL in seconds for cache entries.
Ttl *int `pulumi:"ttl"`
// Cache instance type. Valid values are `SMALL`, `MEDIUM`, `LARGE`, `XLARGE`, `LARGE_2X`, `LARGE_4X`, `LARGE_8X`, `LARGE_12X`, `T2_SMALL`, `T2_MEDIUM`, `R4_LARGE`, `R4_XLARGE`, `R4_2XLARGE`, `R4_4XLARGE`, `R4_8XLARGE`.
Type *string `pulumi:"type"`
}
type ApiCacheState struct {
// Caching behavior. Valid values are `FULL_REQUEST_CACHING` and `PER_RESOLVER_CACHING`.
ApiCachingBehavior pulumi.StringPtrInput
// GraphQL API ID.
ApiId pulumi.StringPtrInput
// At-rest encryption flag for cache. You cannot update this setting after creation.
AtRestEncryptionEnabled pulumi.BoolPtrInput
// Transit encryption flag when connecting to cache. You cannot update this setting after creation.
TransitEncryptionEnabled pulumi.BoolPtrInput
// TTL in seconds for cache entries.
Ttl pulumi.IntPtrInput
// Cache instance type. Valid values are `SMALL`, `MEDIUM`, `LARGE`, `XLARGE`, `LARGE_2X`, `LARGE_4X`, `LARGE_8X`, `LARGE_12X`, `T2_SMALL`, `T2_MEDIUM`, `R4_LARGE`, `R4_XLARGE`, `R4_2XLARGE`, `R4_4XLARGE`, `R4_8XLARGE`.
Type pulumi.StringPtrInput
}
func (ApiCacheState) ElementType() reflect.Type {
return reflect.TypeOf((*apiCacheState)(nil)).Elem()
}
type apiCacheArgs struct {
// Caching behavior. Valid values are `FULL_REQUEST_CACHING` and `PER_RESOLVER_CACHING`.
ApiCachingBehavior string `pulumi:"apiCachingBehavior"`
// GraphQL API ID.
ApiId string `pulumi:"apiId"`
// At-rest encryption flag for cache. You cannot update this setting after creation.
AtRestEncryptionEnabled *bool `pulumi:"atRestEncryptionEnabled"`
// Transit encryption flag when connecting to cache. You cannot update this setting after creation.
TransitEncryptionEnabled *bool `pulumi:"transitEncryptionEnabled"`
// TTL in seconds for cache entries.
Ttl int `pulumi:"ttl"`
// Cache instance type. Valid values are `SMALL`, `MEDIUM`, `LARGE`, `XLARGE`, `LARGE_2X`, `LARGE_4X`, `LARGE_8X`, `LARGE_12X`, `T2_SMALL`, `T2_MEDIUM`, `R4_LARGE`, `R4_XLARGE`, `R4_2XLARGE`, `R4_4XLARGE`, `R4_8XLARGE`.
Type string `pulumi:"type"`
}
// The set of arguments for constructing a ApiCache resource.
type ApiCacheArgs struct {
// Caching behavior. Valid values are `FULL_REQUEST_CACHING` and `PER_RESOLVER_CACHING`.
ApiCachingBehavior pulumi.StringInput
// GraphQL API ID.
ApiId pulumi.StringInput
// At-rest encryption flag for cache. You cannot update this setting after creation.
AtRestEncryptionEnabled pulumi.BoolPtrInput
// Transit encryption flag when connecting to cache. You cannot update this setting after creation.
TransitEncryptionEnabled pulumi.BoolPtrInput
// TTL in seconds for cache entries.
Ttl pulumi.IntInput
// Cache instance type. Valid values are `SMALL`, `MEDIUM`, `LARGE`, `XLARGE`, `LARGE_2X`, `LARGE_4X`, `LARGE_8X`, `LARGE_12X`, `T2_SMALL`, `T2_MEDIUM`, `R4_LARGE`, `R4_XLARGE`, `R4_2XLARGE`, `R4_4XLARGE`, `R4_8XLARGE`.
Type pulumi.StringInput
}
func (ApiCacheArgs) ElementType() reflect.Type {
return reflect.TypeOf((*apiCacheArgs)(nil)).Elem()
}
type ApiCacheInput interface {
pulumi.Input
ToApiCacheOutput() ApiCacheOutput
ToApiCacheOutputWithContext(ctx context.Context) ApiCacheOutput
}
func (*ApiCache) ElementType() reflect.Type {
return reflect.TypeOf((**ApiCache)(nil)).Elem()
}
func (i *ApiCache) ToApiCacheOutput() ApiCacheOutput {
return i.ToApiCacheOutputWithContext(context.Background())
}
func (i *ApiCache) ToApiCacheOutputWithContext(ctx context.Context) ApiCacheOutput {
return pulumi.ToOutputWithContext(ctx, i).(ApiCacheOutput)
}
// ApiCacheArrayInput is an input type that accepts ApiCacheArray and ApiCacheArrayOutput values.
// You can construct a concrete instance of `ApiCacheArrayInput` via:
//
// ApiCacheArray{ ApiCacheArgs{...} }
type ApiCacheArrayInput interface {
pulumi.Input
ToApiCacheArrayOutput() ApiCacheArrayOutput
ToApiCacheArrayOutputWithContext(context.Context) ApiCacheArrayOutput
}
type ApiCacheArray []ApiCacheInput
func (ApiCacheArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ApiCache)(nil)).Elem()
}
func (i ApiCacheArray) ToApiCacheArrayOutput() ApiCacheArrayOutput {
return i.ToApiCacheArrayOutputWithContext(context.Background())
}
func (i ApiCacheArray) ToApiCacheArrayOutputWithContext(ctx context.Context) ApiCacheArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ApiCacheArrayOutput)
}
// ApiCacheMapInput is an input type that accepts ApiCacheMap and ApiCacheMapOutput values.
// You can construct a concrete instance of `ApiCacheMapInput` via:
//
// ApiCacheMap{ "key": ApiCacheArgs{...} }
type ApiCacheMapInput interface {
pulumi.Input
ToApiCacheMapOutput() ApiCacheMapOutput
ToApiCacheMapOutputWithContext(context.Context) ApiCacheMapOutput
}
type ApiCacheMap map[string]ApiCacheInput
func (ApiCacheMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ApiCache)(nil)).Elem()
}
func (i ApiCacheMap) ToApiCacheMapOutput() ApiCacheMapOutput {
return i.ToApiCacheMapOutputWithContext(context.Background())
}
func (i ApiCacheMap) ToApiCacheMapOutputWithContext(ctx context.Context) ApiCacheMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ApiCacheMapOutput)
}
type ApiCacheOutput struct{ *pulumi.OutputState }
func (ApiCacheOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ApiCache)(nil)).Elem()
}
func (o ApiCacheOutput) ToApiCacheOutput() ApiCacheOutput {
return o
}
func (o ApiCacheOutput) ToApiCacheOutputWithContext(ctx context.Context) ApiCacheOutput {
return o
}
// Caching behavior. Valid values are `FULL_REQUEST_CACHING` and `PER_RESOLVER_CACHING`.
func (o ApiCacheOutput) ApiCachingBehavior() pulumi.StringOutput {
return o.ApplyT(func(v *ApiCache) pulumi.StringOutput { return v.ApiCachingBehavior }).(pulumi.StringOutput)
}
// GraphQL API ID.
func (o ApiCacheOutput) ApiId() pulumi.StringOutput {
return o.ApplyT(func(v *ApiCache) pulumi.StringOutput { return v.ApiId }).(pulumi.StringOutput)
}
// At-rest encryption flag for cache. You cannot update this setting after creation.
func (o ApiCacheOutput) AtRestEncryptionEnabled() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *ApiCache) pulumi.BoolPtrOutput { return v.AtRestEncryptionEnabled }).(pulumi.BoolPtrOutput)
}
// Transit encryption flag when connecting to cache. You cannot update this setting after creation.
func (o ApiCacheOutput) TransitEncryptionEnabled() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *ApiCache) pulumi.BoolPtrOutput { return v.TransitEncryptionEnabled }).(pulumi.BoolPtrOutput)
}
// TTL in seconds for cache entries.
func (o ApiCacheOutput) Ttl() pulumi.IntOutput {
return o.ApplyT(func(v *ApiCache) pulumi.IntOutput { return v.Ttl }).(pulumi.IntOutput)
}
// Cache instance type. Valid values are `SMALL`, `MEDIUM`, `LARGE`, `XLARGE`, `LARGE_2X`, `LARGE_4X`, `LARGE_8X`, `LARGE_12X`, `T2_SMALL`, `T2_MEDIUM`, `R4_LARGE`, `R4_XLARGE`, `R4_2XLARGE`, `R4_4XLARGE`, `R4_8XLARGE`.
func (o ApiCacheOutput) Type() pulumi.StringOutput {
return o.ApplyT(func(v *ApiCache) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput)
}
type ApiCacheArrayOutput struct{ *pulumi.OutputState }
func (ApiCacheArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ApiCache)(nil)).Elem()
}
func (o ApiCacheArrayOutput) ToApiCacheArrayOutput() ApiCacheArrayOutput {
return o
}
func (o ApiCacheArrayOutput) ToApiCacheArrayOutputWithContext(ctx context.Context) ApiCacheArrayOutput {
return o
}
func (o ApiCacheArrayOutput) Index(i pulumi.IntInput) ApiCacheOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ApiCache {
return vs[0].([]*ApiCache)[vs[1].(int)]
}).(ApiCacheOutput)
}
type ApiCacheMapOutput struct{ *pulumi.OutputState }
func (ApiCacheMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ApiCache)(nil)).Elem()
}
func (o ApiCacheMapOutput) ToApiCacheMapOutput() ApiCacheMapOutput {
return o
}
func (o ApiCacheMapOutput) ToApiCacheMapOutputWithContext(ctx context.Context) ApiCacheMapOutput {
return o
}
func (o ApiCacheMapOutput) MapIndex(k pulumi.StringInput) ApiCacheOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ApiCache {
return vs[0].(map[string]*ApiCache)[vs[1].(string)]
}).(ApiCacheOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ApiCacheInput)(nil)).Elem(), &ApiCache{})
pulumi.RegisterInputType(reflect.TypeOf((*ApiCacheArrayInput)(nil)).Elem(), ApiCacheArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ApiCacheMapInput)(nil)).Elem(), ApiCacheMap{})
pulumi.RegisterOutputType(ApiCacheOutput{})
pulumi.RegisterOutputType(ApiCacheArrayOutput{})
pulumi.RegisterOutputType(ApiCacheMapOutput{})
}