Skip to content

Commit

Permalink
update testcases
Browse files Browse the repository at this point in the history
Signed-off-by: balasubramanian-s <balasubramanian.s@progress.com>
  • Loading branch information
balasubramanian-s committed Jul 1, 2024
1 parent ce1771b commit 8450138
Show file tree
Hide file tree
Showing 14 changed files with 187 additions and 180 deletions.
Original file line number Diff line number Diff line change
@@ -1,47 +1,46 @@
+++

title = "google_bigtableadmin_project_instance_cluster Resource"
title = "google_bigtableadmin_cluster Resource"
platform = "gcp"
draft = false
gh_repo = "inspec-gcp"


[menu.inspec]

title = "google_bigtableadmin_project_instance_cluster"
identifier = "inspec/resources/gcp/google_bigtableadmin_project_instance_cluster Resource"
title = "google_bigtableadmin_cluster"
identifier = "inspec/resources/gcp/google_bigtableadmin_cluster Resource"
parent = "inspec/resources/gcp"
+++

Use the `google_bigtableadmin_project_instance_cluster` InSpec audit resource to test the properties of a test a Google ProjectInstanceCluster.
Use the `google_bigtableadmin_cluster` InSpec audit resource to test the properties of a test a Google ProjectInstanceCluster.

## Installation
{{% inspec_gcp_install %}}

## Syntax
A `google_bigtableadmin_project_instance_cluster` is used to test a Google ProjectInstanceCluster resource
A `google_bigtableadmin_cluster` is used to test a Google ProjectInstanceCluster resource

## Examples
```
describe google_bigtableadmin_project_instance_cluster(name: ' value_name') do
describe google_bigtableadmin_cluster(name: 'value_name') do
it { should exist }
its('name') { should cmp 'value_name' }
its('location') { should cmp 'value_location' }
its('state') { should cmp 'value_state' }
its('default_storage_type') { should cmp 'value_defaultstoragetype' }
end
describe google_bigtableadmin_project_instance_cluster(name: "does_not_exit") do
describe google_bigtableadmin_cluster(name: "does_not_exit") do
it { should_not exist }
end
```

## Parameters
Properties that can be accessed from the `google_bigtableadmin_project_instance_cluster` resource:
Properties that can be accessed from the `google_bigtableadmin_cluster` resource:

## Properties
Properties that can be accessed from the `google_bigtableadmin_project_instance_cluster` resource:
Properties that can be accessed from the `google_bigtableadmin_cluster` resource:


* `name`: The unique name of the cluster. Values are of the form `projects/{project}/instances/{instance}/clusters/a-z*`.
Expand Down
64 changes: 64 additions & 0 deletions docs/resources/google_bigtableadmin_clusters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
+++

title = "google_bigtableadmin_clusters Resource"
platform = "gcp"
draft = false
gh_repo = "inspec-gcp"


[menu.inspec]

title = "google_bigtableadmin_clusters"
identifier = "inspec/resources/gcp/google_bigtableadmin_clusters Resource"
parent = "inspec/resources/gcp"
+++

Use the `google_bigtableadmin_clusters` InSpec audit resource to test the properties of a test a Google ProjectInstanceCluster.

## Installation
{{% inspec_gcp_install %}}

## Syntax
A `google_bigtableadmin_clusters` is used to test a Google ProjectInstanceCluster resource

## Examples
```
describe google_bigtableadmin_clusters(parent: ' value_parent') do
it { should exist }
its('names') { should include 'value_name' }
its('locations') { should include 'value_location' }
its('states') { should include 'value_state' }
its('default_storage_types') { should include 'value_defaultstoragetype' }
end
```

## Parameters
Properties that can be accessed from the `google_bigtableadmin_clusters` resource:

See [google_bigtableadmin_cluster.md](google_bigtableadmin_cluster.md) for more detailed information
* `names`: an array of `google_bigtableadmin_cluster` name
* `locations`: an array of `google_bigtableadmin_cluster` location
* `states`: an array of `google_bigtableadmin_cluster` state
* `serve_nodes`: an array of `google_bigtableadmin_cluster` serve_nodes
* `cluster_configs`: an array of `google_bigtableadmin_cluster` cluster_config
* `default_storage_types`: an array of `google_bigtableadmin_cluster` default_storage_type
* `encryption_configs`: an array of `google_bigtableadmin_cluster` encryption_config
## Properties
Properties that can be accessed from the `google_bigtableadmin_clusters` resource:

See [google_bigtableadmin_cluster.md](google_bigtableadmin_cluster.md) for more detailed information
* `names`: an array of `google_bigtableadmin_cluster` name
* `locations`: an array of `google_bigtableadmin_cluster` location
* `states`: an array of `google_bigtableadmin_cluster` state
* `serve_nodes`: an array of `google_bigtableadmin_cluster` serve_nodes
* `cluster_configs`: an array of `google_bigtableadmin_cluster` cluster_config
* `default_storage_types`: an array of `google_bigtableadmin_cluster` default_storage_type
* `encryption_configs`: an array of `google_bigtableadmin_cluster` encryption_config

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

## GCP Permissions

Ensure the [https://bigtableadmin.googleapis.com/](https://console.cloud.google.com/apis/library/bigtableadmin.googleapis.com/) is enabled for the current project.
60 changes: 0 additions & 60 deletions docs/resources/google_bigtableadmin_project_instance_clusters.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@
# CONTRIBUTING.md located at the root of this package.
#
# ----------------------------------------------------------------------------
require 'google/bigtableadmin/property/projectinstancecluster_cluster_config_cluster_autoscaling_config'
require 'google/bigtableadmin/property/projectinstancecluster_cluster_config_cluster_autoscaling_config_autoscaling_limits'
require 'google/bigtableadmin/property/projectinstancecluster_cluster_config_cluster_autoscaling_config_autoscaling_targets'
require 'google/bigtableadmin/property/cluster_cluster_config_cluster_autoscaling_config'
require 'google/bigtableadmin/property/cluster_cluster_config_cluster_autoscaling_config_autoscaling_limits'
require 'google/bigtableadmin/property/cluster_cluster_config_cluster_autoscaling_config_autoscaling_targets'
module GoogleInSpec
module Bigtableadmin
module Property
class ProjectInstanceClusterClusterConfig
class ClusterClusterConfig
attr_reader :cluster_autoscaling_config

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@cluster_autoscaling_config = GoogleInSpec::Bigtableadmin::Property::ProjectInstanceClusterClusterConfigClusterAutoscalingConfig.new(args['clusterAutoscalingConfig'], to_s)
@cluster_autoscaling_config = GoogleInSpec::Bigtableadmin::Property::ClusterClusterConfigClusterAutoscalingConfig.new(args['clusterAutoscalingConfig'], to_s)
end

def to_s
"#{@parent_identifier} ProjectInstanceClusterClusterConfig"
"#{@parent_identifier} ClusterClusterConfig"
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@
# CONTRIBUTING.md located at the root of this package.
#
# ----------------------------------------------------------------------------
require 'google/bigtableadmin/property/projectinstancecluster_cluster_config_cluster_autoscaling_config_autoscaling_limits'
require 'google/bigtableadmin/property/projectinstancecluster_cluster_config_cluster_autoscaling_config_autoscaling_targets'
require 'google/bigtableadmin/property/cluster_cluster_config_cluster_autoscaling_config_autoscaling_limits'
require 'google/bigtableadmin/property/cluster_cluster_config_cluster_autoscaling_config_autoscaling_targets'
module GoogleInSpec
module Bigtableadmin
module Property
class ProjectInstanceClusterClusterConfigClusterAutoscalingConfig
class ClusterClusterConfigClusterAutoscalingConfig
attr_reader :autoscaling_limits

attr_reader :autoscaling_targets

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@autoscaling_limits = GoogleInSpec::Bigtableadmin::Property::ProjectInstanceClusterClusterConfigClusterAutoscalingConfigAutoscalingLimits.new(args['autoscalingLimits'], to_s)
@autoscaling_targets = GoogleInSpec::Bigtableadmin::Property::ProjectInstanceClusterClusterConfigClusterAutoscalingConfigAutoscalingTargets.new(args['autoscalingTargets'], to_s)
@autoscaling_limits = GoogleInSpec::Bigtableadmin::Property::ClusterClusterConfigClusterAutoscalingConfigAutoscalingLimits.new(args['autoscalingLimits'], to_s)
@autoscaling_targets = GoogleInSpec::Bigtableadmin::Property::ClusterClusterConfigClusterAutoscalingConfigAutoscalingTargets.new(args['autoscalingTargets'], to_s)
end

def to_s
"#{@parent_identifier} ProjectInstanceClusterClusterConfigClusterAutoscalingConfig"
"#{@parent_identifier} ClusterClusterConfigClusterAutoscalingConfig"
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
module GoogleInSpec
module Bigtableadmin
module Property
class ProjectInstanceClusterClusterConfigClusterAutoscalingConfigAutoscalingLimits
class ClusterClusterConfigClusterAutoscalingConfigAutoscalingLimits
attr_reader :min_serve_nodes

attr_reader :max_serve_nodes
Expand All @@ -29,7 +29,7 @@ def initialize(args = nil, parent_identifier = nil)
end

def to_s
"#{@parent_identifier} ProjectInstanceClusterClusterConfigClusterAutoscalingConfigAutoscalingLimits"
"#{@parent_identifier} ClusterClusterConfigClusterAutoscalingConfigAutoscalingLimits"
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
module GoogleInSpec
module Bigtableadmin
module Property
class ProjectInstanceClusterClusterConfigClusterAutoscalingConfigAutoscalingTargets
class ClusterClusterConfigClusterAutoscalingConfigAutoscalingTargets
attr_reader :cpu_utilization_percent

attr_reader :storage_utilization_gib_per_node
Expand All @@ -29,7 +29,7 @@ def initialize(args = nil, parent_identifier = nil)
end

def to_s
"#{@parent_identifier} ProjectInstanceClusterClusterConfigClusterAutoscalingConfigAutoscalingTargets"
"#{@parent_identifier} ClusterClusterConfigClusterAutoscalingConfigAutoscalingTargets"
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
module GoogleInSpec
module Bigtableadmin
module Property
class ProjectInstanceClusterEncryptionConfig
class ClusterEncryptionConfig
attr_reader :kms_key_name

def initialize(args = nil, parent_identifier = nil)
Expand All @@ -26,7 +26,7 @@ def initialize(args = nil, parent_identifier = nil)
end

def to_s
"#{@parent_identifier} ProjectInstanceClusterEncryptionConfig"
"#{@parent_identifier} ClusterEncryptionConfig"
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
#
# ----------------------------------------------------------------------------
require 'gcp_backend'
require 'google/bigtableadmin/property/projectinstancecluster_cluster_config'
require 'google/bigtableadmin/property/projectinstancecluster_cluster_config_cluster_autoscaling_config'
require 'google/bigtableadmin/property/projectinstancecluster_cluster_config_cluster_autoscaling_config_autoscaling_limits'
require 'google/bigtableadmin/property/projectinstancecluster_cluster_config_cluster_autoscaling_config_autoscaling_targets'
require 'google/bigtableadmin/property/projectinstancecluster_encryption_config'
require 'google/bigtableadmin/property/cluster_cluster_config'
require 'google/bigtableadmin/property/cluster_cluster_config_cluster_autoscaling_config'
require 'google/bigtableadmin/property/cluster_cluster_config_cluster_autoscaling_config_autoscaling_limits'
require 'google/bigtableadmin/property/cluster_cluster_config_cluster_autoscaling_config_autoscaling_targets'
require 'google/bigtableadmin/property/cluster_encryption_config'

# A provider to manage bigtableadmin resources.
class BigtableadminProjectInstanceCluster < GcpResourceBase
name 'google_bigtableadmin_project_instance_cluster'
name 'google_bigtableadmin_cluster'
desc 'ProjectInstanceCluster'
supports platform: 'gcp'

Expand All @@ -47,26 +47,26 @@ def parse
@location = @fetched['location']
@state = @fetched['state']
@serve_nodes = @fetched['serveNodes']
@cluster_config = GoogleInSpec::Bigtableadmin::Property::ProjectInstanceClusterClusterConfig.new(@fetched['clusterConfig'], to_s)
@cluster_config = GoogleInSpec::Bigtableadmin::Property::ClusterClusterConfig.new(@fetched['clusterConfig'], to_s)
@default_storage_type = @fetched['defaultStorageType']
@encryption_config = GoogleInSpec::Bigtableadmin::Property::ProjectInstanceClusterEncryptionConfig.new(@fetched['encryptionConfig'], to_s)
@encryption_config = GoogleInSpec::Bigtableadmin::Property::ClusterEncryptionConfig.new(@fetched['encryptionConfig'], to_s)
end

def exists?
!@fetched.nil?
end

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

private

def product_url(_ = nil)
'https://bigtableadmin.googleapis.com//v2/'
'https://bigtableadmin.googleapis.com/v2/'
end

def resource_base_url
'{{+name}}'
'{{name}}'
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# ----------------------------------------------------------------------------
require 'gcp_backend'
class BigtableadminProjectInstanceClusters < GcpResourceBase
name 'google_bigtableadmin_project_instance_clusters'
name 'google_bigtableadmin_clusters'
desc 'ProjectInstanceCluster plural resource'
supports platform: 'gcp'

Expand All @@ -36,7 +36,7 @@ class BigtableadminProjectInstanceClusters < GcpResourceBase
def initialize(params = {})
super(params.merge({ use_http_transport: true }))
@params = params
@table = fetch_wrapped_resource('projectInstanceClusters')
@table = fetch_wrapped_resource('clusters')
end

def fetch_wrapped_resource(wrap_path)
Expand Down Expand Up @@ -73,19 +73,19 @@ def transformers
'location' => ->(obj) { [:location, obj['location']] },
'state' => ->(obj) { [:state, obj['state']] },
'serveNodes' => ->(obj) { [:serve_nodes, obj['serveNodes']] },
'clusterConfig' => ->(obj) { [:cluster_config, GoogleInSpec::Bigtableadmin::Property::ProjectInstanceClusterClusterConfig.new(obj['clusterConfig'], to_s)] },
'clusterConfig' => ->(obj) { [:cluster_config, GoogleInSpec::Bigtableadmin::Property::ClusterClusterConfig.new(obj['clusterConfig'], to_s)] },
'defaultStorageType' => ->(obj) { [:default_storage_type, obj['defaultStorageType']] },
'encryptionConfig' => ->(obj) { [:encryption_config, GoogleInSpec::Bigtableadmin::Property::ProjectInstanceClusterEncryptionConfig.new(obj['encryptionConfig'], to_s)] },
'encryptionConfig' => ->(obj) { [:encryption_config, GoogleInSpec::Bigtableadmin::Property::ClusterEncryptionConfig.new(obj['encryptionConfig'], to_s)] },
}
end

private

def product_url(_ = nil)
'https://bigtableadmin.googleapis.com//v2/'
'https://bigtableadmin.googleapis.com/v2/'
end

def resource_base_url
'{{+parent}}/clusters'
'{{parent}}/clusters'
end
end
Loading

0 comments on commit 8450138

Please sign in to comment.