1. Packages
  2. Okta
  3. API Docs
  4. policy
  5. getPolicy
Okta v4.8.0 published on Saturday, Mar 2, 2024 by Pulumi

okta.policy.getPolicy

Explore with Pulumi AI

okta logo
Okta v4.8.0 published on Saturday, Mar 2, 2024 by Pulumi

    Use this data source to retrieve a policy from Okta.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Okta = Pulumi.Okta;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Okta.Policy.GetPolicy.Invoke(new()
        {
            Name = "Password Policy Example",
            Type = "PASSWORD",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-okta/sdk/v4/go/okta/policy"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := policy.GetPolicy(ctx, &policy.GetPolicyArgs{
    			Name: "Password Policy Example",
    			Type: "PASSWORD",
    		}, 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.okta.policy.PolicyFunctions;
    import com.pulumi.okta.policy.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 example = PolicyFunctions.getPolicy(GetPolicyArgs.builder()
                .name("Password Policy Example")
                .type("PASSWORD")
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_okta as okta
    
    example = okta.policy.get_policy(name="Password Policy Example",
        type="PASSWORD")
    
    import * as pulumi from "@pulumi/pulumi";
    import * as okta from "@pulumi/okta";
    
    const example = okta.policy.getPolicy({
        name: "Password Policy Example",
        type: "PASSWORD",
    });
    
    variables:
      example:
        fn::invoke:
          Function: okta:policy:getPolicy
          Arguments:
            name: Password Policy Example
            type: PASSWORD
    

    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(name: Optional[str] = None,
                   type: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetPolicyResult
    def get_policy_output(name: Optional[pulumi.Input[str]] = None,
                   type: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetPolicyResult]
    func GetPolicy(ctx *Context, args *GetPolicyArgs, opts ...InvokeOption) (*GetPolicyResult, error)
    func GetPolicyOutput(ctx *Context, args *GetPolicyOutputArgs, opts ...InvokeOption) GetPolicyResultOutput

    > Note: This function is named GetPolicy 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: okta:policy/getPolicy:getPolicy
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    Name of policy to retrieve.
    Type string
    Type of policy to retrieve. See https://developer.okta.com/docs/reference/api/policy/#policy-object for valid values. Currently:

    • All:
    Name string
    Name of policy to retrieve.
    Type string
    Type of policy to retrieve. See https://developer.okta.com/docs/reference/api/policy/#policy-object for valid values. Currently:

    • All:
    name String
    Name of policy to retrieve.
    type String
    Type of policy to retrieve. See https://developer.okta.com/docs/reference/api/policy/#policy-object for valid values. Currently:

    • All:
    name string
    Name of policy to retrieve.
    type string
    Type of policy to retrieve. See https://developer.okta.com/docs/reference/api/policy/#policy-object for valid values. Currently:

    • All:
    name str
    Name of policy to retrieve.
    type str
    Type of policy to retrieve. See https://developer.okta.com/docs/reference/api/policy/#policy-object for valid values. Currently:

    • All:
    name String
    Name of policy to retrieve.
    type String
    Type of policy to retrieve. See https://developer.okta.com/docs/reference/api/policy/#policy-object for valid values. Currently:

    • All:

    getPolicy Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    name of policy.
    Status string
    Type string
    type of policy.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    name of policy.
    Status string
    Type string
    type of policy.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    name of policy.
    status String
    type String
    type of policy.
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    name of policy.
    status string
    type string
    type of policy.
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    name of policy.
    status str
    type str
    type of policy.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    name of policy.
    status String
    type String
    type of policy.

    Package Details

    Repository
    Okta pulumi/pulumi-okta
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the okta Terraform Provider.
    okta logo
    Okta v4.8.0 published on Saturday, Mar 2, 2024 by Pulumi