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

com.pulumi.gcp.iam.kotlin.WorkforcePool.kt Maven / Gradle / Ivy

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

package com.pulumi.gcp.iam.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.iam.kotlin.outputs.WorkforcePoolAccessRestrictions
import com.pulumi.gcp.iam.kotlin.outputs.WorkforcePoolAccessRestrictions.Companion.toKotlin
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit

/**
 * Builder for [WorkforcePool].
 */
@PulumiTagMarker
public class WorkforcePoolResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: WorkforcePoolArgs = WorkforcePoolArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend WorkforcePoolArgsBuilder.() -> Unit) {
        val builder = WorkforcePoolArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): WorkforcePool {
        val builtJavaResource = com.pulumi.gcp.iam.WorkforcePool(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return WorkforcePool(builtJavaResource)
    }
}

/**
 * Represents a collection of external workforces. Provides namespaces for
 * federated users that can be referenced in IAM policies.
 * To get more information about WorkforcePool, see:
 * * [API documentation](https://cloud.google.com/iam/docs/reference/rest/v1/locations.workforcePools)
 * * How-to Guides
 *     * [Manage pools](https://cloud.google.com/iam/docs/manage-workforce-identity-pools-providers#manage_pools)
 * > **Note:** Ask your Google Cloud account team to request access to workforce identity federation for
 * your billing/quota project. The account team notifies you when the project is granted access.
 * ## Example Usage
 * ### Iam Workforce Pool Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const example = new gcp.iam.WorkforcePool("example", {
 *     workforcePoolId: "example-pool",
 *     parent: "organizations/123456789",
 *     location: "global",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * example = gcp.iam.WorkforcePool("example",
 *     workforce_pool_id="example-pool",
 *     parent="organizations/123456789",
 *     location="global")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Gcp.Iam.WorkforcePool("example", new()
 *     {
 *         WorkforcePoolId = "example-pool",
 *         Parent = "organizations/123456789",
 *         Location = "global",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/iam"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := iam.NewWorkforcePool(ctx, "example", &iam.WorkforcePoolArgs{
 * 			WorkforcePoolId: pulumi.String("example-pool"),
 * 			Parent:          pulumi.String("organizations/123456789"),
 * 			Location:        pulumi.String("global"),
 * 		})
 * 		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.iam.WorkforcePool;
 * import com.pulumi.gcp.iam.WorkforcePoolArgs;
 * 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) {
 *         var example = new WorkforcePool("example", WorkforcePoolArgs.builder()
 *             .workforcePoolId("example-pool")
 *             .parent("organizations/123456789")
 *             .location("global")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: gcp:iam:WorkforcePool
 *     properties:
 *       workforcePoolId: example-pool
 *       parent: organizations/123456789
 *       location: global
 * ```
 * 
 * ### Iam Workforce Pool Full
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const example = new gcp.iam.WorkforcePool("example", {
 *     workforcePoolId: "example-pool",
 *     parent: "organizations/123456789",
 *     location: "global",
 *     displayName: "Display name",
 *     description: "A sample workforce pool.",
 *     disabled: false,
 *     sessionDuration: "7200s",
 *     accessRestrictions: {
 *         allowedServices: [{
 *             domain: "backstory.chronicle.security",
 *         }],
 *         disableProgrammaticSignin: false,
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * example = gcp.iam.WorkforcePool("example",
 *     workforce_pool_id="example-pool",
 *     parent="organizations/123456789",
 *     location="global",
 *     display_name="Display name",
 *     description="A sample workforce pool.",
 *     disabled=False,
 *     session_duration="7200s",
 *     access_restrictions={
 *         "allowed_services": [{
 *             "domain": "backstory.chronicle.security",
 *         }],
 *         "disable_programmatic_signin": False,
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Gcp.Iam.WorkforcePool("example", new()
 *     {
 *         WorkforcePoolId = "example-pool",
 *         Parent = "organizations/123456789",
 *         Location = "global",
 *         DisplayName = "Display name",
 *         Description = "A sample workforce pool.",
 *         Disabled = false,
 *         SessionDuration = "7200s",
 *         AccessRestrictions = new Gcp.Iam.Inputs.WorkforcePoolAccessRestrictionsArgs
 *         {
 *             AllowedServices = new[]
 *             {
 *                 new Gcp.Iam.Inputs.WorkforcePoolAccessRestrictionsAllowedServiceArgs
 *                 {
 *                     Domain = "backstory.chronicle.security",
 *                 },
 *             },
 *             DisableProgrammaticSignin = false,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/iam"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := iam.NewWorkforcePool(ctx, "example", &iam.WorkforcePoolArgs{
 * 			WorkforcePoolId: pulumi.String("example-pool"),
 * 			Parent:          pulumi.String("organizations/123456789"),
 * 			Location:        pulumi.String("global"),
 * 			DisplayName:     pulumi.String("Display name"),
 * 			Description:     pulumi.String("A sample workforce pool."),
 * 			Disabled:        pulumi.Bool(false),
 * 			SessionDuration: pulumi.String("7200s"),
 * 			AccessRestrictions: &iam.WorkforcePoolAccessRestrictionsArgs{
 * 				AllowedServices: iam.WorkforcePoolAccessRestrictionsAllowedServiceArray{
 * 					&iam.WorkforcePoolAccessRestrictionsAllowedServiceArgs{
 * 						Domain: pulumi.String("backstory.chronicle.security"),
 * 					},
 * 				},
 * 				DisableProgrammaticSignin: pulumi.Bool(false),
 * 			},
 * 		})
 * 		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.iam.WorkforcePool;
 * import com.pulumi.gcp.iam.WorkforcePoolArgs;
 * import com.pulumi.gcp.iam.inputs.WorkforcePoolAccessRestrictionsArgs;
 * 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) {
 *         var example = new WorkforcePool("example", WorkforcePoolArgs.builder()
 *             .workforcePoolId("example-pool")
 *             .parent("organizations/123456789")
 *             .location("global")
 *             .displayName("Display name")
 *             .description("A sample workforce pool.")
 *             .disabled(false)
 *             .sessionDuration("7200s")
 *             .accessRestrictions(WorkforcePoolAccessRestrictionsArgs.builder()
 *                 .allowedServices(WorkforcePoolAccessRestrictionsAllowedServiceArgs.builder()
 *                     .domain("backstory.chronicle.security")
 *                     .build())
 *                 .disableProgrammaticSignin(false)
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: gcp:iam:WorkforcePool
 *     properties:
 *       workforcePoolId: example-pool
 *       parent: organizations/123456789
 *       location: global
 *       displayName: Display name
 *       description: A sample workforce pool.
 *       disabled: false
 *       sessionDuration: 7200s
 *       accessRestrictions:
 *         allowedServices:
 *           - domain: backstory.chronicle.security
 *         disableProgrammaticSignin: false
 * ```
 * 
 * ## Import
 * WorkforcePool can be imported using any of these accepted formats:
 * * `locations/{{location}}/workforcePools/{{workforce_pool_id}}`
 * * `{{location}}/{{workforce_pool_id}}`
 * When using the `pulumi import` command, WorkforcePool can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:iam/workforcePool:WorkforcePool default locations/{{location}}/workforcePools/{{workforce_pool_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:iam/workforcePool:WorkforcePool default {{location}}/{{workforce_pool_id}}
 * ```
 */
public class WorkforcePool internal constructor(
    override val javaResource: com.pulumi.gcp.iam.WorkforcePool,
) : KotlinCustomResource(javaResource, WorkforcePoolMapper) {
    /**
     * Configure access restrictions on the workforce pool users. This is an optional field. If specified web
     * sign-in can be restricted to given set of services or programmatic sign-in can be disabled for pool users.
     * Structure is documented below.
     */
    public val accessRestrictions: Output?
        get() = javaResource.accessRestrictions().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> toKotlin(args0) })
            }).orElse(null)
        })

    /**
     * A user-specified description of the pool. Cannot exceed 256 characters.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Whether the pool is disabled. You cannot use a disabled pool to exchange tokens,
     * or use existing tokens to access resources. If the pool is re-enabled, existing tokens grant access again.
     */
    public val disabled: Output?
        get() = javaResource.disabled().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * A user-specified display name of the pool in Google Cloud Console. Cannot exceed 32 characters.
     */
    public val displayName: Output?
        get() = javaResource.displayName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The location for the resource.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * Output only. The resource name of the pool.
     * Format: `locations/{location}/workforcePools/{workforcePoolId}`
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Immutable. The resource name of the parent. Format: `organizations/{org-id}`.
     * - - -
     */
    public val parent: Output
        get() = javaResource.parent().applyValue({ args0 -> args0 })

    /**
     * Duration that the Google Cloud access tokens, console sign-in sessions,
     * and `gcloud` sign-in sessions from this pool are valid.
     * Must be greater than 15 minutes (900s) and less than 12 hours (43200s).
     * If `sessionDuration` is not configured, minted credentials have a default duration of one hour (3600s).
     * A duration in seconds with up to nine fractional digits, ending with '`s`'. Example: "`3.5s`".
     */
    public val sessionDuration: Output?
        get() = javaResource.sessionDuration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Output only. The state of the pool.
     * * STATE_UNSPECIFIED: State unspecified.
     * * ACTIVE: The pool is active, and may be used in Google Cloud policies.
     * * DELETED: The pool is soft-deleted. Soft-deleted pools are permanently deleted
     * after approximately 30 days. You can restore a soft-deleted pool using
     * [workforcePools.undelete](https://cloud.google.com/iam/docs/reference/rest/v1/locations.workforcePools/undelete#google.iam.admin.v1.WorkforcePools.UndeleteWorkforcePool).
     * You cannot reuse the ID of a soft-deleted pool until it is permanently deleted.
     * While a pool is deleted, you cannot use it to exchange tokens, or use
     * existing tokens to access resources. If the pool is undeleted, existing
     * tokens grant access again.
     */
    public val state: Output
        get() = javaResource.state().applyValue({ args0 -> args0 })

    /**
     * The name of the pool. The ID must be a globally unique string of 6 to 63 lowercase letters,
     * digits, or hyphens. It must start with a letter, and cannot have a trailing hyphen.
     * The prefix `gcp-` is reserved for use by Google, and may not be specified.
     */
    public val workforcePoolId: Output
        get() = javaResource.workforcePoolId().applyValue({ args0 -> args0 })
}

public object WorkforcePoolMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.iam.WorkforcePool::class == javaResource::class

    override fun map(javaResource: Resource): WorkforcePool = WorkforcePool(
        javaResource as
            com.pulumi.gcp.iam.WorkforcePool,
    )
}

/**
 * @see [WorkforcePool].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [WorkforcePool].
 */
public suspend fun workforcePool(
    name: String,
    block: suspend WorkforcePoolResourceBuilder.() -> Unit,
): WorkforcePool {
    val builder = WorkforcePoolResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [WorkforcePool].
 * @param name The _unique_ name of the resulting resource.
 */
public fun workforcePool(name: String): WorkforcePool {
    val builder = WorkforcePoolResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy