Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
Reset merge issues
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Levenick <slevenick@google.com>
  • Loading branch information
slevenick committed Feb 25, 2019
1 parent 1f43702 commit e591cf4
Show file tree
Hide file tree
Showing 14 changed files with 130 additions and 91 deletions.
21 changes: 12 additions & 9 deletions libraries/google_bigquery_dataset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
require 'google/bigquery/property/dataset_access'
require 'google/bigquery/property/dataset_dataset_reference'

# A provider to manage Google Cloud BigQuery resources.
# A provider to manage BigQuery resources.
class Dataset < GcpResourceBase
name 'google_bigquery_dataset'
desc 'Dataset'
Expand All @@ -34,17 +34,10 @@ class Dataset < GcpResourceBase
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)
@fetched = @connection.fetch(product_url, resource_base_url, params)
parse unless @fetched.nil?
end

Expand All @@ -70,4 +63,14 @@ def parse_time_string(time_string)
def exists?
!@fetched.nil?
end

private

def product_url
'https://www.googleapis.com/bigquery/v2/'
end

def resource_base_url
'projects/{{project}}/datasets/{{name}}'
end
end
20 changes: 11 additions & 9 deletions libraries/google_bigquery_datasets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@ class Datasets < GcpResourceBase

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
Expand All @@ -47,7 +39,7 @@ def initialize(params = {})

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

# Conversion of string -> object hash to symbol -> object hash that InSpec needs
Expand Down Expand Up @@ -87,4 +79,14 @@ def transformers
def parse_time_string(time_string)
time_string ? Time.parse(time_string) : nil
end

private

def product_url
'https://www.googleapis.com/bigquery/v2/'
end

def resource_base_url
'projects/{{project}}/datasets'
end
end
21 changes: 12 additions & 9 deletions libraries/google_compute_router.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
require 'google/compute/property/router_bgp'
require 'google/compute/property/router_bgp_advertised_ip_ranges'

# A provider to manage Google Compute Engine resources.
# A provider to manage Compute Engine resources.
class Router < GcpResourceBase
name 'google_compute_router'
desc 'Router'
Expand All @@ -30,17 +30,10 @@ class Router < GcpResourceBase
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)
@fetched = @connection.fetch(product_url, resource_base_url, params)
parse unless @fetched.nil?
end

Expand All @@ -62,4 +55,14 @@ def parse_time_string(time_string)
def exists?
!@fetched.nil?
end

private

def product_url
'https://www.googleapis.com/compute/v1/'
end

def resource_base_url
'projects/{{project}}/regions/{{region}}/routers/{{name}}'
end
end
20 changes: 11 additions & 9 deletions libraries/google_compute_routers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ class Routers < GcpResourceBase

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
Expand All @@ -49,7 +41,7 @@ def initialize(params = {})

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

# Conversion of string -> object hash to symbol -> object hash that InSpec needs
Expand Down Expand Up @@ -91,4 +83,14 @@ def transformers
def parse_time_string(time_string)
time_string ? Time.parse(time_string) : nil
end

private

def product_url
'https://www.googleapis.com/compute/v1/'
end

def resource_base_url
'projects/{{project}}/regions/{{region}}/routers'
end
end
21 changes: 12 additions & 9 deletions libraries/google_compute_snapshot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
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.
# A provider to manage Compute Engine resources.
class Snapshot < GcpResourceBase
name 'google_compute_snapshot'
desc 'Snapshot'
Expand All @@ -36,17 +36,10 @@ class Snapshot < GcpResourceBase
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)
@fetched = @connection.fetch(product_url, resource_base_url, params)
parse unless @fetched.nil?
end

Expand Down Expand Up @@ -74,4 +67,14 @@ def parse_time_string(time_string)
def exists?
!@fetched.nil?
end

private

def product_url
'https://www.googleapis.com/compute/v1/'
end

def resource_base_url
'projects/{{project}}/global/snapshots/{{name}}'
end
end
20 changes: 11 additions & 9 deletions libraries/google_compute_snapshots.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@ class Snapshots < GcpResourceBase

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
Expand All @@ -55,7 +47,7 @@ def initialize(params = {})

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

# Conversion of string -> object hash to symbol -> object hash that InSpec needs
Expand Down Expand Up @@ -103,4 +95,14 @@ def transformers
def parse_time_string(time_string)
time_string ? Time.parse(time_string) : nil
end

private

def product_url
'https://www.googleapis.com/compute/v1/'
end

def resource_base_url
'projects/{{project}}/global/snapshots'
end
end
21 changes: 12 additions & 9 deletions libraries/google_compute_ssl_certificate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# ----------------------------------------------------------------------------
require 'gcp_backend'

# A provider to manage Google Compute Engine resources.
# A provider to manage Compute Engine resources.
class SslCertificate < GcpResourceBase
name 'google_compute_ssl_certificate'
desc 'SslCertificate'
Expand All @@ -27,17 +27,10 @@ class SslCertificate < GcpResourceBase
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)
@fetched = @connection.fetch(product_url, resource_base_url, params)
parse unless @fetched.nil?
end

Expand All @@ -58,4 +51,14 @@ def parse_time_string(time_string)
def exists?
!@fetched.nil?
end

private

def product_url
'https://www.googleapis.com/compute/v1/'
end

def resource_base_url
'projects/{{project}}/global/sslCertificates/{{name}}'
end
end
20 changes: 11 additions & 9 deletions libraries/google_compute_ssl_certificates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@ class SslCertificates < GcpResourceBase

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
Expand All @@ -48,7 +40,7 @@ def initialize(params = {})

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

# Conversion of string -> object hash to symbol -> object hash that InSpec needs
Expand Down Expand Up @@ -89,4 +81,14 @@ def transformers
def parse_time_string(time_string)
time_string ? Time.parse(time_string) : nil
end

private

def product_url
'https://www.googleapis.com/compute/v1/'
end

def resource_base_url
'projects/{{project}}/global/sslCertificates'
end
end
20 changes: 11 additions & 9 deletions libraries/google_compute_target_https_proxies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,6 @@ class TargetHttpsProxys < GcpResourceBase

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
Expand All @@ -50,7 +42,7 @@ def initialize(params = {})

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

# Conversion of string -> object hash to symbol -> object hash that InSpec needs
Expand Down Expand Up @@ -93,4 +85,14 @@ def transformers
def parse_time_string(time_string)
time_string ? Time.parse(time_string) : nil
end

private

def product_url
'https://www.googleapis.com/compute/v1/'
end

def resource_base_url
'projects/{{project}}/global/targetHttpsProxies'
end
end
Loading

0 comments on commit e591cf4

Please sign in to comment.