1. Packages
  2. Harness Provider
  3. API Docs
  4. platform
  5. getApiKey
Harness v0.7.1 published on Saturday, Mar 29, 2025 by Pulumi

harness.platform.getApiKey

Explore with Pulumi AI

Harness v0.7.1 published on Saturday, Mar 29, 2025 by Pulumi

Use this data source to retrieve information about a Harness API Key. API Keys are used to authenticate and authorize access to Harness Platform resources.

Example Usage

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

const test = harness.platform.getApiKey({
    identifier: "test_apikey",
    name: "test_apikey",
    parentId: "parent_id",
    apikeyType: "USER",
    accountId: "account_id",
    orgId: "org_id",
    projectId: "project_id",
});
Copy
import pulumi
import pulumi_harness as harness

test = harness.platform.get_api_key(identifier="test_apikey",
    name="test_apikey",
    parent_id="parent_id",
    apikey_type="USER",
    account_id="account_id",
    org_id="org_id",
    project_id="project_id")
Copy
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.GetApiKey(ctx, &platform.GetApiKeyArgs{
			Identifier: "test_apikey",
			Name:       pulumi.StringRef("test_apikey"),
			ParentId:   "parent_id",
			ApikeyType: "USER",
			AccountId:  "account_id",
			OrgId:      pulumi.StringRef("org_id"),
			ProjectId:  pulumi.StringRef("project_id"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Harness = Pulumi.Harness;

return await Deployment.RunAsync(() => 
{
    var test = Harness.Platform.GetApiKey.Invoke(new()
    {
        Identifier = "test_apikey",
        Name = "test_apikey",
        ParentId = "parent_id",
        ApikeyType = "USER",
        AccountId = "account_id",
        OrgId = "org_id",
        ProjectId = "project_id",
    });

});
Copy
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.GetApiKeyArgs;
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.getApiKey(GetApiKeyArgs.builder()
            .identifier("test_apikey")
            .name("test_apikey")
            .parentId("parent_id")
            .apikeyType("USER")
            .accountId("account_id")
            .orgId("org_id")
            .projectId("project_id")
            .build());

    }
}
Copy
variables:
  test:
    fn::invoke:
      function: harness:platform:getApiKey
      arguments:
        identifier: test_apikey
        name: test_apikey
        parentId: parent_id
        apikeyType: USER
        accountId: account_id
        orgId: org_id
        projectId: project_id
Copy

Using getApiKey

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 getApiKey(args: GetApiKeyArgs, opts?: InvokeOptions): Promise<GetApiKeyResult>
function getApiKeyOutput(args: GetApiKeyOutputArgs, opts?: InvokeOptions): Output<GetApiKeyResult>
Copy
def get_api_key(account_id: Optional[str] = None,
                apikey_type: Optional[str] = None,
                default_time_to_expire_token: Optional[int] = None,
                identifier: Optional[str] = None,
                name: Optional[str] = None,
                org_id: Optional[str] = None,
                parent_id: Optional[str] = None,
                project_id: Optional[str] = None,
                opts: Optional[InvokeOptions] = None) -> GetApiKeyResult
def get_api_key_output(account_id: Optional[pulumi.Input[str]] = None,
                apikey_type: Optional[pulumi.Input[str]] = None,
                default_time_to_expire_token: Optional[pulumi.Input[int]] = 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,
                opts: Optional[InvokeOptions] = None) -> Output[GetApiKeyResult]
Copy
func GetApiKey(ctx *Context, args *GetApiKeyArgs, opts ...InvokeOption) (*GetApiKeyResult, error)
func GetApiKeyOutput(ctx *Context, args *GetApiKeyOutputArgs, opts ...InvokeOption) GetApiKeyResultOutput
Copy

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

public static class GetApiKey 
{
    public static Task<GetApiKeyResult> InvokeAsync(GetApiKeyArgs args, InvokeOptions? opts = null)
    public static Output<GetApiKeyResult> Invoke(GetApiKeyInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetApiKeyResult> getApiKey(GetApiKeyArgs args, InvokeOptions options)
public static Output<GetApiKeyResult> getApiKey(GetApiKeyArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: harness:platform/getApiKey:getApiKey
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

AccountId This property is required. string
Account Identifier for the Entity
ApikeyType This property is required. string
Type of the API Key
Identifier
This property is required.
Changes to this property will trigger replacement.
string
Unique identifier of the resource.
ParentId This property is required. string
Parent Entity Identifier of the API Key
DefaultTimeToExpireToken int
Default expiration time of the Token within API Key
Name string
Name of the resource.
OrgId string
Unique identifier of the organization.
ProjectId string
Unique identifier of the project.
AccountId This property is required. string
Account Identifier for the Entity
ApikeyType This property is required. string
Type of the API Key
Identifier
This property is required.
Changes to this property will trigger replacement.
string
Unique identifier of the resource.
ParentId This property is required. string
Parent Entity Identifier of the API Key
DefaultTimeToExpireToken int
Default expiration time of the Token within API Key
Name string
Name of the resource.
OrgId string
Unique identifier of the organization.
ProjectId string
Unique identifier of the project.
accountId This property is required. String
Account Identifier for the Entity
apikeyType This property is required. String
Type of the API Key
identifier
This property is required.
Changes to this property will trigger replacement.
String
Unique identifier of the resource.
parentId This property is required. String
Parent Entity Identifier of the API Key
defaultTimeToExpireToken Integer
Default expiration time of the Token within API Key
name String
Name of the resource.
orgId String
Unique identifier of the organization.
projectId String
Unique identifier of the project.
accountId This property is required. string
Account Identifier for the Entity
apikeyType This property is required. string
Type of the API Key
identifier
This property is required.
Changes to this property will trigger replacement.
string
Unique identifier of the resource.
parentId This property is required. string
Parent Entity Identifier of the API Key
defaultTimeToExpireToken number
Default expiration time of the Token within API Key
name string
Name of the resource.
orgId string
Unique identifier of the organization.
projectId string
Unique identifier of the project.
account_id This property is required. str
Account Identifier for the Entity
apikey_type This property is required. str
Type of the API Key
identifier
This property is required.
Changes to this property will trigger replacement.
str
Unique identifier of the resource.
parent_id This property is required. str
Parent Entity Identifier of the API Key
default_time_to_expire_token int
Default expiration time of the Token within API Key
name str
Name of the resource.
org_id str
Unique identifier of the organization.
project_id str
Unique identifier of the project.
accountId This property is required. String
Account Identifier for the Entity
apikeyType This property is required. String
Type of the API Key
identifier
This property is required.
Changes to this property will trigger replacement.
String
Unique identifier of the resource.
parentId This property is required. String
Parent Entity Identifier of the API Key
defaultTimeToExpireToken Number
Default expiration time of the Token within API Key
name String
Name of the resource.
orgId String
Unique identifier of the organization.
projectId String
Unique identifier of the project.

getApiKey Result

The following output properties are available:

AccountId string
Account Identifier for the Entity
ApikeyType 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.
ParentId string
Parent Entity Identifier of the API Key
Tags List<string>
Tags to associate with the resource.
DefaultTimeToExpireToken int
Default expiration time of the Token within API Key
Name string
Name of the resource.
OrgId string
Unique identifier of the organization.
ProjectId string
Unique identifier of the project.
AccountId string
Account Identifier for the Entity
ApikeyType 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.
ParentId string
Parent Entity Identifier of the API Key
Tags []string
Tags to associate with the resource.
DefaultTimeToExpireToken int
Default expiration time of the Token within API Key
Name string
Name of the resource.
OrgId string
Unique identifier of the organization.
ProjectId string
Unique identifier of the project.
accountId String
Account Identifier for the Entity
apikeyType 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.
parentId String
Parent Entity Identifier of the API Key
tags List<String>
Tags to associate with the resource.
defaultTimeToExpireToken Integer
Default expiration time of the Token within API Key
name String
Name of the resource.
orgId String
Unique identifier of the organization.
projectId String
Unique identifier of the project.
accountId string
Account Identifier for the Entity
apikeyType 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.
parentId string
Parent Entity Identifier of the API Key
tags string[]
Tags to associate with the resource.
defaultTimeToExpireToken number
Default expiration time of the Token within API Key
name string
Name of the resource.
orgId string
Unique identifier of the organization.
projectId string
Unique identifier of the project.
account_id str
Account Identifier for the Entity
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
tags Sequence[str]
Tags to associate with the resource.
default_time_to_expire_token int
Default expiration time of the Token within API Key
name str
Name of the resource.
org_id str
Unique identifier of the organization.
project_id str
Unique identifier of the project.
accountId String
Account Identifier for the Entity
apikeyType 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.
parentId String
Parent Entity Identifier of the API Key
tags List<String>
Tags to associate with the resource.
defaultTimeToExpireToken Number
Default expiration time of the Token within API Key
name String
Name of the resource.
orgId String
Unique identifier of the organization.
projectId String
Unique identifier of the project.

Package Details

Repository
harness pulumi/pulumi-harness
License
Apache-2.0
Notes
This Pulumi package is based on the harness Terraform Provider.
Harness v0.7.1 published on Saturday, Mar 29, 2025 by Pulumi