Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added dialogflow_agent_to_link field to the google_discovery_engine_chat_engine resource #11889

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions mmv1/products/discoveryengine/ChatEngine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ examples:
engine_id: 'chat-engine-id'
data_store_id: 'data-store'
data_store_2_id: 'data-store-2'
- name: 'discoveryengine_chat_engine_existing_dialogflow_agent'
primary_resource_id: 'primary'
vars:
engine_id: 'chat-engine-id'
data_store_id: 'data-store'
parameters:
- name: 'engineId'
type: String
Expand Down Expand Up @@ -99,7 +104,6 @@ properties:
description: |
The data stores associated with this engine. Multiple DataStores in the same Collection can be associated here. All listed DataStores must be `SOLUTION_TYPE_CHAT`. Adding or removing data stores will force recreation.
required: true
immutable: true
item_type:
type: String
min_size: 1
Expand All @@ -125,7 +129,12 @@ properties:
type: NestedObject
description: |
The configuration to generate the Dialogflow agent that is associated to this Engine.
required: true
Exactly one of `agent_creation_config` or `dialogflow_agent_to_link` must be set.
immutable: true
ignore_read: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we adding ignore_read to this one here? Did it not correctly read before?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignore_read is set on the parent field here


So I decided to repeat it for both nested fields to have it set more explicit in the code, but you are right, it can be removed since parent field has it set already

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the context

exactly_one_of:
- 'chat_engine_config.0.agent_creation_config'
- 'chat_engine_config.0.dialogflow_agent_to_link'
properties:
- name: 'business'
type: String
Expand All @@ -145,6 +154,18 @@ properties:
type: String
description: |
Agent location for Agent creation, currently supported values: global/us/eu, it needs to be the same region as the Chat Engine.
- name: 'dialogflowAgentToLink'
type: String
description: |
The resource name of an existing Dialogflow agent to link to this Chat Engine. Format: `projects/<Project_ID>/locations/<Location_ID>/agents/<Agent_ID>`.
Exactly one of `agent_creation_config` or `dialogflow_agent_to_link` must be set.
immutable: true
ignore_read: true
validation:
regex: '^projects\/[a-zA-Z0-9-]+(?:\/locations\/[a-zA-Z0-9-]+)?\/agents\/[a-zA-Z0-9-]+$'
exactly_one_of:
- 'chat_engine_config.0.agent_creation_config'
- 'chat_engine_config.0.dialogflow_agent_to_link'
- name: 'commonConfig'
type: NestedObject
description: |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
resource "google_discovery_engine_data_store" "test_data_store" {
location = "global"
data_store_id = "{{index $.Vars "data_store_id"}}"
display_name = "Structured datastore"
industry_vertical = "GENERIC"
content_config = "NO_CONTENT"
solution_types = ["SOLUTION_TYPE_CHAT"]
}

resource "google_dialogflow_cx_agent" "agent" {
display_name = "dialogflowcx-agent"
location = "global"
default_language_code = "en"
time_zone = "America/Los_Angeles"
}

resource "google_discovery_engine_chat_engine" "primary" {
engine_id = "{{index $.Vars "engine_id"}}"
collection_id = "default_collection"
location = google_discovery_engine_data_store.test_data_store.location
display_name = "Chat engine"
industry_vertical = "GENERIC"
data_store_ids = [google_discovery_engine_data_store.test_data_store.data_store_id]
common_config {
company_name = "test-company"
}
chat_engine_config {
dialogflow_agent_to_link = google_dialogflow_cx_agent.agent.id
}
}
Loading