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

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

package com.pulumi.gcp.discoveryengine.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 [Schema].
 */
@PulumiTagMarker
public class SchemaResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: SchemaArgs = SchemaArgs()

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

/**
 * Schema defines the structure and layout of a type of document data.
 * To get more information about Schema, see:
 * * [API documentation](https://cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.dataStores.schemas)
 * * How-to Guides
 *     * [Provide a schema for your data store](https://cloud.google.com/generative-ai-app-builder/docs/provide-schema)
 * ## Example Usage
 * ### Discoveryengine Schema Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const basicDataStore = new gcp.discoveryengine.DataStore("basic", {
 *     location: "global",
 *     dataStoreId: "data-store-id",
 *     displayName: "tf-test-structured-datastore",
 *     industryVertical: "GENERIC",
 *     contentConfig: "NO_CONTENT",
 *     solutionTypes: ["SOLUTION_TYPE_SEARCH"],
 *     createAdvancedSiteSearch: false,
 *     skipDefaultSchemaCreation: true,
 * });
 * const basic = new gcp.discoveryengine.Schema("basic", {
 *     location: basicDataStore.location,
 *     dataStoreId: basicDataStore.dataStoreId,
 *     schemaId: "schema-id",
 *     jsonSchema: "{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"datetime_detection\":true,\"type\":\"object\",\"geolocation_detection\":true}",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * basic_data_store = gcp.discoveryengine.DataStore("basic",
 *     location="global",
 *     data_store_id="data-store-id",
 *     display_name="tf-test-structured-datastore",
 *     industry_vertical="GENERIC",
 *     content_config="NO_CONTENT",
 *     solution_types=["SOLUTION_TYPE_SEARCH"],
 *     create_advanced_site_search=False,
 *     skip_default_schema_creation=True)
 * basic = gcp.discoveryengine.Schema("basic",
 *     location=basic_data_store.location,
 *     data_store_id=basic_data_store.data_store_id,
 *     schema_id="schema-id",
 *     json_schema="{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"datetime_detection\":true,\"type\":\"object\",\"geolocation_detection\":true}")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var basicDataStore = new Gcp.DiscoveryEngine.DataStore("basic", new()
 *     {
 *         Location = "global",
 *         DataStoreId = "data-store-id",
 *         DisplayName = "tf-test-structured-datastore",
 *         IndustryVertical = "GENERIC",
 *         ContentConfig = "NO_CONTENT",
 *         SolutionTypes = new[]
 *         {
 *             "SOLUTION_TYPE_SEARCH",
 *         },
 *         CreateAdvancedSiteSearch = false,
 *         SkipDefaultSchemaCreation = true,
 *     });
 *     var basic = new Gcp.DiscoveryEngine.Schema("basic", new()
 *     {
 *         Location = basicDataStore.Location,
 *         DataStoreId = basicDataStore.DataStoreId,
 *         SchemaId = "schema-id",
 *         JsonSchema = "{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"datetime_detection\":true,\"type\":\"object\",\"geolocation_detection\":true}",
 *     });
 * });
 * ```
 * ```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 {
 * 		basicDataStore, err := discoveryengine.NewDataStore(ctx, "basic", &discoveryengine.DataStoreArgs{
 * 			Location:         pulumi.String("global"),
 * 			DataStoreId:      pulumi.String("data-store-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),
 * 			SkipDefaultSchemaCreation: pulumi.Bool(true),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = discoveryengine.NewSchema(ctx, "basic", &discoveryengine.SchemaArgs{
 * 			Location:    basicDataStore.Location,
 * 			DataStoreId: basicDataStore.DataStoreId,
 * 			SchemaId:    pulumi.String("schema-id"),
 * 			JsonSchema:  pulumi.String("{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"datetime_detection\":true,\"type\":\"object\",\"geolocation_detection\":true}"),
 * 		})
 * 		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.Schema;
 * import com.pulumi.gcp.discoveryengine.SchemaArgs;
 * 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 basicDataStore = new DataStore("basicDataStore", DataStoreArgs.builder()
 *             .location("global")
 *             .dataStoreId("data-store-id")
 *             .displayName("tf-test-structured-datastore")
 *             .industryVertical("GENERIC")
 *             .contentConfig("NO_CONTENT")
 *             .solutionTypes("SOLUTION_TYPE_SEARCH")
 *             .createAdvancedSiteSearch(false)
 *             .skipDefaultSchemaCreation(true)
 *             .build());
 *         var basic = new Schema("basic", SchemaArgs.builder()
 *             .location(basicDataStore.location())
 *             .dataStoreId(basicDataStore.dataStoreId())
 *             .schemaId("schema-id")
 *             .jsonSchema("{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"datetime_detection\":true,\"type\":\"object\",\"geolocation_detection\":true}")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   basic:
 *     type: gcp:discoveryengine:Schema
 *     properties:
 *       location: ${basicDataStore.location}
 *       dataStoreId: ${basicDataStore.dataStoreId}
 *       schemaId: schema-id
 *       jsonSchema: '{"$schema":"https://json-schema.org/draft/2020-12/schema","datetime_detection":true,"type":"object","geolocation_detection":true}'
 *   basicDataStore:
 *     type: gcp:discoveryengine:DataStore
 *     name: basic
 *     properties:
 *       location: global
 *       dataStoreId: data-store-id
 *       displayName: tf-test-structured-datastore
 *       industryVertical: GENERIC
 *       contentConfig: NO_CONTENT
 *       solutionTypes:
 *         - SOLUTION_TYPE_SEARCH
 *       createAdvancedSiteSearch: false
 *       skipDefaultSchemaCreation: true
 * ```
 * 
 * ## Import
 * Schema can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/collections/default_collection/dataStores/{{data_store_id}}/schemas/{{schema_id}}`
 * * `{{project}}/{{location}}/{{data_store_id}}/{{schema_id}}`
 * * `{{location}}/{{data_store_id}}/{{schema_id}}`
 * When using the `pulumi import` command, Schema can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:discoveryengine/schema:Schema default projects/{{project}}/locations/{{location}}/collections/default_collection/dataStores/{{data_store_id}}/schemas/{{schema_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:discoveryengine/schema:Schema default {{project}}/{{location}}/{{data_store_id}}/{{schema_id}}
 * ```
 * ```sh
 * $ pulumi import gcp:discoveryengine/schema:Schema default {{location}}/{{data_store_id}}/{{schema_id}}
 * ```
 */
public class Schema internal constructor(
    override val javaResource: com.pulumi.gcp.discoveryengine.Schema,
) : KotlinCustomResource(javaResource, SchemaMapper) {
    /**
     * The unique id of the data store.
     */
    public val dataStoreId: Output
        get() = javaResource.dataStoreId().applyValue({ args0 -> args0 })

    /**
     * The JSON representation of the schema.
     */
    public val jsonSchema: Output?
        get() = javaResource.jsonSchema().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The geographic location where the data store should reside. The value can
     * only be one of "global", "us" and "eu".
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The unique full resource name of the schema. Values are of the format
     * `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}/schemas/{schema_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 })

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

    /**
     * The unique id of the schema.
     * - - -
     */
    public val schemaId: Output
        get() = javaResource.schemaId().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy