1. Packages
  2. Dynatrace
  3. API Docs
  4. getApiToken
Dynatrace v0.21.0 published on Sunday, Nov 17, 2024 by Pulumiverse

dynatrace.getApiToken

Explore with Pulumi AI

dynatrace logo
Dynatrace v0.21.0 published on Sunday, Nov 17, 2024 by Pulumiverse

    The API token data source allows a single access token to be retrieved by its name, note the token value is not included in the response.

    If multiple tokens match the given name, the first result will be retrieved. To retrieve multiple tokens of the same name, please utilize the dynatrace.getApiTokens data source.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as dynatrace from "@pulumi/dynatrace";
    
    const exampleApiToken = dynatrace.getApiToken({
        name: "Terraform",
    });
    export const example = exampleApiToken;
    
    import pulumi
    import pulumi_dynatrace as dynatrace
    
    example_api_token = dynatrace.get_api_token(name="Terraform")
    pulumi.export("example", example_api_token)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-dynatrace/sdk/go/dynatrace"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleApiToken, err := dynatrace.LookupApiToken(ctx, &dynatrace.LookupApiTokenArgs{
    			Name: "Terraform",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("example", exampleApiToken)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Dynatrace = Pulumi.Dynatrace;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleApiToken = Dynatrace.GetApiToken.Invoke(new()
        {
            Name = "Terraform",
        });
    
        return new Dictionary<string, object?>
        {
            ["example"] = exampleApiToken,
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.dynatrace.DynatraceFunctions;
    import com.pulumi.dynatrace.inputs.GetApiTokenArgs;
    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 exampleApiToken = DynatraceFunctions.getApiToken(GetApiTokenArgs.builder()
                .name("Terraform")
                .build());
    
            ctx.export("example", exampleApiToken.applyValue(getApiTokenResult -> getApiTokenResult));
        }
    }
    
    variables:
      exampleApiToken:
        fn::invoke:
          Function: dynatrace:getApiToken
          Arguments:
            name: Terraform
    outputs:
      example: ${exampleApiToken}
    

    Using getApiToken

    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 getApiToken(args: GetApiTokenArgs, opts?: InvokeOptions): Promise<GetApiTokenResult>
    function getApiTokenOutput(args: GetApiTokenOutputArgs, opts?: InvokeOptions): Output<GetApiTokenResult>
    def get_api_token(name: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetApiTokenResult
    def get_api_token_output(name: Optional[pulumi.Input[str]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetApiTokenResult]
    func LookupApiToken(ctx *Context, args *LookupApiTokenArgs, opts ...InvokeOption) (*LookupApiTokenResult, error)
    func LookupApiTokenOutput(ctx *Context, args *LookupApiTokenOutputArgs, opts ...InvokeOption) LookupApiTokenResultOutput

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

    public static class GetApiToken 
    {
        public static Task<GetApiTokenResult> InvokeAsync(GetApiTokenArgs args, InvokeOptions? opts = null)
        public static Output<GetApiTokenResult> Invoke(GetApiTokenInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetApiTokenResult> getApiToken(GetApiTokenArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: dynatrace:index/getApiToken:getApiToken
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    Name string
    name String
    name string
    name str
    name String

    getApiToken Result

    The following output properties are available:

    CreationDate string
    Token creation date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')
    Enabled bool
    The token is enabled (true) or disabled (false), default disabled (false).
    ExpirationDate string
    The expiration date of the token.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    Owner string
    The owner of the token
    PersonalAccessToken bool
    The token is a personal access token (true) or an API token (false).
    Scopes List<string>
    A list of the scopes to be assigned to the token.
    CreationDate string
    Token creation date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')
    Enabled bool
    The token is enabled (true) or disabled (false), default disabled (false).
    ExpirationDate string
    The expiration date of the token.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    Owner string
    The owner of the token
    PersonalAccessToken bool
    The token is a personal access token (true) or an API token (false).
    Scopes []string
    A list of the scopes to be assigned to the token.
    creationDate String
    Token creation date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')
    enabled Boolean
    The token is enabled (true) or disabled (false), default disabled (false).
    expirationDate String
    The expiration date of the token.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    owner String
    The owner of the token
    personalAccessToken Boolean
    The token is a personal access token (true) or an API token (false).
    scopes List<String>
    A list of the scopes to be assigned to the token.
    creationDate string
    Token creation date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')
    enabled boolean
    The token is enabled (true) or disabled (false), default disabled (false).
    expirationDate string
    The expiration date of the token.
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    owner string
    The owner of the token
    personalAccessToken boolean
    The token is a personal access token (true) or an API token (false).
    scopes string[]
    A list of the scopes to be assigned to the token.
    creation_date str
    Token creation date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')
    enabled bool
    The token is enabled (true) or disabled (false), default disabled (false).
    expiration_date str
    The expiration date of the token.
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    owner str
    The owner of the token
    personal_access_token bool
    The token is a personal access token (true) or an API token (false).
    scopes Sequence[str]
    A list of the scopes to be assigned to the token.
    creationDate String
    Token creation date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')
    enabled Boolean
    The token is enabled (true) or disabled (false), default disabled (false).
    expirationDate String
    The expiration date of the token.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    owner String
    The owner of the token
    personalAccessToken Boolean
    The token is a personal access token (true) or an API token (false).
    scopes List<String>
    A list of the scopes to be assigned to the token.

    Package Details

    Repository
    dynatrace pulumiverse/pulumi-dynatrace
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the dynatrace Terraform Provider.
    dynatrace logo
    Dynatrace v0.21.0 published on Sunday, Nov 17, 2024 by Pulumiverse