1. Packages
  2. Ionoscloud
  3. API Docs
  4. creg
  5. getRegistryToken
IonosCloud v0.2.2 published on Monday, May 12, 2025 by ionos-cloud

ionoscloud.creg.getRegistryToken

Explore with Pulumi AI

ionoscloud logo
IonosCloud v0.2.2 published on Monday, May 12, 2025 by ionos-cloud

    The Container Registry Token data source can be used to search for and return an existing Container Registry Token. You can provide a string for the name parameter which will be compared with provisioned Container Registry Token. If a single match is found, it will be returned. If your search results in multiple matches, an error will be returned. When this happens, please refine your search and make sure that your resources have unique names.

    Example Usage

    By Id

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const example = ionoscloud.creg.getRegistryToken({
        registryId: exampleIonoscloudContainerRegistry.id,
        id: "token_id",
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.creg.get_registry_token(registry_id=example_ionoscloud_container_registry["id"],
        id="token_id")
    
    package main
    
    import (
    	"github.com/ionos-cloud/pulumi-ionoscloud/sdk/go/ionoscloud/creg"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := creg.LookupRegistryToken(ctx, &creg.LookupRegistryTokenArgs{
    			RegistryId: exampleIonoscloudContainerRegistry.Id,
    			Id:         pulumi.StringRef("token_id"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ionoscloud.Creg.GetRegistryToken.Invoke(new()
        {
            RegistryId = exampleIonoscloudContainerRegistry.Id,
            Id = "token_id",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.creg.CregFunctions;
    import com.pulumi.ionoscloud.creg.inputs.GetRegistryTokenArgs;
    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 example = CregFunctions.getRegistryToken(GetRegistryTokenArgs.builder()
                .registryId(exampleIonoscloudContainerRegistry.id())
                .id("token_id")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ionoscloud:creg:getRegistryToken
          arguments:
            registryId: ${exampleIonoscloudContainerRegistry.id}
            id: token_id
    

    By Name

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const example = ionoscloud.creg.getRegistryToken({
        registryId: exampleIonoscloudContainerRegistry.id,
        name: "container-registry-token-example",
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.creg.get_registry_token(registry_id=example_ionoscloud_container_registry["id"],
        name="container-registry-token-example")
    
    package main
    
    import (
    	"github.com/ionos-cloud/pulumi-ionoscloud/sdk/go/ionoscloud/creg"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := creg.LookupRegistryToken(ctx, &creg.LookupRegistryTokenArgs{
    			RegistryId: exampleIonoscloudContainerRegistry.Id,
    			Name:       pulumi.StringRef("container-registry-token-example"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ionoscloud.Creg.GetRegistryToken.Invoke(new()
        {
            RegistryId = exampleIonoscloudContainerRegistry.Id,
            Name = "container-registry-token-example",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.creg.CregFunctions;
    import com.pulumi.ionoscloud.creg.inputs.GetRegistryTokenArgs;
    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 example = CregFunctions.getRegistryToken(GetRegistryTokenArgs.builder()
                .registryId(exampleIonoscloudContainerRegistry.id())
                .name("container-registry-token-example")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ionoscloud:creg:getRegistryToken
          arguments:
            registryId: ${exampleIonoscloudContainerRegistry.id}
            name: container-registry-token-example
    

    By Name with Partial Match

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const example = ionoscloud.creg.getRegistryToken({
        registryId: exampleIonoscloudContainerRegistry.id,
        name: "-example",
        partialMatch: true,
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.creg.get_registry_token(registry_id=example_ionoscloud_container_registry["id"],
        name="-example",
        partial_match=True)
    
    package main
    
    import (
    	"github.com/ionos-cloud/pulumi-ionoscloud/sdk/go/ionoscloud/creg"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := creg.LookupRegistryToken(ctx, &creg.LookupRegistryTokenArgs{
    			RegistryId:   exampleIonoscloudContainerRegistry.Id,
    			Name:         pulumi.StringRef("-example"),
    			PartialMatch: pulumi.BoolRef(true),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ionoscloud.Creg.GetRegistryToken.Invoke(new()
        {
            RegistryId = exampleIonoscloudContainerRegistry.Id,
            Name = "-example",
            PartialMatch = true,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.creg.CregFunctions;
    import com.pulumi.ionoscloud.creg.inputs.GetRegistryTokenArgs;
    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 example = CregFunctions.getRegistryToken(GetRegistryTokenArgs.builder()
                .registryId(exampleIonoscloudContainerRegistry.id())
                .name("-example")
                .partialMatch(true)
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ionoscloud:creg:getRegistryToken
          arguments:
            registryId: ${exampleIonoscloudContainerRegistry.id}
            name: -example
            partialMatch: true
    

    Using getRegistryToken

    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 getRegistryToken(args: GetRegistryTokenArgs, opts?: InvokeOptions): Promise<GetRegistryTokenResult>
    function getRegistryTokenOutput(args: GetRegistryTokenOutputArgs, opts?: InvokeOptions): Output<GetRegistryTokenResult>
    def get_registry_token(id: Optional[str] = None,
                           name: Optional[str] = None,
                           partial_match: Optional[bool] = None,
                           registry_id: Optional[str] = None,
                           opts: Optional[InvokeOptions] = None) -> GetRegistryTokenResult
    def get_registry_token_output(id: Optional[pulumi.Input[str]] = None,
                           name: Optional[pulumi.Input[str]] = None,
                           partial_match: Optional[pulumi.Input[bool]] = None,
                           registry_id: Optional[pulumi.Input[str]] = None,
                           opts: Optional[InvokeOptions] = None) -> Output[GetRegistryTokenResult]
    func LookupRegistryToken(ctx *Context, args *LookupRegistryTokenArgs, opts ...InvokeOption) (*LookupRegistryTokenResult, error)
    func LookupRegistryTokenOutput(ctx *Context, args *LookupRegistryTokenOutputArgs, opts ...InvokeOption) LookupRegistryTokenResultOutput

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

    public static class GetRegistryToken 
    {
        public static Task<GetRegistryTokenResult> InvokeAsync(GetRegistryTokenArgs args, InvokeOptions? opts = null)
        public static Output<GetRegistryTokenResult> Invoke(GetRegistryTokenInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetRegistryTokenResult> getRegistryToken(GetRegistryTokenArgs args, InvokeOptions options)
    public static Output<GetRegistryTokenResult> getRegistryToken(GetRegistryTokenArgs args, InvokeOptions options)
    
    fn::invoke:
      function: ionoscloud:creg/getRegistryToken:getRegistryToken
      arguments:
        # arguments dictionary

    The following arguments are supported:

    RegistryId string
    Registry's UUID.
    Id string
    ID of the container registry token you want to search for.
    Name string
    Name of an existing container registry token that you want to search for. Search by name is case-insensitive. The whole resource name is required if partial_match parameter is not set to true.
    PartialMatch bool

    Whether partial matching is allowed or not when using name argument. Default value is false.

    registry_id and either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    RegistryId string
    Registry's UUID.
    Id string
    ID of the container registry token you want to search for.
    Name string
    Name of an existing container registry token that you want to search for. Search by name is case-insensitive. The whole resource name is required if partial_match parameter is not set to true.
    PartialMatch bool

    Whether partial matching is allowed or not when using name argument. Default value is false.

    registry_id and either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    registryId String
    Registry's UUID.
    id String
    ID of the container registry token you want to search for.
    name String
    Name of an existing container registry token that you want to search for. Search by name is case-insensitive. The whole resource name is required if partial_match parameter is not set to true.
    partialMatch Boolean

    Whether partial matching is allowed or not when using name argument. Default value is false.

    registry_id and either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    registryId string
    Registry's UUID.
    id string
    ID of the container registry token you want to search for.
    name string
    Name of an existing container registry token that you want to search for. Search by name is case-insensitive. The whole resource name is required if partial_match parameter is not set to true.
    partialMatch boolean

    Whether partial matching is allowed or not when using name argument. Default value is false.

    registry_id and either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    registry_id str
    Registry's UUID.
    id str
    ID of the container registry token you want to search for.
    name str
    Name of an existing container registry token that you want to search for. Search by name is case-insensitive. The whole resource name is required if partial_match parameter is not set to true.
    partial_match bool

    Whether partial matching is allowed or not when using name argument. Default value is false.

    registry_id and either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    registryId String
    Registry's UUID.
    id String
    ID of the container registry token you want to search for.
    name String
    Name of an existing container registry token that you want to search for. Search by name is case-insensitive. The whole resource name is required if partial_match parameter is not set to true.
    partialMatch Boolean

    Whether partial matching is allowed or not when using name argument. Default value is false.

    registry_id and either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    getRegistryToken Result

    The following output properties are available:

    Credentials []GetRegistryTokenCredential
    ExpiryDate string
    Id string
    Id of the container registry token.
    Name string
    RegistryId string
    Scopes []GetRegistryTokenScope
    Status string
    PartialMatch bool
    credentials List<GetRegistryTokenCredential>
    expiryDate String
    id String
    Id of the container registry token.
    name String
    registryId String
    scopes List<GetRegistryTokenScope>
    status String
    partialMatch Boolean
    credentials GetRegistryTokenCredential[]
    expiryDate string
    id string
    Id of the container registry token.
    name string
    registryId string
    scopes GetRegistryTokenScope[]
    status string
    partialMatch boolean
    credentials List<Property Map>
    expiryDate String
    id String
    Id of the container registry token.
    name String
    registryId String
    scopes List<Property Map>
    status String
    partialMatch Boolean

    Supporting Types

    GetRegistryTokenCredential

    Username string
    • expiry-date
    Username string
    • expiry-date
    username String
    • expiry-date
    username string
    • expiry-date
    username str
    • expiry-date
    username String
    • expiry-date

    GetRegistryTokenScope

    Actions List<string>
    Name string
    Name of an existing container registry token that you want to search for. Search by name is case-insensitive. The whole resource name is required if partial_match parameter is not set to true.
    Type string
    Actions []string
    Name string
    Name of an existing container registry token that you want to search for. Search by name is case-insensitive. The whole resource name is required if partial_match parameter is not set to true.
    Type string
    actions List<String>
    name String
    Name of an existing container registry token that you want to search for. Search by name is case-insensitive. The whole resource name is required if partial_match parameter is not set to true.
    type String
    actions string[]
    name string
    Name of an existing container registry token that you want to search for. Search by name is case-insensitive. The whole resource name is required if partial_match parameter is not set to true.
    type string
    actions Sequence[str]
    name str
    Name of an existing container registry token that you want to search for. Search by name is case-insensitive. The whole resource name is required if partial_match parameter is not set to true.
    type str
    actions List<String>
    name String
    Name of an existing container registry token that you want to search for. Search by name is case-insensitive. The whole resource name is required if partial_match parameter is not set to true.
    type String

    Package Details

    Repository
    ionoscloud ionos-cloud/pulumi-ionoscloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the ionoscloud Terraform Provider.
    ionoscloud logo
    IonosCloud v0.2.2 published on Monday, May 12, 2025 by ionos-cloud