1. Packages
  2. Zscaler Private Access (ZPA)
  3. API Docs
  4. getPolicyType
Zscaler Private Access v0.0.12 published on Tuesday, Jul 30, 2024 by Zscaler

zpa.getPolicyType

Explore with Pulumi AI

zpa logo
Zscaler Private Access v0.0.12 published on Tuesday, Jul 30, 2024 by Zscaler

    Use the zpa_policy_type data source to get information about an a policy_set_id and policy_type. This data source is required when creating:

    1. Access policy Rules
    2. Access policy timeout rules
    3. Access policy forwarding rules
    4. Access policy inspection rules

    NOTE The parameters policy_set_id is required in all circumstances and is exported when checking for the policy_type parameter. The policy_type value is used for differentiating the policy types, in the request endpoint. The supported values are:

    • ACCESS_POLICY/GLOBAL_POLICY
    • TIMEOUT_POLICY/REAUTH_POLICY
    • BYPASS_POLICY/CLIENT_FORWARDING_POLICY
    • INSPECTION_POLICY

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as zpa from "@pulumi/zpa";
    
    const accessPolicy = zpa.getPolicyType({
        policyType: "ACCESS_POLICY",
    });
    export const zpaPolicyTypeAccessPolicy = accessPolicy.then(accessPolicy => accessPolicy.id);
    
    import pulumi
    import pulumi_zpa as zpa
    
    access_policy = zpa.get_policy_type(policy_type="ACCESS_POLICY")
    pulumi.export("zpaPolicyTypeAccessPolicy", access_policy.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/zscaler/pulumi-zpa/sdk/go/zpa"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		accessPolicy, err := zpa.GetPolicyType(ctx, &zpa.GetPolicyTypeArgs{
    			PolicyType: pulumi.StringRef("ACCESS_POLICY"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("zpaPolicyTypeAccessPolicy", accessPolicy.Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Zpa = Pulumi.Zpa;
    
    return await Deployment.RunAsync(() => 
    {
        var accessPolicy = Zpa.GetPolicyType.Invoke(new()
        {
            PolicyType = "ACCESS_POLICY",
        });
    
        return new Dictionary<string, object?>
        {
            ["zpaPolicyTypeAccessPolicy"] = accessPolicy.Apply(getPolicyTypeResult => getPolicyTypeResult.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.zpa.ZpaFunctions;
    import com.pulumi.zpa.inputs.GetPolicyTypeArgs;
    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 accessPolicy = ZpaFunctions.getPolicyType(GetPolicyTypeArgs.builder()
                .policyType("ACCESS_POLICY")
                .build());
    
            ctx.export("zpaPolicyTypeAccessPolicy", accessPolicy.applyValue(getPolicyTypeResult -> getPolicyTypeResult.id()));
        }
    }
    
    variables:
      accessPolicy:
        fn::invoke:
          Function: zpa:getPolicyType
          Arguments:
            policyType: ACCESS_POLICY
    outputs:
      zpaPolicyTypeAccessPolicy: ${accessPolicy.id}
    
    import * as pulumi from "@pulumi/pulumi";
    import * as zpa from "@pulumi/zpa";
    
    const globalPolicy = zpa.getPolicyType({
        policyType: "GLOBAL_POLICY",
    });
    export const zpaPolicyTypeAccessPolicy = globalPolicy.then(globalPolicy => globalPolicy.id);
    
    import pulumi
    import pulumi_zpa as zpa
    
    global_policy = zpa.get_policy_type(policy_type="GLOBAL_POLICY")
    pulumi.export("zpaPolicyTypeAccessPolicy", global_policy.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/zscaler/pulumi-zpa/sdk/go/zpa"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		globalPolicy, err := zpa.GetPolicyType(ctx, &zpa.GetPolicyTypeArgs{
    			PolicyType: pulumi.StringRef("GLOBAL_POLICY"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("zpaPolicyTypeAccessPolicy", globalPolicy.Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Zpa = Pulumi.Zpa;
    
    return await Deployment.RunAsync(() => 
    {
        var globalPolicy = Zpa.GetPolicyType.Invoke(new()
        {
            PolicyType = "GLOBAL_POLICY",
        });
    
        return new Dictionary<string, object?>
        {
            ["zpaPolicyTypeAccessPolicy"] = globalPolicy.Apply(getPolicyTypeResult => getPolicyTypeResult.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.zpa.ZpaFunctions;
    import com.pulumi.zpa.inputs.GetPolicyTypeArgs;
    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 globalPolicy = ZpaFunctions.getPolicyType(GetPolicyTypeArgs.builder()
                .policyType("GLOBAL_POLICY")
                .build());
    
            ctx.export("zpaPolicyTypeAccessPolicy", globalPolicy.applyValue(getPolicyTypeResult -> getPolicyTypeResult.id()));
        }
    }
    
    variables:
      globalPolicy:
        fn::invoke:
          Function: zpa:getPolicyType
          Arguments:
            policyType: GLOBAL_POLICY
    outputs:
      zpaPolicyTypeAccessPolicy: ${globalPolicy.id}
    
    import * as pulumi from "@pulumi/pulumi";
    import * as zpa from "@pulumi/zpa";
    
    const timeoutPolicy = zpa.getPolicyType({
        policyType: "TIMEOUT_POLICY",
    });
    export const zpaPolicyTypeTimeoutPolicy = timeoutPolicy.then(timeoutPolicy => timeoutPolicy.id);
    
    import pulumi
    import pulumi_zpa as zpa
    
    timeout_policy = zpa.get_policy_type(policy_type="TIMEOUT_POLICY")
    pulumi.export("zpaPolicyTypeTimeoutPolicy", timeout_policy.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/zscaler/pulumi-zpa/sdk/go/zpa"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		timeoutPolicy, err := zpa.GetPolicyType(ctx, &zpa.GetPolicyTypeArgs{
    			PolicyType: pulumi.StringRef("TIMEOUT_POLICY"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("zpaPolicyTypeTimeoutPolicy", timeoutPolicy.Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Zpa = Pulumi.Zpa;
    
    return await Deployment.RunAsync(() => 
    {
        var timeoutPolicy = Zpa.GetPolicyType.Invoke(new()
        {
            PolicyType = "TIMEOUT_POLICY",
        });
    
        return new Dictionary<string, object?>
        {
            ["zpaPolicyTypeTimeoutPolicy"] = timeoutPolicy.Apply(getPolicyTypeResult => getPolicyTypeResult.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.zpa.ZpaFunctions;
    import com.pulumi.zpa.inputs.GetPolicyTypeArgs;
    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 timeoutPolicy = ZpaFunctions.getPolicyType(GetPolicyTypeArgs.builder()
                .policyType("TIMEOUT_POLICY")
                .build());
    
            ctx.export("zpaPolicyTypeTimeoutPolicy", timeoutPolicy.applyValue(getPolicyTypeResult -> getPolicyTypeResult.id()));
        }
    }
    
    variables:
      timeoutPolicy:
        fn::invoke:
          Function: zpa:getPolicyType
          Arguments:
            policyType: TIMEOUT_POLICY
    outputs:
      zpaPolicyTypeTimeoutPolicy: ${timeoutPolicy.id}
    
    import * as pulumi from "@pulumi/pulumi";
    import * as zpa from "@pulumi/zpa";
    
    const reauthPolicy = zpa.getPolicyType({
        policyType: "REAUTH_POLICY",
    });
    export const zpaPolicyTypeReauthPolicy = reauthPolicy.then(reauthPolicy => reauthPolicy.id);
    
    import pulumi
    import pulumi_zpa as zpa
    
    reauth_policy = zpa.get_policy_type(policy_type="REAUTH_POLICY")
    pulumi.export("zpaPolicyTypeReauthPolicy", reauth_policy.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/zscaler/pulumi-zpa/sdk/go/zpa"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		reauthPolicy, err := zpa.GetPolicyType(ctx, &zpa.GetPolicyTypeArgs{
    			PolicyType: pulumi.StringRef("REAUTH_POLICY"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("zpaPolicyTypeReauthPolicy", reauthPolicy.Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Zpa = Pulumi.Zpa;
    
    return await Deployment.RunAsync(() => 
    {
        var reauthPolicy = Zpa.GetPolicyType.Invoke(new()
        {
            PolicyType = "REAUTH_POLICY",
        });
    
        return new Dictionary<string, object?>
        {
            ["zpaPolicyTypeReauthPolicy"] = reauthPolicy.Apply(getPolicyTypeResult => getPolicyTypeResult.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.zpa.ZpaFunctions;
    import com.pulumi.zpa.inputs.GetPolicyTypeArgs;
    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 reauthPolicy = ZpaFunctions.getPolicyType(GetPolicyTypeArgs.builder()
                .policyType("REAUTH_POLICY")
                .build());
    
            ctx.export("zpaPolicyTypeReauthPolicy", reauthPolicy.applyValue(getPolicyTypeResult -> getPolicyTypeResult.id()));
        }
    }
    
    variables:
      reauthPolicy:
        fn::invoke:
          Function: zpa:getPolicyType
          Arguments:
            policyType: REAUTH_POLICY
    outputs:
      zpaPolicyTypeReauthPolicy: ${reauthPolicy.id}
    
    import * as pulumi from "@pulumi/pulumi";
    import * as zpa from "@pulumi/zpa";
    
    const clientForwardingPolicy = zpa.getPolicyType({
        policyType: "CLIENT_FORWARDING_POLICY",
    });
    export const zpaPolicyTypeClientForwardingPolicy = clientForwardingPolicy.then(clientForwardingPolicy => clientForwardingPolicy.id);
    
    import pulumi
    import pulumi_zpa as zpa
    
    client_forwarding_policy = zpa.get_policy_type(policy_type="CLIENT_FORWARDING_POLICY")
    pulumi.export("zpaPolicyTypeClientForwardingPolicy", client_forwarding_policy.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/zscaler/pulumi-zpa/sdk/go/zpa"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		clientForwardingPolicy, err := zpa.GetPolicyType(ctx, &zpa.GetPolicyTypeArgs{
    			PolicyType: pulumi.StringRef("CLIENT_FORWARDING_POLICY"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("zpaPolicyTypeClientForwardingPolicy", clientForwardingPolicy.Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Zpa = Pulumi.Zpa;
    
    return await Deployment.RunAsync(() => 
    {
        var clientForwardingPolicy = Zpa.GetPolicyType.Invoke(new()
        {
            PolicyType = "CLIENT_FORWARDING_POLICY",
        });
    
        return new Dictionary<string, object?>
        {
            ["zpaPolicyTypeClientForwardingPolicy"] = clientForwardingPolicy.Apply(getPolicyTypeResult => getPolicyTypeResult.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.zpa.ZpaFunctions;
    import com.pulumi.zpa.inputs.GetPolicyTypeArgs;
    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 clientForwardingPolicy = ZpaFunctions.getPolicyType(GetPolicyTypeArgs.builder()
                .policyType("CLIENT_FORWARDING_POLICY")
                .build());
    
            ctx.export("zpaPolicyTypeClientForwardingPolicy", clientForwardingPolicy.applyValue(getPolicyTypeResult -> getPolicyTypeResult.id()));
        }
    }
    
    variables:
      clientForwardingPolicy:
        fn::invoke:
          Function: zpa:getPolicyType
          Arguments:
            policyType: CLIENT_FORWARDING_POLICY
    outputs:
      zpaPolicyTypeClientForwardingPolicy: ${clientForwardingPolicy.id}
    
    import * as pulumi from "@pulumi/pulumi";
    import * as zpa from "@pulumi/zpa";
    
    const inspectionPolicy = zpa.getPolicyType({
        policyType: "INSPECTION_POLICY",
    });
    export const zpaPolicyTypeInspectionPolicy = inspectionPolicy.then(inspectionPolicy => inspectionPolicy.id);
    
    import pulumi
    import pulumi_zpa as zpa
    
    inspection_policy = zpa.get_policy_type(policy_type="INSPECTION_POLICY")
    pulumi.export("zpaPolicyTypeInspectionPolicy", inspection_policy.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/zscaler/pulumi-zpa/sdk/go/zpa"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		inspectionPolicy, err := zpa.GetPolicyType(ctx, &zpa.GetPolicyTypeArgs{
    			PolicyType: pulumi.StringRef("INSPECTION_POLICY"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("zpaPolicyTypeInspectionPolicy", inspectionPolicy.Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Zpa = Pulumi.Zpa;
    
    return await Deployment.RunAsync(() => 
    {
        var inspectionPolicy = Zpa.GetPolicyType.Invoke(new()
        {
            PolicyType = "INSPECTION_POLICY",
        });
    
        return new Dictionary<string, object?>
        {
            ["zpaPolicyTypeInspectionPolicy"] = inspectionPolicy.Apply(getPolicyTypeResult => getPolicyTypeResult.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.zpa.ZpaFunctions;
    import com.pulumi.zpa.inputs.GetPolicyTypeArgs;
    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 inspectionPolicy = ZpaFunctions.getPolicyType(GetPolicyTypeArgs.builder()
                .policyType("INSPECTION_POLICY")
                .build());
    
            ctx.export("zpaPolicyTypeInspectionPolicy", inspectionPolicy.applyValue(getPolicyTypeResult -> getPolicyTypeResult.id()));
        }
    }
    
    variables:
      inspectionPolicy:
        fn::invoke:
          Function: zpa:getPolicyType
          Arguments:
            policyType: INSPECTION_POLICY
    outputs:
      zpaPolicyTypeInspectionPolicy: ${inspectionPolicy.id}
    

    Using getPolicyType

    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 getPolicyType(args: GetPolicyTypeArgs, opts?: InvokeOptions): Promise<GetPolicyTypeResult>
    function getPolicyTypeOutput(args: GetPolicyTypeOutputArgs, opts?: InvokeOptions): Output<GetPolicyTypeResult>
    def get_policy_type(id: Optional[str] = None,
                        microtenant_id: Optional[str] = None,
                        microtenant_name: Optional[str] = None,
                        policy_type: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetPolicyTypeResult
    def get_policy_type_output(id: Optional[pulumi.Input[str]] = None,
                        microtenant_id: Optional[pulumi.Input[str]] = None,
                        microtenant_name: Optional[pulumi.Input[str]] = None,
                        policy_type: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetPolicyTypeResult]
    func GetPolicyType(ctx *Context, args *GetPolicyTypeArgs, opts ...InvokeOption) (*GetPolicyTypeResult, error)
    func GetPolicyTypeOutput(ctx *Context, args *GetPolicyTypeOutputArgs, opts ...InvokeOption) GetPolicyTypeResultOutput

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

    public static class GetPolicyType 
    {
        public static Task<GetPolicyTypeResult> InvokeAsync(GetPolicyTypeArgs args, InvokeOptions? opts = null)
        public static Output<GetPolicyTypeResult> Invoke(GetPolicyTypeInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetPolicyTypeResult> getPolicyType(GetPolicyTypeArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: zpa:index/getPolicyType:getPolicyType
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id string
    MicrotenantId string
    MicrotenantName string
    PolicyType string
    Id string
    MicrotenantId string
    MicrotenantName string
    PolicyType string
    id String
    microtenantId String
    microtenantName String
    policyType String
    id string
    microtenantId string
    microtenantName string
    policyType string
    id String
    microtenantId String
    microtenantName String
    policyType String

    getPolicyType Result

    The following output properties are available:

    Supporting Types

    GetPolicyTypeRule

    GetPolicyTypeRuleCondition

    GetPolicyTypeRuleConditionOperand

    CreationTime string
    Id string
    IdpId string
    Lhs string
    ModifiedBy string
    ModifiedTime string
    Name string
    ObjectType string
    Operator string
    Rhs string
    CreationTime string
    Id string
    IdpId string
    Lhs string
    ModifiedBy string
    ModifiedTime string
    Name string
    ObjectType string
    Operator string
    Rhs string
    creationTime String
    id String
    idpId String
    lhs String
    modifiedBy String
    modifiedTime String
    name String
    objectType String
    operator String
    rhs String
    creationTime string
    id string
    idpId string
    lhs string
    modifiedBy string
    modifiedTime string
    name string
    objectType string
    operator string
    rhs string
    creationTime String
    id String
    idpId String
    lhs String
    modifiedBy String
    modifiedTime String
    name String
    objectType String
    operator String
    rhs String

    Package Details

    Repository
    zpa zscaler/pulumi-zpa
    License
    MIT
    Notes
    This Pulumi package is based on the zpa Terraform Provider.
    zpa logo
    Zscaler Private Access v0.0.12 published on Tuesday, Jul 30, 2024 by Zscaler