Skip to content

Commit

Permalink
Merge pull request #492 from inspec/CHEF-5553-MAGIC-MODULE-vertex_ai-…
Browse files Browse the repository at this point in the history
…Datasets__annotationSpec

CHEF-5553-MAGIC-MODULE-vertex_ai-Datasets__annotationSpec - Resource Implementation
  • Loading branch information
sa-progress authored Oct 10, 2023
2 parents 9fd11f4 + ffaf27f commit 65407b6
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 35 deletions.
35 changes: 0 additions & 35 deletions build/inspec/test/integration/build/gcp-mm.tf
Original file line number Diff line number Diff line change
Expand Up @@ -1346,41 +1346,6 @@ resource "google_data_loss_prevention_stored_info_type" "basic" {
}
}

resource "google_healthcare_dataset" "default" {
name = "example-dataset-${local.name_suffix}"
location = "us-central1"
time_zone = "UTC"
}


resource "google_healthcare_dataset" "default" {
name = "example-dataset-${local.name_suffix}"
location = "us-central1"
time_zone = "UTC"
}


resource "google_service_directory_namespace" "example" {
provider = google-beta
namespace_id = "example-namespace-${local.name_suffix}"
location = "us-central1"
}

resource "google_service_directory_service" "example" {
provider = google-beta
service_id = "example-service-${local.name_suffix}"
namespace = google_service_directory_namespace.example.id
}

resource "google_service_directory_endpoint" "example" {
provider = google-beta
endpoint_id = "example-endpoint-${local.name_suffix}"
service = google_service_directory_service.example.id

metadata = {
stage = "prod"
region = "us-central1"
}
resource "google_vertex_ai_tensorboard" "tensorboard" {
display_name = "terraform-${local.name_suffix}"
description = "sample description"
Expand Down
14 changes: 14 additions & 0 deletions build/inspec/test/integration/configuration/mm-attributes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -773,5 +773,19 @@ model_deployment_monitoring_job:
next_schedule_time : "value_nextscheduletime"
data_item_schema_uri : "value_dataitemschemauri"
metrics_schema_uri : "value_metricsschemauri"
update_time : "value_updatetime"
model_deployment_monitoring_job : "value_modeldeploymentmonitoringjob"
description : "value_description"
network : "value_network"
display_name : "value_displayname"
etag : "value_etag"
create_time : "value_createtime"

datasets_annotation_spec:
name : "5438527833485869056"
region : "us-central1"
dataset: "1044994542735982592"
parent: "projects/165434197229/locations/us-central1/datasets/1044994542735982592/annotationSpecs/"
etag : "value_etag"
create_time : "value_createtime"
annotation_schema_uri : "value_annotationschemauri"
41 changes: 41 additions & 0 deletions docs/resources/google_vertex_ai_datasets_annotation_spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: About the google_vertex_ai_datasets_annotation_spec resource
platform: gcp
---

## Syntax
A `google_vertex_ai_datasets_annotation_spec` is used to test a Google DatasetsAnnotationSpec resource

## Examples
```
describe google_vertex_ai_datasets_annotation_spec(name: "projects/#{gcp_project_id}/locations/#{datasets_annotation_spec['region']}/datasets/#{datasets_annotation_spec['dataset']}/annotationSpecs/#{datasets_annotation_spec['name']}", region: ' value_region') do
it { should exist }
its('display_name') { should cmp 'value_displayname' }
its('name') { should cmp 'value_name' }
its('etag') { should cmp 'value_etag' }
its('create_time') { should cmp 'value_createtime' }
its('update_time') { should cmp 'value_updatetime' }
end
describe google_vertex_ai_datasets_annotation_spec(name: "does_not_exit", region: ' value_region') do
it { should_not exist }
end
```

## Properties
Properties that can be accessed from the `google_vertex_ai_datasets_annotation_spec` resource:


* `display_name`: Required. The user-defined name of the AnnotationSpec. The name can be up to 128 characters long and can consist of any UTF-8 characters.

* `name`: Output only. Resource name of the AnnotationSpec.

* `etag`: Optional. Used to perform consistent read-modify-write updates. If not set, a blind "overwrite" update happens.

* `create_time`: Output only. Timestamp when this AnnotationSpec was created.

* `update_time`: Output only. Timestamp when AnnotationSpec was last updated.


## GCP Permissions
63 changes: 63 additions & 0 deletions libraries/google_vertex_ai_datasets_annotation_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# frozen_string_literal: false

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in README.md and
# CONTRIBUTING.md located at the root of this package.
#
# ----------------------------------------------------------------------------
require 'gcp_backend'

# A provider to manage Vertex AI resources.
class VertexAIDatasetsAnnotationSpec < GcpResourceBase
name 'google_vertex_ai_datasets_annotation_spec'
desc 'DatasetsAnnotationSpec'
supports platform: 'gcp'

attr_reader :params
attr_reader :display_name
attr_reader :name
attr_reader :etag
attr_reader :create_time
attr_reader :update_time

def initialize(params)
super(params.merge({ use_http_transport: true }))
@params = params
@fetched = @connection.fetch(product_url(params[:beta]), resource_base_url, params, 'Get')
parse unless @fetched.nil?
end

def parse
@display_name = @fetched['displayName']
@name = @fetched['name']
@etag = @fetched['etag']
@create_time = @fetched['createTime']
@update_time = @fetched['updateTime']
end

def exists?
!@fetched.nil?
end

def to_s
"DatasetsAnnotationSpec #{@params[:name]}"
end

private

def product_url(_ = nil)
'https://{{region}}-aiplatform.googleapis.com/v1/'
end

def resource_base_url
'{{name}}'
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in README.md and
# CONTRIBUTING.md located at the root of this package.
#
# ----------------------------------------------------------------------------

title 'Test GCP google_vertex_ai_datasets_annotation_spec resource.'

gcp_project_id = input(:gcp_project_id, value: 'gcp_project_id', description: 'The GCP project identifier.')

datasets_annotation_spec = input('datasets_annotation_spec', value: {
"name": "5438527833485869056",
"parent": "projects/165434197229/locations/us-central1/datasets/1044994542735982592/annotationSpecs/",
"dataset": "1044994542735982592",
"region": "us-central1",
"display_name": "InSpec",
"etag": "value_etag",
"create_time": "value_createtime",
"update_time": "value_updatetime"
}, description: 'datasets_annotation_spec description')
control 'google_vertex_ai_datasets_annotation_spec-1.0' do
impact 1.0
title 'google_vertex_ai_datasets_annotation_spec resource test'

describe google_vertex_ai_datasets_annotation_spec(name: "projects/#{gcp_project_id}/locations/#{datasets_annotation_spec['region']}/datasets/#{datasets_annotation_spec['dataset']}/annotationSpecs/#{datasets_annotation_spec['name']}", region: datasets_annotation_spec['region']) do
it { should exist }
its('display_name') { should cmp datasets_annotation_spec['display_name'] }
its('name') { should cmp datasets_annotation_spec['name'] }
its('etag') { should cmp datasets_annotation_spec['etag'] }
its('create_time') { should cmp datasets_annotation_spec['create_time'] }
its('update_time') { should cmp datasets_annotation_spec['update_time'] }

end

describe google_vertex_ai_datasets_annotation_spec(name: "does_not_exit", region: datasets_annotation_spec['region']) do
it { should_not exist }
end
end

0 comments on commit 65407b6

Please sign in to comment.