github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cognito/resourceServer.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package cognito 5 6 import ( 7 "context" 8 "reflect" 9 10 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Provides a Cognito Resource Server. 16 // 17 // ## Example Usage 18 // 19 // ### Create a basic resource server 20 // 21 // <!--Start PulumiCodeChooser --> 22 // ```go 23 // package main 24 // 25 // import ( 26 // 27 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cognito" 28 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 29 // 30 // ) 31 // 32 // func main() { 33 // pulumi.Run(func(ctx *pulumi.Context) error { 34 // pool, err := cognito.NewUserPool(ctx, "pool", &cognito.UserPoolArgs{ 35 // Name: pulumi.String("pool"), 36 // }) 37 // if err != nil { 38 // return err 39 // } 40 // _, err = cognito.NewResourceServer(ctx, "resource", &cognito.ResourceServerArgs{ 41 // Identifier: pulumi.String("https://example.com"), 42 // Name: pulumi.String("example"), 43 // UserPoolId: pool.ID(), 44 // }) 45 // if err != nil { 46 // return err 47 // } 48 // return nil 49 // }) 50 // } 51 // 52 // ``` 53 // <!--End PulumiCodeChooser --> 54 // 55 // ### Create a resource server with sample-scope 56 // 57 // <!--Start PulumiCodeChooser --> 58 // ```go 59 // package main 60 // 61 // import ( 62 // 63 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cognito" 64 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 65 // 66 // ) 67 // 68 // func main() { 69 // pulumi.Run(func(ctx *pulumi.Context) error { 70 // pool, err := cognito.NewUserPool(ctx, "pool", &cognito.UserPoolArgs{ 71 // Name: pulumi.String("pool"), 72 // }) 73 // if err != nil { 74 // return err 75 // } 76 // _, err = cognito.NewResourceServer(ctx, "resource", &cognito.ResourceServerArgs{ 77 // Identifier: pulumi.String("https://example.com"), 78 // Name: pulumi.String("example"), 79 // Scopes: cognito.ResourceServerScopeArray{ 80 // &cognito.ResourceServerScopeArgs{ 81 // ScopeName: pulumi.String("sample-scope"), 82 // ScopeDescription: pulumi.String("a Sample Scope Description"), 83 // }, 84 // }, 85 // UserPoolId: pool.ID(), 86 // }) 87 // if err != nil { 88 // return err 89 // } 90 // return nil 91 // }) 92 // } 93 // 94 // ``` 95 // <!--End PulumiCodeChooser --> 96 // 97 // ## Import 98 // 99 // Using `pulumi import`, import `aws_cognito_resource_server` using their User Pool ID and Identifier. For example: 100 // 101 // ```sh 102 // $ pulumi import aws:cognito/resourceServer:ResourceServer example "us-west-2_abc123|https://example.com" 103 // ``` 104 type ResourceServer struct { 105 pulumi.CustomResourceState 106 107 // An identifier for the resource server. 108 Identifier pulumi.StringOutput `pulumi:"identifier"` 109 // A name for the resource server. 110 Name pulumi.StringOutput `pulumi:"name"` 111 // A list of all scopes configured for this resource server in the format identifier/scope_name. 112 ScopeIdentifiers pulumi.StringArrayOutput `pulumi:"scopeIdentifiers"` 113 // A list of Authorization Scope. 114 Scopes ResourceServerScopeArrayOutput `pulumi:"scopes"` 115 // User pool the client belongs to. 116 UserPoolId pulumi.StringOutput `pulumi:"userPoolId"` 117 } 118 119 // NewResourceServer registers a new resource with the given unique name, arguments, and options. 120 func NewResourceServer(ctx *pulumi.Context, 121 name string, args *ResourceServerArgs, opts ...pulumi.ResourceOption) (*ResourceServer, error) { 122 if args == nil { 123 return nil, errors.New("missing one or more required arguments") 124 } 125 126 if args.Identifier == nil { 127 return nil, errors.New("invalid value for required argument 'Identifier'") 128 } 129 if args.UserPoolId == nil { 130 return nil, errors.New("invalid value for required argument 'UserPoolId'") 131 } 132 opts = internal.PkgResourceDefaultOpts(opts) 133 var resource ResourceServer 134 err := ctx.RegisterResource("aws:cognito/resourceServer:ResourceServer", name, args, &resource, opts...) 135 if err != nil { 136 return nil, err 137 } 138 return &resource, nil 139 } 140 141 // GetResourceServer gets an existing ResourceServer resource's state with the given name, ID, and optional 142 // state properties that are used to uniquely qualify the lookup (nil if not required). 143 func GetResourceServer(ctx *pulumi.Context, 144 name string, id pulumi.IDInput, state *ResourceServerState, opts ...pulumi.ResourceOption) (*ResourceServer, error) { 145 var resource ResourceServer 146 err := ctx.ReadResource("aws:cognito/resourceServer:ResourceServer", name, id, state, &resource, opts...) 147 if err != nil { 148 return nil, err 149 } 150 return &resource, nil 151 } 152 153 // Input properties used for looking up and filtering ResourceServer resources. 154 type resourceServerState struct { 155 // An identifier for the resource server. 156 Identifier *string `pulumi:"identifier"` 157 // A name for the resource server. 158 Name *string `pulumi:"name"` 159 // A list of all scopes configured for this resource server in the format identifier/scope_name. 160 ScopeIdentifiers []string `pulumi:"scopeIdentifiers"` 161 // A list of Authorization Scope. 162 Scopes []ResourceServerScope `pulumi:"scopes"` 163 // User pool the client belongs to. 164 UserPoolId *string `pulumi:"userPoolId"` 165 } 166 167 type ResourceServerState struct { 168 // An identifier for the resource server. 169 Identifier pulumi.StringPtrInput 170 // A name for the resource server. 171 Name pulumi.StringPtrInput 172 // A list of all scopes configured for this resource server in the format identifier/scope_name. 173 ScopeIdentifiers pulumi.StringArrayInput 174 // A list of Authorization Scope. 175 Scopes ResourceServerScopeArrayInput 176 // User pool the client belongs to. 177 UserPoolId pulumi.StringPtrInput 178 } 179 180 func (ResourceServerState) ElementType() reflect.Type { 181 return reflect.TypeOf((*resourceServerState)(nil)).Elem() 182 } 183 184 type resourceServerArgs struct { 185 // An identifier for the resource server. 186 Identifier string `pulumi:"identifier"` 187 // A name for the resource server. 188 Name *string `pulumi:"name"` 189 // A list of Authorization Scope. 190 Scopes []ResourceServerScope `pulumi:"scopes"` 191 // User pool the client belongs to. 192 UserPoolId string `pulumi:"userPoolId"` 193 } 194 195 // The set of arguments for constructing a ResourceServer resource. 196 type ResourceServerArgs struct { 197 // An identifier for the resource server. 198 Identifier pulumi.StringInput 199 // A name for the resource server. 200 Name pulumi.StringPtrInput 201 // A list of Authorization Scope. 202 Scopes ResourceServerScopeArrayInput 203 // User pool the client belongs to. 204 UserPoolId pulumi.StringInput 205 } 206 207 func (ResourceServerArgs) ElementType() reflect.Type { 208 return reflect.TypeOf((*resourceServerArgs)(nil)).Elem() 209 } 210 211 type ResourceServerInput interface { 212 pulumi.Input 213 214 ToResourceServerOutput() ResourceServerOutput 215 ToResourceServerOutputWithContext(ctx context.Context) ResourceServerOutput 216 } 217 218 func (*ResourceServer) ElementType() reflect.Type { 219 return reflect.TypeOf((**ResourceServer)(nil)).Elem() 220 } 221 222 func (i *ResourceServer) ToResourceServerOutput() ResourceServerOutput { 223 return i.ToResourceServerOutputWithContext(context.Background()) 224 } 225 226 func (i *ResourceServer) ToResourceServerOutputWithContext(ctx context.Context) ResourceServerOutput { 227 return pulumi.ToOutputWithContext(ctx, i).(ResourceServerOutput) 228 } 229 230 // ResourceServerArrayInput is an input type that accepts ResourceServerArray and ResourceServerArrayOutput values. 231 // You can construct a concrete instance of `ResourceServerArrayInput` via: 232 // 233 // ResourceServerArray{ ResourceServerArgs{...} } 234 type ResourceServerArrayInput interface { 235 pulumi.Input 236 237 ToResourceServerArrayOutput() ResourceServerArrayOutput 238 ToResourceServerArrayOutputWithContext(context.Context) ResourceServerArrayOutput 239 } 240 241 type ResourceServerArray []ResourceServerInput 242 243 func (ResourceServerArray) ElementType() reflect.Type { 244 return reflect.TypeOf((*[]*ResourceServer)(nil)).Elem() 245 } 246 247 func (i ResourceServerArray) ToResourceServerArrayOutput() ResourceServerArrayOutput { 248 return i.ToResourceServerArrayOutputWithContext(context.Background()) 249 } 250 251 func (i ResourceServerArray) ToResourceServerArrayOutputWithContext(ctx context.Context) ResourceServerArrayOutput { 252 return pulumi.ToOutputWithContext(ctx, i).(ResourceServerArrayOutput) 253 } 254 255 // ResourceServerMapInput is an input type that accepts ResourceServerMap and ResourceServerMapOutput values. 256 // You can construct a concrete instance of `ResourceServerMapInput` via: 257 // 258 // ResourceServerMap{ "key": ResourceServerArgs{...} } 259 type ResourceServerMapInput interface { 260 pulumi.Input 261 262 ToResourceServerMapOutput() ResourceServerMapOutput 263 ToResourceServerMapOutputWithContext(context.Context) ResourceServerMapOutput 264 } 265 266 type ResourceServerMap map[string]ResourceServerInput 267 268 func (ResourceServerMap) ElementType() reflect.Type { 269 return reflect.TypeOf((*map[string]*ResourceServer)(nil)).Elem() 270 } 271 272 func (i ResourceServerMap) ToResourceServerMapOutput() ResourceServerMapOutput { 273 return i.ToResourceServerMapOutputWithContext(context.Background()) 274 } 275 276 func (i ResourceServerMap) ToResourceServerMapOutputWithContext(ctx context.Context) ResourceServerMapOutput { 277 return pulumi.ToOutputWithContext(ctx, i).(ResourceServerMapOutput) 278 } 279 280 type ResourceServerOutput struct{ *pulumi.OutputState } 281 282 func (ResourceServerOutput) ElementType() reflect.Type { 283 return reflect.TypeOf((**ResourceServer)(nil)).Elem() 284 } 285 286 func (o ResourceServerOutput) ToResourceServerOutput() ResourceServerOutput { 287 return o 288 } 289 290 func (o ResourceServerOutput) ToResourceServerOutputWithContext(ctx context.Context) ResourceServerOutput { 291 return o 292 } 293 294 // An identifier for the resource server. 295 func (o ResourceServerOutput) Identifier() pulumi.StringOutput { 296 return o.ApplyT(func(v *ResourceServer) pulumi.StringOutput { return v.Identifier }).(pulumi.StringOutput) 297 } 298 299 // A name for the resource server. 300 func (o ResourceServerOutput) Name() pulumi.StringOutput { 301 return o.ApplyT(func(v *ResourceServer) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 302 } 303 304 // A list of all scopes configured for this resource server in the format identifier/scope_name. 305 func (o ResourceServerOutput) ScopeIdentifiers() pulumi.StringArrayOutput { 306 return o.ApplyT(func(v *ResourceServer) pulumi.StringArrayOutput { return v.ScopeIdentifiers }).(pulumi.StringArrayOutput) 307 } 308 309 // A list of Authorization Scope. 310 func (o ResourceServerOutput) Scopes() ResourceServerScopeArrayOutput { 311 return o.ApplyT(func(v *ResourceServer) ResourceServerScopeArrayOutput { return v.Scopes }).(ResourceServerScopeArrayOutput) 312 } 313 314 // User pool the client belongs to. 315 func (o ResourceServerOutput) UserPoolId() pulumi.StringOutput { 316 return o.ApplyT(func(v *ResourceServer) pulumi.StringOutput { return v.UserPoolId }).(pulumi.StringOutput) 317 } 318 319 type ResourceServerArrayOutput struct{ *pulumi.OutputState } 320 321 func (ResourceServerArrayOutput) ElementType() reflect.Type { 322 return reflect.TypeOf((*[]*ResourceServer)(nil)).Elem() 323 } 324 325 func (o ResourceServerArrayOutput) ToResourceServerArrayOutput() ResourceServerArrayOutput { 326 return o 327 } 328 329 func (o ResourceServerArrayOutput) ToResourceServerArrayOutputWithContext(ctx context.Context) ResourceServerArrayOutput { 330 return o 331 } 332 333 func (o ResourceServerArrayOutput) Index(i pulumi.IntInput) ResourceServerOutput { 334 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ResourceServer { 335 return vs[0].([]*ResourceServer)[vs[1].(int)] 336 }).(ResourceServerOutput) 337 } 338 339 type ResourceServerMapOutput struct{ *pulumi.OutputState } 340 341 func (ResourceServerMapOutput) ElementType() reflect.Type { 342 return reflect.TypeOf((*map[string]*ResourceServer)(nil)).Elem() 343 } 344 345 func (o ResourceServerMapOutput) ToResourceServerMapOutput() ResourceServerMapOutput { 346 return o 347 } 348 349 func (o ResourceServerMapOutput) ToResourceServerMapOutputWithContext(ctx context.Context) ResourceServerMapOutput { 350 return o 351 } 352 353 func (o ResourceServerMapOutput) MapIndex(k pulumi.StringInput) ResourceServerOutput { 354 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ResourceServer { 355 return vs[0].(map[string]*ResourceServer)[vs[1].(string)] 356 }).(ResourceServerOutput) 357 } 358 359 func init() { 360 pulumi.RegisterInputType(reflect.TypeOf((*ResourceServerInput)(nil)).Elem(), &ResourceServer{}) 361 pulumi.RegisterInputType(reflect.TypeOf((*ResourceServerArrayInput)(nil)).Elem(), ResourceServerArray{}) 362 pulumi.RegisterInputType(reflect.TypeOf((*ResourceServerMapInput)(nil)).Elem(), ResourceServerMap{}) 363 pulumi.RegisterOutputType(ResourceServerOutput{}) 364 pulumi.RegisterOutputType(ResourceServerArrayOutput{}) 365 pulumi.RegisterOutputType(ResourceServerMapOutput{}) 366 }