From 7eadba2564645bb82f46b2e13078824b43cacb7f Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Thu, 31 Jan 2019 21:43:49 +0000 Subject: [PATCH 1/7] Add router support in InSpec Signed-off-by: Modular Magician --- docs/resources/google_compute_router.md | 50 ++++++++++ docs/resources/google_compute_routers.md | 30 ++++++ .../property/router_advertised_ip_ranges.rb | 40 ++++++++ .../google/compute/property/router_bgp.rb | 39 ++++++++ libraries/google_compute_router.rb | 65 +++++++++++++ libraries/google_compute_routers.rb | 94 +++++++++++++++++++ test/integration/build/gcp-mm.tf | 21 +++++ .../configuration/mm-attributes.yml | 8 ++ .../verify/controls/google_compute_router.rb | 46 +++++++++ .../verify/controls/google_compute_routers.rb | 35 +++++++ 10 files changed, 428 insertions(+) create mode 100644 docs/resources/google_compute_router.md create mode 100644 docs/resources/google_compute_routers.md create mode 100644 libraries/google/compute/property/router_advertised_ip_ranges.rb create mode 100644 libraries/google/compute/property/router_bgp.rb create mode 100644 libraries/google_compute_router.rb create mode 100644 libraries/google_compute_routers.rb create mode 100644 test/integration/verify/controls/google_compute_router.rb create mode 100644 test/integration/verify/controls/google_compute_routers.rb diff --git a/docs/resources/google_compute_router.md b/docs/resources/google_compute_router.md new file mode 100644 index 000000000..53fc149f7 --- /dev/null +++ b/docs/resources/google_compute_router.md @@ -0,0 +1,50 @@ +--- +title: About the google_compute_router resource +platform: gcp +--- + +## Syntax +A `google_compute_router` is used to test a Google Router resource + +## Examples +``` +describe google_compute_router(project: 'chef-gcp-inspec', region: 'europe-west2', name: 'inspec-gcp-router') do + it { should exist } + its('bgp.asn') { should eq '64514' } + its('bgp.advertise_mode') { should eq 'CUSTOM' } + its('bgp.advertised_groups') { should include 'ALL_SUBNETS' } + its('bgp.advertised_ip_ranges.count') { should eq 2 } + its('bgp.advertised_ip_ranges.first.range') { should eq '1.2.3.4' } + its('bgp.advertised_ip_ranges.last.range') { should eq '1.2.3.4' } + its('network') { should match /\/gcp-inspec-network$/ } + end + +describe google_compute_router(project: 'chef-gcp-inspec', region: 'europe-west2', name: 'nonexistent') do + it { should_not exist } +end +``` + +## Properties +Properties that can be accessed from the `google_compute_router` resource: + + * `id`: The unique identifier for the resource. + + * `creation_timestamp`: Creation timestamp in RFC3339 text format. + + * `name`: Name of the resource. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. + + * `description`: An optional description of this resource. + + * `network`: A reference to the network to which this router belongs. + + * `bgp`: BGP information specific to this router. + + * `asn`: Local BGP Autonomous System Number (ASN). Must be an RFC6996 private ASN, either 16-bit or 32-bit. The value will be fixed for this router resource. All VPN tunnels that link to this router will have the same local ASN. + + * `advertiseMode`: User-specified flag to indicate which mode to use for advertisement. Valid values of this enum field are: DEFAULT, CUSTOM + + * `advertisedGroups`: User-specified list of prefix groups to advertise in custom mode. This field can only be populated if advertiseMode is CUSTOM and is advertised to all peers of the router. These groups will be advertised in addition to any specified prefixes. Leave this field blank to advertise no custom groups. This enum field has the one valid value: ALL_SUBNETS + + * `advertisedIpRanges`: User-specified list of individual IP ranges to advertise in custom mode. This field can only be populated if advertiseMode is CUSTOM and is advertised to all peers of the router. These IP ranges will be advertised in addition to any specified groups. Leave this field blank to advertise no custom IP ranges. + + * `region`: Region where the router resides. diff --git a/docs/resources/google_compute_routers.md b/docs/resources/google_compute_routers.md new file mode 100644 index 000000000..7827645f5 --- /dev/null +++ b/docs/resources/google_compute_routers.md @@ -0,0 +1,30 @@ +--- +title: About the google_compute_routers resource +platform: gcp +--- + +## Syntax +A `google_compute_routers` is used to test a Google Router resource + +## Examples +``` +describe google_compute_routers(project: 'chef-gcp-inspec', region: 'europe-west2') do + its('names') { should include 'inspec-gcp-router' } +end +``` + +## Properties +Properties that can be accessed from the `google_compute_routers` resource: + +See [google_compute_router.md](google_compute_router.md) for more detailed information + * `ids`: an array of `google_compute_router` id + * `creation_timestamps`: an array of `google_compute_router` creation_timestamp + * `names`: an array of `google_compute_router` name + * `descriptions`: an array of `google_compute_router` description + * `networks`: an array of `google_compute_router` network + * `bgps`: an array of `google_compute_router` bgp + * `regions`: an array of `google_compute_router` region + +## 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. diff --git a/libraries/google/compute/property/router_advertised_ip_ranges.rb b/libraries/google/compute/property/router_advertised_ip_ranges.rb new file mode 100644 index 000000000..45313e693 --- /dev/null +++ b/libraries/google/compute/property/router_advertised_ip_ranges.rb @@ -0,0 +1,40 @@ +# 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 Compute + module Property + class RouterAdvertisedipranges + attr_reader :range + + attr_reader :description + + def initialize(args = nil) + return if args.nil? + @range = args['range'] + @description = args['description'] + end + end + + class RouterAdvertisediprangesArray + def self.parse(value) + return if value.nil? + return RouterAdvertisedipranges.new(value) unless value.is_a?(::Array) + value.map { |v| RouterAdvertisedipranges.new(v) } + end + end + end + end +end diff --git a/libraries/google/compute/property/router_bgp.rb b/libraries/google/compute/property/router_bgp.rb new file mode 100644 index 000000000..54a34ab73 --- /dev/null +++ b/libraries/google/compute/property/router_bgp.rb @@ -0,0 +1,39 @@ +# 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 'google/compute/property/router_advertised_ip_ranges' +module GoogleInSpec + module Compute + module Property + class RouterBgp + attr_reader :asn + + attr_reader :advertise_mode + + attr_reader :advertised_groups + + attr_reader :advertised_ip_ranges + + def initialize(args = nil) + return if args.nil? + @asn = args['asn'] + @advertise_mode = args['advertiseMode'] + @advertised_groups = args['advertisedGroups'] + @advertised_ip_ranges = GoogleInSpec::Compute::Property::RouterAdvertisediprangesArray.parse(args['advertisedIpRanges']) + end + end + end + end +end diff --git a/libraries/google_compute_router.rb b/libraries/google_compute_router.rb new file mode 100644 index 000000000..6b5d91ab2 --- /dev/null +++ b/libraries/google_compute_router.rb @@ -0,0 +1,65 @@ +# 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' +require 'google/compute/property/router_advertised_ip_ranges' +require 'google/compute/property/router_bgp' + +# A provider to manage Google Compute Engine resources. +class Router < GcpResourceBase + name 'google_compute_router' + desc 'Router' + supports platform: 'gcp' + + attr_reader :id + attr_reader :creation_timestamp + attr_reader :name + attr_reader :description + attr_reader :network + attr_reader :bgp + attr_reader :region + def base + 'https://www.googleapis.com/compute/v1/' + end + + def url + 'projects/{{project}}/regions/{{region}}/routers/{{name}}' + end + + def initialize(params) + super(params.merge({ use_http_transport: true })) + @fetched = @connection.fetch(base, url, params) + parse unless @fetched.nil? + end + + def parse + @id = @fetched['id'] + @creation_timestamp = parse_time_string(@fetched['creationTimestamp']) + @name = @fetched['name'] + @description = @fetched['description'] + @network = @fetched['network'] + @bgp = GoogleInSpec::Compute::Property::RouterBgp.new(@fetched['bgp']) + @region = @fetched['region'] + 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 +end diff --git a/libraries/google_compute_routers.rb b/libraries/google_compute_routers.rb new file mode 100644 index 000000000..4254b22cc --- /dev/null +++ b/libraries/google_compute_routers.rb @@ -0,0 +1,94 @@ +# 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 Routers < GcpResourceBase + name 'google_compute_routers' + desc 'Router plural resource' + supports platform: 'gcp' + + attr_reader :table + + filter_table_config = FilterTable.create + + filter_table_config.add(:ids, field: :id) + filter_table_config.add(:creation_timestamps, field: :creation_timestamp) + filter_table_config.add(:names, field: :name) + filter_table_config.add(:descriptions, field: :description) + filter_table_config.add(:networks, field: :network) + filter_table_config.add(:bgps, field: :bgp) + filter_table_config.add(:regions, field: :region) + + filter_table_config.connect(self, :table) + + def base + 'https://www.googleapis.com/compute/v1/' + end + + def url + 'projects/{{project}}/regions/{{region}}/routers' + end + + def initialize(params = {}) + super(params.merge({ use_http_transport: true })) + @params = params + @table = fetch_wrapped_resource('items') + end + + def fetch_wrapped_resource(wrap_path) + # fetch_resource returns an array of responses (to handle pagination) + result = @connection.fetch_all(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 + { + 'id' => ->(obj) { return :id, obj['id'] }, + 'creationTimestamp' => ->(obj) { return :creation_timestamp, parse_time_string(obj['creationTimestamp']) }, + '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']) }, + 'region' => ->(obj) { return :region, obj['region'] }, + } + end + + # Handles parsing RFC3339 time string + def parse_time_string(time_string) + time_string ? Time.parse(time_string) : nil + end +end diff --git a/test/integration/build/gcp-mm.tf b/test/integration/build/gcp-mm.tf index 5d8fb1a5a..3ffe8793c 100644 --- a/test/integration/build/gcp-mm.tf +++ b/test/integration/build/gcp-mm.tf @@ -82,6 +82,10 @@ variable "route" { type = "map" } +variable "router" { + type = "map" +} + resource "google_compute_ssl_policy" "custom-ssl-policy" { name = "${var.ssl_policy["name"]}" min_tls_version = "${var.ssl_policy["min_tls_version"]}" @@ -337,4 +341,21 @@ resource "google_compute_route" "gcp-inspec-route" { # automatically create subnetworks, we need to create a dependency so # the route is not created before the subnetwork depends_on = ["google_compute_subnetwork.inspec-gcp-subnetwork"] +} + +resource "google_compute_router" "gcp-inspec-router" { + project = "${var.gcp_project_id}" + name = "${var.router["name"]}" + network = "${google_compute_network.inspec-gcp-network.name}" + bgp { + asn = "${var.router["bgp_asn"]}" + advertise_mode = "${var.router["bgp_advertise_mode"]}" + advertised_groups = ["${var.router["bgp_advertised_group"]}"] + advertised_ip_ranges { + range = "${var.router["bgp_advertised_ip_range1"]}" + } + advertised_ip_ranges { + range = "${var.router["bgp_advertised_ip_range2"]}" + } + } } \ No newline at end of file diff --git a/test/integration/configuration/mm-attributes.yml b/test/integration/configuration/mm-attributes.yml index 374183d97..699205ecf 100644 --- a/test/integration/configuration/mm-attributes.yml +++ b/test/integration/configuration/mm-attributes.yml @@ -126,3 +126,11 @@ route: dest_range: 15.0.0.0/24 next_hop_ip: 10.2.0.1 priority: 100 + +router: + name: inspec-gcp-router + bgp_asn: 64514 + bgp_advertise_mode: CUSTOM + bgp_advertised_group: "ALL_SUBNETS" + bgp_advertised_ip_range1: "1.2.3.4" + bgp_advertised_ip_range2: "6.7.0.0/16" diff --git a/test/integration/verify/controls/google_compute_router.rb b/test/integration/verify/controls/google_compute_router.rb new file mode 100644 index 000000000..0f9eeb9dc --- /dev/null +++ b/test/integration/verify/controls/google_compute_router.rb @@ -0,0 +1,46 @@ +# ---------------------------------------------------------------------------- +# +# *** 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_compute_router 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.') +router = attribute('router', default: { + "name": "inspec-gcp-router", + "bgp_asn": 64514, + "bgp_advertise_mode": "CUSTOM", + "bgp_advertised_group": "ALL_SUBNETS", + "bgp_advertised_ip_range1": "1.2.3.4", + "bgp_advertised_ip_range2": "6.7.0.0/16" +}, description: 'Compute router description') +gcp_network_name = attribute(:gcp_network_name, default: 'gcp_network_name', description: 'GCP network name') +control 'google_compute_router-1.0' do + impact 1.0 + title 'google_compute_router resource test' + + describe google_compute_router(project: gcp_project_id, region: gcp_location, name: router['name']) do + it { should exist } + its('bgp.asn') { should eq router['bgp_asn'] } + its('bgp.advertise_mode') { should eq router['bgp_advertise_mode'] } + its('bgp.advertised_groups') { should include router['bgp_advertised_group'] } + its('bgp.advertised_ip_ranges.count') { should eq 2 } + its('bgp.advertised_ip_ranges.first.range') { should eq router['bgp_advertised_ip_range1'] } + its('bgp.advertised_ip_ranges.last.range') { should eq router['bgp_advertised_ip_range2'] } + its('network') { should match /\/#{gcp_network_name}$/ } + end + + describe google_compute_router(project: gcp_project_id, region: gcp_location, name: 'nonexistent') do + it { should_not exist } + end +end diff --git a/test/integration/verify/controls/google_compute_routers.rb b/test/integration/verify/controls/google_compute_routers.rb new file mode 100644 index 000000000..6c5347046 --- /dev/null +++ b/test/integration/verify/controls/google_compute_routers.rb @@ -0,0 +1,35 @@ +# ---------------------------------------------------------------------------- +# +# *** 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_compute_routers 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.') +router = attribute('router', default: { + "name": "inspec-gcp-router", + "bgp_asn": 64514, + "bgp_advertise_mode": "CUSTOM", + "bgp_advertised_group": "ALL_SUBNETS", + "bgp_advertised_ip_range1": "1.2.3.4", + "bgp_advertised_ip_range2": "6.7.0.0/16" +}, description: 'Compute router description') +gcp_network_name = attribute(:gcp_network_name, default: 'gcp_network_name', description: 'GCP network name') +control 'google_compute_routers-1.0' do + impact 1.0 + title 'google_compute_routers resource test' + + describe google_compute_routers(project: gcp_project_id, region: gcp_location) do + its('names') { should include router['name'] } + end +end From 696442cd1d0c54f3407248b18cc2116dc2e55e57 Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Fri, 1 Feb 2019 21:56:26 +0000 Subject: [PATCH 2/7] Add support for InSpec disk snapshot Signed-off-by: Modular Magician --- docs/resources/google_compute_snapshot.md | 59 ++++++++++ docs/resources/google_compute_snapshots.md | 45 ++++++++ .../snapshot_snapshot_encryption_key.rb | 35 ++++++ .../snapshot_source_disk_encryption_key.rb | 32 ++++++ libraries/google_compute_snapshot.rb | 77 +++++++++++++ libraries/google_compute_snapshots.rb | 106 ++++++++++++++++++ test/integration/build/gcp-mm.tf | 11 ++ .../configuration/mm-attributes.yml | 3 + .../controls/google_compute_snapshot.rb | 36 ++++++ .../controls/google_compute_snapshots.rb | 39 +++++++ 10 files changed, 443 insertions(+) create mode 100644 docs/resources/google_compute_snapshot.md create mode 100644 docs/resources/google_compute_snapshots.md create mode 100644 libraries/google/compute/property/snapshot_snapshot_encryption_key.rb create mode 100644 libraries/google/compute/property/snapshot_source_disk_encryption_key.rb create mode 100644 libraries/google_compute_snapshot.rb create mode 100644 libraries/google_compute_snapshots.rb create mode 100644 test/integration/verify/controls/google_compute_snapshot.rb create mode 100644 test/integration/verify/controls/google_compute_snapshots.rb diff --git a/docs/resources/google_compute_snapshot.md b/docs/resources/google_compute_snapshot.md new file mode 100644 index 000000000..2dfd8994f --- /dev/null +++ b/docs/resources/google_compute_snapshot.md @@ -0,0 +1,59 @@ +--- +title: About the google_compute_snapshot resource +platform: gcp +--- + +## Syntax +A `google_compute_snapshot` is used to test a Google Snapshot resource + +## Examples +``` + +describe google_compute_snapshot(project: 'chef-gcp-inspec', name: 'inspec-gcp-disk-snapshot') do + it { should exist } + its('source_disk') { should match 'my_disk' } +end + +describe google_compute_snapshot(project: 'chef-gcp-inspec', name: 'nonexistent') do + it { should_not exist } +end +``` + +## Properties +Properties that can be accessed from the `google_compute_snapshot` resource: + + * `creation_timestamp`: Creation timestamp in RFC3339 text format. + + * `id`: The unique identifier for the resource. + + * `disk_size_gb`: Size of the snapshot, specified in GB. + + * `name`: Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. + + * `description`: An optional description of this resource. + + * `storage_bytes`: A size of the the storage used by the snapshot. As snapshots share storage, this number is expected to change with snapshot creation/deletion. + + * `licenses`: A list of public visible licenses that apply to this snapshot. This can be because the original image had licenses attached (such as a Windows image). snapshotEncryptionKey nested object Encrypts the snapshot using a customer-supplied encryption key. + + * `labels`: Labels to apply to this Snapshot. + + * `label_fingerprint`: The fingerprint used for optimistic locking of this resource. Used internally during updates. + + * `source_disk`: A reference to the disk used to create this snapshot. + + * `zone`: A reference to the zone where the disk is hosted. + + * `snapshot_encryption_key`: The customer-supplied encryption key of the snapshot. Required if the source snapshot is protected by a customer-supplied encryption key. + + * `rawKey`: Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. + + * `sha256`: The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key that protects this resource. + + * `kmsKeyName`: The name of the encryption key that is stored in Google Cloud KMS. + + * `source_disk_encryption_key`: The customer-supplied encryption key of the source snapshot. Required if the source snapshot is protected by a customer-supplied encryption key. + + * `rawKey`: Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. + + * `kmsKeyName`: The name of the encryption key that is stored in Google Cloud KMS. diff --git a/docs/resources/google_compute_snapshots.md b/docs/resources/google_compute_snapshots.md new file mode 100644 index 000000000..62e87f0d2 --- /dev/null +++ b/docs/resources/google_compute_snapshots.md @@ -0,0 +1,45 @@ +--- +title: About the google_compute_snapshots resource +platform: gcp +--- + +## Syntax +A `google_compute_snapshots` is used to test a Google Snapshot resource + +## Examples +``` + +describe google_compute_snapshots(project: 'chef-gcp-inspec') do + its('count') { should be >= 1 } +end + +describe.one do + google_compute_snapshots(project: 'chef-gcp-inspec').names do |snapshot_name| + describe google_compute_snapshot(project: 'chef-gcp-inspec', name: snapshot_name) do + its('source_disk') { should match 'my_disk' } + end + end +end +``` + +## Properties +Properties that can be accessed from the `google_compute_snapshots` resource: + +See [google_compute_snapshot.md](google_compute_snapshot.md) for more detailed information + * `creation_timestamps`: an array of `google_compute_snapshot` creation_timestamp + * `ids`: an array of `google_compute_snapshot` id + * `disk_size_gbs`: an array of `google_compute_snapshot` disk_size_gb + * `names`: an array of `google_compute_snapshot` name + * `descriptions`: an array of `google_compute_snapshot` description + * `storage_bytes`: an array of `google_compute_snapshot` storage_bytes + * `licenses`: an array of `google_compute_snapshot` licenses + * `labels`: an array of `google_compute_snapshot` labels + * `label_fingerprints`: an array of `google_compute_snapshot` label_fingerprint + * `source_disks`: an array of `google_compute_snapshot` source_disk + * `zones`: an array of `google_compute_snapshot` zone + * `snapshot_encryption_keys`: an array of `google_compute_snapshot` snapshot_encryption_key + * `source_disk_encryption_keys`: an array of `google_compute_snapshot` source_disk_encryption_key + +## 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. diff --git a/libraries/google/compute/property/snapshot_snapshot_encryption_key.rb b/libraries/google/compute/property/snapshot_snapshot_encryption_key.rb new file mode 100644 index 000000000..20b236be0 --- /dev/null +++ b/libraries/google/compute/property/snapshot_snapshot_encryption_key.rb @@ -0,0 +1,35 @@ +# 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 Compute + module Property + class SnapshotSnapshotencryptionkey + attr_reader :raw_key + + attr_reader :sha256 + + attr_reader :kms_key_name + + def initialize(args = nil) + return if args.nil? + @raw_key = args['rawKey'] + @sha256 = args['sha256'] + @kms_key_name = args['kmsKeyName'] + end + 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 new file mode 100644 index 000000000..c6e803cc3 --- /dev/null +++ b/libraries/google/compute/property/snapshot_source_disk_encryption_key.rb @@ -0,0 +1,32 @@ +# 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 Compute + module Property + class SnapshotSourcediskencryptionkey + attr_reader :raw_key + + attr_reader :kms_key_name + + def initialize(args = nil) + return if args.nil? + @raw_key = args['rawKey'] + @kms_key_name = args['kmsKeyName'] + end + end + end + end +end diff --git a/libraries/google_compute_snapshot.rb b/libraries/google_compute_snapshot.rb new file mode 100644 index 000000000..53826f636 --- /dev/null +++ b/libraries/google_compute_snapshot.rb @@ -0,0 +1,77 @@ +# 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' +require 'google/compute/property/snapshot_snapshot_encryption_key' +require 'google/compute/property/snapshot_source_disk_encryption_key' + +# A provider to manage Google Compute Engine resources. +class Snapshot < GcpResourceBase + name 'google_compute_snapshot' + desc 'Snapshot' + supports platform: 'gcp' + + attr_reader :creation_timestamp + attr_reader :id + attr_reader :disk_size_gb + attr_reader :name + attr_reader :description + attr_reader :storage_bytes + attr_reader :licenses + attr_reader :labels + attr_reader :label_fingerprint + attr_reader :source_disk + attr_reader :zone + attr_reader :snapshot_encryption_key + attr_reader :source_disk_encryption_key + def base + 'https://www.googleapis.com/compute/v1/' + end + + def url + 'projects/{{project}}/global/snapshots/{{name}}' + end + + def initialize(params) + super(params.merge({ use_http_transport: true })) + @fetched = @connection.fetch(base, url, params) + parse unless @fetched.nil? + end + + def parse + @creation_timestamp = parse_time_string(@fetched['creationTimestamp']) + @id = @fetched['id'] + @disk_size_gb = @fetched['diskSizeGb'] + @name = @fetched['name'] + @description = @fetched['description'] + @storage_bytes = @fetched['storageBytes'] + @licenses = @fetched['licenses'] + @labels = @fetched['labels'] + @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']) + 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 +end diff --git a/libraries/google_compute_snapshots.rb b/libraries/google_compute_snapshots.rb new file mode 100644 index 000000000..37931f773 --- /dev/null +++ b/libraries/google_compute_snapshots.rb @@ -0,0 +1,106 @@ +# 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 Snapshots < GcpResourceBase + name 'google_compute_snapshots' + desc 'Snapshot plural resource' + supports platform: 'gcp' + + attr_reader :table + + filter_table_config = FilterTable.create + + filter_table_config.add(:creation_timestamps, field: :creation_timestamp) + filter_table_config.add(:ids, field: :id) + filter_table_config.add(:disk_size_gbs, field: :disk_size_gb) + filter_table_config.add(:names, field: :name) + filter_table_config.add(:descriptions, field: :description) + filter_table_config.add(:storage_bytes, field: :storage_bytes) + filter_table_config.add(:licenses, field: :licenses) + filter_table_config.add(:labels, field: :labels) + filter_table_config.add(:label_fingerprints, field: :label_fingerprint) + filter_table_config.add(:source_disks, field: :source_disk) + filter_table_config.add(:zones, field: :zone) + filter_table_config.add(:snapshot_encryption_keys, field: :snapshot_encryption_key) + filter_table_config.add(:source_disk_encryption_keys, field: :source_disk_encryption_key) + + filter_table_config.connect(self, :table) + + def base + 'https://www.googleapis.com/compute/v1/' + end + + def url + 'projects/{{project}}/global/snapshots' + end + + def initialize(params = {}) + super(params.merge({ use_http_transport: true })) + @params = params + @table = fetch_wrapped_resource('items') + end + + def fetch_wrapped_resource(wrap_path) + # fetch_resource returns an array of responses (to handle pagination) + result = @connection.fetch_all(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 + { + 'creationTimestamp' => ->(obj) { return :creation_timestamp, parse_time_string(obj['creationTimestamp']) }, + 'id' => ->(obj) { return :id, obj['id'] }, + 'diskSizeGb' => ->(obj) { return :disk_size_gb, obj['diskSizeGb'] }, + 'name' => ->(obj) { return :name, obj['name'] }, + 'description' => ->(obj) { return :description, obj['description'] }, + 'storageBytes' => ->(obj) { return :storage_bytes, obj['storageBytes'] }, + 'licenses' => ->(obj) { return :licenses, obj['licenses'] }, + 'labels' => ->(obj) { return :labels, obj['labels'] }, + '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']) }, + } + end + + # Handles parsing RFC3339 time string + def parse_time_string(time_string) + time_string ? Time.parse(time_string) : nil + end +end diff --git a/test/integration/build/gcp-mm.tf b/test/integration/build/gcp-mm.tf index 3ffe8793c..c99734988 100644 --- a/test/integration/build/gcp-mm.tf +++ b/test/integration/build/gcp-mm.tf @@ -86,6 +86,10 @@ variable "router" { type = "map" } +variable "snapshot" { + type = "map" +} + resource "google_compute_ssl_policy" "custom-ssl-policy" { name = "${var.ssl_policy["name"]}" min_tls_version = "${var.ssl_policy["min_tls_version"]}" @@ -358,4 +362,11 @@ resource "google_compute_router" "gcp-inspec-router" { range = "${var.router["bgp_advertised_ip_range2"]}" } } +} + +resource "google_compute_snapshot" "gcp-inspec-snapshot" { + project = "${var.gcp_project_id}" + name = "${var.snapshot["name"]}" + source_disk = "${google_compute_disk.generic_compute_disk.name}" + zone = "${var.gcp_zone}" } \ No newline at end of file diff --git a/test/integration/configuration/mm-attributes.yml b/test/integration/configuration/mm-attributes.yml index 699205ecf..20c365268 100644 --- a/test/integration/configuration/mm-attributes.yml +++ b/test/integration/configuration/mm-attributes.yml @@ -134,3 +134,6 @@ router: bgp_advertised_group: "ALL_SUBNETS" bgp_advertised_ip_range1: "1.2.3.4" bgp_advertised_ip_range2: "6.7.0.0/16" + +snapshot: + name: inspec-gcp-disk-snapshot diff --git a/test/integration/verify/controls/google_compute_snapshot.rb b/test/integration/verify/controls/google_compute_snapshot.rb new file mode 100644 index 000000000..50432a357 --- /dev/null +++ b/test/integration/verify/controls/google_compute_snapshot.rb @@ -0,0 +1,36 @@ +# ---------------------------------------------------------------------------- +# +# *** 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_compute_snapshot resource.' + +gcp_project_id = attribute(:gcp_project_id, default: 'gcp_project_id', description: 'The GCP project identifier.') +gcp_zone = attribute(:gcp_zone, default: 'gcp_zone', description: 'GCP zone name of the compute disk') +gcp_compute_disk_name = attribute(:gcp_compute_disk_name, default: 'gcp_compute_disk_name', description: 'The name of the GCP compute disk to snapshot') +snapshot = attribute('snapshot', default: { + "name": "inspec-gcp-disk-snapshot" +}, description: 'Compute disk snapshot description') +control 'google_compute_snapshot-1.0' do + impact 1.0 + title 'google_compute_snapshot resource test' + + + describe google_compute_snapshot(project: gcp_project_id, name: snapshot['name']) do + it { should exist } + its('source_disk') { should match gcp_compute_disk_name } + end + + describe google_compute_snapshot(project: gcp_project_id, name: 'nonexistent') do + it { should_not exist } + end +end diff --git a/test/integration/verify/controls/google_compute_snapshots.rb b/test/integration/verify/controls/google_compute_snapshots.rb new file mode 100644 index 000000000..692820543 --- /dev/null +++ b/test/integration/verify/controls/google_compute_snapshots.rb @@ -0,0 +1,39 @@ +# ---------------------------------------------------------------------------- +# +# *** 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_compute_snapshots resource.' + +gcp_project_id = attribute(:gcp_project_id, default: 'gcp_project_id', description: 'The GCP project identifier.') +gcp_zone = attribute(:gcp_zone, default: 'gcp_zone', description: 'GCP zone name of the compute disk') +gcp_compute_disk_name = attribute(:gcp_compute_disk_name, default: 'gcp_compute_disk_name', description: 'The name of the GCP compute disk to snapshot') +snapshot = attribute('snapshot', default: { + "name": "inspec-gcp-disk-snapshot" +}, description: 'Compute disk snapshot description') +control 'google_compute_snapshots-1.0' do + impact 1.0 + title 'google_compute_snapshots resource test' + + + describe google_compute_snapshots(project: gcp_project_id) do + its('count') { should be >= 1 } + end + + describe.one do + google_compute_snapshots(project: gcp_project_id).names do |snapshot_name| + describe google_compute_snapshot(project: gcp_project_id, name: snapshot_name) do + its('source_disk') { should match gcp_compute_disk_name } + end + end + end +end From a33b366bb718b5f2eccb9a3abbbb517c85759d11 Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Sat, 2 Feb 2019 01:36:46 +0000 Subject: [PATCH 3/7] Inspec ssl certificate Signed-off-by: Modular Magician --- .../google_compute_ssl_certificate.md | 52 ++++++++++ .../google_compute_ssl_certificates.md | 49 ++++++++++ .../google_compute_target_https_proxies.md | 32 +++++++ .../google_compute_target_https_proxy.md | 39 ++++++++ libraries/google_compute_ssl_certificate.rb | 61 ++++++++++++ libraries/google_compute_ssl_certificates.rb | 92 ++++++++++++++++++ .../google_compute_target_https_proxies.rb | 96 +++++++++++++++++++ .../google_compute_target_https_proxy.rb | 65 +++++++++++++ test/integration/build/gcp-mm.tf | 24 +++++ .../configuration/mm-attributes.yml | 32 +++++++ .../google_compute_ssl_certificate.rb | 37 +++++++ .../google_compute_ssl_certificates.rb | 34 +++++++ .../google_compute_target_https_proxies.rb | 30 ++++++ .../google_compute_target_https_proxy.rb | 35 +++++++ 14 files changed, 678 insertions(+) create mode 100644 docs/resources/google_compute_ssl_certificate.md create mode 100644 docs/resources/google_compute_ssl_certificates.md create mode 100644 docs/resources/google_compute_target_https_proxies.md create mode 100644 docs/resources/google_compute_target_https_proxy.md create mode 100644 libraries/google_compute_ssl_certificate.rb create mode 100644 libraries/google_compute_ssl_certificates.rb create mode 100644 libraries/google_compute_target_https_proxies.rb create mode 100644 libraries/google_compute_target_https_proxy.rb create mode 100644 test/integration/verify/controls/google_compute_ssl_certificate.rb create mode 100644 test/integration/verify/controls/google_compute_ssl_certificates.rb create mode 100644 test/integration/verify/controls/google_compute_target_https_proxies.rb create mode 100644 test/integration/verify/controls/google_compute_target_https_proxy.rb diff --git a/docs/resources/google_compute_ssl_certificate.md b/docs/resources/google_compute_ssl_certificate.md new file mode 100644 index 000000000..9d8084fae --- /dev/null +++ b/docs/resources/google_compute_ssl_certificate.md @@ -0,0 +1,52 @@ +--- +title: About the google_compute_ssl_certificate resource +platform: gcp +--- + +## Syntax +A `google_compute_ssl_certificate` is used to test a Google SslCertificate resource + +## Examples +``` +describe google_compute_ssl_certificate(project: 'chef-gcp-inspec', name: 'inspec-gcp-ssl-certificate') do + it { should exist } + its('description') { should eq 'A fake ssl certificate (DO NOT USE)' } + its('certificate') { should eq '-----BEGIN CERTIFICATE----- +MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG +EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT +BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm +b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN +AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 +MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP +BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM +FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z +aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH +KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ +4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O +BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn +0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O +M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ +zqGNhIPGq2ULqXKK8BY= +-----END CERTIFICATE----- +' } +end + +describe google_compute_ssl_certificate(project: 'chef-gcp-inspec', name: 'nonexistent') do + it { should_not exist } +end +``` + +## Properties +Properties that can be accessed from the `google_compute_ssl_certificate` resource: + + * `certificate`: The certificate in PEM format. The certificate chain must be no greater than 5 certs long. The chain must include at least one intermediate cert. + + * `creation_timestamp`: Creation timestamp in RFC3339 text format. + + * `description`: An optional description of this resource. + + * `id`: The unique identifier for the resource. + + * `name`: Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. + + * `private_key`: The write-only private key in PEM format. diff --git a/docs/resources/google_compute_ssl_certificates.md b/docs/resources/google_compute_ssl_certificates.md new file mode 100644 index 000000000..ab1db6bd7 --- /dev/null +++ b/docs/resources/google_compute_ssl_certificates.md @@ -0,0 +1,49 @@ +--- +title: About the google_compute_ssl_certificates resource +platform: gcp +--- + +## Syntax +A `google_compute_ssl_certificates` is used to test a Google SslCertificate resource + +## Examples +``` +describe google_compute_ssl_certificates(project: 'chef-gcp-inspec') do + + its('names') { should include 'inspec-gcp-ssl-certificate' } + its('descriptions') { should include 'A fake ssl certificate (DO NOT USE)' } + its('certificates') { should include '-----BEGIN CERTIFICATE----- +MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG +EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT +BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm +b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN +AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 +MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP +BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM +FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z +aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH +KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ +4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O +BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn +0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O +M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ +zqGNhIPGq2ULqXKK8BY= +-----END CERTIFICATE----- +' } +end +``` + +## Properties +Properties that can be accessed from the `google_compute_ssl_certificates` resource: + +See [google_compute_ssl_certificate.md](google_compute_ssl_certificate.md) for more detailed information + * `certificates`: an array of `google_compute_ssl_certificate` certificate + * `creation_timestamps`: an array of `google_compute_ssl_certificate` creation_timestamp + * `descriptions`: an array of `google_compute_ssl_certificate` description + * `ids`: an array of `google_compute_ssl_certificate` id + * `names`: an array of `google_compute_ssl_certificate` name + * `private_keys`: an array of `google_compute_ssl_certificate` private_key + +## 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. diff --git a/docs/resources/google_compute_target_https_proxies.md b/docs/resources/google_compute_target_https_proxies.md new file mode 100644 index 000000000..72c26502d --- /dev/null +++ b/docs/resources/google_compute_target_https_proxies.md @@ -0,0 +1,32 @@ +--- +title: About the google_compute_target_https_proxies resource +platform: gcp +--- + +## Syntax +A `google_compute_target_https_proxies` is used to test a Google TargetHttpsProxy resource + +## Examples +``` +describe google_compute_target_https_proxies(project: 'chef-gcp-inspec') do + its('names') { should include 'inspec-gcp-https-proxy' } + its('descriptions') { should include 'A HTTPS target proxy' } +end +``` + +## Properties +Properties that can be accessed from the `google_compute_target_https_proxies` resource: + +See [google_compute_target_https_proxy.md](google_compute_target_https_proxy.md) for more detailed information + * `creation_timestamps`: an array of `google_compute_target_https_proxy` creation_timestamp + * `descriptions`: an array of `google_compute_target_https_proxy` description + * `ids`: an array of `google_compute_target_https_proxy` id + * `names`: an array of `google_compute_target_https_proxy` name + * `quic_overrides`: an array of `google_compute_target_https_proxy` quic_override + * `ssl_certificates`: an array of `google_compute_target_https_proxy` ssl_certificates + * `ssl_policies`: an array of `google_compute_target_https_proxy` ssl_policy + * `url_maps`: an array of `google_compute_target_https_proxy` url_map + +## 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. diff --git a/docs/resources/google_compute_target_https_proxy.md b/docs/resources/google_compute_target_https_proxy.md new file mode 100644 index 000000000..eaecf3d4b --- /dev/null +++ b/docs/resources/google_compute_target_https_proxy.md @@ -0,0 +1,39 @@ +--- +title: About the google_compute_target_https_proxy resource +platform: gcp +--- + +## Syntax +A `google_compute_target_https_proxy` is used to test a Google TargetHttpsProxy resource + +## Examples +``` +describe google_compute_target_https_proxy(project: 'chef-gcp-inspec', name: 'inspec-gcp-https-proxy') do + it { should exist } + its('url_map') { should match /\/inspec-gcp-url-map$/ } + its('description') { should eq 'A HTTPS target proxy' } +end + +describe google_compute_target_https_proxy(project: 'chef-gcp-inspec', name: 'nonexistent') do + it { should_not exist } +end +``` + +## Properties +Properties that can be accessed from the `google_compute_target_https_proxy` resource: + + * `creation_timestamp`: Creation timestamp in RFC3339 text format. + + * `description`: An optional description of this resource. + + * `id`: The unique identifier for the resource. + + * `name`: Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. + + * `quic_override`: Specifies the QUIC override policy for this resource. This determines whether the load balancer will attempt to negotiate QUIC with clients or not. Can specify one of NONE, ENABLE, or DISABLE. If NONE is specified, uses the QUIC policy with no user overrides, which is equivalent to DISABLE. Not specifying this field is equivalent to specifying NONE. + + * `ssl_certificates`: A list of SslCertificate resources that are used to authenticate connections between users and the load balancer. Currently, exactly one SSL certificate must be specified. + + * `ssl_policy`: A reference to the SslPolicy resource that will be associated with the TargetHttpsProxy resource. If not set, the TargetHttpsProxy resource will not have any SSL policy configured. + + * `url_map`: A reference to the UrlMap resource that defines the mapping from URL to the BackendService. diff --git a/libraries/google_compute_ssl_certificate.rb b/libraries/google_compute_ssl_certificate.rb new file mode 100644 index 000000000..6dbcdff93 --- /dev/null +++ b/libraries/google_compute_ssl_certificate.rb @@ -0,0 +1,61 @@ +# 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 Google Compute Engine resources. +class SslCertificate < GcpResourceBase + name 'google_compute_ssl_certificate' + desc 'SslCertificate' + supports platform: 'gcp' + + attr_reader :certificate + attr_reader :creation_timestamp + attr_reader :description + attr_reader :id + attr_reader :name + attr_reader :private_key + def base + 'https://www.googleapis.com/compute/v1/' + end + + def url + 'projects/{{project}}/global/sslCertificates/{{name}}' + end + + def initialize(params) + super(params.merge({ use_http_transport: true })) + @fetched = @connection.fetch(base, url, params) + parse unless @fetched.nil? + end + + def parse + @certificate = @fetched['certificate'] + @creation_timestamp = parse_time_string(@fetched['creationTimestamp']) + @description = @fetched['description'] + @id = @fetched['id'] + @name = @fetched['name'] + @private_key = @fetched['privateKey'] + 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 +end diff --git a/libraries/google_compute_ssl_certificates.rb b/libraries/google_compute_ssl_certificates.rb new file mode 100644 index 000000000..0cb922ce1 --- /dev/null +++ b/libraries/google_compute_ssl_certificates.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 SslCertificates < GcpResourceBase + name 'google_compute_ssl_certificates' + desc 'SslCertificate plural resource' + supports platform: 'gcp' + + attr_reader :table + + filter_table_config = FilterTable.create + + filter_table_config.add(:certificates, field: :certificate) + filter_table_config.add(:creation_timestamps, field: :creation_timestamp) + filter_table_config.add(:descriptions, field: :description) + filter_table_config.add(:ids, field: :id) + filter_table_config.add(:names, field: :name) + filter_table_config.add(:private_keys, field: :private_key) + + filter_table_config.connect(self, :table) + + def base + 'https://www.googleapis.com/compute/v1/' + end + + def url + 'projects/{{project}}/global/sslCertificates' + end + + def initialize(params = {}) + super(params.merge({ use_http_transport: true })) + @params = params + @table = fetch_wrapped_resource('items') + end + + def fetch_wrapped_resource(wrap_path) + # fetch_resource returns an array of responses (to handle pagination) + result = @connection.fetch_all(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 + { + 'certificate' => ->(obj) { return :certificate, obj['certificate'] }, + 'creationTimestamp' => ->(obj) { return :creation_timestamp, parse_time_string(obj['creationTimestamp']) }, + 'description' => ->(obj) { return :description, obj['description'] }, + 'id' => ->(obj) { return :id, obj['id'] }, + 'name' => ->(obj) { return :name, obj['name'] }, + 'privateKey' => ->(obj) { return :private_key, obj['privateKey'] }, + } + end + + # Handles parsing RFC3339 time string + def parse_time_string(time_string) + time_string ? Time.parse(time_string) : nil + end +end diff --git a/libraries/google_compute_target_https_proxies.rb b/libraries/google_compute_target_https_proxies.rb new file mode 100644 index 000000000..b55270214 --- /dev/null +++ b/libraries/google_compute_target_https_proxies.rb @@ -0,0 +1,96 @@ +# 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 TargetHttpsProxys < GcpResourceBase + name 'google_compute_target_https_proxies' + desc 'TargetHttpsProxy plural resource' + supports platform: 'gcp' + + attr_reader :table + + filter_table_config = FilterTable.create + + filter_table_config.add(:creation_timestamps, field: :creation_timestamp) + filter_table_config.add(:descriptions, field: :description) + filter_table_config.add(:ids, field: :id) + filter_table_config.add(:names, field: :name) + filter_table_config.add(:quic_overrides, field: :quic_override) + filter_table_config.add(:ssl_certificates, field: :ssl_certificates) + filter_table_config.add(:ssl_policies, field: :ssl_policy) + filter_table_config.add(:url_maps, field: :url_map) + + filter_table_config.connect(self, :table) + + def base + 'https://www.googleapis.com/compute/v1/' + end + + def url + 'projects/{{project}}/global/targetHttpsProxies' + end + + def initialize(params = {}) + super(params.merge({ use_http_transport: true })) + @params = params + @table = fetch_wrapped_resource('items') + end + + def fetch_wrapped_resource(wrap_path) + # fetch_resource returns an array of responses (to handle pagination) + result = @connection.fetch_all(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 + { + 'creationTimestamp' => ->(obj) { return :creation_timestamp, parse_time_string(obj['creationTimestamp']) }, + 'description' => ->(obj) { return :description, obj['description'] }, + 'id' => ->(obj) { return :id, obj['id'] }, + 'name' => ->(obj) { return :name, obj['name'] }, + 'quicOverride' => ->(obj) { return :quic_override, obj['quicOverride'] }, + 'sslCertificates' => ->(obj) { return :ssl_certificates, obj['sslCertificates'] }, + 'sslPolicy' => ->(obj) { return :ssl_policy, obj['sslPolicy'] }, + 'urlMap' => ->(obj) { return :url_map, obj['urlMap'] }, + } + end + + # Handles parsing RFC3339 time string + def parse_time_string(time_string) + time_string ? Time.parse(time_string) : nil + end +end diff --git a/libraries/google_compute_target_https_proxy.rb b/libraries/google_compute_target_https_proxy.rb new file mode 100644 index 000000000..a7a13378d --- /dev/null +++ b/libraries/google_compute_target_https_proxy.rb @@ -0,0 +1,65 @@ +# 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 Google Compute Engine resources. +class TargetHttpsProxy < GcpResourceBase + name 'google_compute_target_https_proxy' + desc 'TargetHttpsProxy' + supports platform: 'gcp' + + attr_reader :creation_timestamp + attr_reader :description + attr_reader :id + attr_reader :name + attr_reader :quic_override + attr_reader :ssl_certificates + attr_reader :ssl_policy + attr_reader :url_map + def base + 'https://www.googleapis.com/compute/v1/' + end + + def url + 'projects/{{project}}/global/targetHttpsProxies/{{name}}' + end + + def initialize(params) + super(params.merge({ use_http_transport: true })) + @fetched = @connection.fetch(base, url, params) + parse unless @fetched.nil? + end + + def parse + @creation_timestamp = parse_time_string(@fetched['creationTimestamp']) + @description = @fetched['description'] + @id = @fetched['id'] + @name = @fetched['name'] + @quic_override = @fetched['quicOverride'] + @ssl_certificates = @fetched['sslCertificates'] + @ssl_policy = @fetched['sslPolicy'] + @url_map = @fetched['urlMap'] + 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 +end diff --git a/test/integration/build/gcp-mm.tf b/test/integration/build/gcp-mm.tf index c99734988..23f803e70 100644 --- a/test/integration/build/gcp-mm.tf +++ b/test/integration/build/gcp-mm.tf @@ -90,6 +90,14 @@ variable "snapshot" { type = "map" } +variable "https_proxy" { + type = "map" +} + +variable "ssl_certificate" { + type = "map" +} + resource "google_compute_ssl_policy" "custom-ssl-policy" { name = "${var.ssl_policy["name"]}" min_tls_version = "${var.ssl_policy["min_tls_version"]}" @@ -369,4 +377,20 @@ resource "google_compute_snapshot" "gcp-inspec-snapshot" { name = "${var.snapshot["name"]}" source_disk = "${google_compute_disk.generic_compute_disk.name}" zone = "${var.gcp_zone}" +} + +resource "google_compute_ssl_certificate" "gcp-inspec-ssl-certificate" { + project = "${var.gcp_project_id}" + name = "${var.ssl_certificate["name"]}" + private_key = "${var.ssl_certificate["private_key"]}" + certificate = "${var.ssl_certificate["certificate"]}" + description = "${var.ssl_certificate["description"]}" +} + +resource "google_compute_target_https_proxy" "gcp-inspec-https-proxy" { + project = "${var.gcp_project_id}" + name = "${var.https_proxy["name"]}" + url_map = "${google_compute_url_map.gcp-inspec-url-map.self_link}" + description = "${var.https_proxy["description"]}" + ssl_certificates = ["${google_compute_ssl_certificate.gcp-inspec-ssl-certificate.self_link}"] } \ No newline at end of file diff --git a/test/integration/configuration/mm-attributes.yml b/test/integration/configuration/mm-attributes.yml index 20c365268..eb2437a4a 100644 --- a/test/integration/configuration/mm-attributes.yml +++ b/test/integration/configuration/mm-attributes.yml @@ -137,3 +137,35 @@ router: snapshot: name: inspec-gcp-disk-snapshot + +https_proxy: + name: inspec-gcp-https-proxy + description: A HTTPS target proxy + +ssl_certificate: + name: inspec-gcp-ssl-certificate + description: A fake ssl certificate (DO NOT USE) + certificate: | + -----BEGIN CERTIFICATE----- + MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT + BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN + AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP + BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z + aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ + 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn + 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ + zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE----- + private_key: | + -----BEGIN EC PRIVATE KEY----- + MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f + OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY----- \ No newline at end of file diff --git a/test/integration/verify/controls/google_compute_ssl_certificate.rb b/test/integration/verify/controls/google_compute_ssl_certificate.rb new file mode 100644 index 000000000..f9c8b544b --- /dev/null +++ b/test/integration/verify/controls/google_compute_ssl_certificate.rb @@ -0,0 +1,37 @@ +# ---------------------------------------------------------------------------- +# +# *** 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_compute_ssl_certificate resource.' + +gcp_project_id = attribute(:gcp_project_id, default: 'gcp_project_id', description: 'The GCP project identifier.') +ssl_certificate = attribute('ssl_certificate', default: { + "name": "inspec-gcp-ssl-certificate", + "description": "A fake ssl certificate (DO NOT USE)", + "certificate": "-----BEGIN CERTIFICATE-----\nMIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG\nEwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT\nBgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm\nb3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN\nAQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2\nMDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP\nBgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM\nFUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z\naXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH\nKoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ\n4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O\nBBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn\n0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O\nM3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ\nzqGNhIPGq2ULqXKK8BY=\n-----END CERTIFICATE-----\n", + "private_key": "-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49\nAwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f\nOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==\n-----END EC PRIVATE KEY-----" +}, description: 'A GCP SSL certificate definition') +control 'google_compute_ssl_certificate-1.0' do + impact 1.0 + title 'google_compute_ssl_certificate resource test' + + describe google_compute_ssl_certificate(project: gcp_project_id, name: ssl_certificate['name']) do + it { should exist } + its('description') { should eq ssl_certificate['description'] } + its('certificate') { should eq ssl_certificate['certificate'] } + end + + describe google_compute_ssl_certificate(project: gcp_project_id, name: 'nonexistent') do + it { should_not exist } + end +end diff --git a/test/integration/verify/controls/google_compute_ssl_certificates.rb b/test/integration/verify/controls/google_compute_ssl_certificates.rb new file mode 100644 index 000000000..10ec90b24 --- /dev/null +++ b/test/integration/verify/controls/google_compute_ssl_certificates.rb @@ -0,0 +1,34 @@ +# ---------------------------------------------------------------------------- +# +# *** 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_compute_ssl_certificates resource.' + +gcp_project_id = attribute(:gcp_project_id, default: 'gcp_project_id', description: 'The GCP project identifier.') +ssl_certificate = attribute('ssl_certificate', default: { + "name": "inspec-gcp-ssl-certificate", + "description": "A fake ssl certificate (DO NOT USE)", + "certificate": "-----BEGIN CERTIFICATE-----\nMIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG\nEwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT\nBgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm\nb3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN\nAQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2\nMDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP\nBgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM\nFUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z\naXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH\nKoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ\n4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O\nBBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn\n0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O\nM3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ\nzqGNhIPGq2ULqXKK8BY=\n-----END CERTIFICATE-----\n", + "private_key": "-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49\nAwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f\nOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==\n-----END EC PRIVATE KEY-----" +}, description: 'A GCP SSL certificate definition') +control 'google_compute_ssl_certificates-1.0' do + impact 1.0 + title 'google_compute_ssl_certificates resource test' + + describe google_compute_ssl_certificates(project: gcp_project_id) do + + its('names') { should include ssl_certificate['name'] } + its('descriptions') { should include ssl_certificate['description'] } + its('certificates') { should include ssl_certificate['certificate'] } + end +end diff --git a/test/integration/verify/controls/google_compute_target_https_proxies.rb b/test/integration/verify/controls/google_compute_target_https_proxies.rb new file mode 100644 index 000000000..90d7a9eff --- /dev/null +++ b/test/integration/verify/controls/google_compute_target_https_proxies.rb @@ -0,0 +1,30 @@ +# ---------------------------------------------------------------------------- +# +# *** 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_compute_target_https_proxies resource.' + +gcp_project_id = attribute(:gcp_project_id, default: 'gcp_project_id', description: 'The GCP project identifier.') +https_proxy = attribute('https_proxy', default: { + "name": "inspec-gcp-https-proxy", + "description": "A HTTPS target proxy" +}, description: 'Compute HTTPS proxy definition') +control 'google_compute_target_https_proxies-1.0' do + impact 1.0 + title 'google_compute_target_https_proxies resource test' + + describe google_compute_target_https_proxies(project: gcp_project_id) do + its('names') { should include https_proxy['name'] } + its('descriptions') { should include https_proxy['description'] } + end +end diff --git a/test/integration/verify/controls/google_compute_target_https_proxy.rb b/test/integration/verify/controls/google_compute_target_https_proxy.rb new file mode 100644 index 000000000..24ff7ea64 --- /dev/null +++ b/test/integration/verify/controls/google_compute_target_https_proxy.rb @@ -0,0 +1,35 @@ +# ---------------------------------------------------------------------------- +# +# *** 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_compute_target_https_proxy resource.' + +gcp_project_id = attribute(:gcp_project_id, default: 'gcp_project_id', description: 'The GCP project identifier.') +https_proxy = attribute('https_proxy', default: { + "name": "inspec-gcp-https-proxy", + "description": "A HTTPS target proxy" +}, description: 'Compute HTTPS proxy definition') +control 'google_compute_target_https_proxy-1.0' do + impact 1.0 + title 'google_compute_target_https_proxy resource test' + + describe google_compute_target_https_proxy(project: gcp_project_id, name: https_proxy['name']) do + it { should exist } + its('url_map') { should match /\/inspec-gcp-url-map$/ } + its('description') { should eq https_proxy['description'] } + end + + describe google_compute_target_https_proxy(project: gcp_project_id, name: 'nonexistent') do + it { should_not exist } + end +end From a67098989c56fc8ba878a31efd693d98855202a1 Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Wed, 6 Feb 2019 17:51:10 +0000 Subject: [PATCH 4/7] Fix InSpec pubsub subscription test Signed-off-by: Modular Magician --- docs/resources/google_pubsub_subscriptions.md | 3 +-- .../integration/verify/controls/google_pubsub_subscriptions.rb | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/resources/google_pubsub_subscriptions.md b/docs/resources/google_pubsub_subscriptions.md index 29329d1c7..5bc3dba41 100644 --- a/docs/resources/google_pubsub_subscriptions.md +++ b/docs/resources/google_pubsub_subscriptions.md @@ -9,8 +9,7 @@ A `google_pubsub_subscriptions` is used to test a Google Subscription resource ## Examples ``` describe google_pubsub_subscriptions(project: 'chef-gcp-inspec') do - it { should exist } - its('count') { should eq 1 } + its('count') { should be >= 1 } end google_pubsub_subscriptions(project: 'chef-gcp-inspec').names.each do |subscription_name| diff --git a/test/integration/verify/controls/google_pubsub_subscriptions.rb b/test/integration/verify/controls/google_pubsub_subscriptions.rb index 73f8afa63..9ebe3eaa6 100644 --- a/test/integration/verify/controls/google_pubsub_subscriptions.rb +++ b/test/integration/verify/controls/google_pubsub_subscriptions.rb @@ -22,8 +22,7 @@ title 'google_pubsub_subscriptions resource test' describe google_pubsub_subscriptions(project: gcp_project_id) do - it { should exist } - its('count') { should eq 1 } + its('count') { should be >= 1 } end google_pubsub_subscriptions(project: gcp_project_id).names.each do |subscription_name| From 1f91b4fa8b7076d531cd57af0744d77de34e330a Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Wed, 6 Feb 2019 21:51:48 +0000 Subject: [PATCH 5/7] InSpec add support for BigQuery Dataset Signed-off-by: Modular Magician --- docs/resources/google_bigquery_dataset.md | 82 +++++++++++++++++ docs/resources/google_bigquery_datasets.md | 30 +++++++ .../bigquery/property/dataset_access.rb | 53 +++++++++++ .../property/dataset_dataset_reference.rb | 32 +++++++ .../google/bigquery/property/dataset_view.rb | 35 ++++++++ libraries/google_bigquery_dataset.rb | 73 +++++++++++++++ libraries/google_bigquery_datasets.rb | 90 +++++++++++++++++++ test/integration/build/gcp-mm.tf | 23 +++++ .../configuration/mm-attributes.yml | 13 ++- .../controls/google_bigquery_dataset.rb | 63 +++++++++++++ .../controls/google_bigquery_datasets.rb | 38 ++++++++ .../google_compute_ssl_certificate.rb | 2 +- .../google_compute_ssl_certificates.rb | 2 +- 13 files changed, 533 insertions(+), 3 deletions(-) create mode 100644 docs/resources/google_bigquery_dataset.md create mode 100644 docs/resources/google_bigquery_datasets.md create mode 100644 libraries/google/bigquery/property/dataset_access.rb create mode 100644 libraries/google/bigquery/property/dataset_dataset_reference.rb create mode 100644 libraries/google/bigquery/property/dataset_view.rb create mode 100644 libraries/google_bigquery_dataset.rb create mode 100644 libraries/google_bigquery_datasets.rb create mode 100644 test/integration/verify/controls/google_bigquery_dataset.rb create mode 100644 test/integration/verify/controls/google_bigquery_datasets.rb diff --git a/docs/resources/google_bigquery_dataset.md b/docs/resources/google_bigquery_dataset.md new file mode 100644 index 000000000..2da3080a9 --- /dev/null +++ b/docs/resources/google_bigquery_dataset.md @@ -0,0 +1,82 @@ +--- +title: About the google_bigquery_dataset resource +platform: gcp +--- + +## Syntax +A `google_bigquery_dataset` is used to test a Google Dataset resource + +## Examples +``` +describe google_bigquery_dataset(project: 'chef-gcp-inspec', name: 'inspec_gcp_dataset') do + it { should exist } + + its('friendly_name') { should eq 'A BigQuery dataset test' } + its('location') { should eq 'EU' } + its('description') { should eq 'Test BigQuery dataset description' } + its('default_table_expiration_ms') { should cmp '3600000' } +end + +describe.one do + google_bigquery_dataset(project: 'chef-gcp-inspec', name: 'inspec_gcp_dataset').access.each do |dataset_access| + describe dataset_access do + its('role') { should eq 'READER' } + its('domain') { should eq 'example.com' } + end + end +end + +describe.one do + google_bigquery_dataset(project: 'chef-gcp-inspec', name: 'inspec_gcp_dataset').access.each do |dataset_access| + describe dataset_access do + its('role') { should eq 'WRITER' } + its('special_group') { should eq 'projectWriters' } + end + end +end + +describe google_bigquery_dataset(project: 'chef-gcp-inspec', name: 'nonexistent') do + it { should_not exist } +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 + + * `groupByEmail`: An email address of a Google Group to grant access to + + * `role`: Describes the rights granted to the user specified by the other member of the access object + + * `specialGroup`: A special group to grant access to. + + * `userByEmail`: An email address of a user to grant access to. For example: fred@example.com + + * `view`: A view from a different dataset to grant access to. Queries executed against that view will have read access to tables in this dataset. The role field is not required when this field is set. If that view is updated by any user, access to the view needs to be granted again via an update operation. + + * `creation_time`: The time when this dataset was created, in milliseconds since the epoch. + + * `dataset_reference`: A reference that identifies the dataset. + + * `datasetId`: A unique ID for this dataset, without the project name. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters. + + * `projectId`: The ID of the project containing this dataset. + + * `default_table_expiration_ms`: The default lifetime of all tables in the dataset, in milliseconds + + * `description`: A user-friendly description of the dataset + + * `friendly_name`: A descriptive name for the dataset + + * `id`: The fully-qualified unique name of the dataset in the format projectId:datasetId. The dataset name without the project name is given in the datasetId field + + * `labels`: The labels associated with this dataset. You can use these to organize and group your datasets + + * `last_modified_time`: The date when this dataset or any of its tables was last modified, in milliseconds since the epoch. + + * `location`: The geographic location where the dataset should reside. Possible values include EU and US. The default value is US. diff --git a/docs/resources/google_bigquery_datasets.md b/docs/resources/google_bigquery_datasets.md new file mode 100644 index 000000000..f8412c64c --- /dev/null +++ b/docs/resources/google_bigquery_datasets.md @@ -0,0 +1,30 @@ +--- +title: About the google_bigquery_datasets resource +platform: gcp +--- + +## Syntax +A `google_bigquery_datasets` is used to test a Google Dataset resource + +## Examples +``` +describe google_bigquery_datasets(project: 'chef-gcp-inspec') do + its('count') { should be >= 1 } + its('friendly_names') { should include 'A BigQuery dataset test' } + its('locations') { should include 'EU' } +end +``` + +## Properties +Properties that can be accessed from the `google_bigquery_datasets` resource: + +See [google_bigquery_dataset.md](google_bigquery_dataset.md) for more detailed information + * `dataset_references`: an array of `google_bigquery_dataset` dataset_reference + * `friendly_names`: an array of `google_bigquery_dataset` friendly_name + * `ids`: an array of `google_bigquery_dataset` id + * `labels`: an array of `google_bigquery_dataset` labels + * `locations`: an array of `google_bigquery_dataset` location + +## 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. diff --git a/libraries/google/bigquery/property/dataset_access.rb b/libraries/google/bigquery/property/dataset_access.rb new file mode 100644 index 000000000..9fae4cea2 --- /dev/null +++ b/libraries/google/bigquery/property/dataset_access.rb @@ -0,0 +1,53 @@ +# 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 'google/bigquery/property/dataset_view' +module GoogleInSpec + module BigQuery + module Property + class DatasetAccess + attr_reader :domain + + attr_reader :group_by_email + + attr_reader :role + + attr_reader :special_group + + attr_reader :user_by_email + + attr_reader :view + + def initialize(args = nil) + return if args.nil? + @domain = args['domain'] + @group_by_email = args['groupByEmail'] + @role = args['role'] + @special_group = args['specialGroup'] + @user_by_email = args['userByEmail'] + @view = GoogleInSpec::BigQuery::Property::DatasetView.new(args['view']) + end + end + + class DatasetAccessArray + def self.parse(value) + return if value.nil? + return DatasetAccess.new(value) unless value.is_a?(::Array) + value.map { |v| DatasetAccess.new(v) } + end + end + end + end +end diff --git a/libraries/google/bigquery/property/dataset_dataset_reference.rb b/libraries/google/bigquery/property/dataset_dataset_reference.rb new file mode 100644 index 000000000..de38bcafe --- /dev/null +++ b/libraries/google/bigquery/property/dataset_dataset_reference.rb @@ -0,0 +1,32 @@ +# 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 BigQuery + module Property + class DatasetDatasetreference + attr_reader :dataset_id + + attr_reader :project_id + + def initialize(args = nil) + return if args.nil? + @dataset_id = args['datasetId'] + @project_id = args['projectId'] + end + end + end + end +end diff --git a/libraries/google/bigquery/property/dataset_view.rb b/libraries/google/bigquery/property/dataset_view.rb new file mode 100644 index 000000000..96d6023d1 --- /dev/null +++ b/libraries/google/bigquery/property/dataset_view.rb @@ -0,0 +1,35 @@ +# 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 BigQuery + module Property + class DatasetView + attr_reader :dataset_id + + attr_reader :project_id + + attr_reader :table_id + + def initialize(args = nil) + return if args.nil? + @dataset_id = args['datasetId'] + @project_id = args['projectId'] + @table_id = args['tableId'] + end + end + end + end +end diff --git a/libraries/google_bigquery_dataset.rb b/libraries/google_bigquery_dataset.rb new file mode 100644 index 000000000..57790a12f --- /dev/null +++ b/libraries/google_bigquery_dataset.rb @@ -0,0 +1,73 @@ +# 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' +require 'google/bigquery/property/dataset_access' +require 'google/bigquery/property/dataset_dataset_reference' + +# A provider to manage Google Cloud BigQuery resources. +class Dataset < GcpResourceBase + name 'google_bigquery_dataset' + desc 'Dataset' + supports platform: 'gcp' + + attr_reader :name + attr_reader :access + attr_reader :creation_time + attr_reader :dataset_reference + attr_reader :default_table_expiration_ms + attr_reader :description + attr_reader :friendly_name + attr_reader :id + attr_reader :labels + attr_reader :last_modified_time + attr_reader :location + def base + 'https://www.googleapis.com/bigquery/v2/' + end + + def url + 'projects/{{project}}/datasets/{{name}}' + end + + def initialize(params) + super(params.merge({ use_http_transport: true })) + @fetched = @connection.fetch(base, url, params) + parse unless @fetched.nil? + 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']) + @default_table_expiration_ms = @fetched['defaultTableExpirationMs'] + @description = @fetched['description'] + @friendly_name = @fetched['friendlyName'] + @id = @fetched['id'] + @labels = @fetched['labels'] + @last_modified_time = @fetched['lastModifiedTime'] + @location = @fetched['location'] + 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 +end diff --git a/libraries/google_bigquery_datasets.rb b/libraries/google_bigquery_datasets.rb new file mode 100644 index 000000000..100350300 --- /dev/null +++ b/libraries/google_bigquery_datasets.rb @@ -0,0 +1,90 @@ +# 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 Datasets < GcpResourceBase + name 'google_bigquery_datasets' + desc 'Dataset plural resource' + supports platform: 'gcp' + + attr_reader :table + + filter_table_config = FilterTable.create + + filter_table_config.add(:dataset_references, field: :dataset_reference) + filter_table_config.add(:friendly_names, field: :friendly_name) + filter_table_config.add(:ids, field: :id) + filter_table_config.add(:labels, field: :labels) + filter_table_config.add(:locations, field: :location) + + filter_table_config.connect(self, :table) + + def base + 'https://www.googleapis.com/bigquery/v2/' + end + + def url + 'projects/{{project}}/datasets' + end + + def initialize(params = {}) + super(params.merge({ use_http_transport: true })) + @params = params + @table = fetch_wrapped_resource('datasets') + end + + def fetch_wrapped_resource(wrap_path) + # fetch_resource returns an array of responses (to handle pagination) + result = @connection.fetch_all(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 + { + 'datasetReference' => ->(obj) { return :dataset_reference, GoogleInSpec::BigQuery::Property::DatasetDatasetreference.new(obj['datasetReference']) }, + 'friendlyName' => ->(obj) { return :friendly_name, obj['friendlyName'] }, + 'id' => ->(obj) { return :id, obj['id'] }, + 'labels' => ->(obj) { return :labels, obj['labels'] }, + 'location' => ->(obj) { return :location, obj['location'] }, + } + end + + # Handles parsing RFC3339 time string + def parse_time_string(time_string) + time_string ? Time.parse(time_string) : nil + end +end diff --git a/test/integration/build/gcp-mm.tf b/test/integration/build/gcp-mm.tf index 23f803e70..17296b5c8 100644 --- a/test/integration/build/gcp-mm.tf +++ b/test/integration/build/gcp-mm.tf @@ -98,6 +98,10 @@ variable "ssl_certificate" { type = "map" } +variable "dataset" { + type = "map" +} + resource "google_compute_ssl_policy" "custom-ssl-policy" { name = "${var.ssl_policy["name"]}" min_tls_version = "${var.ssl_policy["min_tls_version"]}" @@ -393,4 +397,23 @@ resource "google_compute_target_https_proxy" "gcp-inspec-https-proxy" { url_map = "${google_compute_url_map.gcp-inspec-url-map.self_link}" description = "${var.https_proxy["description"]}" ssl_certificates = ["${google_compute_ssl_certificate.gcp-inspec-ssl-certificate.self_link}"] +} + +resource "google_bigquery_dataset" "gcp-inspec-dataset" { + project = "${var.gcp_project_id}" + dataset_id = "${var.dataset["dataset_id"]}" + friendly_name = "${var.dataset["friendly_name"]}" + description = "${var.dataset["description"]}" + location = "${var.dataset["location"]}" + default_table_expiration_ms = "${var.dataset["default_table_expiration_ms"]}" + + access { + role = "${var.dataset["access_reader_role"]}" + domain = "${var.dataset["access_reader_domain"]}" + } + + access { + role = "${var.dataset["access_writer_role"]}" + special_group = "${var.dataset["access_writer_special_group"]}" + } } \ No newline at end of file diff --git a/test/integration/configuration/mm-attributes.yml b/test/integration/configuration/mm-attributes.yml index eb2437a4a..434d4130c 100644 --- a/test/integration/configuration/mm-attributes.yml +++ b/test/integration/configuration/mm-attributes.yml @@ -168,4 +168,15 @@ ssl_certificate: MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- \ No newline at end of file + -----END EC PRIVATE KEY----- + +dataset: + dataset_id: inspec_gcp_dataset + friendly_name: A BigQuery dataset test + description: Test BigQuery dataset description + location: EU + default_table_expiration_ms: 3600000 + access_reader_role: READER + access_reader_domain: example.com + access_writer_role: WRITER + access_writer_special_group: projectWriters \ No newline at end of file diff --git a/test/integration/verify/controls/google_bigquery_dataset.rb b/test/integration/verify/controls/google_bigquery_dataset.rb new file mode 100644 index 000000000..be8e94694 --- /dev/null +++ b/test/integration/verify/controls/google_bigquery_dataset.rb @@ -0,0 +1,63 @@ +# ---------------------------------------------------------------------------- +# +# *** 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_bigquery_dataset resource.' + +gcp_project_id = attribute(:gcp_project_id, default: 'gcp_project_id', description: 'The GCP project identifier.') +dataset = attribute('dataset', default: { + "dataset_id": "inspec_gcp_dataset", + "friendly_name": "A BigQuery dataset test", + "description": "Test BigQuery dataset description", + "location": "EU", + "default_table_expiration_ms": 3600000, + "access_reader_role": "READER", + "access_reader_domain": "example.com", + "access_writer_role": "WRITER", + "access_writer_special_group": "projectWriters" +}, description: 'BigQuery dataset definition') +control 'google_bigquery_dataset-1.0' do + impact 1.0 + title 'google_bigquery_dataset resource test' + + describe google_bigquery_dataset(project: gcp_project_id, name: dataset['dataset_id']) do + it { should exist } + + its('friendly_name') { should eq dataset['friendly_name'] } + its('location') { should eq dataset['location'] } + its('description') { should eq dataset['description'] } + its('default_table_expiration_ms') { should cmp dataset['default_table_expiration_ms'] } + end + + describe.one do + google_bigquery_dataset(project: gcp_project_id, name: dataset['dataset_id']).access.each do |dataset_access| + describe dataset_access do + its('role') { should eq dataset['access_reader_role'] } + its('domain') { should eq dataset['access_reader_domain'] } + end + end + end + + describe.one do + google_bigquery_dataset(project: gcp_project_id, name: dataset['dataset_id']).access.each do |dataset_access| + describe dataset_access do + its('role') { should eq dataset['access_writer_role'] } + its('special_group') { should eq dataset['access_writer_special_group'] } + end + end + end + + describe google_bigquery_dataset(project: gcp_project_id, name: 'nonexistent') do + it { should_not exist } + end +end diff --git a/test/integration/verify/controls/google_bigquery_datasets.rb b/test/integration/verify/controls/google_bigquery_datasets.rb new file mode 100644 index 000000000..a7517de60 --- /dev/null +++ b/test/integration/verify/controls/google_bigquery_datasets.rb @@ -0,0 +1,38 @@ +# ---------------------------------------------------------------------------- +# +# *** 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_bigquery_datasets resource.' + +gcp_project_id = attribute(:gcp_project_id, default: 'gcp_project_id', description: 'The GCP project identifier.') +dataset = attribute('dataset', default: { + "dataset_id": "inspec_gcp_dataset", + "friendly_name": "A BigQuery dataset test", + "description": "Test BigQuery dataset description", + "location": "EU", + "default_table_expiration_ms": 3600000, + "access_reader_role": "READER", + "access_reader_domain": "example.com", + "access_writer_role": "WRITER", + "access_writer_special_group": "projectWriters" +}, description: 'BigQuery dataset definition') +control 'google_bigquery_datasets-1.0' do + impact 1.0 + title 'google_bigquery_datasets resource test' + + describe google_bigquery_datasets(project: gcp_project_id) do + its('count') { should be >= 1 } + its('friendly_names') { should include dataset['friendly_name'] } + its('locations') { should include dataset['location'] } + end +end diff --git a/test/integration/verify/controls/google_compute_ssl_certificate.rb b/test/integration/verify/controls/google_compute_ssl_certificate.rb index f9c8b544b..dfb45f5d7 100644 --- a/test/integration/verify/controls/google_compute_ssl_certificate.rb +++ b/test/integration/verify/controls/google_compute_ssl_certificate.rb @@ -19,7 +19,7 @@ "name": "inspec-gcp-ssl-certificate", "description": "A fake ssl certificate (DO NOT USE)", "certificate": "-----BEGIN CERTIFICATE-----\nMIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG\nEwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT\nBgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm\nb3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN\nAQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2\nMDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP\nBgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM\nFUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z\naXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH\nKoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ\n4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O\nBBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn\n0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O\nM3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ\nzqGNhIPGq2ULqXKK8BY=\n-----END CERTIFICATE-----\n", - "private_key": "-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49\nAwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f\nOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==\n-----END EC PRIVATE KEY-----" + "private_key": "-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49\nAwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f\nOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==\n-----END EC PRIVATE KEY-----\n" }, description: 'A GCP SSL certificate definition') control 'google_compute_ssl_certificate-1.0' do impact 1.0 diff --git a/test/integration/verify/controls/google_compute_ssl_certificates.rb b/test/integration/verify/controls/google_compute_ssl_certificates.rb index 10ec90b24..2ef9bac7f 100644 --- a/test/integration/verify/controls/google_compute_ssl_certificates.rb +++ b/test/integration/verify/controls/google_compute_ssl_certificates.rb @@ -19,7 +19,7 @@ "name": "inspec-gcp-ssl-certificate", "description": "A fake ssl certificate (DO NOT USE)", "certificate": "-----BEGIN CERTIFICATE-----\nMIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG\nEwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT\nBgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm\nb3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN\nAQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2\nMDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP\nBgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM\nFUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z\naXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH\nKoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ\n4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O\nBBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn\n0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O\nM3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ\nzqGNhIPGq2ULqXKK8BY=\n-----END CERTIFICATE-----\n", - "private_key": "-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49\nAwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f\nOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==\n-----END EC PRIVATE KEY-----" + "private_key": "-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49\nAwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f\nOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==\n-----END EC PRIVATE KEY-----\n" }, description: 'A GCP SSL certificate definition') control 'google_compute_ssl_certificates-1.0' do impact 1.0 From e9228c1d30560c48e9c1e3e439f66c01af233070 Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Wed, 13 Feb 2019 00:35:24 +0000 Subject: [PATCH 6/7] Inspec nested refactor Signed-off-by: Modular Magician --- docs/resources/google_bigquery_dataset.md | 9 --- .../bigquery/property/dataset_access.rb | 4 +- .../bigquery/property/dataset_access_view.rb | 35 ++++++++++ .../property/dataset_dataset_reference.rb | 2 +- .../cloudbuild/property/trigger_build.rb | 4 +- .../property/trigger_build_steps.rb | 40 +++++++++++ .../property/trigger_trigger_template.rb | 2 +- .../property/autoscaler_autoscaling_policy.rb | 14 ++-- ...aler_autoscaling_policy_cpu_utilization.rb | 29 ++++++++ ...aling_policy_custom_metric_utilizations.rb | 43 ++++++++++++ ...aling_policy_load_balancing_utilization.rb | 29 ++++++++ .../property/backendservice_cdn_policy.rb | 6 +- ...kendservice_cdn_policy_cache_key_policy.rb | 41 ++++++++++++ .../backendservice_connection_draining.rb | 2 +- .../property/disk_disk_encryption_key.rb | 2 +- .../disk_source_image_encryption_key.rb | 2 +- .../disk_source_snapshot_encryption_key.rb | 2 +- .../property/healthcheck_http_health_check.rb | 2 +- .../healthcheck_https_health_check.rb | 2 +- .../property/healthcheck_ssl_health_check.rb | 2 +- .../property/healthcheck_tcp_health_check.rb | 2 +- .../instancegroupmanager_current_actions.rb | 2 +- .../instancegroupmanager_named_ports.rb | 8 +-- .../property/instancetemplate_properties.rb | 24 +++---- .../instancetemplate_properties_disks.rb | 67 +++++++++++++++++++ ...te_properties_disks_disk_encryption_key.rb | 35 ++++++++++ ...late_properties_disks_initialize_params.rb | 42 ++++++++++++ ...lize_params_source_image_encryption_key.rb | 32 +++++++++ ...etemplate_properties_guest_accelerators.rb | 40 +++++++++++ ...etemplate_properties_network_interfaces.rb | 54 +++++++++++++++ ...rties_network_interfaces_access_configs.rb | 43 ++++++++++++ ...ties_network_interfaces_alias_ip_ranges.rb | 40 +++++++++++ .../instancetemplate_properties_scheduling.rb | 35 ++++++++++ ...ncetemplate_properties_service_accounts.rb | 40 +++++++++++ .../instancetemplate_properties_tags.rb | 32 +++++++++ .../google/compute/property/router_bgp.rb | 4 +- .../router_bgp_advertised_ip_ranges.rb | 40 +++++++++++ .../snapshot_snapshot_encryption_key.rb | 2 +- .../snapshot_source_disk_encryption_key.rb | 2 +- .../compute/property/urlmap_host_rules.rb | 8 +-- .../compute/property/urlmap_path_matchers.rb | 12 ++-- .../urlmap_path_matchers_path_rules.rb | 40 +++++++++++ .../property/regionalcluster_addons_config.rb | 10 +-- ...ddons_config_horizontal_pod_autoscaling.rb | 29 ++++++++ ...uster_addons_config_http_load_balancing.rb | 29 ++++++++ .../property/regionalcluster_master_auth.rb | 2 +- .../property/regionalcluster_node_config.rb | 2 +- .../property/subscription_push_config.rb | 2 +- libraries/google_bigquery_dataset.rb | 2 +- libraries/google_bigquery_datasets.rb | 2 +- libraries/google_cloudbuild_trigger.rb | 4 +- libraries/google_cloudbuild_triggers.rb | 2 +- libraries/google_compute_autoscaler.rb | 8 +-- libraries/google_compute_autoscalers.rb | 2 +- libraries/google_compute_backend_service.rb | 6 +- libraries/google_compute_backend_services.rb | 4 +- libraries/google_compute_disk.rb | 6 +- libraries/google_compute_disks.rb | 6 +- libraries/google_compute_health_check.rb | 8 +-- libraries/google_compute_health_checks.rb | 8 +-- .../google_compute_instance_group_manager.rb | 4 +- .../google_compute_instance_group_managers.rb | 4 +- libraries/google_compute_instance_template.rb | 12 ++-- libraries/google_compute_router.rb | 2 +- libraries/google_compute_snapshot.rb | 4 +- libraries/google_compute_snapshots.rb | 4 +- libraries/google_compute_url_map.rb | 4 +- libraries/google_compute_url_maps.rb | 4 +- .../google_container_regional_cluster.rb | 10 +-- .../google_container_regional_clusters.rb | 6 +- libraries/google_pubsub_subscription.rb | 2 +- libraries/google_pubsub_subscriptions.rb | 2 +- test/integration/build/gcp-mm.tf | 25 +++++-- .../configuration/mm-attributes.yml | 10 ++- .../controls/google_bigquery_dataset.rb | 11 --- .../controls/google_bigquery_datasets.rb | 2 - 76 files changed, 964 insertions(+), 150 deletions(-) create mode 100644 libraries/google/bigquery/property/dataset_access_view.rb create mode 100644 libraries/google/cloudbuild/property/trigger_build_steps.rb create mode 100644 libraries/google/compute/property/autoscaler_autoscaling_policy_cpu_utilization.rb create mode 100644 libraries/google/compute/property/autoscaler_autoscaling_policy_custom_metric_utilizations.rb create mode 100644 libraries/google/compute/property/autoscaler_autoscaling_policy_load_balancing_utilization.rb create mode 100644 libraries/google/compute/property/backendservice_cdn_policy_cache_key_policy.rb create mode 100644 libraries/google/compute/property/instancetemplate_properties_disks.rb create mode 100644 libraries/google/compute/property/instancetemplate_properties_disks_disk_encryption_key.rb create mode 100644 libraries/google/compute/property/instancetemplate_properties_disks_initialize_params.rb create mode 100644 libraries/google/compute/property/instancetemplate_properties_disks_initialize_params_source_image_encryption_key.rb create mode 100644 libraries/google/compute/property/instancetemplate_properties_guest_accelerators.rb create mode 100644 libraries/google/compute/property/instancetemplate_properties_network_interfaces.rb create mode 100644 libraries/google/compute/property/instancetemplate_properties_network_interfaces_access_configs.rb create mode 100644 libraries/google/compute/property/instancetemplate_properties_network_interfaces_alias_ip_ranges.rb create mode 100644 libraries/google/compute/property/instancetemplate_properties_scheduling.rb create mode 100644 libraries/google/compute/property/instancetemplate_properties_service_accounts.rb create mode 100644 libraries/google/compute/property/instancetemplate_properties_tags.rb create mode 100644 libraries/google/compute/property/router_bgp_advertised_ip_ranges.rb create mode 100644 libraries/google/compute/property/urlmap_path_matchers_path_rules.rb create mode 100644 libraries/google/container/property/regionalcluster_addons_config_horizontal_pod_autoscaling.rb create mode 100644 libraries/google/container/property/regionalcluster_addons_config_http_load_balancing.rb diff --git a/docs/resources/google_bigquery_dataset.md b/docs/resources/google_bigquery_dataset.md index 2da3080a9..769dc9462 100644 --- a/docs/resources/google_bigquery_dataset.md +++ b/docs/resources/google_bigquery_dataset.md @@ -17,15 +17,6 @@ describe google_bigquery_dataset(project: 'chef-gcp-inspec', name: 'inspec_gcp_d its('default_table_expiration_ms') { should cmp '3600000' } end -describe.one do - google_bigquery_dataset(project: 'chef-gcp-inspec', name: 'inspec_gcp_dataset').access.each do |dataset_access| - describe dataset_access do - its('role') { should eq 'READER' } - its('domain') { should eq 'example.com' } - end - end -end - describe.one do google_bigquery_dataset(project: 'chef-gcp-inspec', name: 'inspec_gcp_dataset').access.each do |dataset_access| describe dataset_access do diff --git a/libraries/google/bigquery/property/dataset_access.rb b/libraries/google/bigquery/property/dataset_access.rb index 9fae4cea2..7a61630b3 100644 --- a/libraries/google/bigquery/property/dataset_access.rb +++ b/libraries/google/bigquery/property/dataset_access.rb @@ -13,7 +13,7 @@ # CONTRIBUTING.md located at the root of this package. # # ---------------------------------------------------------------------------- -require 'google/bigquery/property/dataset_view' +require 'google/bigquery/property/dataset_access_view' module GoogleInSpec module BigQuery module Property @@ -37,7 +37,7 @@ def initialize(args = nil) @role = args['role'] @special_group = args['specialGroup'] @user_by_email = args['userByEmail'] - @view = GoogleInSpec::BigQuery::Property::DatasetView.new(args['view']) + @view = GoogleInSpec::BigQuery::Property::DatasetAccessView.new(args['view']) end end diff --git a/libraries/google/bigquery/property/dataset_access_view.rb b/libraries/google/bigquery/property/dataset_access_view.rb new file mode 100644 index 000000000..2f75ba004 --- /dev/null +++ b/libraries/google/bigquery/property/dataset_access_view.rb @@ -0,0 +1,35 @@ +# 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 BigQuery + module Property + class DatasetAccessView + attr_reader :dataset_id + + attr_reader :project_id + + attr_reader :table_id + + def initialize(args = nil) + return if args.nil? + @dataset_id = args['datasetId'] + @project_id = args['projectId'] + @table_id = args['tableId'] + end + 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 de38bcafe..3c9105393 100644 --- a/libraries/google/bigquery/property/dataset_dataset_reference.rb +++ b/libraries/google/bigquery/property/dataset_dataset_reference.rb @@ -16,7 +16,7 @@ module GoogleInSpec module BigQuery module Property - class DatasetDatasetreference + class DatasetDatasetReference attr_reader :dataset_id attr_reader :project_id diff --git a/libraries/google/cloudbuild/property/trigger_build.rb b/libraries/google/cloudbuild/property/trigger_build.rb index fc6e838af..4cc7e74a3 100644 --- a/libraries/google/cloudbuild/property/trigger_build.rb +++ b/libraries/google/cloudbuild/property/trigger_build.rb @@ -13,7 +13,7 @@ # CONTRIBUTING.md located at the root of this package. # # ---------------------------------------------------------------------------- -require 'google/cloudbuild/property/trigger_steps' +require 'google/cloudbuild/property/trigger_build_steps' module GoogleInSpec module CloudBuild module Property @@ -28,7 +28,7 @@ def initialize(args = nil) return if args.nil? @tags = args['tags'] @images = args['images'] - @steps = GoogleInSpec::CloudBuild::Property::TriggerStepsArray.parse(args['steps']) + @steps = GoogleInSpec::CloudBuild::Property::TriggerBuildStepsArray.parse(args['steps']) end end end diff --git a/libraries/google/cloudbuild/property/trigger_build_steps.rb b/libraries/google/cloudbuild/property/trigger_build_steps.rb new file mode 100644 index 000000000..9a1a9625e --- /dev/null +++ b/libraries/google/cloudbuild/property/trigger_build_steps.rb @@ -0,0 +1,40 @@ +# 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 CloudBuild + module Property + class TriggerBuildSteps + attr_reader :name + + attr_reader :args + + def initialize(args = nil) + return if args.nil? + @name = args['name'] + @args = args['args'] + end + end + + class TriggerBuildStepsArray + def self.parse(value) + return if value.nil? + return TriggerBuildSteps.new(value) unless value.is_a?(::Array) + value.map { |v| TriggerBuildSteps.new(v) } + end + end + end + end +end diff --git a/libraries/google/cloudbuild/property/trigger_trigger_template.rb b/libraries/google/cloudbuild/property/trigger_trigger_template.rb index af219c92f..fdd7febd1 100644 --- a/libraries/google/cloudbuild/property/trigger_trigger_template.rb +++ b/libraries/google/cloudbuild/property/trigger_trigger_template.rb @@ -16,7 +16,7 @@ module GoogleInSpec module CloudBuild module Property - class TriggerTriggertemplate + class TriggerTriggerTemplate attr_reader :project_id attr_reader :repo_name diff --git a/libraries/google/compute/property/autoscaler_autoscaling_policy.rb b/libraries/google/compute/property/autoscaler_autoscaling_policy.rb index a7e0f9bb2..05011caed 100644 --- a/libraries/google/compute/property/autoscaler_autoscaling_policy.rb +++ b/libraries/google/compute/property/autoscaler_autoscaling_policy.rb @@ -13,13 +13,13 @@ # CONTRIBUTING.md located at the root of this package. # # ---------------------------------------------------------------------------- -require 'google/compute/property/autoscaler_cpu_utilization' -require 'google/compute/property/autoscaler_custom_metric_utilizations' -require 'google/compute/property/autoscaler_load_balancing_utilization' +require 'google/compute/property/autoscaler_autoscaling_policy_cpu_utilization' +require 'google/compute/property/autoscaler_autoscaling_policy_custom_metric_utilizations' +require 'google/compute/property/autoscaler_autoscaling_policy_load_balancing_utilization' module GoogleInSpec module Compute module Property - class AutoscalerAutoscalingpolicy + class AutoscalerAutoscalingPolicy attr_reader :min_num_replicas attr_reader :max_num_replicas @@ -37,9 +37,9 @@ def initialize(args = nil) @min_num_replicas = args['minNumReplicas'] @max_num_replicas = args['maxNumReplicas'] @cool_down_period_sec = args['coolDownPeriodSec'] - @cpu_utilization = GoogleInSpec::Compute::Property::AutoscalerCpuutilization.new(args['cpuUtilization']) - @custom_metric_utilizations = GoogleInSpec::Compute::Property::AutoscalerCustommetricutilizationsArray.parse(args['customMetricUtilizations']) - @load_balancing_utilization = GoogleInSpec::Compute::Property::AutoscalerLoadbalancingutilization.new(args['loadBalancingUtilization']) + @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']) 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 new file mode 100644 index 000000000..e365a8d06 --- /dev/null +++ b/libraries/google/compute/property/autoscaler_autoscaling_policy_cpu_utilization.rb @@ -0,0 +1,29 @@ +# 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 Compute + module Property + class AutoscalerAutoscalingPolicyCpuUtilization + attr_reader :utilization_target + + def initialize(args = nil) + return if args.nil? + @utilization_target = args['utilizationTarget'] + end + 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 new file mode 100644 index 000000000..4bb514986 --- /dev/null +++ b/libraries/google/compute/property/autoscaler_autoscaling_policy_custom_metric_utilizations.rb @@ -0,0 +1,43 @@ +# 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 Compute + module Property + class AutoscalerAutoscalingPolicyCustomMetricUtilizations + attr_reader :metric + + attr_reader :utilization_target + + attr_reader :utilization_target_type + + def initialize(args = nil) + return if args.nil? + @metric = args['metric'] + @utilization_target = args['utilizationTarget'] + @utilization_target_type = args['utilizationTargetType'] + end + end + + class AutoscalerAutoscalingPolicyCustomMetricUtilizationsArray + def self.parse(value) + return if value.nil? + return AutoscalerAutoscalingPolicyCustomMetricUtilizations.new(value) unless value.is_a?(::Array) + value.map { |v| AutoscalerAutoscalingPolicyCustomMetricUtilizations.new(v) } + end + end + 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 new file mode 100644 index 000000000..89be33703 --- /dev/null +++ b/libraries/google/compute/property/autoscaler_autoscaling_policy_load_balancing_utilization.rb @@ -0,0 +1,29 @@ +# 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 Compute + module Property + class AutoscalerAutoscalingPolicyLoadBalancingUtilization + attr_reader :utilization_target + + def initialize(args = nil) + return if args.nil? + @utilization_target = args['utilizationTarget'] + end + end + end + end +end diff --git a/libraries/google/compute/property/backendservice_cdn_policy.rb b/libraries/google/compute/property/backendservice_cdn_policy.rb index f83d99d09..bdeb1d573 100644 --- a/libraries/google/compute/property/backendservice_cdn_policy.rb +++ b/libraries/google/compute/property/backendservice_cdn_policy.rb @@ -13,16 +13,16 @@ # CONTRIBUTING.md located at the root of this package. # # ---------------------------------------------------------------------------- -require 'google/compute/property/backendservice_cache_key_policy' +require 'google/compute/property/backendservice_cdn_policy_cache_key_policy' module GoogleInSpec module Compute module Property - class BackendServiceCdnpolicy + class BackendServiceCdnPolicy attr_reader :cache_key_policy def initialize(args = nil) return if args.nil? - @cache_key_policy = GoogleInSpec::Compute::Property::BackendServiceCachekeypolicy.new(args['cacheKeyPolicy']) + @cache_key_policy = GoogleInSpec::Compute::Property::BackendServiceCdnPolicyCacheKeyPolicy.new(args['cacheKeyPolicy']) 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 new file mode 100644 index 000000000..99ff75afc --- /dev/null +++ b/libraries/google/compute/property/backendservice_cdn_policy_cache_key_policy.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 Compute + module Property + class BackendServiceCdnPolicyCacheKeyPolicy + attr_reader :include_host + + attr_reader :include_protocol + + attr_reader :include_query_string + + attr_reader :query_string_blacklist + + attr_reader :query_string_whitelist + + def initialize(args = nil) + return if args.nil? + @include_host = args['includeHost'] + @include_protocol = args['includeProtocol'] + @include_query_string = args['includeQueryString'] + @query_string_blacklist = args['queryStringBlacklist'] + @query_string_whitelist = args['queryStringWhitelist'] + end + 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 773c2297e..4e9fa9ac6 100644 --- a/libraries/google/compute/property/backendservice_connection_draining.rb +++ b/libraries/google/compute/property/backendservice_connection_draining.rb @@ -16,7 +16,7 @@ module GoogleInSpec module Compute module Property - class BackendServiceConnectiondraining + class BackendServiceConnectionDraining attr_reader :draining_timeout_sec def initialize(args = nil) diff --git a/libraries/google/compute/property/disk_disk_encryption_key.rb b/libraries/google/compute/property/disk_disk_encryption_key.rb index 1ecbecdbd..be114da0c 100644 --- a/libraries/google/compute/property/disk_disk_encryption_key.rb +++ b/libraries/google/compute/property/disk_disk_encryption_key.rb @@ -16,7 +16,7 @@ module GoogleInSpec module Compute module Property - class DiskDiskencryptionkey + class DiskDiskEncryptionKey attr_reader :raw_key attr_reader :sha256 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 94a627cc3..3eceba6ee 100644 --- a/libraries/google/compute/property/disk_source_image_encryption_key.rb +++ b/libraries/google/compute/property/disk_source_image_encryption_key.rb @@ -16,7 +16,7 @@ module GoogleInSpec module Compute module Property - class DiskSourceimageencryptionkey + class DiskSourceImageEncryptionKey attr_reader :raw_key attr_reader :sha256 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 1c447719b..3ffd8ccbc 100644 --- a/libraries/google/compute/property/disk_source_snapshot_encryption_key.rb +++ b/libraries/google/compute/property/disk_source_snapshot_encryption_key.rb @@ -16,7 +16,7 @@ module GoogleInSpec module Compute module Property - class DiskSourcesnapshotencryptionkey + class DiskSourceSnapshotEncryptionKey attr_reader :raw_key attr_reader :kms_key_name diff --git a/libraries/google/compute/property/healthcheck_http_health_check.rb b/libraries/google/compute/property/healthcheck_http_health_check.rb index c90d392ea..8a6cd6c5d 100644 --- a/libraries/google/compute/property/healthcheck_http_health_check.rb +++ b/libraries/google/compute/property/healthcheck_http_health_check.rb @@ -16,7 +16,7 @@ module GoogleInSpec module Compute module Property - class HealthCheckHttphealthcheck + class HealthCheckHttpHealthCheck attr_reader :host attr_reader :request_path diff --git a/libraries/google/compute/property/healthcheck_https_health_check.rb b/libraries/google/compute/property/healthcheck_https_health_check.rb index 3b88901ba..3cab46ee3 100644 --- a/libraries/google/compute/property/healthcheck_https_health_check.rb +++ b/libraries/google/compute/property/healthcheck_https_health_check.rb @@ -16,7 +16,7 @@ module GoogleInSpec module Compute module Property - class HealthCheckHttpshealthcheck + class HealthCheckHttpsHealthCheck attr_reader :host attr_reader :request_path diff --git a/libraries/google/compute/property/healthcheck_ssl_health_check.rb b/libraries/google/compute/property/healthcheck_ssl_health_check.rb index f4c11d938..61a56fff8 100644 --- a/libraries/google/compute/property/healthcheck_ssl_health_check.rb +++ b/libraries/google/compute/property/healthcheck_ssl_health_check.rb @@ -16,7 +16,7 @@ module GoogleInSpec module Compute module Property - class HealthCheckSslhealthcheck + class HealthCheckSslHealthCheck attr_reader :request attr_reader :response diff --git a/libraries/google/compute/property/healthcheck_tcp_health_check.rb b/libraries/google/compute/property/healthcheck_tcp_health_check.rb index 85e6e8165..53e4a788e 100644 --- a/libraries/google/compute/property/healthcheck_tcp_health_check.rb +++ b/libraries/google/compute/property/healthcheck_tcp_health_check.rb @@ -16,7 +16,7 @@ module GoogleInSpec module Compute module Property - class HealthCheckTcphealthcheck + class HealthCheckTcpHealthCheck attr_reader :request attr_reader :response diff --git a/libraries/google/compute/property/instancegroupmanager_current_actions.rb b/libraries/google/compute/property/instancegroupmanager_current_actions.rb index ccc007063..12f0057a8 100644 --- a/libraries/google/compute/property/instancegroupmanager_current_actions.rb +++ b/libraries/google/compute/property/instancegroupmanager_current_actions.rb @@ -16,7 +16,7 @@ module GoogleInSpec module Compute module Property - class InstanceGroupManagerCurrentactions + class InstanceGroupManagerCurrentActions attr_reader :abandoning attr_reader :creating diff --git a/libraries/google/compute/property/instancegroupmanager_named_ports.rb b/libraries/google/compute/property/instancegroupmanager_named_ports.rb index a1c123548..7873ea742 100644 --- a/libraries/google/compute/property/instancegroupmanager_named_ports.rb +++ b/libraries/google/compute/property/instancegroupmanager_named_ports.rb @@ -16,7 +16,7 @@ module GoogleInSpec module Compute module Property - class InstanceGroupManagerNamedports + class InstanceGroupManagerNamedPorts attr_reader :name attr_reader :port @@ -28,11 +28,11 @@ def initialize(args = nil) end end - class InstanceGroupManagerNamedportsArray + class InstanceGroupManagerNamedPortsArray def self.parse(value) return if value.nil? - return InstanceGroupManagerNamedports.new(value) unless value.is_a?(::Array) - value.map { |v| InstanceGroupManagerNamedports.new(v) } + return InstanceGroupManagerNamedPorts.new(value) unless value.is_a?(::Array) + value.map { |v| InstanceGroupManagerNamedPorts.new(v) } end end end diff --git a/libraries/google/compute/property/instancetemplate_properties.rb b/libraries/google/compute/property/instancetemplate_properties.rb index c3b637ff1..d5bb51c1f 100644 --- a/libraries/google/compute/property/instancetemplate_properties.rb +++ b/libraries/google/compute/property/instancetemplate_properties.rb @@ -13,12 +13,12 @@ # CONTRIBUTING.md located at the root of this package. # # ---------------------------------------------------------------------------- -require 'google/compute/property/instancetemplate_disks' -require 'google/compute/property/instancetemplate_guest_accelerators' -require 'google/compute/property/instancetemplate_network_interfaces' -require 'google/compute/property/instancetemplate_scheduling' -require 'google/compute/property/instancetemplate_service_accounts' -require 'google/compute/property/instancetemplate_tags' +require 'google/compute/property/instancetemplate_properties_disks' +require 'google/compute/property/instancetemplate_properties_guest_accelerators' +require 'google/compute/property/instancetemplate_properties_network_interfaces' +require 'google/compute/property/instancetemplate_properties_scheduling' +require 'google/compute/property/instancetemplate_properties_service_accounts' +require 'google/compute/property/instancetemplate_properties_tags' module GoogleInSpec module Compute module Property @@ -49,15 +49,15 @@ def initialize(args = nil) return if args.nil? @can_ip_forward = args['canIpForward'] @description = args['description'] - @disks = GoogleInSpec::Compute::Property::InstanceTemplateDisksArray.parse(args['disks']) + @disks = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesDisksArray.parse(args['disks']) @machine_type = args['machineType'] @min_cpu_platform = args['minCpuPlatform'] @metadata = args['metadata'] - @guest_accelerators = GoogleInSpec::Compute::Property::InstanceTemplateGuestacceleratorsArray.parse(args['guestAccelerators']) - @network_interfaces = GoogleInSpec::Compute::Property::InstanceTemplateNetworkinterfacesArray.parse(args['networkInterfaces']) - @scheduling = GoogleInSpec::Compute::Property::InstanceTemplateScheduling.new(args['scheduling']) - @service_accounts = GoogleInSpec::Compute::Property::InstanceTemplateServiceaccountsArray.parse(args['serviceAccounts']) - @tags = GoogleInSpec::Compute::Property::InstanceTemplateTags.new(args['tags']) + @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']) end end end diff --git a/libraries/google/compute/property/instancetemplate_properties_disks.rb b/libraries/google/compute/property/instancetemplate_properties_disks.rb new file mode 100644 index 000000000..f939d3ffa --- /dev/null +++ b/libraries/google/compute/property/instancetemplate_properties_disks.rb @@ -0,0 +1,67 @@ +# 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 'google/compute/property/instancetemplate_properties_disks_disk_encryption_key' +require 'google/compute/property/instancetemplate_properties_disks_initialize_params' +require 'google/compute/property/instancetemplate_properties_disks_initialize_params_source_image_encryption_key' +module GoogleInSpec + module Compute + module Property + class InstanceTemplatePropertiesDisks + attr_reader :auto_delete + + attr_reader :boot + + attr_reader :device_name + + attr_reader :disk_encryption_key + + attr_reader :index + + attr_reader :initialize_params + + attr_reader :interface + + attr_reader :mode + + attr_reader :source + + attr_reader :type + + def initialize(args = nil) + return if args.nil? + @auto_delete = args['autoDelete'] + @boot = args['boot'] + @device_name = args['deviceName'] + @disk_encryption_key = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesDisksDiskEncryptionKey.new(args['diskEncryptionKey']) + @index = args['index'] + @initialize_params = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesDisksInitializeParams.new(args['initializeParams']) + @interface = args['interface'] + @mode = args['mode'] + @source = args['source'] + @type = args['type'] + end + end + + class InstanceTemplatePropertiesDisksArray + def self.parse(value) + return if value.nil? + return InstanceTemplatePropertiesDisks.new(value) unless value.is_a?(::Array) + value.map { |v| InstanceTemplatePropertiesDisks.new(v) } + end + end + 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 new file mode 100644 index 000000000..6eedb60d1 --- /dev/null +++ b/libraries/google/compute/property/instancetemplate_properties_disks_disk_encryption_key.rb @@ -0,0 +1,35 @@ +# 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 Compute + module Property + class InstanceTemplatePropertiesDisksDiskEncryptionKey + attr_reader :raw_key + + attr_reader :rsa_encrypted_key + + attr_reader :sha256 + + def initialize(args = nil) + return if args.nil? + @raw_key = args['rawKey'] + @rsa_encrypted_key = args['rsaEncryptedKey'] + @sha256 = args['sha256'] + end + 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 new file mode 100644 index 000000000..a0ce90f1f --- /dev/null +++ b/libraries/google/compute/property/instancetemplate_properties_disks_initialize_params.rb @@ -0,0 +1,42 @@ +# 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 'google/compute/property/instancetemplate_properties_disks_initialize_params_source_image_encryption_key' +module GoogleInSpec + module Compute + module Property + class InstanceTemplatePropertiesDisksInitializeParams + attr_reader :disk_name + + attr_reader :disk_size_gb + + attr_reader :disk_type + + attr_reader :source_image + + attr_reader :source_image_encryption_key + + def initialize(args = nil) + return if args.nil? + @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']) + end + end + 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 new file mode 100644 index 000000000..3b2aeee8f --- /dev/null +++ b/libraries/google/compute/property/instancetemplate_properties_disks_initialize_params_source_image_encryption_key.rb @@ -0,0 +1,32 @@ +# 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 Compute + module Property + class InstanceTemplatePropertiesDisksInitializeParamsSourceImageEncryptionKey + attr_reader :raw_key + + attr_reader :sha256 + + def initialize(args = nil) + return if args.nil? + @raw_key = args['rawKey'] + @sha256 = args['sha256'] + end + 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 new file mode 100644 index 000000000..7d9c31795 --- /dev/null +++ b/libraries/google/compute/property/instancetemplate_properties_guest_accelerators.rb @@ -0,0 +1,40 @@ +# 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 Compute + module Property + class InstanceTemplatePropertiesGuestAccelerators + attr_reader :accelerator_count + + attr_reader :accelerator_type + + def initialize(args = nil) + return if args.nil? + @accelerator_count = args['acceleratorCount'] + @accelerator_type = args['acceleratorType'] + end + end + + class InstanceTemplatePropertiesGuestAcceleratorsArray + def self.parse(value) + return if value.nil? + return InstanceTemplatePropertiesGuestAccelerators.new(value) unless value.is_a?(::Array) + value.map { |v| InstanceTemplatePropertiesGuestAccelerators.new(v) } + end + end + 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 new file mode 100644 index 000000000..f00f46dae --- /dev/null +++ b/libraries/google/compute/property/instancetemplate_properties_network_interfaces.rb @@ -0,0 +1,54 @@ +# 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 'google/compute/property/instancetemplate_properties_network_interfaces_access_configs' +require 'google/compute/property/instancetemplate_properties_network_interfaces_alias_ip_ranges' +module GoogleInSpec + module Compute + module Property + class InstanceTemplatePropertiesNetworkInterfaces + attr_reader :access_configs + + attr_reader :alias_ip_ranges + + attr_reader :name + + attr_reader :network + + attr_reader :network_ip + + attr_reader :subnetwork + + def initialize(args = nil) + return if args.nil? + @access_configs = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesNetworkInterfacesAccessConfigsArray.parse(args['accessConfigs']) + @alias_ip_ranges = GoogleInSpec::Compute::Property::InstanceTemplatePropertiesNetworkInterfacesAliasIpRangesArray.parse(args['aliasIpRanges']) + @name = args['name'] + @network = args['network'] + @network_ip = args['networkIP'] + @subnetwork = args['subnetwork'] + end + end + + class InstanceTemplatePropertiesNetworkInterfacesArray + def self.parse(value) + return if value.nil? + return InstanceTemplatePropertiesNetworkInterfaces.new(value) unless value.is_a?(::Array) + value.map { |v| InstanceTemplatePropertiesNetworkInterfaces.new(v) } + end + end + 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 new file mode 100644 index 000000000..89c6c394d --- /dev/null +++ b/libraries/google/compute/property/instancetemplate_properties_network_interfaces_access_configs.rb @@ -0,0 +1,43 @@ +# 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 Compute + module Property + class InstanceTemplatePropertiesNetworkInterfacesAccessConfigs + attr_reader :name + + attr_reader :nat_ip + + attr_reader :type + + def initialize(args = nil) + return if args.nil? + @name = args['name'] + @nat_ip = args['natIP'] + @type = args['type'] + end + end + + class InstanceTemplatePropertiesNetworkInterfacesAccessConfigsArray + def self.parse(value) + return if value.nil? + return InstanceTemplatePropertiesNetworkInterfacesAccessConfigs.new(value) unless value.is_a?(::Array) + value.map { |v| InstanceTemplatePropertiesNetworkInterfacesAccessConfigs.new(v) } + end + end + 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 new file mode 100644 index 000000000..1fdaad384 --- /dev/null +++ b/libraries/google/compute/property/instancetemplate_properties_network_interfaces_alias_ip_ranges.rb @@ -0,0 +1,40 @@ +# 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 Compute + module Property + class InstanceTemplatePropertiesNetworkInterfacesAliasIpRanges + attr_reader :ip_cidr_range + + attr_reader :subnetwork_range_name + + def initialize(args = nil) + return if args.nil? + @ip_cidr_range = args['ipCidrRange'] + @subnetwork_range_name = args['subnetworkRangeName'] + end + end + + class InstanceTemplatePropertiesNetworkInterfacesAliasIpRangesArray + def self.parse(value) + return if value.nil? + return InstanceTemplatePropertiesNetworkInterfacesAliasIpRanges.new(value) unless value.is_a?(::Array) + value.map { |v| InstanceTemplatePropertiesNetworkInterfacesAliasIpRanges.new(v) } + end + end + end + end +end diff --git a/libraries/google/compute/property/instancetemplate_properties_scheduling.rb b/libraries/google/compute/property/instancetemplate_properties_scheduling.rb new file mode 100644 index 000000000..78eeb5591 --- /dev/null +++ b/libraries/google/compute/property/instancetemplate_properties_scheduling.rb @@ -0,0 +1,35 @@ +# 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 Compute + module Property + class InstanceTemplatePropertiesScheduling + attr_reader :automatic_restart + + attr_reader :on_host_maintenance + + attr_reader :preemptible + + def initialize(args = nil) + return if args.nil? + @automatic_restart = args['automaticRestart'] + @on_host_maintenance = args['onHostMaintenance'] + @preemptible = args['preemptible'] + end + 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 new file mode 100644 index 000000000..ec7ba2f3b --- /dev/null +++ b/libraries/google/compute/property/instancetemplate_properties_service_accounts.rb @@ -0,0 +1,40 @@ +# 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 Compute + module Property + class InstanceTemplatePropertiesServiceAccounts + attr_reader :email + + attr_reader :scopes + + def initialize(args = nil) + return if args.nil? + @email = args['email'] + @scopes = args['scopes'] + end + end + + class InstanceTemplatePropertiesServiceAccountsArray + def self.parse(value) + return if value.nil? + return InstanceTemplatePropertiesServiceAccounts.new(value) unless value.is_a?(::Array) + value.map { |v| InstanceTemplatePropertiesServiceAccounts.new(v) } + end + end + end + end +end diff --git a/libraries/google/compute/property/instancetemplate_properties_tags.rb b/libraries/google/compute/property/instancetemplate_properties_tags.rb new file mode 100644 index 000000000..43da87494 --- /dev/null +++ b/libraries/google/compute/property/instancetemplate_properties_tags.rb @@ -0,0 +1,32 @@ +# 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 Compute + module Property + class InstanceTemplatePropertiesTags + attr_reader :fingerprint + + attr_reader :items + + def initialize(args = nil) + return if args.nil? + @fingerprint = args['fingerprint'] + @items = args['items'] + end + end + end + end +end diff --git a/libraries/google/compute/property/router_bgp.rb b/libraries/google/compute/property/router_bgp.rb index 54a34ab73..b650dd1cf 100644 --- a/libraries/google/compute/property/router_bgp.rb +++ b/libraries/google/compute/property/router_bgp.rb @@ -13,7 +13,7 @@ # CONTRIBUTING.md located at the root of this package. # # ---------------------------------------------------------------------------- -require 'google/compute/property/router_advertised_ip_ranges' +require 'google/compute/property/router_bgp_advertised_ip_ranges' module GoogleInSpec module Compute module Property @@ -31,7 +31,7 @@ def initialize(args = nil) @asn = args['asn'] @advertise_mode = args['advertiseMode'] @advertised_groups = args['advertisedGroups'] - @advertised_ip_ranges = GoogleInSpec::Compute::Property::RouterAdvertisediprangesArray.parse(args['advertisedIpRanges']) + @advertised_ip_ranges = GoogleInSpec::Compute::Property::RouterBgpAdvertisedIpRangesArray.parse(args['advertisedIpRanges']) 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 new file mode 100644 index 000000000..7a9740de5 --- /dev/null +++ b/libraries/google/compute/property/router_bgp_advertised_ip_ranges.rb @@ -0,0 +1,40 @@ +# 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 Compute + module Property + class RouterBgpAdvertisedIpRanges + attr_reader :range + + attr_reader :description + + def initialize(args = nil) + return if args.nil? + @range = args['range'] + @description = args['description'] + end + end + + class RouterBgpAdvertisedIpRangesArray + def self.parse(value) + return if value.nil? + return RouterBgpAdvertisedIpRanges.new(value) unless value.is_a?(::Array) + value.map { |v| RouterBgpAdvertisedIpRanges.new(v) } + end + end + 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 20b236be0..914cdb500 100644 --- a/libraries/google/compute/property/snapshot_snapshot_encryption_key.rb +++ b/libraries/google/compute/property/snapshot_snapshot_encryption_key.rb @@ -16,7 +16,7 @@ module GoogleInSpec module Compute module Property - class SnapshotSnapshotencryptionkey + class SnapshotSnapshotEncryptionKey attr_reader :raw_key attr_reader :sha256 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 c6e803cc3..0dcef7a97 100644 --- a/libraries/google/compute/property/snapshot_source_disk_encryption_key.rb +++ b/libraries/google/compute/property/snapshot_source_disk_encryption_key.rb @@ -16,7 +16,7 @@ module GoogleInSpec module Compute module Property - class SnapshotSourcediskencryptionkey + class SnapshotSourceDiskEncryptionKey attr_reader :raw_key attr_reader :kms_key_name diff --git a/libraries/google/compute/property/urlmap_host_rules.rb b/libraries/google/compute/property/urlmap_host_rules.rb index dbe4e38de..88f700505 100644 --- a/libraries/google/compute/property/urlmap_host_rules.rb +++ b/libraries/google/compute/property/urlmap_host_rules.rb @@ -16,7 +16,7 @@ module GoogleInSpec module Compute module Property - class UrlMapHostrules + class UrlMapHostRules attr_reader :description attr_reader :hosts @@ -31,11 +31,11 @@ def initialize(args = nil) end end - class UrlMapHostrulesArray + class UrlMapHostRulesArray def self.parse(value) return if value.nil? - return UrlMapHostrules.new(value) unless value.is_a?(::Array) - value.map { |v| UrlMapHostrules.new(v) } + return UrlMapHostRules.new(value) unless value.is_a?(::Array) + value.map { |v| UrlMapHostRules.new(v) } end end end diff --git a/libraries/google/compute/property/urlmap_path_matchers.rb b/libraries/google/compute/property/urlmap_path_matchers.rb index ecd46328e..000d730f7 100644 --- a/libraries/google/compute/property/urlmap_path_matchers.rb +++ b/libraries/google/compute/property/urlmap_path_matchers.rb @@ -13,11 +13,11 @@ # CONTRIBUTING.md located at the root of this package. # # ---------------------------------------------------------------------------- -require 'google/compute/property/urlmap_path_rules' +require 'google/compute/property/urlmap_path_matchers_path_rules' module GoogleInSpec module Compute module Property - class UrlMapPathmatchers + class UrlMapPathMatchers attr_reader :default_service attr_reader :description @@ -31,15 +31,15 @@ def initialize(args = nil) @default_service = args['defaultService'] @description = args['description'] @name = args['name'] - @path_rules = GoogleInSpec::Compute::Property::UrlMapPathrulesArray.parse(args['pathRules']) + @path_rules = GoogleInSpec::Compute::Property::UrlMapPathMatchersPathRulesArray.parse(args['pathRules']) end end - class UrlMapPathmatchersArray + class UrlMapPathMatchersArray def self.parse(value) return if value.nil? - return UrlMapPathmatchers.new(value) unless value.is_a?(::Array) - value.map { |v| UrlMapPathmatchers.new(v) } + return UrlMapPathMatchers.new(value) unless value.is_a?(::Array) + value.map { |v| UrlMapPathMatchers.new(v) } 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 new file mode 100644 index 000000000..d6d438a76 --- /dev/null +++ b/libraries/google/compute/property/urlmap_path_matchers_path_rules.rb @@ -0,0 +1,40 @@ +# 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 Compute + module Property + class UrlMapPathMatchersPathRules + attr_reader :paths + + attr_reader :service + + def initialize(args = nil) + return if args.nil? + @paths = args['paths'] + @service = args['service'] + end + end + + class UrlMapPathMatchersPathRulesArray + def self.parse(value) + return if value.nil? + return UrlMapPathMatchersPathRules.new(value) unless value.is_a?(::Array) + value.map { |v| UrlMapPathMatchersPathRules.new(v) } + end + end + end + end +end diff --git a/libraries/google/container/property/regionalcluster_addons_config.rb b/libraries/google/container/property/regionalcluster_addons_config.rb index f604c6109..e5c2a957d 100644 --- a/libraries/google/container/property/regionalcluster_addons_config.rb +++ b/libraries/google/container/property/regionalcluster_addons_config.rb @@ -13,20 +13,20 @@ # CONTRIBUTING.md located at the root of this package. # # ---------------------------------------------------------------------------- -require 'google/container/property/regionalcluster_horizontal_pod_autoscaling' -require 'google/container/property/regionalcluster_http_load_balancing' +require 'google/container/property/regionalcluster_addons_config_horizontal_pod_autoscaling' +require 'google/container/property/regionalcluster_addons_config_http_load_balancing' module GoogleInSpec module Container module Property - class RegionalClusterAddonsconfig + class RegionalClusterAddonsConfig attr_reader :http_load_balancing attr_reader :horizontal_pod_autoscaling def initialize(args = nil) return if args.nil? - @http_load_balancing = GoogleInSpec::Container::Property::RegionalClusterHttploadbalancing.new(args['httpLoadBalancing']) - @horizontal_pod_autoscaling = GoogleInSpec::Container::Property::RegionalClusterHorizontalpodautoscaling.new(args['horizontalPodAutoscaling']) + @http_load_balancing = GoogleInSpec::Container::Property::RegionalClusterAddonsConfigHttpLoadBalancing.new(args['httpLoadBalancing']) + @horizontal_pod_autoscaling = GoogleInSpec::Container::Property::RegionalClusterAddonsConfigHorizontalPodAutoscaling.new(args['horizontalPodAutoscaling']) 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 new file mode 100644 index 000000000..f0b313863 --- /dev/null +++ b/libraries/google/container/property/regionalcluster_addons_config_horizontal_pod_autoscaling.rb @@ -0,0 +1,29 @@ +# 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 RegionalClusterAddonsConfigHorizontalPodAutoscaling + attr_reader :disabled + + def initialize(args = nil) + return if args.nil? + @disabled = args['disabled'] + end + 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 new file mode 100644 index 000000000..0ebf124c7 --- /dev/null +++ b/libraries/google/container/property/regionalcluster_addons_config_http_load_balancing.rb @@ -0,0 +1,29 @@ +# 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 RegionalClusterAddonsConfigHttpLoadBalancing + attr_reader :disabled + + def initialize(args = nil) + return if args.nil? + @disabled = args['disabled'] + end + 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 63ae6c527..ddff46095 100644 --- a/libraries/google/container/property/regionalcluster_master_auth.rb +++ b/libraries/google/container/property/regionalcluster_master_auth.rb @@ -16,7 +16,7 @@ module GoogleInSpec module Container module Property - class RegionalClusterMasterauth + class RegionalClusterMasterAuth attr_reader :username attr_reader :password diff --git a/libraries/google/container/property/regionalcluster_node_config.rb b/libraries/google/container/property/regionalcluster_node_config.rb index c75148f4d..97755ad6c 100644 --- a/libraries/google/container/property/regionalcluster_node_config.rb +++ b/libraries/google/container/property/regionalcluster_node_config.rb @@ -16,7 +16,7 @@ module GoogleInSpec module Container module Property - class RegionalClusterNodeconfig + class RegionalClusterNodeConfig attr_reader :machine_type attr_reader :disk_size_gb diff --git a/libraries/google/pubsub/property/subscription_push_config.rb b/libraries/google/pubsub/property/subscription_push_config.rb index 234cf0bfd..90695d1e6 100644 --- a/libraries/google/pubsub/property/subscription_push_config.rb +++ b/libraries/google/pubsub/property/subscription_push_config.rb @@ -16,7 +16,7 @@ module GoogleInSpec module Pubsub module Property - class SubscriptionPushconfig + class SubscriptionPushConfig attr_reader :push_endpoint def initialize(args = nil) diff --git a/libraries/google_bigquery_dataset.rb b/libraries/google_bigquery_dataset.rb index 57790a12f..cfd684f7c 100644 --- a/libraries/google_bigquery_dataset.rb +++ b/libraries/google_bigquery_dataset.rb @@ -52,7 +52,7 @@ 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']) + @dataset_reference = GoogleInSpec::BigQuery::Property::DatasetDatasetReference.new(@fetched['datasetReference']) @default_table_expiration_ms = @fetched['defaultTableExpirationMs'] @description = @fetched['description'] @friendly_name = @fetched['friendlyName'] diff --git a/libraries/google_bigquery_datasets.rb b/libraries/google_bigquery_datasets.rb index 100350300..3d2163c05 100644 --- a/libraries/google_bigquery_datasets.rb +++ b/libraries/google_bigquery_datasets.rb @@ -75,7 +75,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']) }, 'friendlyName' => ->(obj) { return :friendly_name, obj['friendlyName'] }, 'id' => ->(obj) { return :id, obj['id'] }, 'labels' => ->(obj) { return :labels, obj['labels'] }, diff --git a/libraries/google_cloudbuild_trigger.rb b/libraries/google_cloudbuild_trigger.rb index eb1ec28cc..c99e5a2f7 100644 --- a/libraries/google_cloudbuild_trigger.rb +++ b/libraries/google_cloudbuild_trigger.rb @@ -15,7 +15,7 @@ # ---------------------------------------------------------------------------- require 'gcp_backend' require 'google/cloudbuild/property/trigger_build' -require 'google/cloudbuild/property/trigger_steps' +require 'google/cloudbuild/property/trigger_build_steps' require 'google/cloudbuild/property/trigger_trigger_template' # A provider to manage Cloud build resources. @@ -57,7 +57,7 @@ def parse @filename = @fetched['filename'] @ignored_files = @fetched['ignoredFiles'] @included_files = @fetched['includedFiles'] - @trigger_template = GoogleInSpec::CloudBuild::Property::TriggerTriggertemplate.new(@fetched['triggerTemplate']) + @trigger_template = GoogleInSpec::CloudBuild::Property::TriggerTriggerTemplate.new(@fetched['triggerTemplate']) @build = GoogleInSpec::CloudBuild::Property::TriggerBuild.new(@fetched['build']) end diff --git a/libraries/google_cloudbuild_triggers.rb b/libraries/google_cloudbuild_triggers.rb index a6aa7c99e..b8221c647 100644 --- a/libraries/google_cloudbuild_triggers.rb +++ b/libraries/google_cloudbuild_triggers.rb @@ -88,7 +88,7 @@ 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']) }, + 'triggerTemplate' => ->(obj) { return :trigger_template, GoogleInSpec::CloudBuild::Property::TriggerTriggerTemplate.new(obj['triggerTemplate']) }, 'build' => ->(obj) { return :build, GoogleInSpec::CloudBuild::Property::TriggerBuild.new(obj['build']) }, } end diff --git a/libraries/google_compute_autoscaler.rb b/libraries/google_compute_autoscaler.rb index b5c590dca..c7019072c 100644 --- a/libraries/google_compute_autoscaler.rb +++ b/libraries/google_compute_autoscaler.rb @@ -15,9 +15,9 @@ # ---------------------------------------------------------------------------- require 'gcp_backend' require 'google/compute/property/autoscaler_autoscaling_policy' -require 'google/compute/property/autoscaler_cpu_utilization' -require 'google/compute/property/autoscaler_custom_metric_utilizations' -require 'google/compute/property/autoscaler_load_balancing_utilization' +require 'google/compute/property/autoscaler_autoscaling_policy_cpu_utilization' +require 'google/compute/property/autoscaler_autoscaling_policy_custom_metric_utilizations' +require 'google/compute/property/autoscaler_autoscaling_policy_load_balancing_utilization' # A provider to manage Google Compute Engine resources. class Autoscaler < GcpResourceBase @@ -51,7 +51,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']) @target = @fetched['target'] @zone = @fetched['zone'] end diff --git a/libraries/google_compute_autoscalers.rb b/libraries/google_compute_autoscalers.rb index e98ad8fce..ce7954895 100644 --- a/libraries/google_compute_autoscalers.rb +++ b/libraries/google_compute_autoscalers.rb @@ -81,7 +81,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']) }, '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 538de535d..b4e6c8ef6 100644 --- a/libraries/google_compute_backend_service.rb +++ b/libraries/google_compute_backend_service.rb @@ -15,8 +15,8 @@ # ---------------------------------------------------------------------------- require 'gcp_backend' require 'google/compute/property/backendservice_backends' -require 'google/compute/property/backendservice_cache_key_policy' require 'google/compute/property/backendservice_cdn_policy' +require 'google/compute/property/backendservice_cdn_policy_cache_key_policy' require 'google/compute/property/backendservice_connection_draining' require 'google/compute/property/backendservice_iap' @@ -60,8 +60,8 @@ def initialize(params) 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']) + @cdn_policy = GoogleInSpec::Compute::Property::BackendServiceCdnPolicy.new(@fetched['cdnPolicy']) + @connection_draining = GoogleInSpec::Compute::Property::BackendServiceConnectionDraining.new(@fetched['connectionDraining']) @creation_timestamp = parse_time_string(@fetched['creationTimestamp']) @description = @fetched['description'] @enable_cdn = @fetched['enableCDN'] diff --git a/libraries/google_compute_backend_services.rb b/libraries/google_compute_backend_services.rb index c689f61ee..8daa82066 100644 --- a/libraries/google_compute_backend_services.rb +++ b/libraries/google_compute_backend_services.rb @@ -89,8 +89,8 @@ 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']) }, + 'cdnPolicy' => ->(obj) { return :cdn_policy, GoogleInSpec::Compute::Property::BackendServiceCdnPolicy.new(obj['cdnPolicy']) }, + 'connectionDraining' => ->(obj) { return :connection_draining, GoogleInSpec::Compute::Property::BackendServiceConnectionDraining.new(obj['connectionDraining']) }, 'creationTimestamp' => ->(obj) { return :creation_timestamp, parse_time_string(obj['creationTimestamp']) }, 'description' => ->(obj) { return :description, obj['description'] }, 'enableCDN' => ->(obj) { return :enable_cdn, obj['enableCDN'] }, diff --git a/libraries/google_compute_disk.rb b/libraries/google_compute_disk.rb index d807ee20d..caa586125 100644 --- a/libraries/google_compute_disk.rb +++ b/libraries/google_compute_disk.rb @@ -73,11 +73,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']) @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']) @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']) @source_snapshot_id = @fetched['sourceSnapshotId'] end diff --git a/libraries/google_compute_disks.rb b/libraries/google_compute_disks.rb index 32e875a1d..cb3bf974d 100644 --- a/libraries/google_compute_disks.rb +++ b/libraries/google_compute_disks.rb @@ -104,11 +104,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']) }, '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']) }, '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']) }, 'sourceSnapshotId' => ->(obj) { return :source_snapshot_id, obj['sourceSnapshotId'] }, } end diff --git a/libraries/google_compute_health_check.rb b/libraries/google_compute_health_check.rb index 894751361..47c42ecfa 100644 --- a/libraries/google_compute_health_check.rb +++ b/libraries/google_compute_health_check.rb @@ -62,10 +62,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']) + @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']) end # Handles parsing RFC3339 time string diff --git a/libraries/google_compute_health_checks.rb b/libraries/google_compute_health_checks.rb index ae436b26b..0ef54fba3 100644 --- a/libraries/google_compute_health_checks.rb +++ b/libraries/google_compute_health_checks.rb @@ -92,10 +92,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']) }, + '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']) }, } end diff --git a/libraries/google_compute_instance_group_manager.rb b/libraries/google_compute_instance_group_manager.rb index 96af5bdbe..f518ff84f 100644 --- a/libraries/google_compute_instance_group_manager.rb +++ b/libraries/google_compute_instance_group_manager.rb @@ -53,13 +53,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']) @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']) @region = @fetched['region'] @target_pools = @fetched['targetPools'] @target_size = @fetched['targetSize'] diff --git a/libraries/google_compute_instance_group_managers.rb b/libraries/google_compute_instance_group_managers.rb index 45aa62e61..616853fc7 100644 --- a/libraries/google_compute_instance_group_managers.rb +++ b/libraries/google_compute_instance_group_managers.rb @@ -85,13 +85,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']) }, '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']) }, '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 3f68e55b2..86c352fb9 100644 --- a/libraries/google_compute_instance_template.rb +++ b/libraries/google_compute_instance_template.rb @@ -14,13 +14,13 @@ # # ---------------------------------------------------------------------------- require 'gcp_backend' -require 'google/compute/property/instancetemplate_disks' -require 'google/compute/property/instancetemplate_guest_accelerators' -require 'google/compute/property/instancetemplate_network_interfaces' require 'google/compute/property/instancetemplate_properties' -require 'google/compute/property/instancetemplate_scheduling' -require 'google/compute/property/instancetemplate_service_accounts' -require 'google/compute/property/instancetemplate_tags' +require 'google/compute/property/instancetemplate_properties_disks' +require 'google/compute/property/instancetemplate_properties_guest_accelerators' +require 'google/compute/property/instancetemplate_properties_network_interfaces' +require 'google/compute/property/instancetemplate_properties_scheduling' +require 'google/compute/property/instancetemplate_properties_service_accounts' +require 'google/compute/property/instancetemplate_properties_tags' # A provider to manage Google Compute Engine resources. class InstanceTemplate < GcpResourceBase diff --git a/libraries/google_compute_router.rb b/libraries/google_compute_router.rb index 6b5d91ab2..e39217ee4 100644 --- a/libraries/google_compute_router.rb +++ b/libraries/google_compute_router.rb @@ -14,8 +14,8 @@ # # ---------------------------------------------------------------------------- require 'gcp_backend' -require 'google/compute/property/router_advertised_ip_ranges' require 'google/compute/property/router_bgp' +require 'google/compute/property/router_bgp_advertised_ip_ranges' # A provider to manage Google Compute Engine resources. class Router < GcpResourceBase diff --git a/libraries/google_compute_snapshot.rb b/libraries/google_compute_snapshot.rb index 53826f636..482121e07 100644 --- a/libraries/google_compute_snapshot.rb +++ b/libraries/google_compute_snapshot.rb @@ -62,8 +62,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']) + @source_disk_encryption_key = GoogleInSpec::Compute::Property::SnapshotSourceDiskEncryptionKey.new(@fetched['sourceDiskEncryptionKey']) end # Handles parsing RFC3339 time string diff --git a/libraries/google_compute_snapshots.rb b/libraries/google_compute_snapshots.rb index 37931f773..675d660e5 100644 --- a/libraries/google_compute_snapshots.rb +++ b/libraries/google_compute_snapshots.rb @@ -94,8 +94,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']) }, + 'sourceDiskEncryptionKey' => ->(obj) { return :source_disk_encryption_key, GoogleInSpec::Compute::Property::SnapshotSourceDiskEncryptionKey.new(obj['sourceDiskEncryptionKey']) }, } end diff --git a/libraries/google_compute_url_map.rb b/libraries/google_compute_url_map.rb index bb3f84fdc..080e4adb5 100644 --- a/libraries/google_compute_url_map.rb +++ b/libraries/google_compute_url_map.rb @@ -51,11 +51,11 @@ 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']) @id = @fetched['id'] @fingerprint = @fetched['fingerprint'] @name = @fetched['name'] - @path_matchers = GoogleInSpec::Compute::Property::UrlMapPathmatchersArray.parse(@fetched['pathMatchers']) + @path_matchers = GoogleInSpec::Compute::Property::UrlMapPathMatchersArray.parse(@fetched['pathMatchers']) @tests = GoogleInSpec::Compute::Property::UrlMapTestsArray.parse(@fetched['tests']) end diff --git a/libraries/google_compute_url_maps.rb b/libraries/google_compute_url_maps.rb index 48a4fd6c9..7c3ef5f6e 100644 --- a/libraries/google_compute_url_maps.rb +++ b/libraries/google_compute_url_maps.rb @@ -82,11 +82,11 @@ 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']) }, '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']) }, + 'pathMatchers' => ->(obj) { return :path_matchers, GoogleInSpec::Compute::Property::UrlMapPathMatchersArray.parse(obj['pathMatchers']) }, 'tests' => ->(obj) { return :tests, GoogleInSpec::Compute::Property::UrlMapTestsArray.parse(obj['tests']) }, } end diff --git a/libraries/google_container_regional_cluster.rb b/libraries/google_container_regional_cluster.rb index c255f3505..41576be66 100644 --- a/libraries/google_container_regional_cluster.rb +++ b/libraries/google_container_regional_cluster.rb @@ -15,8 +15,8 @@ # ---------------------------------------------------------------------------- require 'gcp_backend' require 'google/container/property/regionalcluster_addons_config' -require 'google/container/property/regionalcluster_horizontal_pod_autoscaling' -require 'google/container/property/regionalcluster_http_load_balancing' +require 'google/container/property/regionalcluster_addons_config_horizontal_pod_autoscaling' +require 'google/container/property/regionalcluster_addons_config_http_load_balancing' require 'google/container/property/regionalcluster_master_auth' require 'google/container/property/regionalcluster_node_config' @@ -65,13 +65,13 @@ 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']) + @master_auth = GoogleInSpec::Container::Property::RegionalClusterMasterAuth.new(@fetched['masterAuth']) @logging_service = @fetched['loggingService'] @monitoring_service = @fetched['monitoringService'] @network = @fetched['network'] @cluster_ipv4_cidr = @fetched['clusterIpv4Cidr'] - @addons_config = GoogleInSpec::Container::Property::RegionalClusterAddonsconfig.new(@fetched['addonsConfig']) + @addons_config = GoogleInSpec::Container::Property::RegionalClusterAddonsConfig.new(@fetched['addonsConfig']) @subnetwork = @fetched['subnetwork'] @endpoint = @fetched['endpoint'] @initial_cluster_version = @fetched['initialClusterVersion'] diff --git a/libraries/google_container_regional_clusters.rb b/libraries/google_container_regional_clusters.rb index 89bf16ec6..14cf22aee 100644 --- a/libraries/google_container_regional_clusters.rb +++ b/libraries/google_container_regional_clusters.rb @@ -94,13 +94,13 @@ 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']) }, + 'masterAuth' => ->(obj) { return :master_auth, GoogleInSpec::Container::Property::RegionalClusterMasterAuth.new(obj['masterAuth']) }, 'loggingService' => ->(obj) { return :logging_service, obj['loggingService'] }, 'monitoringService' => ->(obj) { return :monitoring_service, obj['monitoringService'] }, 'network' => ->(obj) { return :network, obj['network'] }, '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']) }, '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_pubsub_subscription.rb b/libraries/google_pubsub_subscription.rb index 4138c7b22..6a02a71f8 100644 --- a/libraries/google_pubsub_subscription.rb +++ b/libraries/google_pubsub_subscription.rb @@ -43,7 +43,7 @@ def initialize(params) def parse @name = name_from_self_link(@fetched['name']) @topic = @fetched['topic'] - @push_config = GoogleInSpec::Pubsub::Property::SubscriptionPushconfig.new(@fetched['pushConfig']) + @push_config = GoogleInSpec::Pubsub::Property::SubscriptionPushConfig.new(@fetched['pushConfig']) @ack_deadline_seconds = @fetched['ackDeadlineSeconds'] end diff --git a/libraries/google_pubsub_subscriptions.rb b/libraries/google_pubsub_subscriptions.rb index 099da6cc7..be1bff1a9 100644 --- a/libraries/google_pubsub_subscriptions.rb +++ b/libraries/google_pubsub_subscriptions.rb @@ -76,7 +76,7 @@ def transformers { 'name' => ->(obj) { return :name, name_from_self_link(obj['name']) }, 'topic' => ->(obj) { return :topic, obj['topic'] }, - 'pushConfig' => ->(obj) { return :push_config, GoogleInSpec::Pubsub::Property::SubscriptionPushconfig.new(obj['pushConfig']) }, + 'pushConfig' => ->(obj) { return :push_config, GoogleInSpec::Pubsub::Property::SubscriptionPushConfig.new(obj['pushConfig']) }, 'ackDeadlineSeconds' => ->(obj) { return :ack_deadline_seconds, obj['ackDeadlineSeconds'] }, } end diff --git a/test/integration/build/gcp-mm.tf b/test/integration/build/gcp-mm.tf index 17296b5c8..cedbc52b0 100644 --- a/test/integration/build/gcp-mm.tf +++ b/test/integration/build/gcp-mm.tf @@ -102,6 +102,10 @@ variable "dataset" { type = "map" } +variable "bigquery_table" { + type = "map" +} + resource "google_compute_ssl_policy" "custom-ssl-policy" { name = "${var.ssl_policy["name"]}" min_tls_version = "${var.ssl_policy["min_tls_version"]}" @@ -408,12 +412,25 @@ resource "google_bigquery_dataset" "gcp-inspec-dataset" { default_table_expiration_ms = "${var.dataset["default_table_expiration_ms"]}" access { - role = "${var.dataset["access_reader_role"]}" - domain = "${var.dataset["access_reader_domain"]}" + role = "${var.dataset["access_writer_role"]}" + special_group = "${var.dataset["access_writer_special_group"]}" } access { - role = "${var.dataset["access_writer_role"]}" - special_group = "${var.dataset["access_writer_special_group"]}" + role = "OWNER" + special_group = "projectOwners" } +} + +resource "google_bigquery_table" "gcp-inspec-bigquery-table" { + project = "${var.gcp_project_id}" + dataset_id = "${google_bigquery_dataset.gcp-inspec-dataset.dataset_id}" + table_id = "${var.bigquery_table["table_id"]}" + + time_partitioning { + type = "${var.bigquery_table["time_partitioning_type"]}" + } + + description = "${var.bigquery_table["description"]}" + expiration_time = "${var.bigquery_table["expiration_time"]}" } \ No newline at end of file diff --git a/test/integration/configuration/mm-attributes.yml b/test/integration/configuration/mm-attributes.yml index 434d4130c..b7ca91f40 100644 --- a/test/integration/configuration/mm-attributes.yml +++ b/test/integration/configuration/mm-attributes.yml @@ -176,7 +176,11 @@ dataset: description: Test BigQuery dataset description location: EU default_table_expiration_ms: 3600000 - access_reader_role: READER - access_reader_domain: example.com access_writer_role: WRITER - access_writer_special_group: projectWriters \ No newline at end of file + access_writer_special_group: projectWriters + +bigquery_table: + table_id: inspec_gcp_bigquery_table + description: A BigQuery table + expiration_time: 1738882264000 + time_partitioning_type: DAY \ No newline at end of file diff --git a/test/integration/verify/controls/google_bigquery_dataset.rb b/test/integration/verify/controls/google_bigquery_dataset.rb index be8e94694..6e4e325ab 100644 --- a/test/integration/verify/controls/google_bigquery_dataset.rb +++ b/test/integration/verify/controls/google_bigquery_dataset.rb @@ -21,8 +21,6 @@ "description": "Test BigQuery dataset description", "location": "EU", "default_table_expiration_ms": 3600000, - "access_reader_role": "READER", - "access_reader_domain": "example.com", "access_writer_role": "WRITER", "access_writer_special_group": "projectWriters" }, description: 'BigQuery dataset definition') @@ -39,15 +37,6 @@ its('default_table_expiration_ms') { should cmp dataset['default_table_expiration_ms'] } end - describe.one do - google_bigquery_dataset(project: gcp_project_id, name: dataset['dataset_id']).access.each do |dataset_access| - describe dataset_access do - its('role') { should eq dataset['access_reader_role'] } - its('domain') { should eq dataset['access_reader_domain'] } - end - end - end - describe.one do google_bigquery_dataset(project: gcp_project_id, name: dataset['dataset_id']).access.each do |dataset_access| describe dataset_access do diff --git a/test/integration/verify/controls/google_bigquery_datasets.rb b/test/integration/verify/controls/google_bigquery_datasets.rb index a7517de60..84051e26d 100644 --- a/test/integration/verify/controls/google_bigquery_datasets.rb +++ b/test/integration/verify/controls/google_bigquery_datasets.rb @@ -21,8 +21,6 @@ "description": "Test BigQuery dataset description", "location": "EU", "default_table_expiration_ms": 3600000, - "access_reader_role": "READER", - "access_reader_domain": "example.com", "access_writer_role": "WRITER", "access_writer_special_group": "projectWriters" }, description: 'BigQuery dataset definition') From 6e7bd78bdeec5340884b37ba6f665cd825544d5a Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Tue, 12 Feb 2019 16:57:50 -0800 Subject: [PATCH 7/7] Remove old nested objects with bad namespaces Signed-off-by: Sam Levenick --- .../google/bigquery/property/dataset_view.rb | 35 ---------- .../cloudbuild/property/trigger_steps.rb | 40 ----------- .../property/autoscaler_cpu_utilization.rb | 29 -------- .../autoscaler_custom_metric_utilizations.rb | 43 ------------ .../autoscaler_load_balancing_utilization.rb | 29 -------- .../backendservice_cache_key_policy.rb | 41 ------------ .../instancetemplate_access_configs.rb | 43 ------------ .../instancetemplate_alias_ip_ranges.rb | 40 ----------- .../instancetemplate_disk_encryption_key.rb | 35 ---------- .../property/instancetemplate_disks.rb | 67 ------------------- .../instancetemplate_guest_accelerators.rb | 40 ----------- .../instancetemplate_initialize_params.rb | 42 ------------ .../instancetemplate_network_interfaces.rb | 54 --------------- .../property/instancetemplate_scheduling.rb | 35 ---------- .../instancetemplate_service_accounts.rb | 40 ----------- ...ncetemplate_source_image_encryption_key.rb | 32 --------- .../compute/property/instancetemplate_tags.rb | 32 --------- .../property/router_advertised_ip_ranges.rb | 40 ----------- .../compute/property/urlmap_path_rules.rb | 40 ----------- ...ionalcluster_horizontal_pod_autoscaling.rb | 29 -------- .../regionalcluster_http_load_balancing.rb | 29 -------- 21 files changed, 815 deletions(-) delete mode 100644 libraries/google/bigquery/property/dataset_view.rb delete mode 100644 libraries/google/cloudbuild/property/trigger_steps.rb delete mode 100644 libraries/google/compute/property/autoscaler_cpu_utilization.rb delete mode 100644 libraries/google/compute/property/autoscaler_custom_metric_utilizations.rb delete mode 100644 libraries/google/compute/property/autoscaler_load_balancing_utilization.rb delete mode 100644 libraries/google/compute/property/backendservice_cache_key_policy.rb delete mode 100644 libraries/google/compute/property/instancetemplate_access_configs.rb delete mode 100644 libraries/google/compute/property/instancetemplate_alias_ip_ranges.rb delete mode 100644 libraries/google/compute/property/instancetemplate_disk_encryption_key.rb delete mode 100644 libraries/google/compute/property/instancetemplate_disks.rb delete mode 100644 libraries/google/compute/property/instancetemplate_guest_accelerators.rb delete mode 100644 libraries/google/compute/property/instancetemplate_initialize_params.rb delete mode 100644 libraries/google/compute/property/instancetemplate_network_interfaces.rb delete mode 100644 libraries/google/compute/property/instancetemplate_scheduling.rb delete mode 100644 libraries/google/compute/property/instancetemplate_service_accounts.rb delete mode 100644 libraries/google/compute/property/instancetemplate_source_image_encryption_key.rb delete mode 100644 libraries/google/compute/property/instancetemplate_tags.rb delete mode 100644 libraries/google/compute/property/router_advertised_ip_ranges.rb delete mode 100644 libraries/google/compute/property/urlmap_path_rules.rb delete mode 100644 libraries/google/container/property/regionalcluster_horizontal_pod_autoscaling.rb delete mode 100644 libraries/google/container/property/regionalcluster_http_load_balancing.rb diff --git a/libraries/google/bigquery/property/dataset_view.rb b/libraries/google/bigquery/property/dataset_view.rb deleted file mode 100644 index 96d6023d1..000000000 --- a/libraries/google/bigquery/property/dataset_view.rb +++ /dev/null @@ -1,35 +0,0 @@ -# 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 BigQuery - module Property - class DatasetView - attr_reader :dataset_id - - attr_reader :project_id - - attr_reader :table_id - - def initialize(args = nil) - return if args.nil? - @dataset_id = args['datasetId'] - @project_id = args['projectId'] - @table_id = args['tableId'] - end - end - end - end -end diff --git a/libraries/google/cloudbuild/property/trigger_steps.rb b/libraries/google/cloudbuild/property/trigger_steps.rb deleted file mode 100644 index 05596caa6..000000000 --- a/libraries/google/cloudbuild/property/trigger_steps.rb +++ /dev/null @@ -1,40 +0,0 @@ -# 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 CloudBuild - module Property - class TriggerSteps - attr_reader :name - - attr_reader :args - - def initialize(args = nil) - return if args.nil? - @name = args['name'] - @args = args['args'] - end - end - - class TriggerStepsArray - def self.parse(value) - return if value.nil? - return TriggerSteps.new(value) unless value.is_a?(::Array) - value.map { |v| TriggerSteps.new(v) } - end - end - end - end -end diff --git a/libraries/google/compute/property/autoscaler_cpu_utilization.rb b/libraries/google/compute/property/autoscaler_cpu_utilization.rb deleted file mode 100644 index 12d179582..000000000 --- a/libraries/google/compute/property/autoscaler_cpu_utilization.rb +++ /dev/null @@ -1,29 +0,0 @@ -# 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 Compute - module Property - class AutoscalerCpuutilization - attr_reader :utilization_target - - def initialize(args = nil) - return if args.nil? - @utilization_target = args['utilizationTarget'] - end - end - end - end -end diff --git a/libraries/google/compute/property/autoscaler_custom_metric_utilizations.rb b/libraries/google/compute/property/autoscaler_custom_metric_utilizations.rb deleted file mode 100644 index 9307323c2..000000000 --- a/libraries/google/compute/property/autoscaler_custom_metric_utilizations.rb +++ /dev/null @@ -1,43 +0,0 @@ -# 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 Compute - module Property - class AutoscalerCustommetricutilizations - attr_reader :metric - - attr_reader :utilization_target - - attr_reader :utilization_target_type - - def initialize(args = nil) - return if args.nil? - @metric = args['metric'] - @utilization_target = args['utilizationTarget'] - @utilization_target_type = args['utilizationTargetType'] - end - end - - class AutoscalerCustommetricutilizationsArray - def self.parse(value) - return if value.nil? - return AutoscalerCustommetricutilizations.new(value) unless value.is_a?(::Array) - value.map { |v| AutoscalerCustommetricutilizations.new(v) } - end - end - end - end -end diff --git a/libraries/google/compute/property/autoscaler_load_balancing_utilization.rb b/libraries/google/compute/property/autoscaler_load_balancing_utilization.rb deleted file mode 100644 index b6510b902..000000000 --- a/libraries/google/compute/property/autoscaler_load_balancing_utilization.rb +++ /dev/null @@ -1,29 +0,0 @@ -# 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 Compute - module Property - class AutoscalerLoadbalancingutilization - attr_reader :utilization_target - - def initialize(args = nil) - return if args.nil? - @utilization_target = args['utilizationTarget'] - end - end - end - end -end diff --git a/libraries/google/compute/property/backendservice_cache_key_policy.rb b/libraries/google/compute/property/backendservice_cache_key_policy.rb deleted file mode 100644 index a0951f41e..000000000 --- a/libraries/google/compute/property/backendservice_cache_key_policy.rb +++ /dev/null @@ -1,41 +0,0 @@ -# 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 Compute - module Property - class BackendServiceCachekeypolicy - attr_reader :include_host - - attr_reader :include_protocol - - attr_reader :include_query_string - - attr_reader :query_string_blacklist - - attr_reader :query_string_whitelist - - def initialize(args = nil) - return if args.nil? - @include_host = args['includeHost'] - @include_protocol = args['includeProtocol'] - @include_query_string = args['includeQueryString'] - @query_string_blacklist = args['queryStringBlacklist'] - @query_string_whitelist = args['queryStringWhitelist'] - end - end - end - end -end diff --git a/libraries/google/compute/property/instancetemplate_access_configs.rb b/libraries/google/compute/property/instancetemplate_access_configs.rb deleted file mode 100644 index f5a0a904c..000000000 --- a/libraries/google/compute/property/instancetemplate_access_configs.rb +++ /dev/null @@ -1,43 +0,0 @@ -# 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 Compute - module Property - class InstanceTemplateAccessconfigs - attr_reader :name - - attr_reader :nat_ip - - attr_reader :type - - def initialize(args = nil) - return if args.nil? - @name = args['name'] - @nat_ip = args['natIP'] - @type = args['type'] - end - end - - class InstanceTemplateAccessconfigsArray - def self.parse(value) - return if value.nil? - return InstanceTemplateAccessconfigs.new(value) unless value.is_a?(::Array) - value.map { |v| InstanceTemplateAccessconfigs.new(v) } - end - end - end - end -end diff --git a/libraries/google/compute/property/instancetemplate_alias_ip_ranges.rb b/libraries/google/compute/property/instancetemplate_alias_ip_ranges.rb deleted file mode 100644 index 3f4f0d3c9..000000000 --- a/libraries/google/compute/property/instancetemplate_alias_ip_ranges.rb +++ /dev/null @@ -1,40 +0,0 @@ -# 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 Compute - module Property - class InstanceTemplateAliasipranges - attr_reader :ip_cidr_range - - attr_reader :subnetwork_range_name - - def initialize(args = nil) - return if args.nil? - @ip_cidr_range = args['ipCidrRange'] - @subnetwork_range_name = args['subnetworkRangeName'] - end - end - - class InstanceTemplateAliasiprangesArray - def self.parse(value) - return if value.nil? - return InstanceTemplateAliasipranges.new(value) unless value.is_a?(::Array) - value.map { |v| InstanceTemplateAliasipranges.new(v) } - end - end - end - end -end diff --git a/libraries/google/compute/property/instancetemplate_disk_encryption_key.rb b/libraries/google/compute/property/instancetemplate_disk_encryption_key.rb deleted file mode 100644 index f48e897f2..000000000 --- a/libraries/google/compute/property/instancetemplate_disk_encryption_key.rb +++ /dev/null @@ -1,35 +0,0 @@ -# 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 Compute - module Property - class InstanceTemplateDiskencryptionkey - attr_reader :raw_key - - attr_reader :rsa_encrypted_key - - attr_reader :sha256 - - def initialize(args = nil) - return if args.nil? - @raw_key = args['rawKey'] - @rsa_encrypted_key = args['rsaEncryptedKey'] - @sha256 = args['sha256'] - end - end - end - end -end diff --git a/libraries/google/compute/property/instancetemplate_disks.rb b/libraries/google/compute/property/instancetemplate_disks.rb deleted file mode 100644 index 8b35a6224..000000000 --- a/libraries/google/compute/property/instancetemplate_disks.rb +++ /dev/null @@ -1,67 +0,0 @@ -# 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 'google/compute/property/instancetemplate_disk_encryption_key' -require 'google/compute/property/instancetemplate_initialize_params' -require 'google/compute/property/instancetemplate_source_image_encryption_key' -module GoogleInSpec - module Compute - module Property - class InstanceTemplateDisks - attr_reader :auto_delete - - attr_reader :boot - - attr_reader :device_name - - attr_reader :disk_encryption_key - - attr_reader :index - - attr_reader :initialize_params - - attr_reader :interface - - attr_reader :mode - - attr_reader :source - - attr_reader :type - - def initialize(args = nil) - return if args.nil? - @auto_delete = args['autoDelete'] - @boot = args['boot'] - @device_name = args['deviceName'] - @disk_encryption_key = GoogleInSpec::Compute::Property::InstanceTemplateDiskencryptionkey.new(args['diskEncryptionKey']) - @index = args['index'] - @initialize_params = GoogleInSpec::Compute::Property::InstanceTemplateInitializeparams.new(args['initializeParams']) - @interface = args['interface'] - @mode = args['mode'] - @source = args['source'] - @type = args['type'] - end - end - - class InstanceTemplateDisksArray - def self.parse(value) - return if value.nil? - return InstanceTemplateDisks.new(value) unless value.is_a?(::Array) - value.map { |v| InstanceTemplateDisks.new(v) } - end - end - end - end -end diff --git a/libraries/google/compute/property/instancetemplate_guest_accelerators.rb b/libraries/google/compute/property/instancetemplate_guest_accelerators.rb deleted file mode 100644 index 5182be9dc..000000000 --- a/libraries/google/compute/property/instancetemplate_guest_accelerators.rb +++ /dev/null @@ -1,40 +0,0 @@ -# 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 Compute - module Property - class InstanceTemplateGuestaccelerators - attr_reader :accelerator_count - - attr_reader :accelerator_type - - def initialize(args = nil) - return if args.nil? - @accelerator_count = args['acceleratorCount'] - @accelerator_type = args['acceleratorType'] - end - end - - class InstanceTemplateGuestacceleratorsArray - def self.parse(value) - return if value.nil? - return InstanceTemplateGuestaccelerators.new(value) unless value.is_a?(::Array) - value.map { |v| InstanceTemplateGuestaccelerators.new(v) } - end - end - end - end -end diff --git a/libraries/google/compute/property/instancetemplate_initialize_params.rb b/libraries/google/compute/property/instancetemplate_initialize_params.rb deleted file mode 100644 index f7d77bc37..000000000 --- a/libraries/google/compute/property/instancetemplate_initialize_params.rb +++ /dev/null @@ -1,42 +0,0 @@ -# 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 'google/compute/property/instancetemplate_source_image_encryption_key' -module GoogleInSpec - module Compute - module Property - class InstanceTemplateInitializeparams - attr_reader :disk_name - - attr_reader :disk_size_gb - - attr_reader :disk_type - - attr_reader :source_image - - attr_reader :source_image_encryption_key - - def initialize(args = nil) - return if args.nil? - @disk_name = args['diskName'] - @disk_size_gb = args['diskSizeGb'] - @disk_type = args['diskType'] - @source_image = args['sourceImage'] - @source_image_encryption_key = GoogleInSpec::Compute::Property::InstanceTemplateSourceimageencryptionkey.new(args['sourceImageEncryptionKey']) - end - end - end - end -end diff --git a/libraries/google/compute/property/instancetemplate_network_interfaces.rb b/libraries/google/compute/property/instancetemplate_network_interfaces.rb deleted file mode 100644 index 69140847f..000000000 --- a/libraries/google/compute/property/instancetemplate_network_interfaces.rb +++ /dev/null @@ -1,54 +0,0 @@ -# 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 'google/compute/property/instancetemplate_access_configs' -require 'google/compute/property/instancetemplate_alias_ip_ranges' -module GoogleInSpec - module Compute - module Property - class InstanceTemplateNetworkinterfaces - attr_reader :access_configs - - attr_reader :alias_ip_ranges - - attr_reader :name - - attr_reader :network - - attr_reader :network_ip - - attr_reader :subnetwork - - def initialize(args = nil) - return if args.nil? - @access_configs = GoogleInSpec::Compute::Property::InstanceTemplateAccessconfigsArray.parse(args['accessConfigs']) - @alias_ip_ranges = GoogleInSpec::Compute::Property::InstanceTemplateAliasiprangesArray.parse(args['aliasIpRanges']) - @name = args['name'] - @network = args['network'] - @network_ip = args['networkIP'] - @subnetwork = args['subnetwork'] - end - end - - class InstanceTemplateNetworkinterfacesArray - def self.parse(value) - return if value.nil? - return InstanceTemplateNetworkinterfaces.new(value) unless value.is_a?(::Array) - value.map { |v| InstanceTemplateNetworkinterfaces.new(v) } - end - end - end - end -end diff --git a/libraries/google/compute/property/instancetemplate_scheduling.rb b/libraries/google/compute/property/instancetemplate_scheduling.rb deleted file mode 100644 index 33a95de09..000000000 --- a/libraries/google/compute/property/instancetemplate_scheduling.rb +++ /dev/null @@ -1,35 +0,0 @@ -# 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 Compute - module Property - class InstanceTemplateScheduling - attr_reader :automatic_restart - - attr_reader :on_host_maintenance - - attr_reader :preemptible - - def initialize(args = nil) - return if args.nil? - @automatic_restart = args['automaticRestart'] - @on_host_maintenance = args['onHostMaintenance'] - @preemptible = args['preemptible'] - end - end - end - end -end diff --git a/libraries/google/compute/property/instancetemplate_service_accounts.rb b/libraries/google/compute/property/instancetemplate_service_accounts.rb deleted file mode 100644 index f48d2da81..000000000 --- a/libraries/google/compute/property/instancetemplate_service_accounts.rb +++ /dev/null @@ -1,40 +0,0 @@ -# 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 Compute - module Property - class InstanceTemplateServiceaccounts - attr_reader :email - - attr_reader :scopes - - def initialize(args = nil) - return if args.nil? - @email = args['email'] - @scopes = args['scopes'] - end - end - - class InstanceTemplateServiceaccountsArray - def self.parse(value) - return if value.nil? - return InstanceTemplateServiceaccounts.new(value) unless value.is_a?(::Array) - value.map { |v| InstanceTemplateServiceaccounts.new(v) } - end - end - end - end -end diff --git a/libraries/google/compute/property/instancetemplate_source_image_encryption_key.rb b/libraries/google/compute/property/instancetemplate_source_image_encryption_key.rb deleted file mode 100644 index 3e0543c7c..000000000 --- a/libraries/google/compute/property/instancetemplate_source_image_encryption_key.rb +++ /dev/null @@ -1,32 +0,0 @@ -# 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 Compute - module Property - class InstanceTemplateSourceimageencryptionkey - attr_reader :raw_key - - attr_reader :sha256 - - def initialize(args = nil) - return if args.nil? - @raw_key = args['rawKey'] - @sha256 = args['sha256'] - end - end - end - end -end diff --git a/libraries/google/compute/property/instancetemplate_tags.rb b/libraries/google/compute/property/instancetemplate_tags.rb deleted file mode 100644 index 65d7b1a1e..000000000 --- a/libraries/google/compute/property/instancetemplate_tags.rb +++ /dev/null @@ -1,32 +0,0 @@ -# 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 Compute - module Property - class InstanceTemplateTags - attr_reader :fingerprint - - attr_reader :items - - def initialize(args = nil) - return if args.nil? - @fingerprint = args['fingerprint'] - @items = args['items'] - end - end - end - end -end diff --git a/libraries/google/compute/property/router_advertised_ip_ranges.rb b/libraries/google/compute/property/router_advertised_ip_ranges.rb deleted file mode 100644 index 45313e693..000000000 --- a/libraries/google/compute/property/router_advertised_ip_ranges.rb +++ /dev/null @@ -1,40 +0,0 @@ -# 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 Compute - module Property - class RouterAdvertisedipranges - attr_reader :range - - attr_reader :description - - def initialize(args = nil) - return if args.nil? - @range = args['range'] - @description = args['description'] - end - end - - class RouterAdvertisediprangesArray - def self.parse(value) - return if value.nil? - return RouterAdvertisedipranges.new(value) unless value.is_a?(::Array) - value.map { |v| RouterAdvertisedipranges.new(v) } - end - end - end - end -end diff --git a/libraries/google/compute/property/urlmap_path_rules.rb b/libraries/google/compute/property/urlmap_path_rules.rb deleted file mode 100644 index e2c6b2f69..000000000 --- a/libraries/google/compute/property/urlmap_path_rules.rb +++ /dev/null @@ -1,40 +0,0 @@ -# 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 Compute - module Property - class UrlMapPathrules - attr_reader :paths - - attr_reader :service - - def initialize(args = nil) - return if args.nil? - @paths = args['paths'] - @service = args['service'] - end - end - - class UrlMapPathrulesArray - def self.parse(value) - return if value.nil? - return UrlMapPathrules.new(value) unless value.is_a?(::Array) - value.map { |v| UrlMapPathrules.new(v) } - end - end - end - end -end diff --git a/libraries/google/container/property/regionalcluster_horizontal_pod_autoscaling.rb b/libraries/google/container/property/regionalcluster_horizontal_pod_autoscaling.rb deleted file mode 100644 index 499901d34..000000000 --- a/libraries/google/container/property/regionalcluster_horizontal_pod_autoscaling.rb +++ /dev/null @@ -1,29 +0,0 @@ -# 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 RegionalClusterHorizontalpodautoscaling - attr_reader :disabled - - def initialize(args = nil) - return if args.nil? - @disabled = args['disabled'] - end - end - end - end -end diff --git a/libraries/google/container/property/regionalcluster_http_load_balancing.rb b/libraries/google/container/property/regionalcluster_http_load_balancing.rb deleted file mode 100644 index 08b5da8ae..000000000 --- a/libraries/google/container/property/regionalcluster_http_load_balancing.rb +++ /dev/null @@ -1,29 +0,0 @@ -# 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 RegionalClusterHttploadbalancing - attr_reader :disabled - - def initialize(args = nil) - return if args.nil? - @disabled = args['disabled'] - end - end - end - end -end