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

com.pulumi.gcp.discoveryengine.kotlin.SearchEngine.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.discoveryengine.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.discoveryengine.kotlin.outputs.SearchEngineCommonConfig
import com.pulumi.gcp.discoveryengine.kotlin.outputs.SearchEngineSearchEngineConfig
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.SearchEngineCommonConfig.Companion.toKotlin as searchEngineCommonConfigToKotlin
import com.pulumi.gcp.discoveryengine.kotlin.outputs.SearchEngineSearchEngineConfig.Companion.toKotlin as searchEngineSearchEngineConfigToKotlin

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

    public var args: SearchEngineArgs = SearchEngineArgs()

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

/**
 * Vertex AI Search and Conversation can be used to create a search engine or a chat application by connecting it with a datastore
 * To get more information about SearchEngine, see:
 * * [API documentation](https://cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.engines)
 * * How-to Guides
 *     * [Create a Search Engine](https://cloud.google.com/generative-ai-app-builder/docs/create-engine-es)
 * ## Example Usage
 * ### Discoveryengine Searchengine Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const basic = new gcp.discoveryengine.DataStore("basic", {
 *     location: "global",
 *     dataStoreId: "example-datastore-id",
 *     displayName: "tf-test-structured-datastore",
 *     industryVertical: "GENERIC",
 *     contentConfig: "NO_CONTENT",
 *     solutionTypes: ["SOLUTION_TYPE_SEARCH"],
 *     createAdvancedSiteSearch: false,
 * });
 * const basicSearchEngine = new gcp.discoveryengine.SearchEngine("basic", {
 *     engineId: "example-engine-id",
 *     collectionId: "default_collection",
 *     location: basic.location,
 *     displayName: "Example Display Name",
 *     dataStoreIds: [basic.dataStoreId],
 *     searchEngineConfig: {},
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * basic = gcp.discoveryengine.DataStore("basic",
 *     location="global",
 *     data_store_id="example-datastore-id",
 *     display_name="tf-test-structured-datastore",
 *     industry_vertical="GENERIC",
 *     content_config="NO_CONTENT",
 *     solution_types=["SOLUTION_TYPE_SEARCH"],
 *     create_advanced_site_search=False)
 * basic_search_engine = gcp.discoveryengine.SearchEngine("basic",
 *     engine_id="example-engine-id",
 *     collection_id="default_collection",
 *     location=basic.location,
 *     display_name="Example Display Name",
 *     data_store_ids=[basic.data_store_id],
 *     search_engine_config=gcp.discoveryengine.SearchEngineSearchEngineConfigArgs())
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var basic = new Gcp.DiscoveryEngine.DataStore("basic", new()
 *     {
 *         Location = "global",
 *         DataStoreId = "example-datastore-id",
 *         DisplayName = "tf-test-structured-datastore",
 *         IndustryVertical = "GENERIC",
 *         ContentConfig = "NO_CONTENT",
 *         SolutionTypes = new[]
 *         {
 *             "SOLUTION_TYPE_SEARCH",
 *         },
 *         CreateAdvancedSiteSearch = false,
 *     });
 *     var basicSearchEngine = new Gcp.DiscoveryEngine.SearchEngine("basic", new()
 *     {
 *         EngineId = "example-engine-id",
 *         CollectionId = "default_collection",
 *         Location = basic.Location,
 *         DisplayName = "Example Display Name",
 *         DataStoreIds = new[]
 *         {
 *             basic.DataStoreId,
 *         },
 *         SearchEngineConfig = null,
 *     });
 * });
 * ```
 * ```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 {
 * 		basic, err := discoveryengine.NewDataStore(ctx, "basic", &discoveryengine.DataStoreArgs{
 * 			Location:         pulumi.String("global"),
 * 			DataStoreId:      pulumi.String("example-datastore-id"),
 * 			DisplayName:      pulumi.String("tf-test-structured-datastore"),
 * 			IndustryVertical: pulumi.String("GENERIC"),
 * 			ContentConfig:    pulumi.String("NO_CONTENT"),
 * 			SolutionTypes: pulumi.StringArray{
 * 				pulumi.String("SOLUTION_TYPE_SEARCH"),
 * 			},
 * 			CreateAdvancedSiteSearch: pulumi.Bool(false),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = discoveryengine.NewSearchEngine(ctx, "basic", &discoveryengine.SearchEngineArgs{
 * 			EngineId:     pulumi.String("example-engine-id"),
 * 			CollectionId: pulumi.String("default_collection"),
 * 			Location:     basic.Location,
 * 			DisplayName:  pulumi.String("Example Display Name"),
 * 			DataStoreIds: pulumi.StringArray{
 * 				basic.DataStoreId,
 * 			},
 * 			SearchEngineConfig: 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.discoveryengine.DataStore;
 * import com.pulumi.gcp.discoveryengine.DataStoreArgs;
 * import com.pulumi.gcp.discoveryengine.SearchEngine;
 * import com.pulumi.gcp.discoveryengine.SearchEngineArgs;
 * import com.pulumi.gcp.discoveryengine.inputs.SearchEngineSearchEngineConfigArgs;
 * 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 basic = new DataStore("basic", DataStoreArgs.builder()
 *             .location("global")
 *             .dataStoreId("example-datastore-id")
 *             .displayName("tf-test-structured-datastore")
 *             .industryVertical("GENERIC")
 *             .contentConfig("NO_CONTENT")
 *             .solutionTypes("SOLUTION_TYPE_SEARCH")
 *             .createAdvancedSiteSearch(false)
 *             .build());
 *         var basicSearchEngine = new SearchEngine("basicSearchEngine", SearchEngineArgs.builder()
 *             .engineId("example-engine-id")
 *             .collectionId("default_collection")
 *             .location(basic.location())
 *             .displayName("Example Display Name")
 *             .dataStoreIds(basic.dataStoreId())
 *             .searchEngineConfig()
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   basic:
 *     type: gcp:discoveryengine:DataStore
 *     properties:
 *       location: global
 *       dataStoreId: example-datastore-id
 *       displayName: tf-test-structured-datastore
 *       industryVertical: GENERIC
 *       contentConfig: NO_CONTENT
 *       solutionTypes:
 *         - SOLUTION_TYPE_SEARCH
 *       createAdvancedSiteSearch: false
 *   basicSearchEngine:
 *     type: gcp:discoveryengine:SearchEngine
 *     name: basic
 *     properties:
 *       engineId: example-engine-id
 *       collectionId: default_collection
 *       location: ${basic.location}
 *       displayName: Example Display Name
 *       dataStoreIds:
 *         - ${basic.dataStoreId}
 *       searchEngineConfig: {}
 * ```
 * 
 * ## Import
 * SearchEngine 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, SearchEngine can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:discoveryengine/searchEngine:SearchEngine default projects/{{project}}/locations/{{location}}/collections/{{collection_id}}/engines/{{engine_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:discoveryengine/searchEngine:SearchEngine default {{project}}/{{location}}/{{collection_id}}/{{engine_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:discoveryengine/searchEngine:SearchEngine default {{location}}/{{collection_id}}/{{engine_id}}
 * ```
 */
public class SearchEngine internal constructor(
    override val javaResource: com.pulumi.gcp.discoveryengine.SearchEngine,
) : KotlinCustomResource(javaResource, SearchEngineMapper) {
    /**
     * 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 ->
                    searchEngineCommonConfigToKotlin(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. For SOLUTION_TYPE_SEARCH type of engines, they can only associate with at most one data store.
     */
    public val dataStoreIds: Output>
        get() = javaResource.dataStoreIds().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * Required. 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 })

    /**
     * Unique ID to use for Search Engine App.
     */
    public val engineId: Output
        get() = javaResource.engineId().applyValue({ args0 -> args0 })

    /**
     * The industry vertical that the engine registers. The restriction of the Engine industry vertical is based on DataStore:
     * If unspecified, default to GENERIC. Vertical on Engine has to match vertical of the DataStore liniked to the engine.
     * Default value: "GENERIC" Possible values: ["GENERIC", "MEDIA"]
     */
    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 search 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 })

    /**
     * Configurations for a Search Engine.
     * Structure is documented below.
     */
    public val searchEngineConfig: Output
        get() = javaResource.searchEngineConfig().applyValue({ args0 ->
            args0.let({ args0 ->
                searchEngineSearchEngineConfigToKotlin(args0)
            })
        })

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

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy