Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.gcp.diagflow.kotlin.CxAgent.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.diagflow.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.diagflow.kotlin.outputs.CxAgentAdvancedSettings
import com.pulumi.gcp.diagflow.kotlin.outputs.CxAgentGitIntegrationSettings
import com.pulumi.gcp.diagflow.kotlin.outputs.CxAgentSpeechToTextSettings
import com.pulumi.gcp.diagflow.kotlin.outputs.CxAgentTextToSpeechSettings
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.diagflow.kotlin.outputs.CxAgentAdvancedSettings.Companion.toKotlin as cxAgentAdvancedSettingsToKotlin
import com.pulumi.gcp.diagflow.kotlin.outputs.CxAgentGitIntegrationSettings.Companion.toKotlin as cxAgentGitIntegrationSettingsToKotlin
import com.pulumi.gcp.diagflow.kotlin.outputs.CxAgentSpeechToTextSettings.Companion.toKotlin as cxAgentSpeechToTextSettingsToKotlin
import com.pulumi.gcp.diagflow.kotlin.outputs.CxAgentTextToSpeechSettings.Companion.toKotlin as cxAgentTextToSpeechSettingsToKotlin
/**
* Builder for [CxAgent].
*/
@PulumiTagMarker
public class CxAgentResourceBuilder internal constructor() {
public var name: String? = null
public var args: CxAgentArgs = CxAgentArgs()
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 CxAgentArgsBuilder.() -> Unit) {
val builder = CxAgentArgsBuilder()
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(): CxAgent {
val builtJavaResource = com.pulumi.gcp.diagflow.CxAgent(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return CxAgent(builtJavaResource)
}
}
/**
* Agents are best described as Natural Language Understanding (NLU) modules that transform user requests into actionable data. You can include agents in your app, product, or service to determine user intent and respond to the user in a natural way.
* To get more information about Agent, see:
* * [API documentation](https://cloud.google.com/dialogflow/cx/docs/reference/rest/v3/projects.locations.agents)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/dialogflow/cx/docs)
* ## Example Usage
* ### Dialogflowcx Agent Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const bucket = new gcp.storage.Bucket("bucket", {
* name: "dialogflowcx-bucket",
* location: "US",
* uniformBucketLevelAccess: true,
* });
* const fullAgent = new gcp.diagflow.CxAgent("full_agent", {
* displayName: "dialogflowcx-agent",
* location: "global",
* defaultLanguageCode: "en",
* supportedLanguageCodes: [
* "fr",
* "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,
* },
* advancedSettings: {
* audioExportGcsDestination: {
* uri: pulumi.interpolate`${bucket.url}/prefix-`,
* },
* dtmfSettings: {
* enabled: true,
* maxDigits: 1,
* finishDigit: "#",
* },
* },
* gitIntegrationSettings: {
* githubSettings: {
* displayName: "Github Repo",
* repositoryUri: "https://api.github.com/repos/githubtraining/hellogitworld",
* trackingBranch: "main",
* accessToken: "secret-token",
* branches: ["main"],
* },
* },
* textToSpeechSettings: {
* synthesizeSpeechConfigs: JSON.stringify({
* en: {
* voice: {
* name: "en-US-Neural2-A",
* },
* },
* fr: {
* voice: {
* name: "fr-CA-Neural2-A",
* },
* },
* }),
* },
* });
* ```
* ```python
* import pulumi
* import json
* import pulumi_gcp as gcp
* bucket = gcp.storage.Bucket("bucket",
* name="dialogflowcx-bucket",
* location="US",
* uniform_bucket_level_access=True)
* full_agent = gcp.diagflow.CxAgent("full_agent",
* display_name="dialogflowcx-agent",
* location="global",
* default_language_code="en",
* supported_language_codes=[
* "fr",
* "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={
* "enable_speech_adaptation": True,
* },
* advanced_settings={
* "audio_export_gcs_destination": {
* "uri": bucket.url.apply(lambda url: f"{url}/prefix-"),
* },
* "dtmf_settings": {
* "enabled": True,
* "max_digits": 1,
* "finish_digit": "#",
* },
* },
* git_integration_settings={
* "github_settings": {
* "display_name": "Github Repo",
* "repository_uri": "https://api.github.com/repos/githubtraining/hellogitworld",
* "tracking_branch": "main",
* "access_token": "secret-token",
* "branches": ["main"],
* },
* },
* text_to_speech_settings={
* "synthesize_speech_configs": json.dumps({
* "en": {
* "voice": {
* "name": "en-US-Neural2-A",
* },
* },
* "fr": {
* "voice": {
* "name": "fr-CA-Neural2-A",
* },
* },
* }),
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using System.Text.Json;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var bucket = new Gcp.Storage.Bucket("bucket", new()
* {
* Name = "dialogflowcx-bucket",
* Location = "US",
* UniformBucketLevelAccess = true,
* });
* var fullAgent = new Gcp.Diagflow.CxAgent("full_agent", new()
* {
* DisplayName = "dialogflowcx-agent",
* Location = "global",
* DefaultLanguageCode = "en",
* SupportedLanguageCodes = new[]
* {
* "fr",
* "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,
* },
* AdvancedSettings = new Gcp.Diagflow.Inputs.CxAgentAdvancedSettingsArgs
* {
* AudioExportGcsDestination = new Gcp.Diagflow.Inputs.CxAgentAdvancedSettingsAudioExportGcsDestinationArgs
* {
* Uri = bucket.Url.Apply(url => $"{url}/prefix-"),
* },
* DtmfSettings = new Gcp.Diagflow.Inputs.CxAgentAdvancedSettingsDtmfSettingsArgs
* {
* Enabled = true,
* MaxDigits = 1,
* FinishDigit = "#",
* },
* },
* GitIntegrationSettings = new Gcp.Diagflow.Inputs.CxAgentGitIntegrationSettingsArgs
* {
* GithubSettings = new Gcp.Diagflow.Inputs.CxAgentGitIntegrationSettingsGithubSettingsArgs
* {
* DisplayName = "Github Repo",
* RepositoryUri = "https://api.github.com/repos/githubtraining/hellogitworld",
* TrackingBranch = "main",
* AccessToken = "secret-token",
* Branches = new[]
* {
* "main",
* },
* },
* },
* TextToSpeechSettings = new Gcp.Diagflow.Inputs.CxAgentTextToSpeechSettingsArgs
* {
* SynthesizeSpeechConfigs = JsonSerializer.Serialize(new Dictionary
* {
* ["en"] = new Dictionary
* {
* ["voice"] = new Dictionary
* {
* ["name"] = "en-US-Neural2-A",
* },
* },
* ["fr"] = new Dictionary
* {
* ["voice"] = new Dictionary
* {
* ["name"] = "fr-CA-Neural2-A",
* },
* },
* }),
* },
* });
* });
* ```
* ```go
* package main
* import (
* "encoding/json"
* "fmt"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/diagflow"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* bucket, err := storage.NewBucket(ctx, "bucket", &storage.BucketArgs{
* Name: pulumi.String("dialogflowcx-bucket"),
* Location: pulumi.String("US"),
* UniformBucketLevelAccess: pulumi.Bool(true),
* })
* if err != nil {
* return err
* }
* tmpJSON0, err := json.Marshal(map[string]interface{}{
* "en": map[string]interface{}{
* "voice": map[string]interface{}{
* "name": "en-US-Neural2-A",
* },
* },
* "fr": map[string]interface{}{
* "voice": map[string]interface{}{
* "name": "fr-CA-Neural2-A",
* },
* },
* })
* if err != nil {
* return err
* }
* json0 := string(tmpJSON0)
* _, err = diagflow.NewCxAgent(ctx, "full_agent", &diagflow.CxAgentArgs{
* DisplayName: pulumi.String("dialogflowcx-agent"),
* Location: pulumi.String("global"),
* DefaultLanguageCode: pulumi.String("en"),
* SupportedLanguageCodes: pulumi.StringArray{
* pulumi.String("fr"),
* 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),
* },
* AdvancedSettings: &diagflow.CxAgentAdvancedSettingsArgs{
* AudioExportGcsDestination: &diagflow.CxAgentAdvancedSettingsAudioExportGcsDestinationArgs{
* Uri: bucket.Url.ApplyT(func(url string) (string, error) {
* return fmt.Sprintf("%v/prefix-", url), nil
* }).(pulumi.StringOutput),
* },
* DtmfSettings: &diagflow.CxAgentAdvancedSettingsDtmfSettingsArgs{
* Enabled: pulumi.Bool(true),
* MaxDigits: pulumi.Int(1),
* FinishDigit: pulumi.String("#"),
* },
* },
* GitIntegrationSettings: &diagflow.CxAgentGitIntegrationSettingsArgs{
* GithubSettings: &diagflow.CxAgentGitIntegrationSettingsGithubSettingsArgs{
* DisplayName: pulumi.String("Github Repo"),
* RepositoryUri: pulumi.String("https://api.github.com/repos/githubtraining/hellogitworld"),
* TrackingBranch: pulumi.String("main"),
* AccessToken: pulumi.String("secret-token"),
* Branches: pulumi.StringArray{
* pulumi.String("main"),
* },
* },
* },
* TextToSpeechSettings: &diagflow.CxAgentTextToSpeechSettingsArgs{
* SynthesizeSpeechConfigs: pulumi.String(json0),
* },
* })
* 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.storage.Bucket;
* import com.pulumi.gcp.storage.BucketArgs;
* import com.pulumi.gcp.diagflow.CxAgent;
* import com.pulumi.gcp.diagflow.CxAgentArgs;
* import com.pulumi.gcp.diagflow.inputs.CxAgentSpeechToTextSettingsArgs;
* import com.pulumi.gcp.diagflow.inputs.CxAgentAdvancedSettingsArgs;
* import com.pulumi.gcp.diagflow.inputs.CxAgentAdvancedSettingsAudioExportGcsDestinationArgs;
* import com.pulumi.gcp.diagflow.inputs.CxAgentAdvancedSettingsDtmfSettingsArgs;
* import com.pulumi.gcp.diagflow.inputs.CxAgentGitIntegrationSettingsArgs;
* import com.pulumi.gcp.diagflow.inputs.CxAgentGitIntegrationSettingsGithubSettingsArgs;
* import com.pulumi.gcp.diagflow.inputs.CxAgentTextToSpeechSettingsArgs;
* import static com.pulumi.codegen.internal.Serialization.*;
* 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 bucket = new Bucket("bucket", BucketArgs.builder()
* .name("dialogflowcx-bucket")
* .location("US")
* .uniformBucketLevelAccess(true)
* .build());
* var fullAgent = new CxAgent("fullAgent", CxAgentArgs.builder()
* .displayName("dialogflowcx-agent")
* .location("global")
* .defaultLanguageCode("en")
* .supportedLanguageCodes(
* "fr",
* "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())
* .advancedSettings(CxAgentAdvancedSettingsArgs.builder()
* .audioExportGcsDestination(CxAgentAdvancedSettingsAudioExportGcsDestinationArgs.builder()
* .uri(bucket.url().applyValue(url -> String.format("%s/prefix-", url)))
* .build())
* .dtmfSettings(CxAgentAdvancedSettingsDtmfSettingsArgs.builder()
* .enabled(true)
* .maxDigits(1)
* .finishDigit("#")
* .build())
* .build())
* .gitIntegrationSettings(CxAgentGitIntegrationSettingsArgs.builder()
* .githubSettings(CxAgentGitIntegrationSettingsGithubSettingsArgs.builder()
* .displayName("Github Repo")
* .repositoryUri("https://api.github.com/repos/githubtraining/hellogitworld")
* .trackingBranch("main")
* .accessToken("secret-token")
* .branches("main")
* .build())
* .build())
* .textToSpeechSettings(CxAgentTextToSpeechSettingsArgs.builder()
* .synthesizeSpeechConfigs(serializeJson(
* jsonObject(
* jsonProperty("en", jsonObject(
* jsonProperty("voice", jsonObject(
* jsonProperty("name", "en-US-Neural2-A")
* ))
* )),
* jsonProperty("fr", jsonObject(
* jsonProperty("voice", jsonObject(
* jsonProperty("name", "fr-CA-Neural2-A")
* ))
* ))
* )))
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* bucket:
* type: gcp:storage:Bucket
* properties:
* name: dialogflowcx-bucket
* location: US
* uniformBucketLevelAccess: true
* fullAgent:
* type: gcp:diagflow:CxAgent
* name: full_agent
* properties:
* displayName: dialogflowcx-agent
* location: global
* defaultLanguageCode: en
* supportedLanguageCodes:
* - fr
* - 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
* advancedSettings:
* audioExportGcsDestination:
* uri: ${bucket.url}/prefix-
* dtmfSettings:
* enabled: true
* maxDigits: 1
* finishDigit: '#'
* gitIntegrationSettings:
* githubSettings:
* displayName: Github Repo
* repositoryUri: https://api.github.com/repos/githubtraining/hellogitworld
* trackingBranch: main
* accessToken: secret-token
* branches:
* - main
* textToSpeechSettings:
* synthesizeSpeechConfigs:
* fn::toJSON:
* en:
* voice:
* name: en-US-Neural2-A
* fr:
* voice:
* name: fr-CA-Neural2-A
* ```
*
* ## Import
* Agent can be imported using any of these accepted formats:
* * `projects/{{project}}/locations/{{location}}/agents/{{name}}`
* * `{{project}}/{{location}}/{{name}}`
* * `{{location}}/{{name}}`
* When using the `pulumi import` command, Agent can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:diagflow/cxAgent:CxAgent default projects/{{project}}/locations/{{location}}/agents/{{name}}
* ```
* ```sh
* $ pulumi import gcp:diagflow/cxAgent:CxAgent default {{project}}/{{location}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:diagflow/cxAgent:CxAgent default {{location}}/{{name}}
* ```
*/
public class CxAgent internal constructor(
override val javaResource: com.pulumi.gcp.diagflow.CxAgent,
) : KotlinCustomResource(javaResource, CxAgentMapper) {
/**
* Hierarchical advanced settings for this agent. The settings exposed at the lower level overrides the settings exposed at the higher level.
* Hierarchy: Agent->Flow->Page->Fulfillment/Parameter.
* Structure is documented below.
*/
public val advancedSettings: Output
get() = javaResource.advancedSettings().applyValue({ args0 ->
args0.let({ args0 ->
cxAgentAdvancedSettingsToKotlin(args0)
})
})
/**
* The URI of the agent's avatar. Avatars are used throughout the Dialogflow console and in the self-hosted Web Demo integration.
*/
public val avatarUri: Output?
get() = javaResource.avatarUri().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The default language of the agent as a language tag. [See Language Support](https://cloud.google.com/dialogflow/cx/docs/reference/language)
* for a list of the currently supported language codes. This field cannot be updated after creation.
*/
public val defaultLanguageCode: Output
get() = javaResource.defaultLanguageCode().applyValue({ args0 -> args0 })
/**
* The description of this agent. The maximum length is 500 characters. If exceeded, the request is rejected.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The human-readable name of the agent, unique within the location.
*/
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)
})
/**
* Git integration settings for this agent.
* Structure is documented below.
*/
public val gitIntegrationSettings: Output?
get() = javaResource.gitIntegrationSettings().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> cxAgentGitIntegrationSettingsToKotlin(args0) })
}).orElse(null)
})
/**
* The name of the location this agent is located in.
* > **Note:** The first time you are deploying an Agent in your project you must configure location settings.
* This is a one time step but at the moment you can only [configure location settings](https://cloud.google.com/dialogflow/cx/docs/concept/region#location-settings) via the Dialogflow CX console.
* Another options is to use global location so you don't need to manually configure location settings.
*/
public val location: Output
get() = javaResource.location().applyValue({ args0 -> args0 })
/**
* The unique identifier of the agent.
*/
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 })
/**
* 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)
})
/**
* Settings related to speech recognition.
* Structure is documented below.
*/
public val speechToTextSettings: Output?
get() = javaResource.speechToTextSettings().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> cxAgentSpeechToTextSettingsToKotlin(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 })
/**
* The list of all languages supported by this agent (except for the default_language_code).
*/
public val supportedLanguageCodes: Output>?
get() = javaResource.supportedLanguageCodes().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 -> args0 })
}).orElse(null)
})
/**
* Settings related to speech synthesizing.
* Structure is documented below.
*/
public val textToSpeechSettings: Output?
get() = javaResource.textToSpeechSettings().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> cxAgentTextToSpeechSettingsToKotlin(args0) })
}).orElse(null)
})
/**
* The time zone of this agent from the [time zone database](https://www.iana.org/time-zones), e.g., America/New_York,
* Europe/Paris.
* - - -
*/
public val timeZone: Output
get() = javaResource.timeZone().applyValue({ args0 -> args0 })
}
public object CxAgentMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.diagflow.CxAgent::class == javaResource::class
override fun map(javaResource: Resource): CxAgent = CxAgent(
javaResource as
com.pulumi.gcp.diagflow.CxAgent,
)
}
/**
* @see [CxAgent].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [CxAgent].
*/
public suspend fun cxAgent(name: String, block: suspend CxAgentResourceBuilder.() -> Unit): CxAgent {
val builder = CxAgentResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [CxAgent].
* @param name The _unique_ name of the resulting resource.
*/
public fun cxAgent(name: String): CxAgent {
val builder = CxAgentResourceBuilder()
builder.name(name)
return builder.build()
}