-
Notifications
You must be signed in to change notification settings - Fork 150
/
resourceServer.go
316 lines (270 loc) · 10.3 KB
/
resourceServer.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
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package cognito
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a Cognito Resource Server.
//
// ## Example Usage
// ### Create a basic resource server
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/cognito"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// pool, err := cognito.NewUserPool(ctx, "pool", nil)
// if err != nil {
// return err
// }
// _, err = cognito.NewResourceServer(ctx, "resource", &cognito.ResourceServerArgs{
// Identifier: pulumi.String("https://example.com"),
// UserPoolId: pool.ID(),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
// ### Create a resource server with sample-scope
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/cognito"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// pool, err := cognito.NewUserPool(ctx, "pool", nil)
// if err != nil {
// return err
// }
// _, err = cognito.NewResourceServer(ctx, "resource", &cognito.ResourceServerArgs{
// Identifier: pulumi.String("https://example.com"),
// Scopes: cognito.ResourceServerScopeArray{
// &cognito.ResourceServerScopeArgs{
// ScopeName: pulumi.String("sample-scope"),
// ScopeDescription: pulumi.String("a Sample Scope Description"),
// },
// },
// UserPoolId: pool.ID(),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// `aws_cognito_resource_server` can be imported using their User Pool ID and Identifier, e.g.,
//
// ```sh
// $ pulumi import aws:cognito/resourceServer:ResourceServer example xxx_yyyyy|https://example.com
// ```
type ResourceServer struct {
pulumi.CustomResourceState
// An identifier for the resource server.
Identifier pulumi.StringOutput `pulumi:"identifier"`
// A name for the resource server.
Name pulumi.StringOutput `pulumi:"name"`
// A list of all scopes configured for this resource server in the format identifier/scope_name.
ScopeIdentifiers pulumi.StringArrayOutput `pulumi:"scopeIdentifiers"`
// A list of Authorization Scope.
Scopes ResourceServerScopeArrayOutput `pulumi:"scopes"`
UserPoolId pulumi.StringOutput `pulumi:"userPoolId"`
}
// NewResourceServer registers a new resource with the given unique name, arguments, and options.
func NewResourceServer(ctx *pulumi.Context,
name string, args *ResourceServerArgs, opts ...pulumi.ResourceOption) (*ResourceServer, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Identifier == nil {
return nil, errors.New("invalid value for required argument 'Identifier'")
}
if args.UserPoolId == nil {
return nil, errors.New("invalid value for required argument 'UserPoolId'")
}
var resource ResourceServer
err := ctx.RegisterResource("aws:cognito/resourceServer:ResourceServer", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetResourceServer gets an existing ResourceServer 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 GetResourceServer(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ResourceServerState, opts ...pulumi.ResourceOption) (*ResourceServer, error) {
var resource ResourceServer
err := ctx.ReadResource("aws:cognito/resourceServer:ResourceServer", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ResourceServer resources.
type resourceServerState struct {
// An identifier for the resource server.
Identifier *string `pulumi:"identifier"`
// A name for the resource server.
Name *string `pulumi:"name"`
// A list of all scopes configured for this resource server in the format identifier/scope_name.
ScopeIdentifiers []string `pulumi:"scopeIdentifiers"`
// A list of Authorization Scope.
Scopes []ResourceServerScope `pulumi:"scopes"`
UserPoolId *string `pulumi:"userPoolId"`
}
type ResourceServerState struct {
// An identifier for the resource server.
Identifier pulumi.StringPtrInput
// A name for the resource server.
Name pulumi.StringPtrInput
// A list of all scopes configured for this resource server in the format identifier/scope_name.
ScopeIdentifiers pulumi.StringArrayInput
// A list of Authorization Scope.
Scopes ResourceServerScopeArrayInput
UserPoolId pulumi.StringPtrInput
}
func (ResourceServerState) ElementType() reflect.Type {
return reflect.TypeOf((*resourceServerState)(nil)).Elem()
}
type resourceServerArgs struct {
// An identifier for the resource server.
Identifier string `pulumi:"identifier"`
// A name for the resource server.
Name *string `pulumi:"name"`
// A list of Authorization Scope.
Scopes []ResourceServerScope `pulumi:"scopes"`
UserPoolId string `pulumi:"userPoolId"`
}
// The set of arguments for constructing a ResourceServer resource.
type ResourceServerArgs struct {
// An identifier for the resource server.
Identifier pulumi.StringInput
// A name for the resource server.
Name pulumi.StringPtrInput
// A list of Authorization Scope.
Scopes ResourceServerScopeArrayInput
UserPoolId pulumi.StringInput
}
func (ResourceServerArgs) ElementType() reflect.Type {
return reflect.TypeOf((*resourceServerArgs)(nil)).Elem()
}
type ResourceServerInput interface {
pulumi.Input
ToResourceServerOutput() ResourceServerOutput
ToResourceServerOutputWithContext(ctx context.Context) ResourceServerOutput
}
func (*ResourceServer) ElementType() reflect.Type {
return reflect.TypeOf((**ResourceServer)(nil)).Elem()
}
func (i *ResourceServer) ToResourceServerOutput() ResourceServerOutput {
return i.ToResourceServerOutputWithContext(context.Background())
}
func (i *ResourceServer) ToResourceServerOutputWithContext(ctx context.Context) ResourceServerOutput {
return pulumi.ToOutputWithContext(ctx, i).(ResourceServerOutput)
}
// ResourceServerArrayInput is an input type that accepts ResourceServerArray and ResourceServerArrayOutput values.
// You can construct a concrete instance of `ResourceServerArrayInput` via:
//
// ResourceServerArray{ ResourceServerArgs{...} }
type ResourceServerArrayInput interface {
pulumi.Input
ToResourceServerArrayOutput() ResourceServerArrayOutput
ToResourceServerArrayOutputWithContext(context.Context) ResourceServerArrayOutput
}
type ResourceServerArray []ResourceServerInput
func (ResourceServerArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ResourceServer)(nil)).Elem()
}
func (i ResourceServerArray) ToResourceServerArrayOutput() ResourceServerArrayOutput {
return i.ToResourceServerArrayOutputWithContext(context.Background())
}
func (i ResourceServerArray) ToResourceServerArrayOutputWithContext(ctx context.Context) ResourceServerArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ResourceServerArrayOutput)
}
// ResourceServerMapInput is an input type that accepts ResourceServerMap and ResourceServerMapOutput values.
// You can construct a concrete instance of `ResourceServerMapInput` via:
//
// ResourceServerMap{ "key": ResourceServerArgs{...} }
type ResourceServerMapInput interface {
pulumi.Input
ToResourceServerMapOutput() ResourceServerMapOutput
ToResourceServerMapOutputWithContext(context.Context) ResourceServerMapOutput
}
type ResourceServerMap map[string]ResourceServerInput
func (ResourceServerMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ResourceServer)(nil)).Elem()
}
func (i ResourceServerMap) ToResourceServerMapOutput() ResourceServerMapOutput {
return i.ToResourceServerMapOutputWithContext(context.Background())
}
func (i ResourceServerMap) ToResourceServerMapOutputWithContext(ctx context.Context) ResourceServerMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ResourceServerMapOutput)
}
type ResourceServerOutput struct{ *pulumi.OutputState }
func (ResourceServerOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ResourceServer)(nil)).Elem()
}
func (o ResourceServerOutput) ToResourceServerOutput() ResourceServerOutput {
return o
}
func (o ResourceServerOutput) ToResourceServerOutputWithContext(ctx context.Context) ResourceServerOutput {
return o
}
type ResourceServerArrayOutput struct{ *pulumi.OutputState }
func (ResourceServerArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ResourceServer)(nil)).Elem()
}
func (o ResourceServerArrayOutput) ToResourceServerArrayOutput() ResourceServerArrayOutput {
return o
}
func (o ResourceServerArrayOutput) ToResourceServerArrayOutputWithContext(ctx context.Context) ResourceServerArrayOutput {
return o
}
func (o ResourceServerArrayOutput) Index(i pulumi.IntInput) ResourceServerOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ResourceServer {
return vs[0].([]*ResourceServer)[vs[1].(int)]
}).(ResourceServerOutput)
}
type ResourceServerMapOutput struct{ *pulumi.OutputState }
func (ResourceServerMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ResourceServer)(nil)).Elem()
}
func (o ResourceServerMapOutput) ToResourceServerMapOutput() ResourceServerMapOutput {
return o
}
func (o ResourceServerMapOutput) ToResourceServerMapOutputWithContext(ctx context.Context) ResourceServerMapOutput {
return o
}
func (o ResourceServerMapOutput) MapIndex(k pulumi.StringInput) ResourceServerOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ResourceServer {
return vs[0].(map[string]*ResourceServer)[vs[1].(string)]
}).(ResourceServerOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ResourceServerInput)(nil)).Elem(), &ResourceServer{})
pulumi.RegisterInputType(reflect.TypeOf((*ResourceServerArrayInput)(nil)).Elem(), ResourceServerArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ResourceServerMapInput)(nil)).Elem(), ResourceServerMap{})
pulumi.RegisterOutputType(ResourceServerOutput{})
pulumi.RegisterOutputType(ResourceServerArrayOutput{})
pulumi.RegisterOutputType(ResourceServerMapOutput{})
}