harness.platform.Token
Explore with Pulumi AI
Resource for creating tokens.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Harness = Lbrlabs.PulumiPackage.Harness;
return await Deployment.RunAsync(() =>
{
// Create token for project level apikey
var test = new Harness.Platform.Token("test", new()
{
AccountId = "account_id",
ApikeyId = "apikey_id",
ApikeyType = "USER",
Identifier = "test_token",
OrgId = "org_id",
ParentId = "apikey_parent_id",
ProjectId = "project_id",
});
});
package main
import (
"github.com/lbrlabs/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.NewToken(ctx, "test", &platform.TokenArgs{
AccountId: pulumi.String("account_id"),
ApikeyId: pulumi.String("apikey_id"),
ApikeyType: pulumi.String("USER"),
Identifier: pulumi.String("test_token"),
OrgId: pulumi.String("org_id"),
ParentId: pulumi.String("apikey_parent_id"),
ProjectId: pulumi.String("project_id"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.harness.platform.Token;
import com.pulumi.harness.platform.TokenArgs;
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) {
var test = new Token("test", TokenArgs.builder()
.accountId("account_id")
.apikeyId("apikey_id")
.apikeyType("USER")
.identifier("test_token")
.orgId("org_id")
.parentId("apikey_parent_id")
.projectId("project_id")
.build());
}
}
import pulumi
import lbrlabs_pulumi_harness as harness
# Create token for project level apikey
test = harness.platform.Token("test",
account_id="account_id",
apikey_id="apikey_id",
apikey_type="USER",
identifier="test_token",
org_id="org_id",
parent_id="apikey_parent_id",
project_id="project_id")
import * as pulumi from "@pulumi/pulumi";
import * as harness from "@lbrlabs/pulumi-harness";
// Create token for project level apikey
const test = new harness.platform.Token("test", {
accountId: "account_id",
apikeyId: "apikey_id",
apikeyType: "USER",
identifier: "test_token",
orgId: "org_id",
parentId: "apikey_parent_id",
projectId: "project_id",
});
resources:
# Create token for project level apikey
test:
type: harness:platform:Token
properties:
accountId: account_id
apikeyId: apikey_id
apikeyType: USER
identifier: test_token
orgId: org_id
parentId: apikey_parent_id
projectId: project_id
Create Token Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Token(name: string, args: TokenArgs, opts?: CustomResourceOptions);
@overload
def Token(resource_name: str,
args: TokenArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Token(resource_name: str,
opts: Optional[ResourceOptions] = None,
identifier: Optional[str] = None,
apikey_id: Optional[str] = None,
apikey_type: Optional[str] = None,
parent_id: Optional[str] = None,
account_id: Optional[str] = None,
org_id: Optional[str] = None,
encoded_password: Optional[str] = None,
name: Optional[str] = None,
email: Optional[str] = None,
description: Optional[str] = None,
project_id: Optional[str] = None,
scheduled_expire_time: Optional[int] = None,
tags: Optional[Mapping[str, str]] = None,
username: Optional[str] = None,
valid: Optional[bool] = None,
valid_from: Optional[int] = None,
valid_to: Optional[int] = None)
func NewToken(ctx *Context, name string, args TokenArgs, opts ...ResourceOption) (*Token, error)
public Token(string name, TokenArgs args, CustomResourceOptions? opts = null)
type: harness:platform:Token
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args TokenArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args TokenArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args TokenArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args TokenArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args TokenArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var tokenResource = new Harness.Platform.Token("tokenResource", new()
{
Identifier = "string",
ApikeyId = "string",
ApikeyType = "string",
ParentId = "string",
AccountId = "string",
OrgId = "string",
EncodedPassword = "string",
Name = "string",
Email = "string",
Description = "string",
ProjectId = "string",
ScheduledExpireTime = 0,
Tags =
{
{ "string", "string" },
},
Username = "string",
Valid = false,
ValidFrom = 0,
ValidTo = 0,
});
example, err := platform.NewToken(ctx, "tokenResource", &platform.TokenArgs{
Identifier: pulumi.String("string"),
ApikeyId: pulumi.String("string"),
ApikeyType: pulumi.String("string"),
ParentId: pulumi.String("string"),
AccountId: pulumi.String("string"),
OrgId: pulumi.String("string"),
EncodedPassword: pulumi.String("string"),
Name: pulumi.String("string"),
Email: pulumi.String("string"),
Description: pulumi.String("string"),
ProjectId: pulumi.String("string"),
ScheduledExpireTime: pulumi.Int(0),
Tags: pulumi.StringMap{
"string": pulumi.String("string"),
},
Username: pulumi.String("string"),
Valid: pulumi.Bool(false),
ValidFrom: pulumi.Int(0),
ValidTo: pulumi.Int(0),
})
var tokenResource = new Token("tokenResource", TokenArgs.builder()
.identifier("string")
.apikeyId("string")
.apikeyType("string")
.parentId("string")
.accountId("string")
.orgId("string")
.encodedPassword("string")
.name("string")
.email("string")
.description("string")
.projectId("string")
.scheduledExpireTime(0)
.tags(Map.of("string", "string"))
.username("string")
.valid(false)
.validFrom(0)
.validTo(0)
.build());
token_resource = harness.platform.Token("tokenResource",
identifier="string",
apikey_id="string",
apikey_type="string",
parent_id="string",
account_id="string",
org_id="string",
encoded_password="string",
name="string",
email="string",
description="string",
project_id="string",
scheduled_expire_time=0,
tags={
"string": "string",
},
username="string",
valid=False,
valid_from=0,
valid_to=0)
const tokenResource = new harness.platform.Token("tokenResource", {
identifier: "string",
apikeyId: "string",
apikeyType: "string",
parentId: "string",
accountId: "string",
orgId: "string",
encodedPassword: "string",
name: "string",
email: "string",
description: "string",
projectId: "string",
scheduledExpireTime: 0,
tags: {
string: "string",
},
username: "string",
valid: false,
validFrom: 0,
validTo: 0,
});
type: harness:platform:Token
properties:
accountId: string
apikeyId: string
apikeyType: string
description: string
email: string
encodedPassword: string
identifier: string
name: string
orgId: string
parentId: string
projectId: string
scheduledExpireTime: 0
tags:
string: string
username: string
valid: false
validFrom: 0
validTo: 0
Token Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The Token resource accepts the following input properties:
- 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
- Identifier of the Token
- Parent
Id string - Parent Entity Identifier of the API Key
- Description string
- Description of the Token
- Email string
- Email Id of the user who created the Token
- Encoded
Password string - Encoded password of the Token
- Name string
- Name of the Token
- Org
Id string - Organization Identifier for the Entity
- Project
Id string - Project Identifier for the Entity
- Scheduled
Expire intTime - Scheduled expiry time in milliseconds
- Dictionary<string, string>
- Tags for the Token
- 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
- Identifier of the Token
- Parent
Id string - Parent Entity Identifier of the API Key
- Description string
- Description of the Token
- Email string
- Email Id of the user who created the Token
- Encoded
Password string - Encoded password of the Token
- Name string
- Name of the Token
- Org
Id string - Organization Identifier for the Entity
- Project
Id string - Project Identifier for the Entity
- Scheduled
Expire intTime - Scheduled expiry time in milliseconds
- map[string]string
- Tags for the Token
- 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
- Identifier of the Token
- parent
Id String - Parent Entity Identifier of the API Key
- description String
- Description of the Token
- email String
- Email Id of the user who created the Token
- encoded
Password String - Encoded password of the Token
- name String
- Name of the Token
- org
Id String - Organization Identifier for the Entity
- project
Id String - Project Identifier for the Entity
- scheduled
Expire IntegerTime - Scheduled expiry time in milliseconds
- Map<String,String>
- Tags for the Token
- 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
- Identifier of the Token
- parent
Id string - Parent Entity Identifier of the API Key
- description string
- Description of the Token
- email string
- Email Id of the user who created the Token
- encoded
Password string - Encoded password of the Token
- name string
- Name of the Token
- org
Id string - Organization Identifier for the Entity
- project
Id string - Project Identifier for the Entity
- scheduled
Expire numberTime - Scheduled expiry time in milliseconds
- {[key: string]: string}
- Tags for the Token
- 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
- Identifier of the Token
- parent_
id str - Parent Entity Identifier of the API Key
- description str
- Description of the Token
- email str
- Email Id of the user who created the Token
- encoded_
password str - Encoded password of the Token
- name str
- Name of the Token
- org_
id str - Organization Identifier for the Entity
- project_
id str - Project Identifier for the Entity
- scheduled_
expire_ inttime - Scheduled expiry time in milliseconds
- Mapping[str, str]
- Tags for the Token
- 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
- Identifier of the Token
- parent
Id String - Parent Entity Identifier of the API Key
- description String
- Description of the Token
- email String
- Email Id of the user who created the Token
- encoded
Password String - Encoded password of the Token
- name String
- Name of the Token
- org
Id String - Organization Identifier for the Entity
- project
Id String - Project Identifier for the Entity
- scheduled
Expire NumberTime - Scheduled expiry time in milliseconds
- Map<String>
- Tags for the Token
- 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
Outputs
All input properties are implicitly available as output properties. Additionally, the Token resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Token Resource
Get an existing Token resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: TokenState, opts?: CustomResourceOptions): Token
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
account_id: Optional[str] = None,
apikey_id: Optional[str] = None,
apikey_type: Optional[str] = None,
description: 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,
tags: Optional[Mapping[str, str]] = None,
username: Optional[str] = None,
valid: Optional[bool] = None,
valid_from: Optional[int] = None,
valid_to: Optional[int] = None) -> Token
func GetToken(ctx *Context, name string, id IDInput, state *TokenState, opts ...ResourceOption) (*Token, error)
public static Token Get(string name, Input<string> id, TokenState? state, CustomResourceOptions? opts = null)
public static Token get(String name, Output<String> id, TokenState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- 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 Token
- Email string
- Email Id of the user who created the Token
- Encoded
Password string - Encoded password of the Token
- Identifier string
- Identifier of the Token
- Name string
- Name of the Token
- Org
Id string - Organization Identifier for the Entity
- Parent
Id string - Parent Entity Identifier of the API Key
- Project
Id string - Project Identifier for the Entity
- Scheduled
Expire intTime - Scheduled expiry time in milliseconds
- Dictionary<string, string>
- Tags for the Token
- 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 Token
- Email string
- Email Id of the user who created the Token
- Encoded
Password string - Encoded password of the Token
- Identifier string
- Identifier of the Token
- Name string
- Name of the Token
- Org
Id string - Organization Identifier for the Entity
- Parent
Id string - Parent Entity Identifier of the API Key
- Project
Id string - Project Identifier for the Entity
- Scheduled
Expire intTime - Scheduled expiry time in milliseconds
- map[string]string
- Tags for the Token
- 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 Token
- email String
- Email Id of the user who created the Token
- encoded
Password String - Encoded password of the Token
- identifier String
- Identifier of the Token
- name String
- Name of the Token
- org
Id String - Organization Identifier for the Entity
- parent
Id String - Parent Entity Identifier of the API Key
- project
Id String - Project Identifier for the Entity
- scheduled
Expire IntegerTime - Scheduled expiry time in milliseconds
- Map<String,String>
- Tags for the Token
- 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 Token
- email string
- Email Id of the user who created the Token
- encoded
Password string - Encoded password of the Token
- identifier string
- Identifier of the Token
- name string
- Name of the Token
- org
Id string - Organization Identifier for the Entity
- parent
Id string - Parent Entity Identifier of the API Key
- project
Id string - Project Identifier for the Entity
- scheduled
Expire numberTime - Scheduled expiry time in milliseconds
- {[key: string]: string}
- Tags for the Token
- 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 Token
- email str
- Email Id of the user who created the Token
- encoded_
password str - Encoded password of the Token
- identifier str
- Identifier of the Token
- name str
- Name of the Token
- org_
id str - Organization Identifier for the Entity
- parent_
id str - Parent Entity Identifier of the API Key
- project_
id str - Project Identifier for the Entity
- scheduled_
expire_ inttime - Scheduled expiry time in milliseconds
- Mapping[str, str]
- Tags for the Token
- 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 Token
- email String
- Email Id of the user who created the Token
- encoded
Password String - Encoded password of the Token
- identifier String
- Identifier of the Token
- name String
- Name of the Token
- org
Id String - Organization Identifier for the Entity
- parent
Id String - Parent Entity Identifier of the API Key
- project
Id String - Project Identifier for the Entity
- scheduled
Expire NumberTime - Scheduled expiry time in milliseconds
- Map<String>
- Tags for the Token
- 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
Import
Import account level token
$ pulumi import harness:platform/token:Token harness_platform_token <parent_id>/<apikey_id>/<apikey_type>/<token_id>
Import org level token
$ pulumi import harness:platform/token:Token harness_platform_token <org_id>/<parent_id>/<apikey_id>/<apikey_type>/<token_id>
Import project level token
$ pulumi import harness:platform/token:Token harness_platform_token <org_id>/<project_id>/<parent_id>/<apikey_id>/<apikey_type>/<token_id>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- harness lbrlabs/pulumi-harness
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
harness
Terraform Provider.