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

com.pulumi.googlenative.discoveryengine.v1alpha.kotlin.Document.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.

The newest version!
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.googlenative.discoveryengine.v1alpha.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
import kotlin.collections.Map

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

    public var args: DocumentArgs = DocumentArgs()

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

/**
 * Creates a Document.
 */
public class Document internal constructor(
    override val javaResource: com.pulumi.googlenative.discoveryengine.v1alpha.Document,
) : KotlinCustomResource(javaResource, DocumentMapper) {
    public val branchId: Output
        get() = javaResource.branchId().applyValue({ args0 -> args0 })

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

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

    /**
     * Required. The ID to use for the Document, which will become the final component of the Document.name. If the caller does not have permission to create the Document, regardless of whether or not it exists, a `PERMISSION_DENIED` error is returned. This field must be unique among all Documents with the same parent. Otherwise, an `ALREADY_EXISTS` error is returned. This field must conform to [RFC-1034](https://tools.ietf.org/html/rfc1034) standard with a length limit of 63 characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
     */
    public val documentId: Output
        get() = javaResource.documentId().applyValue({ args0 -> args0 })

    /**
     * The JSON string representation of the document. It should conform to the registered Schema.schema or an `INVALID_ARGUMENT` error is thrown.
     */
    public val jsonData: Output
        get() = javaResource.jsonData().applyValue({ args0 -> args0 })

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

    /**
     * Immutable. The full resource name of the document. Format: `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document_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 identifier of the parent document. Currently supports at most two level document hierarchy. Id should conform to [RFC-1034](https://tools.ietf.org/html/rfc1034) standard with a length limit of 63 characters.
     */
    public val parentDocumentId: Output
        get() = javaResource.parentDocumentId().applyValue({ args0 -> args0 })

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

    /**
     * The identifier of the schema located in the same data store.
     */
    public val schemaId: Output
        get() = javaResource.schemaId().applyValue({ args0 -> args0 })

    /**
     * The structured JSON data for the document. It should conform to the registered Schema.schema or an `INVALID_ARGUMENT` error is thrown.
     */
    public val structData: Output>
        get() = javaResource.structData().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })
}

public object DocumentMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.googlenative.discoveryengine.v1alpha.Document::class == javaResource::class

    override fun map(javaResource: Resource): Document = Document(
        javaResource as
            com.pulumi.googlenative.discoveryengine.v1alpha.Document,
    )
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy