1. Packages
  2. Harness Provider
  3. API Docs
  4. platform
  5. getTemplate
Harness v0.4.4 published on Tuesday, Nov 12, 2024 by Pulumi

harness.platform.getTemplate

Explore with Pulumi AI

harness logo
Harness v0.4.4 published on Tuesday, Nov 12, 2024 by Pulumi

    Data source for retrieving a Harness pipeline.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as harness from "@pulumi/harness";
    
    //For account level template
    const example = harness.platform.getTemplate({
        identifier: "identifier",
        version: "version",
    });
    //For org level template
    const example1 = harness.platform.getTemplate({
        identifier: "identifier",
        version: "version",
        orgId: "org_id",
    });
    //For project level template
    const example2 = harness.platform.getTemplate({
        identifier: "identifier",
        version: "version",
        orgId: "org_id",
        projectId: "project_id",
    });
    
    import pulumi
    import pulumi_harness as harness
    
    #For account level template
    example = harness.platform.get_template(identifier="identifier",
        version="version")
    #For org level template
    example1 = harness.platform.get_template(identifier="identifier",
        version="version",
        org_id="org_id")
    #For project level template
    example2 = harness.platform.get_template(identifier="identifier",
        version="version",
        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 {
    		// For account level template
    		_, err := platform.LookupTemplate(ctx, &platform.LookupTemplateArgs{
    			Identifier: pulumi.StringRef("identifier"),
    			Version:    pulumi.StringRef("version"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// For org level template
    		_, err = platform.LookupTemplate(ctx, &platform.LookupTemplateArgs{
    			Identifier: pulumi.StringRef("identifier"),
    			Version:    pulumi.StringRef("version"),
    			OrgId:      pulumi.StringRef("org_id"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// For project level template
    		_, err = platform.LookupTemplate(ctx, &platform.LookupTemplateArgs{
    			Identifier: pulumi.StringRef("identifier"),
    			Version:    pulumi.StringRef("version"),
    			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(() => 
    {
        //For account level template
        var example = Harness.Platform.GetTemplate.Invoke(new()
        {
            Identifier = "identifier",
            Version = "version",
        });
    
        //For org level template
        var example1 = Harness.Platform.GetTemplate.Invoke(new()
        {
            Identifier = "identifier",
            Version = "version",
            OrgId = "org_id",
        });
    
        //For project level template
        var example2 = Harness.Platform.GetTemplate.Invoke(new()
        {
            Identifier = "identifier",
            Version = "version",
            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.GetTemplateArgs;
    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) {
            //For account level template
            final var example = PlatformFunctions.getTemplate(GetTemplateArgs.builder()
                .identifier("identifier")
                .version("version")
                .build());
    
            //For org level template
            final var example1 = PlatformFunctions.getTemplate(GetTemplateArgs.builder()
                .identifier("identifier")
                .version("version")
                .orgId("org_id")
                .build());
    
            //For project level template
            final var example2 = PlatformFunctions.getTemplate(GetTemplateArgs.builder()
                .identifier("identifier")
                .version("version")
                .orgId("org_id")
                .projectId("project_id")
                .build());
    
        }
    }
    
    variables:
      #For account level template
      example:
        fn::invoke:
          Function: harness:platform:getTemplate
          Arguments:
            identifier: identifier
            version: version
      #For org level template
      example1:
        fn::invoke:
          Function: harness:platform:getTemplate
          Arguments:
            identifier: identifier
            version: version
            orgId: org_id
      #For project level template
      example2:
        fn::invoke:
          Function: harness:platform:getTemplate
          Arguments:
            identifier: identifier
            version: version
            orgId: org_id
            projectId: project_id
    

    Using getTemplate

    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 getTemplate(args: GetTemplateArgs, opts?: InvokeOptions): Promise<GetTemplateResult>
    function getTemplateOutput(args: GetTemplateOutputArgs, opts?: InvokeOptions): Output<GetTemplateResult>
    def get_template(branch_name: Optional[str] = None,
                     child_type: Optional[str] = None,
                     git_details: Optional[GetTemplateGitDetails] = None,
                     identifier: Optional[str] = None,
                     is_stable: Optional[bool] = None,
                     name: Optional[str] = None,
                     org_id: Optional[str] = None,
                     project_id: Optional[str] = None,
                     scope: Optional[str] = None,
                     version: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetTemplateResult
    def get_template_output(branch_name: Optional[pulumi.Input[str]] = None,
                     child_type: Optional[pulumi.Input[str]] = None,
                     git_details: Optional[pulumi.Input[GetTemplateGitDetailsArgs]] = None,
                     identifier: Optional[pulumi.Input[str]] = None,
                     is_stable: Optional[pulumi.Input[bool]] = None,
                     name: Optional[pulumi.Input[str]] = None,
                     org_id: Optional[pulumi.Input[str]] = None,
                     project_id: Optional[pulumi.Input[str]] = None,
                     scope: Optional[pulumi.Input[str]] = None,
                     version: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetTemplateResult]
    func LookupTemplate(ctx *Context, args *LookupTemplateArgs, opts ...InvokeOption) (*LookupTemplateResult, error)
    func LookupTemplateOutput(ctx *Context, args *LookupTemplateOutputArgs, opts ...InvokeOption) LookupTemplateResultOutput

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

    public static class GetTemplate 
    {
        public static Task<GetTemplateResult> InvokeAsync(GetTemplateArgs args, InvokeOptions? opts = null)
        public static Output<GetTemplateResult> Invoke(GetTemplateInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetTemplateResult> getTemplate(GetTemplateArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: harness:platform/getTemplate:getTemplate
      arguments:
        # arguments dictionary

    The following arguments are supported:

    BranchName string
    Version Label for Template.
    ChildType string
    Defines child template type.
    GitDetails GetTemplateGitDetails
    Contains parameters related to creating an Entity for Git Experience.
    Identifier string
    Unique identifier of the resource.
    IsStable bool
    True if given version for template to be set as stable.
    Name string
    Name of the resource.
    OrgId string
    Unique identifier of the organization.
    ProjectId string
    Unique identifier of the project.
    Scope string
    Scope of template.
    Version string
    Version Label for Template.
    BranchName string
    Version Label for Template.
    ChildType string
    Defines child template type.
    GitDetails GetTemplateGitDetails
    Contains parameters related to creating an Entity for Git Experience.
    Identifier string
    Unique identifier of the resource.
    IsStable bool
    True if given version for template to be set as stable.
    Name string
    Name of the resource.
    OrgId string
    Unique identifier of the organization.
    ProjectId string
    Unique identifier of the project.
    Scope string
    Scope of template.
    Version string
    Version Label for Template.
    branchName String
    Version Label for Template.
    childType String
    Defines child template type.
    gitDetails GetTemplateGitDetails
    Contains parameters related to creating an Entity for Git Experience.
    identifier String
    Unique identifier of the resource.
    isStable Boolean
    True if given version for template to be set as stable.
    name String
    Name of the resource.
    orgId String
    Unique identifier of the organization.
    projectId String
    Unique identifier of the project.
    scope String
    Scope of template.
    version String
    Version Label for Template.
    branchName string
    Version Label for Template.
    childType string
    Defines child template type.
    gitDetails GetTemplateGitDetails
    Contains parameters related to creating an Entity for Git Experience.
    identifier string
    Unique identifier of the resource.
    isStable boolean
    True if given version for template to be set as stable.
    name string
    Name of the resource.
    orgId string
    Unique identifier of the organization.
    projectId string
    Unique identifier of the project.
    scope string
    Scope of template.
    version string
    Version Label for Template.
    branch_name str
    Version Label for Template.
    child_type str
    Defines child template type.
    git_details GetTemplateGitDetails
    Contains parameters related to creating an Entity for Git Experience.
    identifier str
    Unique identifier of the resource.
    is_stable bool
    True if given version for template to be set as stable.
    name str
    Name of the resource.
    org_id str
    Unique identifier of the organization.
    project_id str
    Unique identifier of the project.
    scope str
    Scope of template.
    version str
    Version Label for Template.
    branchName String
    Version Label for Template.
    childType String
    Defines child template type.
    gitDetails Property Map
    Contains parameters related to creating an Entity for Git Experience.
    identifier String
    Unique identifier of the resource.
    isStable Boolean
    True if given version for template to be set as stable.
    name String
    Name of the resource.
    orgId String
    Unique identifier of the organization.
    projectId String
    Unique identifier of the project.
    scope String
    Scope of template.
    version String
    Version Label for Template.

    getTemplate Result

    The following output properties are available:

    ConnectorRef string
    Identifier of the Harness Connector used for CRUD operations on the Entity.
    Description string
    Description of the resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    StoreType string
    Specifies whether the Entity is to be stored in Git or not. Possible values: INLINE, REMOTE.
    Tags List<string>
    Tags to associate with the resource.
    TemplateYaml string
    Yaml for creating new Template.
    BranchName string
    Version Label for Template.
    ChildType string
    Defines child template type.
    GitDetails GetTemplateGitDetails
    Contains parameters related to creating an Entity for Git Experience.
    Identifier string
    Unique identifier of the resource.
    IsStable bool
    True if given version for template to be set as stable.
    Name string
    Name of the resource.
    OrgId string
    Unique identifier of the organization.
    ProjectId string
    Unique identifier of the project.
    Scope string
    Scope of template.
    Version string
    Version Label for Template.
    ConnectorRef string
    Identifier of the Harness Connector used for CRUD operations on the Entity.
    Description string
    Description of the resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    StoreType string
    Specifies whether the Entity is to be stored in Git or not. Possible values: INLINE, REMOTE.
    Tags []string
    Tags to associate with the resource.
    TemplateYaml string
    Yaml for creating new Template.
    BranchName string
    Version Label for Template.
    ChildType string
    Defines child template type.
    GitDetails GetTemplateGitDetails
    Contains parameters related to creating an Entity for Git Experience.
    Identifier string
    Unique identifier of the resource.
    IsStable bool
    True if given version for template to be set as stable.
    Name string
    Name of the resource.
    OrgId string
    Unique identifier of the organization.
    ProjectId string
    Unique identifier of the project.
    Scope string
    Scope of template.
    Version string
    Version Label for Template.
    connectorRef String
    Identifier of the Harness Connector used for CRUD operations on the Entity.
    description String
    Description of the resource.
    id String
    The provider-assigned unique ID for this managed resource.
    storeType String
    Specifies whether the Entity is to be stored in Git or not. Possible values: INLINE, REMOTE.
    tags List<String>
    Tags to associate with the resource.
    templateYaml String
    Yaml for creating new Template.
    branchName String
    Version Label for Template.
    childType String
    Defines child template type.
    gitDetails GetTemplateGitDetails
    Contains parameters related to creating an Entity for Git Experience.
    identifier String
    Unique identifier of the resource.
    isStable Boolean
    True if given version for template to be set as stable.
    name String
    Name of the resource.
    orgId String
    Unique identifier of the organization.
    projectId String
    Unique identifier of the project.
    scope String
    Scope of template.
    version String
    Version Label for Template.
    connectorRef string
    Identifier of the Harness Connector used for CRUD operations on the Entity.
    description string
    Description of the resource.
    id string
    The provider-assigned unique ID for this managed resource.
    storeType string
    Specifies whether the Entity is to be stored in Git or not. Possible values: INLINE, REMOTE.
    tags string[]
    Tags to associate with the resource.
    templateYaml string
    Yaml for creating new Template.
    branchName string
    Version Label for Template.
    childType string
    Defines child template type.
    gitDetails GetTemplateGitDetails
    Contains parameters related to creating an Entity for Git Experience.
    identifier string
    Unique identifier of the resource.
    isStable boolean
    True if given version for template to be set as stable.
    name string
    Name of the resource.
    orgId string
    Unique identifier of the organization.
    projectId string
    Unique identifier of the project.
    scope string
    Scope of template.
    version string
    Version Label for Template.
    connector_ref str
    Identifier of the Harness Connector used for CRUD operations on the Entity.
    description str
    Description of the resource.
    id str
    The provider-assigned unique ID for this managed resource.
    store_type str
    Specifies whether the Entity is to be stored in Git or not. Possible values: INLINE, REMOTE.
    tags Sequence[str]
    Tags to associate with the resource.
    template_yaml str
    Yaml for creating new Template.
    branch_name str
    Version Label for Template.
    child_type str
    Defines child template type.
    git_details GetTemplateGitDetails
    Contains parameters related to creating an Entity for Git Experience.
    identifier str
    Unique identifier of the resource.
    is_stable bool
    True if given version for template to be set as stable.
    name str
    Name of the resource.
    org_id str
    Unique identifier of the organization.
    project_id str
    Unique identifier of the project.
    scope str
    Scope of template.
    version str
    Version Label for Template.
    connectorRef String
    Identifier of the Harness Connector used for CRUD operations on the Entity.
    description String
    Description of the resource.
    id String
    The provider-assigned unique ID for this managed resource.
    storeType String
    Specifies whether the Entity is to be stored in Git or not. Possible values: INLINE, REMOTE.
    tags List<String>
    Tags to associate with the resource.
    templateYaml String
    Yaml for creating new Template.
    branchName String
    Version Label for Template.
    childType String
    Defines child template type.
    gitDetails Property Map
    Contains parameters related to creating an Entity for Git Experience.
    identifier String
    Unique identifier of the resource.
    isStable Boolean
    True if given version for template to be set as stable.
    name String
    Name of the resource.
    orgId String
    Unique identifier of the organization.
    projectId String
    Unique identifier of the project.
    scope String
    Scope of template.
    version String
    Version Label for Template.

    Supporting Types

    GetTemplateGitDetails

    LastCommitId string
    Last commit identifier (for Git Repositories other than Github). To be provided only when updating Pipeline.
    LastObjectId string
    Last object identifier (for Github). To be provided only when updating Pipeline.
    BranchName string
    Name of the branch.
    FilePath string
    File path of the Entity in the repository.
    FileUrl string
    File url of the Entity in the repository.
    RepoName string
    Name of the repository.
    RepoUrl string
    Repo url of the Entity in the repository.
    LastCommitId string
    Last commit identifier (for Git Repositories other than Github). To be provided only when updating Pipeline.
    LastObjectId string
    Last object identifier (for Github). To be provided only when updating Pipeline.
    BranchName string
    Name of the branch.
    FilePath string
    File path of the Entity in the repository.
    FileUrl string
    File url of the Entity in the repository.
    RepoName string
    Name of the repository.
    RepoUrl string
    Repo url of the Entity in the repository.
    lastCommitId String
    Last commit identifier (for Git Repositories other than Github). To be provided only when updating Pipeline.
    lastObjectId String
    Last object identifier (for Github). To be provided only when updating Pipeline.
    branchName String
    Name of the branch.
    filePath String
    File path of the Entity in the repository.
    fileUrl String
    File url of the Entity in the repository.
    repoName String
    Name of the repository.
    repoUrl String
    Repo url of the Entity in the repository.
    lastCommitId string
    Last commit identifier (for Git Repositories other than Github). To be provided only when updating Pipeline.
    lastObjectId string
    Last object identifier (for Github). To be provided only when updating Pipeline.
    branchName string
    Name of the branch.
    filePath string
    File path of the Entity in the repository.
    fileUrl string
    File url of the Entity in the repository.
    repoName string
    Name of the repository.
    repoUrl string
    Repo url of the Entity in the repository.
    last_commit_id str
    Last commit identifier (for Git Repositories other than Github). To be provided only when updating Pipeline.
    last_object_id str
    Last object identifier (for Github). To be provided only when updating Pipeline.
    branch_name str
    Name of the branch.
    file_path str
    File path of the Entity in the repository.
    file_url str
    File url of the Entity in the repository.
    repo_name str
    Name of the repository.
    repo_url str
    Repo url of the Entity in the repository.
    lastCommitId String
    Last commit identifier (for Git Repositories other than Github). To be provided only when updating Pipeline.
    lastObjectId String
    Last object identifier (for Github). To be provided only when updating Pipeline.
    branchName String
    Name of the branch.
    filePath String
    File path of the Entity in the repository.
    fileUrl String
    File url of the Entity in the repository.
    repoName String
    Name of the repository.
    repoUrl String
    Repo url of the Entity in the repository.

    Package Details

    Repository
    harness pulumi/pulumi-harness
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the harness Terraform Provider.
    harness logo
    Harness v0.4.4 published on Tuesday, Nov 12, 2024 by Pulumi