-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Discovery Engine Data Store #9682
Changes from all commits
55ef153
c9928b9
d090272
6e0aeff
58ae514
45b5215
0741fa4
db93751
3aa31ee
005dd1d
451b7a1
5a3cdef
c730698
55c3d08
4c59446
f400ae3
e629831
3a73249
c6ec24b
e3b0ac8
75a7abc
f605bac
a7e591f
a6f6f17
fb879e9
0ecd750
7ac2058
e28ad41
14535d0
5196ef6
d854bbb
8158dd2
d4172eb
2236077
7bf6eb0
765cdc9
dae1f9e
fb5c292
24dd57c
c0b90d7
f6b6309
65587d0
c78f8d6
f573a23
ae510b1
2b29bde
c26aa6b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
# Copyright 2023 Google Inc. | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
--- !ruby/object:Api::Resource | ||
name: 'DataStore' | ||
description: | | ||
Data store is a collection of websites and documents used to find answers for | ||
end-user's questions in Discovery Engine (a.k.a. Vertex AI Search and | ||
Conversation). | ||
references: !ruby/object:Api::Resource::ReferenceLinks | ||
guides: | ||
'Create a search data store': 'https://cloud.google.com/generative-ai-app-builder/docs/create-data-store-es' | ||
api: 'https://cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1alpha/projects.locations.collections.dataStores' | ||
|
||
base_url: 'projects/{{project}}/locations/{{location}}/collections/default_collection/dataStores' | ||
self_link: 'projects/{{project}}/locations/{{location}}/collections/default_collection/dataStores/{{data_store_id}}' | ||
create_url: 'projects/{{project}}/locations/{{location}}/collections/default_collection/dataStores?dataStoreId={{data_store_id}}&createAdvancedSiteSearch={{create_advanced_site_search}}' | ||
update_verb: :PATCH | ||
update_mask: true | ||
delete_url: 'projects/{{project}}/locations/{{location}}/collections/default_collection/dataStores/{{data_store_id}}' | ||
import_format: | ||
[ | ||
'projects/{{project}}/locations/{{location}}/collections/default_collection/dataStores/{{data_store_id}}', | ||
] | ||
|
||
autogen_async: true | ||
async: !ruby/object:Api::OpAsync | ||
operation: !ruby/object:Api::OpAsync::Operation | ||
path: "name" | ||
base_url: "{{op_id}}" | ||
wait_ms: 1000 | ||
timeouts: !ruby/object:Api::Timeouts | ||
insert_minutes: 60 | ||
update_minutes: 60 | ||
delete_minutes: 60 | ||
result: !ruby/object:Api::OpAsync::Result | ||
path: "response" | ||
status: !ruby/object:Api::OpAsync::Status | ||
path: "done" | ||
complete: true | ||
allowed: | ||
- true | ||
- false | ||
error: !ruby/object:Api::OpAsync::Error | ||
path: "error" | ||
message: "message" | ||
|
||
examples: | ||
roaks3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- !ruby/object:Provider::Terraform::Examples | ||
name: "discoveryengine_datastore_basic" | ||
primary_resource_id: 'basic' | ||
primary_resource_name: | ||
'fmt.Sprintf("tf_test_data_store%s", context["random_suffix"])' | ||
vars: | ||
data_store_id: "data-store-id" | ||
parameters: | ||
- !ruby/object:Api::Type::String | ||
name: 'location' | ||
required: true | ||
immutable: true | ||
url_param_only: true | ||
description: | | ||
The geographic location where the data store should reside. | ||
- !ruby/object:Api::Type::String | ||
name: 'dataStoreId' | ||
required: true | ||
immutable: true | ||
url_param_only: true | ||
description: | | ||
The unique id of the data store. | ||
- !ruby/object:Api::Type::Boolean | ||
name: 'createAdvancedSiteSearch' | ||
default_value: false | ||
url_param_only: true | ||
description: | | ||
If true, an advanced data store for site search will be created. If the | ||
data store is not configured as site search (GENERIC vertical and | ||
PUBLIC_WEBSITE contentConfig), this flag will be ignored. | ||
|
||
properties: | ||
- !ruby/object:Api::Type::String | ||
name: 'name' | ||
description: | | ||
The unique full resource name of the data store. Values are of the format | ||
`projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`. | ||
This field must be a UTF-8 encoded string with a length limit of 1024 | ||
characters. | ||
output: true | ||
- !ruby/object:Api::Type::String | ||
name: 'displayName' | ||
description: | | ||
The display name of the data store. This field must be a UTF-8 encoded | ||
string with a length limit of 128 characters. | ||
required: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just checking, but I'm a little surprised the user is required to provide both a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, we need both.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting, ok, makes sense! |
||
- !ruby/object:Api::Type::Enum | ||
name: 'industryVertical' | ||
description: | | ||
The industry vertical that the data store registers. | ||
values: | ||
- :GENERIC | ||
- :MEDIA | ||
immutable: true | ||
required: true | ||
- !ruby/object:Api::Type::Array | ||
name: 'solutionTypes' | ||
description: | | ||
The solutions that the data store enrolls. | ||
item_type: !ruby/object:Api::Type::Enum | ||
name: 'solutionType' | ||
description: | | ||
The type of solution. | ||
values: | ||
- :SOLUTION_TYPE_RECOMMENDATION | ||
- :SOLUTION_TYPE_SEARCH | ||
- :SOLUTION_TYPE_CHAT | ||
immutable: true | ||
- !ruby/object:Api::Type::String | ||
name: 'defaultSchemaId' | ||
description: | | ||
The id of the default Schema associated with this data store. | ||
output: true | ||
- !ruby/object:Api::Type::Enum | ||
name: 'contentConfig' | ||
description: | | ||
The content config of the data store. | ||
values: | ||
- :NO_CONTENT | ||
- :CONTENT_REQUIRED | ||
- :PUBLIC_WEBSITE | ||
immutable: true | ||
required: true | ||
- !ruby/object:Api::Type::Time | ||
name: "createTime" | ||
description: | | ||
Timestamp when the DataStore was created. | ||
output: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright 2023 Google Inc. | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
--- !ruby/object:Api::Product | ||
name: DiscoveryEngine | ||
display_name: Discovery Engine | ||
versions: | ||
- !ruby/object:Api::Product::Version | ||
name: ga | ||
base_url: https://discoveryengine.googleapis.com/v1alpha/ | ||
scopes: | ||
- https://www.googleapis.com/auth/cloud-platform |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
resource "google_discovery_engine_data_store" "basic" { | ||
location = "global" | ||
data_store_id = "<%= ctx[:vars]['data_store_id'] %>" | ||
display_name = "tf-test-structured-datastore" | ||
industry_vertical = "GENERIC" | ||
content_config = "NO_CONTENT" | ||
solution_types = ["SOLUTION_TYPE_SEARCH"] | ||
create_advanced_site_search = false | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package discoveryengine_test | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
"github.com/hashicorp/terraform-provider-google/google/acctest" | ||
"testing" | ||
) | ||
|
||
func TestAccDiscoveryEngineDataStore_discoveryengineDatastoreBasicExample_update(t *testing.T) { | ||
t.Parallel() | ||
|
||
context := map[string]interface{}{ | ||
"random_suffix": acctest.RandString(t, 10), | ||
} | ||
|
||
acctest.VcrTest(t, resource.TestCase{ | ||
PreCheck: func() { acctest.AccTestPreCheck(t) }, | ||
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), | ||
CheckDestroy: testAccCheckDiscoveryEngineDataStoreDestroyProducer(t), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccDiscoveryEngineDataStore_discoveryengineDatastoreBasicExample_basic(context), | ||
}, | ||
{ | ||
ResourceName: "google_discovery_engine_data_store.basic", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"location", "data_store_id", "create_advanced_site_search"}, | ||
}, | ||
{ | ||
Config: testAccDiscoveryEngineDataStore_discoveryengineDatastoreBasicExample_update(context), | ||
}, | ||
{ | ||
ResourceName: "google_discovery_engine_data_store.basic", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"location", "data_store_id", "create_advanced_site_search"}, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccDiscoveryEngineDataStore_discoveryengineDatastoreBasicExample_basic(context map[string]interface{}) string { | ||
return acctest.Nprintf(` | ||
resource "google_discovery_engine_data_store" "basic" { | ||
location = "global" | ||
data_store_id = "tf-test-data-store-id%{random_suffix}" | ||
display_name = "tf-test-structured-datastore" | ||
industry_vertical = "GENERIC" | ||
content_config = "NO_CONTENT" | ||
} | ||
`, context) | ||
} | ||
|
||
func testAccDiscoveryEngineDataStore_discoveryengineDatastoreBasicExample_update(context map[string]interface{}) string { | ||
return acctest.Nprintf(` | ||
resource "google_discovery_engine_data_store" "basic" { | ||
location = "global" | ||
data_store_id = "tf-test-data-store-id%{random_suffix}" | ||
display_name = "updated-tf-test-structured-datastore" | ||
industry_vertical = "GENERIC" | ||
content_config = "NO_CONTENT" | ||
solution_types = ["SOLUTION_TYPE_SEARCH"] | ||
create_advanced_site_search = false | ||
} | ||
`, context) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jialei-chen , I think the
base_url
should beThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @5fff, thanks. As for this error
I fixed it by adding import formats explicitly to the resource with the
{{data_store_id}}
variable