From a058dc30119ede791b7258e8d6c398fd8c0cb375 Mon Sep 17 00:00:00 2001 From: purvii-n <120627798+purvii-n@users.noreply.github.com> Date: Fri, 28 Jul 2023 21:52:43 +0530 Subject: [PATCH] adding location and doc schema (#8371) * adding location and doc schema * added copyright * resolved required field, url_param_only field, description, autogen_async, async in Location * resolved required field, url_param_only field, description, autogen_async, async in Location * resolved hardcoded location, few fields in location, removed unnecessary enum values * resolved project_number, added fields in location example * DocumentSchema final changes * added timeouts in Location * adding missing fields from test report * added DocumentSchema tests * removed required field from processorType * changed dummy_values * removed fields under properties * added new line * added enum tests * separated tests into separate files * made Document Schema immutable --- .../documentaiwarehouse/DocumentSchema.yaml | 346 ++++++++++++++++++ .../documentaiwarehouse/Location.yaml | 104 ++++++ .../products/documentaiwarehouse/product.yaml | 26 ++ ...cument_ai_warehouse_document_schema.go.erb | 17 + ..._warehouse_document_schema_datetime.tf.erb | 24 ++ ...t_ai_warehouse_document_schema_enum.tf.erb | 31 ++ ..._ai_warehouse_document_schema_float.tf.erb | 23 ++ ...i_warehouse_document_schema_integer.tf.erb | 24 ++ ...nt_ai_warehouse_document_schema_map.tf.erb | 24 ++ ..._warehouse_document_schema_property.tf.erb | 41 +++ ...house_document_schema_property_enum.tf.erb | 48 +++ ...t_ai_warehouse_document_schema_text.tf.erb | 25 ++ ...warehouse_document_schema_timestamp.tf.erb | 24 ++ .../document_ai_warehouse_location.tf.erb | 11 + 14 files changed, 768 insertions(+) create mode 100644 mmv1/products/documentaiwarehouse/DocumentSchema.yaml create mode 100644 mmv1/products/documentaiwarehouse/Location.yaml create mode 100644 mmv1/products/documentaiwarehouse/product.yaml create mode 100644 mmv1/templates/terraform/custom_import/document_ai_warehouse_document_schema.go.erb create mode 100644 mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_datetime.tf.erb create mode 100644 mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_enum.tf.erb create mode 100644 mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_float.tf.erb create mode 100644 mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_integer.tf.erb create mode 100644 mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_map.tf.erb create mode 100644 mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_property.tf.erb create mode 100644 mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_property_enum.tf.erb create mode 100644 mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_text.tf.erb create mode 100644 mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_timestamp.tf.erb create mode 100644 mmv1/templates/terraform/examples/document_ai_warehouse_location.tf.erb diff --git a/mmv1/products/documentaiwarehouse/DocumentSchema.yaml b/mmv1/products/documentaiwarehouse/DocumentSchema.yaml new file mode 100644 index 000000000000..9c8746f6b72e --- /dev/null +++ b/mmv1/products/documentaiwarehouse/DocumentSchema.yaml @@ -0,0 +1,346 @@ +# 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: 'DocumentSchema' +base_url: 'projects/{{project_number}}/locations/{{location}}/documentSchemas' +self_link: '{{name}}' +delete_url: '{{name}}' +immutable: true +references: !ruby/object:Api::Resource::ReferenceLinks + guides: + 'Official Documentation': 'https://cloud.google.com/document-warehouse/docs/manage-document-schemas' + api: 'https://cloud.google.com/document-warehouse/docs/reference/rest/v1/projects.locations.documentSchemas' +description: | + A document schema is used to define document structure. +custom_code: !ruby/object:Provider::Terraform::CustomCode + custom_import: templates/terraform/custom_import/document_ai_warehouse_document_schema.go.erb +examples: + - !ruby/object:Provider::Terraform::Examples + name: "document_ai_warehouse_document_schema_text" + primary_resource_id: "example_text" + vars: + document_schema_name: "schema-name-text" + - !ruby/object:Provider::Terraform::Examples + name: "document_ai_warehouse_document_schema_integer" + primary_resource_id: "example_integer" + vars: + document_schema_name: "schema-name-integer" + - !ruby/object:Provider::Terraform::Examples + name: "document_ai_warehouse_document_schema_float" + primary_resource_id: "example_float" + vars: + document_schema_name: "schema-name-float" + - !ruby/object:Provider::Terraform::Examples + name: "document_ai_warehouse_document_schema_property" + primary_resource_id: "example_property" + vars: + document_schema_name: "schema-name-property" + - !ruby/object:Provider::Terraform::Examples + name: "document_ai_warehouse_document_schema_property_enum" + primary_resource_id: "example_property_enum" + vars: + document_schema_name: "schema-name-property-enum" + - !ruby/object:Provider::Terraform::Examples + name: "document_ai_warehouse_document_schema_enum" + primary_resource_id: "example_enum" + vars: + document_schema_name: "schema-name-enum" + - !ruby/object:Provider::Terraform::Examples + name: "document_ai_warehouse_document_schema_map" + primary_resource_id: "example_map" + vars: + document_schema_name: "schema-name-map" + - !ruby/object:Provider::Terraform::Examples + name: "document_ai_warehouse_document_schema_datetime" + primary_resource_id: "example_datetime" + vars: + document_schema_name: "schema-name-datetime" + - !ruby/object:Provider::Terraform::Examples + name: "document_ai_warehouse_document_schema_timestamp" + primary_resource_id: "example_timestamp" + vars: + document_schema_name: "schema-name-timestamp" +parameters: + - !ruby/object:Api::Type::String + name: 'project_number' + url_param_only: true + required: true + immutable: true + description: | + The unique identifier of the project. + - !ruby/object:Api::Type::String + name: 'location' + url_param_only: true + immutable: true + required: true + description: | + The location of the resource. +properties: + - !ruby/object:Api::Type::String + name: 'name' + output: true + description: | + The resource name of the document schema. + - !ruby/object:Api::Type::String + name: 'displayName' + required: true + description: | + Name of the schema given by the user. + - !ruby/object:Api::Type::Boolean + name: 'documentIsFolder' + description: | + Tells whether the document is a folder or a typical document. + - !ruby/object:Api::Type::Array + name: 'propertyDefinitions' + description: | + Defines the metadata for a schema property. + required: true + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: 'name' + required: true + description: | + The name of the metadata property. + - !ruby/object:Api::Type::String + name: 'displayName' + description: | + The display-name for the property, used for front-end. + - !ruby/object:Api::Type::Boolean + name: 'isRepeatable' + description: | + Whether the property can have multiple values. + - !ruby/object:Api::Type::Boolean + name: 'isFilterable' + description: | + Whether the property can be filtered. If this is a sub-property, all the parent properties must be marked filterable. + - !ruby/object:Api::Type::Boolean + name: 'isSearchable' + description: | + Indicates that the property should be included in a global search. + - !ruby/object:Api::Type::Boolean + name: 'isMetadata' + description: | + Whether the property is user supplied metadata. + - !ruby/object:Api::Type::Boolean + name: 'isRequired' + description: | + Whether the property is mandatory. + - !ruby/object:Api::Type::Enum + name: 'retrievalImportance' + description: | + Stores the retrieval importance. + values: + - :HIGHEST + - :HIGHER + - :HIGH + - :MEDIUM + - :LOW + - :LOWEST + - !ruby/object:Api::Type::Array + name: 'schemaSources' + description: | + The schema source information. + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: 'name' + description: | + The schema name in the source. + - !ruby/object:Api::Type::String + name: 'processorType' + description: | + The Doc AI processor type name. + # select any one of the property types (integer, float, text, property, enum, dateTime, map, timestamp) + - !ruby/object:Api::Type::NestedObject + name: 'integerTypeOptions' + description: | + Integer property. + send_empty_value: true + allow_empty_object: true + properties: [] + - !ruby/object:Api::Type::NestedObject + name: 'floatTypeOptions' + description: | + Float property. + send_empty_value: true + allow_empty_object: true + properties: [] + - !ruby/object:Api::Type::NestedObject + name: 'textTypeOptions' + description: | + Text/string property. + send_empty_value: true + allow_empty_object: true + properties: [] + - !ruby/object:Api::Type::NestedObject + name: 'propertyTypeOptions' + description: | + Nested structured data property. + properties: + - !ruby/object:Api::Type::Array + name: 'propertyDefinitions' + description: | + Defines the metadata for a schema property. + required: true + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: 'name' + required: true + description: | + The name of the metadata property. + - !ruby/object:Api::Type::String + name: 'displayName' + description: | + The display-name for the property, used for front-end. + - !ruby/object:Api::Type::Boolean + name: 'isRepeatable' + description: | + Whether the property can have multiple values. + - !ruby/object:Api::Type::Boolean + name: 'isFilterable' + description: | + Whether the property can be filtered. If this is a sub-property, all the parent properties must be marked filterable. + - !ruby/object:Api::Type::Boolean + name: 'isSearchable' + description: | + Indicates that the property should be included in a global search. + - !ruby/object:Api::Type::Boolean + name: 'isMetadata' + description: | + Whether the property is user supplied metadata. + - !ruby/object:Api::Type::Boolean + name: 'isRequired' + description: | + Whether the property is mandatory. + - !ruby/object:Api::Type::Enum + name: 'retrievalImportance' + description: | + Stores the retrieval importance. + values: + - :HIGHEST + - :HIGHER + - :HIGH + - :MEDIUM + - :LOW + - :LOWEST + - !ruby/object:Api::Type::Array + name: 'schemaSources' + description: | + The schema source information. + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: 'name' + description: | + The schema name in the source. + - !ruby/object:Api::Type::String + name: 'processorType' + description: | + The Doc AI processor type name. + - !ruby/object:Api::Type::NestedObject + name: 'integerTypeOptions' + description: | + Integer property. + send_empty_value: true + allow_empty_object: true + properties: [] + - !ruby/object:Api::Type::NestedObject + name: 'floatTypeOptions' + description: | + Float property. + send_empty_value: true + allow_empty_object: true + properties: [] + - !ruby/object:Api::Type::NestedObject + name: 'textTypeOptions' + description: | + Text property. + send_empty_value: true + allow_empty_object: true + properties: [] + - !ruby/object:Api::Type::NestedObject + name: 'enumTypeOptions' + description: | + Enum/categorical property. + properties: + - !ruby/object:Api::Type::Array + name: 'possibleValues' + required: true + description: | + List of possible enum values. + item_type: Api::Type::String + - !ruby/object:Api::Type::Boolean + name: 'validationCheckDisabled' + description: | + Make sure the enum property value provided in the document is in the possile value list during document creation. The validation check runs by default. + - !ruby/object:Api::Type::NestedObject + name: 'dateTimeTypeOptions' + description: | + Date time property. Not supported by CMEK compliant deployment. + send_empty_value: true + allow_empty_object: true + properties: [] + - !ruby/object:Api::Type::NestedObject + name: 'mapTypeOptions' + description: | + Map property. + send_empty_value: true + allow_empty_object: true + properties: [] + - !ruby/object:Api::Type::NestedObject + name: 'timestampTypeOptions' + description: | + Timestamp property. Not supported by CMEK compliant deployment. + send_empty_value: true + allow_empty_object: true + properties: [] + - !ruby/object:Api::Type::NestedObject + name: 'enumTypeOptions' + description: | + Enum/categorical property. + properties: + - !ruby/object:Api::Type::Array + name: 'possibleValues' + required: true + description: | + List of possible enum values. + item_type: Api::Type::String + - !ruby/object:Api::Type::Boolean + name: 'validationCheckDisabled' + description: | + Make sure the enum property value provided in the document is in the possile value list during document creation. The validation check runs by default. + - !ruby/object:Api::Type::NestedObject + name: 'dateTimeTypeOptions' + description: | + Date time property. Not supported by CMEK compliant deployment. + send_empty_value: true + allow_empty_object: true + properties: [] + - !ruby/object:Api::Type::NestedObject + name: 'mapTypeOptions' + description: | + Map property. + send_empty_value: true + allow_empty_object: true + properties: [] + - !ruby/object:Api::Type::NestedObject + name: 'timestampTypeOptions' + description: | + Timestamp property. Not supported by CMEK compliant deployment. + send_empty_value: true + allow_empty_object: true + properties: [] + diff --git a/mmv1/products/documentaiwarehouse/Location.yaml b/mmv1/products/documentaiwarehouse/Location.yaml new file mode 100644 index 000000000000..cbf1a999e150 --- /dev/null +++ b/mmv1/products/documentaiwarehouse/Location.yaml @@ -0,0 +1,104 @@ +# 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: 'Location' +base_url: 'projects/{{project_number}}/locations/{{location}}:initialize' +references: !ruby/object:Api::Resource::ReferenceLinks + guides: + 'Official Documentation': 'https://cloud.google.com/document-warehouse/docs/overview' + api: 'https://cloud.google.com/document-warehouse/docs/reference/rest/v1/projects.locations' +description: | + A location is used to initialize a project. +id_format: 'projects/{{project_number}}/locations/{{location}}' +autogen_async: true +async: !ruby/object:Api::OpAsync + actions: ['create'] + operation: !ruby/object:Api::OpAsync::Operation + path: 'name' + base_url: '{{op_id}}' + wait_ms: + 1000 + result: !ruby/object:Api::OpAsync::Result + path: 'response' + resource_inside_response: true + status: !ruby/object:Api::OpAsync::Status + path: 'done' + complete: true + allowed: + - true + - false + error: !ruby/object:Api::OpAsync::Error + path: 'error' + message: 'message' +immutable: true +skip_read: true +skip_delete: true +skip_sweeper: true +exclude_import: true +examples: + - !ruby/object:Provider::Terraform::Examples + name: "document_ai_warehouse_location" + primary_resource_id: "example" + skip_import_test: true +timeouts: !ruby/object:Api::Timeouts + insert_minutes: 30 + update_minutes: 30 + delete_minutes: 30 +parameters: + - !ruby/object:Api::Type::String + name: 'project_number' + url_param_only: true + required: true + description: | + The unique identifier of the project. + - !ruby/object:Api::Type::String + name: 'location' + url_param_only: true + required: true + description: | + The location in which the instance is to be provisioned. It takes the form projects/{projectNumber}/locations/{location}. +properties: + - !ruby/object:Api::Type::Enum + name: 'databaseType' + description: | + The type of database used to store customer data. + required: true + values: + - :DB_INFRA_SPANNER + - :DB_CLOUD_SQL_POSTGRES + - !ruby/object:Api::Type::Enum + name: 'accessControlMode' + description: | + The access control mode for accessing the customer data. + required: true + values: + - :ACL_MODE_DOCUMENT_LEVEL_ACCESS_CONTROL_GCI + - :ACL_MODE_DOCUMENT_LEVEL_ACCESS_CONTROL_BYOID + - :ACL_MODE_UNIVERSAL_ACCESS + - !ruby/object:Api::Type::String + name: 'kmsKey' + description: | + The KMS key used for CMEK encryption. It is required that + the kms key is in the same region as the endpoint. The + same key will be used for all provisioned resources, if + encryption is available. If the kmsKey is left empty, no + encryption will be enforced. + - !ruby/object:Api::Type::Enum + name: 'documentCreatorDefaultRole' + description: | + The default role for the person who create a document. + values: + - :DOCUMENT_ADMIN + - :DOCUMENT_EDITOR + - :DOCUMENT_VIEWER \ No newline at end of file diff --git a/mmv1/products/documentaiwarehouse/product.yaml b/mmv1/products/documentaiwarehouse/product.yaml new file mode 100644 index 000000000000..5493a6660cb2 --- /dev/null +++ b/mmv1/products/documentaiwarehouse/product.yaml @@ -0,0 +1,26 @@ +# 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: DocumentAIWarehouse +display_name: Document AI Warehouse +versions: + - !ruby/object:Api::Product::Version + name: ga + base_url: https://contentwarehouse.googleapis.com/v1/ +scopes: + - https://www.googleapis.com/auth/cloud-platform +apis_required: + - !ruby/object:Api::Product::ApiReference + name: Document AI Warehouse API + url: https://console.cloud.google.com/apis/library/contentwarehouse.googleapis.com/ diff --git a/mmv1/templates/terraform/custom_import/document_ai_warehouse_document_schema.go.erb b/mmv1/templates/terraform/custom_import/document_ai_warehouse_document_schema.go.erb new file mode 100644 index 000000000000..f24c80976052 --- /dev/null +++ b/mmv1/templates/terraform/custom_import/document_ai_warehouse_document_schema.go.erb @@ -0,0 +1,17 @@ +config := meta.(*transport_tpg.Config) + +if err := tpgresource.ParseImportId([]string{ + "projects/(?P[^/]+)/locations/(?P[^/]+)/documentSchemas/(?P[^/]+)"}, d, config); err != nil { + return nil, err +} + +originalName := d.Get("name").(string) +originalLocation := d.Get("location").(string) +originalProject := d.Get("project_number").(string) +name := fmt.Sprintf("projects/%s/locations/%s/documentSchemas/%s", originalProject, originalLocation, originalName) + +if err := d.Set("name", name); err != nil { + return nil, fmt.Errorf("Error setting name: %s", err) +} +d.SetId(name) +return []*schema.ResourceData{d}, nil diff --git a/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_datetime.tf.erb b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_datetime.tf.erb new file mode 100644 index 000000000000..1e3e4f35b060 --- /dev/null +++ b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_datetime.tf.erb @@ -0,0 +1,24 @@ +resource "google_document_ai_warehouse_document_schema" "example_datetime" { + project_number = data.google_project.project.number + display_name = "test-property-date_time" + location = "us" + + property_definitions { + name = "prop7" + display_name = "propdisp7" + is_repeatable = false + is_filterable = true + is_searchable = true + is_metadata = false + is_required = false + retrieval_importance = "HIGHEST" + schema_sources { + name = "dummy_source" + processor_type = "dummy_processor" + } + date_time_type_options {} + } +} + +data "google_project" "project" { +} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_enum.tf.erb b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_enum.tf.erb new file mode 100644 index 000000000000..b763f2fad385 --- /dev/null +++ b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_enum.tf.erb @@ -0,0 +1,31 @@ +resource "google_document_ai_warehouse_document_schema" "example_enum" { + project_number = data.google_project.project.number + display_name = "test-property-enum" + location = "us" + + property_definitions { + name = "prop6" + display_name = "propdisp6" + is_repeatable = false + is_filterable = true + is_searchable = true + is_metadata = false + is_required = false + retrieval_importance = "HIGHEST" + schema_sources { + name = "dummy_source" + processor_type = "dummy_processor" + } + enum_type_options { + possible_values = [ + "M", + "F", + "X" + ] + validation_check_disabled = false + } + } +} + +data "google_project" "project" { +} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_float.tf.erb b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_float.tf.erb new file mode 100644 index 000000000000..96d30784152b --- /dev/null +++ b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_float.tf.erb @@ -0,0 +1,23 @@ +resource "google_document_ai_warehouse_document_schema" "example_float" { + project_number = data.google_project.project.number + display_name = "test-property-float" + location = "us" + + property_definitions { + name = "prop2" + display_name = "propdisp2" + is_repeatable = false + is_filterable = true + is_searchable = true + is_metadata = false + is_required = false + retrieval_importance = "HIGHEST" + schema_sources { + name = "dummy_source" + processor_type = "dummy_processor" + } + float_type_options {} + } +} +data "google_project" "project" { +} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_integer.tf.erb b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_integer.tf.erb new file mode 100644 index 000000000000..9c0ef30e6b4f --- /dev/null +++ b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_integer.tf.erb @@ -0,0 +1,24 @@ +resource "google_document_ai_warehouse_document_schema" "example_integer" { + project_number = data.google_project.project.number + display_name = "test-property-integer" + location = "us" + + property_definitions { + name = "prop1" + display_name = "propdisp1" + is_repeatable = false + is_filterable = true + is_searchable = true + is_metadata = false + is_required = false + retrieval_importance = "HIGHEST" + schema_sources { + name = "dummy_source" + processor_type = "dummy_processor" + } + integer_type_options {} + } +} + +data "google_project" "project" { +} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_map.tf.erb b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_map.tf.erb new file mode 100644 index 000000000000..11796b01b0e8 --- /dev/null +++ b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_map.tf.erb @@ -0,0 +1,24 @@ +resource "google_document_ai_warehouse_document_schema" "example_map" { + project_number = data.google_project.project.number + display_name = "test-property-map" + location = "us" + + property_definitions { + name = "prop4" + display_name = "propdisp4" + is_repeatable = false + is_filterable = true + is_searchable = true + is_metadata = false + is_required = false + retrieval_importance = "HIGHEST" + schema_sources { + name = "dummy_source" + processor_type = "dummy_processor" + } + map_type_options {} + } +} + +data "google_project" "project" { +} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_property.tf.erb b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_property.tf.erb new file mode 100644 index 000000000000..bd0ba6ee0976 --- /dev/null +++ b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_property.tf.erb @@ -0,0 +1,41 @@ +resource "google_document_ai_warehouse_document_schema" "example_property" { + project_number = data.google_project.project.number + display_name = "test-property-property" + location = "us" + document_is_folder = false + + property_definitions { + name = "prop8" + display_name = "propdisp8" + is_repeatable = false + is_filterable = true + is_searchable = true + is_metadata = false + is_required = false + retrieval_importance = "HIGHEST" + schema_sources { + name = "dummy_source" + processor_type = "dummy_processor" + } + property_type_options { + property_definitions { + name = "prop8_nested" + display_name = "propdisp8_nested" + is_repeatable = false + is_filterable = true + is_searchable = true + is_metadata = false + is_required = false + retrieval_importance = "HIGHEST" + schema_sources { + name = "dummy_source_nested" + processor_type = "dummy_processor_nested" + } + text_type_options {} + } + } + } +} + +data "google_project" "project" { +} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_property_enum.tf.erb b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_property_enum.tf.erb new file mode 100644 index 000000000000..19eb0553b6c7 --- /dev/null +++ b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_property_enum.tf.erb @@ -0,0 +1,48 @@ +resource "google_document_ai_warehouse_document_schema" "example_property_enum" { + project_number = data.google_project.project.number + display_name = "test-property-property" + location = "us" + document_is_folder = false + + property_definitions { + name = "prop8" + display_name = "propdisp8" + is_repeatable = false + is_filterable = true + is_searchable = true + is_metadata = false + is_required = false + retrieval_importance = "HIGHEST" + schema_sources { + name = "dummy_source" + processor_type = "dummy_processor" + } + property_type_options { + property_definitions { + name = "prop8_nested" + display_name = "propdisp8_nested" + is_repeatable = false + is_filterable = true + is_searchable = true + is_metadata = false + is_required = false + retrieval_importance = "HIGHEST" + schema_sources { + name = "dummy_source_nested" + processor_type = "dummy_processor_nested" + } + enum_type_options { + possible_values = [ + "M", + "F", + "X" + ] + validation_check_disabled = false + } + } + } + } +} + +data "google_project" "project" { +} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_text.tf.erb b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_text.tf.erb new file mode 100644 index 000000000000..d7f797fbe114 --- /dev/null +++ b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_text.tf.erb @@ -0,0 +1,25 @@ +resource "google_document_ai_warehouse_document_schema" "example_text" { + project_number = data.google_project.project.number + display_name = "test-property-text" + location = "us" + document_is_folder = false + + property_definitions { + name = "prop3" + display_name = "propdisp3" + is_repeatable = false + is_filterable = true + is_searchable = true + is_metadata = false + is_required = false + retrieval_importance = "HIGHEST" + schema_sources { + name = "dummy_source" + processor_type = "dummy_processor" + } + text_type_options {} + } +} + +data "google_project" "project" { +} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_timestamp.tf.erb b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_timestamp.tf.erb new file mode 100644 index 000000000000..417d81fe70fa --- /dev/null +++ b/mmv1/templates/terraform/examples/document_ai_warehouse_document_schema_timestamp.tf.erb @@ -0,0 +1,24 @@ +resource "google_document_ai_warehouse_document_schema" "example_timestamp" { + project_number = data.google_project.project.number + display_name = "test-property-timestamp" + location = "us" + + property_definitions { + name = "prop5" + display_name = "propdisp5" + is_repeatable = false + is_filterable = true + is_searchable = true + is_metadata = false + is_required = false + retrieval_importance = "HIGHEST" + schema_sources { + name = "dummy_source" + processor_type = "dummy_processor" + } + timestamp_type_options {} + } +} + +data "google_project" "project" { +} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/document_ai_warehouse_location.tf.erb b/mmv1/templates/terraform/examples/document_ai_warehouse_location.tf.erb new file mode 100644 index 000000000000..28ef1e3f8a78 --- /dev/null +++ b/mmv1/templates/terraform/examples/document_ai_warehouse_location.tf.erb @@ -0,0 +1,11 @@ +resource "google_document_ai_warehouse_location" "<%= ctx[:primary_resource_id] %>" { + location = "us" + project_number = data.google_project.project.number + access_control_mode = "ACL_MODE_DOCUMENT_LEVEL_ACCESS_CONTROL_GCI" + database_type = "DB_INFRA_SPANNER" + kms_key = "dummy_key" + document_creator_default_role = "DOCUMENT_ADMIN" +} + +data "google_project" "project" { +} \ No newline at end of file