1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. folder
  5. getOrganizationPolicy
Google Cloud Classic v7.11.2 published on Wednesday, Feb 28, 2024 by Pulumi

gcp.folder.getOrganizationPolicy

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.11.2 published on Wednesday, Feb 28, 2024 by Pulumi

    Allows management of Organization policies for a Google Folder. For more information see the official documentation

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var policy = Gcp.Folder.GetOrganizationPolicy.Invoke(new()
        {
            Folder = "folders/folderid",
            Constraint = "constraints/compute.trustedImageProjects",
        });
    
        return new Dictionary<string, object?>
        {
            ["version"] = policy.Apply(getOrganizationPolicyResult => getOrganizationPolicyResult.Version),
        };
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/folder"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		policy, err := folder.LookupOrganizationPolicy(ctx, &folder.LookupOrganizationPolicyArgs{
    			Folder:     "folders/folderid",
    			Constraint: "constraints/compute.trustedImageProjects",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("version", policy.Version)
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.folder.FolderFunctions;
    import com.pulumi.gcp.folder.inputs.GetOrganizationPolicyArgs;
    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 policy = FolderFunctions.getOrganizationPolicy(GetOrganizationPolicyArgs.builder()
                .folder("folders/folderid")
                .constraint("constraints/compute.trustedImageProjects")
                .build());
    
            ctx.export("version", policy.applyValue(getOrganizationPolicyResult -> getOrganizationPolicyResult.version()));
        }
    }
    
    import pulumi
    import pulumi_gcp as gcp
    
    policy = gcp.folder.get_organization_policy(folder="folders/folderid",
        constraint="constraints/compute.trustedImageProjects")
    pulumi.export("version", policy.version)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const policy = gcp.folder.getOrganizationPolicy({
        folder: "folders/folderid",
        constraint: "constraints/compute.trustedImageProjects",
    });
    export const version = policy.then(policy => policy.version);
    
    variables:
      policy:
        fn::invoke:
          Function: gcp:folder:getOrganizationPolicy
          Arguments:
            folder: folders/folderid
            constraint: constraints/compute.trustedImageProjects
    outputs:
      version: ${policy.version}
    

    Using getOrganizationPolicy

    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 getOrganizationPolicy(args: GetOrganizationPolicyArgs, opts?: InvokeOptions): Promise<GetOrganizationPolicyResult>
    function getOrganizationPolicyOutput(args: GetOrganizationPolicyOutputArgs, opts?: InvokeOptions): Output<GetOrganizationPolicyResult>
    def get_organization_policy(constraint: Optional[str] = None,
                                folder: Optional[str] = None,
                                opts: Optional[InvokeOptions] = None) -> GetOrganizationPolicyResult
    def get_organization_policy_output(constraint: Optional[pulumi.Input[str]] = None,
                                folder: Optional[pulumi.Input[str]] = None,
                                opts: Optional[InvokeOptions] = None) -> Output[GetOrganizationPolicyResult]
    func LookupOrganizationPolicy(ctx *Context, args *LookupOrganizationPolicyArgs, opts ...InvokeOption) (*LookupOrganizationPolicyResult, error)
    func LookupOrganizationPolicyOutput(ctx *Context, args *LookupOrganizationPolicyOutputArgs, opts ...InvokeOption) LookupOrganizationPolicyResultOutput

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

    public static class GetOrganizationPolicy 
    {
        public static Task<GetOrganizationPolicyResult> InvokeAsync(GetOrganizationPolicyArgs args, InvokeOptions? opts = null)
        public static Output<GetOrganizationPolicyResult> Invoke(GetOrganizationPolicyInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetOrganizationPolicyResult> getOrganizationPolicy(GetOrganizationPolicyArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: gcp:folder/getOrganizationPolicy:getOrganizationPolicy
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Constraint string
    (Required) The name of the Constraint the Policy is configuring, for example, serviceuser.services. Check out the complete list of available constraints.
    Folder string
    The resource name of the folder to set the policy for. Its format is folders/{folder_id}.
    Constraint string
    (Required) The name of the Constraint the Policy is configuring, for example, serviceuser.services. Check out the complete list of available constraints.
    Folder string
    The resource name of the folder to set the policy for. Its format is folders/{folder_id}.
    constraint String
    (Required) The name of the Constraint the Policy is configuring, for example, serviceuser.services. Check out the complete list of available constraints.
    folder String
    The resource name of the folder to set the policy for. Its format is folders/{folder_id}.
    constraint string
    (Required) The name of the Constraint the Policy is configuring, for example, serviceuser.services. Check out the complete list of available constraints.
    folder string
    The resource name of the folder to set the policy for. Its format is folders/{folder_id}.
    constraint str
    (Required) The name of the Constraint the Policy is configuring, for example, serviceuser.services. Check out the complete list of available constraints.
    folder str
    The resource name of the folder to set the policy for. Its format is folders/{folder_id}.
    constraint String
    (Required) The name of the Constraint the Policy is configuring, for example, serviceuser.services. Check out the complete list of available constraints.
    folder String
    The resource name of the folder to set the policy for. Its format is folders/{folder_id}.

    getOrganizationPolicy Result

    The following output properties are available:

    booleanPolicies List<Property Map>
    constraint String
    etag String
    folder String
    id String
    The provider-assigned unique ID for this managed resource.
    listPolicies List<Property Map>
    restorePolicies List<Property Map>
    updateTime String
    version Number

    Supporting Types

    GetOrganizationPolicyBooleanPolicy

    Enforced bool
    If true, then the Policy is enforced. If false, then any configuration is acceptable.
    Enforced bool
    If true, then the Policy is enforced. If false, then any configuration is acceptable.
    enforced Boolean
    If true, then the Policy is enforced. If false, then any configuration is acceptable.
    enforced boolean
    If true, then the Policy is enforced. If false, then any configuration is acceptable.
    enforced bool
    If true, then the Policy is enforced. If false, then any configuration is acceptable.
    enforced Boolean
    If true, then the Policy is enforced. If false, then any configuration is acceptable.

    GetOrganizationPolicyListPolicy

    Allows List<GetOrganizationPolicyListPolicyAllow>
    One or the other must be set.
    Denies List<GetOrganizationPolicyListPolicyDeny>
    One or the other must be set.
    InheritFromParent bool
    If set to true, the values from the effective Policy of the parent resource are inherited, meaning the values set in this Policy are added to the values inherited up the hierarchy.
    SuggestedValue string
    The Google Cloud Console will try to default to a configuration that matches the value specified in this field.
    Allows []GetOrganizationPolicyListPolicyAllow
    One or the other must be set.
    Denies []GetOrganizationPolicyListPolicyDeny
    One or the other must be set.
    InheritFromParent bool
    If set to true, the values from the effective Policy of the parent resource are inherited, meaning the values set in this Policy are added to the values inherited up the hierarchy.
    SuggestedValue string
    The Google Cloud Console will try to default to a configuration that matches the value specified in this field.
    allows List<GetOrganizationPolicyListPolicyAllow>
    One or the other must be set.
    denies List<GetOrganizationPolicyListPolicyDeny>
    One or the other must be set.
    inheritFromParent Boolean
    If set to true, the values from the effective Policy of the parent resource are inherited, meaning the values set in this Policy are added to the values inherited up the hierarchy.
    suggestedValue String
    The Google Cloud Console will try to default to a configuration that matches the value specified in this field.
    allows GetOrganizationPolicyListPolicyAllow[]
    One or the other must be set.
    denies GetOrganizationPolicyListPolicyDeny[]
    One or the other must be set.
    inheritFromParent boolean
    If set to true, the values from the effective Policy of the parent resource are inherited, meaning the values set in this Policy are added to the values inherited up the hierarchy.
    suggestedValue string
    The Google Cloud Console will try to default to a configuration that matches the value specified in this field.
    allows Sequence[GetOrganizationPolicyListPolicyAllow]
    One or the other must be set.
    denies Sequence[GetOrganizationPolicyListPolicyDeny]
    One or the other must be set.
    inherit_from_parent bool
    If set to true, the values from the effective Policy of the parent resource are inherited, meaning the values set in this Policy are added to the values inherited up the hierarchy.
    suggested_value str
    The Google Cloud Console will try to default to a configuration that matches the value specified in this field.
    allows List<Property Map>
    One or the other must be set.
    denies List<Property Map>
    One or the other must be set.
    inheritFromParent Boolean
    If set to true, the values from the effective Policy of the parent resource are inherited, meaning the values set in this Policy are added to the values inherited up the hierarchy.
    suggestedValue String
    The Google Cloud Console will try to default to a configuration that matches the value specified in this field.

    GetOrganizationPolicyListPolicyAllow

    All bool
    The policy allows or denies all values.
    Values List<string>
    The policy can define specific values that are allowed or denied.
    All bool
    The policy allows or denies all values.
    Values []string
    The policy can define specific values that are allowed or denied.
    all Boolean
    The policy allows or denies all values.
    values List<String>
    The policy can define specific values that are allowed or denied.
    all boolean
    The policy allows or denies all values.
    values string[]
    The policy can define specific values that are allowed or denied.
    all bool
    The policy allows or denies all values.
    values Sequence[str]
    The policy can define specific values that are allowed or denied.
    all Boolean
    The policy allows or denies all values.
    values List<String>
    The policy can define specific values that are allowed or denied.

    GetOrganizationPolicyListPolicyDeny

    All bool
    The policy allows or denies all values.
    Values List<string>
    The policy can define specific values that are allowed or denied.
    All bool
    The policy allows or denies all values.
    Values []string
    The policy can define specific values that are allowed or denied.
    all Boolean
    The policy allows or denies all values.
    values List<String>
    The policy can define specific values that are allowed or denied.
    all boolean
    The policy allows or denies all values.
    values string[]
    The policy can define specific values that are allowed or denied.
    all bool
    The policy allows or denies all values.
    values Sequence[str]
    The policy can define specific values that are allowed or denied.
    all Boolean
    The policy allows or denies all values.
    values List<String>
    The policy can define specific values that are allowed or denied.

    GetOrganizationPolicyRestorePolicy

    Default bool
    May only be set to true. If set, then the default Policy is restored.
    Default bool
    May only be set to true. If set, then the default Policy is restored.
    default_ Boolean
    May only be set to true. If set, then the default Policy is restored.
    default boolean
    May only be set to true. If set, then the default Policy is restored.
    default bool
    May only be set to true. If set, then the default Policy is restored.
    default Boolean
    May only be set to true. If set, then the default Policy is restored.

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v7.11.2 published on Wednesday, Feb 28, 2024 by Pulumi