1. Packages
  2. Okta Provider
  3. API Docs
  4. policy
  5. getPolicy
Okta v4.16.0 published on Wednesday, Apr 9, 2025 by Pulumi

okta.policy.getPolicy

Explore with Pulumi AI

Okta v4.16.0 published on Wednesday, Apr 9, 2025 by Pulumi

Get a policy from Okta.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as okta from "@pulumi/okta";

const example = okta.policy.getPolicy({
    name: "Password Policy Example",
    type: "PASSWORD",
});
Copy
import pulumi
import pulumi_okta as okta

example = okta.policy.get_policy(name="Password Policy Example",
    type="PASSWORD")
Copy
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
	})
}
Copy
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",
    });

});
Copy
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());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: okta:policy:getPolicy
      arguments:
        name: Password Policy Example
        type: PASSWORD
Copy

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>
Copy
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]
Copy
func GetPolicy(ctx *Context, args *GetPolicyArgs, opts ...InvokeOption) (*GetPolicyResult, error)
func GetPolicyOutput(ctx *Context, args *GetPolicyOutputArgs, opts ...InvokeOption) GetPolicyResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetPolicyResult> getPolicy(GetPolicyArgs args, InvokeOptions options)
public static Output<GetPolicyResult> getPolicy(GetPolicyArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: okta:policy/getPolicy:getPolicy
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
Name of the policy
Type This property is required. string
Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object
Name This property is required. string
Name of the policy
Type This property is required. string
Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object
name This property is required. String
Name of the policy
type This property is required. String
Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object
name This property is required. string
Name of the policy
type This property is required. string
Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object
name This property is required. str
Name of the policy
type This property is required. str
Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object
name This property is required. String
Name of the policy
type This property is required. String
Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object

getPolicy Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
Name string
Name of the policy
Status string
Status of the policy
Type string
Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object
Id string
The provider-assigned unique ID for this managed resource.
Name string
Name of the policy
Status string
Status of the policy
Type string
Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object
id String
The provider-assigned unique ID for this managed resource.
name String
Name of the policy
status String
Status of the policy
type String
Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object
id string
The provider-assigned unique ID for this managed resource.
name string
Name of the policy
status string
Status of the policy
type string
Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object
id str
The provider-assigned unique ID for this managed resource.
name str
Name of the policy
status str
Status of the policy
type str
Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object
id String
The provider-assigned unique ID for this managed resource.
name String
Name of the policy
status String
Status of the policy
type String
Policy type, see https://developer.okta.com/docs/reference/api/policy/#policy-object

Package Details

Repository
Okta pulumi/pulumi-okta
License
Apache-2.0
Notes
This Pulumi package is based on the okta Terraform Provider.
Okta v4.16.0 published on Wednesday, Apr 9, 2025 by Pulumi