Harness v0.5.7 published on Saturday, Mar 8, 2025 by Pulumi
harness.platform.getApiKey
Explore with Pulumi AI
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",
});
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")
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
	})
}
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",
    });
});
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());
    }
}
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
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>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]func GetApiKey(ctx *Context, args *GetApiKeyArgs, opts ...InvokeOption) (*GetApiKeyResult, error)
func GetApiKeyOutput(ctx *Context, args *GetApiKeyOutputArgs, opts ...InvokeOption) GetApiKeyResultOutput> 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)
}public static CompletableFuture<GetApiKeyResult> getApiKey(GetApiKeyArgs args, InvokeOptions options)
public static Output<GetApiKeyResult> getApiKey(GetApiKeyArgs args, InvokeOptions options)
fn::invoke:
  function: harness:platform/getApiKey:getApiKey
  arguments:
    # arguments dictionaryThe following arguments are supported:
- AccountId string
- Account Identifier for the Entity
- ApikeyType string
- Type of the API Key
- Identifier string
- Unique identifier of the resource.
- ParentId string
- Parent Entity Identifier of the API Key
- DefaultTime intTo Expire Token 
- 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
- Identifier string
- Unique identifier of the resource.
- ParentId string
- Parent Entity Identifier of the API Key
- DefaultTime intTo Expire Token 
- 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
- identifier String
- Unique identifier of the resource.
- parentId String
- Parent Entity Identifier of the API Key
- defaultTime IntegerTo Expire Token 
- 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
- identifier string
- Unique identifier of the resource.
- parentId string
- Parent Entity Identifier of the API Key
- defaultTime numberTo Expire Token 
- 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
- identifier str
- Unique identifier of the resource.
- parent_id str
- Parent Entity Identifier of the API Key
- default_time_ intto_ expire_ token 
- 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
- identifier String
- Unique identifier of the resource.
- parentId String
- Parent Entity Identifier of the API Key
- defaultTime NumberTo Expire Token 
- 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
- List<string>
- Tags to associate with the resource.
- DefaultTime intTo Expire Token 
- 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
- []string
- Tags to associate with the resource.
- DefaultTime intTo Expire Token 
- 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
- List<String>
- Tags to associate with the resource.
- defaultTime IntegerTo Expire Token 
- 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
- string[]
- Tags to associate with the resource.
- defaultTime numberTo Expire Token 
- 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
- Sequence[str]
- Tags to associate with the resource.
- default_time_ intto_ expire_ token 
- 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
- List<String>
- Tags to associate with the resource.
- defaultTime NumberTo Expire Token 
- 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 harnessTerraform Provider.
