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

Commit

Permalink
Merge pull request #127 from modular-magician/to-s-updates
Browse files Browse the repository at this point in the history
to_s updates
  • Loading branch information
Stuart Paterson authored Mar 20, 2019
2 parents 48ccc3c + ea8b07d commit 0e194a2
Show file tree
Hide file tree
Showing 123 changed files with 843 additions and 248 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Metrics/CyclomaticComplexity:
Metrics/PerceivedComplexity:
Max: 11
Metrics/AbcSize:
Max: 50
Max: 55
Metrics/CyclomaticComplexity:
Max: 15
Metrics/PerceivedComplexity:
Expand Down
3 changes: 1 addition & 2 deletions docs/resources/google_bigquery_dataset.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe google_bigquery_dataset(project: 'chef-gcp-inspec', name: 'inspec_gcp_d
its('friendly_name') { should eq 'A BigQuery dataset test' }
its('location') { should eq 'EU' }
its('description') { should eq 'Test BigQuery dataset description' }
its('name') { should eq 'inspec_gcp_dataset' }
its('default_table_expiration_ms') { should cmp '3600000' }
end
Expand All @@ -34,8 +35,6 @@ end
## Properties
Properties that can be accessed from the `google_bigquery_dataset` resource:

* `name`: Dataset name

* `access`: Access controls on the bucket.

* `domain`: A domain to grant access to. Any users signed in with the domain specified will be granted the specified access
Expand Down
2 changes: 2 additions & 0 deletions docs/resources/google_compute_disk.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ Properties that can be accessed from the `google_compute_disk` resource:

* `users`: Links to the users of the disk (attached instances) in form: project/zones/zone/instances/instance

* `physical_block_size_bytes`: Physical block size of the persistent disk, in bytes. If not present in a request, a default value is used. Currently supported sizes are 4096 and 16384, other sizes may be added in the future. If an unsupported value is requested, the error message will list the supported values for the caller's project.

* `type`: URL of the disk type resource describing which disk type to use to create the disk. Provide this when creating the disk.

* `source_image`: The source image used to create this disk. If the source image is deleted, this field will not be set. To create a disk with one of the public operating system images, specify the image by its family name. For example, specify family/debian-8 to use the latest Debian 8 image: projects/debian-cloud/global/images/family/debian-8 Alternatively, use a specific version of a public operating system image: projects/debian-cloud/global/images/debian-8-jessie-vYYYYMMDD To create a disk with a private image that you created, specify the image name in the following format: global/images/my-private-image You can also specify a private image by its image family, which returns the latest version of the image in that family. Replace the image name with family/family-name: global/images/family/my-private-family
Expand Down
1 change: 1 addition & 0 deletions docs/resources/google_compute_disks.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ See [google_compute_disk.md](google_compute_disk.md) for more detailed informati
* `names`: an array of `google_compute_disk` name
* `size_gbs`: an array of `google_compute_disk` size_gb
* `users`: an array of `google_compute_disk` users
* `physical_block_size_bytes`: an array of `google_compute_disk` physical_block_size_bytes
* `types`: an array of `google_compute_disk` type
* `source_images`: an array of `google_compute_disk` source_image
* `zones`: an array of `google_compute_disk` zone
Expand Down
12 changes: 12 additions & 0 deletions docs/resources/google_container_regional_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@ Properties that can be accessed from the `google_container_regional_cluster` res

* `network`: The name of the Google Compute Engine network to which the cluster is connected. If left unspecified, the default network will be used.

* `private_cluster_config`: Configuration for a private cluster.

* `enablePrivateNodes`: Whether nodes have internal IP addresses only. If enabled, all nodes are given only RFC 1918 private addresses and communicate with the master via private networking.

* `enablePrivateEndpoint`: Whether the master's internal IP address is used as the cluster endpoint.

* `masterIpv4CidrBlock`: The IP range in CIDR notation to use for the hosted master network. This range will be used for assigning internal IP addresses to the master or set of masters, as well as the ILB VIP. This range must not overlap with any other ranges in use within the cluster's network.

* `privateEndpoint`: The internal IP address of this cluster's master endpoint.

* `publicEndpoint`: The external IP address of this cluster's master endpoint.

* `cluster_ipv4_cidr`: The IP address range of the container pods in this cluster, in CIDR notation (e.g. 10.96.0.0/14). Leave blank to have one automatically chosen or specify a /14 block in 10.0.0.0/8.

* `addons_config`: Configurations for the various addons available to run in the cluster.
Expand Down
1 change: 1 addition & 0 deletions docs/resources/google_container_regional_clusters.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ See [google_container_regional_cluster.md](google_container_regional_cluster.md)
* `logging_services`: an array of `google_container_regional_cluster` logging_service
* `monitoring_services`: an array of `google_container_regional_cluster` monitoring_service
* `networks`: an array of `google_container_regional_cluster` network
* `private_cluster_configs`: an array of `google_container_regional_cluster` private_cluster_config
* `cluster_ipv4_cidrs`: an array of `google_container_regional_cluster` cluster_ipv4_cidr
* `addons_configs`: an array of `google_container_regional_cluster` addons_config
* `subnetworks`: an array of `google_container_regional_cluster` subnetwork
Expand Down
4 changes: 4 additions & 0 deletions docs/resources/google_pubsub_subscription.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ Properties that can be accessed from the `google_pubsub_subscription` resource:

* `ack_deadline_seconds`: This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the ack deadline expires and before the message is acknowledged, it is an outstanding message and will not be delivered again during that time (on a best-effort basis). For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call subscriptions.modifyAckDeadline with the corresponding ackId if using pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used. For push delivery, this value is also used to set the request timeout for the call to the push endpoint. If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.

* `message_retention_duration`: How long to retain unacknowledged messages in the subscription's backlog, from the moment a message is published. If retainAckedMessages is true, then this also configures the retention of acknowledged messages, and thus configures how far back in time a subscriptions.seek can be done. Defaults to 7 days. Cannot be more than 7 days (`"604800s"`) or less than 10 minutes (`"600s"`). A duration in seconds with up to nine fractional digits, terminated by 's'. Example: `"600.5s"`.

* `retain_acked_messages`: Indicates whether to retain acknowledged messages. If `true`, then messages are not expunged from the subscription's backlog, even if they are acknowledged, until they fall out of the messageRetentionDuration window.



## GCP Permissions
Expand Down
2 changes: 2 additions & 0 deletions docs/resources/google_pubsub_subscriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ See [google_pubsub_subscription.md](google_pubsub_subscription.md) for more deta
* `labels`: an array of `google_pubsub_subscription` labels
* `push_configs`: an array of `google_pubsub_subscription` push_config
* `ack_deadline_seconds`: an array of `google_pubsub_subscription` ack_deadline_seconds
* `message_retention_durations`: an array of `google_pubsub_subscription` message_retention_duration
* `retain_acked_messages`: an array of `google_pubsub_subscription` retain_acked_messages

## Filter Criteria
This resource supports all of the above properties as filter criteria, which can be used
Expand Down
15 changes: 10 additions & 5 deletions libraries/google/bigquery/property/dataset_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,27 @@ class DatasetAccess

attr_reader :view

def initialize(args = nil)
def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@domain = args['domain']
@group_by_email = args['groupByEmail']
@role = args['role']
@special_group = args['specialGroup']
@user_by_email = args['userByEmail']
@view = GoogleInSpec::BigQuery::Property::DatasetAccessView.new(args['view'])
@view = GoogleInSpec::BigQuery::Property::DatasetAccessView.new(args['view'], to_s)
end

def to_s
"#{@parent_identifier} DatasetAccess"
end
end

class DatasetAccessArray
def self.parse(value)
def self.parse(value, parent_identifier)
return if value.nil?
return DatasetAccess.new(value) unless value.is_a?(::Array)
value.map { |v| DatasetAccess.new(v) }
return DatasetAccess.new(value, parent_identifier) unless value.is_a?(::Array)
value.map { |v| DatasetAccess.new(v, parent_identifier) }
end
end
end
Expand Down
7 changes: 6 additions & 1 deletion libraries/google/bigquery/property/dataset_access_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@ class DatasetAccessView

attr_reader :table_id

def initialize(args = nil)
def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@dataset_id = args['datasetId']
@project_id = args['projectId']
@table_id = args['tableId']
end

def to_s
"#{@parent_identifier} DatasetAccessView"
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@ class DatasetDatasetReference

attr_reader :project_id

def initialize(args = nil)
def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@dataset_id = args['datasetId']
@project_id = args['projectId']
end

def to_s
"#{@parent_identifier} DatasetDatasetReference"
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ module Property
class TableEncryptionConfiguration
attr_reader :kms_key_name

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

def to_s
"#{@parent_identifier} TableEncryptionConfiguration"
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,23 @@ class TableExternalDataConfiguration

attr_reader :bigtable_options

def initialize(args = nil)
def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@autodetect = args['autodetect']
@compression = args['compression']
@ignore_unknown_values = args['ignoreUnknownValues']
@max_bad_records = args['maxBadRecords']
@source_format = args['sourceFormat']
@source_uris = args['sourceUris']
@schema = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationSchema.new(args['schema'])
@google_sheets_options = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationGoogleSheetsOptions.new(args['googleSheetsOptions'])
@csv_options = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationCsvOptions.new(args['csvOptions'])
@bigtable_options = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationBigtableOptions.new(args['bigtableOptions'])
@schema = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationSchema.new(args['schema'], to_s)
@google_sheets_options = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationGoogleSheetsOptions.new(args['googleSheetsOptions'], to_s)
@csv_options = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationCsvOptions.new(args['csvOptions'], to_s)
@bigtable_options = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationBigtableOptions.new(args['bigtableOptions'], to_s)
end

def to_s
"#{@parent_identifier} TableExternalDataConfiguration"
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,16 @@ class TableExternalDataConfigurationBigtableOptions

attr_reader :column_families

def initialize(args = nil)
def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@ignore_unspecified_column_families = args['ignoreUnspecifiedColumnFamilies']
@read_rowkey_as_string = args['readRowkeyAsString']
@column_families = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationBigtableOptionsColumnFamiliesArray.parse(args['columnFamilies'])
@column_families = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationBigtableOptionsColumnFamiliesArray.parse(args['columnFamilies'], to_s)
end

def to_s
"#{@parent_identifier} TableExternalDataConfigurationBigtableOptions"
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,26 @@ class TableExternalDataConfigurationBigtableOptionsColumnFamilies

attr_reader :type

def initialize(args = nil)
def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@columns = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationBigtableOptionsColumnFamiliesColumnsArray.parse(args['columns'])
@parent_identifier = parent_identifier
@columns = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationBigtableOptionsColumnFamiliesColumnsArray.parse(args['columns'], to_s)
@encoding = args['encoding']
@family_id = args['familyId']
@only_read_latest = args['onlyReadLatest']
@type = args['type']
end

def to_s
"#{@parent_identifier} TableExternalDataConfigurationBigtableOptionsColumnFamilies"
end
end

class TableExternalDataConfigurationBigtableOptionsColumnFamiliesArray
def self.parse(value)
def self.parse(value, parent_identifier)
return if value.nil?
return TableExternalDataConfigurationBigtableOptionsColumnFamilies.new(value) unless value.is_a?(::Array)
value.map { |v| TableExternalDataConfigurationBigtableOptionsColumnFamilies.new(v) }
return TableExternalDataConfigurationBigtableOptionsColumnFamilies.new(value, parent_identifier) unless value.is_a?(::Array)
value.map { |v| TableExternalDataConfigurationBigtableOptionsColumnFamilies.new(v, parent_identifier) }
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,26 @@ class TableExternalDataConfigurationBigtableOptionsColumnFamiliesColumns

attr_reader :type

def initialize(args = nil)
def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@encoding = args['encoding']
@field_name = args['fieldName']
@only_read_latest = args['onlyReadLatest']
@qualifier_string = args['qualifierString']
@type = args['type']
end

def to_s
"#{@parent_identifier} TableExternalDataConfigurationBigtableOptionsColumnFamiliesColumns"
end
end

class TableExternalDataConfigurationBigtableOptionsColumnFamiliesColumnsArray
def self.parse(value)
def self.parse(value, parent_identifier)
return if value.nil?
return TableExternalDataConfigurationBigtableOptionsColumnFamiliesColumns.new(value) unless value.is_a?(::Array)
value.map { |v| TableExternalDataConfigurationBigtableOptionsColumnFamiliesColumns.new(v) }
return TableExternalDataConfigurationBigtableOptionsColumnFamiliesColumns.new(value, parent_identifier) unless value.is_a?(::Array)
value.map { |v| TableExternalDataConfigurationBigtableOptionsColumnFamiliesColumns.new(v, parent_identifier) }
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,20 @@ class TableExternalDataConfigurationCsvOptions

attr_reader :skip_leading_rows

def initialize(args = nil)
def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@allow_jagged_rows = args['allowJaggedRows']
@allow_quoted_newlines = args['allowQuotedNewlines']
@encoding = args['encoding']
@field_delimiter = args['fieldDelimiter']
@quote = args['quote']
@skip_leading_rows = args['skipLeadingRows']
end

def to_s
"#{@parent_identifier} TableExternalDataConfigurationCsvOptions"
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ module Property
class TableExternalDataConfigurationGoogleSheetsOptions
attr_reader :skip_leading_rows

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

def to_s
"#{@parent_identifier} TableExternalDataConfigurationGoogleSheetsOptions"
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ module Property
class TableExternalDataConfigurationSchema
attr_reader :fields

def initialize(args = nil)
def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@fields = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationSchemaFieldsArray.parse(args['fields'])
@parent_identifier = parent_identifier
@fields = GoogleInSpec::BigQuery::Property::TableExternalDataConfigurationSchemaFieldsArray.parse(args['fields'], to_s)
end

def to_s
"#{@parent_identifier} TableExternalDataConfigurationSchema"
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,26 @@ class TableExternalDataConfigurationSchemaFields

attr_reader :type

def initialize(args = nil)
def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@description = args['description']
@fields = args['fields']
@mode = args['mode']
@name = args['name']
@type = args['type']
end

def to_s
"#{@parent_identifier} TableExternalDataConfigurationSchemaFields"
end
end

class TableExternalDataConfigurationSchemaFieldsArray
def self.parse(value)
def self.parse(value, parent_identifier)
return if value.nil?
return TableExternalDataConfigurationSchemaFields.new(value) unless value.is_a?(::Array)
value.map { |v| TableExternalDataConfigurationSchemaFields.new(v) }
return TableExternalDataConfigurationSchemaFields.new(value, parent_identifier) unless value.is_a?(::Array)
value.map { |v| TableExternalDataConfigurationSchemaFields.new(v, parent_identifier) }
end
end
end
Expand Down
9 changes: 7 additions & 2 deletions libraries/google/bigquery/property/table_schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ module Property
class TableSchema
attr_reader :fields

def initialize(args = nil)
def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@fields = GoogleInSpec::BigQuery::Property::TableSchemaFieldsArray.parse(args['fields'])
@parent_identifier = parent_identifier
@fields = GoogleInSpec::BigQuery::Property::TableSchemaFieldsArray.parse(args['fields'], to_s)
end

def to_s
"#{@parent_identifier} TableSchema"
end
end
end
Expand Down
Loading

0 comments on commit 0e194a2

Please sign in to comment.