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

com.pulumi.gcp.essentialcontacts.kotlin.DocumentAiWarehouseDocumentSchema.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.essentialcontacts.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.essentialcontacts.kotlin.outputs.DocumentAiWarehouseDocumentSchemaPropertyDefinition
import com.pulumi.gcp.essentialcontacts.kotlin.outputs.DocumentAiWarehouseDocumentSchemaPropertyDefinition.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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List

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

    public var args: DocumentAiWarehouseDocumentSchemaArgs = DocumentAiWarehouseDocumentSchemaArgs()

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

/**
 * A document schema is used to define document structure.
 * To get more information about DocumentSchema, see:
 * * [API documentation](https://cloud.google.com/document-warehouse/docs/reference/rest/v1/projects.locations.documentSchemas)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/document-warehouse/docs/manage-document-schemas)
 * ## Example Usage
 * ### Document Ai Warehouse Document Schema Text
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const project = gcp.organizations.getProject({});
 * const exampleText = new gcp.essentialcontacts.DocumentAiWarehouseDocumentSchema("example_text", {
 *     projectNumber: project.then(project => project.number),
 *     displayName: "test-property-text",
 *     location: "us",
 *     documentIsFolder: false,
 *     propertyDefinitions: [{
 *         name: "prop3",
 *         displayName: "propdisp3",
 *         isRepeatable: false,
 *         isFilterable: true,
 *         isSearchable: true,
 *         isMetadata: false,
 *         isRequired: false,
 *         retrievalImportance: "HIGHEST",
 *         schemaSources: [{
 *             name: "dummy_source",
 *             processorType: "dummy_processor",
 *         }],
 *         textTypeOptions: {},
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * project = gcp.organizations.get_project()
 * example_text = gcp.essentialcontacts.DocumentAiWarehouseDocumentSchema("example_text",
 *     project_number=project.number,
 *     display_name="test-property-text",
 *     location="us",
 *     document_is_folder=False,
 *     property_definitions=[gcp.essentialcontacts.DocumentAiWarehouseDocumentSchemaPropertyDefinitionArgs(
 *         name="prop3",
 *         display_name="propdisp3",
 *         is_repeatable=False,
 *         is_filterable=True,
 *         is_searchable=True,
 *         is_metadata=False,
 *         is_required=False,
 *         retrieval_importance="HIGHEST",
 *         schema_sources=[gcp.essentialcontacts.DocumentAiWarehouseDocumentSchemaPropertyDefinitionSchemaSourceArgs(
 *             name="dummy_source",
 *             processor_type="dummy_processor",
 *         )],
 *         text_type_options=gcp.essentialcontacts.DocumentAiWarehouseDocumentSchemaPropertyDefinitionTextTypeOptionsArgs(),
 *     )])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var project = Gcp.Organizations.GetProject.Invoke();
 *     var exampleText = new Gcp.EssentialContacts.DocumentAiWarehouseDocumentSchema("example_text", new()
 *     {
 *         ProjectNumber = project.Apply(getProjectResult => getProjectResult.Number),
 *         DisplayName = "test-property-text",
 *         Location = "us",
 *         DocumentIsFolder = false,
 *         PropertyDefinitions = new[]
 *         {
 *             new Gcp.EssentialContacts.Inputs.DocumentAiWarehouseDocumentSchemaPropertyDefinitionArgs
 *             {
 *                 Name = "prop3",
 *                 DisplayName = "propdisp3",
 *                 IsRepeatable = false,
 *                 IsFilterable = true,
 *                 IsSearchable = true,
 *                 IsMetadata = false,
 *                 IsRequired = false,
 *                 RetrievalImportance = "HIGHEST",
 *                 SchemaSources = new[]
 *                 {
 *                     new Gcp.EssentialContacts.Inputs.DocumentAiWarehouseDocumentSchemaPropertyDefinitionSchemaSourceArgs
 *                     {
 *                         Name = "dummy_source",
 *                         ProcessorType = "dummy_processor",
 *                     },
 *                 },
 *                 TextTypeOptions = null,
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/essentialcontacts"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		project, err := organizations.LookupProject(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = essentialcontacts.NewDocumentAiWarehouseDocumentSchema(ctx, "example_text", &essentialcontacts.DocumentAiWarehouseDocumentSchemaArgs{
 * 			ProjectNumber:    pulumi.String(project.Number),
 * 			DisplayName:      pulumi.String("test-property-text"),
 * 			Location:         pulumi.String("us"),
 * 			DocumentIsFolder: pulumi.Bool(false),
 * 			PropertyDefinitions: essentialcontacts.DocumentAiWarehouseDocumentSchemaPropertyDefinitionArray{
 * 				&essentialcontacts.DocumentAiWarehouseDocumentSchemaPropertyDefinitionArgs{
 * 					Name:                pulumi.String("prop3"),
 * 					DisplayName:         pulumi.String("propdisp3"),
 * 					IsRepeatable:        pulumi.Bool(false),
 * 					IsFilterable:        pulumi.Bool(true),
 * 					IsSearchable:        pulumi.Bool(true),
 * 					IsMetadata:          pulumi.Bool(false),
 * 					IsRequired:          pulumi.Bool(false),
 * 					RetrievalImportance: pulumi.String("HIGHEST"),
 * 					SchemaSources: essentialcontacts.DocumentAiWarehouseDocumentSchemaPropertyDefinitionSchemaSourceArray{
 * 						&essentialcontacts.DocumentAiWarehouseDocumentSchemaPropertyDefinitionSchemaSourceArgs{
 * 							Name:          pulumi.String("dummy_source"),
 * 							ProcessorType: pulumi.String("dummy_processor"),
 * 						},
 * 					},
 * 					TextTypeOptions: 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.organizations.OrganizationsFunctions;
 * import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
 * import com.pulumi.gcp.essentialcontacts.DocumentAiWarehouseDocumentSchema;
 * import com.pulumi.gcp.essentialcontacts.DocumentAiWarehouseDocumentSchemaArgs;
 * import com.pulumi.gcp.essentialcontacts.inputs.DocumentAiWarehouseDocumentSchemaPropertyDefinitionArgs;
 * import com.pulumi.gcp.essentialcontacts.inputs.DocumentAiWarehouseDocumentSchemaPropertyDefinitionTextTypeOptionsArgs;
 * 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 project = OrganizationsFunctions.getProject();
 *         var exampleText = new DocumentAiWarehouseDocumentSchema("exampleText", DocumentAiWarehouseDocumentSchemaArgs.builder()
 *             .projectNumber(project.applyValue(getProjectResult -> getProjectResult.number()))
 *             .displayName("test-property-text")
 *             .location("us")
 *             .documentIsFolder(false)
 *             .propertyDefinitions(DocumentAiWarehouseDocumentSchemaPropertyDefinitionArgs.builder()
 *                 .name("prop3")
 *                 .displayName("propdisp3")
 *                 .isRepeatable(false)
 *                 .isFilterable(true)
 *                 .isSearchable(true)
 *                 .isMetadata(false)
 *                 .isRequired(false)
 *                 .retrievalImportance("HIGHEST")
 *                 .schemaSources(DocumentAiWarehouseDocumentSchemaPropertyDefinitionSchemaSourceArgs.builder()
 *                     .name("dummy_source")
 *                     .processorType("dummy_processor")
 *                     .build())
 *                 .textTypeOptions()
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   exampleText:
 *     type: gcp:essentialcontacts:DocumentAiWarehouseDocumentSchema
 *     name: example_text
 *     properties:
 *       projectNumber: ${project.number}
 *       displayName: test-property-text
 *       location: us
 *       documentIsFolder: false
 *       propertyDefinitions:
 *         - name: prop3
 *           displayName: propdisp3
 *           isRepeatable: false
 *           isFilterable: true
 *           isSearchable: true
 *           isMetadata: false
 *           isRequired: false
 *           retrievalImportance: HIGHEST
 *           schemaSources:
 *             - name: dummy_source
 *               processorType: dummy_processor
 *           textTypeOptions: {}
 * variables:
 *   project:
 *     fn::invoke:
 *       Function: gcp:organizations:getProject
 *       Arguments: {}
 * ```
 * 
 * ## Import
 * DocumentSchema can be imported using any of these accepted formats:
 * * `projects/{{project_number}}/locations/{{location}}/documentSchemas/{{name}}`
 * * `{{project_number}}/{{location}}/{{name}}`
 * When using the `pulumi import` command, DocumentSchema can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:essentialcontacts/documentAiWarehouseDocumentSchema:DocumentAiWarehouseDocumentSchema default projects/{{project_number}}/locations/{{location}}/documentSchemas/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:essentialcontacts/documentAiWarehouseDocumentSchema:DocumentAiWarehouseDocumentSchema default {{project_number}}/{{location}}/{{name}}
 * ```
 */
public class DocumentAiWarehouseDocumentSchema internal constructor(
    override val javaResource: com.pulumi.gcp.essentialcontacts.DocumentAiWarehouseDocumentSchema,
) : KotlinCustomResource(javaResource, DocumentAiWarehouseDocumentSchemaMapper) {
    /**
     * Name of the schema given by the user.
     */
    public val displayName: Output
        get() = javaResource.displayName().applyValue({ args0 -> args0 })

    /**
     * Tells whether the document is a folder or a typical document.
     */
    public val documentIsFolder: Output?
        get() = javaResource.documentIsFolder().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The location of the resource.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The resource name of the document schema.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The unique identifier of the project.
     */
    public val projectNumber: Output
        get() = javaResource.projectNumber().applyValue({ args0 -> args0 })

    /**
     * Defines the metadata for a schema property.
     * Structure is documented below.
     */
    public val propertyDefinitions: Output>
        get() = javaResource.propertyDefinitions().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> toKotlin(args0) })
            })
        })
}

public object DocumentAiWarehouseDocumentSchemaMapper :
    ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.essentialcontacts.DocumentAiWarehouseDocumentSchema::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy