From 36ca82876a17fbf097efe9e761d184e0fa10641e Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Fri, 1 Mar 2019 10:36:31 -0800 Subject: [PATCH 1/9] Remove URL escaping, sometimes (folders) we need to have / characters unescaped Signed-off-by: Sam Levenick --- libraries/gcp_backend.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/gcp_backend.rb b/libraries/gcp_backend.rb index 8f77b8631..29dd6d88a 100644 --- a/libraries/gcp_backend.rb +++ b/libraries/gcp_backend.rb @@ -285,7 +285,7 @@ def expand_variables(template, var_data) unless var_data.key?(v) raise "Missing variable :#{v} in #{var_data} on #{caller.join("\n")}}" end - template.gsub!(/{{#{v}}}/, CGI.escape(var_data[v].to_s)) + template.gsub!(/{{#{v}}}/, var_data[v].to_s) end template end From 4e222deaae92292ee8c8954e0639081212b492aa Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Fri, 1 Mar 2019 18:45:27 +0000 Subject: [PATCH 2/9] Inspec resource folder Signed-off-by: Modular Magician --- .../google_resourcemanager_folder.md | 38 ++++++++ .../google_resourcemanager_folders.md | 36 ++++++++ libraries/google_resourcemanager_folder.rb | 62 +++++++++++++ libraries/google_resourcemanager_folders.rb | 92 +++++++++++++++++++ test/integration/build/gcp-mm.tf | 15 +++ .../configuration/mm-attributes.yml | 5 +- .../controls/google_resourcemanager_folder.rb | 33 +++++++ .../google_resourcemanager_folders.rb | 32 +++++++ 8 files changed, 312 insertions(+), 1 deletion(-) create mode 100644 docs/resources/google_resourcemanager_folder.md create mode 100644 docs/resources/google_resourcemanager_folders.md create mode 100644 libraries/google_resourcemanager_folder.rb create mode 100644 libraries/google_resourcemanager_folders.rb create mode 100644 test/integration/verify/controls/google_resourcemanager_folder.rb create mode 100644 test/integration/verify/controls/google_resourcemanager_folders.rb diff --git a/docs/resources/google_resourcemanager_folder.md b/docs/resources/google_resourcemanager_folder.md new file mode 100644 index 000000000..203595877 --- /dev/null +++ b/docs/resources/google_resourcemanager_folder.md @@ -0,0 +1,38 @@ +--- +title: About the google_resourcemanager_folder resource +platform: gcp +--- + +## Syntax +A `google_resourcemanager_folder` is used to test a Google Folder resource + +## Examples +``` +describe.one do + google_resourcemanager_folders(parent: 'organizations/12345').names.each do |name| + describe google_resourcemanager_folder(name: name) do + it { should exist } + its('display_name') { should eq 'inspec-gcp-folder' } + end + end +end +``` + +## Properties +Properties that can be accessed from the `google_resourcemanager_folder` resource: + + * `name`: The resource name of the Folder. Its format is folders/{folder_id}, for example: "folders/1234". + + * `lifecycle_state`: The lifecycle state of the folder. Updates to the lifecycleState must be performed via folders.delete and folders.undelete. + + * `create_time`: Time of creation + + * `parent`: The Folder’s parent's resource name. Updates to the folder's parent must be performed via folders.move. + + * `display_name`: The folder’s display name. A folder’s display name must be unique amongst its siblings, e.g. no two folders with the same parent can share the same display name. The display name must start and end with a letter or digit, may contain letters, digits, spaces, hyphens and underscores and can be no longer than 30 characters. This is captured by the regular expression: `[\p{L}\p{N}]([\p{L}\p{N}_- ]{0,28}[\p{L}\p{N}])?`. + + + +## GCP Permissions + +Ensure the [Cloud Resource Manager API](https://console.cloud.google.com/apis/library/cloudresourcemanager.googleapis.com/) is enabled for the current project. diff --git a/docs/resources/google_resourcemanager_folders.md b/docs/resources/google_resourcemanager_folders.md new file mode 100644 index 000000000..af1d42018 --- /dev/null +++ b/docs/resources/google_resourcemanager_folders.md @@ -0,0 +1,36 @@ +--- +title: About the google_resourcemanager_folders resource +platform: gcp +--- + +## Syntax +A `google_resourcemanager_folders` is used to test a Google Folder resource + +## Examples +``` +describe.one do + google_resourcemanager_folders(parent: 'organizations/12345').display_names.each do |display_name| + describe display_name do + it { should eq 'inspec-gcp-folder' } + end + end +end +``` + +## Properties +Properties that can be accessed from the `google_resourcemanager_folders` resource: + +See [google_resourcemanager_folder.md](google_resourcemanager_folder.md) for more detailed information + * `names`: an array of `google_resourcemanager_folder` name + * `lifecycle_states`: an array of `google_resourcemanager_folder` lifecycle_state + * `create_times`: an array of `google_resourcemanager_folder` create_time + * `parents`: an array of `google_resourcemanager_folder` parent + * `display_names`: an array of `google_resourcemanager_folder` display_name + +## 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 + +Ensure the [Cloud Resource Manager API](https://console.cloud.google.com/apis/library/cloudresourcemanager.googleapis.com/) is enabled for the current project. diff --git a/libraries/google_resourcemanager_folder.rb b/libraries/google_resourcemanager_folder.rb new file mode 100644 index 000000000..c85af34b2 --- /dev/null +++ b/libraries/google_resourcemanager_folder.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: false + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# 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 Resource Manager resources. +class Folder < GcpResourceBase + name 'google_resourcemanager_folder' + desc 'Folder' + supports platform: 'gcp' + + attr_reader :name + attr_reader :lifecycle_state + attr_reader :create_time + attr_reader :parent + attr_reader :display_name + + def initialize(params) + super(params.merge({ use_http_transport: true })) + @fetched = @connection.fetch(product_url, resource_base_url, params) + parse unless @fetched.nil? + end + + def parse + @name = @fetched['name'] + @lifecycle_state = @fetched['lifecycleState'] + @create_time = parse_time_string(@fetched['createTime']) + @parent = @fetched['parent'] + @display_name = @fetched['displayName'] + end + + # Handles parsing RFC3339 time string + def parse_time_string(time_string) + time_string ? Time.parse(time_string) : nil + end + + def exists? + !@fetched.nil? + end + + private + + def product_url + 'https://cloudresourcemanager.googleapis.com/v2/' + end + + def resource_base_url + '{{name}}' + end +end diff --git a/libraries/google_resourcemanager_folders.rb b/libraries/google_resourcemanager_folders.rb new file mode 100644 index 000000000..9e46d9bcb --- /dev/null +++ b/libraries/google_resourcemanager_folders.rb @@ -0,0 +1,92 @@ +# frozen_string_literal: false + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# 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 Folders < GcpResourceBase + name 'google_resourcemanager_folders' + desc 'Folder plural resource' + supports platform: 'gcp' + + attr_reader :table + + filter_table_config = FilterTable.create + + filter_table_config.add(:names, field: :name) + filter_table_config.add(:lifecycle_states, field: :lifecycle_state) + filter_table_config.add(:create_times, field: :create_time) + filter_table_config.add(:parents, field: :parent) + filter_table_config.add(:display_names, field: :display_name) + + filter_table_config.connect(self, :table) + + def initialize(params = {}) + super(params.merge({ use_http_transport: true })) + @params = params + @table = fetch_wrapped_resource('folders') + 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) + 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 + { + 'name' => ->(obj) { return :name, obj['name'] }, + 'lifecycleState' => ->(obj) { return :lifecycle_state, obj['lifecycleState'] }, + 'createTime' => ->(obj) { return :create_time, parse_time_string(obj['createTime']) }, + 'parent' => ->(obj) { return :parent, obj['parent'] }, + 'displayName' => ->(obj) { return :display_name, obj['displayName'] }, + } + end + + # Handles parsing RFC3339 time string + def parse_time_string(time_string) + time_string ? Time.parse(time_string) : nil + end + + private + + def product_url + 'https://cloudresourcemanager.googleapis.com/v2/' + end + + def resource_base_url + 'folders?parent={{parent}}' + end +end diff --git a/test/integration/build/gcp-mm.tf b/test/integration/build/gcp-mm.tf index b940273d5..798c6cd22 100644 --- a/test/integration/build/gcp-mm.tf +++ b/test/integration/build/gcp-mm.tf @@ -110,6 +110,15 @@ variable "repository" { type = "map" } +variable "folder" { + type = "map" +} + +variable "gcp_organization_id" { + type = "string" + default = "none" +} + resource "google_compute_ssl_policy" "custom-ssl-policy" { name = "${var.ssl_policy["name"]}" min_tls_version = "${var.ssl_policy["min_tls_version"]}" @@ -442,4 +451,10 @@ resource "google_bigquery_table" "gcp-inspec-bigquery-table" { resource "google_sourcerepo_repository" "gcp-inspec-sourcerepo-repository" { project = "${var.gcp_project_id}" name = "${var.repository["name"]}" +} + +resource "google_folder" "inspec-gcp-folder" { + count = "${var.gcp_organization_id == "none" ? 0 : var.gcp_enable_privileged_resources}" + display_name = "${var.folder["display_name"]}" + parent = "${var.gcp_organization_id}" } \ No newline at end of file diff --git a/test/integration/configuration/mm-attributes.yml b/test/integration/configuration/mm-attributes.yml index 3c3dde1ce..03eb34035 100644 --- a/test/integration/configuration/mm-attributes.yml +++ b/test/integration/configuration/mm-attributes.yml @@ -186,4 +186,7 @@ bigquery_table: time_partitioning_type: DAY repository: - name: inspec-gcp-repository \ No newline at end of file + name: inspec-gcp-repository + +folder: + display_name: inspec-gcp-folder \ No newline at end of file diff --git a/test/integration/verify/controls/google_resourcemanager_folder.rb b/test/integration/verify/controls/google_resourcemanager_folder.rb new file mode 100644 index 000000000..dd653f52d --- /dev/null +++ b/test/integration/verify/controls/google_resourcemanager_folder.rb @@ -0,0 +1,33 @@ +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# 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_resourcemanager_folder resource.' + +folder = attribute('folder', default: {"display_name"=>"inspec-gcp-folder"}) +gcp_organization_id = attribute(:gcp_organization_id, default: gcp_organization_id, description: 'The identifier of the organization that is the parent of this folder') +gcp_enable_privileged_resources = attribute(:gcp_enable_privileged_resources, default:0, description:'Flag to enable privileged resources requiring elevated privileges in GCP.') +control 'google_resourcemanager_folder-1.0' do + impact 1.0 + title 'google_resourcemanager_folder resource test' + + only_if { gcp_enable_privileged_resources.to_i == 1 && gcp_organization_id != ''} + describe.one do + google_resourcemanager_folders(parent: "organizations/#{gcp_organization_id}").names.each do |name| + describe google_resourcemanager_folder(name: name) do + it { should exist } + its('display_name') { should eq folder['display_name'] } + end + end + end +end diff --git a/test/integration/verify/controls/google_resourcemanager_folders.rb b/test/integration/verify/controls/google_resourcemanager_folders.rb new file mode 100644 index 000000000..f9baed1b2 --- /dev/null +++ b/test/integration/verify/controls/google_resourcemanager_folders.rb @@ -0,0 +1,32 @@ +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# 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_resourcemanager_folders resource.' + +folder = attribute('folder', default: {"display_name"=>"inspec-gcp-folder"}) +gcp_organization_id = attribute(:gcp_organization_id, default: gcp_organization_id, description: 'The identifier of the organization that is the parent of this folder') +gcp_enable_privileged_resources = attribute(:gcp_enable_privileged_resources, default:0, description:'Flag to enable privileged resources requiring elevated privileges in GCP.') +control 'google_resourcemanager_folders-1.0' do + impact 1.0 + title 'google_resourcemanager_folders resource test' + + only_if { gcp_enable_privileged_resources.to_i == 1 && gcp_organization_id != ''} + describe.one do + google_resourcemanager_folders(parent: "organizations/#{gcp_organization_id}").display_names.each do |display_name| + describe display_name do + it { should eq folder['display_name'] } + end + end + end +end From 21720daee96c04acfc4275879a69e9819abf3b36 Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 6 Mar 2019 13:32:36 -0800 Subject: [PATCH 3/9] Add retention duraction, retain acked message to pubsub (#121) /cc @rileykarson --- docs/resources/google_pubsub_subscription.md | 4 ++++ docs/resources/google_pubsub_subscriptions.md | 2 ++ libraries/google_pubsub_subscription.rb | 4 ++++ libraries/google_pubsub_subscriptions.rb | 4 ++++ 4 files changed, 14 insertions(+) diff --git a/docs/resources/google_pubsub_subscription.md b/docs/resources/google_pubsub_subscription.md index 0386cd8f7..40ff2d64d 100644 --- a/docs/resources/google_pubsub_subscription.md +++ b/docs/resources/google_pubsub_subscription.md @@ -34,6 +34,10 @@ Properties that can be accessed from the `google_pubsub_subscription` resource: * `ack_deadline_seconds`: This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the ack deadline expires and before the message is acknowledged, it is an outstanding message and will not be delivered again during that time (on a best-effort basis). For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call subscriptions.modifyAckDeadline with the corresponding ackId if using pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used. For push delivery, this value is also used to set the request timeout for the call to the push endpoint. If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message. + * `message_retention_duration`: How long to retain unacknowledged messages in the subscription's backlog, from the moment a message is published. If retainAckedMessages is true, then this also configures the retention of acknowledged messages, and thus configures how far back in time a subscriptions.seek can be done. Defaults to 7 days. Cannot be more than 7 days (`"604800s"`) or less than 10 minutes (`"600s"`). A duration in seconds with up to nine fractional digits, terminated by 's'. Example: `"600.5s"`. + + * `retain_acked_messages`: Indicates whether to retain acknowledged messages. If `true`, then messages are not expunged from the subscription's backlog, even if they are acknowledged, until they fall out of the messageRetentionDuration window. + ## GCP Permissions diff --git a/docs/resources/google_pubsub_subscriptions.md b/docs/resources/google_pubsub_subscriptions.md index 484986c5d..75092b065 100644 --- a/docs/resources/google_pubsub_subscriptions.md +++ b/docs/resources/google_pubsub_subscriptions.md @@ -28,6 +28,8 @@ See [google_pubsub_subscription.md](google_pubsub_subscription.md) for more deta * `labels`: an array of `google_pubsub_subscription` labels * `push_configs`: an array of `google_pubsub_subscription` push_config * `ack_deadline_seconds`: an array of `google_pubsub_subscription` ack_deadline_seconds + * `message_retention_durations`: an array of `google_pubsub_subscription` message_retention_duration + * `retain_acked_messages`: an array of `google_pubsub_subscription` retain_acked_messages ## Filter Criteria This resource supports all of the above properties as filter criteria, which can be used diff --git a/libraries/google_pubsub_subscription.rb b/libraries/google_pubsub_subscription.rb index 75027a612..31ffe9c74 100644 --- a/libraries/google_pubsub_subscription.rb +++ b/libraries/google_pubsub_subscription.rb @@ -27,6 +27,8 @@ class Subscription < GcpResourceBase attr_reader :labels attr_reader :push_config attr_reader :ack_deadline_seconds + attr_reader :message_retention_duration + attr_reader :retain_acked_messages def initialize(params) super(params.merge({ use_http_transport: true })) @@ -40,6 +42,8 @@ def parse @labels = @fetched['labels'] @push_config = GoogleInSpec::Pubsub::Property::SubscriptionPushConfig.new(@fetched['pushConfig']) @ack_deadline_seconds = @fetched['ackDeadlineSeconds'] + @message_retention_duration = @fetched['messageRetentionDuration'] + @retain_acked_messages = @fetched['retainAckedMessages'] end # Handles parsing RFC3339 time string diff --git a/libraries/google_pubsub_subscriptions.rb b/libraries/google_pubsub_subscriptions.rb index a2629dd30..ac4b8153e 100644 --- a/libraries/google_pubsub_subscriptions.rb +++ b/libraries/google_pubsub_subscriptions.rb @@ -28,6 +28,8 @@ class Subscriptions < GcpResourceBase filter_table_config.add(:labels, field: :labels) filter_table_config.add(:push_configs, field: :push_config) filter_table_config.add(:ack_deadline_seconds, field: :ack_deadline_seconds) + filter_table_config.add(:message_retention_durations, field: :message_retention_duration) + filter_table_config.add(:retain_acked_messages, field: :retain_acked_messages) filter_table_config.connect(self, :table) @@ -72,6 +74,8 @@ def transformers 'labels' => ->(obj) { return :labels, obj['labels'] }, 'pushConfig' => ->(obj) { return :push_config, GoogleInSpec::Pubsub::Property::SubscriptionPushConfig.new(obj['pushConfig']) }, 'ackDeadlineSeconds' => ->(obj) { return :ack_deadline_seconds, obj['ackDeadlineSeconds'] }, + 'messageRetentionDuration' => ->(obj) { return :message_retention_duration, obj['messageRetentionDuration'] }, + 'retainAckedMessages' => ->(obj) { return :retain_acked_messages, obj['retainAckedMessages'] }, } end From 69e1071cf03158e2adceae04c383c72b552a5fd6 Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Fri, 8 Mar 2019 18:41:13 +0000 Subject: [PATCH 4/9] Use existing gcp_location attribute Signed-off-by: Modular Magician --- test/integration/build/gcp-mm.tf | 2 +- test/integration/configuration/mm-attributes.yml | 1 - .../verify/controls/google_container_regional_cluster.rb | 8 ++++---- .../verify/controls/google_container_regional_clusters.rb | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/test/integration/build/gcp-mm.tf b/test/integration/build/gcp-mm.tf index 798c6cd22..822f9bc8a 100644 --- a/test/integration/build/gcp-mm.tf +++ b/test/integration/build/gcp-mm.tf @@ -358,7 +358,7 @@ resource "google_compute_target_tcp_proxy" "gcp-inspec-target-tcp-proxy" { resource "google_container_cluster" "gcp-inspec-regional-cluster" { project = "${var.gcp_project_id}" name = "${var.regional_cluster["name"]}" - region = "${var.regional_cluster["region"]}" + region = "${var.gcp_location}" initial_node_count = "${var.regional_cluster["initial_node_count"]}" } diff --git a/test/integration/configuration/mm-attributes.yml b/test/integration/configuration/mm-attributes.yml index 03eb34035..881b37400 100644 --- a/test/integration/configuration/mm-attributes.yml +++ b/test/integration/configuration/mm-attributes.yml @@ -118,7 +118,6 @@ target_tcp_proxy: regional_cluster: name: inspec-gcp-regional-cluster - region: europe-west2 initial_node_count: 1 route: diff --git a/test/integration/verify/controls/google_container_regional_cluster.rb b/test/integration/verify/controls/google_container_regional_cluster.rb index 14bc5e0dc..2c3af1b17 100644 --- a/test/integration/verify/controls/google_container_regional_cluster.rb +++ b/test/integration/verify/controls/google_container_regional_cluster.rb @@ -15,22 +15,22 @@ title 'Test GCP google_container_regional_cluster resource.' gcp_project_id = attribute(:gcp_project_id, default: 'gcp_project_id', description: 'The GCP project identifier.') +gcp_location = attribute(:gcp_location, default: 'gcp_location', description: 'The GCP project region.') regional_cluster = attribute('regional_cluster', default: { "name": "inspec-gcp-regional-cluster", - "region": "europe-west2", "initial_node_count": 1 }, description: 'Regional container cluster definition') control 'google_container_regional_cluster-1.0' do impact 1.0 title 'google_container_regional_cluster resource test' - describe google_container_regional_cluster(project: gcp_project_id, location: regional_cluster['region'], name: regional_cluster['name']) do + describe google_container_regional_cluster(project: gcp_project_id, location: gcp_location, name: regional_cluster['name']) do it { should exist } its('initial_node_count') { should eq regional_cluster['initial_node_count']} - its('location') { should eq regional_cluster['region']} + its('location') { should eq gcp_location} end - describe google_container_regional_cluster(project: gcp_project_id, location: regional_cluster['region'], name: 'nonexistent') do + describe google_container_regional_cluster(project: gcp_project_id, location: gcp_location, name: 'nonexistent') do it { should_not exist } end end diff --git a/test/integration/verify/controls/google_container_regional_clusters.rb b/test/integration/verify/controls/google_container_regional_clusters.rb index 33da71ca9..4f7017eee 100644 --- a/test/integration/verify/controls/google_container_regional_clusters.rb +++ b/test/integration/verify/controls/google_container_regional_clusters.rb @@ -15,16 +15,16 @@ title 'Test GCP google_container_regional_clusters resource.' gcp_project_id = attribute(:gcp_project_id, default: 'gcp_project_id', description: 'The GCP project identifier.') +gcp_location = attribute(:gcp_location, default: 'gcp_location', description: 'The GCP project region.') regional_cluster = attribute('regional_cluster', default: { "name": "inspec-gcp-regional-cluster", - "region": "europe-west2", "initial_node_count": 1 }, description: 'Regional container cluster definition') control 'google_container_regional_clusters-1.0' do impact 1.0 title 'google_container_regional_clusters resource test' - describe google_container_regional_clusters(project: gcp_project_id, location: regional_cluster['region']) do + describe google_container_regional_clusters(project: gcp_project_id, location: gcp_location) do its('count') { should be >= 1 } its('names') { should include regional_cluster['name'] } its('initial_node_counts') { should include regional_cluster['initial_node_count']} From 634fbdaac9f41f6d4867d196ab8ca4f614f024ce Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Fri, 8 Mar 2019 20:54:45 +0000 Subject: [PATCH 5/9] private clustering for container clusters Signed-off-by: Modular Magician --- .../google_container_regional_cluster.md | 12 ++++++ .../google_container_regional_clusters.md | 1 + .../regionalcluster_private_cluster_config.rb | 41 +++++++++++++++++++ .../google_container_regional_cluster.rb | 3 ++ .../google_container_regional_clusters.rb | 2 + 5 files changed, 59 insertions(+) create mode 100644 libraries/google/container/property/regionalcluster_private_cluster_config.rb diff --git a/docs/resources/google_container_regional_cluster.md b/docs/resources/google_container_regional_cluster.md index b8734ff6a..527c208f3 100644 --- a/docs/resources/google_container_regional_cluster.md +++ b/docs/resources/google_container_regional_cluster.md @@ -68,6 +68,18 @@ Properties that can be accessed from the `google_container_regional_cluster` res * `network`: The name of the Google Compute Engine network to which the cluster is connected. If left unspecified, the default network will be used. + * `private_cluster_config`: Configuration for a private cluster. + + * `enablePrivateNodes`: Whether nodes have internal IP addresses only. If enabled, all nodes are given only RFC 1918 private addresses and communicate with the master via private networking. + + * `enablePrivateEndpoint`: Whether the master's internal IP address is used as the cluster endpoint. + + * `masterIpv4CidrBlock`: The IP range in CIDR notation to use for the hosted master network. This range will be used for assigning internal IP addresses to the master or set of masters, as well as the ILB VIP. This range must not overlap with any other ranges in use within the cluster's network. + + * `privateEndpoint`: The internal IP address of this cluster's master endpoint. + + * `publicEndpoint`: The external IP address of this cluster's master endpoint. + * `cluster_ipv4_cidr`: The IP address range of the container pods in this cluster, in CIDR notation (e.g. 10.96.0.0/14). Leave blank to have one automatically chosen or specify a /14 block in 10.0.0.0/8. * `addons_config`: Configurations for the various addons available to run in the cluster. diff --git a/docs/resources/google_container_regional_clusters.md b/docs/resources/google_container_regional_clusters.md index 6399a5378..52685ca3a 100644 --- a/docs/resources/google_container_regional_clusters.md +++ b/docs/resources/google_container_regional_clusters.md @@ -27,6 +27,7 @@ See [google_container_regional_cluster.md](google_container_regional_cluster.md) * `logging_services`: an array of `google_container_regional_cluster` logging_service * `monitoring_services`: an array of `google_container_regional_cluster` monitoring_service * `networks`: an array of `google_container_regional_cluster` network + * `private_cluster_configs`: an array of `google_container_regional_cluster` private_cluster_config * `cluster_ipv4_cidrs`: an array of `google_container_regional_cluster` cluster_ipv4_cidr * `addons_configs`: an array of `google_container_regional_cluster` addons_config * `subnetworks`: an array of `google_container_regional_cluster` subnetwork diff --git a/libraries/google/container/property/regionalcluster_private_cluster_config.rb b/libraries/google/container/property/regionalcluster_private_cluster_config.rb new file mode 100644 index 000000000..09476fd30 --- /dev/null +++ b/libraries/google/container/property/regionalcluster_private_cluster_config.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: false + +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +# +# ---------------------------------------------------------------------------- +# +# 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 Container + module Property + class RegionalClusterPrivateClusterConfig + attr_reader :enable_private_nodes + + attr_reader :enable_private_endpoint + + attr_reader :master_ipv4_cidr_block + + attr_reader :private_endpoint + + attr_reader :public_endpoint + + def initialize(args = nil) + return if args.nil? + @enable_private_nodes = args['enablePrivateNodes'] + @enable_private_endpoint = args['enablePrivateEndpoint'] + @master_ipv4_cidr_block = args['masterIpv4CidrBlock'] + @private_endpoint = args['privateEndpoint'] + @public_endpoint = args['publicEndpoint'] + end + end + end + end +end diff --git a/libraries/google_container_regional_cluster.rb b/libraries/google_container_regional_cluster.rb index 04942518a..2d69510b1 100644 --- a/libraries/google_container_regional_cluster.rb +++ b/libraries/google_container_regional_cluster.rb @@ -19,6 +19,7 @@ require 'google/container/property/regionalcluster_addons_config_http_load_balancing' require 'google/container/property/regionalcluster_master_auth' require 'google/container/property/regionalcluster_node_config' +require 'google/container/property/regionalcluster_private_cluster_config' # A provider to manage Google Kubernetes Engine resources. class RegionalCluster < GcpResourceBase @@ -34,6 +35,7 @@ class RegionalCluster < GcpResourceBase attr_reader :logging_service attr_reader :monitoring_service attr_reader :network + attr_reader :private_cluster_config attr_reader :cluster_ipv4_cidr attr_reader :addons_config attr_reader :subnetwork @@ -63,6 +65,7 @@ def parse @logging_service = @fetched['loggingService'] @monitoring_service = @fetched['monitoringService'] @network = @fetched['network'] + @private_cluster_config = GoogleInSpec::Container::Property::RegionalClusterPrivateClusterConfig.new(@fetched['privateClusterConfig']) @cluster_ipv4_cidr = @fetched['clusterIpv4Cidr'] @addons_config = GoogleInSpec::Container::Property::RegionalClusterAddonsConfig.new(@fetched['addonsConfig']) @subnetwork = @fetched['subnetwork'] diff --git a/libraries/google_container_regional_clusters.rb b/libraries/google_container_regional_clusters.rb index f4dc5cf66..2297f3040 100644 --- a/libraries/google_container_regional_clusters.rb +++ b/libraries/google_container_regional_clusters.rb @@ -31,6 +31,7 @@ class RegionalClusters < GcpResourceBase filter_table_config.add(:logging_services, field: :logging_service) filter_table_config.add(:monitoring_services, field: :monitoring_service) filter_table_config.add(:networks, field: :network) + filter_table_config.add(:private_cluster_configs, field: :private_cluster_config) filter_table_config.add(:cluster_ipv4_cidrs, field: :cluster_ipv4_cidr) filter_table_config.add(:addons_configs, field: :addons_config) filter_table_config.add(:subnetworks, field: :subnetwork) @@ -91,6 +92,7 @@ def transformers 'loggingService' => ->(obj) { return :logging_service, obj['loggingService'] }, 'monitoringService' => ->(obj) { return :monitoring_service, obj['monitoringService'] }, 'network' => ->(obj) { return :network, obj['network'] }, + 'privateClusterConfig' => ->(obj) { return :private_cluster_config, GoogleInSpec::Container::Property::RegionalClusterPrivateClusterConfig.new(obj['privateClusterConfig']) }, 'clusterIpv4Cidr' => ->(obj) { return :cluster_ipv4_cidr, obj['clusterIpv4Cidr'] }, 'addonsConfig' => ->(obj) { return :addons_config, GoogleInSpec::Container::Property::RegionalClusterAddonsConfig.new(obj['addonsConfig']) }, 'subnetwork' => ->(obj) { return :subnetwork, obj['subnetwork'] }, From 5465f7ed0727937e7acbb7e4b08d88e1087363df Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Wed, 13 Mar 2019 17:59:24 +0000 Subject: [PATCH 6/9] Add test and alias for BigQuery Dataset name Signed-off-by: Modular Magician --- docs/resources/google_bigquery_dataset.md | 3 +-- libraries/google_bigquery_dataset.rb | 6 ++++-- test/integration/verify/controls/google_bigquery_dataset.rb | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/resources/google_bigquery_dataset.md b/docs/resources/google_bigquery_dataset.md index ab2edc4a0..557805371 100644 --- a/docs/resources/google_bigquery_dataset.md +++ b/docs/resources/google_bigquery_dataset.md @@ -14,6 +14,7 @@ describe google_bigquery_dataset(project: 'chef-gcp-inspec', name: 'inspec_gcp_d its('friendly_name') { should eq 'A BigQuery dataset test' } its('location') { should eq 'EU' } its('description') { should eq 'Test BigQuery dataset description' } + its('name') { should eq 'inspec_gcp_dataset' } its('default_table_expiration_ms') { should cmp '3600000' } end @@ -34,8 +35,6 @@ end ## Properties Properties that can be accessed from the `google_bigquery_dataset` resource: - * `name`: Dataset name - * `access`: Access controls on the bucket. * `domain`: A domain to grant access to. Any users signed in with the domain specified will be granted the specified access diff --git a/libraries/google_bigquery_dataset.rb b/libraries/google_bigquery_dataset.rb index 452a91180..863dc2460 100644 --- a/libraries/google_bigquery_dataset.rb +++ b/libraries/google_bigquery_dataset.rb @@ -23,7 +23,6 @@ class Dataset < GcpResourceBase desc 'Dataset' supports platform: 'gcp' - attr_reader :name attr_reader :access attr_reader :creation_time attr_reader :dataset_reference @@ -42,7 +41,6 @@ def initialize(params) end def parse - @name = @fetched['name'] @access = GoogleInSpec::BigQuery::Property::DatasetAccessArray.parse(@fetched['access']) @creation_time = @fetched['creationTime'] @dataset_reference = GoogleInSpec::BigQuery::Property::DatasetDatasetReference.new(@fetched['datasetReference']) @@ -64,6 +62,10 @@ def exists? !@fetched.nil? end + def name + dataset_reference&.dataset_id + end + private def product_url diff --git a/test/integration/verify/controls/google_bigquery_dataset.rb b/test/integration/verify/controls/google_bigquery_dataset.rb index 6e4e325ab..7d9963430 100644 --- a/test/integration/verify/controls/google_bigquery_dataset.rb +++ b/test/integration/verify/controls/google_bigquery_dataset.rb @@ -34,6 +34,7 @@ its('friendly_name') { should eq dataset['friendly_name'] } its('location') { should eq dataset['location'] } its('description') { should eq dataset['description'] } + its('name') { should eq dataset['dataset_id'] } its('default_table_expiration_ms') { should cmp dataset['default_table_expiration_ms'] } end From f882debe979c7f93a70c1597d10470d73791cb2f Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 13 Mar 2019 15:52:57 -0700 Subject: [PATCH 7/9] Terraform: Support for (Regional)Disk physicalBlockSizeBytes (#126) /cc @drebes --- docs/resources/google_compute_disk.md | 2 ++ docs/resources/google_compute_disks.md | 1 + libraries/google_compute_disk.rb | 2 ++ libraries/google_compute_disks.rb | 2 ++ 4 files changed, 7 insertions(+) diff --git a/docs/resources/google_compute_disk.md b/docs/resources/google_compute_disk.md index 4aca7ef57..e1c0bb2ae 100644 --- a/docs/resources/google_compute_disk.md +++ b/docs/resources/google_compute_disk.md @@ -56,6 +56,8 @@ Properties that can be accessed from the `google_compute_disk` resource: * `users`: Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance + * `physical_block_size_bytes`: Physical block size of the persistent disk, in bytes. If not present in a request, a default value is used. Currently supported sizes are 4096 and 16384, other sizes may be added in the future. If an unsupported value is requested, the error message will list the supported values for the caller's project. + * `type`: URL of the disk type resource describing which disk type to use to create the disk. Provide this when creating the disk. * `source_image`: The source image used to create this disk. If the source image is deleted, this field will not be set. To create a disk with one of the public operating system images, specify the image by its family name. For example, specify family/debian-8 to use the latest Debian 8 image: projects/debian-cloud/global/images/family/debian-8 Alternatively, use a specific version of a public operating system image: projects/debian-cloud/global/images/debian-8-jessie-vYYYYMMDD To create a disk with a private image that you created, specify the image name in the following format: global/images/my-private-image You can also specify a private image by its image family, which returns the latest version of the image in that family. Replace the image name with family/family-name: global/images/family/my-private-family diff --git a/docs/resources/google_compute_disks.md b/docs/resources/google_compute_disks.md index f6a5d8cbd..d6cf171bf 100644 --- a/docs/resources/google_compute_disks.md +++ b/docs/resources/google_compute_disks.md @@ -31,6 +31,7 @@ See [google_compute_disk.md](google_compute_disk.md) for more detailed informati * `names`: an array of `google_compute_disk` name * `size_gbs`: an array of `google_compute_disk` size_gb * `users`: an array of `google_compute_disk` users + * `physical_block_size_bytes`: an array of `google_compute_disk` physical_block_size_bytes * `types`: an array of `google_compute_disk` type * `source_images`: an array of `google_compute_disk` source_image * `zones`: an array of `google_compute_disk` zone diff --git a/libraries/google_compute_disk.rb b/libraries/google_compute_disk.rb index 9dae4cc58..f0770012c 100644 --- a/libraries/google_compute_disk.rb +++ b/libraries/google_compute_disk.rb @@ -35,6 +35,7 @@ class Disk < GcpResourceBase attr_reader :name attr_reader :size_gb attr_reader :users + attr_reader :physical_block_size_bytes attr_reader :type attr_reader :source_image attr_reader :zone @@ -63,6 +64,7 @@ def parse @name = @fetched['name'] @size_gb = @fetched['sizeGb'] @users = @fetched['users'] + @physical_block_size_bytes = @fetched['physicalBlockSizeBytes'] @type = @fetched['type'] @source_image = @fetched['sourceImage'] @zone = @fetched['zone'] diff --git a/libraries/google_compute_disks.rb b/libraries/google_compute_disks.rb index ece34ca12..3d978a351 100644 --- a/libraries/google_compute_disks.rb +++ b/libraries/google_compute_disks.rb @@ -34,6 +34,7 @@ class Disks < GcpResourceBase filter_table_config.add(:names, field: :name) filter_table_config.add(:size_gbs, field: :size_gb) filter_table_config.add(:users, field: :users) + filter_table_config.add(:physical_block_size_bytes, field: :physical_block_size_bytes) filter_table_config.add(:types, field: :type) filter_table_config.add(:source_images, field: :source_image) filter_table_config.add(:zones, field: :zone) @@ -93,6 +94,7 @@ def transformers 'name' => ->(obj) { return :name, obj['name'] }, 'sizeGb' => ->(obj) { return :size_gb, obj['sizeGb'] }, 'users' => ->(obj) { return :users, obj['users'] }, + 'physicalBlockSizeBytes' => ->(obj) { return :physical_block_size_bytes, obj['physicalBlockSizeBytes'] }, 'type' => ->(obj) { return :type, obj['type'] }, 'sourceImage' => ->(obj) { return :source_image, obj['sourceImage'] }, 'zone' => ->(obj) { return :zone, obj['zone'] }, From 5053aebcab0bcfd7082dccb0d01470e18bc58fc9 Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Mon, 18 Mar 2019 10:20:49 -0700 Subject: [PATCH 8/9] Increase ABC size max Signed-off-by: Sam Levenick --- .rubocop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index a3419f58d..d470eb9ca 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -31,7 +31,7 @@ Metrics/CyclomaticComplexity: Metrics/PerceivedComplexity: Max: 11 Metrics/AbcSize: - Max: 50 + Max: 55 Metrics/CyclomaticComplexity: Max: 15 Metrics/PerceivedComplexity: From 7683c2fc6824224687a265a4c4863ea8d338a5ec Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Mon, 18 Mar 2019 17:26:34 +0000 Subject: [PATCH 9/9] Add resource to_s methods Signed-off-by: Modular Magician --- .../bigquery/property/dataset_access.rb | 15 +++++++++----- .../bigquery/property/dataset_access_view.rb | 7 ++++++- .../property/dataset_dataset_reference.rb | 7 ++++++- .../table_encryption_configuration.rb | 7 ++++++- .../table_external_data_configuration.rb | 15 +++++++++----- ...nal_data_configuration_bigtable_options.rb | 9 +++++++-- ...ration_bigtable_options_column_families.rb | 15 +++++++++----- ...igtable_options_column_families_columns.rb | 13 ++++++++---- ...external_data_configuration_csv_options.rb | 7 ++++++- ...ata_configuration_google_sheets_options.rb | 7 ++++++- ...able_external_data_configuration_schema.rb | 9 +++++++-- ...ternal_data_configuration_schema_fields.rb | 13 ++++++++---- .../google/bigquery/property/table_schema.rb | 9 +++++++-- .../bigquery/property/table_schema_fields.rb | 13 ++++++++---- .../property/table_streaming_buffer.rb | 7 ++++++- .../property/table_table_reference.rb | 7 ++++++- .../property/table_time_partitioning.rb | 7 ++++++- .../google/bigquery/property/table_view.rb | 9 +++++++-- ...le_view_user_defined_function_resources.rb | 13 ++++++++---- .../cloudbuild/property/trigger_build.rb | 9 +++++++-- .../property/trigger_build_steps.rb | 13 ++++++++---- .../property/trigger_trigger_template.rb | 7 ++++++- .../property/autoscaler_autoscaling_policy.rb | 13 ++++++++---- ...aler_autoscaling_policy_cpu_utilization.rb | 7 ++++++- ...aling_policy_custom_metric_utilizations.rb | 13 ++++++++---- ...aling_policy_load_balancing_utilization.rb | 7 ++++++- .../property/backendservice_backends.rb | 13 ++++++++---- .../property/backendservice_cdn_policy.rb | 9 +++++++-- ...kendservice_cdn_policy_cache_key_policy.rb | 7 ++++++- .../backendservice_connection_draining.rb | 7 ++++++- .../compute/property/backendservice_iap.rb | 7 ++++++- .../property/disk_disk_encryption_key.rb | 7 ++++++- .../disk_source_image_encryption_key.rb | 7 ++++++- .../disk_source_snapshot_encryption_key.rb | 7 ++++++- .../property/healthcheck_http_health_check.rb | 7 ++++++- .../healthcheck_https_health_check.rb | 7 ++++++- .../property/healthcheck_ssl_health_check.rb | 7 ++++++- .../property/healthcheck_tcp_health_check.rb | 7 ++++++- .../instancegroupmanager_current_actions.rb | 7 ++++++- .../instancegroupmanager_named_ports.rb | 13 ++++++++---- .../property/instancetemplate_properties.rb | 19 +++++++++++------- .../instancetemplate_properties_disks.rb | 17 ++++++++++------ ...te_properties_disks_disk_encryption_key.rb | 7 ++++++- ...late_properties_disks_initialize_params.rb | 9 +++++++-- ...lize_params_source_image_encryption_key.rb | 7 ++++++- ...etemplate_properties_guest_accelerators.rb | 13 ++++++++---- ...etemplate_properties_network_interfaces.rb | 17 ++++++++++------ ...rties_network_interfaces_access_configs.rb | 13 ++++++++---- ...ties_network_interfaces_alias_ip_ranges.rb | 13 ++++++++---- .../instancetemplate_properties_scheduling.rb | 7 ++++++- ...ncetemplate_properties_service_accounts.rb | 13 ++++++++---- .../instancetemplate_properties_tags.rb | 7 ++++++- .../google/compute/property/router_bgp.rb | 9 +++++++-- .../router_bgp_advertised_ip_ranges.rb | 13 ++++++++---- .../snapshot_snapshot_encryption_key.rb | 7 ++++++- .../snapshot_source_disk_encryption_key.rb | 7 ++++++- .../compute/property/sslpolicy_warnings.rb | 13 ++++++++---- .../compute/property/urlmap_host_rules.rb | 13 ++++++++---- .../compute/property/urlmap_path_matchers.rb | 15 +++++++++----- .../urlmap_path_matchers_path_rules.rb | 13 ++++++++---- .../google/compute/property/urlmap_tests.rb | 13 ++++++++---- .../property/regionalcluster_addons_config.rb | 11 +++++++--- ...ddons_config_horizontal_pod_autoscaling.rb | 7 ++++++- ...uster_addons_config_http_load_balancing.rb | 7 ++++++- .../property/regionalcluster_master_auth.rb | 7 ++++++- .../property/regionalcluster_node_config.rb | 7 ++++++- .../regionalcluster_private_cluster_config.rb | 7 ++++++- .../property/subscription_push_config.rb | 7 ++++++- libraries/google_bigquery_dataset.rb | 10 ++++++++-- libraries/google_bigquery_datasets.rb | 2 +- libraries/google_bigquery_table.rb | 20 ++++++++++++------- libraries/google_bigquery_tables.rb | 14 ++++++------- libraries/google_cloudbuild_trigger.rb | 10 ++++++++-- libraries/google_cloudbuild_triggers.rb | 4 ++-- libraries/google_compute_autoscaler.rb | 8 +++++++- libraries/google_compute_autoscalers.rb | 2 +- libraries/google_compute_backend_service.rb | 14 +++++++++---- libraries/google_compute_backend_services.rb | 8 ++++---- libraries/google_compute_disk.rb | 12 ++++++++--- libraries/google_compute_disks.rb | 6 +++--- libraries/google_compute_global_address.rb | 6 ++++++ .../google_compute_global_forwarding_rule.rb | 6 ++++++ libraries/google_compute_health_check.rb | 14 +++++++++---- libraries/google_compute_health_checks.rb | 8 ++++---- libraries/google_compute_http_health_check.rb | 6 ++++++ .../google_compute_https_health_check.rb | 6 ++++++ .../google_compute_instance_group_manager.rb | 10 ++++++++-- .../google_compute_instance_group_managers.rb | 4 ++-- libraries/google_compute_instance_template.rb | 8 +++++++- .../google_compute_instance_templates.rb | 2 +- libraries/google_compute_route.rb | 6 ++++++ libraries/google_compute_router.rb | 8 +++++++- libraries/google_compute_routers.rb | 2 +- libraries/google_compute_snapshot.rb | 10 ++++++++-- libraries/google_compute_snapshots.rb | 4 ++-- libraries/google_compute_ssl_certificate.rb | 6 ++++++ libraries/google_compute_ssl_policies.rb | 2 +- libraries/google_compute_ssl_policy.rb | 8 +++++++- libraries/google_compute_target_http_proxy.rb | 6 ++++++ .../google_compute_target_https_proxy.rb | 6 ++++++ libraries/google_compute_target_pool.rb | 6 ++++++ libraries/google_compute_target_tcp_proxy.rb | 6 ++++++ libraries/google_compute_url_map.rb | 12 ++++++++--- libraries/google_compute_url_maps.rb | 6 +++--- .../google_container_regional_cluster.rb | 14 +++++++++---- .../google_container_regional_clusters.rb | 8 ++++---- libraries/google_dns_resource_record_set.rb | 6 ++++++ libraries/google_pubsub_subscription.rb | 8 +++++++- libraries/google_pubsub_subscriptions.rb | 2 +- libraries/google_pubsub_topic.rb | 6 ++++++ libraries/google_resourcemanager_folder.rb | 6 ++++++ libraries/google_sourcerepo_repository.rb | 6 ++++++ 112 files changed, 753 insertions(+), 239 deletions(-) diff --git a/libraries/google/bigquery/property/dataset_access.rb b/libraries/google/bigquery/property/dataset_access.rb index 7a61630b3..5c67303bb 100644 --- a/libraries/google/bigquery/property/dataset_access.rb +++ b/libraries/google/bigquery/property/dataset_access.rb @@ -30,22 +30,27 @@ class DatasetAccess attr_reader :view - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @domain = args['domain'] @group_by_email = args['groupByEmail'] @role = args['role'] @special_group = args['specialGroup'] @user_by_email = args['userByEmail'] - @view = GoogleInSpec::BigQuery::Property::DatasetAccessView.new(args['view']) + @view = GoogleInSpec::BigQuery::Property::DatasetAccessView.new(args['view'], to_s) + end + + def to_s + "#{@parent_identifier} DatasetAccess" end end class DatasetAccessArray - def self.parse(value) + def self.parse(value, parent_identifier) return if value.nil? - return DatasetAccess.new(value) unless value.is_a?(::Array) - value.map { |v| DatasetAccess.new(v) } + return DatasetAccess.new(value, parent_identifier) unless value.is_a?(::Array) + value.map { |v| DatasetAccess.new(v, parent_identifier) } end end end diff --git a/libraries/google/bigquery/property/dataset_access_view.rb b/libraries/google/bigquery/property/dataset_access_view.rb index 2f75ba004..d61f8fb23 100644 --- a/libraries/google/bigquery/property/dataset_access_view.rb +++ b/libraries/google/bigquery/property/dataset_access_view.rb @@ -23,12 +23,17 @@ class DatasetAccessView attr_reader :table_id - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @dataset_id = args['datasetId'] @project_id = args['projectId'] @table_id = args['tableId'] end + + def to_s + "#{@parent_identifier} DatasetAccessView" + end end end end diff --git a/libraries/google/bigquery/property/dataset_dataset_reference.rb b/libraries/google/bigquery/property/dataset_dataset_reference.rb index 3c9105393..6be8ffc15 100644 --- a/libraries/google/bigquery/property/dataset_dataset_reference.rb +++ b/libraries/google/bigquery/property/dataset_dataset_reference.rb @@ -21,11 +21,16 @@ class DatasetDatasetReference attr_reader :project_id - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @dataset_id = args['datasetId'] @project_id = args['projectId'] end + + def to_s + "#{@parent_identifier} DatasetDatasetReference" + end end end end diff --git a/libraries/google/bigquery/property/table_encryption_configuration.rb b/libraries/google/bigquery/property/table_encryption_configuration.rb index f7e13ae71..9476f17f4 100644 --- a/libraries/google/bigquery/property/table_encryption_configuration.rb +++ b/libraries/google/bigquery/property/table_encryption_configuration.rb @@ -19,10 +19,15 @@ module Property class TableEncryptionConfiguration attr_reader :kms_key_name - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @kms_key_name = args['kmsKeyName'] end + + def to_s + "#{@parent_identifier} TableEncryptionConfiguration" + end end end end diff --git a/libraries/google/bigquery/property/table_external_data_configuration.rb b/libraries/google/bigquery/property/table_external_data_configuration.rb index 493dc7d03..5453b8211 100644 --- a/libraries/google/bigquery/property/table_external_data_configuration.rb +++ b/libraries/google/bigquery/property/table_external_data_configuration.rb @@ -43,18 +43,23 @@ class TableExternalDataConfiguration attr_reader :bigtable_options - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @autodetect = args['autodetect'] @compression = args['compression'] @ignore_unknown_values = args['ignoreUnknownValues'] @max_bad_records = args['maxBadRecords'] @source_format = args['sourceFormat'] @source_uris = args['sourceUris'] - @schema = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationSchema.new(args['schema']) - @google_sheets_options = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationGoogleSheetsOptions.new(args['googleSheetsOptions']) - @csv_options = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationCsvOptions.new(args['csvOptions']) - @bigtable_options = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationBigtableOptions.new(args['bigtableOptions']) + @schema = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationSchema.new(args['schema'], to_s) + @google_sheets_options = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationGoogleSheetsOptions.new(args['googleSheetsOptions'], to_s) + @csv_options = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationCsvOptions.new(args['csvOptions'], to_s) + @bigtable_options = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationBigtableOptions.new(args['bigtableOptions'], to_s) + end + + def to_s + "#{@parent_identifier} TableExternalDataConfiguration" end end end diff --git a/libraries/google/bigquery/property/table_external_data_configuration_bigtable_options.rb b/libraries/google/bigquery/property/table_external_data_configuration_bigtable_options.rb index f5da50ab2..508366b90 100644 --- a/libraries/google/bigquery/property/table_external_data_configuration_bigtable_options.rb +++ b/libraries/google/bigquery/property/table_external_data_configuration_bigtable_options.rb @@ -24,11 +24,16 @@ class TableExternalDataConfigurationBigtableOptions attr_reader :column_families - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @ignore_unspecified_column_families = args['ignoreUnspecifiedColumnFamilies'] @read_rowkey_as_string = args['readRowkeyAsString'] - @column_families = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationBigtableOptionsColumnFamiliesArray.parse(args['columnFamilies']) + @column_families = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationBigtableOptionsColumnFamiliesArray.parse(args['columnFamilies'], to_s) + end + + def to_s + "#{@parent_identifier} TableExternalDataConfigurationBigtableOptions" end end end diff --git a/libraries/google/bigquery/property/table_external_data_configuration_bigtable_options_column_families.rb b/libraries/google/bigquery/property/table_external_data_configuration_bigtable_options_column_families.rb index 713f4f835..3170112e3 100644 --- a/libraries/google/bigquery/property/table_external_data_configuration_bigtable_options_column_families.rb +++ b/libraries/google/bigquery/property/table_external_data_configuration_bigtable_options_column_families.rb @@ -28,21 +28,26 @@ class TableExternalDataConfigurationBigtableOptionsColumnFamilies attr_reader :type - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? - @columns = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationBigtableOptionsColumnFamiliesColumnsArray.parse(args['columns']) + @parent_identifier = parent_identifier + @columns = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationBigtableOptionsColumnFamiliesColumnsArray.parse(args['columns'], to_s) @encoding = args['encoding'] @family_id = args['familyId'] @only_read_latest = args['onlyReadLatest'] @type = args['type'] end + + def to_s + "#{@parent_identifier} TableExternalDataConfigurationBigtableOptionsColumnFamilies" + end end class TableExternalDataConfigurationBigtableOptionsColumnFamiliesArray - def self.parse(value) + def self.parse(value, parent_identifier) return if value.nil? - return TableExternalDataConfigurationBigtableOptionsColumnFamilies.new(value) unless value.is_a?(::Array) - value.map { |v| TableExternalDataConfigurationBigtableOptionsColumnFamilies.new(v) } + return TableExternalDataConfigurationBigtableOptionsColumnFamilies.new(value, parent_identifier) unless value.is_a?(::Array) + value.map { |v| TableExternalDataConfigurationBigtableOptionsColumnFamilies.new(v, parent_identifier) } end end end diff --git a/libraries/google/bigquery/property/table_external_data_configuration_bigtable_options_column_families_columns.rb b/libraries/google/bigquery/property/table_external_data_configuration_bigtable_options_column_families_columns.rb index 9869d4692..3d9a91512 100644 --- a/libraries/google/bigquery/property/table_external_data_configuration_bigtable_options_column_families_columns.rb +++ b/libraries/google/bigquery/property/table_external_data_configuration_bigtable_options_column_families_columns.rb @@ -27,21 +27,26 @@ class TableExternalDataConfigurationBigtableOptionsColumnFamiliesColumns attr_reader :type - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @encoding = args['encoding'] @field_name = args['fieldName'] @only_read_latest = args['onlyReadLatest'] @qualifier_string = args['qualifierString'] @type = args['type'] end + + def to_s + "#{@parent_identifier} TableExternalDataConfigurationBigtableOptionsColumnFamiliesColumns" + end end class TableExternalDataConfigurationBigtableOptionsColumnFamiliesColumnsArray - def self.parse(value) + def self.parse(value, parent_identifier) return if value.nil? - return TableExternalDataConfigurationBigtableOptionsColumnFamiliesColumns.new(value) unless value.is_a?(::Array) - value.map { |v| TableExternalDataConfigurationBigtableOptionsColumnFamiliesColumns.new(v) } + return TableExternalDataConfigurationBigtableOptionsColumnFamiliesColumns.new(value, parent_identifier) unless value.is_a?(::Array) + value.map { |v| TableExternalDataConfigurationBigtableOptionsColumnFamiliesColumns.new(v, parent_identifier) } end end end diff --git a/libraries/google/bigquery/property/table_external_data_configuration_csv_options.rb b/libraries/google/bigquery/property/table_external_data_configuration_csv_options.rb index 9620948aa..97fd1b4b2 100644 --- a/libraries/google/bigquery/property/table_external_data_configuration_csv_options.rb +++ b/libraries/google/bigquery/property/table_external_data_configuration_csv_options.rb @@ -29,8 +29,9 @@ class TableExternalDataConfigurationCsvOptions attr_reader :skip_leading_rows - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @allow_jagged_rows = args['allowJaggedRows'] @allow_quoted_newlines = args['allowQuotedNewlines'] @encoding = args['encoding'] @@ -38,6 +39,10 @@ def initialize(args = nil) @quote = args['quote'] @skip_leading_rows = args['skipLeadingRows'] end + + def to_s + "#{@parent_identifier} TableExternalDataConfigurationCsvOptions" + end end end end diff --git a/libraries/google/bigquery/property/table_external_data_configuration_google_sheets_options.rb b/libraries/google/bigquery/property/table_external_data_configuration_google_sheets_options.rb index 1833dbba8..4e0341c09 100644 --- a/libraries/google/bigquery/property/table_external_data_configuration_google_sheets_options.rb +++ b/libraries/google/bigquery/property/table_external_data_configuration_google_sheets_options.rb @@ -19,10 +19,15 @@ module Property class TableExternalDataConfigurationGoogleSheetsOptions attr_reader :skip_leading_rows - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @skip_leading_rows = args['skipLeadingRows'] end + + def to_s + "#{@parent_identifier} TableExternalDataConfigurationGoogleSheetsOptions" + end end end end diff --git a/libraries/google/bigquery/property/table_external_data_configuration_schema.rb b/libraries/google/bigquery/property/table_external_data_configuration_schema.rb index 6ef8eef8d..1f240562f 100644 --- a/libraries/google/bigquery/property/table_external_data_configuration_schema.rb +++ b/libraries/google/bigquery/property/table_external_data_configuration_schema.rb @@ -20,9 +20,14 @@ module Property class TableExternalDataConfigurationSchema attr_reader :fields - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? - @fields = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationSchemaFieldsArray.parse(args['fields']) + @parent_identifier = parent_identifier + @fields = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationSchemaFieldsArray.parse(args['fields'], to_s) + end + + def to_s + "#{@parent_identifier} TableExternalDataConfigurationSchema" end end end diff --git a/libraries/google/bigquery/property/table_external_data_configuration_schema_fields.rb b/libraries/google/bigquery/property/table_external_data_configuration_schema_fields.rb index c2990b4ae..145e8c0a0 100644 --- a/libraries/google/bigquery/property/table_external_data_configuration_schema_fields.rb +++ b/libraries/google/bigquery/property/table_external_data_configuration_schema_fields.rb @@ -27,21 +27,26 @@ class TableExternalDataConfigurationSchemaFields attr_reader :type - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @description = args['description'] @fields = args['fields'] @mode = args['mode'] @name = args['name'] @type = args['type'] end + + def to_s + "#{@parent_identifier} TableExternalDataConfigurationSchemaFields" + end end class TableExternalDataConfigurationSchemaFieldsArray - def self.parse(value) + def self.parse(value, parent_identifier) return if value.nil? - return TableExternalDataConfigurationSchemaFields.new(value) unless value.is_a?(::Array) - value.map { |v| TableExternalDataConfigurationSchemaFields.new(v) } + return TableExternalDataConfigurationSchemaFields.new(value, parent_identifier) unless value.is_a?(::Array) + value.map { |v| TableExternalDataConfigurationSchemaFields.new(v, parent_identifier) } end end end diff --git a/libraries/google/bigquery/property/table_schema.rb b/libraries/google/bigquery/property/table_schema.rb index 79fa4940d..756743956 100644 --- a/libraries/google/bigquery/property/table_schema.rb +++ b/libraries/google/bigquery/property/table_schema.rb @@ -20,9 +20,14 @@ module Property class TableSchema attr_reader :fields - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? - @fields = GoogleInSpec::BigQuery::Property::TableSchemaFieldsArray.parse(args['fields']) + @parent_identifier = parent_identifier + @fields = GoogleInSpec::BigQuery::Property::TableSchemaFieldsArray.parse(args['fields'], to_s) + end + + def to_s + "#{@parent_identifier} TableSchema" end end end diff --git a/libraries/google/bigquery/property/table_schema_fields.rb b/libraries/google/bigquery/property/table_schema_fields.rb index 62bf7298c..dc5a2cab4 100644 --- a/libraries/google/bigquery/property/table_schema_fields.rb +++ b/libraries/google/bigquery/property/table_schema_fields.rb @@ -27,21 +27,26 @@ class TableSchemaFields attr_reader :type - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @description = args['description'] @fields = args['fields'] @mode = args['mode'] @name = args['name'] @type = args['type'] end + + def to_s + "#{@parent_identifier} TableSchemaFields" + end end class TableSchemaFieldsArray - def self.parse(value) + def self.parse(value, parent_identifier) return if value.nil? - return TableSchemaFields.new(value) unless value.is_a?(::Array) - value.map { |v| TableSchemaFields.new(v) } + return TableSchemaFields.new(value, parent_identifier) unless value.is_a?(::Array) + value.map { |v| TableSchemaFields.new(v, parent_identifier) } end end end diff --git a/libraries/google/bigquery/property/table_streaming_buffer.rb b/libraries/google/bigquery/property/table_streaming_buffer.rb index a38f90ba3..8a124242f 100644 --- a/libraries/google/bigquery/property/table_streaming_buffer.rb +++ b/libraries/google/bigquery/property/table_streaming_buffer.rb @@ -23,12 +23,17 @@ class TableStreamingBuffer attr_reader :oldest_entry_time - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @estimated_bytes = args['estimatedBytes'] @estimated_rows = args['estimatedRows'] @oldest_entry_time = args['oldestEntryTime'] end + + def to_s + "#{@parent_identifier} TableStreamingBuffer" + end end end end diff --git a/libraries/google/bigquery/property/table_table_reference.rb b/libraries/google/bigquery/property/table_table_reference.rb index 43cdb0060..727ffc9bf 100644 --- a/libraries/google/bigquery/property/table_table_reference.rb +++ b/libraries/google/bigquery/property/table_table_reference.rb @@ -23,12 +23,17 @@ class TableTableReference attr_reader :table_id - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @dataset_id = args['datasetId'] @project_id = args['projectId'] @table_id = args['tableId'] end + + def to_s + "#{@parent_identifier} TableTableReference" + end end end end diff --git a/libraries/google/bigquery/property/table_time_partitioning.rb b/libraries/google/bigquery/property/table_time_partitioning.rb index 24f2e0b65..3c4666f41 100644 --- a/libraries/google/bigquery/property/table_time_partitioning.rb +++ b/libraries/google/bigquery/property/table_time_partitioning.rb @@ -21,11 +21,16 @@ class TableTimePartitioning attr_reader :type - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @expiration_ms = args['expirationMs'] @type = args['type'] end + + def to_s + "#{@parent_identifier} TableTimePartitioning" + end end end end diff --git a/libraries/google/bigquery/property/table_view.rb b/libraries/google/bigquery/property/table_view.rb index c263d4f7d..c5830e135 100644 --- a/libraries/google/bigquery/property/table_view.rb +++ b/libraries/google/bigquery/property/table_view.rb @@ -22,10 +22,15 @@ class TableView attr_reader :user_defined_function_resources - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @use_legacy_sql = args['useLegacySql'] - @user_defined_function_resources = GoogleInSpec::BigQuery::Property::TableViewUserDefinedFunctionResourcesArray.parse(args['userDefinedFunctionResources']) + @user_defined_function_resources = GoogleInSpec::BigQuery::Property::TableViewUserDefinedFunctionResourcesArray.parse(args['userDefinedFunctionResources'], to_s) + end + + def to_s + "#{@parent_identifier} TableView" end end end diff --git a/libraries/google/bigquery/property/table_view_user_defined_function_resources.rb b/libraries/google/bigquery/property/table_view_user_defined_function_resources.rb index c44403a25..d3b12bdc0 100644 --- a/libraries/google/bigquery/property/table_view_user_defined_function_resources.rb +++ b/libraries/google/bigquery/property/table_view_user_defined_function_resources.rb @@ -21,18 +21,23 @@ class TableViewUserDefinedFunctionResources attr_reader :resource_uri - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @inline_code = args['inlineCode'] @resource_uri = args['resourceUri'] end + + def to_s + "#{@parent_identifier} TableViewUserDefinedFunctionResources" + end end class TableViewUserDefinedFunctionResourcesArray - def self.parse(value) + def self.parse(value, parent_identifier) return if value.nil? - return TableViewUserDefinedFunctionResources.new(value) unless value.is_a?(::Array) - value.map { |v| TableViewUserDefinedFunctionResources.new(v) } + return TableViewUserDefinedFunctionResources.new(value, parent_identifier) unless value.is_a?(::Array) + value.map { |v| TableViewUserDefinedFunctionResources.new(v, parent_identifier) } end end end diff --git a/libraries/google/cloudbuild/property/trigger_build.rb b/libraries/google/cloudbuild/property/trigger_build.rb index 4cc7e74a3..e8cefc39b 100644 --- a/libraries/google/cloudbuild/property/trigger_build.rb +++ b/libraries/google/cloudbuild/property/trigger_build.rb @@ -24,11 +24,16 @@ class TriggerBuild attr_reader :steps - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @tags = args['tags'] @images = args['images'] - @steps = GoogleInSpec::CloudBuild::Property::TriggerBuildStepsArray.parse(args['steps']) + @steps = GoogleInSpec::CloudBuild::Property::TriggerBuildStepsArray.parse(args['steps'], to_s) + end + + def to_s + "#{@parent_identifier} TriggerBuild" end end end diff --git a/libraries/google/cloudbuild/property/trigger_build_steps.rb b/libraries/google/cloudbuild/property/trigger_build_steps.rb index 9a1a9625e..205e7c0d3 100644 --- a/libraries/google/cloudbuild/property/trigger_build_steps.rb +++ b/libraries/google/cloudbuild/property/trigger_build_steps.rb @@ -21,18 +21,23 @@ class TriggerBuildSteps attr_reader :args - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @name = args['name'] @args = args['args'] end + + def to_s + "#{@parent_identifier} TriggerBuildSteps" + end end class TriggerBuildStepsArray - def self.parse(value) + def self.parse(value, parent_identifier) return if value.nil? - return TriggerBuildSteps.new(value) unless value.is_a?(::Array) - value.map { |v| TriggerBuildSteps.new(v) } + return TriggerBuildSteps.new(value, parent_identifier) unless value.is_a?(::Array) + value.map { |v| TriggerBuildSteps.new(v, parent_identifier) } end end end diff --git a/libraries/google/cloudbuild/property/trigger_trigger_template.rb b/libraries/google/cloudbuild/property/trigger_trigger_template.rb index fdd7febd1..7a38479a9 100644 --- a/libraries/google/cloudbuild/property/trigger_trigger_template.rb +++ b/libraries/google/cloudbuild/property/trigger_trigger_template.rb @@ -29,8 +29,9 @@ class TriggerTriggerTemplate attr_reader :commit_sha - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @project_id = args['projectId'] @repo_name = args['repoName'] @dir = args['dir'] @@ -38,6 +39,10 @@ def initialize(args = nil) @tag_name = args['tagName'] @commit_sha = args['commitSha'] end + + def to_s + "#{@parent_identifier} TriggerTriggerTemplate" + end end end end diff --git a/libraries/google/compute/property/autoscaler_autoscaling_policy.rb b/libraries/google/compute/property/autoscaler_autoscaling_policy.rb index 05011caed..25527f7d0 100644 --- a/libraries/google/compute/property/autoscaler_autoscaling_policy.rb +++ b/libraries/google/compute/property/autoscaler_autoscaling_policy.rb @@ -32,14 +32,19 @@ class AutoscalerAutoscalingPolicy attr_reader :load_balancing_utilization - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @min_num_replicas = args['minNumReplicas'] @max_num_replicas = args['maxNumReplicas'] @cool_down_period_sec = args['coolDownPeriodSec'] - @cpu_utilization = GoogleInSpec::Compute::Property::AutoscalerAutoscalingPolicyCpuUtilization.new(args['cpuUtilization']) - @custom_metric_utilizations = GoogleInSpec::Compute::Property::AutoscalerAutoscalingPolicyCustomMetricUtilizationsArray.parse(args['customMetricUtilizations']) - @load_balancing_utilization = GoogleInSpec::Compute::Property::AutoscalerAutoscalingPolicyLoadBalancingUtilization.new(args['loadBalancingUtilization']) + @cpu_utilization = GoogleInSpec::Compute::Property::AutoscalerAutoscalingPolicyCpuUtilization.new(args['cpuUtilization'], to_s) + @custom_metric_utilizations = GoogleInSpec::Compute::Property::AutoscalerAutoscalingPolicyCustomMetricUtilizationsArray.parse(args['customMetricUtilizations'], to_s) + @load_balancing_utilization = GoogleInSpec::Compute::Property::AutoscalerAutoscalingPolicyLoadBalancingUtilization.new(args['loadBalancingUtilization'], to_s) + end + + def to_s + "#{@parent_identifier} AutoscalerAutoscalingPolicy" end end end diff --git a/libraries/google/compute/property/autoscaler_autoscaling_policy_cpu_utilization.rb b/libraries/google/compute/property/autoscaler_autoscaling_policy_cpu_utilization.rb index e365a8d06..fc1cdb8f9 100644 --- a/libraries/google/compute/property/autoscaler_autoscaling_policy_cpu_utilization.rb +++ b/libraries/google/compute/property/autoscaler_autoscaling_policy_cpu_utilization.rb @@ -19,10 +19,15 @@ module Property class AutoscalerAutoscalingPolicyCpuUtilization attr_reader :utilization_target - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @utilization_target = args['utilizationTarget'] end + + def to_s + "#{@parent_identifier} AutoscalerAutoscalingPolicyCpuUtilization" + end end end end diff --git a/libraries/google/compute/property/autoscaler_autoscaling_policy_custom_metric_utilizations.rb b/libraries/google/compute/property/autoscaler_autoscaling_policy_custom_metric_utilizations.rb index 4bb514986..a9b176c5d 100644 --- a/libraries/google/compute/property/autoscaler_autoscaling_policy_custom_metric_utilizations.rb +++ b/libraries/google/compute/property/autoscaler_autoscaling_policy_custom_metric_utilizations.rb @@ -23,19 +23,24 @@ class AutoscalerAutoscalingPolicyCustomMetricUtilizations attr_reader :utilization_target_type - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @metric = args['metric'] @utilization_target = args['utilizationTarget'] @utilization_target_type = args['utilizationTargetType'] end + + def to_s + "#{@parent_identifier} AutoscalerAutoscalingPolicyCustomMetricUtilizations" + end end class AutoscalerAutoscalingPolicyCustomMetricUtilizationsArray - def self.parse(value) + def self.parse(value, parent_identifier) return if value.nil? - return AutoscalerAutoscalingPolicyCustomMetricUtilizations.new(value) unless value.is_a?(::Array) - value.map { |v| AutoscalerAutoscalingPolicyCustomMetricUtilizations.new(v) } + return AutoscalerAutoscalingPolicyCustomMetricUtilizations.new(value, parent_identifier) unless value.is_a?(::Array) + value.map { |v| AutoscalerAutoscalingPolicyCustomMetricUtilizations.new(v, parent_identifier) } end end end diff --git a/libraries/google/compute/property/autoscaler_autoscaling_policy_load_balancing_utilization.rb b/libraries/google/compute/property/autoscaler_autoscaling_policy_load_balancing_utilization.rb index 89be33703..9a942ab2b 100644 --- a/libraries/google/compute/property/autoscaler_autoscaling_policy_load_balancing_utilization.rb +++ b/libraries/google/compute/property/autoscaler_autoscaling_policy_load_balancing_utilization.rb @@ -19,10 +19,15 @@ module Property class AutoscalerAutoscalingPolicyLoadBalancingUtilization attr_reader :utilization_target - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @utilization_target = args['utilizationTarget'] end + + def to_s + "#{@parent_identifier} AutoscalerAutoscalingPolicyLoadBalancingUtilization" + end end end end diff --git a/libraries/google/compute/property/backendservice_backends.rb b/libraries/google/compute/property/backendservice_backends.rb index 0089842f6..86e62dece 100644 --- a/libraries/google/compute/property/backendservice_backends.rb +++ b/libraries/google/compute/property/backendservice_backends.rb @@ -35,8 +35,9 @@ class BackendServiceBackends attr_reader :max_utilization - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @balancing_mode = args['balancingMode'] @capacity_scaler = args['capacityScaler'] @description = args['description'] @@ -47,13 +48,17 @@ def initialize(args = nil) @max_rate_per_instance = args['maxRatePerInstance'] @max_utilization = args['maxUtilization'] end + + def to_s + "#{@parent_identifier} BackendServiceBackends" + end end class BackendServiceBackendsArray - def self.parse(value) + def self.parse(value, parent_identifier) return if value.nil? - return BackendServiceBackends.new(value) unless value.is_a?(::Array) - value.map { |v| BackendServiceBackends.new(v) } + return BackendServiceBackends.new(value, parent_identifier) unless value.is_a?(::Array) + value.map { |v| BackendServiceBackends.new(v, parent_identifier) } end end end diff --git a/libraries/google/compute/property/backendservice_cdn_policy.rb b/libraries/google/compute/property/backendservice_cdn_policy.rb index bdeb1d573..f34c5962d 100644 --- a/libraries/google/compute/property/backendservice_cdn_policy.rb +++ b/libraries/google/compute/property/backendservice_cdn_policy.rb @@ -20,9 +20,14 @@ module Property class BackendServiceCdnPolicy attr_reader :cache_key_policy - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? - @cache_key_policy = GoogleInSpec::Compute::Property::BackendServiceCdnPolicyCacheKeyPolicy.new(args['cacheKeyPolicy']) + @parent_identifier = parent_identifier + @cache_key_policy = GoogleInSpec::Compute::Property::BackendServiceCdnPolicyCacheKeyPolicy.new(args['cacheKeyPolicy'], to_s) + end + + def to_s + "#{@parent_identifier} BackendServiceCdnPolicy" end end end diff --git a/libraries/google/compute/property/backendservice_cdn_policy_cache_key_policy.rb b/libraries/google/compute/property/backendservice_cdn_policy_cache_key_policy.rb index 99ff75afc..1e95d38f5 100644 --- a/libraries/google/compute/property/backendservice_cdn_policy_cache_key_policy.rb +++ b/libraries/google/compute/property/backendservice_cdn_policy_cache_key_policy.rb @@ -27,14 +27,19 @@ class BackendServiceCdnPolicyCacheKeyPolicy attr_reader :query_string_whitelist - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @include_host = args['includeHost'] @include_protocol = args['includeProtocol'] @include_query_string = args['includeQueryString'] @query_string_blacklist = args['queryStringBlacklist'] @query_string_whitelist = args['queryStringWhitelist'] end + + def to_s + "#{@parent_identifier} BackendServiceCdnPolicyCacheKeyPolicy" + end end end end diff --git a/libraries/google/compute/property/backendservice_connection_draining.rb b/libraries/google/compute/property/backendservice_connection_draining.rb index 4e9fa9ac6..0234527a1 100644 --- a/libraries/google/compute/property/backendservice_connection_draining.rb +++ b/libraries/google/compute/property/backendservice_connection_draining.rb @@ -19,10 +19,15 @@ module Property class BackendServiceConnectionDraining attr_reader :draining_timeout_sec - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @draining_timeout_sec = args['drainingTimeoutSec'] end + + def to_s + "#{@parent_identifier} BackendServiceConnectionDraining" + end end end end diff --git a/libraries/google/compute/property/backendservice_iap.rb b/libraries/google/compute/property/backendservice_iap.rb index 463d16371..a45e3e2ef 100644 --- a/libraries/google/compute/property/backendservice_iap.rb +++ b/libraries/google/compute/property/backendservice_iap.rb @@ -25,13 +25,18 @@ class BackendServiceIap attr_reader :oauth2_client_secret_sha256 - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @enabled = args['enabled'] @oauth2_client_id = args['oauth2ClientId'] @oauth2_client_secret = args['oauth2ClientSecret'] @oauth2_client_secret_sha256 = args['oauth2ClientSecretSha256'] end + + def to_s + "#{@parent_identifier} BackendServiceIap" + end end end end diff --git a/libraries/google/compute/property/disk_disk_encryption_key.rb b/libraries/google/compute/property/disk_disk_encryption_key.rb index be114da0c..219698820 100644 --- a/libraries/google/compute/property/disk_disk_encryption_key.rb +++ b/libraries/google/compute/property/disk_disk_encryption_key.rb @@ -23,12 +23,17 @@ class DiskDiskEncryptionKey attr_reader :kms_key_name - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @raw_key = args['rawKey'] @sha256 = args['sha256'] @kms_key_name = args['kmsKeyName'] end + + def to_s + "#{@parent_identifier} DiskDiskEncryptionKey" + end end end end diff --git a/libraries/google/compute/property/disk_source_image_encryption_key.rb b/libraries/google/compute/property/disk_source_image_encryption_key.rb index 3eceba6ee..14cbdd2f3 100644 --- a/libraries/google/compute/property/disk_source_image_encryption_key.rb +++ b/libraries/google/compute/property/disk_source_image_encryption_key.rb @@ -23,12 +23,17 @@ class DiskSourceImageEncryptionKey attr_reader :kms_key_name - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @raw_key = args['rawKey'] @sha256 = args['sha256'] @kms_key_name = args['kmsKeyName'] end + + def to_s + "#{@parent_identifier} DiskSourceImageEncryptionKey" + end end end end diff --git a/libraries/google/compute/property/disk_source_snapshot_encryption_key.rb b/libraries/google/compute/property/disk_source_snapshot_encryption_key.rb index 3ffd8ccbc..4dce32824 100644 --- a/libraries/google/compute/property/disk_source_snapshot_encryption_key.rb +++ b/libraries/google/compute/property/disk_source_snapshot_encryption_key.rb @@ -23,12 +23,17 @@ class DiskSourceSnapshotEncryptionKey attr_reader :sha256 - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @raw_key = args['rawKey'] @kms_key_name = args['kmsKeyName'] @sha256 = args['sha256'] end + + def to_s + "#{@parent_identifier} DiskSourceSnapshotEncryptionKey" + end end end end diff --git a/libraries/google/compute/property/healthcheck_http_health_check.rb b/libraries/google/compute/property/healthcheck_http_health_check.rb index 8a6cd6c5d..b6f126aee 100644 --- a/libraries/google/compute/property/healthcheck_http_health_check.rb +++ b/libraries/google/compute/property/healthcheck_http_health_check.rb @@ -29,8 +29,9 @@ class HealthCheckHttpHealthCheck attr_reader :proxy_header - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @host = args['host'] @request_path = args['requestPath'] @response = args['response'] @@ -38,6 +39,10 @@ def initialize(args = nil) @port_name = args['portName'] @proxy_header = args['proxyHeader'] end + + def to_s + "#{@parent_identifier} HealthCheckHttpHealthCheck" + end end end end diff --git a/libraries/google/compute/property/healthcheck_https_health_check.rb b/libraries/google/compute/property/healthcheck_https_health_check.rb index 3cab46ee3..62c7f9ae1 100644 --- a/libraries/google/compute/property/healthcheck_https_health_check.rb +++ b/libraries/google/compute/property/healthcheck_https_health_check.rb @@ -29,8 +29,9 @@ class HealthCheckHttpsHealthCheck attr_reader :proxy_header - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @host = args['host'] @request_path = args['requestPath'] @response = args['response'] @@ -38,6 +39,10 @@ def initialize(args = nil) @port_name = args['portName'] @proxy_header = args['proxyHeader'] end + + def to_s + "#{@parent_identifier} HealthCheckHttpsHealthCheck" + end end end end diff --git a/libraries/google/compute/property/healthcheck_ssl_health_check.rb b/libraries/google/compute/property/healthcheck_ssl_health_check.rb index 61a56fff8..842df54c1 100644 --- a/libraries/google/compute/property/healthcheck_ssl_health_check.rb +++ b/libraries/google/compute/property/healthcheck_ssl_health_check.rb @@ -27,14 +27,19 @@ class HealthCheckSslHealthCheck attr_reader :proxy_header - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @request = args['request'] @response = args['response'] @port = args['port'] @port_name = args['portName'] @proxy_header = args['proxyHeader'] end + + def to_s + "#{@parent_identifier} HealthCheckSslHealthCheck" + end end end end diff --git a/libraries/google/compute/property/healthcheck_tcp_health_check.rb b/libraries/google/compute/property/healthcheck_tcp_health_check.rb index 53e4a788e..1fb0ba571 100644 --- a/libraries/google/compute/property/healthcheck_tcp_health_check.rb +++ b/libraries/google/compute/property/healthcheck_tcp_health_check.rb @@ -27,14 +27,19 @@ class HealthCheckTcpHealthCheck attr_reader :proxy_header - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @request = args['request'] @response = args['response'] @port = args['port'] @port_name = args['portName'] @proxy_header = args['proxyHeader'] end + + def to_s + "#{@parent_identifier} HealthCheckTcpHealthCheck" + end end end end diff --git a/libraries/google/compute/property/instancegroupmanager_current_actions.rb b/libraries/google/compute/property/instancegroupmanager_current_actions.rb index 12f0057a8..b4e766866 100644 --- a/libraries/google/compute/property/instancegroupmanager_current_actions.rb +++ b/libraries/google/compute/property/instancegroupmanager_current_actions.rb @@ -33,8 +33,9 @@ class InstanceGroupManagerCurrentActions attr_reader :restarting - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @abandoning = args['abandoning'] @creating = args['creating'] @creating_without_retries = args['creatingWithoutRetries'] @@ -44,6 +45,10 @@ def initialize(args = nil) @refreshing = args['refreshing'] @restarting = args['restarting'] end + + def to_s + "#{@parent_identifier} InstanceGroupManagerCurrentActions" + end end end end diff --git a/libraries/google/compute/property/instancegroupmanager_named_ports.rb b/libraries/google/compute/property/instancegroupmanager_named_ports.rb index 7873ea742..1482a38f7 100644 --- a/libraries/google/compute/property/instancegroupmanager_named_ports.rb +++ b/libraries/google/compute/property/instancegroupmanager_named_ports.rb @@ -21,18 +21,23 @@ class InstanceGroupManagerNamedPorts attr_reader :port - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @name = args['name'] @port = args['port'] end + + def to_s + "#{@parent_identifier} InstanceGroupManagerNamedPorts" + end end class InstanceGroupManagerNamedPortsArray - def self.parse(value) + def self.parse(value, parent_identifier) return if value.nil? - return InstanceGroupManagerNamedPorts.new(value) unless value.is_a?(::Array) - value.map { |v| InstanceGroupManagerNamedPorts.new(v) } + return InstanceGroupManagerNamedPorts.new(value, parent_identifier) unless value.is_a?(::Array) + value.map { |v| InstanceGroupManagerNamedPorts.new(v, parent_identifier) } end end end diff --git a/libraries/google/compute/property/instancetemplate_properties.rb b/libraries/google/compute/property/instancetemplate_properties.rb index d5bb51c1f..46844803f 100644 --- a/libraries/google/compute/property/instancetemplate_properties.rb +++ b/libraries/google/compute/property/instancetemplate_properties.rb @@ -45,19 +45,24 @@ class InstanceTemplateProperties attr_reader :tags - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @can_ip_forward = args['canIpForward'] @description = args['description'] - @disks = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesDisksArray.parse(args['disks']) + @disks = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesDisksArray.parse(args['disks'], to_s) @machine_type = args['machineType'] @min_cpu_platform = args['minCpuPlatform'] @metadata = args['metadata'] - @guest_accelerators = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesGuestAcceleratorsArray.parse(args['guestAccelerators']) - @network_interfaces = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesNetworkInterfacesArray.parse(args['networkInterfaces']) - @scheduling = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesScheduling.new(args['scheduling']) - @service_accounts = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesServiceAccountsArray.parse(args['serviceAccounts']) - @tags = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesTags.new(args['tags']) + @guest_accelerators = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesGuestAcceleratorsArray.parse(args['guestAccelerators'], to_s) + @network_interfaces = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesNetworkInterfacesArray.parse(args['networkInterfaces'], to_s) + @scheduling = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesScheduling.new(args['scheduling'], to_s) + @service_accounts = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesServiceAccountsArray.parse(args['serviceAccounts'], to_s) + @tags = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesTags.new(args['tags'], to_s) + end + + def to_s + "#{@parent_identifier} InstanceTemplateProperties" end end end diff --git a/libraries/google/compute/property/instancetemplate_properties_disks.rb b/libraries/google/compute/property/instancetemplate_properties_disks.rb index f939d3ffa..4d7782229 100644 --- a/libraries/google/compute/property/instancetemplate_properties_disks.rb +++ b/libraries/google/compute/property/instancetemplate_properties_disks.rb @@ -40,26 +40,31 @@ class InstanceTemplatePropertiesDisks attr_reader :type - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @auto_delete = args['autoDelete'] @boot = args['boot'] @device_name = args['deviceName'] - @disk_encryption_key = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesDisksDiskEncryptionKey.new(args['diskEncryptionKey']) + @disk_encryption_key = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesDisksDiskEncryptionKey.new(args['diskEncryptionKey'], to_s) @index = args['index'] - @initialize_params = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesDisksInitializeParams.new(args['initializeParams']) + @initialize_params = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesDisksInitializeParams.new(args['initializeParams'], to_s) @interface = args['interface'] @mode = args['mode'] @source = args['source'] @type = args['type'] end + + def to_s + "#{@parent_identifier} InstanceTemplatePropertiesDisks" + end end class InstanceTemplatePropertiesDisksArray - def self.parse(value) + def self.parse(value, parent_identifier) return if value.nil? - return InstanceTemplatePropertiesDisks.new(value) unless value.is_a?(::Array) - value.map { |v| InstanceTemplatePropertiesDisks.new(v) } + return InstanceTemplatePropertiesDisks.new(value, parent_identifier) unless value.is_a?(::Array) + value.map { |v| InstanceTemplatePropertiesDisks.new(v, parent_identifier) } end end end diff --git a/libraries/google/compute/property/instancetemplate_properties_disks_disk_encryption_key.rb b/libraries/google/compute/property/instancetemplate_properties_disks_disk_encryption_key.rb index 6eedb60d1..bcf9c8f6f 100644 --- a/libraries/google/compute/property/instancetemplate_properties_disks_disk_encryption_key.rb +++ b/libraries/google/compute/property/instancetemplate_properties_disks_disk_encryption_key.rb @@ -23,12 +23,17 @@ class InstanceTemplatePropertiesDisksDiskEncryptionKey attr_reader :sha256 - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @raw_key = args['rawKey'] @rsa_encrypted_key = args['rsaEncryptedKey'] @sha256 = args['sha256'] end + + def to_s + "#{@parent_identifier} InstanceTemplatePropertiesDisksDiskEncryptionKey" + end end end end diff --git a/libraries/google/compute/property/instancetemplate_properties_disks_initialize_params.rb b/libraries/google/compute/property/instancetemplate_properties_disks_initialize_params.rb index a0ce90f1f..6e35f0910 100644 --- a/libraries/google/compute/property/instancetemplate_properties_disks_initialize_params.rb +++ b/libraries/google/compute/property/instancetemplate_properties_disks_initialize_params.rb @@ -28,13 +28,18 @@ class InstanceTemplatePropertiesDisksInitializeParams attr_reader :source_image_encryption_key - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @disk_name = args['diskName'] @disk_size_gb = args['diskSizeGb'] @disk_type = args['diskType'] @source_image = args['sourceImage'] - @source_image_encryption_key = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesDisksInitializeParamsSourceImageEncryptionKey.new(args['sourceImageEncryptionKey']) + @source_image_encryption_key = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesDisksInitializeParamsSourceImageEncryptionKey.new(args['sourceImageEncryptionKey'], to_s) + end + + def to_s + "#{@parent_identifier} InstanceTemplatePropertiesDisksInitializeParams" end end end diff --git a/libraries/google/compute/property/instancetemplate_properties_disks_initialize_params_source_image_encryption_key.rb b/libraries/google/compute/property/instancetemplate_properties_disks_initialize_params_source_image_encryption_key.rb index 3b2aeee8f..022236927 100644 --- a/libraries/google/compute/property/instancetemplate_properties_disks_initialize_params_source_image_encryption_key.rb +++ b/libraries/google/compute/property/instancetemplate_properties_disks_initialize_params_source_image_encryption_key.rb @@ -21,11 +21,16 @@ class InstanceTemplatePropertiesDisksInitializeParamsSourceImageEncryptionKey attr_reader :sha256 - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @raw_key = args['rawKey'] @sha256 = args['sha256'] end + + def to_s + "#{@parent_identifier} InstanceTemplatePropertiesDisksInitializeParamsSourceImageEncryptionKey" + end end end end diff --git a/libraries/google/compute/property/instancetemplate_properties_guest_accelerators.rb b/libraries/google/compute/property/instancetemplate_properties_guest_accelerators.rb index 7d9c31795..8f1271d6d 100644 --- a/libraries/google/compute/property/instancetemplate_properties_guest_accelerators.rb +++ b/libraries/google/compute/property/instancetemplate_properties_guest_accelerators.rb @@ -21,18 +21,23 @@ class InstanceTemplatePropertiesGuestAccelerators attr_reader :accelerator_type - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @accelerator_count = args['acceleratorCount'] @accelerator_type = args['acceleratorType'] end + + def to_s + "#{@parent_identifier} InstanceTemplatePropertiesGuestAccelerators" + end end class InstanceTemplatePropertiesGuestAcceleratorsArray - def self.parse(value) + def self.parse(value, parent_identifier) return if value.nil? - return InstanceTemplatePropertiesGuestAccelerators.new(value) unless value.is_a?(::Array) - value.map { |v| InstanceTemplatePropertiesGuestAccelerators.new(v) } + return InstanceTemplatePropertiesGuestAccelerators.new(value, parent_identifier) unless value.is_a?(::Array) + value.map { |v| InstanceTemplatePropertiesGuestAccelerators.new(v, parent_identifier) } end end end diff --git a/libraries/google/compute/property/instancetemplate_properties_network_interfaces.rb b/libraries/google/compute/property/instancetemplate_properties_network_interfaces.rb index f00f46dae..73f83a631 100644 --- a/libraries/google/compute/property/instancetemplate_properties_network_interfaces.rb +++ b/libraries/google/compute/property/instancetemplate_properties_network_interfaces.rb @@ -31,22 +31,27 @@ class InstanceTemplatePropertiesNetworkInterfaces attr_reader :subnetwork - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? - @access_configs = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesNetworkInterfacesAccessConfigsArray.parse(args['accessConfigs']) - @alias_ip_ranges = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesNetworkInterfacesAliasIpRangesArray.parse(args['aliasIpRanges']) + @parent_identifier = parent_identifier + @access_configs = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesNetworkInterfacesAccessConfigsArray.parse(args['accessConfigs'], to_s) + @alias_ip_ranges = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesNetworkInterfacesAliasIpRangesArray.parse(args['aliasIpRanges'], to_s) @name = args['name'] @network = args['network'] @network_ip = args['networkIP'] @subnetwork = args['subnetwork'] end + + def to_s + "#{@parent_identifier} InstanceTemplatePropertiesNetworkInterfaces" + end end class InstanceTemplatePropertiesNetworkInterfacesArray - def self.parse(value) + def self.parse(value, parent_identifier) return if value.nil? - return InstanceTemplatePropertiesNetworkInterfaces.new(value) unless value.is_a?(::Array) - value.map { |v| InstanceTemplatePropertiesNetworkInterfaces.new(v) } + return InstanceTemplatePropertiesNetworkInterfaces.new(value, parent_identifier) unless value.is_a?(::Array) + value.map { |v| InstanceTemplatePropertiesNetworkInterfaces.new(v, parent_identifier) } end end end diff --git a/libraries/google/compute/property/instancetemplate_properties_network_interfaces_access_configs.rb b/libraries/google/compute/property/instancetemplate_properties_network_interfaces_access_configs.rb index 89c6c394d..6396fddcb 100644 --- a/libraries/google/compute/property/instancetemplate_properties_network_interfaces_access_configs.rb +++ b/libraries/google/compute/property/instancetemplate_properties_network_interfaces_access_configs.rb @@ -23,19 +23,24 @@ class InstanceTemplatePropertiesNetworkInterfacesAccessConfigs attr_reader :type - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @name = args['name'] @nat_ip = args['natIP'] @type = args['type'] end + + def to_s + "#{@parent_identifier} InstanceTemplatePropertiesNetworkInterfacesAccessConfigs" + end end class InstanceTemplatePropertiesNetworkInterfacesAccessConfigsArray - def self.parse(value) + def self.parse(value, parent_identifier) return if value.nil? - return InstanceTemplatePropertiesNetworkInterfacesAccessConfigs.new(value) unless value.is_a?(::Array) - value.map { |v| InstanceTemplatePropertiesNetworkInterfacesAccessConfigs.new(v) } + return InstanceTemplatePropertiesNetworkInterfacesAccessConfigs.new(value, parent_identifier) unless value.is_a?(::Array) + value.map { |v| InstanceTemplatePropertiesNetworkInterfacesAccessConfigs.new(v, parent_identifier) } end end end diff --git a/libraries/google/compute/property/instancetemplate_properties_network_interfaces_alias_ip_ranges.rb b/libraries/google/compute/property/instancetemplate_properties_network_interfaces_alias_ip_ranges.rb index 1fdaad384..f4205d742 100644 --- a/libraries/google/compute/property/instancetemplate_properties_network_interfaces_alias_ip_ranges.rb +++ b/libraries/google/compute/property/instancetemplate_properties_network_interfaces_alias_ip_ranges.rb @@ -21,18 +21,23 @@ class InstanceTemplatePropertiesNetworkInterfacesAliasIpRanges attr_reader :subnetwork_range_name - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @ip_cidr_range = args['ipCidrRange'] @subnetwork_range_name = args['subnetworkRangeName'] end + + def to_s + "#{@parent_identifier} InstanceTemplatePropertiesNetworkInterfacesAliasIpRanges" + end end class InstanceTemplatePropertiesNetworkInterfacesAliasIpRangesArray - def self.parse(value) + def self.parse(value, parent_identifier) return if value.nil? - return InstanceTemplatePropertiesNetworkInterfacesAliasIpRanges.new(value) unless value.is_a?(::Array) - value.map { |v| InstanceTemplatePropertiesNetworkInterfacesAliasIpRanges.new(v) } + return InstanceTemplatePropertiesNetworkInterfacesAliasIpRanges.new(value, parent_identifier) unless value.is_a?(::Array) + value.map { |v| InstanceTemplatePropertiesNetworkInterfacesAliasIpRanges.new(v, parent_identifier) } end end end diff --git a/libraries/google/compute/property/instancetemplate_properties_scheduling.rb b/libraries/google/compute/property/instancetemplate_properties_scheduling.rb index 78eeb5591..cf909758e 100644 --- a/libraries/google/compute/property/instancetemplate_properties_scheduling.rb +++ b/libraries/google/compute/property/instancetemplate_properties_scheduling.rb @@ -23,12 +23,17 @@ class InstanceTemplatePropertiesScheduling attr_reader :preemptible - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @automatic_restart = args['automaticRestart'] @on_host_maintenance = args['onHostMaintenance'] @preemptible = args['preemptible'] end + + def to_s + "#{@parent_identifier} InstanceTemplatePropertiesScheduling" + end end end end diff --git a/libraries/google/compute/property/instancetemplate_properties_service_accounts.rb b/libraries/google/compute/property/instancetemplate_properties_service_accounts.rb index ec7ba2f3b..85ca02e7b 100644 --- a/libraries/google/compute/property/instancetemplate_properties_service_accounts.rb +++ b/libraries/google/compute/property/instancetemplate_properties_service_accounts.rb @@ -21,18 +21,23 @@ class InstanceTemplatePropertiesServiceAccounts attr_reader :scopes - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @email = args['email'] @scopes = args['scopes'] end + + def to_s + "#{@parent_identifier} InstanceTemplatePropertiesServiceAccounts" + end end class InstanceTemplatePropertiesServiceAccountsArray - def self.parse(value) + def self.parse(value, parent_identifier) return if value.nil? - return InstanceTemplatePropertiesServiceAccounts.new(value) unless value.is_a?(::Array) - value.map { |v| InstanceTemplatePropertiesServiceAccounts.new(v) } + return InstanceTemplatePropertiesServiceAccounts.new(value, parent_identifier) unless value.is_a?(::Array) + value.map { |v| InstanceTemplatePropertiesServiceAccounts.new(v, parent_identifier) } end end end diff --git a/libraries/google/compute/property/instancetemplate_properties_tags.rb b/libraries/google/compute/property/instancetemplate_properties_tags.rb index 43da87494..6c42aa693 100644 --- a/libraries/google/compute/property/instancetemplate_properties_tags.rb +++ b/libraries/google/compute/property/instancetemplate_properties_tags.rb @@ -21,11 +21,16 @@ class InstanceTemplatePropertiesTags attr_reader :items - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @fingerprint = args['fingerprint'] @items = args['items'] end + + def to_s + "#{@parent_identifier} InstanceTemplatePropertiesTags" + end end end end diff --git a/libraries/google/compute/property/router_bgp.rb b/libraries/google/compute/property/router_bgp.rb index b650dd1cf..4d3603743 100644 --- a/libraries/google/compute/property/router_bgp.rb +++ b/libraries/google/compute/property/router_bgp.rb @@ -26,12 +26,17 @@ class RouterBgp attr_reader :advertised_ip_ranges - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @asn = args['asn'] @advertise_mode = args['advertiseMode'] @advertised_groups = args['advertisedGroups'] - @advertised_ip_ranges = GoogleInSpec::Compute::Property::RouterBgpAdvertisedIpRangesArray.parse(args['advertisedIpRanges']) + @advertised_ip_ranges = GoogleInSpec::Compute::Property::RouterBgpAdvertisedIpRangesArray.parse(args['advertisedIpRanges'], to_s) + end + + def to_s + "#{@parent_identifier} RouterBgp" end end end diff --git a/libraries/google/compute/property/router_bgp_advertised_ip_ranges.rb b/libraries/google/compute/property/router_bgp_advertised_ip_ranges.rb index 7a9740de5..5b13e7153 100644 --- a/libraries/google/compute/property/router_bgp_advertised_ip_ranges.rb +++ b/libraries/google/compute/property/router_bgp_advertised_ip_ranges.rb @@ -21,18 +21,23 @@ class RouterBgpAdvertisedIpRanges attr_reader :description - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @range = args['range'] @description = args['description'] end + + def to_s + "#{@parent_identifier} RouterBgpAdvertisedIpRanges" + end end class RouterBgpAdvertisedIpRangesArray - def self.parse(value) + def self.parse(value, parent_identifier) return if value.nil? - return RouterBgpAdvertisedIpRanges.new(value) unless value.is_a?(::Array) - value.map { |v| RouterBgpAdvertisedIpRanges.new(v) } + return RouterBgpAdvertisedIpRanges.new(value, parent_identifier) unless value.is_a?(::Array) + value.map { |v| RouterBgpAdvertisedIpRanges.new(v, parent_identifier) } end end end diff --git a/libraries/google/compute/property/snapshot_snapshot_encryption_key.rb b/libraries/google/compute/property/snapshot_snapshot_encryption_key.rb index 914cdb500..c8d5410b7 100644 --- a/libraries/google/compute/property/snapshot_snapshot_encryption_key.rb +++ b/libraries/google/compute/property/snapshot_snapshot_encryption_key.rb @@ -23,12 +23,17 @@ class SnapshotSnapshotEncryptionKey attr_reader :kms_key_name - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @raw_key = args['rawKey'] @sha256 = args['sha256'] @kms_key_name = args['kmsKeyName'] end + + def to_s + "#{@parent_identifier} SnapshotSnapshotEncryptionKey" + end end end end diff --git a/libraries/google/compute/property/snapshot_source_disk_encryption_key.rb b/libraries/google/compute/property/snapshot_source_disk_encryption_key.rb index 0dcef7a97..88207fb0c 100644 --- a/libraries/google/compute/property/snapshot_source_disk_encryption_key.rb +++ b/libraries/google/compute/property/snapshot_source_disk_encryption_key.rb @@ -21,11 +21,16 @@ class SnapshotSourceDiskEncryptionKey attr_reader :kms_key_name - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @raw_key = args['rawKey'] @kms_key_name = args['kmsKeyName'] end + + def to_s + "#{@parent_identifier} SnapshotSourceDiskEncryptionKey" + end end end end diff --git a/libraries/google/compute/property/sslpolicy_warnings.rb b/libraries/google/compute/property/sslpolicy_warnings.rb index f098b9e54..6a37431ac 100644 --- a/libraries/google/compute/property/sslpolicy_warnings.rb +++ b/libraries/google/compute/property/sslpolicy_warnings.rb @@ -21,18 +21,23 @@ class SslPolicyWarnings attr_reader :message - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @code = args['code'] @message = args['message'] end + + def to_s + "#{@parent_identifier} SslPolicyWarnings" + end end class SslPolicyWarningsArray - def self.parse(value) + def self.parse(value, parent_identifier) return if value.nil? - return SslPolicyWarnings.new(value) unless value.is_a?(::Array) - value.map { |v| SslPolicyWarnings.new(v) } + return SslPolicyWarnings.new(value, parent_identifier) unless value.is_a?(::Array) + value.map { |v| SslPolicyWarnings.new(v, parent_identifier) } end end end diff --git a/libraries/google/compute/property/urlmap_host_rules.rb b/libraries/google/compute/property/urlmap_host_rules.rb index 88f700505..eab09df9c 100644 --- a/libraries/google/compute/property/urlmap_host_rules.rb +++ b/libraries/google/compute/property/urlmap_host_rules.rb @@ -23,19 +23,24 @@ class UrlMapHostRules attr_reader :path_matcher - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @description = args['description'] @hosts = args['hosts'] @path_matcher = args['pathMatcher'] end + + def to_s + "#{@parent_identifier} UrlMapHostRules" + end end class UrlMapHostRulesArray - def self.parse(value) + def self.parse(value, parent_identifier) return if value.nil? - return UrlMapHostRules.new(value) unless value.is_a?(::Array) - value.map { |v| UrlMapHostRules.new(v) } + return UrlMapHostRules.new(value, parent_identifier) unless value.is_a?(::Array) + value.map { |v| UrlMapHostRules.new(v, parent_identifier) } end end end diff --git a/libraries/google/compute/property/urlmap_path_matchers.rb b/libraries/google/compute/property/urlmap_path_matchers.rb index 000d730f7..da8563514 100644 --- a/libraries/google/compute/property/urlmap_path_matchers.rb +++ b/libraries/google/compute/property/urlmap_path_matchers.rb @@ -26,20 +26,25 @@ class UrlMapPathMatchers attr_reader :path_rules - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @default_service = args['defaultService'] @description = args['description'] @name = args['name'] - @path_rules = GoogleInSpec::Compute::Property::UrlMapPathMatchersPathRulesArray.parse(args['pathRules']) + @path_rules = GoogleInSpec::Compute::Property::UrlMapPathMatchersPathRulesArray.parse(args['pathRules'], to_s) + end + + def to_s + "#{@parent_identifier} UrlMapPathMatchers" end end class UrlMapPathMatchersArray - def self.parse(value) + def self.parse(value, parent_identifier) return if value.nil? - return UrlMapPathMatchers.new(value) unless value.is_a?(::Array) - value.map { |v| UrlMapPathMatchers.new(v) } + return UrlMapPathMatchers.new(value, parent_identifier) unless value.is_a?(::Array) + value.map { |v| UrlMapPathMatchers.new(v, parent_identifier) } end end end diff --git a/libraries/google/compute/property/urlmap_path_matchers_path_rules.rb b/libraries/google/compute/property/urlmap_path_matchers_path_rules.rb index d6d438a76..6202f915e 100644 --- a/libraries/google/compute/property/urlmap_path_matchers_path_rules.rb +++ b/libraries/google/compute/property/urlmap_path_matchers_path_rules.rb @@ -21,18 +21,23 @@ class UrlMapPathMatchersPathRules attr_reader :service - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @paths = args['paths'] @service = args['service'] end + + def to_s + "#{@parent_identifier} UrlMapPathMatchersPathRules" + end end class UrlMapPathMatchersPathRulesArray - def self.parse(value) + def self.parse(value, parent_identifier) return if value.nil? - return UrlMapPathMatchersPathRules.new(value) unless value.is_a?(::Array) - value.map { |v| UrlMapPathMatchersPathRules.new(v) } + return UrlMapPathMatchersPathRules.new(value, parent_identifier) unless value.is_a?(::Array) + value.map { |v| UrlMapPathMatchersPathRules.new(v, parent_identifier) } end end end diff --git a/libraries/google/compute/property/urlmap_tests.rb b/libraries/google/compute/property/urlmap_tests.rb index 96251ca26..33d91fa02 100644 --- a/libraries/google/compute/property/urlmap_tests.rb +++ b/libraries/google/compute/property/urlmap_tests.rb @@ -25,20 +25,25 @@ class UrlMapTests attr_reader :service - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @description = args['description'] @host = args['host'] @path = args['path'] @service = args['service'] end + + def to_s + "#{@parent_identifier} UrlMapTests" + end end class UrlMapTestsArray - def self.parse(value) + def self.parse(value, parent_identifier) return if value.nil? - return UrlMapTests.new(value) unless value.is_a?(::Array) - value.map { |v| UrlMapTests.new(v) } + return UrlMapTests.new(value, parent_identifier) unless value.is_a?(::Array) + value.map { |v| UrlMapTests.new(v, parent_identifier) } end end end diff --git a/libraries/google/container/property/regionalcluster_addons_config.rb b/libraries/google/container/property/regionalcluster_addons_config.rb index e5c2a957d..7990a3339 100644 --- a/libraries/google/container/property/regionalcluster_addons_config.rb +++ b/libraries/google/container/property/regionalcluster_addons_config.rb @@ -23,10 +23,15 @@ class RegionalClusterAddonsConfig attr_reader :horizontal_pod_autoscaling - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? - @http_load_balancing = GoogleInSpec::Container::Property::RegionalClusterAddonsConfigHttpLoadBalancing.new(args['httpLoadBalancing']) - @horizontal_pod_autoscaling = GoogleInSpec::Container::Property::RegionalClusterAddonsConfigHorizontalPodAutoscaling.new(args['horizontalPodAutoscaling']) + @parent_identifier = parent_identifier + @http_load_balancing = GoogleInSpec::Container::Property::RegionalClusterAddonsConfigHttpLoadBalancing.new(args['httpLoadBalancing'], to_s) + @horizontal_pod_autoscaling = GoogleInSpec::Container::Property::RegionalClusterAddonsConfigHorizontalPodAutoscaling.new(args['horizontalPodAutoscaling'], to_s) + end + + def to_s + "#{@parent_identifier} RegionalClusterAddonsConfig" end end end diff --git a/libraries/google/container/property/regionalcluster_addons_config_horizontal_pod_autoscaling.rb b/libraries/google/container/property/regionalcluster_addons_config_horizontal_pod_autoscaling.rb index f0b313863..1feff5e48 100644 --- a/libraries/google/container/property/regionalcluster_addons_config_horizontal_pod_autoscaling.rb +++ b/libraries/google/container/property/regionalcluster_addons_config_horizontal_pod_autoscaling.rb @@ -19,10 +19,15 @@ module Property class RegionalClusterAddonsConfigHorizontalPodAutoscaling attr_reader :disabled - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @disabled = args['disabled'] end + + def to_s + "#{@parent_identifier} RegionalClusterAddonsConfigHorizontalPodAutoscaling" + end end end end diff --git a/libraries/google/container/property/regionalcluster_addons_config_http_load_balancing.rb b/libraries/google/container/property/regionalcluster_addons_config_http_load_balancing.rb index 0ebf124c7..35c6ed2b0 100644 --- a/libraries/google/container/property/regionalcluster_addons_config_http_load_balancing.rb +++ b/libraries/google/container/property/regionalcluster_addons_config_http_load_balancing.rb @@ -19,10 +19,15 @@ module Property class RegionalClusterAddonsConfigHttpLoadBalancing attr_reader :disabled - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @disabled = args['disabled'] end + + def to_s + "#{@parent_identifier} RegionalClusterAddonsConfigHttpLoadBalancing" + end end end end diff --git a/libraries/google/container/property/regionalcluster_master_auth.rb b/libraries/google/container/property/regionalcluster_master_auth.rb index ddff46095..d84e74afb 100644 --- a/libraries/google/container/property/regionalcluster_master_auth.rb +++ b/libraries/google/container/property/regionalcluster_master_auth.rb @@ -27,14 +27,19 @@ class RegionalClusterMasterAuth attr_reader :client_key - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @username = args['username'] @password = args['password'] @cluster_ca_certificate = args['clusterCaCertificate'] @client_certificate = args['clientCertificate'] @client_key = args['clientKey'] end + + def to_s + "#{@parent_identifier} RegionalClusterMasterAuth" + end end end end diff --git a/libraries/google/container/property/regionalcluster_node_config.rb b/libraries/google/container/property/regionalcluster_node_config.rb index 97755ad6c..70e3ae76e 100644 --- a/libraries/google/container/property/regionalcluster_node_config.rb +++ b/libraries/google/container/property/regionalcluster_node_config.rb @@ -37,8 +37,9 @@ class RegionalClusterNodeConfig attr_reader :preemptible - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @machine_type = args['machineType'] @disk_size_gb = args['diskSizeGb'] @oauth_scopes = args['oauthScopes'] @@ -50,6 +51,10 @@ def initialize(args = nil) @tags = args['tags'] @preemptible = args['preemptible'] end + + def to_s + "#{@parent_identifier} RegionalClusterNodeConfig" + end end end end diff --git a/libraries/google/container/property/regionalcluster_private_cluster_config.rb b/libraries/google/container/property/regionalcluster_private_cluster_config.rb index 09476fd30..39c96bc51 100644 --- a/libraries/google/container/property/regionalcluster_private_cluster_config.rb +++ b/libraries/google/container/property/regionalcluster_private_cluster_config.rb @@ -27,14 +27,19 @@ class RegionalClusterPrivateClusterConfig attr_reader :public_endpoint - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @enable_private_nodes = args['enablePrivateNodes'] @enable_private_endpoint = args['enablePrivateEndpoint'] @master_ipv4_cidr_block = args['masterIpv4CidrBlock'] @private_endpoint = args['privateEndpoint'] @public_endpoint = args['publicEndpoint'] end + + def to_s + "#{@parent_identifier} RegionalClusterPrivateClusterConfig" + end end end end diff --git a/libraries/google/pubsub/property/subscription_push_config.rb b/libraries/google/pubsub/property/subscription_push_config.rb index 22a06e45b..ef547d660 100644 --- a/libraries/google/pubsub/property/subscription_push_config.rb +++ b/libraries/google/pubsub/property/subscription_push_config.rb @@ -21,11 +21,16 @@ class SubscriptionPushConfig attr_reader :attributes - def initialize(args = nil) + def initialize(args = nil, parent_identifier = nil) return if args.nil? + @parent_identifier = parent_identifier @push_endpoint = args['pushEndpoint'] @attributes = args['attributes'] end + + def to_s + "#{@parent_identifier} SubscriptionPushConfig" + end end end end diff --git a/libraries/google_bigquery_dataset.rb b/libraries/google_bigquery_dataset.rb index 863dc2460..a7816fe80 100644 --- a/libraries/google_bigquery_dataset.rb +++ b/libraries/google_bigquery_dataset.rb @@ -23,6 +23,7 @@ class Dataset < GcpResourceBase desc 'Dataset' supports platform: 'gcp' + attr_reader :params attr_reader :access attr_reader :creation_time attr_reader :dataset_reference @@ -36,14 +37,15 @@ class Dataset < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end def parse - @access = GoogleInSpec::BigQuery::Property::DatasetAccessArray.parse(@fetched['access']) + @access = GoogleInSpec::BigQuery::Property::DatasetAccessArray.parse(@fetched['access'], to_s) @creation_time = @fetched['creationTime'] - @dataset_reference = GoogleInSpec::BigQuery::Property::DatasetDatasetReference.new(@fetched['datasetReference']) + @dataset_reference = GoogleInSpec::BigQuery::Property::DatasetDatasetReference.new(@fetched['datasetReference'], to_s) @default_table_expiration_ms = @fetched['defaultTableExpirationMs'] @description = @fetched['description'] @friendly_name = @fetched['friendlyName'] @@ -62,6 +64,10 @@ def exists? !@fetched.nil? end + def to_s + "Dataset #{@params[:name]}" + end + def name dataset_reference&.dataset_id end diff --git a/libraries/google_bigquery_datasets.rb b/libraries/google_bigquery_datasets.rb index ce0cb3f0f..2f791e7d9 100644 --- a/libraries/google_bigquery_datasets.rb +++ b/libraries/google_bigquery_datasets.rb @@ -67,7 +67,7 @@ def transform(key, value) def transformers { - 'datasetReference' => ->(obj) { return :dataset_reference, GoogleInSpec::BigQuery::Property::DatasetDatasetReference.new(obj['datasetReference']) }, + 'datasetReference' => ->(obj) { return :dataset_reference, GoogleInSpec::BigQuery::Property::DatasetDatasetReference.new(obj['datasetReference'], to_s) }, 'friendlyName' => ->(obj) { return :friendly_name, obj['friendlyName'] }, 'id' => ->(obj) { return :id, obj['id'] }, 'labels' => ->(obj) { return :labels, obj['labels'] }, diff --git a/libraries/google_bigquery_table.rb b/libraries/google_bigquery_table.rb index 1adfa2c5e..7287c5422 100644 --- a/libraries/google_bigquery_table.rb +++ b/libraries/google_bigquery_table.rb @@ -36,6 +36,7 @@ class Table < GcpResourceBase desc 'Table' supports platform: 'gcp' + attr_reader :params attr_reader :table_reference attr_reader :creation_time attr_reader :description @@ -60,12 +61,13 @@ class Table < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end def parse - @table_reference = GoogleInSpec::BigQuery::Property::TableTableReference.new(@fetched['tableReference']) + @table_reference = GoogleInSpec::BigQuery::Property::TableTableReference.new(@fetched['tableReference'], to_s) @creation_time = @fetched['creationTime'] @description = @fetched['description'] @friendly_name = @fetched['friendlyName'] @@ -78,13 +80,13 @@ def parse @num_long_term_bytes = @fetched['numLongTermBytes'] @num_rows = @fetched['numRows'] @type = @fetched['type'] - @view = GoogleInSpec::BigQuery::Property::TableView.new(@fetched['view']) - @time_partitioning = GoogleInSpec::BigQuery::Property::TableTimePartitioning.new(@fetched['timePartitioning']) - @streaming_buffer = GoogleInSpec::BigQuery::Property::TableStreamingBuffer.new(@fetched['streamingBuffer']) - @schema = GoogleInSpec::BigQuery::Property::TableSchema.new(@fetched['schema']) - @encryption_configuration = GoogleInSpec::BigQuery::Property::TableEncryptionConfiguration.new(@fetched['encryptionConfiguration']) + @view = GoogleInSpec::BigQuery::Property::TableView.new(@fetched['view'], to_s) + @time_partitioning = GoogleInSpec::BigQuery::Property::TableTimePartitioning.new(@fetched['timePartitioning'], to_s) + @streaming_buffer = GoogleInSpec::BigQuery::Property::TableStreamingBuffer.new(@fetched['streamingBuffer'], to_s) + @schema = GoogleInSpec::BigQuery::Property::TableSchema.new(@fetched['schema'], to_s) + @encryption_configuration = GoogleInSpec::BigQuery::Property::TableEncryptionConfiguration.new(@fetched['encryptionConfiguration'], to_s) @expiration_time = @fetched['expirationTime'] - @external_data_configuration = GoogleInSpec::BigQuery::Property::TableExternalDataConfiguration.new(@fetched['externalDataConfiguration']) + @external_data_configuration = GoogleInSpec::BigQuery::Property::TableExternalDataConfiguration.new(@fetched['externalDataConfiguration'], to_s) @dataset = @fetched['dataset'] end @@ -97,6 +99,10 @@ def exists? !@fetched.nil? end + def to_s + "Table #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_bigquery_tables.rb b/libraries/google_bigquery_tables.rb index b07711419..816b37e21 100644 --- a/libraries/google_bigquery_tables.rb +++ b/libraries/google_bigquery_tables.rb @@ -81,7 +81,7 @@ def transform(key, value) def transformers { - 'tableReference' => ->(obj) { return :table_reference, GoogleInSpec::BigQuery::Property::TableTableReference.new(obj['tableReference']) }, + 'tableReference' => ->(obj) { return :table_reference, GoogleInSpec::BigQuery::Property::TableTableReference.new(obj['tableReference'], to_s) }, 'creationTime' => ->(obj) { return :creation_time, obj['creationTime'] }, 'friendlyName' => ->(obj) { return :friendly_name, obj['friendlyName'] }, 'id' => ->(obj) { return :id, obj['id'] }, @@ -92,13 +92,13 @@ def transformers 'numLongTermBytes' => ->(obj) { return :num_long_term_bytes, obj['numLongTermBytes'] }, 'numRows' => ->(obj) { return :num_rows, obj['numRows'] }, 'type' => ->(obj) { return :type, obj['type'] }, - 'view' => ->(obj) { return :view, GoogleInSpec::BigQuery::Property::TableView.new(obj['view']) }, - 'timePartitioning' => ->(obj) { return :time_partitioning, GoogleInSpec::BigQuery::Property::TableTimePartitioning.new(obj['timePartitioning']) }, - 'streamingBuffer' => ->(obj) { return :streaming_buffer, GoogleInSpec::BigQuery::Property::TableStreamingBuffer.new(obj['streamingBuffer']) }, - 'schema' => ->(obj) { return :schema, GoogleInSpec::BigQuery::Property::TableSchema.new(obj['schema']) }, - 'encryptionConfiguration' => ->(obj) { return :encryption_configuration, GoogleInSpec::BigQuery::Property::TableEncryptionConfiguration.new(obj['encryptionConfiguration']) }, + 'view' => ->(obj) { return :view, GoogleInSpec::BigQuery::Property::TableView.new(obj['view'], to_s) }, + 'timePartitioning' => ->(obj) { return :time_partitioning, GoogleInSpec::BigQuery::Property::TableTimePartitioning.new(obj['timePartitioning'], to_s) }, + 'streamingBuffer' => ->(obj) { return :streaming_buffer, GoogleInSpec::BigQuery::Property::TableStreamingBuffer.new(obj['streamingBuffer'], to_s) }, + 'schema' => ->(obj) { return :schema, GoogleInSpec::BigQuery::Property::TableSchema.new(obj['schema'], to_s) }, + 'encryptionConfiguration' => ->(obj) { return :encryption_configuration, GoogleInSpec::BigQuery::Property::TableEncryptionConfiguration.new(obj['encryptionConfiguration'], to_s) }, 'expirationTime' => ->(obj) { return :expiration_time, obj['expirationTime'] }, - 'externalDataConfiguration' => ->(obj) { return :external_data_configuration, GoogleInSpec::BigQuery::Property::TableExternalDataConfiguration.new(obj['externalDataConfiguration']) }, + 'externalDataConfiguration' => ->(obj) { return :external_data_configuration, GoogleInSpec::BigQuery::Property::TableExternalDataConfiguration.new(obj['externalDataConfiguration'], to_s) }, 'dataset' => ->(obj) { return :dataset, obj['dataset'] }, } end diff --git a/libraries/google_cloudbuild_trigger.rb b/libraries/google_cloudbuild_trigger.rb index 071af6f7c..0153cd7ff 100644 --- a/libraries/google_cloudbuild_trigger.rb +++ b/libraries/google_cloudbuild_trigger.rb @@ -24,6 +24,7 @@ class Trigger < GcpResourceBase desc 'Trigger' supports platform: 'gcp' + attr_reader :params attr_reader :id attr_reader :description attr_reader :disabled @@ -37,6 +38,7 @@ class Trigger < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -50,8 +52,8 @@ def parse @filename = @fetched['filename'] @ignored_files = @fetched['ignoredFiles'] @included_files = @fetched['includedFiles'] - @trigger_template = GoogleInSpec::CloudBuild::Property::TriggerTriggerTemplate.new(@fetched['triggerTemplate']) - @build = GoogleInSpec::CloudBuild::Property::TriggerBuild.new(@fetched['build']) + @trigger_template = GoogleInSpec::CloudBuild::Property::TriggerTriggerTemplate.new(@fetched['triggerTemplate'], to_s) + @build = GoogleInSpec::CloudBuild::Property::TriggerBuild.new(@fetched['build'], to_s) end # Handles parsing RFC3339 time string @@ -63,6 +65,10 @@ def exists? !@fetched.nil? end + def to_s + "Trigger #{@params[:id]}" + end + private def product_url diff --git a/libraries/google_cloudbuild_triggers.rb b/libraries/google_cloudbuild_triggers.rb index 55abd90f0..3a66e2c83 100644 --- a/libraries/google_cloudbuild_triggers.rb +++ b/libraries/google_cloudbuild_triggers.rb @@ -80,8 +80,8 @@ def transformers 'filename' => ->(obj) { return :filename, obj['filename'] }, 'ignoredFiles' => ->(obj) { return :ignored_files, obj['ignoredFiles'] }, 'includedFiles' => ->(obj) { return :included_files, obj['includedFiles'] }, - 'triggerTemplate' => ->(obj) { return :trigger_template, GoogleInSpec::CloudBuild::Property::TriggerTriggerTemplate.new(obj['triggerTemplate']) }, - 'build' => ->(obj) { return :build, GoogleInSpec::CloudBuild::Property::TriggerBuild.new(obj['build']) }, + 'triggerTemplate' => ->(obj) { return :trigger_template, GoogleInSpec::CloudBuild::Property::TriggerTriggerTemplate.new(obj['triggerTemplate'], to_s) }, + 'build' => ->(obj) { return :build, GoogleInSpec::CloudBuild::Property::TriggerBuild.new(obj['build'], to_s) }, } end diff --git a/libraries/google_compute_autoscaler.rb b/libraries/google_compute_autoscaler.rb index ea2b7beb3..38c375f1d 100644 --- a/libraries/google_compute_autoscaler.rb +++ b/libraries/google_compute_autoscaler.rb @@ -25,6 +25,7 @@ class Autoscaler < GcpResourceBase desc 'Autoscaler' supports platform: 'gcp' + attr_reader :params attr_reader :id attr_reader :creation_timestamp attr_reader :name @@ -35,6 +36,7 @@ class Autoscaler < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -44,7 +46,7 @@ def parse @creation_timestamp = parse_time_string(@fetched['creationTimestamp']) @name = @fetched['name'] @description = @fetched['description'] - @autoscaling_policy = GoogleInSpec::Compute::Property::AutoscalerAutoscalingPolicy.new(@fetched['autoscalingPolicy']) + @autoscaling_policy = GoogleInSpec::Compute::Property::AutoscalerAutoscalingPolicy.new(@fetched['autoscalingPolicy'], to_s) @target = @fetched['target'] @zone = @fetched['zone'] end @@ -58,6 +60,10 @@ def exists? !@fetched.nil? end + def to_s + "Autoscaler #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_compute_autoscalers.rb b/libraries/google_compute_autoscalers.rb index e8ee98935..951e153bf 100644 --- a/libraries/google_compute_autoscalers.rb +++ b/libraries/google_compute_autoscalers.rb @@ -73,7 +73,7 @@ def transformers 'creationTimestamp' => ->(obj) { return :creation_timestamp, parse_time_string(obj['creationTimestamp']) }, 'name' => ->(obj) { return :name, obj['name'] }, 'description' => ->(obj) { return :description, obj['description'] }, - 'autoscalingPolicy' => ->(obj) { return :autoscaling_policy, GoogleInSpec::Compute::Property::AutoscalerAutoscalingPolicy.new(obj['autoscalingPolicy']) }, + 'autoscalingPolicy' => ->(obj) { return :autoscaling_policy, GoogleInSpec::Compute::Property::AutoscalerAutoscalingPolicy.new(obj['autoscalingPolicy'], to_s) }, 'target' => ->(obj) { return :target, obj['target'] }, 'zone' => ->(obj) { return :zone, obj['zone'] }, } diff --git a/libraries/google_compute_backend_service.rb b/libraries/google_compute_backend_service.rb index 14ddf6dda..9212325fc 100644 --- a/libraries/google_compute_backend_service.rb +++ b/libraries/google_compute_backend_service.rb @@ -26,6 +26,7 @@ class BackendService < GcpResourceBase desc 'BackendService' supports platform: 'gcp' + attr_reader :params attr_reader :affinity_cookie_ttl_sec attr_reader :backends attr_reader :cdn_policy @@ -46,21 +47,22 @@ class BackendService < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end def parse @affinity_cookie_ttl_sec = @fetched['affinityCookieTtlSec'] - @backends = GoogleInSpec::Compute::Property::BackendServiceBackendsArray.parse(@fetched['backends']) - @cdn_policy = GoogleInSpec::Compute::Property::BackendServiceCdnPolicy.new(@fetched['cdnPolicy']) - @connection_draining = GoogleInSpec::Compute::Property::BackendServiceConnectionDraining.new(@fetched['connectionDraining']) + @backends = GoogleInSpec::Compute::Property::BackendServiceBackendsArray.parse(@fetched['backends'], to_s) + @cdn_policy = GoogleInSpec::Compute::Property::BackendServiceCdnPolicy.new(@fetched['cdnPolicy'], to_s) + @connection_draining = GoogleInSpec::Compute::Property::BackendServiceConnectionDraining.new(@fetched['connectionDraining'], to_s) @creation_timestamp = parse_time_string(@fetched['creationTimestamp']) @description = @fetched['description'] @enable_cdn = @fetched['enableCDN'] @health_checks = @fetched['healthChecks'] @id = @fetched['id'] - @iap = GoogleInSpec::Compute::Property::BackendServiceIap.new(@fetched['iap']) + @iap = GoogleInSpec::Compute::Property::BackendServiceIap.new(@fetched['iap'], to_s) @load_balancing_scheme = @fetched['loadBalancingScheme'] @name = @fetched['name'] @port_name = @fetched['portName'] @@ -79,6 +81,10 @@ def exists? !@fetched.nil? end + def to_s + "BackendService #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_compute_backend_services.rb b/libraries/google_compute_backend_services.rb index c98a3ad99..93789e03e 100644 --- a/libraries/google_compute_backend_services.rb +++ b/libraries/google_compute_backend_services.rb @@ -80,15 +80,15 @@ def transform(key, value) def transformers { 'affinityCookieTtlSec' => ->(obj) { return :affinity_cookie_ttl_sec, obj['affinityCookieTtlSec'] }, - 'backends' => ->(obj) { return :backends, GoogleInSpec::Compute::Property::BackendServiceBackendsArray.parse(obj['backends']) }, - 'cdnPolicy' => ->(obj) { return :cdn_policy, GoogleInSpec::Compute::Property::BackendServiceCdnPolicy.new(obj['cdnPolicy']) }, - 'connectionDraining' => ->(obj) { return :connection_draining, GoogleInSpec::Compute::Property::BackendServiceConnectionDraining.new(obj['connectionDraining']) }, + 'backends' => ->(obj) { return :backends, GoogleInSpec::Compute::Property::BackendServiceBackendsArray.parse(obj['backends'], to_s) }, + 'cdnPolicy' => ->(obj) { return :cdn_policy, GoogleInSpec::Compute::Property::BackendServiceCdnPolicy.new(obj['cdnPolicy'], to_s) }, + 'connectionDraining' => ->(obj) { return :connection_draining, GoogleInSpec::Compute::Property::BackendServiceConnectionDraining.new(obj['connectionDraining'], to_s) }, 'creationTimestamp' => ->(obj) { return :creation_timestamp, parse_time_string(obj['creationTimestamp']) }, 'description' => ->(obj) { return :description, obj['description'] }, 'enableCDN' => ->(obj) { return :enable_cdn, obj['enableCDN'] }, 'healthChecks' => ->(obj) { return :health_checks, obj['healthChecks'] }, 'id' => ->(obj) { return :id, obj['id'] }, - 'iap' => ->(obj) { return :iap, GoogleInSpec::Compute::Property::BackendServiceIap.new(obj['iap']) }, + 'iap' => ->(obj) { return :iap, GoogleInSpec::Compute::Property::BackendServiceIap.new(obj['iap'], to_s) }, 'loadBalancingScheme' => ->(obj) { return :load_balancing_scheme, obj['loadBalancingScheme'] }, 'name' => ->(obj) { return :name, obj['name'] }, 'portName' => ->(obj) { return :port_name, obj['portName'] }, diff --git a/libraries/google_compute_disk.rb b/libraries/google_compute_disk.rb index f0770012c..32c268c48 100644 --- a/libraries/google_compute_disk.rb +++ b/libraries/google_compute_disk.rb @@ -24,6 +24,7 @@ class Disk < GcpResourceBase desc 'Disk' supports platform: 'gcp' + attr_reader :params attr_reader :label_fingerprint attr_reader :creation_timestamp attr_reader :description @@ -48,6 +49,7 @@ class Disk < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -68,11 +70,11 @@ def parse @type = @fetched['type'] @source_image = @fetched['sourceImage'] @zone = @fetched['zone'] - @source_image_encryption_key = GoogleInSpec::Compute::Property::DiskSourceImageEncryptionKey.new(@fetched['sourceImageEncryptionKey']) + @source_image_encryption_key = GoogleInSpec::Compute::Property::DiskSourceImageEncryptionKey.new(@fetched['sourceImageEncryptionKey'], to_s) @source_image_id = @fetched['sourceImageId'] - @disk_encryption_key = GoogleInSpec::Compute::Property::DiskDiskEncryptionKey.new(@fetched['diskEncryptionKey']) + @disk_encryption_key = GoogleInSpec::Compute::Property::DiskDiskEncryptionKey.new(@fetched['diskEncryptionKey'], to_s) @source_snapshot = @fetched['sourceSnapshot'] - @source_snapshot_encryption_key = GoogleInSpec::Compute::Property::DiskSourceSnapshotEncryptionKey.new(@fetched['sourceSnapshotEncryptionKey']) + @source_snapshot_encryption_key = GoogleInSpec::Compute::Property::DiskSourceSnapshotEncryptionKey.new(@fetched['sourceSnapshotEncryptionKey'], to_s) @source_snapshot_id = @fetched['sourceSnapshotId'] end @@ -85,6 +87,10 @@ def exists? !@fetched.nil? end + def to_s + "Disk #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_compute_disks.rb b/libraries/google_compute_disks.rb index 3d978a351..fb962254b 100644 --- a/libraries/google_compute_disks.rb +++ b/libraries/google_compute_disks.rb @@ -98,11 +98,11 @@ def transformers 'type' => ->(obj) { return :type, obj['type'] }, 'sourceImage' => ->(obj) { return :source_image, obj['sourceImage'] }, 'zone' => ->(obj) { return :zone, obj['zone'] }, - 'sourceImageEncryptionKey' => ->(obj) { return :source_image_encryption_key, GoogleInSpec::Compute::Property::DiskSourceImageEncryptionKey.new(obj['sourceImageEncryptionKey']) }, + 'sourceImageEncryptionKey' => ->(obj) { return :source_image_encryption_key, GoogleInSpec::Compute::Property::DiskSourceImageEncryptionKey.new(obj['sourceImageEncryptionKey'], to_s) }, 'sourceImageId' => ->(obj) { return :source_image_id, obj['sourceImageId'] }, - 'diskEncryptionKey' => ->(obj) { return :disk_encryption_key, GoogleInSpec::Compute::Property::DiskDiskEncryptionKey.new(obj['diskEncryptionKey']) }, + 'diskEncryptionKey' => ->(obj) { return :disk_encryption_key, GoogleInSpec::Compute::Property::DiskDiskEncryptionKey.new(obj['diskEncryptionKey'], to_s) }, 'sourceSnapshot' => ->(obj) { return :source_snapshot, obj['sourceSnapshot'] }, - 'sourceSnapshotEncryptionKey' => ->(obj) { return :source_snapshot_encryption_key, GoogleInSpec::Compute::Property::DiskSourceSnapshotEncryptionKey.new(obj['sourceSnapshotEncryptionKey']) }, + 'sourceSnapshotEncryptionKey' => ->(obj) { return :source_snapshot_encryption_key, GoogleInSpec::Compute::Property::DiskSourceSnapshotEncryptionKey.new(obj['sourceSnapshotEncryptionKey'], to_s) }, 'sourceSnapshotId' => ->(obj) { return :source_snapshot_id, obj['sourceSnapshotId'] }, } end diff --git a/libraries/google_compute_global_address.rb b/libraries/google_compute_global_address.rb index c312b2386..fb6ca257a 100644 --- a/libraries/google_compute_global_address.rb +++ b/libraries/google_compute_global_address.rb @@ -21,6 +21,7 @@ class GlobalAddress < GcpResourceBase desc 'GlobalAddress' supports platform: 'gcp' + attr_reader :params attr_reader :address attr_reader :creation_timestamp attr_reader :description @@ -32,6 +33,7 @@ class GlobalAddress < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -56,6 +58,10 @@ def exists? !@fetched.nil? end + def to_s + "GlobalAddress #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_compute_global_forwarding_rule.rb b/libraries/google_compute_global_forwarding_rule.rb index 0f48e1ff6..d17fc590f 100644 --- a/libraries/google_compute_global_forwarding_rule.rb +++ b/libraries/google_compute_global_forwarding_rule.rb @@ -21,6 +21,7 @@ class GlobalForwardingRule < GcpResourceBase desc 'GlobalForwardingRule' supports platform: 'gcp' + attr_reader :params attr_reader :creation_timestamp attr_reader :description attr_reader :id @@ -39,6 +40,7 @@ class GlobalForwardingRule < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -70,6 +72,10 @@ def exists? !@fetched.nil? end + def to_s + "GlobalForwardingRule #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_compute_health_check.rb b/libraries/google_compute_health_check.rb index 478477c58..106e76996 100644 --- a/libraries/google_compute_health_check.rb +++ b/libraries/google_compute_health_check.rb @@ -25,6 +25,7 @@ class HealthCheck < GcpResourceBase desc 'HealthCheck' supports platform: 'gcp' + attr_reader :params attr_reader :check_interval_sec attr_reader :creation_timestamp attr_reader :description @@ -41,6 +42,7 @@ class HealthCheck < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -55,10 +57,10 @@ def parse @timeout_sec = @fetched['timeoutSec'] @unhealthy_threshold = @fetched['unhealthyThreshold'] @type = @fetched['type'] - @http_health_check = GoogleInSpec::Compute::Property::HealthCheckHttpHealthCheck.new(@fetched['httpHealthCheck']) - @https_health_check = GoogleInSpec::Compute::Property::HealthCheckHttpsHealthCheck.new(@fetched['httpsHealthCheck']) - @tcp_health_check = GoogleInSpec::Compute::Property::HealthCheckTcpHealthCheck.new(@fetched['tcpHealthCheck']) - @ssl_health_check = GoogleInSpec::Compute::Property::HealthCheckSslHealthCheck.new(@fetched['sslHealthCheck']) + @http_health_check = GoogleInSpec::Compute::Property::HealthCheckHttpHealthCheck.new(@fetched['httpHealthCheck'], to_s) + @https_health_check = GoogleInSpec::Compute::Property::HealthCheckHttpsHealthCheck.new(@fetched['httpsHealthCheck'], to_s) + @tcp_health_check = GoogleInSpec::Compute::Property::HealthCheckTcpHealthCheck.new(@fetched['tcpHealthCheck'], to_s) + @ssl_health_check = GoogleInSpec::Compute::Property::HealthCheckSslHealthCheck.new(@fetched['sslHealthCheck'], to_s) end # Handles parsing RFC3339 time string @@ -70,6 +72,10 @@ def exists? !@fetched.nil? end + def to_s + "HealthCheck #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_compute_health_checks.rb b/libraries/google_compute_health_checks.rb index 2f0492165..f95e5d53c 100644 --- a/libraries/google_compute_health_checks.rb +++ b/libraries/google_compute_health_checks.rb @@ -84,10 +84,10 @@ def transformers 'timeoutSec' => ->(obj) { return :timeout_sec, obj['timeoutSec'] }, 'unhealthyThreshold' => ->(obj) { return :unhealthy_threshold, obj['unhealthyThreshold'] }, 'type' => ->(obj) { return :type, obj['type'] }, - 'httpHealthCheck' => ->(obj) { return :http_health_check, GoogleInSpec::Compute::Property::HealthCheckHttpHealthCheck.new(obj['httpHealthCheck']) }, - 'httpsHealthCheck' => ->(obj) { return :https_health_check, GoogleInSpec::Compute::Property::HealthCheckHttpsHealthCheck.new(obj['httpsHealthCheck']) }, - 'tcpHealthCheck' => ->(obj) { return :tcp_health_check, GoogleInSpec::Compute::Property::HealthCheckTcpHealthCheck.new(obj['tcpHealthCheck']) }, - 'sslHealthCheck' => ->(obj) { return :ssl_health_check, GoogleInSpec::Compute::Property::HealthCheckSslHealthCheck.new(obj['sslHealthCheck']) }, + 'httpHealthCheck' => ->(obj) { return :http_health_check, GoogleInSpec::Compute::Property::HealthCheckHttpHealthCheck.new(obj['httpHealthCheck'], to_s) }, + 'httpsHealthCheck' => ->(obj) { return :https_health_check, GoogleInSpec::Compute::Property::HealthCheckHttpsHealthCheck.new(obj['httpsHealthCheck'], to_s) }, + 'tcpHealthCheck' => ->(obj) { return :tcp_health_check, GoogleInSpec::Compute::Property::HealthCheckTcpHealthCheck.new(obj['tcpHealthCheck'], to_s) }, + 'sslHealthCheck' => ->(obj) { return :ssl_health_check, GoogleInSpec::Compute::Property::HealthCheckSslHealthCheck.new(obj['sslHealthCheck'], to_s) }, } end diff --git a/libraries/google_compute_http_health_check.rb b/libraries/google_compute_http_health_check.rb index caa340629..0eb24f485 100644 --- a/libraries/google_compute_http_health_check.rb +++ b/libraries/google_compute_http_health_check.rb @@ -21,6 +21,7 @@ class HttpHealthCheck < GcpResourceBase desc 'HttpHealthCheck' supports platform: 'gcp' + attr_reader :params attr_reader :check_interval_sec attr_reader :creation_timestamp attr_reader :description @@ -35,6 +36,7 @@ class HttpHealthCheck < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -62,6 +64,10 @@ def exists? !@fetched.nil? end + def to_s + "HttpHealthCheck #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_compute_https_health_check.rb b/libraries/google_compute_https_health_check.rb index fa27b9dae..fd8d76bdc 100644 --- a/libraries/google_compute_https_health_check.rb +++ b/libraries/google_compute_https_health_check.rb @@ -21,6 +21,7 @@ class HttpsHealthCheck < GcpResourceBase desc 'HttpsHealthCheck' supports platform: 'gcp' + attr_reader :params attr_reader :check_interval_sec attr_reader :creation_timestamp attr_reader :description @@ -35,6 +36,7 @@ class HttpsHealthCheck < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -62,6 +64,10 @@ def exists? !@fetched.nil? end + def to_s + "HttpsHealthCheck #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_compute_instance_group_manager.rb b/libraries/google_compute_instance_group_manager.rb index c0d213ea8..b1797b919 100644 --- a/libraries/google_compute_instance_group_manager.rb +++ b/libraries/google_compute_instance_group_manager.rb @@ -23,6 +23,7 @@ class InstanceGroupManager < GcpResourceBase desc 'InstanceGroupManager' supports platform: 'gcp' + attr_reader :params attr_reader :base_instance_name attr_reader :creation_timestamp attr_reader :current_actions @@ -39,6 +40,7 @@ class InstanceGroupManager < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -46,13 +48,13 @@ def initialize(params) def parse @base_instance_name = @fetched['baseInstanceName'] @creation_timestamp = parse_time_string(@fetched['creationTimestamp']) - @current_actions = GoogleInSpec::Compute::Property::InstanceGroupManagerCurrentActions.new(@fetched['currentActions']) + @current_actions = GoogleInSpec::Compute::Property::InstanceGroupManagerCurrentActions.new(@fetched['currentActions'], to_s) @description = @fetched['description'] @id = @fetched['id'] @instance_group = @fetched['instanceGroup'] @instance_template = @fetched['instanceTemplate'] @name = @fetched['name'] - @named_ports = GoogleInSpec::Compute::Property::InstanceGroupManagerNamedPortsArray.parse(@fetched['namedPorts']) + @named_ports = GoogleInSpec::Compute::Property::InstanceGroupManagerNamedPortsArray.parse(@fetched['namedPorts'], to_s) @region = @fetched['region'] @target_pools = @fetched['targetPools'] @target_size = @fetched['targetSize'] @@ -68,6 +70,10 @@ def exists? !@fetched.nil? end + def to_s + "InstanceGroupManager #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_compute_instance_group_managers.rb b/libraries/google_compute_instance_group_managers.rb index 332e204c4..0a4bee4e4 100644 --- a/libraries/google_compute_instance_group_managers.rb +++ b/libraries/google_compute_instance_group_managers.rb @@ -77,13 +77,13 @@ def transformers { 'baseInstanceName' => ->(obj) { return :base_instance_name, obj['baseInstanceName'] }, 'creationTimestamp' => ->(obj) { return :creation_timestamp, parse_time_string(obj['creationTimestamp']) }, - 'currentActions' => ->(obj) { return :current_actions, GoogleInSpec::Compute::Property::InstanceGroupManagerCurrentActions.new(obj['currentActions']) }, + 'currentActions' => ->(obj) { return :current_actions, GoogleInSpec::Compute::Property::InstanceGroupManagerCurrentActions.new(obj['currentActions'], to_s) }, 'description' => ->(obj) { return :description, obj['description'] }, 'id' => ->(obj) { return :id, obj['id'] }, 'instanceGroup' => ->(obj) { return :instance_group, obj['instanceGroup'] }, 'instanceTemplate' => ->(obj) { return :instance_template, obj['instanceTemplate'] }, 'name' => ->(obj) { return :name, obj['name'] }, - 'namedPorts' => ->(obj) { return :named_ports, GoogleInSpec::Compute::Property::InstanceGroupManagerNamedPortsArray.parse(obj['namedPorts']) }, + 'namedPorts' => ->(obj) { return :named_ports, GoogleInSpec::Compute::Property::InstanceGroupManagerNamedPortsArray.parse(obj['namedPorts'], to_s) }, 'region' => ->(obj) { return :region, obj['region'] }, 'targetPools' => ->(obj) { return :target_pools, obj['targetPools'] }, 'targetSize' => ->(obj) { return :target_size, obj['targetSize'] }, diff --git a/libraries/google_compute_instance_template.rb b/libraries/google_compute_instance_template.rb index 2dea96d2d..8ad45a23d 100644 --- a/libraries/google_compute_instance_template.rb +++ b/libraries/google_compute_instance_template.rb @@ -28,6 +28,7 @@ class InstanceTemplate < GcpResourceBase desc 'InstanceTemplate' supports platform: 'gcp' + attr_reader :params attr_reader :creation_timestamp attr_reader :description attr_reader :id @@ -36,6 +37,7 @@ class InstanceTemplate < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -45,7 +47,7 @@ def parse @description = @fetched['description'] @id = @fetched['id'] @name = @fetched['name'] - @properties = GoogleInSpec::Compute::Property::InstanceTemplateProperties.new(@fetched['properties']) + @properties = GoogleInSpec::Compute::Property::InstanceTemplateProperties.new(@fetched['properties'], to_s) end # Handles parsing RFC3339 time string @@ -57,6 +59,10 @@ def exists? !@fetched.nil? end + def to_s + "InstanceTemplate #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_compute_instance_templates.rb b/libraries/google_compute_instance_templates.rb index 4ae92b1b0..53c6cfe26 100644 --- a/libraries/google_compute_instance_templates.rb +++ b/libraries/google_compute_instance_templates.rb @@ -71,7 +71,7 @@ def transformers 'description' => ->(obj) { return :description, obj['description'] }, 'id' => ->(obj) { return :id, obj['id'] }, 'name' => ->(obj) { return :name, obj['name'] }, - 'properties' => ->(obj) { return :properties, GoogleInSpec::Compute::Property::InstanceTemplateProperties.new(obj['properties']) }, + 'properties' => ->(obj) { return :properties, GoogleInSpec::Compute::Property::InstanceTemplateProperties.new(obj['properties'], to_s) }, } end diff --git a/libraries/google_compute_route.rb b/libraries/google_compute_route.rb index 6542eb6cb..0e28ff37e 100644 --- a/libraries/google_compute_route.rb +++ b/libraries/google_compute_route.rb @@ -21,6 +21,7 @@ class Route < GcpResourceBase desc 'Route' supports platform: 'gcp' + attr_reader :params attr_reader :dest_range attr_reader :description attr_reader :name @@ -35,6 +36,7 @@ class Route < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -62,6 +64,10 @@ def exists? !@fetched.nil? end + def to_s + "Route #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_compute_router.rb b/libraries/google_compute_router.rb index 34e9c64b3..6f7a2f069 100644 --- a/libraries/google_compute_router.rb +++ b/libraries/google_compute_router.rb @@ -23,6 +23,7 @@ class Router < GcpResourceBase desc 'Router' supports platform: 'gcp' + attr_reader :params attr_reader :id attr_reader :creation_timestamp attr_reader :name @@ -33,6 +34,7 @@ class Router < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -43,7 +45,7 @@ def parse @name = @fetched['name'] @description = @fetched['description'] @network = @fetched['network'] - @bgp = GoogleInSpec::Compute::Property::RouterBgp.new(@fetched['bgp']) + @bgp = GoogleInSpec::Compute::Property::RouterBgp.new(@fetched['bgp'], to_s) @region = @fetched['region'] end @@ -56,6 +58,10 @@ def exists? !@fetched.nil? end + def to_s + "Router #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_compute_routers.rb b/libraries/google_compute_routers.rb index 0a060f1b5..26ce1710b 100644 --- a/libraries/google_compute_routers.rb +++ b/libraries/google_compute_routers.rb @@ -74,7 +74,7 @@ def transformers 'name' => ->(obj) { return :name, obj['name'] }, 'description' => ->(obj) { return :description, obj['description'] }, 'network' => ->(obj) { return :network, obj['network'] }, - 'bgp' => ->(obj) { return :bgp, GoogleInSpec::Compute::Property::RouterBgp.new(obj['bgp']) }, + 'bgp' => ->(obj) { return :bgp, GoogleInSpec::Compute::Property::RouterBgp.new(obj['bgp'], to_s) }, 'region' => ->(obj) { return :region, obj['region'] }, } end diff --git a/libraries/google_compute_snapshot.rb b/libraries/google_compute_snapshot.rb index c1251db35..4244fb18a 100644 --- a/libraries/google_compute_snapshot.rb +++ b/libraries/google_compute_snapshot.rb @@ -23,6 +23,7 @@ class Snapshot < GcpResourceBase desc 'Snapshot' supports platform: 'gcp' + attr_reader :params attr_reader :creation_timestamp attr_reader :id attr_reader :disk_size_gb @@ -39,6 +40,7 @@ class Snapshot < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -55,8 +57,8 @@ def parse @label_fingerprint = @fetched['labelFingerprint'] @source_disk = @fetched['sourceDisk'] @zone = @fetched['zone'] - @snapshot_encryption_key = GoogleInSpec::Compute::Property::SnapshotSnapshotEncryptionKey.new(@fetched['snapshotEncryptionKey']) - @source_disk_encryption_key = GoogleInSpec::Compute::Property::SnapshotSourceDiskEncryptionKey.new(@fetched['sourceDiskEncryptionKey']) + @snapshot_encryption_key = GoogleInSpec::Compute::Property::SnapshotSnapshotEncryptionKey.new(@fetched['snapshotEncryptionKey'], to_s) + @source_disk_encryption_key = GoogleInSpec::Compute::Property::SnapshotSourceDiskEncryptionKey.new(@fetched['sourceDiskEncryptionKey'], to_s) end # Handles parsing RFC3339 time string @@ -68,6 +70,10 @@ def exists? !@fetched.nil? end + def to_s + "Snapshot #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_compute_snapshots.rb b/libraries/google_compute_snapshots.rb index eeb00ebdb..907dd4345 100644 --- a/libraries/google_compute_snapshots.rb +++ b/libraries/google_compute_snapshots.rb @@ -86,8 +86,8 @@ def transformers 'labelFingerprint' => ->(obj) { return :label_fingerprint, obj['labelFingerprint'] }, 'sourceDisk' => ->(obj) { return :source_disk, obj['sourceDisk'] }, 'zone' => ->(obj) { return :zone, obj['zone'] }, - 'snapshotEncryptionKey' => ->(obj) { return :snapshot_encryption_key, GoogleInSpec::Compute::Property::SnapshotSnapshotEncryptionKey.new(obj['snapshotEncryptionKey']) }, - 'sourceDiskEncryptionKey' => ->(obj) { return :source_disk_encryption_key, GoogleInSpec::Compute::Property::SnapshotSourceDiskEncryptionKey.new(obj['sourceDiskEncryptionKey']) }, + 'snapshotEncryptionKey' => ->(obj) { return :snapshot_encryption_key, GoogleInSpec::Compute::Property::SnapshotSnapshotEncryptionKey.new(obj['snapshotEncryptionKey'], to_s) }, + 'sourceDiskEncryptionKey' => ->(obj) { return :source_disk_encryption_key, GoogleInSpec::Compute::Property::SnapshotSourceDiskEncryptionKey.new(obj['sourceDiskEncryptionKey'], to_s) }, } end diff --git a/libraries/google_compute_ssl_certificate.rb b/libraries/google_compute_ssl_certificate.rb index 081e4b6cd..1fe030795 100644 --- a/libraries/google_compute_ssl_certificate.rb +++ b/libraries/google_compute_ssl_certificate.rb @@ -21,6 +21,7 @@ class SslCertificate < GcpResourceBase desc 'SslCertificate' supports platform: 'gcp' + attr_reader :params attr_reader :certificate attr_reader :creation_timestamp attr_reader :description @@ -30,6 +31,7 @@ class SslCertificate < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -52,6 +54,10 @@ def exists? !@fetched.nil? end + def to_s + "SslCertificate #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_compute_ssl_policies.rb b/libraries/google_compute_ssl_policies.rb index 736616a57..85a02d748 100644 --- a/libraries/google_compute_ssl_policies.rb +++ b/libraries/google_compute_ssl_policies.rb @@ -81,7 +81,7 @@ def transformers 'enabledFeatures' => ->(obj) { return :enabled_features, obj['enabledFeatures'] }, 'customFeatures' => ->(obj) { return :custom_features, obj['customFeatures'] }, 'fingerprint' => ->(obj) { return :fingerprint, obj['fingerprint'] }, - 'warnings' => ->(obj) { return :warnings, GoogleInSpec::Compute::Property::SslPolicyWarningsArray.parse(obj['warnings']) }, + 'warnings' => ->(obj) { return :warnings, GoogleInSpec::Compute::Property::SslPolicyWarningsArray.parse(obj['warnings'], to_s) }, } end diff --git a/libraries/google_compute_ssl_policy.rb b/libraries/google_compute_ssl_policy.rb index a5dadec6e..59febb9f7 100644 --- a/libraries/google_compute_ssl_policy.rb +++ b/libraries/google_compute_ssl_policy.rb @@ -22,6 +22,7 @@ class SslPolicy < GcpResourceBase desc 'SslPolicy' supports platform: 'gcp' + attr_reader :params attr_reader :creation_timestamp attr_reader :description attr_reader :id @@ -35,6 +36,7 @@ class SslPolicy < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -49,7 +51,7 @@ def parse @enabled_features = @fetched['enabledFeatures'] @custom_features = @fetched['customFeatures'] @fingerprint = @fetched['fingerprint'] - @warnings = GoogleInSpec::Compute::Property::SslPolicyWarningsArray.parse(@fetched['warnings']) + @warnings = GoogleInSpec::Compute::Property::SslPolicyWarningsArray.parse(@fetched['warnings'], to_s) end # Handles parsing RFC3339 time string @@ -61,6 +63,10 @@ def exists? !@fetched.nil? end + def to_s + "SslPolicy #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_compute_target_http_proxy.rb b/libraries/google_compute_target_http_proxy.rb index 1bd781656..eacc4dd74 100644 --- a/libraries/google_compute_target_http_proxy.rb +++ b/libraries/google_compute_target_http_proxy.rb @@ -21,6 +21,7 @@ class TargetHttpProxy < GcpResourceBase desc 'TargetHttpProxy' supports platform: 'gcp' + attr_reader :params attr_reader :creation_timestamp attr_reader :description attr_reader :id @@ -29,6 +30,7 @@ class TargetHttpProxy < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -50,6 +52,10 @@ def exists? !@fetched.nil? end + def to_s + "TargetHttpProxy #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_compute_target_https_proxy.rb b/libraries/google_compute_target_https_proxy.rb index 41c9c55ee..59b497734 100644 --- a/libraries/google_compute_target_https_proxy.rb +++ b/libraries/google_compute_target_https_proxy.rb @@ -21,6 +21,7 @@ class TargetHttpsProxy < GcpResourceBase desc 'TargetHttpsProxy' supports platform: 'gcp' + attr_reader :params attr_reader :creation_timestamp attr_reader :description attr_reader :id @@ -32,6 +33,7 @@ class TargetHttpsProxy < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -56,6 +58,10 @@ def exists? !@fetched.nil? end + def to_s + "TargetHttpsProxy #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_compute_target_pool.rb b/libraries/google_compute_target_pool.rb index a20d4e85c..3b8ebb509 100644 --- a/libraries/google_compute_target_pool.rb +++ b/libraries/google_compute_target_pool.rb @@ -21,6 +21,7 @@ class TargetPool < GcpResourceBase desc 'TargetPool' supports platform: 'gcp' + attr_reader :params attr_reader :backup_pool attr_reader :creation_timestamp attr_reader :description @@ -34,6 +35,7 @@ class TargetPool < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -60,6 +62,10 @@ def exists? !@fetched.nil? end + def to_s + "TargetPool #{@params[:name]}" + end + RSpec::Matchers.alias_matcher :has_target_instance, :be_has_target_instance def has_target_instance?(name, zone) diff --git a/libraries/google_compute_target_tcp_proxy.rb b/libraries/google_compute_target_tcp_proxy.rb index f7f088e67..c0049ec9b 100644 --- a/libraries/google_compute_target_tcp_proxy.rb +++ b/libraries/google_compute_target_tcp_proxy.rb @@ -21,6 +21,7 @@ class TargetTcpProxy < GcpResourceBase desc 'TargetTcpProxy' supports platform: 'gcp' + attr_reader :params attr_reader :creation_timestamp attr_reader :description attr_reader :id @@ -30,6 +31,7 @@ class TargetTcpProxy < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -52,6 +54,10 @@ def exists? !@fetched.nil? end + def to_s + "TargetTcpProxy #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_compute_url_map.rb b/libraries/google_compute_url_map.rb index b42df354a..79ace5f17 100644 --- a/libraries/google_compute_url_map.rb +++ b/libraries/google_compute_url_map.rb @@ -24,6 +24,7 @@ class UrlMap < GcpResourceBase desc 'UrlMap' supports platform: 'gcp' + attr_reader :params attr_reader :creation_timestamp attr_reader :default_service attr_reader :description @@ -36,6 +37,7 @@ class UrlMap < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -44,12 +46,12 @@ def parse @creation_timestamp = parse_time_string(@fetched['creationTimestamp']) @default_service = @fetched['defaultService'] @description = @fetched['description'] - @host_rules = GoogleInSpec::Compute::Property::UrlMapHostRulesArray.parse(@fetched['hostRules']) + @host_rules = GoogleInSpec::Compute::Property::UrlMapHostRulesArray.parse(@fetched['hostRules'], to_s) @id = @fetched['id'] @fingerprint = @fetched['fingerprint'] @name = @fetched['name'] - @path_matchers = GoogleInSpec::Compute::Property::UrlMapPathMatchersArray.parse(@fetched['pathMatchers']) - @tests = GoogleInSpec::Compute::Property::UrlMapTestsArray.parse(@fetched['tests']) + @path_matchers = GoogleInSpec::Compute::Property::UrlMapPathMatchersArray.parse(@fetched['pathMatchers'], to_s) + @tests = GoogleInSpec::Compute::Property::UrlMapTestsArray.parse(@fetched['tests'], to_s) end # Handles parsing RFC3339 time string @@ -61,6 +63,10 @@ def exists? !@fetched.nil? end + def to_s + "UrlMap #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_compute_url_maps.rb b/libraries/google_compute_url_maps.rb index 2b003e32c..407362fab 100644 --- a/libraries/google_compute_url_maps.rb +++ b/libraries/google_compute_url_maps.rb @@ -74,12 +74,12 @@ def transformers 'creationTimestamp' => ->(obj) { return :creation_timestamp, parse_time_string(obj['creationTimestamp']) }, 'defaultService' => ->(obj) { return :default_service, obj['defaultService'] }, 'description' => ->(obj) { return :description, obj['description'] }, - 'hostRules' => ->(obj) { return :host_rules, GoogleInSpec::Compute::Property::UrlMapHostRulesArray.parse(obj['hostRules']) }, + 'hostRules' => ->(obj) { return :host_rules, GoogleInSpec::Compute::Property::UrlMapHostRulesArray.parse(obj['hostRules'], to_s) }, 'id' => ->(obj) { return :id, obj['id'] }, 'fingerprint' => ->(obj) { return :fingerprint, obj['fingerprint'] }, 'name' => ->(obj) { return :name, obj['name'] }, - 'pathMatchers' => ->(obj) { return :path_matchers, GoogleInSpec::Compute::Property::UrlMapPathMatchersArray.parse(obj['pathMatchers']) }, - 'tests' => ->(obj) { return :tests, GoogleInSpec::Compute::Property::UrlMapTestsArray.parse(obj['tests']) }, + 'pathMatchers' => ->(obj) { return :path_matchers, GoogleInSpec::Compute::Property::UrlMapPathMatchersArray.parse(obj['pathMatchers'], to_s) }, + 'tests' => ->(obj) { return :tests, GoogleInSpec::Compute::Property::UrlMapTestsArray.parse(obj['tests'], to_s) }, } end diff --git a/libraries/google_container_regional_cluster.rb b/libraries/google_container_regional_cluster.rb index 2d69510b1..d0ba383ce 100644 --- a/libraries/google_container_regional_cluster.rb +++ b/libraries/google_container_regional_cluster.rb @@ -27,6 +27,7 @@ class RegionalCluster < GcpResourceBase desc 'RegionalCluster' supports platform: 'gcp' + attr_reader :params attr_reader :name attr_reader :description attr_reader :initial_node_count @@ -52,6 +53,7 @@ class RegionalCluster < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -60,14 +62,14 @@ def parse @name = @fetched['name'] @description = @fetched['description'] @initial_node_count = @fetched['initialNodeCount'] - @node_config = GoogleInSpec::Container::Property::RegionalClusterNodeConfig.new(@fetched['nodeConfig']) - @master_auth = GoogleInSpec::Container::Property::RegionalClusterMasterAuth.new(@fetched['masterAuth']) + @node_config = GoogleInSpec::Container::Property::RegionalClusterNodeConfig.new(@fetched['nodeConfig'], to_s) + @master_auth = GoogleInSpec::Container::Property::RegionalClusterMasterAuth.new(@fetched['masterAuth'], to_s) @logging_service = @fetched['loggingService'] @monitoring_service = @fetched['monitoringService'] @network = @fetched['network'] - @private_cluster_config = GoogleInSpec::Container::Property::RegionalClusterPrivateClusterConfig.new(@fetched['privateClusterConfig']) + @private_cluster_config = GoogleInSpec::Container::Property::RegionalClusterPrivateClusterConfig.new(@fetched['privateClusterConfig'], to_s) @cluster_ipv4_cidr = @fetched['clusterIpv4Cidr'] - @addons_config = GoogleInSpec::Container::Property::RegionalClusterAddonsConfig.new(@fetched['addonsConfig']) + @addons_config = GoogleInSpec::Container::Property::RegionalClusterAddonsConfig.new(@fetched['addonsConfig'], to_s) @subnetwork = @fetched['subnetwork'] @endpoint = @fetched['endpoint'] @initial_cluster_version = @fetched['initialClusterVersion'] @@ -90,6 +92,10 @@ def exists? !@fetched.nil? end + def to_s + "RegionalCluster #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_container_regional_clusters.rb b/libraries/google_container_regional_clusters.rb index 2297f3040..8ee1e30de 100644 --- a/libraries/google_container_regional_clusters.rb +++ b/libraries/google_container_regional_clusters.rb @@ -87,14 +87,14 @@ def transformers 'name' => ->(obj) { return :name, obj['name'] }, 'description' => ->(obj) { return :description, obj['description'] }, 'initialNodeCount' => ->(obj) { return :initial_node_count, obj['initialNodeCount'] }, - 'nodeConfig' => ->(obj) { return :node_config, GoogleInSpec::Container::Property::RegionalClusterNodeConfig.new(obj['nodeConfig']) }, - 'masterAuth' => ->(obj) { return :master_auth, GoogleInSpec::Container::Property::RegionalClusterMasterAuth.new(obj['masterAuth']) }, + 'nodeConfig' => ->(obj) { return :node_config, GoogleInSpec::Container::Property::RegionalClusterNodeConfig.new(obj['nodeConfig'], to_s) }, + 'masterAuth' => ->(obj) { return :master_auth, GoogleInSpec::Container::Property::RegionalClusterMasterAuth.new(obj['masterAuth'], to_s) }, 'loggingService' => ->(obj) { return :logging_service, obj['loggingService'] }, 'monitoringService' => ->(obj) { return :monitoring_service, obj['monitoringService'] }, 'network' => ->(obj) { return :network, obj['network'] }, - 'privateClusterConfig' => ->(obj) { return :private_cluster_config, GoogleInSpec::Container::Property::RegionalClusterPrivateClusterConfig.new(obj['privateClusterConfig']) }, + 'privateClusterConfig' => ->(obj) { return :private_cluster_config, GoogleInSpec::Container::Property::RegionalClusterPrivateClusterConfig.new(obj['privateClusterConfig'], to_s) }, 'clusterIpv4Cidr' => ->(obj) { return :cluster_ipv4_cidr, obj['clusterIpv4Cidr'] }, - 'addonsConfig' => ->(obj) { return :addons_config, GoogleInSpec::Container::Property::RegionalClusterAddonsConfig.new(obj['addonsConfig']) }, + 'addonsConfig' => ->(obj) { return :addons_config, GoogleInSpec::Container::Property::RegionalClusterAddonsConfig.new(obj['addonsConfig'], to_s) }, 'subnetwork' => ->(obj) { return :subnetwork, obj['subnetwork'] }, 'endpoint' => ->(obj) { return :endpoint, obj['endpoint'] }, 'initialClusterVersion' => ->(obj) { return :initial_cluster_version, obj['initialClusterVersion'] }, diff --git a/libraries/google_dns_resource_record_set.rb b/libraries/google_dns_resource_record_set.rb index ff2677f2b..93a26067c 100644 --- a/libraries/google_dns_resource_record_set.rb +++ b/libraries/google_dns_resource_record_set.rb @@ -21,6 +21,7 @@ class ResourceRecordSet < GcpResourceBase desc 'ResourceRecordSet' supports platform: 'gcp' + attr_reader :params attr_reader :name attr_reader :type attr_reader :ttl @@ -29,6 +30,7 @@ class ResourceRecordSet < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params fetched = @connection.fetch(product_url, resource_base_url, params) @fetched = unwrap(fetched, params) parse unless @fetched.nil? @@ -63,6 +65,10 @@ def exists? !@fetched.nil? end + def to_s + "ResourceRecordSet #{@params[:type]}" + end + private def product_url diff --git a/libraries/google_pubsub_subscription.rb b/libraries/google_pubsub_subscription.rb index 31ffe9c74..a2d5a6a12 100644 --- a/libraries/google_pubsub_subscription.rb +++ b/libraries/google_pubsub_subscription.rb @@ -22,6 +22,7 @@ class Subscription < GcpResourceBase desc 'Subscription' supports platform: 'gcp' + attr_reader :params attr_reader :name attr_reader :topic attr_reader :labels @@ -32,6 +33,7 @@ class Subscription < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -40,7 +42,7 @@ def parse @name = name_from_self_link(@fetched['name']) @topic = @fetched['topic'] @labels = @fetched['labels'] - @push_config = GoogleInSpec::Pubsub::Property::SubscriptionPushConfig.new(@fetched['pushConfig']) + @push_config = GoogleInSpec::Pubsub::Property::SubscriptionPushConfig.new(@fetched['pushConfig'], to_s) @ack_deadline_seconds = @fetched['ackDeadlineSeconds'] @message_retention_duration = @fetched['messageRetentionDuration'] @retain_acked_messages = @fetched['retainAckedMessages'] @@ -55,6 +57,10 @@ def exists? !@fetched.nil? end + def to_s + "Subscription #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_pubsub_subscriptions.rb b/libraries/google_pubsub_subscriptions.rb index ac4b8153e..66ce93252 100644 --- a/libraries/google_pubsub_subscriptions.rb +++ b/libraries/google_pubsub_subscriptions.rb @@ -72,7 +72,7 @@ def transformers 'name' => ->(obj) { return :name, name_from_self_link(obj['name']) }, 'topic' => ->(obj) { return :topic, obj['topic'] }, 'labels' => ->(obj) { return :labels, obj['labels'] }, - 'pushConfig' => ->(obj) { return :push_config, GoogleInSpec::Pubsub::Property::SubscriptionPushConfig.new(obj['pushConfig']) }, + 'pushConfig' => ->(obj) { return :push_config, GoogleInSpec::Pubsub::Property::SubscriptionPushConfig.new(obj['pushConfig'], to_s) }, 'ackDeadlineSeconds' => ->(obj) { return :ack_deadline_seconds, obj['ackDeadlineSeconds'] }, 'messageRetentionDuration' => ->(obj) { return :message_retention_duration, obj['messageRetentionDuration'] }, 'retainAckedMessages' => ->(obj) { return :retain_acked_messages, obj['retainAckedMessages'] }, diff --git a/libraries/google_pubsub_topic.rb b/libraries/google_pubsub_topic.rb index 85d438bab..0e16f890a 100644 --- a/libraries/google_pubsub_topic.rb +++ b/libraries/google_pubsub_topic.rb @@ -21,11 +21,13 @@ class Topic < GcpResourceBase desc 'Topic' supports platform: 'gcp' + attr_reader :params attr_reader :name attr_reader :labels def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -44,6 +46,10 @@ def exists? !@fetched.nil? end + def to_s + "Topic #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_resourcemanager_folder.rb b/libraries/google_resourcemanager_folder.rb index c85af34b2..e206d2cb9 100644 --- a/libraries/google_resourcemanager_folder.rb +++ b/libraries/google_resourcemanager_folder.rb @@ -21,6 +21,7 @@ class Folder < GcpResourceBase desc 'Folder' supports platform: 'gcp' + attr_reader :params attr_reader :name attr_reader :lifecycle_state attr_reader :create_time @@ -29,6 +30,7 @@ class Folder < GcpResourceBase def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -50,6 +52,10 @@ def exists? !@fetched.nil? end + def to_s + "Folder #{@params[:name]}" + end + private def product_url diff --git a/libraries/google_sourcerepo_repository.rb b/libraries/google_sourcerepo_repository.rb index aec2da712..a5b6740a2 100644 --- a/libraries/google_sourcerepo_repository.rb +++ b/libraries/google_sourcerepo_repository.rb @@ -21,12 +21,14 @@ class Repository < GcpResourceBase desc 'Repository' supports platform: 'gcp' + attr_reader :params attr_reader :name attr_reader :url attr_reader :size def initialize(params) super(params.merge({ use_http_transport: true })) + @params = params @fetched = @connection.fetch(product_url, resource_base_url, params) parse unless @fetched.nil? end @@ -46,6 +48,10 @@ def exists? !@fetched.nil? end + def to_s + "Repository #{@params[:name]}" + end + private def product_url