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

com.pulumi.gcp.discoveryengine.kotlin.ChatEngine.kt Maven / Gradle / Ivy

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

package com.pulumi.gcp.discoveryengine.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.discoveryengine.kotlin.outputs.ChatEngineChatEngineConfig
import com.pulumi.gcp.discoveryengine.kotlin.outputs.ChatEngineChatEngineMetadata
import com.pulumi.gcp.discoveryengine.kotlin.outputs.ChatEngineCommonConfig
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
import kotlin.collections.List
import com.pulumi.gcp.discoveryengine.kotlin.outputs.ChatEngineChatEngineConfig.Companion.toKotlin as chatEngineChatEngineConfigToKotlin
import com.pulumi.gcp.discoveryengine.kotlin.outputs.ChatEngineChatEngineMetadata.Companion.toKotlin as chatEngineChatEngineMetadataToKotlin
import com.pulumi.gcp.discoveryengine.kotlin.outputs.ChatEngineCommonConfig.Companion.toKotlin as chatEngineCommonConfigToKotlin

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

    public var args: ChatEngineArgs = ChatEngineArgs()

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

/**
 * Vertex chat and Conversation Engine Chat type
 * To get more information about ChatEngine, see:
 * * [API documentation](https://cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.engines)
 * * How-to Guides
 *     * [Vertex AI Conversation](https://cloud.google.com/dialogflow/cx/docs/concept/generative)
 * ## Example Usage
 * ### Discoveryengine Chat Engine Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const testDataStore = new gcp.discoveryengine.DataStore("test_data_store", {
 *     location: "global",
 *     dataStoreId: "data-store",
 *     displayName: "Structured datastore",
 *     industryVertical: "GENERIC",
 *     contentConfig: "NO_CONTENT",
 *     solutionTypes: ["SOLUTION_TYPE_CHAT"],
 * });
 * const testDataStore2 = new gcp.discoveryengine.DataStore("test_data_store_2", {
 *     location: testDataStore.location,
 *     dataStoreId: "data-store-2",
 *     displayName: "Structured datastore 2",
 *     industryVertical: "GENERIC",
 *     contentConfig: "NO_CONTENT",
 *     solutionTypes: ["SOLUTION_TYPE_CHAT"],
 * });
 * const primary = new gcp.discoveryengine.ChatEngine("primary", {
 *     engineId: "chat-engine-id",
 *     collectionId: "default_collection",
 *     location: testDataStore.location,
 *     displayName: "Chat engine",
 *     industryVertical: "GENERIC",
 *     dataStoreIds: [
 *         testDataStore.dataStoreId,
 *         testDataStore2.dataStoreId,
 *     ],
 *     commonConfig: {
 *         companyName: "test-company",
 *     },
 *     chatEngineConfig: {
 *         agentCreationConfig: {
 *             business: "test business name",
 *             defaultLanguageCode: "en",
 *             timeZone: "America/Los_Angeles",
 *         },
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * test_data_store = gcp.discoveryengine.DataStore("test_data_store",
 *     location="global",
 *     data_store_id="data-store",
 *     display_name="Structured datastore",
 *     industry_vertical="GENERIC",
 *     content_config="NO_CONTENT",
 *     solution_types=["SOLUTION_TYPE_CHAT"])
 * test_data_store2 = gcp.discoveryengine.DataStore("test_data_store_2",
 *     location=test_data_store.location,
 *     data_store_id="data-store-2",
 *     display_name="Structured datastore 2",
 *     industry_vertical="GENERIC",
 *     content_config="NO_CONTENT",
 *     solution_types=["SOLUTION_TYPE_CHAT"])
 * primary = gcp.discoveryengine.ChatEngine("primary",
 *     engine_id="chat-engine-id",
 *     collection_id="default_collection",
 *     location=test_data_store.location,
 *     display_name="Chat engine",
 *     industry_vertical="GENERIC",
 *     data_store_ids=[
 *         test_data_store.data_store_id,
 *         test_data_store2.data_store_id,
 *     ],
 *     common_config={
 *         "company_name": "test-company",
 *     },
 *     chat_engine_config={
 *         "agent_creation_config": {
 *             "business": "test business name",
 *             "default_language_code": "en",
 *             "time_zone": "America/Los_Angeles",
 *         },
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var testDataStore = new Gcp.DiscoveryEngine.DataStore("test_data_store", new()
 *     {
 *         Location = "global",
 *         DataStoreId = "data-store",
 *         DisplayName = "Structured datastore",
 *         IndustryVertical = "GENERIC",
 *         ContentConfig = "NO_CONTENT",
 *         SolutionTypes = new[]
 *         {
 *             "SOLUTION_TYPE_CHAT",
 *         },
 *     });
 *     var testDataStore2 = new Gcp.DiscoveryEngine.DataStore("test_data_store_2", new()
 *     {
 *         Location = testDataStore.Location,
 *         DataStoreId = "data-store-2",
 *         DisplayName = "Structured datastore 2",
 *         IndustryVertical = "GENERIC",
 *         ContentConfig = "NO_CONTENT",
 *         SolutionTypes = new[]
 *         {
 *             "SOLUTION_TYPE_CHAT",
 *         },
 *     });
 *     var primary = new Gcp.DiscoveryEngine.ChatEngine("primary", new()
 *     {
 *         EngineId = "chat-engine-id",
 *         CollectionId = "default_collection",
 *         Location = testDataStore.Location,
 *         DisplayName = "Chat engine",
 *         IndustryVertical = "GENERIC",
 *         DataStoreIds = new[]
 *         {
 *             testDataStore.DataStoreId,
 *             testDataStore2.DataStoreId,
 *         },
 *         CommonConfig = new Gcp.DiscoveryEngine.Inputs.ChatEngineCommonConfigArgs
 *         {
 *             CompanyName = "test-company",
 *         },
 *         ChatEngineConfig = new Gcp.DiscoveryEngine.Inputs.ChatEngineChatEngineConfigArgs
 *         {
 *             AgentCreationConfig = new Gcp.DiscoveryEngine.Inputs.ChatEngineChatEngineConfigAgentCreationConfigArgs
 *             {
 *                 Business = "test business name",
 *                 DefaultLanguageCode = "en",
 *                 TimeZone = "America/Los_Angeles",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/discoveryengine"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		testDataStore, err := discoveryengine.NewDataStore(ctx, "test_data_store", &discoveryengine.DataStoreArgs{
 * 			Location:         pulumi.String("global"),
 * 			DataStoreId:      pulumi.String("data-store"),
 * 			DisplayName:      pulumi.String("Structured datastore"),
 * 			IndustryVertical: pulumi.String("GENERIC"),
 * 			ContentConfig:    pulumi.String("NO_CONTENT"),
 * 			SolutionTypes: pulumi.StringArray{
 * 				pulumi.String("SOLUTION_TYPE_CHAT"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		testDataStore2, err := discoveryengine.NewDataStore(ctx, "test_data_store_2", &discoveryengine.DataStoreArgs{
 * 			Location:         testDataStore.Location,
 * 			DataStoreId:      pulumi.String("data-store-2"),
 * 			DisplayName:      pulumi.String("Structured datastore 2"),
 * 			IndustryVertical: pulumi.String("GENERIC"),
 * 			ContentConfig:    pulumi.String("NO_CONTENT"),
 * 			SolutionTypes: pulumi.StringArray{
 * 				pulumi.String("SOLUTION_TYPE_CHAT"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = discoveryengine.NewChatEngine(ctx, "primary", &discoveryengine.ChatEngineArgs{
 * 			EngineId:         pulumi.String("chat-engine-id"),
 * 			CollectionId:     pulumi.String("default_collection"),
 * 			Location:         testDataStore.Location,
 * 			DisplayName:      pulumi.String("Chat engine"),
 * 			IndustryVertical: pulumi.String("GENERIC"),
 * 			DataStoreIds: pulumi.StringArray{
 * 				testDataStore.DataStoreId,
 * 				testDataStore2.DataStoreId,
 * 			},
 * 			CommonConfig: &discoveryengine.ChatEngineCommonConfigArgs{
 * 				CompanyName: pulumi.String("test-company"),
 * 			},
 * 			ChatEngineConfig: &discoveryengine.ChatEngineChatEngineConfigArgs{
 * 				AgentCreationConfig: &discoveryengine.ChatEngineChatEngineConfigAgentCreationConfigArgs{
 * 					Business:            pulumi.String("test business name"),
 * 					DefaultLanguageCode: pulumi.String("en"),
 * 					TimeZone:            pulumi.String("America/Los_Angeles"),
 * 				},
 * 			},
 * 		})
 * 		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.discoveryengine.DataStore;
 * import com.pulumi.gcp.discoveryengine.DataStoreArgs;
 * import com.pulumi.gcp.discoveryengine.ChatEngine;
 * import com.pulumi.gcp.discoveryengine.ChatEngineArgs;
 * import com.pulumi.gcp.discoveryengine.inputs.ChatEngineCommonConfigArgs;
 * import com.pulumi.gcp.discoveryengine.inputs.ChatEngineChatEngineConfigArgs;
 * import com.pulumi.gcp.discoveryengine.inputs.ChatEngineChatEngineConfigAgentCreationConfigArgs;
 * 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 testDataStore = new DataStore("testDataStore", DataStoreArgs.builder()
 *             .location("global")
 *             .dataStoreId("data-store")
 *             .displayName("Structured datastore")
 *             .industryVertical("GENERIC")
 *             .contentConfig("NO_CONTENT")
 *             .solutionTypes("SOLUTION_TYPE_CHAT")
 *             .build());
 *         var testDataStore2 = new DataStore("testDataStore2", DataStoreArgs.builder()
 *             .location(testDataStore.location())
 *             .dataStoreId("data-store-2")
 *             .displayName("Structured datastore 2")
 *             .industryVertical("GENERIC")
 *             .contentConfig("NO_CONTENT")
 *             .solutionTypes("SOLUTION_TYPE_CHAT")
 *             .build());
 *         var primary = new ChatEngine("primary", ChatEngineArgs.builder()
 *             .engineId("chat-engine-id")
 *             .collectionId("default_collection")
 *             .location(testDataStore.location())
 *             .displayName("Chat engine")
 *             .industryVertical("GENERIC")
 *             .dataStoreIds(
 *                 testDataStore.dataStoreId(),
 *                 testDataStore2.dataStoreId())
 *             .commonConfig(ChatEngineCommonConfigArgs.builder()
 *                 .companyName("test-company")
 *                 .build())
 *             .chatEngineConfig(ChatEngineChatEngineConfigArgs.builder()
 *                 .agentCreationConfig(ChatEngineChatEngineConfigAgentCreationConfigArgs.builder()
 *                     .business("test business name")
 *                     .defaultLanguageCode("en")
 *                     .timeZone("America/Los_Angeles")
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   testDataStore:
 *     type: gcp:discoveryengine:DataStore
 *     name: test_data_store
 *     properties:
 *       location: global
 *       dataStoreId: data-store
 *       displayName: Structured datastore
 *       industryVertical: GENERIC
 *       contentConfig: NO_CONTENT
 *       solutionTypes:
 *         - SOLUTION_TYPE_CHAT
 *   testDataStore2:
 *     type: gcp:discoveryengine:DataStore
 *     name: test_data_store_2
 *     properties:
 *       location: ${testDataStore.location}
 *       dataStoreId: data-store-2
 *       displayName: Structured datastore 2
 *       industryVertical: GENERIC
 *       contentConfig: NO_CONTENT
 *       solutionTypes:
 *         - SOLUTION_TYPE_CHAT
 *   primary:
 *     type: gcp:discoveryengine:ChatEngine
 *     properties:
 *       engineId: chat-engine-id
 *       collectionId: default_collection
 *       location: ${testDataStore.location}
 *       displayName: Chat engine
 *       industryVertical: GENERIC
 *       dataStoreIds:
 *         - ${testDataStore.dataStoreId}
 *         - ${testDataStore2.dataStoreId}
 *       commonConfig:
 *         companyName: test-company
 *       chatEngineConfig:
 *         agentCreationConfig:
 *           business: test business name
 *           defaultLanguageCode: en
 *           timeZone: America/Los_Angeles
 * ```
 * 
 * ## Import
 * ChatEngine can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/collections/{{collection_id}}/engines/{{engine_id}}`
 * * `{{project}}/{{location}}/{{collection_id}}/{{engine_id}}`
 * * `{{location}}/{{collection_id}}/{{engine_id}}`
 * When using the `pulumi import` command, ChatEngine can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:discoveryengine/chatEngine:ChatEngine default projects/{{project}}/locations/{{location}}/collections/{{collection_id}}/engines/{{engine_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:discoveryengine/chatEngine:ChatEngine default {{project}}/{{location}}/{{collection_id}}/{{engine_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:discoveryengine/chatEngine:ChatEngine default {{location}}/{{collection_id}}/{{engine_id}}
 * ```
 */
public class ChatEngine internal constructor(
    override val javaResource: com.pulumi.gcp.discoveryengine.ChatEngine,
) : KotlinCustomResource(javaResource, ChatEngineMapper) {
    /**
     * Configurations for a chat Engine.
     * Structure is documented below.
     */
    public val chatEngineConfig: Output
        get() = javaResource.chatEngineConfig().applyValue({ args0 ->
            args0.let({ args0 ->
                chatEngineChatEngineConfigToKotlin(args0)
            })
        })

    /**
     * Additional information of the Chat Engine.
     * Structure is documented below.
     */
    public val chatEngineMetadatas: Output>
        get() = javaResource.chatEngineMetadatas().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> chatEngineChatEngineMetadataToKotlin(args0) })
            })
        })

    /**
     * The collection ID.
     */
    public val collectionId: Output
        get() = javaResource.collectionId().applyValue({ args0 -> args0 })

    /**
     * Common config spec that specifies the metadata of the engine.
     */
    public val commonConfig: Output?
        get() = javaResource.commonConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    chatEngineCommonConfigToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Timestamp the Engine was created at.
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * The data stores associated with this engine. Multiple DataStores in the same Collection can be associated here. All listed DataStores must be `SOLUTION_TYPE_CHAT`. Adding or removing data stores will force recreation.
     */
    public val dataStoreIds: Output>
        get() = javaResource.dataStoreIds().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * The display name of the engine. Should be human readable. UTF-8 encoded string with limit of 1024 characters.
     */
    public val displayName: Output
        get() = javaResource.displayName().applyValue({ args0 -> args0 })

    /**
     * The ID to use for chat engine.
     */
    public val engineId: Output
        get() = javaResource.engineId().applyValue({ args0 -> args0 })

    /**
     * The industry vertical that the chat engine registers. Vertical on Engine has to match vertical of the DataStore linked
     * to the engine. Default value: "GENERIC" Possible values: ["GENERIC"]
     */
    public val industryVertical: Output?
        get() = javaResource.industryVertical().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Location.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The unique full resource name of the chat engine. Values are of the format
     * `projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}`.
     * This field must be a UTF-8 encoded string with a length limit of 1024
     * characters.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * Timestamp the Engine was last updated.
     */
    public val updateTime: Output
        get() = javaResource.updateTime().applyValue({ args0 -> args0 })
}

public object ChatEngineMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.discoveryengine.ChatEngine::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy