diff --git a/mmv1/products/vertexai/FeatureGroup.yaml b/mmv1/products/vertexai/FeatureGroup.yaml new file mode 100644 index 000000000000..22ca5e4df9d9 --- /dev/null +++ b/mmv1/products/vertexai/FeatureGroup.yaml @@ -0,0 +1,107 @@ +# 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: FeatureGroup +base_url: projects/{{project}}/locations/{{region}}/featureGroups +create_url: projects/{{project}}/locations/{{region}}/featureGroups?featureGroupId={{name}} +self_link: projects/{{project}}/locations/{{region}}/featureGroups/{{name}} +update_verb: :PATCH +update_mask: true +create_verb: :POST +references: !ruby/object:Api::Resource::ReferenceLinks + guides: + 'Creating a Feature Group': 'https://cloud.google.com/vertex-ai/docs/featurestore/latest/create-featuregroup' + api: 'https://cloud.google.com/vertex-ai/docs/reference/rest/v1/projects.locations.featureGroups' +async: !ruby/object:Api::OpAsync + actions: + - create + - delete + - update + 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' +description: Vertex AI Feature Group. +autogen_async: false +examples: + - !ruby/object:Provider::Terraform::Examples + name: vertex_ai_feature_group + primary_resource_id: feature_group + ignore_read_extra: + - description + vars: + job_id: job_load + feature_group_name: example_feature_group +parameters: + - !ruby/object:Api::Type::String + name: region + description: The region of feature group. eg us-central1 + url_param_only: true + immutable: true +properties: + - !ruby/object:Api::Type::String + name: name + description: The resource name of the Feature Group. + custom_flatten: templates/terraform/custom_flatten/name_from_self_link.erb + - !ruby/object:Api::Type::String + name: createTime + output: true + description: The timestamp of when the FeatureGroup was created in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. + - !ruby/object:Api::Type::String + name: updateTime + output: true + description: The timestamp of when the FeatureGroup was last updated in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. + - !ruby/object:Api::Type::String + name: etag + description: Used to perform consistent read-modify-write updates. + output: true + ignore_read: true + - !ruby/object:Api::Type::KeyValueLabels + name: labels + description: The labels with user-defined metadata to organize your FeatureGroup. + - !ruby/object:Api::Type::String + name: description + description: The description of the FeatureGroup. + # When API starts returning description, this line should be removed. + custom_flatten: templates/terraform/custom_flatten/vertex_ai_feature_group_ignore_description.go.erb + - !ruby/object:Api::Type::NestedObject + name: bigQuery + description: Indicates that features for this group come from BigQuery Table/View. By default treats the source as a sparse time series source, which is required to have an entityId and a feature_timestamp column in the source. + properties: + - !ruby/object:Api::Type::NestedObject + name: bigQuerySource + required: true + immutable: true + description: The BigQuery source URI that points to either a BigQuery Table or View. + properties: + - !ruby/object:Api::Type::String + name: 'inputUri' + required: true + description: 'BigQuery URI to a table, up to 2000 characters long. For example: `bq://projectId.bqDatasetId.bqTableId.`' + - !ruby/object:Api::Type::Array + name: entityIdColumns + description: Columns to construct entityId / row keys. Currently only supports 1 entity_id_column. If not provided defaults to entityId. + item_type: Api::Type::String diff --git a/mmv1/templates/terraform/custom_flatten/vertex_ai_feature_group_ignore_description.go.erb b/mmv1/templates/terraform/custom_flatten/vertex_ai_feature_group_ignore_description.go.erb new file mode 100644 index 000000000000..61f2aa0d8915 --- /dev/null +++ b/mmv1/templates/terraform/custom_flatten/vertex_ai_feature_group_ignore_description.go.erb @@ -0,0 +1,17 @@ +<%# The license inside this block applies to this file. + # 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. +-%> +func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return d.Get("description") +} diff --git a/mmv1/templates/terraform/examples/vertex_ai_feature_group.tf.erb b/mmv1/templates/terraform/examples/vertex_ai_feature_group.tf.erb new file mode 100644 index 000000000000..8bab10127d28 --- /dev/null +++ b/mmv1/templates/terraform/examples/vertex_ai_feature_group.tf.erb @@ -0,0 +1,43 @@ + resource "google_vertex_ai_feature_group" "<%= ctx[:primary_resource_id] %>" { + name = "<%= ctx[:vars]['feature_group_name'] %>" + description = "A sample feature group" + region = "us-central1" + labels = { + label-one = "value-one" + } + big_query { + big_query_source { + # The source table must have a column named 'feature_timestamp' of type TIMESTAMP. + input_uri = "bq://${google_bigquery_table.sample_table.project}.${google_bigquery_table.sample_table.dataset_id}.${google_bigquery_table.sample_table.table_id}" + } + entity_id_columns = ["feature_id"] + } +} + +resource "google_bigquery_dataset" "sample_dataset" { + dataset_id = "<%= ctx[:vars]['job_id'] %>_dataset" + friendly_name = "test" + description = "This is a test description" + location = "US" +} + +resource "google_bigquery_table" "sample_table" { + deletion_protection = false + dataset_id = google_bigquery_dataset.sample_dataset.dataset_id + table_id = "<%= ctx[:vars]['job_id'] %>_table" + + schema = <