1. Packages
  2. Dynatrace
  3. API Docs
  4. getApiTokens
Dynatrace v0.27.0 published on Friday, Mar 21, 2025 by Pulumiverse

dynatrace.getApiTokens

Explore with Pulumi AI

Dynatrace v0.27.0 published on Friday, Mar 21, 2025 by Pulumiverse

The API tokens data source allows all access tokens to be retrieved, note the token value is not included in the response.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as dynatrace from "@pulumi/dynatrace";

const exampleApiTokens = dynatrace.getApiTokens({});
export const example = exampleApiTokens;
Copy
import pulumi
import pulumi_dynatrace as dynatrace

example_api_tokens = dynatrace.get_api_tokens()
pulumi.export("example", example_api_tokens)
Copy
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 {
		exampleApiTokens, err := dynatrace.GetApiTokens(ctx, map[string]interface{}{}, nil)
		if err != nil {
			return err
		}
		ctx.Export("example", exampleApiTokens)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Dynatrace = Pulumi.Dynatrace;

return await Deployment.RunAsync(() => 
{
    var exampleApiTokens = Dynatrace.GetApiTokens.Invoke();

    return new Dictionary<string, object?>
    {
        ["example"] = exampleApiTokens,
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.dynatrace.DynatraceFunctions;
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 exampleApiTokens = DynatraceFunctions.getApiTokens();

        ctx.export("example", exampleApiTokens.applyValue(getApiTokensResult -> getApiTokensResult));
    }
}
Copy
variables:
  exampleApiTokens:
    fn::invoke:
      function: dynatrace:getApiTokens
      arguments: {}
outputs:
  example: ${exampleApiTokens}
Copy

Using getApiTokens

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 getApiTokens(opts?: InvokeOptions): Promise<GetApiTokensResult>
function getApiTokensOutput(opts?: InvokeOptions): Output<GetApiTokensResult>
Copy
def get_api_tokens(opts: Optional[InvokeOptions] = None) -> GetApiTokensResult
def get_api_tokens_output(opts: Optional[InvokeOptions] = None) -> Output[GetApiTokensResult]
Copy
func GetApiTokens(ctx *Context, opts ...InvokeOption) (*GetApiTokensResult, error)
func GetApiTokensOutput(ctx *Context, opts ...InvokeOption) GetApiTokensResultOutput
Copy

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

public static class GetApiTokens 
{
    public static Task<GetApiTokensResult> InvokeAsync(InvokeOptions? opts = null)
    public static Output<GetApiTokensResult> Invoke(InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetApiTokensResult> getApiTokens(InvokeOptions options)
public static Output<GetApiTokensResult> getApiTokens(InvokeOptions options)
Copy
fn::invoke:
  function: dynatrace:index/getApiTokens:getApiTokens
  arguments:
    # arguments dictionary
Copy

getApiTokens Result

The following output properties are available:

ApiTokens List<Pulumiverse.Dynatrace.Outputs.GetApiTokensApiToken>
Id string
The provider-assigned unique ID for this managed resource.
ApiTokens []GetApiTokensApiToken
Id string
The provider-assigned unique ID for this managed resource.
apiTokens List<GetApiTokensApiToken>
id String
The provider-assigned unique ID for this managed resource.
apiTokens GetApiTokensApiToken[]
id string
The provider-assigned unique ID for this managed resource.
api_tokens Sequence[GetApiTokensApiToken]
id str
The provider-assigned unique ID for this managed resource.
apiTokens List<Property Map>
id String
The provider-assigned unique ID for this managed resource.

Supporting Types

GetApiTokensApiToken

CreationDate This property is required. string
Token creation date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')
LastUsedDate This property is required. string
Token last used date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')
LastUsedIpAddress This property is required. string
Token last used IP address.
ModifiedDate This property is required. string
Token last modified date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z').
Name This property is required. string
The name of the token.
Owner This property is required. string
The owner of the token
Scopes This property is required. List<string>
A list of the scopes to be assigned to the token.
Token This property is required. string
The secret of the token.
Enabled bool
The token is enabled (true) or disabled (false), default disabled (false).
ExpirationDate string
The expiration date of the token.
PersonalAccessToken bool
The token is a personal access token (true) or an API token (false).
CreationDate This property is required. string
Token creation date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')
LastUsedDate This property is required. string
Token last used date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')
LastUsedIpAddress This property is required. string
Token last used IP address.
ModifiedDate This property is required. string
Token last modified date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z').
Name This property is required. string
The name of the token.
Owner This property is required. string
The owner of the token
Scopes This property is required. []string
A list of the scopes to be assigned to the token.
Token This property is required. string
The secret of the token.
Enabled bool
The token is enabled (true) or disabled (false), default disabled (false).
ExpirationDate string
The expiration date of the token.
PersonalAccessToken bool
The token is a personal access token (true) or an API token (false).
creationDate This property is required. String
Token creation date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')
lastUsedDate This property is required. String
Token last used date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')
lastUsedIpAddress This property is required. String
Token last used IP address.
modifiedDate This property is required. String
Token last modified date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z').
name This property is required. String
The name of the token.
owner This property is required. String
The owner of the token
scopes This property is required. List<String>
A list of the scopes to be assigned to the token.
token This property is required. String
The secret of the token.
enabled Boolean
The token is enabled (true) or disabled (false), default disabled (false).
expirationDate String
The expiration date of the token.
personalAccessToken Boolean
The token is a personal access token (true) or an API token (false).
creationDate This property is required. string
Token creation date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')
lastUsedDate This property is required. string
Token last used date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')
lastUsedIpAddress This property is required. string
Token last used IP address.
modifiedDate This property is required. string
Token last modified date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z').
name This property is required. string
The name of the token.
owner This property is required. string
The owner of the token
scopes This property is required. string[]
A list of the scopes to be assigned to the token.
token This property is required. string
The secret of the token.
enabled boolean
The token is enabled (true) or disabled (false), default disabled (false).
expirationDate string
The expiration date of the token.
personalAccessToken boolean
The token is a personal access token (true) or an API token (false).
creation_date This property is required. str
Token creation date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')
last_used_date This property is required. str
Token last used date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')
last_used_ip_address This property is required. str
Token last used IP address.
modified_date This property is required. str
Token last modified date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z').
name This property is required. str
The name of the token.
owner This property is required. str
The owner of the token
scopes This property is required. Sequence[str]
A list of the scopes to be assigned to the token.
token This property is required. str
The secret of the token.
enabled bool
The token is enabled (true) or disabled (false), default disabled (false).
expiration_date str
The expiration date of the token.
personal_access_token bool
The token is a personal access token (true) or an API token (false).
creationDate This property is required. String
Token creation date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')
lastUsedDate This property is required. String
Token last used date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')
lastUsedIpAddress This property is required. String
Token last used IP address.
modifiedDate This property is required. String
Token last modified date in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS'Z').
name This property is required. String
The name of the token.
owner This property is required. String
The owner of the token
scopes This property is required. List<String>
A list of the scopes to be assigned to the token.
token This property is required. String
The secret of the token.
enabled Boolean
The token is enabled (true) or disabled (false), default disabled (false).
expirationDate String
The expiration date of the token.
personalAccessToken Boolean
The token is a personal access token (true) or an API token (false).

Package Details

Repository
dynatrace pulumiverse/pulumi-dynatrace
License
Apache-2.0
Notes
This Pulumi package is based on the dynatrace Terraform Provider.
Dynatrace v0.27.0 published on Friday, Mar 21, 2025 by Pulumiverse