1. Packages
  2. Keycloak Provider
  3. API Docs
  4. openid
  5. ClientOptionalScopes
Keycloak v5.3.5 published on Wednesday, Oct 16, 2024 by Pulumi

keycloak.openid.ClientOptionalScopes

Explore with Pulumi AI

keycloak logo
Keycloak v5.3.5 published on Wednesday, Oct 16, 2024 by Pulumi

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as keycloak from "@pulumi/keycloak";
    
    const realm = new keycloak.Realm("realm", {
        realm: "my-realm",
        enabled: true,
    });
    const client = new keycloak.openid.Client("client", {
        realmId: realm.id,
        clientId: "test-client",
        accessType: "CONFIDENTIAL",
    });
    const clientScope = new keycloak.openid.ClientScope("client_scope", {
        realmId: realm.id,
        name: "test-client-scope",
    });
    const clientOptionalScopes = new keycloak.openid.ClientOptionalScopes("client_optional_scopes", {
        realmId: realm.id,
        clientId: client.id,
        optionalScopes: [
            "address",
            "phone",
            "offline_access",
            clientScope.name,
        ],
    });
    
    import pulumi
    import pulumi_keycloak as keycloak
    
    realm = keycloak.Realm("realm",
        realm="my-realm",
        enabled=True)
    client = keycloak.openid.Client("client",
        realm_id=realm.id,
        client_id="test-client",
        access_type="CONFIDENTIAL")
    client_scope = keycloak.openid.ClientScope("client_scope",
        realm_id=realm.id,
        name="test-client-scope")
    client_optional_scopes = keycloak.openid.ClientOptionalScopes("client_optional_scopes",
        realm_id=realm.id,
        client_id=client.id,
        optional_scopes=[
            "address",
            "phone",
            "offline_access",
            client_scope.name,
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-keycloak/sdk/v5/go/keycloak"
    	"github.com/pulumi/pulumi-keycloak/sdk/v5/go/keycloak/openid"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		realm, err := keycloak.NewRealm(ctx, "realm", &keycloak.RealmArgs{
    			Realm:   pulumi.String("my-realm"),
    			Enabled: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		client, err := openid.NewClient(ctx, "client", &openid.ClientArgs{
    			RealmId:    realm.ID(),
    			ClientId:   pulumi.String("test-client"),
    			AccessType: pulumi.String("CONFIDENTIAL"),
    		})
    		if err != nil {
    			return err
    		}
    		clientScope, err := openid.NewClientScope(ctx, "client_scope", &openid.ClientScopeArgs{
    			RealmId: realm.ID(),
    			Name:    pulumi.String("test-client-scope"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = openid.NewClientOptionalScopes(ctx, "client_optional_scopes", &openid.ClientOptionalScopesArgs{
    			RealmId:  realm.ID(),
    			ClientId: client.ID(),
    			OptionalScopes: pulumi.StringArray{
    				pulumi.String("address"),
    				pulumi.String("phone"),
    				pulumi.String("offline_access"),
    				clientScope.Name,
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Keycloak = Pulumi.Keycloak;
    
    return await Deployment.RunAsync(() => 
    {
        var realm = new Keycloak.Realm("realm", new()
        {
            RealmName = "my-realm",
            Enabled = true,
        });
    
        var client = new Keycloak.OpenId.Client("client", new()
        {
            RealmId = realm.Id,
            ClientId = "test-client",
            AccessType = "CONFIDENTIAL",
        });
    
        var clientScope = new Keycloak.OpenId.ClientScope("client_scope", new()
        {
            RealmId = realm.Id,
            Name = "test-client-scope",
        });
    
        var clientOptionalScopes = new Keycloak.OpenId.ClientOptionalScopes("client_optional_scopes", new()
        {
            RealmId = realm.Id,
            ClientId = client.Id,
            OptionalScopes = new[]
            {
                "address",
                "phone",
                "offline_access",
                clientScope.Name,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.keycloak.Realm;
    import com.pulumi.keycloak.RealmArgs;
    import com.pulumi.keycloak.openid.Client;
    import com.pulumi.keycloak.openid.ClientArgs;
    import com.pulumi.keycloak.openid.ClientScope;
    import com.pulumi.keycloak.openid.ClientScopeArgs;
    import com.pulumi.keycloak.openid.ClientOptionalScopes;
    import com.pulumi.keycloak.openid.ClientOptionalScopesArgs;
    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 realm = new Realm("realm", RealmArgs.builder()
                .realm("my-realm")
                .enabled(true)
                .build());
    
            var client = new Client("client", ClientArgs.builder()
                .realmId(realm.id())
                .clientId("test-client")
                .accessType("CONFIDENTIAL")
                .build());
    
            var clientScope = new ClientScope("clientScope", ClientScopeArgs.builder()
                .realmId(realm.id())
                .name("test-client-scope")
                .build());
    
            var clientOptionalScopes = new ClientOptionalScopes("clientOptionalScopes", ClientOptionalScopesArgs.builder()
                .realmId(realm.id())
                .clientId(client.id())
                .optionalScopes(            
                    "address",
                    "phone",
                    "offline_access",
                    clientScope.name())
                .build());
    
        }
    }
    
    resources:
      realm:
        type: keycloak:Realm
        properties:
          realm: my-realm
          enabled: true
      client:
        type: keycloak:openid:Client
        properties:
          realmId: ${realm.id}
          clientId: test-client
          accessType: CONFIDENTIAL
      clientScope:
        type: keycloak:openid:ClientScope
        name: client_scope
        properties:
          realmId: ${realm.id}
          name: test-client-scope
      clientOptionalScopes:
        type: keycloak:openid:ClientOptionalScopes
        name: client_optional_scopes
        properties:
          realmId: ${realm.id}
          clientId: ${client.id}
          optionalScopes:
            - address
            - phone
            - offline_access
            - ${clientScope.name}
    

    Argument Reference

    The following arguments are supported:

    • realm_id - (Required) The realm this client and scopes exists in.
    • client_id - (Required) The ID of the client to attach optional scopes to. Note that this is the unique ID of the client generated by Keycloak.
    • optional_scopes - (Required) An array of client scope names to attach to this client as optional scopes.

    Import

    This resource does not support import. Instead of importing, feel free to create this resource as if it did not already exist on the server.

    Create ClientOptionalScopes Resource

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

    Constructor syntax

    new ClientOptionalScopes(name: string, args: ClientOptionalScopesArgs, opts?: CustomResourceOptions);
    @overload
    def ClientOptionalScopes(resource_name: str,
                             args: ClientOptionalScopesArgs,
                             opts: Optional[ResourceOptions] = None)
    
    @overload
    def ClientOptionalScopes(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             client_id: Optional[str] = None,
                             optional_scopes: Optional[Sequence[str]] = None,
                             realm_id: Optional[str] = None)
    func NewClientOptionalScopes(ctx *Context, name string, args ClientOptionalScopesArgs, opts ...ResourceOption) (*ClientOptionalScopes, error)
    public ClientOptionalScopes(string name, ClientOptionalScopesArgs args, CustomResourceOptions? opts = null)
    public ClientOptionalScopes(String name, ClientOptionalScopesArgs args)
    public ClientOptionalScopes(String name, ClientOptionalScopesArgs args, CustomResourceOptions options)
    
    type: keycloak:openid:ClientOptionalScopes
    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 ClientOptionalScopesArgs
    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 ClientOptionalScopesArgs
    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 ClientOptionalScopesArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ClientOptionalScopesArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ClientOptionalScopesArgs
    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 clientOptionalScopesResource = new Keycloak.OpenId.ClientOptionalScopes("clientOptionalScopesResource", new()
    {
        ClientId = "string",
        OptionalScopes = new[]
        {
            "string",
        },
        RealmId = "string",
    });
    
    example, err := openid.NewClientOptionalScopes(ctx, "clientOptionalScopesResource", &openid.ClientOptionalScopesArgs{
    	ClientId: pulumi.String("string"),
    	OptionalScopes: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	RealmId: pulumi.String("string"),
    })
    
    var clientOptionalScopesResource = new ClientOptionalScopes("clientOptionalScopesResource", ClientOptionalScopesArgs.builder()
        .clientId("string")
        .optionalScopes("string")
        .realmId("string")
        .build());
    
    client_optional_scopes_resource = keycloak.openid.ClientOptionalScopes("clientOptionalScopesResource",
        client_id="string",
        optional_scopes=["string"],
        realm_id="string")
    
    const clientOptionalScopesResource = new keycloak.openid.ClientOptionalScopes("clientOptionalScopesResource", {
        clientId: "string",
        optionalScopes: ["string"],
        realmId: "string",
    });
    
    type: keycloak:openid:ClientOptionalScopes
    properties:
        clientId: string
        optionalScopes:
            - string
        realmId: string
    

    ClientOptionalScopes 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 ClientOptionalScopes resource accepts the following input properties:

    ClientId string
    OptionalScopes List<string>
    RealmId string
    ClientId string
    OptionalScopes []string
    RealmId string
    clientId String
    optionalScopes List<String>
    realmId String
    clientId string
    optionalScopes string[]
    realmId string
    client_id str
    optional_scopes Sequence[str]
    realm_id str
    clientId String
    optionalScopes List<String>
    realmId String

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing ClientOptionalScopes Resource

    Get an existing ClientOptionalScopes 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?: ClientOptionalScopesState, opts?: CustomResourceOptions): ClientOptionalScopes
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            client_id: Optional[str] = None,
            optional_scopes: Optional[Sequence[str]] = None,
            realm_id: Optional[str] = None) -> ClientOptionalScopes
    func GetClientOptionalScopes(ctx *Context, name string, id IDInput, state *ClientOptionalScopesState, opts ...ResourceOption) (*ClientOptionalScopes, error)
    public static ClientOptionalScopes Get(string name, Input<string> id, ClientOptionalScopesState? state, CustomResourceOptions? opts = null)
    public static ClientOptionalScopes get(String name, Output<String> id, ClientOptionalScopesState 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:
    ClientId string
    OptionalScopes List<string>
    RealmId string
    ClientId string
    OptionalScopes []string
    RealmId string
    clientId String
    optionalScopes List<String>
    realmId String
    clientId string
    optionalScopes string[]
    realmId string
    client_id str
    optional_scopes Sequence[str]
    realm_id str
    clientId String
    optionalScopes List<String>
    realmId String

    Package Details

    Repository
    Keycloak pulumi/pulumi-keycloak
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the keycloak Terraform Provider.
    keycloak logo
    Keycloak v5.3.5 published on Wednesday, Oct 16, 2024 by Pulumi