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

com.pulumi.gcp.applicationintegration.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.10.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.applicationintegration.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.applicationintegration.kotlin.outputs.ClientCloudKmsConfig
import com.pulumi.gcp.applicationintegration.kotlin.outputs.ClientCloudKmsConfig.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.Deprecated
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.applicationintegration.Client(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Client(builtJavaResource)
    }
}

/**
 * Application Integration Client.
 * To get more information about Client, see:
 * * [API documentation](https://cloud.google.com/application-integration/docs/reference/rest/v1/projects.locations.clients)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/application-integration/docs/overview)
 *     * [Set up Application Integration](https://cloud.google.com/application-integration/docs/setup-application-integration)
 * ## Example Usage
 * ### Integrations Client Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const example = new gcp.applicationintegration.Client("example", {location: "us-central1"});
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * example = gcp.applicationintegration.Client("example", location="us-central1")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Gcp.ApplicationIntegration.Client("example", new()
 *     {
 *         Location = "us-central1",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/applicationintegration"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := applicationintegration.NewClient(ctx, "example", &applicationintegration.ClientArgs{
 * 			Location: pulumi.String("us-central1"),
 * 		})
 * 		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.applicationintegration.Client;
 * import com.pulumi.gcp.applicationintegration.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 example = new Client("example", ClientArgs.builder()
 *             .location("us-central1")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: gcp:applicationintegration:Client
 *     properties:
 *       location: us-central1
 * ```
 * 
 * ### Integrations Client Full
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const testProject = gcp.organizations.getProject({});
 * const keyring = new gcp.kms.KeyRing("keyring", {
 *     name: "my-keyring",
 *     location: "us-east1",
 * });
 * const cryptokey = new gcp.kms.CryptoKey("cryptokey", {
 *     name: "crypto-key-example",
 *     keyRing: keyring.id,
 *     rotationPeriod: "7776000s",
 * });
 * const testKey = new gcp.kms.CryptoKeyVersion("test_key", {cryptoKey: cryptokey.id});
 * const serviceAccount = new gcp.serviceaccount.Account("service_account", {
 *     accountId: "service-account-id",
 *     displayName: "Service Account",
 * });
 * const example = new gcp.applicationintegration.Client("example", {
 *     location: "us-east1",
 *     createSampleIntegrations: true,
 *     runAsServiceAccount: serviceAccount.email,
 *     cloudKmsConfig: {
 *         kmsLocation: "us-east1",
 *         kmsRing: keyring.id,
 *         key: cryptokey.id,
 *         keyVersion: testKey.id,
 *         kmsProjectId: testProject.then(testProject => testProject.projectId),
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * test_project = gcp.organizations.get_project()
 * keyring = gcp.kms.KeyRing("keyring",
 *     name="my-keyring",
 *     location="us-east1")
 * cryptokey = gcp.kms.CryptoKey("cryptokey",
 *     name="crypto-key-example",
 *     key_ring=keyring.id,
 *     rotation_period="7776000s")
 * test_key = gcp.kms.CryptoKeyVersion("test_key", crypto_key=cryptokey.id)
 * service_account = gcp.serviceaccount.Account("service_account",
 *     account_id="service-account-id",
 *     display_name="Service Account")
 * example = gcp.applicationintegration.Client("example",
 *     location="us-east1",
 *     create_sample_integrations=True,
 *     run_as_service_account=service_account.email,
 *     cloud_kms_config=gcp.applicationintegration.ClientCloudKmsConfigArgs(
 *         kms_location="us-east1",
 *         kms_ring=keyring.id,
 *         key=cryptokey.id,
 *         key_version=test_key.id,
 *         kms_project_id=test_project.project_id,
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var testProject = Gcp.Organizations.GetProject.Invoke();
 *     var keyring = new Gcp.Kms.KeyRing("keyring", new()
 *     {
 *         Name = "my-keyring",
 *         Location = "us-east1",
 *     });
 *     var cryptokey = new Gcp.Kms.CryptoKey("cryptokey", new()
 *     {
 *         Name = "crypto-key-example",
 *         KeyRing = keyring.Id,
 *         RotationPeriod = "7776000s",
 *     });
 *     var testKey = new Gcp.Kms.CryptoKeyVersion("test_key", new()
 *     {
 *         CryptoKey = cryptokey.Id,
 *     });
 *     var serviceAccount = new Gcp.ServiceAccount.Account("service_account", new()
 *     {
 *         AccountId = "service-account-id",
 *         DisplayName = "Service Account",
 *     });
 *     var example = new Gcp.ApplicationIntegration.Client("example", new()
 *     {
 *         Location = "us-east1",
 *         CreateSampleIntegrations = true,
 *         RunAsServiceAccount = serviceAccount.Email,
 *         CloudKmsConfig = new Gcp.ApplicationIntegration.Inputs.ClientCloudKmsConfigArgs
 *         {
 *             KmsLocation = "us-east1",
 *             KmsRing = keyring.Id,
 *             Key = cryptokey.Id,
 *             KeyVersion = testKey.Id,
 *             KmsProjectId = testProject.Apply(getProjectResult => getProjectResult.ProjectId),
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/applicationintegration"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/kms"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/serviceaccount"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		testProject, err := organizations.LookupProject(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		keyring, err := kms.NewKeyRing(ctx, "keyring", &kms.KeyRingArgs{
 * 			Name:     pulumi.String("my-keyring"),
 * 			Location: pulumi.String("us-east1"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		cryptokey, err := kms.NewCryptoKey(ctx, "cryptokey", &kms.CryptoKeyArgs{
 * 			Name:           pulumi.String("crypto-key-example"),
 * 			KeyRing:        keyring.ID(),
 * 			RotationPeriod: pulumi.String("7776000s"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		testKey, err := kms.NewCryptoKeyVersion(ctx, "test_key", &kms.CryptoKeyVersionArgs{
 * 			CryptoKey: cryptokey.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		serviceAccount, err := serviceaccount.NewAccount(ctx, "service_account", &serviceaccount.AccountArgs{
 * 			AccountId:   pulumi.String("service-account-id"),
 * 			DisplayName: pulumi.String("Service Account"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = applicationintegration.NewClient(ctx, "example", &applicationintegration.ClientArgs{
 * 			Location:                 pulumi.String("us-east1"),
 * 			CreateSampleIntegrations: pulumi.Bool(true),
 * 			RunAsServiceAccount:      serviceAccount.Email,
 * 			CloudKmsConfig: &applicationintegration.ClientCloudKmsConfigArgs{
 * 				KmsLocation:  pulumi.String("us-east1"),
 * 				KmsRing:      keyring.ID(),
 * 				Key:          cryptokey.ID(),
 * 				KeyVersion:   testKey.ID(),
 * 				KmsProjectId: pulumi.String(testProject.ProjectId),
 * 			},
 * 		})
 * 		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.OrganizationsFunctions;
 * import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
 * import com.pulumi.gcp.kms.KeyRing;
 * import com.pulumi.gcp.kms.KeyRingArgs;
 * import com.pulumi.gcp.kms.CryptoKey;
 * import com.pulumi.gcp.kms.CryptoKeyArgs;
 * import com.pulumi.gcp.kms.CryptoKeyVersion;
 * import com.pulumi.gcp.kms.CryptoKeyVersionArgs;
 * import com.pulumi.gcp.serviceaccount.Account;
 * import com.pulumi.gcp.serviceaccount.AccountArgs;
 * import com.pulumi.gcp.applicationintegration.Client;
 * import com.pulumi.gcp.applicationintegration.ClientArgs;
 * import com.pulumi.gcp.applicationintegration.inputs.ClientCloudKmsConfigArgs;
 * 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 testProject = OrganizationsFunctions.getProject();
 *         var keyring = new KeyRing("keyring", KeyRingArgs.builder()
 *             .name("my-keyring")
 *             .location("us-east1")
 *             .build());
 *         var cryptokey = new CryptoKey("cryptokey", CryptoKeyArgs.builder()
 *             .name("crypto-key-example")
 *             .keyRing(keyring.id())
 *             .rotationPeriod("7776000s")
 *             .build());
 *         var testKey = new CryptoKeyVersion("testKey", CryptoKeyVersionArgs.builder()
 *             .cryptoKey(cryptokey.id())
 *             .build());
 *         var serviceAccount = new Account("serviceAccount", AccountArgs.builder()
 *             .accountId("service-account-id")
 *             .displayName("Service Account")
 *             .build());
 *         var example = new Client("example", ClientArgs.builder()
 *             .location("us-east1")
 *             .createSampleIntegrations(true)
 *             .runAsServiceAccount(serviceAccount.email())
 *             .cloudKmsConfig(ClientCloudKmsConfigArgs.builder()
 *                 .kmsLocation("us-east1")
 *                 .kmsRing(keyring.id())
 *                 .key(cryptokey.id())
 *                 .keyVersion(testKey.id())
 *                 .kmsProjectId(testProject.applyValue(getProjectResult -> getProjectResult.projectId()))
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   keyring:
 *     type: gcp:kms:KeyRing
 *     properties:
 *       name: my-keyring
 *       location: us-east1
 *   cryptokey:
 *     type: gcp:kms:CryptoKey
 *     properties:
 *       name: crypto-key-example
 *       keyRing: ${keyring.id}
 *       rotationPeriod: 7776000s
 *   testKey:
 *     type: gcp:kms:CryptoKeyVersion
 *     name: test_key
 *     properties:
 *       cryptoKey: ${cryptokey.id}
 *   serviceAccount:
 *     type: gcp:serviceaccount:Account
 *     name: service_account
 *     properties:
 *       accountId: service-account-id
 *       displayName: Service Account
 *   example:
 *     type: gcp:applicationintegration:Client
 *     properties:
 *       location: us-east1
 *       createSampleIntegrations: true
 *       runAsServiceAccount: ${serviceAccount.email}
 *       cloudKmsConfig:
 *         kmsLocation: us-east1
 *         kmsRing: ${keyring.id}
 *         key: ${cryptokey.id}
 *         keyVersion: ${testKey.id}
 *         kmsProjectId: ${testProject.projectId}
 * variables:
 *   testProject:
 *     fn::invoke:
 *       Function: gcp:organizations:getProject
 *       Arguments: {}
 * ```
 * 
 * ## Import
 * Client can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/clients`
 * * `{{project}}/{{location}}`
 * * `{{location}}`
 * When using the `pulumi import` command, Client can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:applicationintegration/client:Client default projects/{{project}}/locations/{{location}}/clients
 * ```
 * ```sh
 * $ pulumi import gcp:applicationintegration/client:Client default {{project}}/{{location}}
 * ```
 * ```sh
 * $ pulumi import gcp:applicationintegration/client:Client default {{location}}
 * ```
 */
public class Client internal constructor(
    override val javaResource: com.pulumi.gcp.applicationintegration.Client,
) : KotlinCustomResource(javaResource, ClientMapper) {
    /**
     * Cloud KMS config for AuthModule to encrypt/decrypt credentials.
     * Structure is documented below.
     */
    public val cloudKmsConfig: Output?
        get() = javaResource.cloudKmsConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> toKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Indicates if sample integrations should be created along with provisioning.
     */
    public val createSampleIntegrations: Output?
        get() = javaResource.createSampleIntegrations().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * (Optional, Deprecated)
     * Indicates if sample workflow should be created along with provisioning.
     * > **Warning:** `create_sample_workflows` is deprecated and will be removed in a future major release. Use `create_sample_integrations` instead.
     */
    @Deprecated(
        message = """
  `create_sample_workflows` is deprecated and will be removed in a future major release. Use
      `create_sample_integrations` instead.
  """,
    )
    public val createSampleWorkflows: Output?
        get() = javaResource.createSampleWorkflows().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Location in which client needs to be provisioned.
     * - - -
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * (Optional, Deprecated)
     * Indicates provision with GMEK or CMEK.
     * > **Warning:** `provision_gmek` is deprecated and will be removed in a future major release. Client would be provisioned as gmek if `cloud_kms_config` is not given.
     */
    @Deprecated(
        message = """
  `provision_gmek` is deprecated and will be removed in a future major release. Client would be
      provisioned as gmek if `cloud_kms_config` is not given.
  """,
    )
    public val provisionGmek: Output?
        get() = javaResource.provisionGmek().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * User input run-as service account, if empty, will bring up a new default service account.
     */
    public val runAsServiceAccount: Output?
        get() = javaResource.runAsServiceAccount().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

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

    override fun map(javaResource: Resource): Client = Client(
        javaResource as
            com.pulumi.gcp.applicationintegration.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 - 2024 Weber Informatics LLC | Privacy Policy