Skip to content

Commit

Permalink
Automatically generated by magic modules for service: vertex_ai and r…
Browse files Browse the repository at this point in the history
…esource: Tensorboards__experiment.

This commit includes the following changes:
- Singular Resource
- Plural Resource
- Documentation updates
- Terraform configuration
- Integration tests

Signed-off-by: Samir Anand <[email protected]>
  • Loading branch information
samiranand1990 committed Sep 19, 2023
1 parent 5e1a34c commit fdcbe0e
Show file tree
Hide file tree
Showing 9 changed files with 403 additions and 17 deletions.
2 changes: 2 additions & 0 deletions build/inspec/test/integration/build/gcp-mm.tf
Original file line number Diff line number Diff line change
Expand Up @@ -1359,6 +1359,7 @@ resource "google_healthcare_dataset" "default" {
time_zone = "UTC"
}


resource "google_service_directory_namespace" "example" {
provider = google-beta
namespace_id = "example-namespace-${local.name_suffix}"
Expand Down Expand Up @@ -1411,3 +1412,4 @@ resource "google_service_directory_endpoint" "example" {
address = "1.2.3.4"
port = 5353
}

51 changes: 34 additions & 17 deletions build/inspec/test/integration/configuration/mm-attributes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -546,49 +546,66 @@ dlp:
location: "europe-west2"
type: "Infotype"

endpoint:
training_pipeline:
name : "value_name"
job_id: "job_id"
region : "value_region"
parent : "value_parent"
update_time : "value_updatetime"
model_deployment_monitoring_job : "value_modeldeploymentmonitoringjob"
description : "value_description"
network : "value_network"
display_name : "value_displayname"
etag : "value_etag"


nas_job:
name : "value_name"
region : "value_region"
parent : "value_parent"
end_time : "value_endtime"
state : "value_state"
create_time : "value_createtime"
display_name : "value_displayname"
start_time : "value_starttime"
update_time : "value_updatetime"

batch_prediction_job:
name : "value_name"
region : "value_region"
parent : "value_parent"
create_time : "value_createtime"
model_version_id : "1"
model_version_id : "value_modelversionid"
end_time : "value_endtime"
start_time : "value_starttime"
update_time : "value_updatetime"
state : "value_state"
model : "value_model"
display_name : "value_displayname"
service_account : "value_serviceaccount"

custom_job:
name : "value_name"
job_id: "job_id"
region : "value_region"
parent : "value_parent"
job_id: "job_id"

training_pipeline:

region_security_policy:
securitypolicy : "value_securitypolicy"

endpoint:
name : "value_name"
job_id: "job_id"
region : "value_region"
parent : "value_parent"
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"

nas_job:
tensorboards_experiment:
name : "value_name"
region : "value_region"
parent : "value_parent"
end_time : "value_endtime"
state : "value_state"
create_time : "value_createtime"
description : "value_description"
source : "value_source"
display_name : "value_displayname"
start_time : "value_starttime"
create_time : "value_createtime"
update_time : "value_updatetime"
etag : "value_etag"
51 changes: 51 additions & 0 deletions docs/resources/google_vertex_ai_tensorboards_experiment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: About the google_vertex_ai_tensorboards_experiment resource
platform: gcp
---

## Syntax
A `google_vertex_ai_tensorboards_experiment` is used to test a Google TensorboardsExperiment resource

## Examples
```
describe google_vertex_ai_tensorboards_experiment(name: "projects/#{gcp_project_id}/locations/#{tensorboards_experiment['region']}/tensorboards/#{tensorboards_experiment['tensorboard']}/experiments/#{tensorboards_experiment['name']}", region: ' value_region') do
it { should exist }
its('description') { should cmp 'value_description' }
its('source') { should cmp 'value_source' }
its('display_name') { should cmp 'value_displayname' }
its('create_time') { should cmp 'value_createtime' }
its('update_time') { should cmp 'value_updatetime' }
its('name') { should cmp 'value_name' }
its('etag') { should cmp 'value_etag' }
end
describe google_vertex_ai_tensorboards_experiment(name: "does_not_exit", region: ' value_region') do
it { should_not exist }
end
```

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


* `description`: Description of this TensorboardExperiment.

* `source`: Immutable. Source of the TensorboardExperiment. Example: a custom training job.

* `display_name`: User provided name of this TensorboardExperiment.

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

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

* `labels`: The labels with user-defined metadata to organize your TensorboardExperiment. Label keys and values cannot be longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. No more than 64 user labels can be associated with one Dataset (System labels are excluded). See https://goo.gl/xmQnxf for more information and examples of labels. System reserved label keys are prefixed with `aiplatform.googleapis.com/` and are immutable. The following system labels exist for each Dataset: * `aiplatform.googleapis.com/dataset_metadata_schema`: output only. Its value is the metadata_schema's title.

* `additional_properties`:

* `name`: Output only. Name of the TensorboardExperiment. Format: `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}`

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


## GCP Permissions
33 changes: 33 additions & 0 deletions docs/resources/google_vertex_ai_tensorboards_experiments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: About the google_vertex_ai_tensorboards_experiments resource
platform: gcp
---

## Syntax
A `google_vertex_ai_tensorboards_experiments` is used to test a Google TensorboardsExperiment resource

## Examples
```
describe google_vertex_ai_tensorboards_experiments(parent: "projects/#{gcp_project_id}/locations/#{tensorboards_experiment['region']}/tensorboards/#{tensorboards_experiment['tensorboard']}", region: ' value_region') do
it { should exist }
end
```

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

See [google_vertex_ai_tensorboards_experiment.md](google_vertex_ai_tensorboards_experiment.md) for more detailed information
* `descriptions`: an array of `google_vertex_ai_tensorboards_experiment` description
* `sources`: an array of `google_vertex_ai_tensorboards_experiment` source
* `display_names`: an array of `google_vertex_ai_tensorboards_experiment` display_name
* `create_times`: an array of `google_vertex_ai_tensorboards_experiment` create_time
* `update_times`: an array of `google_vertex_ai_tensorboards_experiment` update_time
* `labels`: an array of `google_vertex_ai_tensorboards_experiment` labels
* `names`: an array of `google_vertex_ai_tensorboards_experiment` name
* `etags`: an array of `google_vertex_ai_tensorboards_experiment` etag

## Filter Criteria
This resource supports all of the above properties as filter criteria, which can be used
with `where` as a block or a method.

## GCP Permissions
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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.
#
# ----------------------------------------------------------------------------
module GoogleInSpec
module VertexAI
module Property
class TensorboardsExperimentLabels
attr_reader :additional_properties

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@additional_properties = args['additionalProperties']
end

def to_s
"#{@parent_identifier} TensorboardsExperimentLabels"
end
end
end
end
end
70 changes: 70 additions & 0 deletions libraries/google_vertex_ai_tensorboards_experiment.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# 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'
require 'google/vertexai/property/tensorboardsexperiment_labels'

# A provider to manage Vertex AI resources.
class VertexAITensorboardsExperiment < GcpResourceBase
name 'google_vertex_ai_tensorboards_experiment'
desc 'TensorboardsExperiment'
supports platform: 'gcp'

attr_reader :params
attr_reader :description
attr_reader :source
attr_reader :display_name
attr_reader :create_time
attr_reader :update_time
attr_reader :labels
attr_reader :name
attr_reader :etag

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
@description = @fetched['description']
@source = @fetched['source']
@display_name = @fetched['displayName']
@create_time = @fetched['createTime']
@update_time = @fetched['updateTime']
@labels = GoogleInSpec::VertexAI::Property::TensorboardsExperimentLabels.new(@fetched['labels'], to_s)
@name = @fetched['name']
@etag = @fetched['etag']
end

def exists?
!@fetched.nil?
end

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

private

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

def resource_base_url
'{{name}}'
end
end
93 changes: 93 additions & 0 deletions libraries/google_vertex_ai_tensorboards_experiments.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# 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'
class VertexAITensorboardsExperiments < GcpResourceBase
name 'google_vertex_ai_tensorboards_experiments'
desc 'TensorboardsExperiment plural resource'
supports platform: 'gcp'

attr_reader :table

filter_table_config = FilterTable.create

filter_table_config.add(:descriptions, field: :description)
filter_table_config.add(:sources, field: :source)
filter_table_config.add(:display_names, field: :display_name)
filter_table_config.add(:create_times, field: :create_time)
filter_table_config.add(:update_times, field: :update_time)
filter_table_config.add(:labels, field: :labels)
filter_table_config.add(:names, field: :name)
filter_table_config.add(:etags, field: :etag)

filter_table_config.connect(self, :table)

def initialize(params = {})
super(params.merge({ use_http_transport: true }))
@params = params
@table = fetch_wrapped_resource('tensorboardsExperiments')
end

def fetch_wrapped_resource(wrap_path)
# fetch_resource returns an array of responses (to handle pagination)
result = @connection.fetch_all(product_url, resource_base_url, @params, 'Get')
return if result.nil?

# Conversion of string -> object hash to symbol -> object hash that InSpec needs
converted = []
result.each do |response|
next if response.nil? || !response.key?(wrap_path)
response[wrap_path].each do |hash|
hash_with_symbols = {}
hash.each_key do |key|
name, value = transform(key, hash)
hash_with_symbols[name] = value
end
converted.push(hash_with_symbols)
end
end

converted
end

def transform(key, value)
return transformers[key].call(value) if transformers.key?(key)

[key.to_sym, value]
end

def transformers
{
'description' => ->(obj) { return :description, obj['description'] },
'source' => ->(obj) { return :source, obj['source'] },
'displayName' => ->(obj) { return :display_name, obj['displayName'] },
'createTime' => ->(obj) { return :create_time, obj['createTime'] },
'updateTime' => ->(obj) { return :update_time, obj['updateTime'] },
'labels' => ->(obj) { return :labels, GoogleInSpec::VertexAI::Property::TensorboardsExperimentLabels.new(obj['labels'], to_s) },
'name' => ->(obj) { return :name, obj['name'] },
'etag' => ->(obj) { return :etag, obj['etag'] },
}
end

private

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

def resource_base_url
'{{parent}}/experiments'
end
end
Loading

0 comments on commit fdcbe0e

Please sign in to comment.