From 76dc08ddcfae5df019a88d74625faa07f5e57a14 Mon Sep 17 00:00:00 2001 From: Aleksandr Averbukh Date: Wed, 9 Oct 2024 23:19:10 +0200 Subject: [PATCH] Add logging_settings and speech_settings to dialogflow_cx_agent/flow (#11940) --- mmv1/products/dialogflowcx/Agent.yaml | 52 +++++++++++++++++++ mmv1/products/dialogflowcx/Flow.yaml | 49 +++++++++++++++++ .../examples/dialogflowcx_agent_full.tf.tmpl | 19 ++++++- .../examples/dialogflowcx_flow_full.tf.tmpl | 17 +++++- .../resource_dialogflowcx_agent_test.go.tmpl | 25 +++++++-- .../resource_dialogflowcx_flow_test.go | 29 ++++++++--- 6 files changed, 177 insertions(+), 14 deletions(-) diff --git a/mmv1/products/dialogflowcx/Agent.yaml b/mmv1/products/dialogflowcx/Agent.yaml index 85270a9abc33..8d3f2b006552 100644 --- a/mmv1/products/dialogflowcx/Agent.yaml +++ b/mmv1/products/dialogflowcx/Agent.yaml @@ -40,6 +40,8 @@ examples: bucket_name: 'dialogflowcx-bucket' ignore_read_extra: - 'git_integration_settings.0.github_settings.0.access_token' + - 'enable_stackdriver_logging' + - 'advanced_settings.0.logging_settings' parameters: properties: - name: 'name' @@ -113,8 +115,11 @@ properties: Name of the SecuritySettings reference for the agent. Format: projects//locations//securitySettings/. - name: 'enableStackdriverLogging' type: Boolean + # Ignore read, field is deprecated and conflicts with advanced_settings.logging_settings.enable_stackdriver_logging when it's set + ignore_read: true description: | Determines whether this agent should log conversation queries. + deprecation_message: '`enable_stackdriver_logging` is deprecated and will be removed in a future major release. Please use `advanced_settings.logging_settings.enable_stackdriver_logging`instead.' - name: 'enableSpellCorrection' type: Boolean description: | @@ -138,6 +143,33 @@ properties: description: | The Google Cloud Storage URI for the exported objects. Whether a full object name, or just a prefix, its usage depends on the Dialogflow operation. Format: gs://bucket/object-name-or-prefix + - name: 'speechSettings' + type: NestedObject + description: | + Settings for speech to text detection. Exposed at the following levels: + * Agent level + * Flow level + * Page level + * Parameter level + properties: + - name: 'endpointerSensitivity' + type: Integer + description: | + Sensitivity of the speech model that detects the end of speech. Scale from 0 to 100. + - name: 'noSpeechTimeout' + type: String + description: | + Timeout before detecting no speech. + A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s". + - name: 'useTimeoutBasedEndpointing' + type: Boolean + description: | + Use timeout based endpointing, interpreting endpointer sensitivy as seconds of timeout value. + - name: 'models' + type: KeyValuePairs + description: | + Mapping from language to Speech-to-Text model. The mapped Speech-to-Text model will be selected for requests from its corresponding language. For more information, see [Speech models](https://cloud.google.com/dialogflow/cx/docs/concept/speech-models). + An object containing a list of **"key": value** pairs. Example: **{ "name": "wrench", "mass": "1.3kg", "count": "3" }**. - name: 'dtmfSettings' type: NestedObject description: | @@ -159,6 +191,26 @@ properties: type: String description: | The digit that terminates a DTMF digit sequence. + - name: 'loggingSettings' + type: NestedObject + # Due to inconsistent API behaviour http://b/303056144, ignore read can be removed once fixed + ignore_read: true + description: | + Settings for logging. Settings for Dialogflow History, Contact Center messages, StackDriver logs, and speech logging. Exposed at the following levels: + * Agent level + properties: + - name: 'enableStackdriverLogging' + type: Boolean + description: | + Enables Google Cloud Logging. + - name: 'enableInteractionLogging' + type: Boolean + description: | + Enables DF Interaction logging. + - name: 'enableConsentBasedRedaction' + type: Boolean + description: | + Enables consent-based end-user input redaction, if true, a pre-defined session parameter **$session.params.conversation-redaction** will be used to determine if the utterance should be redacted. - name: 'gitIntegrationSettings' type: NestedObject description: | diff --git a/mmv1/products/dialogflowcx/Flow.yaml b/mmv1/products/dialogflowcx/Flow.yaml index 22c11a4ac68b..c08b57be66bf 100644 --- a/mmv1/products/dialogflowcx/Flow.yaml +++ b/mmv1/products/dialogflowcx/Flow.yaml @@ -42,6 +42,8 @@ examples: primary_resource_id: 'basic_flow' vars: agent_name: 'dialogflowcx-agent' + ignore_read_extra: + - 'advanced_settings.0.logging_settings' - name: 'dialogflowcx_flow_full' primary_resource_id: 'basic_flow' vars: @@ -564,6 +566,33 @@ properties: description: | The Google Cloud Storage URI for the exported objects. Whether a full object name, or just a prefix, its usage depends on the Dialogflow operation. Format: gs://bucket/object-name-or-prefix + - name: 'speechSettings' + type: NestedObject + description: | + Settings for speech to text detection. Exposed at the following levels: + * Agent level + * Flow level + * Page level + * Parameter level + properties: + - name: 'endpointerSensitivity' + type: Integer + description: | + Sensitivity of the speech model that detects the end of speech. Scale from 0 to 100. + - name: 'noSpeechTimeout' + type: String + description: | + Timeout before detecting no speech. + A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s". + - name: 'useTimeoutBasedEndpointing' + type: Boolean + description: | + Use timeout based endpointing, interpreting endpointer sensitivy as seconds of timeout value. + - name: 'models' + type: KeyValuePairs + description: | + Mapping from language to Speech-to-Text model. The mapped Speech-to-Text model will be selected for requests from its corresponding language. For more information, see [Speech models](https://cloud.google.com/dialogflow/cx/docs/concept/speech-models). + An object containing a list of **"key": value** pairs. Example: **{ "name": "wrench", "mass": "1.3kg", "count": "3" }**. - name: 'dtmfSettings' type: NestedObject description: | @@ -585,3 +614,23 @@ properties: type: String description: | The digit that terminates a DTMF digit sequence. + - name: 'loggingSettings' + type: NestedObject + ignore_read: true + # Ignore read as API does not return loggingSettings back, only accepts in the /create/update API call + description: | + Settings for logging. Settings for Dialogflow History, Contact Center messages, StackDriver logs, and speech logging. Exposed at the following levels: + * Agent level + properties: + - name: 'enableStackdriverLogging' + type: Boolean + description: | + Enables Google Cloud Logging. + - name: 'enableInteractionLogging' + type: Boolean + description: | + Enables DF Interaction logging. + - name: 'enableConsentBasedRedaction' + type: Boolean + description: | + Enables consent-based end-user input redaction, if true, a pre-defined session parameter **$session.params.conversation-redaction** will be used to determine if the utterance should be redacted. diff --git a/mmv1/templates/terraform/examples/dialogflowcx_agent_full.tf.tmpl b/mmv1/templates/terraform/examples/dialogflowcx_agent_full.tf.tmpl index c58d83218701..4e76cd8876e5 100644 --- a/mmv1/templates/terraform/examples/dialogflowcx_agent_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflowcx_agent_full.tf.tmpl @@ -21,11 +21,26 @@ resource "google_dialogflow_cx_agent" "{{$.PrimaryResourceId}}" { audio_export_gcs_destination { uri = "${google_storage_bucket.bucket.url}/prefix-" } + speech_settings { + endpointer_sensitivity = 30 + no_speech_timeout = "3.500s" + use_timeout_based_endpointing = true + models = { + name : "wrench" + mass : "1.3kg" + count : "3" + } + } dtmf_settings { - enabled = true - max_digits = 1 + enabled = true + max_digits = 1 finish_digit = "#" } + logging_settings { + enable_stackdriver_logging = true + enable_interaction_logging = true + enable_consent_based_redaction = true + } } git_integration_settings { github_settings { diff --git a/mmv1/templates/terraform/examples/dialogflowcx_flow_full.tf.tmpl b/mmv1/templates/terraform/examples/dialogflowcx_flow_full.tf.tmpl index 0ed8216c4812..774be2521980 100644 --- a/mmv1/templates/terraform/examples/dialogflowcx_flow_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dialogflowcx_flow_full.tf.tmpl @@ -273,10 +273,25 @@ resource "google_dialogflow_cx_flow" "{{$.PrimaryResourceId}}" { audio_export_gcs_destination { uri = "${google_storage_bucket.bucket.url}/prefix-" } + speech_settings { + endpointer_sensitivity = 30 + no_speech_timeout = "3.500s" + use_timeout_based_endpointing = true + models = { + name : "wrench" + mass : "1.3kg" + count : "3" + } + } dtmf_settings { enabled = true max_digits = 1 finish_digit = "#" } + logging_settings { + enable_stackdriver_logging = true + enable_interaction_logging = true + enable_consent_based_redaction = true + } } -} \ No newline at end of file +} diff --git a/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_agent_test.go.tmpl b/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_agent_test.go.tmpl index d6d7f1b16f17..9e4965209503 100644 --- a/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_agent_test.go.tmpl +++ b/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_agent_test.go.tmpl @@ -29,7 +29,7 @@ func TestAccDialogflowCXAgent_update(t *testing.T) { ResourceName: "google_dialogflow_cx_agent.foobar", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"git_integration_settings.0.github_settings.0.access_token"}, + ImportStateVerifyIgnore: []string{"git_integration_settings.0.github_settings.0.access_token", "enable_stackdriver_logging", "advanced_settings.0.logging_settings"}, }, { Config: testAccDialogflowCXAgent_full(context), @@ -38,7 +38,7 @@ func TestAccDialogflowCXAgent_update(t *testing.T) { ResourceName: "google_dialogflow_cx_agent.foobar", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"git_integration_settings.0.github_settings.0.access_token"}, + ImportStateVerifyIgnore: []string{"git_integration_settings.0.github_settings.0.access_token", "enable_stackdriver_logging", "advanced_settings.0.logging_settings"}, }, { Config: testAccDialogflowCXAgent_removeSettings(context), @@ -47,7 +47,7 @@ func TestAccDialogflowCXAgent_update(t *testing.T) { ResourceName: "google_dialogflow_cx_agent.foobar", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"git_integration_settings.0.github_settings.0.access_token"}, + ImportStateVerifyIgnore: []string{"git_integration_settings.0.github_settings.0.access_token", "enable_stackdriver_logging", "advanced_settings.0.logging_settings"}, }, }, }) @@ -92,11 +92,26 @@ func testAccDialogflowCXAgent_full(context map[string]interface{}) string { audio_export_gcs_destination { uri = "${google_storage_bucket.bucket.url}/prefix-" } + speech_settings { + endpointer_sensitivity = 30 + no_speech_timeout = "3.500s" + use_timeout_based_endpointing = true + models = { + name : "wrench" + mass : "1.3kg" + count : "3" + } + } dtmf_settings { - enabled = true - max_digits = 1 + enabled = true + max_digits = 1 finish_digit = "#" } + logging_settings { + enable_stackdriver_logging = true + enable_interaction_logging = true + enable_consent_based_redaction = true + } } git_integration_settings { github_settings { diff --git a/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_flow_test.go b/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_flow_test.go index e4a7b516aa15..b3745305614e 100644 --- a/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_flow_test.go +++ b/mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflowcx_flow_test.go @@ -25,17 +25,19 @@ func TestAccDialogflowCXFlow_update(t *testing.T) { Config: testAccDialogflowCXFlow_basic(context), }, { - ResourceName: "google_dialogflow_cx_flow.my_flow", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_dialogflow_cx_flow.my_flow", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"advanced_settings.0.logging_settings"}, }, { Config: testAccDialogflowCXFlow_full(context), }, { - ResourceName: "google_dialogflow_cx_flow.my_flow", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_dialogflow_cx_flow.my_flow", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"advanced_settings.0.logging_settings"}, }, }, }) @@ -341,11 +343,26 @@ func testAccDialogflowCXFlow_full(context map[string]interface{}) string { audio_export_gcs_destination { uri = "${google_storage_bucket.bucket.url}/prefix-" } + speech_settings { + endpointer_sensitivity = 30 + no_speech_timeout = "3.500s" + use_timeout_based_endpointing = true + models = { + name : "wrench" + mass : "1.3kg" + count : "3" + } + } dtmf_settings { enabled = true max_digits = 1 finish_digit = "#" } + logging_settings { + enable_stackdriver_logging = true + enable_interaction_logging = true + enable_consent_based_redaction = true + } } } `, context)