1. Packages
  2. Harness
  3. API Docs
  4. platform
  5. Token
Harness v0.0.6 published on Saturday, Jul 1, 2023 by lbrlabs

harness.platform.Token

Explore with Pulumi AI

harness logo
Harness v0.0.6 published on Saturday, Jul 1, 2023 by lbrlabs

    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)
    public Token(String name, TokenArgs args)
    public Token(String name, TokenArgs args, CustomResourceOptions options)
    
    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.

    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:

    AccountId string
    Account Identifier for the Entity
    ApikeyId string
    Identifier of the API Key
    ApikeyType string
    Type of the API Key
    Identifier string
    Identifier of the Token
    ParentId 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
    EncodedPassword string
    Encoded password of the Token
    Name string
    Name of the Token
    OrgId string
    Organization Identifier for the Entity
    ProjectId string
    Project Identifier for the Entity
    ScheduledExpireTime int
    Scheduled expiry time in milliseconds
    Tags 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.
    ValidFrom int
    This is the time from which the Token is valid. The time is in milliseconds
    ValidTo int
    This is the time till which the Token is valid. The time is in milliseconds
    AccountId string
    Account Identifier for the Entity
    ApikeyId string
    Identifier of the API Key
    ApikeyType string
    Type of the API Key
    Identifier string
    Identifier of the Token
    ParentId 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
    EncodedPassword string
    Encoded password of the Token
    Name string
    Name of the Token
    OrgId string
    Organization Identifier for the Entity
    ProjectId string
    Project Identifier for the Entity
    ScheduledExpireTime int
    Scheduled expiry time in milliseconds
    Tags 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.
    ValidFrom int
    This is the time from which the Token is valid. The time is in milliseconds
    ValidTo int
    This is the time till which the Token is valid. The time is in milliseconds
    accountId String
    Account Identifier for the Entity
    apikeyId String
    Identifier of the API Key
    apikeyType String
    Type of the API Key
    identifier String
    Identifier of the Token
    parentId 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
    encodedPassword String
    Encoded password of the Token
    name String
    Name of the Token
    orgId String
    Organization Identifier for the Entity
    projectId String
    Project Identifier for the Entity
    scheduledExpireTime Integer
    Scheduled expiry time in milliseconds
    tags 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.
    validFrom Integer
    This is the time from which the Token is valid. The time is in milliseconds
    validTo Integer
    This is the time till which the Token is valid. The time is in milliseconds
    accountId string
    Account Identifier for the Entity
    apikeyId string
    Identifier of the API Key
    apikeyType string
    Type of the API Key
    identifier string
    Identifier of the Token
    parentId 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
    encodedPassword string
    Encoded password of the Token
    name string
    Name of the Token
    orgId string
    Organization Identifier for the Entity
    projectId string
    Project Identifier for the Entity
    scheduledExpireTime number
    Scheduled expiry time in milliseconds
    tags {[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.
    validFrom number
    This is the time from which the Token is valid. The time is in milliseconds
    validTo 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_time int
    Scheduled expiry time in milliseconds
    tags 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
    accountId String
    Account Identifier for the Entity
    apikeyId String
    Identifier of the API Key
    apikeyType String
    Type of the API Key
    identifier String
    Identifier of the Token
    parentId 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
    encodedPassword String
    Encoded password of the Token
    name String
    Name of the Token
    orgId String
    Organization Identifier for the Entity
    projectId String
    Project Identifier for the Entity
    scheduledExpireTime Number
    Scheduled expiry time in milliseconds
    tags 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.
    validFrom Number
    This is the time from which the Token is valid. The time is in milliseconds
    validTo 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.
    The following state arguments are supported:
    AccountId string
    Account Identifier for the Entity
    ApikeyId string
    Identifier of the API Key
    ApikeyType string
    Type of the API Key
    Description string
    Description of the Token
    Email string
    Email Id of the user who created the Token
    EncodedPassword string
    Encoded password of the Token
    Identifier string
    Identifier of the Token
    Name string
    Name of the Token
    OrgId string
    Organization Identifier for the Entity
    ParentId string
    Parent Entity Identifier of the API Key
    ProjectId string
    Project Identifier for the Entity
    ScheduledExpireTime int
    Scheduled expiry time in milliseconds
    Tags 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.
    ValidFrom int
    This is the time from which the Token is valid. The time is in milliseconds
    ValidTo int
    This is the time till which the Token is valid. The time is in milliseconds
    AccountId string
    Account Identifier for the Entity
    ApikeyId string
    Identifier of the API Key
    ApikeyType string
    Type of the API Key
    Description string
    Description of the Token
    Email string
    Email Id of the user who created the Token
    EncodedPassword string
    Encoded password of the Token
    Identifier string
    Identifier of the Token
    Name string
    Name of the Token
    OrgId string
    Organization Identifier for the Entity
    ParentId string
    Parent Entity Identifier of the API Key
    ProjectId string
    Project Identifier for the Entity
    ScheduledExpireTime int
    Scheduled expiry time in milliseconds
    Tags 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.
    ValidFrom int
    This is the time from which the Token is valid. The time is in milliseconds
    ValidTo int
    This is the time till which the Token is valid. The time is in milliseconds
    accountId String
    Account Identifier for the Entity
    apikeyId String
    Identifier of the API Key
    apikeyType String
    Type of the API Key
    description String
    Description of the Token
    email String
    Email Id of the user who created the Token
    encodedPassword String
    Encoded password of the Token
    identifier String
    Identifier of the Token
    name String
    Name of the Token
    orgId String
    Organization Identifier for the Entity
    parentId String
    Parent Entity Identifier of the API Key
    projectId String
    Project Identifier for the Entity
    scheduledExpireTime Integer
    Scheduled expiry time in milliseconds
    tags 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.
    validFrom Integer
    This is the time from which the Token is valid. The time is in milliseconds
    validTo Integer
    This is the time till which the Token is valid. The time is in milliseconds
    accountId string
    Account Identifier for the Entity
    apikeyId string
    Identifier of the API Key
    apikeyType string
    Type of the API Key
    description string
    Description of the Token
    email string
    Email Id of the user who created the Token
    encodedPassword string
    Encoded password of the Token
    identifier string
    Identifier of the Token
    name string
    Name of the Token
    orgId string
    Organization Identifier for the Entity
    parentId string
    Parent Entity Identifier of the API Key
    projectId string
    Project Identifier for the Entity
    scheduledExpireTime number
    Scheduled expiry time in milliseconds
    tags {[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.
    validFrom number
    This is the time from which the Token is valid. The time is in milliseconds
    validTo 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_time int
    Scheduled expiry time in milliseconds
    tags 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
    accountId String
    Account Identifier for the Entity
    apikeyId String
    Identifier of the API Key
    apikeyType String
    Type of the API Key
    description String
    Description of the Token
    email String
    Email Id of the user who created the Token
    encodedPassword String
    Encoded password of the Token
    identifier String
    Identifier of the Token
    name String
    Name of the Token
    orgId String
    Organization Identifier for the Entity
    parentId String
    Parent Entity Identifier of the API Key
    projectId String
    Project Identifier for the Entity
    scheduledExpireTime Number
    Scheduled expiry time in milliseconds
    tags 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.
    validFrom Number
    This is the time from which the Token is valid. The time is in milliseconds
    validTo 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.
    harness logo
    Harness v0.0.6 published on Saturday, Jul 1, 2023 by lbrlabs