1. Packages
  2. Keycloak
  3. API Docs
  4. openid
  5. getClientScope
Keycloak v5.3.1 published on Monday, Mar 11, 2024 by Pulumi

keycloak.openid.getClientScope

Explore with Pulumi AI

keycloak logo
Keycloak v5.3.1 published on Monday, Mar 11, 2024 by Pulumi

    This data source can be used to fetch properties of a Keycloak OpenID client scope for usage with other resources.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as keycloak from "@pulumi/keycloak";
    
    const offlineAccess = keycloak.openid.getClientScope({
        realmId: "my-realm",
        name: "offline_access",
    });
    // use the data source
    const audienceMapper = new keycloak.openid.AudienceProtocolMapper("audienceMapper", {
        realmId: offlineAccess.then(offlineAccess => offlineAccess.realmId),
        clientScopeId: offlineAccess.then(offlineAccess => offlineAccess.id),
        includedCustomAudience: "foo",
    });
    
    import pulumi
    import pulumi_keycloak as keycloak
    
    offline_access = keycloak.openid.get_client_scope(realm_id="my-realm",
        name="offline_access")
    # use the data source
    audience_mapper = keycloak.openid.AudienceProtocolMapper("audienceMapper",
        realm_id=offline_access.realm_id,
        client_scope_id=offline_access.id,
        included_custom_audience="foo")
    
    package main
    
    import (
    	"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 {
    		offlineAccess, err := openid.LookupClientScope(ctx, &openid.LookupClientScopeArgs{
    			RealmId: "my-realm",
    			Name:    "offline_access",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// use the data source
    		_, err = openid.NewAudienceProtocolMapper(ctx, "audienceMapper", &openid.AudienceProtocolMapperArgs{
    			RealmId:                *pulumi.String(offlineAccess.RealmId),
    			ClientScopeId:          *pulumi.String(offlineAccess.Id),
    			IncludedCustomAudience: pulumi.String("foo"),
    		})
    		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 offlineAccess = Keycloak.OpenId.GetClientScope.Invoke(new()
        {
            RealmId = "my-realm",
            Name = "offline_access",
        });
    
        // use the data source
        var audienceMapper = new Keycloak.OpenId.AudienceProtocolMapper("audienceMapper", new()
        {
            RealmId = offlineAccess.Apply(getClientScopeResult => getClientScopeResult.RealmId),
            ClientScopeId = offlineAccess.Apply(getClientScopeResult => getClientScopeResult.Id),
            IncludedCustomAudience = "foo",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.keycloak.openid.OpenidFunctions;
    import com.pulumi.keycloak.openid.inputs.GetClientScopeArgs;
    import com.pulumi.keycloak.openid.AudienceProtocolMapper;
    import com.pulumi.keycloak.openid.AudienceProtocolMapperArgs;
    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) {
            final var offlineAccess = OpenidFunctions.getClientScope(GetClientScopeArgs.builder()
                .realmId("my-realm")
                .name("offline_access")
                .build());
    
            var audienceMapper = new AudienceProtocolMapper("audienceMapper", AudienceProtocolMapperArgs.builder()        
                .realmId(offlineAccess.applyValue(getClientScopeResult -> getClientScopeResult.realmId()))
                .clientScopeId(offlineAccess.applyValue(getClientScopeResult -> getClientScopeResult.id()))
                .includedCustomAudience("foo")
                .build());
    
        }
    }
    
    resources:
      # use the data source
      audienceMapper:
        type: keycloak:openid:AudienceProtocolMapper
        properties:
          realmId: ${offlineAccess.realmId}
          clientScopeId: ${offlineAccess.id}
          includedCustomAudience: foo
    variables:
      offlineAccess:
        fn::invoke:
          Function: keycloak:openid:getClientScope
          Arguments:
            realmId: my-realm
            name: offline_access
    

    Using getClientScope

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getClientScope(args: GetClientScopeArgs, opts?: InvokeOptions): Promise<GetClientScopeResult>
    function getClientScopeOutput(args: GetClientScopeOutputArgs, opts?: InvokeOptions): Output<GetClientScopeResult>
    def get_client_scope(name: Optional[str] = None,
                         realm_id: Optional[str] = None,
                         opts: Optional[InvokeOptions] = None) -> GetClientScopeResult
    def get_client_scope_output(name: Optional[pulumi.Input[str]] = None,
                         realm_id: Optional[pulumi.Input[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetClientScopeResult]
    func LookupClientScope(ctx *Context, args *LookupClientScopeArgs, opts ...InvokeOption) (*LookupClientScopeResult, error)
    func LookupClientScopeOutput(ctx *Context, args *LookupClientScopeOutputArgs, opts ...InvokeOption) LookupClientScopeResultOutput

    > Note: This function is named LookupClientScope in the Go SDK.

    public static class GetClientScope 
    {
        public static Task<GetClientScopeResult> InvokeAsync(GetClientScopeArgs args, InvokeOptions? opts = null)
        public static Output<GetClientScopeResult> Invoke(GetClientScopeInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetClientScopeResult> getClientScope(GetClientScopeArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: keycloak:openid/getClientScope:getClientScope
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    The name of the client scope.
    RealmId string
    The realm id.
    Name string
    The name of the client scope.
    RealmId string
    The realm id.
    name String
    The name of the client scope.
    realmId String
    The realm id.
    name string
    The name of the client scope.
    realmId string
    The realm id.
    name str
    The name of the client scope.
    realm_id str
    The realm id.
    name String
    The name of the client scope.
    realmId String
    The realm id.

    getClientScope Result

    The following output properties are available:

    ConsentScreenText string
    Description string
    GuiOrder int
    Id string
    The provider-assigned unique ID for this managed resource.
    IncludeInTokenScope bool
    Name string
    RealmId string
    ConsentScreenText string
    Description string
    GuiOrder int
    Id string
    The provider-assigned unique ID for this managed resource.
    IncludeInTokenScope bool
    Name string
    RealmId string
    consentScreenText String
    description String
    guiOrder Integer
    id String
    The provider-assigned unique ID for this managed resource.
    includeInTokenScope Boolean
    name String
    realmId String
    consentScreenText string
    description string
    guiOrder number
    id string
    The provider-assigned unique ID for this managed resource.
    includeInTokenScope boolean
    name string
    realmId string
    consent_screen_text str
    description str
    gui_order int
    id str
    The provider-assigned unique ID for this managed resource.
    include_in_token_scope bool
    name str
    realm_id str
    consentScreenText String
    description String
    guiOrder Number
    id String
    The provider-assigned unique ID for this managed resource.
    includeInTokenScope Boolean
    name 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.1 published on Monday, Mar 11, 2024 by Pulumi