Harness v0.7.0 published on Friday, Mar 28, 2025 by Pulumi
harness.platform.getToken
Explore with Pulumi AI
Data source for retrieving a Harness ApiKey Token.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as harness from "@pulumi/harness";
const test = harness.platform.getToken({
    identifier: "test_token",
    parentId: "apikey_parent_id",
    orgId: "org_id",
    projectId: "project_id",
    apikeyId: "apikey_id",
    apikeyType: "USER",
});
import pulumi
import pulumi_harness as harness
test = harness.platform.get_token(identifier="test_token",
    parent_id="apikey_parent_id",
    org_id="org_id",
    project_id="project_id",
    apikey_id="apikey_id",
    apikey_type="USER")
package main
import (
	"github.com/pulumi/pulumi-harness/sdk/go/harness/platform"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := platform.LookupToken(ctx, &platform.LookupTokenArgs{
			Identifier: "test_token",
			ParentId:   "apikey_parent_id",
			OrgId:      pulumi.StringRef("org_id"),
			ProjectId:  pulumi.StringRef("project_id"),
			ApikeyId:   "apikey_id",
			ApikeyType: "USER",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Harness = Pulumi.Harness;
return await Deployment.RunAsync(() => 
{
    var test = Harness.Platform.GetToken.Invoke(new()
    {
        Identifier = "test_token",
        ParentId = "apikey_parent_id",
        OrgId = "org_id",
        ProjectId = "project_id",
        ApikeyId = "apikey_id",
        ApikeyType = "USER",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.harness.platform.PlatformFunctions;
import com.pulumi.harness.platform.inputs.GetTokenArgs;
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 test = PlatformFunctions.getToken(GetTokenArgs.builder()
            .identifier("test_token")
            .parentId("apikey_parent_id")
            .orgId("org_id")
            .projectId("project_id")
            .apikeyId("apikey_id")
            .apikeyType("USER")
            .build());
    }
}
variables:
  test:
    fn::invoke:
      function: harness:platform:getToken
      arguments:
        identifier: test_token
        parentId: apikey_parent_id
        orgId: org_id
        projectId: project_id
        apikeyId: apikey_id
        apikeyType: USER
Using getToken
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 getToken(args: GetTokenArgs, opts?: InvokeOptions): Promise<GetTokenResult>
function getTokenOutput(args: GetTokenOutputArgs, opts?: InvokeOptions): Output<GetTokenResult>def get_token(account_id: Optional[str] = None,
              apikey_id: Optional[str] = None,
              apikey_type: Optional[str] = None,
              email: Optional[str] = None,
              encoded_password: Optional[str] = None,
              identifier: Optional[str] = None,
              name: Optional[str] = None,
              org_id: Optional[str] = None,
              parent_id: Optional[str] = None,
              project_id: Optional[str] = None,
              scheduled_expire_time: Optional[int] = None,
              username: Optional[str] = None,
              valid: Optional[bool] = None,
              valid_from: Optional[int] = None,
              valid_to: Optional[int] = None,
              opts: Optional[InvokeOptions] = None) -> GetTokenResult
def get_token_output(account_id: Optional[pulumi.Input[str]] = None,
              apikey_id: Optional[pulumi.Input[str]] = None,
              apikey_type: Optional[pulumi.Input[str]] = None,
              email: Optional[pulumi.Input[str]] = None,
              encoded_password: Optional[pulumi.Input[str]] = None,
              identifier: Optional[pulumi.Input[str]] = None,
              name: Optional[pulumi.Input[str]] = None,
              org_id: Optional[pulumi.Input[str]] = None,
              parent_id: Optional[pulumi.Input[str]] = None,
              project_id: Optional[pulumi.Input[str]] = None,
              scheduled_expire_time: Optional[pulumi.Input[int]] = None,
              username: Optional[pulumi.Input[str]] = None,
              valid: Optional[pulumi.Input[bool]] = None,
              valid_from: Optional[pulumi.Input[int]] = None,
              valid_to: Optional[pulumi.Input[int]] = None,
              opts: Optional[InvokeOptions] = None) -> Output[GetTokenResult]func LookupToken(ctx *Context, args *LookupTokenArgs, opts ...InvokeOption) (*LookupTokenResult, error)
func LookupTokenOutput(ctx *Context, args *LookupTokenOutputArgs, opts ...InvokeOption) LookupTokenResultOutput> Note: This function is named LookupToken in the Go SDK.
public static class GetToken 
{
    public static Task<GetTokenResult> InvokeAsync(GetTokenArgs args, InvokeOptions? opts = null)
    public static Output<GetTokenResult> Invoke(GetTokenInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetTokenResult> getToken(GetTokenArgs args, InvokeOptions options)
public static Output<GetTokenResult> getToken(GetTokenArgs args, InvokeOptions options)
fn::invoke:
  function: harness:platform/getToken:getToken
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Account
Id string - Account Identifier for the Entity
 - Apikey
Id string - Identifier of the API Key
 - Apikey
Type string - Type of the API Key
 - Identifier string
 - Unique identifier of the resource.
 - Parent
Id string - Parent Entity Identifier of the API Key
 - Email string
 - Email Id of the user who created the Token
 - Encoded
Password string - Encoded password of the Token
 - Name string
 - Name of the resource.
 - Org
Id string - Unique identifier of the organization.
 - Project
Id string - Unique identifier of the project.
 - Scheduled
Expire intTime  - Scheduled expiry time in milliseconds
 - Username string
 - Name of the user who created the Token
 - Valid bool
 - Boolean value to indicate if Token is valid or not.
 - Valid
From int - This is the time from which the Token is valid. The time is in milliseconds
 - Valid
To int - This is the time till which the Token is valid. The time is in milliseconds
 
- Account
Id string - Account Identifier for the Entity
 - Apikey
Id string - Identifier of the API Key
 - Apikey
Type string - Type of the API Key
 - Identifier string
 - Unique identifier of the resource.
 - Parent
Id string - Parent Entity Identifier of the API Key
 - Email string
 - Email Id of the user who created the Token
 - Encoded
Password string - Encoded password of the Token
 - Name string
 - Name of the resource.
 - Org
Id string - Unique identifier of the organization.
 - Project
Id string - Unique identifier of the project.
 - Scheduled
Expire intTime  - Scheduled expiry time in milliseconds
 - Username string
 - Name of the user who created the Token
 - Valid bool
 - Boolean value to indicate if Token is valid or not.
 - Valid
From int - This is the time from which the Token is valid. The time is in milliseconds
 - Valid
To int - This is the time till which the Token is valid. The time is in milliseconds
 
- account
Id String - Account Identifier for the Entity
 - apikey
Id String - Identifier of the API Key
 - apikey
Type String - Type of the API Key
 - identifier String
 - Unique identifier of the resource.
 - parent
Id String - Parent Entity Identifier of the API Key
 - email String
 - Email Id of the user who created the Token
 - encoded
Password String - Encoded password of the Token
 - name String
 - Name of the resource.
 - org
Id String - Unique identifier of the organization.
 - project
Id String - Unique identifier of the project.
 - scheduled
Expire IntegerTime  - Scheduled expiry time in milliseconds
 - username String
 - Name of the user who created the Token
 - valid Boolean
 - Boolean value to indicate if Token is valid or not.
 - valid
From Integer - This is the time from which the Token is valid. The time is in milliseconds
 - valid
To Integer - This is the time till which the Token is valid. The time is in milliseconds
 
- account
Id string - Account Identifier for the Entity
 - apikey
Id string - Identifier of the API Key
 - apikey
Type string - Type of the API Key
 - identifier string
 - Unique identifier of the resource.
 - parent
Id string - Parent Entity Identifier of the API Key
 - email string
 - Email Id of the user who created the Token
 - encoded
Password string - Encoded password of the Token
 - name string
 - Name of the resource.
 - org
Id string - Unique identifier of the organization.
 - project
Id string - Unique identifier of the project.
 - scheduled
Expire numberTime  - Scheduled expiry time in milliseconds
 - username string
 - Name of the user who created the Token
 - valid boolean
 - Boolean value to indicate if Token is valid or not.
 - valid
From number - This is the time from which the Token is valid. The time is in milliseconds
 - valid
To number - This is the time till which the Token is valid. The time is in milliseconds
 
- account_
id str - Account Identifier for the Entity
 - apikey_
id str - Identifier of the API Key
 - apikey_
type str - Type of the API Key
 - identifier str
 - Unique identifier of the resource.
 - parent_
id str - Parent Entity Identifier of the API Key
 - email str
 - Email Id of the user who created the Token
 - encoded_
password str - Encoded password of the Token
 - name str
 - Name of the resource.
 - org_
id str - Unique identifier of the organization.
 - project_
id str - Unique identifier of the project.
 - scheduled_
expire_ inttime  - Scheduled expiry time in milliseconds
 - username str
 - Name of the user who created the Token
 - valid bool
 - Boolean value to indicate if Token is valid or not.
 - valid_
from int - This is the time from which the Token is valid. The time is in milliseconds
 - valid_
to int - This is the time till which the Token is valid. The time is in milliseconds
 
- account
Id String - Account Identifier for the Entity
 - apikey
Id String - Identifier of the API Key
 - apikey
Type String - Type of the API Key
 - identifier String
 - Unique identifier of the resource.
 - parent
Id String - Parent Entity Identifier of the API Key
 - email String
 - Email Id of the user who created the Token
 - encoded
Password String - Encoded password of the Token
 - name String
 - Name of the resource.
 - org
Id String - Unique identifier of the organization.
 - project
Id String - Unique identifier of the project.
 - scheduled
Expire NumberTime  - Scheduled expiry time in milliseconds
 - username String
 - Name of the user who created the Token
 - valid Boolean
 - Boolean value to indicate if Token is valid or not.
 - valid
From Number - This is the time from which the Token is valid. The time is in milliseconds
 - valid
To Number - This is the time till which the Token is valid. The time is in milliseconds
 
getToken Result
The following output properties are available:
- Account
Id string - Account Identifier for the Entity
 - Apikey
Id string - Identifier of the API Key
 - Apikey
Type string - Type of the API Key
 - Description string
 - Description of the resource.
 - Id string
 - The provider-assigned unique ID for this managed resource.
 - Identifier string
 - Unique identifier of the resource.
 - Parent
Id string - Parent Entity Identifier of the API Key
 - List<string>
 - Tags to associate with the resource.
 - Email string
 - Email Id of the user who created the Token
 - Encoded
Password string - Encoded password of the Token
 - Name string
 - Name of the resource.
 - Org
Id string - Unique identifier of the organization.
 - Project
Id string - Unique identifier of the project.
 - Scheduled
Expire intTime  - Scheduled expiry time in milliseconds
 - Username string
 - Name of the user who created the Token
 - Valid bool
 - Boolean value to indicate if Token is valid or not.
 - Valid
From int - This is the time from which the Token is valid. The time is in milliseconds
 - Valid
To int - This is the time till which the Token is valid. The time is in milliseconds
 
- Account
Id string - Account Identifier for the Entity
 - Apikey
Id string - Identifier of the API Key
 - Apikey
Type string - Type of the API Key
 - Description string
 - Description of the resource.
 - Id string
 - The provider-assigned unique ID for this managed resource.
 - Identifier string
 - Unique identifier of the resource.
 - Parent
Id string - Parent Entity Identifier of the API Key
 - []string
 - Tags to associate with the resource.
 - Email string
 - Email Id of the user who created the Token
 - Encoded
Password string - Encoded password of the Token
 - Name string
 - Name of the resource.
 - Org
Id string - Unique identifier of the organization.
 - Project
Id string - Unique identifier of the project.
 - Scheduled
Expire intTime  - Scheduled expiry time in milliseconds
 - Username string
 - Name of the user who created the Token
 - Valid bool
 - Boolean value to indicate if Token is valid or not.
 - Valid
From int - This is the time from which the Token is valid. The time is in milliseconds
 - Valid
To int - This is the time till which the Token is valid. The time is in milliseconds
 
- account
Id String - Account Identifier for the Entity
 - apikey
Id String - Identifier of the API Key
 - apikey
Type String - Type of the API Key
 - description String
 - Description of the resource.
 - id String
 - The provider-assigned unique ID for this managed resource.
 - identifier String
 - Unique identifier of the resource.
 - parent
Id String - Parent Entity Identifier of the API Key
 - List<String>
 - Tags to associate with the resource.
 - email String
 - Email Id of the user who created the Token
 - encoded
Password String - Encoded password of the Token
 - name String
 - Name of the resource.
 - org
Id String - Unique identifier of the organization.
 - project
Id String - Unique identifier of the project.
 - scheduled
Expire IntegerTime  - Scheduled expiry time in milliseconds
 - username String
 - Name of the user who created the Token
 - valid Boolean
 - Boolean value to indicate if Token is valid or not.
 - valid
From Integer - This is the time from which the Token is valid. The time is in milliseconds
 - valid
To Integer - This is the time till which the Token is valid. The time is in milliseconds
 
- account
Id string - Account Identifier for the Entity
 - apikey
Id string - Identifier of the API Key
 - apikey
Type string - Type of the API Key
 - description string
 - Description of the resource.
 - id string
 - The provider-assigned unique ID for this managed resource.
 - identifier string
 - Unique identifier of the resource.
 - parent
Id string - Parent Entity Identifier of the API Key
 - string[]
 - Tags to associate with the resource.
 - email string
 - Email Id of the user who created the Token
 - encoded
Password string - Encoded password of the Token
 - name string
 - Name of the resource.
 - org
Id string - Unique identifier of the organization.
 - project
Id string - Unique identifier of the project.
 - scheduled
Expire numberTime  - Scheduled expiry time in milliseconds
 - username string
 - Name of the user who created the Token
 - valid boolean
 - Boolean value to indicate if Token is valid or not.
 - valid
From number - This is the time from which the Token is valid. The time is in milliseconds
 - valid
To number - This is the time till which the Token is valid. The time is in milliseconds
 
- account_
id str - Account Identifier for the Entity
 - apikey_
id str - Identifier of the API Key
 - apikey_
type str - Type of the API Key
 - description str
 - Description of the resource.
 - id str
 - The provider-assigned unique ID for this managed resource.
 - identifier str
 - Unique identifier of the resource.
 - parent_
id str - Parent Entity Identifier of the API Key
 - Sequence[str]
 - Tags to associate with the resource.
 - email str
 - Email Id of the user who created the Token
 - encoded_
password str - Encoded password of the Token
 - name str
 - Name of the resource.
 - org_
id str - Unique identifier of the organization.
 - project_
id str - Unique identifier of the project.
 - scheduled_
expire_ inttime  - Scheduled expiry time in milliseconds
 - username str
 - Name of the user who created the Token
 - valid bool
 - Boolean value to indicate if Token is valid or not.
 - valid_
from int - This is the time from which the Token is valid. The time is in milliseconds
 - valid_
to int - This is the time till which the Token is valid. The time is in milliseconds
 
- account
Id String - Account Identifier for the Entity
 - apikey
Id String - Identifier of the API Key
 - apikey
Type String - Type of the API Key
 - description String
 - Description of the resource.
 - id String
 - The provider-assigned unique ID for this managed resource.
 - identifier String
 - Unique identifier of the resource.
 - parent
Id String - Parent Entity Identifier of the API Key
 - List<String>
 - Tags to associate with the resource.
 - email String
 - Email Id of the user who created the Token
 - encoded
Password String - Encoded password of the Token
 - name String
 - Name of the resource.
 - org
Id String - Unique identifier of the organization.
 - project
Id String - Unique identifier of the project.
 - scheduled
Expire NumberTime  - Scheduled expiry time in milliseconds
 - username String
 - Name of the user who created the Token
 - valid Boolean
 - Boolean value to indicate if Token is valid or not.
 - valid
From Number - This is the time from which the Token is valid. The time is in milliseconds
 - valid
To Number - This is the time till which the Token is valid. The time is in milliseconds
 
Package Details
- Repository
 - harness pulumi/pulumi-harness
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
harnessTerraform Provider.