/
type.go
340 lines (288 loc) · 9.15 KB
/
type.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
// 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-aws/sdk/v6/go/aws/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides an AppSync Type.
//
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appsync"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// example, err := appsync.NewGraphQLApi(ctx, "example", &appsync.GraphQLApiArgs{
// AuthenticationType: pulumi.String("API_KEY"),
// Name: pulumi.String("example"),
// })
// if err != nil {
// return err
// }
// _, err = appsync.NewType(ctx, "example", &appsync.TypeArgs{
// ApiId: example.ID(),
// Format: pulumi.String("SDL"),
// Definition: pulumi.String(`type Mutation
//
// {
// putPost(id: ID!,title: String! ): Post
//
// }
// `),
//
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// Using `pulumi import`, import Appsync Types using the `id`. For example:
//
// ```sh
// $ pulumi import aws:appsync/type:Type example api-id:format:name
// ```
type Type struct {
pulumi.CustomResourceState
// GraphQL API ID.
ApiId pulumi.StringOutput `pulumi:"apiId"`
// The ARN of the type.
Arn pulumi.StringOutput `pulumi:"arn"`
// The type definition.
Definition pulumi.StringOutput `pulumi:"definition"`
// The type description.
Description pulumi.StringOutput `pulumi:"description"`
// The type format: `SDL` or `JSON`.
Format pulumi.StringOutput `pulumi:"format"`
// The type name.
Name pulumi.StringOutput `pulumi:"name"`
}
// NewType registers a new resource with the given unique name, arguments, and options.
func NewType(ctx *pulumi.Context,
name string, args *TypeArgs, opts ...pulumi.ResourceOption) (*Type, 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'")
}
if args.Definition == nil {
return nil, errors.New("invalid value for required argument 'Definition'")
}
if args.Format == nil {
return nil, errors.New("invalid value for required argument 'Format'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource Type
err := ctx.RegisterResource("aws:appsync/type:Type", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetType gets an existing Type 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 GetType(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *TypeState, opts ...pulumi.ResourceOption) (*Type, error) {
var resource Type
err := ctx.ReadResource("aws:appsync/type:Type", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Type resources.
type typeState struct {
// GraphQL API ID.
ApiId *string `pulumi:"apiId"`
// The ARN of the type.
Arn *string `pulumi:"arn"`
// The type definition.
Definition *string `pulumi:"definition"`
// The type description.
Description *string `pulumi:"description"`
// The type format: `SDL` or `JSON`.
Format *string `pulumi:"format"`
// The type name.
Name *string `pulumi:"name"`
}
type TypeState struct {
// GraphQL API ID.
ApiId pulumi.StringPtrInput
// The ARN of the type.
Arn pulumi.StringPtrInput
// The type definition.
Definition pulumi.StringPtrInput
// The type description.
Description pulumi.StringPtrInput
// The type format: `SDL` or `JSON`.
Format pulumi.StringPtrInput
// The type name.
Name pulumi.StringPtrInput
}
func (TypeState) ElementType() reflect.Type {
return reflect.TypeOf((*typeState)(nil)).Elem()
}
type typeArgs struct {
// GraphQL API ID.
ApiId string `pulumi:"apiId"`
// The type definition.
Definition string `pulumi:"definition"`
// The type format: `SDL` or `JSON`.
Format string `pulumi:"format"`
}
// The set of arguments for constructing a Type resource.
type TypeArgs struct {
// GraphQL API ID.
ApiId pulumi.StringInput
// The type definition.
Definition pulumi.StringInput
// The type format: `SDL` or `JSON`.
Format pulumi.StringInput
}
func (TypeArgs) ElementType() reflect.Type {
return reflect.TypeOf((*typeArgs)(nil)).Elem()
}
type TypeInput interface {
pulumi.Input
ToTypeOutput() TypeOutput
ToTypeOutputWithContext(ctx context.Context) TypeOutput
}
func (*Type) ElementType() reflect.Type {
return reflect.TypeOf((**Type)(nil)).Elem()
}
func (i *Type) ToTypeOutput() TypeOutput {
return i.ToTypeOutputWithContext(context.Background())
}
func (i *Type) ToTypeOutputWithContext(ctx context.Context) TypeOutput {
return pulumi.ToOutputWithContext(ctx, i).(TypeOutput)
}
// TypeArrayInput is an input type that accepts TypeArray and TypeArrayOutput values.
// You can construct a concrete instance of `TypeArrayInput` via:
//
// TypeArray{ TypeArgs{...} }
type TypeArrayInput interface {
pulumi.Input
ToTypeArrayOutput() TypeArrayOutput
ToTypeArrayOutputWithContext(context.Context) TypeArrayOutput
}
type TypeArray []TypeInput
func (TypeArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Type)(nil)).Elem()
}
func (i TypeArray) ToTypeArrayOutput() TypeArrayOutput {
return i.ToTypeArrayOutputWithContext(context.Background())
}
func (i TypeArray) ToTypeArrayOutputWithContext(ctx context.Context) TypeArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(TypeArrayOutput)
}
// TypeMapInput is an input type that accepts TypeMap and TypeMapOutput values.
// You can construct a concrete instance of `TypeMapInput` via:
//
// TypeMap{ "key": TypeArgs{...} }
type TypeMapInput interface {
pulumi.Input
ToTypeMapOutput() TypeMapOutput
ToTypeMapOutputWithContext(context.Context) TypeMapOutput
}
type TypeMap map[string]TypeInput
func (TypeMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Type)(nil)).Elem()
}
func (i TypeMap) ToTypeMapOutput() TypeMapOutput {
return i.ToTypeMapOutputWithContext(context.Background())
}
func (i TypeMap) ToTypeMapOutputWithContext(ctx context.Context) TypeMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(TypeMapOutput)
}
type TypeOutput struct{ *pulumi.OutputState }
func (TypeOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Type)(nil)).Elem()
}
func (o TypeOutput) ToTypeOutput() TypeOutput {
return o
}
func (o TypeOutput) ToTypeOutputWithContext(ctx context.Context) TypeOutput {
return o
}
// GraphQL API ID.
func (o TypeOutput) ApiId() pulumi.StringOutput {
return o.ApplyT(func(v *Type) pulumi.StringOutput { return v.ApiId }).(pulumi.StringOutput)
}
// The ARN of the type.
func (o TypeOutput) Arn() pulumi.StringOutput {
return o.ApplyT(func(v *Type) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
}
// The type definition.
func (o TypeOutput) Definition() pulumi.StringOutput {
return o.ApplyT(func(v *Type) pulumi.StringOutput { return v.Definition }).(pulumi.StringOutput)
}
// The type description.
func (o TypeOutput) Description() pulumi.StringOutput {
return o.ApplyT(func(v *Type) pulumi.StringOutput { return v.Description }).(pulumi.StringOutput)
}
// The type format: `SDL` or `JSON`.
func (o TypeOutput) Format() pulumi.StringOutput {
return o.ApplyT(func(v *Type) pulumi.StringOutput { return v.Format }).(pulumi.StringOutput)
}
// The type name.
func (o TypeOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Type) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
type TypeArrayOutput struct{ *pulumi.OutputState }
func (TypeArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Type)(nil)).Elem()
}
func (o TypeArrayOutput) ToTypeArrayOutput() TypeArrayOutput {
return o
}
func (o TypeArrayOutput) ToTypeArrayOutputWithContext(ctx context.Context) TypeArrayOutput {
return o
}
func (o TypeArrayOutput) Index(i pulumi.IntInput) TypeOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Type {
return vs[0].([]*Type)[vs[1].(int)]
}).(TypeOutput)
}
type TypeMapOutput struct{ *pulumi.OutputState }
func (TypeMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Type)(nil)).Elem()
}
func (o TypeMapOutput) ToTypeMapOutput() TypeMapOutput {
return o
}
func (o TypeMapOutput) ToTypeMapOutputWithContext(ctx context.Context) TypeMapOutput {
return o
}
func (o TypeMapOutput) MapIndex(k pulumi.StringInput) TypeOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Type {
return vs[0].(map[string]*Type)[vs[1].(string)]
}).(TypeOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*TypeInput)(nil)).Elem(), &Type{})
pulumi.RegisterInputType(reflect.TypeOf((*TypeArrayInput)(nil)).Elem(), TypeArray{})
pulumi.RegisterInputType(reflect.TypeOf((*TypeMapInput)(nil)).Elem(), TypeMap{})
pulumi.RegisterOutputType(TypeOutput{})
pulumi.RegisterOutputType(TypeArrayOutput{})
pulumi.RegisterOutputType(TypeMapOutput{})
}