1. Packages
  2. AWS
  3. API Docs
  4. cognito
  5. ResourceServer
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

aws.cognito.ResourceServer

Explore with Pulumi AI

aws logo
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Provides a Cognito Resource Server.

    Example Usage

    Create a basic resource server

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const pool = new aws.cognito.UserPool("pool", {name: "pool"});
    const resource = new aws.cognito.ResourceServer("resource", {
        identifier: "https://example.com",
        name: "example",
        userPoolId: pool.id,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    pool = aws.cognito.UserPool("pool", name="pool")
    resource = aws.cognito.ResourceServer("resource",
        identifier="https://example.com",
        name="example",
        user_pool_id=pool.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/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", &cognito.UserPoolArgs{
    			Name: pulumi.String("pool"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = cognito.NewResourceServer(ctx, "resource", &cognito.ResourceServerArgs{
    			Identifier: pulumi.String("https://example.com"),
    			Name:       pulumi.String("example"),
    			UserPoolId: pool.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var pool = new Aws.Cognito.UserPool("pool", new()
        {
            Name = "pool",
        });
    
        var resource = new Aws.Cognito.ResourceServer("resource", new()
        {
            Identifier = "https://example.com",
            Name = "example",
            UserPoolId = pool.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.cognito.UserPool;
    import com.pulumi.aws.cognito.UserPoolArgs;
    import com.pulumi.aws.cognito.ResourceServer;
    import com.pulumi.aws.cognito.ResourceServerArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var pool = new UserPool("pool", UserPoolArgs.builder()
                .name("pool")
                .build());
    
            var resource = new ResourceServer("resource", ResourceServerArgs.builder()
                .identifier("https://example.com")
                .name("example")
                .userPoolId(pool.id())
                .build());
    
        }
    }
    
    resources:
      pool:
        type: aws:cognito:UserPool
        properties:
          name: pool
      resource:
        type: aws:cognito:ResourceServer
        properties:
          identifier: https://example.com
          name: example
          userPoolId: ${pool.id}
    

    Create a resource server with sample-scope

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const pool = new aws.cognito.UserPool("pool", {name: "pool"});
    const resource = new aws.cognito.ResourceServer("resource", {
        identifier: "https://example.com",
        name: "example",
        scopes: [{
            scopeName: "sample-scope",
            scopeDescription: "a Sample Scope Description",
        }],
        userPoolId: pool.id,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    pool = aws.cognito.UserPool("pool", name="pool")
    resource = aws.cognito.ResourceServer("resource",
        identifier="https://example.com",
        name="example",
        scopes=[{
            "scope_name": "sample-scope",
            "scope_description": "a Sample Scope Description",
        }],
        user_pool_id=pool.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/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", &cognito.UserPoolArgs{
    			Name: pulumi.String("pool"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = cognito.NewResourceServer(ctx, "resource", &cognito.ResourceServerArgs{
    			Identifier: pulumi.String("https://example.com"),
    			Name:       pulumi.String("example"),
    			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
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var pool = new Aws.Cognito.UserPool("pool", new()
        {
            Name = "pool",
        });
    
        var resource = new Aws.Cognito.ResourceServer("resource", new()
        {
            Identifier = "https://example.com",
            Name = "example",
            Scopes = new[]
            {
                new Aws.Cognito.Inputs.ResourceServerScopeArgs
                {
                    ScopeName = "sample-scope",
                    ScopeDescription = "a Sample Scope Description",
                },
            },
            UserPoolId = pool.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.cognito.UserPool;
    import com.pulumi.aws.cognito.UserPoolArgs;
    import com.pulumi.aws.cognito.ResourceServer;
    import com.pulumi.aws.cognito.ResourceServerArgs;
    import com.pulumi.aws.cognito.inputs.ResourceServerScopeArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var pool = new UserPool("pool", UserPoolArgs.builder()
                .name("pool")
                .build());
    
            var resource = new ResourceServer("resource", ResourceServerArgs.builder()
                .identifier("https://example.com")
                .name("example")
                .scopes(ResourceServerScopeArgs.builder()
                    .scopeName("sample-scope")
                    .scopeDescription("a Sample Scope Description")
                    .build())
                .userPoolId(pool.id())
                .build());
    
        }
    }
    
    resources:
      pool:
        type: aws:cognito:UserPool
        properties:
          name: pool
      resource:
        type: aws:cognito:ResourceServer
        properties:
          identifier: https://example.com
          name: example
          scopes:
            - scopeName: sample-scope
              scopeDescription: a Sample Scope Description
          userPoolId: ${pool.id}
    

    Create ResourceServer Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ResourceServer(name: string, args: ResourceServerArgs, opts?: CustomResourceOptions);
    @overload
    def ResourceServer(resource_name: str,
                       args: ResourceServerArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def ResourceServer(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       identifier: Optional[str] = None,
                       user_pool_id: Optional[str] = None,
                       name: Optional[str] = None,
                       scopes: Optional[Sequence[ResourceServerScopeArgs]] = None)
    func NewResourceServer(ctx *Context, name string, args ResourceServerArgs, opts ...ResourceOption) (*ResourceServer, error)
    public ResourceServer(string name, ResourceServerArgs args, CustomResourceOptions? opts = null)
    public ResourceServer(String name, ResourceServerArgs args)
    public ResourceServer(String name, ResourceServerArgs args, CustomResourceOptions options)
    
    type: aws:cognito:ResourceServer
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ResourceServerArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ResourceServerArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ResourceServerArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ResourceServerArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ResourceServerArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var resourceServerResource = new Aws.Cognito.ResourceServer("resourceServerResource", new()
    {
        Identifier = "string",
        UserPoolId = "string",
        Name = "string",
        Scopes = new[]
        {
            new Aws.Cognito.Inputs.ResourceServerScopeArgs
            {
                ScopeDescription = "string",
                ScopeName = "string",
            },
        },
    });
    
    example, err := cognito.NewResourceServer(ctx, "resourceServerResource", &cognito.ResourceServerArgs{
    	Identifier: pulumi.String("string"),
    	UserPoolId: pulumi.String("string"),
    	Name:       pulumi.String("string"),
    	Scopes: cognito.ResourceServerScopeArray{
    		&cognito.ResourceServerScopeArgs{
    			ScopeDescription: pulumi.String("string"),
    			ScopeName:        pulumi.String("string"),
    		},
    	},
    })
    
    var resourceServerResource = new ResourceServer("resourceServerResource", ResourceServerArgs.builder()
        .identifier("string")
        .userPoolId("string")
        .name("string")
        .scopes(ResourceServerScopeArgs.builder()
            .scopeDescription("string")
            .scopeName("string")
            .build())
        .build());
    
    resource_server_resource = aws.cognito.ResourceServer("resourceServerResource",
        identifier="string",
        user_pool_id="string",
        name="string",
        scopes=[{
            "scope_description": "string",
            "scope_name": "string",
        }])
    
    const resourceServerResource = new aws.cognito.ResourceServer("resourceServerResource", {
        identifier: "string",
        userPoolId: "string",
        name: "string",
        scopes: [{
            scopeDescription: "string",
            scopeName: "string",
        }],
    });
    
    type: aws:cognito:ResourceServer
    properties:
        identifier: string
        name: string
        scopes:
            - scopeDescription: string
              scopeName: string
        userPoolId: string
    

    ResourceServer Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The ResourceServer resource accepts the following input properties:

    Identifier string
    An identifier for the resource server.
    UserPoolId string
    User pool the client belongs to.
    Name string
    A name for the resource server.
    Scopes List<ResourceServerScope>
    A list of Authorization Scope.
    Identifier string
    An identifier for the resource server.
    UserPoolId string
    User pool the client belongs to.
    Name string
    A name for the resource server.
    Scopes []ResourceServerScopeArgs
    A list of Authorization Scope.
    identifier String
    An identifier for the resource server.
    userPoolId String
    User pool the client belongs to.
    name String
    A name for the resource server.
    scopes List<ResourceServerScope>
    A list of Authorization Scope.
    identifier string
    An identifier for the resource server.
    userPoolId string
    User pool the client belongs to.
    name string
    A name for the resource server.
    scopes ResourceServerScope[]
    A list of Authorization Scope.
    identifier str
    An identifier for the resource server.
    user_pool_id str
    User pool the client belongs to.
    name str
    A name for the resource server.
    scopes Sequence[ResourceServerScopeArgs]
    A list of Authorization Scope.
    identifier String
    An identifier for the resource server.
    userPoolId String
    User pool the client belongs to.
    name String
    A name for the resource server.
    scopes List<Property Map>
    A list of Authorization Scope.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ResourceServer resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    ScopeIdentifiers List<string>
    A list of all scopes configured for this resource server in the format identifier/scope_name.
    Id string
    The provider-assigned unique ID for this managed resource.
    ScopeIdentifiers []string
    A list of all scopes configured for this resource server in the format identifier/scope_name.
    id String
    The provider-assigned unique ID for this managed resource.
    scopeIdentifiers List<String>
    A list of all scopes configured for this resource server in the format identifier/scope_name.
    id string
    The provider-assigned unique ID for this managed resource.
    scopeIdentifiers string[]
    A list of all scopes configured for this resource server in the format identifier/scope_name.
    id str
    The provider-assigned unique ID for this managed resource.
    scope_identifiers Sequence[str]
    A list of all scopes configured for this resource server in the format identifier/scope_name.
    id String
    The provider-assigned unique ID for this managed resource.
    scopeIdentifiers List<String>
    A list of all scopes configured for this resource server in the format identifier/scope_name.

    Look up Existing ResourceServer Resource

    Get an existing ResourceServer resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ResourceServerState, opts?: CustomResourceOptions): ResourceServer
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            identifier: Optional[str] = None,
            name: Optional[str] = None,
            scope_identifiers: Optional[Sequence[str]] = None,
            scopes: Optional[Sequence[ResourceServerScopeArgs]] = None,
            user_pool_id: Optional[str] = None) -> ResourceServer
    func GetResourceServer(ctx *Context, name string, id IDInput, state *ResourceServerState, opts ...ResourceOption) (*ResourceServer, error)
    public static ResourceServer Get(string name, Input<string> id, ResourceServerState? state, CustomResourceOptions? opts = null)
    public static ResourceServer get(String name, Output<String> id, ResourceServerState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Identifier string
    An identifier for the resource server.
    Name string
    A name for the resource server.
    ScopeIdentifiers List<string>
    A list of all scopes configured for this resource server in the format identifier/scope_name.
    Scopes List<ResourceServerScope>
    A list of Authorization Scope.
    UserPoolId string
    User pool the client belongs to.
    Identifier string
    An identifier for the resource server.
    Name string
    A name for the resource server.
    ScopeIdentifiers []string
    A list of all scopes configured for this resource server in the format identifier/scope_name.
    Scopes []ResourceServerScopeArgs
    A list of Authorization Scope.
    UserPoolId string
    User pool the client belongs to.
    identifier String
    An identifier for the resource server.
    name String
    A name for the resource server.
    scopeIdentifiers List<String>
    A list of all scopes configured for this resource server in the format identifier/scope_name.
    scopes List<ResourceServerScope>
    A list of Authorization Scope.
    userPoolId String
    User pool the client belongs to.
    identifier string
    An identifier for the resource server.
    name string
    A name for the resource server.
    scopeIdentifiers string[]
    A list of all scopes configured for this resource server in the format identifier/scope_name.
    scopes ResourceServerScope[]
    A list of Authorization Scope.
    userPoolId string
    User pool the client belongs to.
    identifier str
    An identifier for the resource server.
    name str
    A name for the resource server.
    scope_identifiers Sequence[str]
    A list of all scopes configured for this resource server in the format identifier/scope_name.
    scopes Sequence[ResourceServerScopeArgs]
    A list of Authorization Scope.
    user_pool_id str
    User pool the client belongs to.
    identifier String
    An identifier for the resource server.
    name String
    A name for the resource server.
    scopeIdentifiers List<String>
    A list of all scopes configured for this resource server in the format identifier/scope_name.
    scopes List<Property Map>
    A list of Authorization Scope.
    userPoolId String
    User pool the client belongs to.

    Supporting Types

    ResourceServerScope, ResourceServerScopeArgs

    ScopeDescription string
    The scope description.
    ScopeName string
    The scope name.
    ScopeDescription string
    The scope description.
    ScopeName string
    The scope name.
    scopeDescription String
    The scope description.
    scopeName String
    The scope name.
    scopeDescription string
    The scope description.
    scopeName string
    The scope name.
    scope_description str
    The scope description.
    scope_name str
    The scope name.
    scopeDescription String
    The scope description.
    scopeName String
    The scope name.

    Import

    Using pulumi import, import aws_cognito_resource_server using their User Pool ID and Identifier. For example:

    $ pulumi import aws:cognito/resourceServer:ResourceServer example "us-west-2_abc123|https://example.com"
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi