-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #492 from inspec/CHEF-5553-MAGIC-MODULE-vertex_ai-…
…Datasets__annotationSpec CHEF-5553-MAGIC-MODULE-vertex_ai-Datasets__annotationSpec - Resource Implementation
- Loading branch information
Showing
5 changed files
with
164 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
docs/resources/google_vertex_ai_datasets_annotation_spec.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
46 changes: 46 additions & 0 deletions
46
test/integration/verify/controls/google_vertex_ai_datasets_annotation_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |