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

harness.platform.getPolicy

Explore with Pulumi AI

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

    Data source for retrieving a Harness policy.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Harness = Pulumi.Harness;
    
    return await Deployment.RunAsync(() => 
    {
        var test = Harness.Platform.GetPolicy.Invoke(new()
        {
            Identifier = harness_platform_policy.Test.Identifier,
            Name = harness_platform_policy.Test.Name,
            Rego = "package test",
        });
    
    });
    
    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.LookupPolicy(ctx, &platform.LookupPolicyArgs{
    			Identifier: pulumi.StringRef(harness_platform_policy.Test.Identifier),
    			Name:       pulumi.StringRef(harness_platform_policy.Test.Name),
    			Rego:       "package test",
    		}, nil)
    		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.PlatformFunctions;
    import com.pulumi.harness.platform.inputs.GetPolicyArgs;
    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.getPolicy(GetPolicyArgs.builder()
                .identifier(harness_platform_policy.test().identifier())
                .name(harness_platform_policy.test().name())
                .rego("package test")
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_harness as harness
    
    test = harness.platform.get_policy(identifier=harness_platform_policy["test"]["identifier"],
        name=harness_platform_policy["test"]["name"],
        rego="package test")
    
    import * as pulumi from "@pulumi/pulumi";
    import * as harness from "@pulumi/harness";
    
    const test = harness.platform.getPolicy({
        identifier: harness_platform_policy.test.identifier,
        name: harness_platform_policy.test.name,
        rego: "package test",
    });
    
    variables:
      test:
        fn::invoke:
          Function: harness:platform:getPolicy
          Arguments:
            identifier: ${harness_platform_policy.test.identifier}
            name: ${harness_platform_policy.test.name}
            rego: package test
    

    Using getPolicy

    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 getPolicy(args: GetPolicyArgs, opts?: InvokeOptions): Promise<GetPolicyResult>
    function getPolicyOutput(args: GetPolicyOutputArgs, opts?: InvokeOptions): Output<GetPolicyResult>
    def get_policy(identifier: Optional[str] = None,
                   name: Optional[str] = None,
                   org_id: Optional[str] = None,
                   project_id: Optional[str] = None,
                   rego: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetPolicyResult
    def get_policy_output(identifier: Optional[pulumi.Input[str]] = None,
                   name: Optional[pulumi.Input[str]] = None,
                   org_id: Optional[pulumi.Input[str]] = None,
                   project_id: Optional[pulumi.Input[str]] = None,
                   rego: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetPolicyResult]
    func LookupPolicy(ctx *Context, args *LookupPolicyArgs, opts ...InvokeOption) (*LookupPolicyResult, error)
    func LookupPolicyOutput(ctx *Context, args *LookupPolicyOutputArgs, opts ...InvokeOption) LookupPolicyResultOutput

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

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

    The following arguments are supported:

    Rego string
    Rego code for the policy.
    Identifier string
    Unique identifier of the resource.
    Name string
    Name of the resource.
    OrgId string
    Unique identifier of the organization.
    ProjectId string
    Unique identifier of the project.
    Rego string
    Rego code for the policy.
    Identifier string
    Unique identifier of the resource.
    Name string
    Name of the resource.
    OrgId string
    Unique identifier of the organization.
    ProjectId string
    Unique identifier of the project.
    rego String
    Rego code for the policy.
    identifier String
    Unique identifier of the resource.
    name String
    Name of the resource.
    orgId String
    Unique identifier of the organization.
    projectId String
    Unique identifier of the project.
    rego string
    Rego code for the policy.
    identifier string
    Unique identifier of the resource.
    name string
    Name of the resource.
    orgId string
    Unique identifier of the organization.
    projectId string
    Unique identifier of the project.
    rego str
    Rego code for the policy.
    identifier str
    Unique identifier of the resource.
    name str
    Name of the resource.
    org_id str
    Unique identifier of the organization.
    project_id str
    Unique identifier of the project.
    rego String
    Rego code for the policy.
    identifier String
    Unique identifier of the resource.
    name String
    Name of the resource.
    orgId String
    Unique identifier of the organization.
    projectId String
    Unique identifier of the project.

    getPolicy Result

    The following output properties are available:

    Description string
    Description of the resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    Rego string
    Rego code for the policy.
    Tags List<string>
    Tags to associate with the resource.
    Identifier string
    Unique identifier of the resource.
    Name string
    Name of the resource.
    OrgId string
    Unique identifier of the organization.
    ProjectId string
    Unique identifier of the project.
    Description string
    Description of the resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    Rego string
    Rego code for the policy.
    Tags []string
    Tags to associate with the resource.
    Identifier string
    Unique identifier of the resource.
    Name string
    Name of the resource.
    OrgId string
    Unique identifier of the organization.
    ProjectId string
    Unique identifier of the project.
    description String
    Description of the resource.
    id String
    The provider-assigned unique ID for this managed resource.
    rego String
    Rego code for the policy.
    tags List<String>
    Tags to associate with the resource.
    identifier String
    Unique identifier of the resource.
    name String
    Name of the resource.
    orgId String
    Unique identifier of the organization.
    projectId String
    Unique identifier of the project.
    description string
    Description of the resource.
    id string
    The provider-assigned unique ID for this managed resource.
    rego string
    Rego code for the policy.
    tags string[]
    Tags to associate with the resource.
    identifier string
    Unique identifier of the resource.
    name string
    Name of the resource.
    orgId string
    Unique identifier of the organization.
    projectId string
    Unique identifier of the project.
    description str
    Description of the resource.
    id str
    The provider-assigned unique ID for this managed resource.
    rego str
    Rego code for the policy.
    tags Sequence[str]
    Tags to associate with the resource.
    identifier str
    Unique identifier of the resource.
    name str
    Name of the resource.
    org_id str
    Unique identifier of the organization.
    project_id str
    Unique identifier of the project.
    description String
    Description of the resource.
    id String
    The provider-assigned unique ID for this managed resource.
    rego String
    Rego code for the policy.
    tags List<String>
    Tags to associate with the resource.
    identifier String
    Unique identifier of the resource.
    name String
    Name of the resource.
    orgId String
    Unique identifier of the organization.
    projectId String
    Unique identifier of the project.

    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