diff --git a/mmv1/products/discoveryengine/DataStore.yaml b/mmv1/products/discoveryengine/DataStore.yaml new file mode 100644 index 000000000000..fad7d3e84d21 --- /dev/null +++ b/mmv1/products/discoveryengine/DataStore.yaml @@ -0,0 +1,147 @@ +# 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/v1/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: + - !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. The value can + only be one of "global", "us" and "eu". + - !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 + - !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 diff --git a/mmv1/products/discoveryengine/product.yaml b/mmv1/products/discoveryengine/product.yaml new file mode 100644 index 000000000000..28a7a8b6715e --- /dev/null +++ b/mmv1/products/discoveryengine/product.yaml @@ -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://{{location}}-discoveryengine.googleapis.com/v1/ +scopes: + - https://www.googleapis.com/auth/cloud-platform diff --git a/mmv1/templates/terraform/examples/discoveryengine_datastore_basic.tf.erb b/mmv1/templates/terraform/examples/discoveryengine_datastore_basic.tf.erb new file mode 100644 index 000000000000..f69c1fdd320c --- /dev/null +++ b/mmv1/templates/terraform/examples/discoveryengine_datastore_basic.tf.erb @@ -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 +} \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/discoveryengine/resource_discovery_engine_data_store_test.go b/mmv1/third_party/terraform/services/discoveryengine/resource_discovery_engine_data_store_test.go new file mode 100644 index 000000000000..fc324b9f601d --- /dev/null +++ b/mmv1/third_party/terraform/services/discoveryengine/resource_discovery_engine_data_store_test.go @@ -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) +}