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

com.pulumi.gcp.diagflow.kotlin.CxWebhook.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.diagflow.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.diagflow.kotlin.outputs.CxWebhookGenericWebService
import com.pulumi.gcp.diagflow.kotlin.outputs.CxWebhookServiceDirectory
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 com.pulumi.gcp.diagflow.kotlin.outputs.CxWebhookGenericWebService.Companion.toKotlin as cxWebhookGenericWebServiceToKotlin
import com.pulumi.gcp.diagflow.kotlin.outputs.CxWebhookServiceDirectory.Companion.toKotlin as cxWebhookServiceDirectoryToKotlin

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

    public var args: CxWebhookArgs = CxWebhookArgs()

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

/**
 * Webhooks host the developer's business logic. During a session, webhooks allow the developer to use the data extracted by Dialogflow's natural language processing to generate dynamic responses, validate collected data, or trigger actions on the backend.
 * To get more information about Webhook, see:
 * * [API documentation](https://cloud.google.com/dialogflow/cx/docs/reference/rest/v3/projects.locations.agents.webhooks)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/dialogflow/cx/docs)
 * ## Example Usage
 * ### Dialogflowcx Webhook Full
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const agent = new gcp.diagflow.CxAgent("agent", {
 *     displayName: "dialogflowcx-agent",
 *     location: "global",
 *     defaultLanguageCode: "en",
 *     supportedLanguageCodes: [
 *         "it",
 *         "de",
 *         "es",
 *     ],
 *     timeZone: "America/New_York",
 *     description: "Example description.",
 *     avatarUri: "https://cloud.google.com/_static/images/cloud/icons/favicons/onecloud/super_cloud.png",
 *     enableStackdriverLogging: true,
 *     enableSpellCorrection: true,
 *     speechToTextSettings: {
 *         enableSpeechAdaptation: true,
 *     },
 * });
 * const basicWebhook = new gcp.diagflow.CxWebhook("basic_webhook", {
 *     parent: agent.id,
 *     displayName: "MyFlow",
 *     genericWebService: {
 *         uri: "https://example.com",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * agent = gcp.diagflow.CxAgent("agent",
 *     display_name="dialogflowcx-agent",
 *     location="global",
 *     default_language_code="en",
 *     supported_language_codes=[
 *         "it",
 *         "de",
 *         "es",
 *     ],
 *     time_zone="America/New_York",
 *     description="Example description.",
 *     avatar_uri="https://cloud.google.com/_static/images/cloud/icons/favicons/onecloud/super_cloud.png",
 *     enable_stackdriver_logging=True,
 *     enable_spell_correction=True,
 *     speech_to_text_settings=gcp.diagflow.CxAgentSpeechToTextSettingsArgs(
 *         enable_speech_adaptation=True,
 *     ))
 * basic_webhook = gcp.diagflow.CxWebhook("basic_webhook",
 *     parent=agent.id,
 *     display_name="MyFlow",
 *     generic_web_service=gcp.diagflow.CxWebhookGenericWebServiceArgs(
 *         uri="https://example.com",
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var agent = new Gcp.Diagflow.CxAgent("agent", new()
 *     {
 *         DisplayName = "dialogflowcx-agent",
 *         Location = "global",
 *         DefaultLanguageCode = "en",
 *         SupportedLanguageCodes = new[]
 *         {
 *             "it",
 *             "de",
 *             "es",
 *         },
 *         TimeZone = "America/New_York",
 *         Description = "Example description.",
 *         AvatarUri = "https://cloud.google.com/_static/images/cloud/icons/favicons/onecloud/super_cloud.png",
 *         EnableStackdriverLogging = true,
 *         EnableSpellCorrection = true,
 *         SpeechToTextSettings = new Gcp.Diagflow.Inputs.CxAgentSpeechToTextSettingsArgs
 *         {
 *             EnableSpeechAdaptation = true,
 *         },
 *     });
 *     var basicWebhook = new Gcp.Diagflow.CxWebhook("basic_webhook", new()
 *     {
 *         Parent = agent.Id,
 *         DisplayName = "MyFlow",
 *         GenericWebService = new Gcp.Diagflow.Inputs.CxWebhookGenericWebServiceArgs
 *         {
 *             Uri = "https://example.com",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/diagflow"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		agent, err := diagflow.NewCxAgent(ctx, "agent", &diagflow.CxAgentArgs{
 * 			DisplayName:         pulumi.String("dialogflowcx-agent"),
 * 			Location:            pulumi.String("global"),
 * 			DefaultLanguageCode: pulumi.String("en"),
 * 			SupportedLanguageCodes: pulumi.StringArray{
 * 				pulumi.String("it"),
 * 				pulumi.String("de"),
 * 				pulumi.String("es"),
 * 			},
 * 			TimeZone:                 pulumi.String("America/New_York"),
 * 			Description:              pulumi.String("Example description."),
 * 			AvatarUri:                pulumi.String("https://cloud.google.com/_static/images/cloud/icons/favicons/onecloud/super_cloud.png"),
 * 			EnableStackdriverLogging: pulumi.Bool(true),
 * 			EnableSpellCorrection:    pulumi.Bool(true),
 * 			SpeechToTextSettings: &diagflow.CxAgentSpeechToTextSettingsArgs{
 * 				EnableSpeechAdaptation: pulumi.Bool(true),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = diagflow.NewCxWebhook(ctx, "basic_webhook", &diagflow.CxWebhookArgs{
 * 			Parent:      agent.ID(),
 * 			DisplayName: pulumi.String("MyFlow"),
 * 			GenericWebService: &diagflow.CxWebhookGenericWebServiceArgs{
 * 				Uri: pulumi.String("https://example.com"),
 * 			},
 * 		})
 * 		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.diagflow.CxAgent;
 * import com.pulumi.gcp.diagflow.CxAgentArgs;
 * import com.pulumi.gcp.diagflow.inputs.CxAgentSpeechToTextSettingsArgs;
 * import com.pulumi.gcp.diagflow.CxWebhook;
 * import com.pulumi.gcp.diagflow.CxWebhookArgs;
 * import com.pulumi.gcp.diagflow.inputs.CxWebhookGenericWebServiceArgs;
 * 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 agent = new CxAgent("agent", CxAgentArgs.builder()
 *             .displayName("dialogflowcx-agent")
 *             .location("global")
 *             .defaultLanguageCode("en")
 *             .supportedLanguageCodes(
 *                 "it",
 *                 "de",
 *                 "es")
 *             .timeZone("America/New_York")
 *             .description("Example description.")
 *             .avatarUri("https://cloud.google.com/_static/images/cloud/icons/favicons/onecloud/super_cloud.png")
 *             .enableStackdriverLogging(true)
 *             .enableSpellCorrection(true)
 *             .speechToTextSettings(CxAgentSpeechToTextSettingsArgs.builder()
 *                 .enableSpeechAdaptation(true)
 *                 .build())
 *             .build());
 *         var basicWebhook = new CxWebhook("basicWebhook", CxWebhookArgs.builder()
 *             .parent(agent.id())
 *             .displayName("MyFlow")
 *             .genericWebService(CxWebhookGenericWebServiceArgs.builder()
 *                 .uri("https://example.com")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   agent:
 *     type: gcp:diagflow:CxAgent
 *     properties:
 *       displayName: dialogflowcx-agent
 *       location: global
 *       defaultLanguageCode: en
 *       supportedLanguageCodes:
 *         - it
 *         - de
 *         - es
 *       timeZone: America/New_York
 *       description: Example description.
 *       avatarUri: https://cloud.google.com/_static/images/cloud/icons/favicons/onecloud/super_cloud.png
 *       enableStackdriverLogging: true
 *       enableSpellCorrection: true
 *       speechToTextSettings:
 *         enableSpeechAdaptation: true
 *   basicWebhook:
 *     type: gcp:diagflow:CxWebhook
 *     name: basic_webhook
 *     properties:
 *       parent: ${agent.id}
 *       displayName: MyFlow
 *       genericWebService:
 *         uri: https://example.com
 * ```
 * 
 * ## Import
 * Webhook can be imported using any of these accepted formats:
 * * `{{parent}}/webhooks/{{name}}`
 * * `{{parent}}/{{name}}`
 * When using the `pulumi import` command, Webhook can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:diagflow/cxWebhook:CxWebhook default {{parent}}/webhooks/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:diagflow/cxWebhook:CxWebhook default {{parent}}/{{name}}
 * ```
 */
public class CxWebhook internal constructor(
    override val javaResource: com.pulumi.gcp.diagflow.CxWebhook,
) : KotlinCustomResource(javaResource, CxWebhookMapper) {
    /**
     * Indicates whether the webhook is disabled.
     */
    public val disabled: Output?
        get() = javaResource.disabled().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The human-readable name of the webhook, unique within the agent.
     * - - -
     */
    public val displayName: Output
        get() = javaResource.displayName().applyValue({ args0 -> args0 })

    /**
     * Indicates if automatic spell correction is enabled in detect intent requests.
     */
    public val enableSpellCorrection: Output?
        get() = javaResource.enableSpellCorrection().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Determines whether this agent should log conversation queries.
     */
    public val enableStackdriverLogging: Output?
        get() = javaResource.enableStackdriverLogging().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Configuration for a generic web service.
     * Structure is documented below.
     */
    public val genericWebService: Output?
        get() = javaResource.genericWebService().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> cxWebhookGenericWebServiceToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The unique identifier of the webhook.
     * Format: projects//locations//agents//webhooks/.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The agent to create a webhook for.
     * Format: projects//locations//agents/.
     */
    public val parent: Output?
        get() = javaResource.parent().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Name of the SecuritySettings reference for the agent. Format: projects//locations//securitySettings/.
     */
    public val securitySettings: Output?
        get() = javaResource.securitySettings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Configuration for a Service Directory service.
     * Structure is documented below.
     */
    public val serviceDirectory: Output?
        get() = javaResource.serviceDirectory().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> cxWebhookServiceDirectoryToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Name of the start flow in this agent. A start flow will be automatically created when the agent is created, and can only be deleted by deleting the agent. Format: projects//locations//agents//flows/.
     */
    public val startFlow: Output
        get() = javaResource.startFlow().applyValue({ args0 -> args0 })

    /**
     * Webhook execution timeout.
     */
    public val timeout: Output?
        get() = javaResource.timeout().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

public object CxWebhookMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.diagflow.CxWebhook::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy