Skip to content

Commit

Permalink
Merge pull request #636 from inspec/CHEF-12475-v2-MAGIC-MODULE-bigtab…
Browse files Browse the repository at this point in the history
…leadmin_v2-Projects__instances__cluster

CHEF-12475-v2-MAGIC-MODULE-bigtableadmin_v2-Projects__instances__cluster - Resource Implementation
  • Loading branch information
balasubramanian-s authored Jul 3, 2024
2 parents c3ba385 + a0e82ac commit 89cacfe
Show file tree
Hide file tree
Showing 14 changed files with 604 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ The following resources are available in the InSpec GCP Profile
| [google_appengine_standard_app_version](docs/resources/google_appengine_standard_app_version.md) | [google_appengine_standard_app_versions](docs/resources/google_appengine_standard_app_versions.md) |
| [google_bigquery_dataset](docs/resources/google_bigquery_dataset.md) | [google_bigquery_datasets](docs/resources/google_bigquery_datasets.md) |
| [google_bigquery_table](docs/resources/google_bigquery_table.md) | [google_bigquery_tables](docs/resources/google_bigquery_tables.md) |
| [google_bigtableadmin_cluster](docs/resources/google_bigtableadmin_cluster.md) | [google_bigtableadmin_clusters](docs/resources/google_bigtableadmin_clusters.md) |
| [google_billing_project_billing_info](docs/resources/google_billing_project_billing_info.md) | No Plural Resource |
| [google_cloud_scheduler_job](docs/resources/google_cloud_scheduler_job.md) | [google_cloud_scheduler_jobs](docs/resources/google_cloud_scheduler_jobs.md) |
| [google_cloudbuild_trigger](docs/resources/google_cloudbuild_trigger.md) | [google_cloudbuild_triggers](docs/resources/google_cloudbuild_triggers.md) |
Expand Down
89 changes: 89 additions & 0 deletions docs/resources/google_bigtableadmin_cluster.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
+++

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


[menu.inspec]

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

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

## Installation
{{% inspec_gcp_install %}}

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

## Examples
```
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_cluster(name: "does_not_exit") do
it { should_not exist }
end
```

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

## Properties
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*`.

* `location`: Immutable. The location where this cluster's nodes and storage reside. For best performance, clients should be located as close as possible to this cluster. Currently only zones are supported, so values should be of the form `projects/{project}/locations/{zone}`.

* `state`: Output only. The current state of the cluster.
Possible values:
* STATE_NOT_KNOWN
* READY
* CREATING
* RESIZING
* DISABLED

* `serve_nodes`: The number of nodes in the cluster. If no value is set, Cloud Bigtable automatically allocates nodes based on your data footprint and optimized for 50% storage utilization.

* `cluster_config`: Configuration for a cluster.

* `cluster_autoscaling_config`: Autoscaling config for a cluster.

* `autoscaling_limits`: Limits for the number of nodes a Cluster can autoscale up/down to.

* `min_serve_nodes`: Required. Minimum number of nodes to scale down to.

* `max_serve_nodes`: Required. Maximum number of nodes to scale up to.

* `autoscaling_targets`: The Autoscaling targets for a Cluster. These determine the recommended nodes.

* `cpu_utilization_percent`: The cpu utilization that the Autoscaler should be trying to achieve. This number is on a scale from 0 (no utilization) to 100 (total utilization), and is limited between 10 and 80, otherwise it will return INVALID_ARGUMENT error.

* `storage_utilization_gib_per_node`: The storage utilization that the Autoscaler should be trying to achieve. This number is limited between 2560 (2.5TiB) and 5120 (5TiB) for a SSD cluster and between 8192 (8TiB) and 16384 (16TiB) for an HDD cluster, otherwise it will return INVALID_ARGUMENT error. If this value is set to 0, it will be treated as if it were set to the default value: 2560 for SSD, 8192 for HDD.

* `default_storage_type`: Immutable. The type of storage used by this cluster to serve its parent instance's tables, unless explicitly overridden.
Possible values:
* STORAGE_TYPE_UNSPECIFIED
* SSD
* HDD

* `encryption_config`: Cloud Key Management Service (Cloud KMS) settings for a CMEK-protected cluster.

* `kms_key_name`: Describes the Cloud KMS encryption key that will be used to protect the destination Bigtable cluster. The requirements for this key are: 1) The Cloud Bigtable service account associated with the project that contains this cluster must be granted the `cloudkms.cryptoKeyEncrypterDecrypter` role on the CMEK key. 2) Only regional keys can be used and the region of the CMEK key must match the region of the cluster. Values are of the form `projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}`


## GCP Permissions

Ensure the [https://bigtableadmin.googleapis.com/](https://console.cloud.google.com/apis/library/bigtableadmin.googleapis.com/) is enabled for the current project.
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 Cluster.

## Installation
{{% inspec_gcp_install %}}

## Syntax
A `google_bigtableadmin_clusters` is used to test a Google Cluster 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.
37 changes: 37 additions & 0 deletions libraries/google/bigtableadmin/property/cluster_cluster_config.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# frozen_string_literal: false

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# 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/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 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::ClusterClusterConfigClusterAutoscalingConfig.new(args['clusterAutoscalingConfig'], to_s)
end

def to_s
"#{@parent_identifier} ClusterClusterConfig"
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# frozen_string_literal: false

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# 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/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 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::ClusterClusterConfigClusterAutoscalingConfigAutoscalingLimits.new(args['autoscalingLimits'], to_s)
@autoscaling_targets = GoogleInSpec::Bigtableadmin::Property::ClusterClusterConfigClusterAutoscalingConfigAutoscalingTargets.new(args['autoscalingTargets'], to_s)
end

def to_s
"#{@parent_identifier} ClusterClusterConfigClusterAutoscalingConfig"
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# frozen_string_literal: false

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# 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 Bigtableadmin
module Property
class ClusterClusterConfigClusterAutoscalingConfigAutoscalingLimits
attr_reader :min_serve_nodes

attr_reader :max_serve_nodes

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@min_serve_nodes = args['minServeNodes']
@max_serve_nodes = args['maxServeNodes']
end

def to_s
"#{@parent_identifier} ClusterClusterConfigClusterAutoscalingConfigAutoscalingLimits"
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# frozen_string_literal: false

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# 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 Bigtableadmin
module Property
class ClusterClusterConfigClusterAutoscalingConfigAutoscalingTargets
attr_reader :cpu_utilization_percent

attr_reader :storage_utilization_gib_per_node

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@cpu_utilization_percent = args['cpuUtilizationPercent']
@storage_utilization_gib_per_node = args['storageUtilizationGibPerNode']
end

def to_s
"#{@parent_identifier} ClusterClusterConfigClusterAutoscalingConfigAutoscalingTargets"
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# frozen_string_literal: false

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# 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 Bigtableadmin
module Property
class ClusterEncryptionConfig
attr_reader :kms_key_name

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} ClusterEncryptionConfig"
end
end
end
end
end
Loading

0 comments on commit 89cacfe

Please sign in to comment.