All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.gcp.folder.kotlin.FolderFunctions.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.folder.kotlin

import com.pulumi.gcp.folder.FolderFunctions.getIamPolicyPlain
import com.pulumi.gcp.folder.FolderFunctions.getOrganizationPolicyPlain
import com.pulumi.gcp.folder.kotlin.inputs.GetIamPolicyPlainArgs
import com.pulumi.gcp.folder.kotlin.inputs.GetIamPolicyPlainArgsBuilder
import com.pulumi.gcp.folder.kotlin.inputs.GetOrganizationPolicyPlainArgs
import com.pulumi.gcp.folder.kotlin.inputs.GetOrganizationPolicyPlainArgsBuilder
import com.pulumi.gcp.folder.kotlin.outputs.GetIamPolicyResult
import com.pulumi.gcp.folder.kotlin.outputs.GetOrganizationPolicyResult
import kotlinx.coroutines.future.await
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import com.pulumi.gcp.folder.kotlin.outputs.GetIamPolicyResult.Companion.toKotlin as getIamPolicyResultToKotlin
import com.pulumi.gcp.folder.kotlin.outputs.GetOrganizationPolicyResult.Companion.toKotlin as getOrganizationPolicyResultToKotlin

public object FolderFunctions {
    /**
     * Retrieves the current IAM policy data for a folder.
     * ## example
     * 
     * ```typescript
     * import * as pulumi from "@pulumi/pulumi";
     * import * as gcp from "@pulumi/gcp";
     * const test = gcp.folder.getIamPolicy({
     *     folder: permissiontest.name,
     * });
     * ```
     * ```python
     * import pulumi
     * import pulumi_gcp as gcp
     * test = gcp.folder.get_iam_policy(folder=permissiontest["name"])
     * ```
     * ```csharp
     * using System.Collections.Generic;
     * using System.Linq;
     * using Pulumi;
     * using Gcp = Pulumi.Gcp;
     * return await Deployment.RunAsync(() =>
     * {
     *     var test = Gcp.Folder.GetIamPolicy.Invoke(new()
     *     {
     *         Folder = permissiontest.Name,
     *     });
     * });
     * ```
     * ```go
     * 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 {
     * 		_, err := folder.GetIamPolicy(ctx, &folder.GetIamPolicyArgs{
     * 			Folder: permissiontest.Name,
     * 		}, nil)
     * 		if err != nil {
     * 			return err
     * 		}
     * 		return nil
     * 	})
     * }
     * ```
     * ```java
     * 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.GetIamPolicyArgs;
     * 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 = FolderFunctions.getIamPolicy(GetIamPolicyArgs.builder()
     *             .folder(permissiontest.name())
     *             .build());
     *     }
     * }
     * ```
     * ```yaml
     * variables:
     *   test:
     *     fn::invoke:
     *       Function: gcp:folder:getIamPolicy
     *       Arguments:
     *         folder: ${permissiontest.name}
     * ```
     * 
     * @param argument A collection of arguments for invoking getIamPolicy.
     * @return A collection of values returned by getIamPolicy.
     */
    public suspend fun getIamPolicy(argument: GetIamPolicyPlainArgs): GetIamPolicyResult =
        getIamPolicyResultToKotlin(getIamPolicyPlain(argument.toJava()).await())

    /**
     * @see [getIamPolicy].
     * @param folder The resource name of the folder the policy is attached to. Its format is folders/{folder_id}.
     * @return A collection of values returned by getIamPolicy.
     */
    public suspend fun getIamPolicy(folder: String): GetIamPolicyResult {
        val argument = GetIamPolicyPlainArgs(
            folder = folder,
        )
        return getIamPolicyResultToKotlin(getIamPolicyPlain(argument.toJava()).await())
    }

    /**
     * @see [getIamPolicy].
     * @param argument Builder for [com.pulumi.gcp.folder.kotlin.inputs.GetIamPolicyPlainArgs].
     * @return A collection of values returned by getIamPolicy.
     */
    public suspend fun getIamPolicy(argument: suspend GetIamPolicyPlainArgsBuilder.() -> Unit): GetIamPolicyResult {
        val builder = GetIamPolicyPlainArgsBuilder()
        builder.argument()
        val builtArgument = builder.build()
        return getIamPolicyResultToKotlin(getIamPolicyPlain(builtArgument.toJava()).await())
    }

    /**
     * Allows management of Organization policies for a Google Folder. For more information see
     * [the official
   * documentation](https://cloud.google.com/resource-manager/docs/organization-policy/overview)
     * ## Example Usage
     * 
     * ```typescript
     * 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);
     * ```
     * ```python
     * 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)
     * ```
     * ```csharp
     * 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
     *     {
     *         ["version"] = policy.Apply(getOrganizationPolicyResult => getOrganizationPolicyResult.Version),
     *     };
     * });
     * ```
     * ```go
     * 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
     * 	})
     * }
     * ```
     * ```java
     * 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()));
     *     }
     * }
     * ```
     * ```yaml
     * variables:
     *   policy:
     *     fn::invoke:
     *       Function: gcp:folder:getOrganizationPolicy
     *       Arguments:
     *         folder: folders/folderid
     *         constraint: constraints/compute.trustedImageProjects
     * outputs:
     *   version: ${policy.version}
     * ```
     * 
     * @param argument A collection of arguments for invoking getOrganizationPolicy.
     * @return A collection of values returned by getOrganizationPolicy.
     */
    public suspend fun getOrganizationPolicy(argument: GetOrganizationPolicyPlainArgs): GetOrganizationPolicyResult =
        getOrganizationPolicyResultToKotlin(getOrganizationPolicyPlain(argument.toJava()).await())

    /**
     * @see [getOrganizationPolicy].
     * @param constraint (Required) The name of the Constraint the Policy is configuring, for example, `serviceuser.services`. Check out the [complete list of available constraints](https://cloud.google.com/resource-manager/docs/organization-policy/understanding-constraints#available_constraints).
     * @param folder The resource name of the folder to set the policy for. Its format is folders/{folder_id}.
     * @return A collection of values returned by getOrganizationPolicy.
     */
    public suspend fun getOrganizationPolicy(constraint: String, folder: String): GetOrganizationPolicyResult {
        val argument = GetOrganizationPolicyPlainArgs(
            constraint = constraint,
            folder = folder,
        )
        return getOrganizationPolicyResultToKotlin(getOrganizationPolicyPlain(argument.toJava()).await())
    }

    /**
     * @see [getOrganizationPolicy].
     * @param argument Builder for [com.pulumi.gcp.folder.kotlin.inputs.GetOrganizationPolicyPlainArgs].
     * @return A collection of values returned by getOrganizationPolicy.
     */
    public suspend fun getOrganizationPolicy(argument: suspend GetOrganizationPolicyPlainArgsBuilder.() -> Unit): GetOrganizationPolicyResult {
        val builder = GetOrganizationPolicyPlainArgsBuilder()
        builder.argument()
        val builtArgument = builder.build()
        return getOrganizationPolicyResultToKotlin(getOrganizationPolicyPlain(builtArgument.toJava()).await())
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy