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

com.pulumi.gcp.iap.kotlin.Client.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 8.12.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.iap.kotlin

import com.pulumi.core.Output
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 [Client].
 */
@PulumiTagMarker
public class ClientResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: ClientArgs = ClientArgs()

    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 ClientArgsBuilder.() -> Unit) {
        val builder = ClientArgsBuilder()
        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(): Client {
        val builtJavaResource = com.pulumi.gcp.iap.Client(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Client(builtJavaResource)
    }
}

/**
 * Contains the data that describes an Identity Aware Proxy owned client.
 * > **Note:** Only internal org clients can be created via declarative tools. External clients must be
 * manually created via the GCP console. This restriction is due to the existing APIs and not lack of support
 * in this tool.
 * To get more information about Client, see:
 * * [API documentation](https://cloud.google.com/iap/docs/reference/rest/v1/projects.brands.identityAwareProxyClients)
 * * How-to Guides
 *     * [Setting up IAP Client](https://cloud.google.com/iap/docs/authentication-howto)
 * ## Example Usage
 * ### Iap Client
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const project = new gcp.organizations.Project("project", {
 *     projectId: "my-project",
 *     name: "my-project",
 *     orgId: "123456789",
 * });
 * const projectService = new gcp.projects.Service("project_service", {
 *     project: project.projectId,
 *     service: "iap.googleapis.com",
 * });
 * const projectBrand = new gcp.iap.Brand("project_brand", {
 *     supportEmail: "[email protected]",
 *     applicationTitle: "Cloud IAP protected Application",
 *     project: projectService.project,
 * });
 * const projectClient = new gcp.iap.Client("project_client", {
 *     displayName: "Test Client",
 *     brand: projectBrand.name,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * project = gcp.organizations.Project("project",
 *     project_id="my-project",
 *     name="my-project",
 *     org_id="123456789")
 * project_service = gcp.projects.Service("project_service",
 *     project=project.project_id,
 *     service="iap.googleapis.com")
 * project_brand = gcp.iap.Brand("project_brand",
 *     support_email="[email protected]",
 *     application_title="Cloud IAP protected Application",
 *     project=project_service.project)
 * project_client = gcp.iap.Client("project_client",
 *     display_name="Test Client",
 *     brand=project_brand.name)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var project = new Gcp.Organizations.Project("project", new()
 *     {
 *         ProjectId = "my-project",
 *         Name = "my-project",
 *         OrgId = "123456789",
 *     });
 *     var projectService = new Gcp.Projects.Service("project_service", new()
 *     {
 *         Project = project.ProjectId,
 *         ServiceName = "iap.googleapis.com",
 *     });
 *     var projectBrand = new Gcp.Iap.Brand("project_brand", new()
 *     {
 *         SupportEmail = "[email protected]",
 *         ApplicationTitle = "Cloud IAP protected Application",
 *         Project = projectService.Project,
 *     });
 *     var projectClient = new Gcp.Iap.Client("project_client", new()
 *     {
 *         DisplayName = "Test Client",
 *         Brand = projectBrand.Name,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/iap"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		project, err := organizations.NewProject(ctx, "project", &organizations.ProjectArgs{
 * 			ProjectId: pulumi.String("my-project"),
 * 			Name:      pulumi.String("my-project"),
 * 			OrgId:     pulumi.String("123456789"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		projectService, err := projects.NewService(ctx, "project_service", &projects.ServiceArgs{
 * 			Project: project.ProjectId,
 * 			Service: pulumi.String("iap.googleapis.com"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		projectBrand, err := iap.NewBrand(ctx, "project_brand", &iap.BrandArgs{
 * 			SupportEmail:     pulumi.String("[email protected]"),
 * 			ApplicationTitle: pulumi.String("Cloud IAP protected Application"),
 * 			Project:          projectService.Project,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = iap.NewClient(ctx, "project_client", &iap.ClientArgs{
 * 			DisplayName: pulumi.String("Test Client"),
 * 			Brand:       projectBrand.Name,
 * 		})
 * 		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.organizations.Project;
 * import com.pulumi.gcp.organizations.ProjectArgs;
 * import com.pulumi.gcp.projects.Service;
 * import com.pulumi.gcp.projects.ServiceArgs;
 * import com.pulumi.gcp.iap.Brand;
 * import com.pulumi.gcp.iap.BrandArgs;
 * import com.pulumi.gcp.iap.Client;
 * import com.pulumi.gcp.iap.ClientArgs;
 * 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 project = new Project("project", ProjectArgs.builder()
 *             .projectId("my-project")
 *             .name("my-project")
 *             .orgId("123456789")
 *             .build());
 *         var projectService = new Service("projectService", ServiceArgs.builder()
 *             .project(project.projectId())
 *             .service("iap.googleapis.com")
 *             .build());
 *         var projectBrand = new Brand("projectBrand", BrandArgs.builder()
 *             .supportEmail("[email protected]")
 *             .applicationTitle("Cloud IAP protected Application")
 *             .project(projectService.project())
 *             .build());
 *         var projectClient = new Client("projectClient", ClientArgs.builder()
 *             .displayName("Test Client")
 *             .brand(projectBrand.name())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   project:
 *     type: gcp:organizations:Project
 *     properties:
 *       projectId: my-project
 *       name: my-project
 *       orgId: '123456789'
 *   projectService:
 *     type: gcp:projects:Service
 *     name: project_service
 *     properties:
 *       project: ${project.projectId}
 *       service: iap.googleapis.com
 *   projectBrand:
 *     type: gcp:iap:Brand
 *     name: project_brand
 *     properties:
 *       supportEmail: [email protected]
 *       applicationTitle: Cloud IAP protected Application
 *       project: ${projectService.project}
 *   projectClient:
 *     type: gcp:iap:Client
 *     name: project_client
 *     properties:
 *       displayName: Test Client
 *       brand: ${projectBrand.name}
 * ```
 * 
 * ## Import
 * Client can be imported using any of these accepted formats:
 * * `{{brand}}/identityAwareProxyClients/{{client_id}}`
 * * `{{brand}}/{{client_id}}`
 * When using the `pulumi import` command, Client can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:iap/client:Client default {{brand}}/identityAwareProxyClients/{{client_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:iap/client:Client default {{brand}}/{{client_id}}
 * ```
 */
public class Client internal constructor(
    override val javaResource: com.pulumi.gcp.iap.Client,
) : KotlinCustomResource(javaResource, ClientMapper) {
    /**
     * Identifier of the brand to which this client
     * is attached to. The format is
     * `projects/{project_number}/brands/{brand_id}/identityAwareProxyClients/{client_id}`.
     * - - -
     */
    public val brand: Output
        get() = javaResource.brand().applyValue({ args0 -> args0 })

    /**
     * The OAuth2 ID of the client.
     */
    public val clientId: Output
        get() = javaResource.clientId().applyValue({ args0 -> args0 })

    /**
     * Human-friendly name given to the OAuth client.
     */
    public val displayName: Output
        get() = javaResource.displayName().applyValue({ args0 -> args0 })

    /**
     * Output only. Client secret of the OAuth client.
     * **Note**: This property is sensitive and will not be displayed in the plan.
     */
    public val secret: Output
        get() = javaResource.secret().applyValue({ args0 -> args0 })
}

public object ClientMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.iap.Client::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy