Skip to content

Commit

Permalink
Merge pull request #643 from inspec/CHEF-12474-v3-MAGIC-MODULE-bigtab…
Browse files Browse the repository at this point in the history
…leadmin_v2-Projects__instances__appProfile

CHEF-12474-v3-MAGIC-MODULE-bigtableadmin_v2-Projects__instances__appProfile - Resource Implementation
  • Loading branch information
balasubramanian-s authored Aug 5, 2024
2 parents d53de35 + c26290a commit 6a2f1db
Show file tree
Hide file tree
Showing 11 changed files with 534 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ The following resources are available in the InSpec GCP Profile
| [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_bigtableadmin_instance_app_profile](docs/resources/google_bigtableadmin_instance_app_profile.md) | [google_bigtableadmin_instance_app_profiles](docs/resources/google_bigtableadmin_instance_app_profiles.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_instance_app_profile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
+++

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


[menu.inspec]

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

Use the `google_bigtableadmin_instance_app_profile` InSpec audit resource to test the properties of a test a Google InstanceAppProfile.

## Installation
{{% inspec_gcp_install %}}

## Syntax
A `google_bigtableadmin_instance_app_profile` is used to test a Google InstanceAppProfile resource

## Examples
```
describe google_bigtableadmin_instance_app_profile(name: 'value_name') do
it { should exist }
its('name') { should cmp 'value_name' }
its('etag') { should cmp 'value_etag' }
its('description') { should cmp 'value_description' }
its('priority') { should cmp 'value_priority' }
end
describe google_bigtableadmin_instance_app_profile(name: "does_not_exit") do
it { should_not exist }
end
```

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

## Properties
Properties that can be accessed from the `google_bigtableadmin_instance_app_profile` resource:


* `name`: The unique name of the app profile. Values are of the form `projects/{project}/instances/{instance}/appProfiles/_a-zA-Z0-9*`.

* `etag`: Strongly validated etag for optimistic concurrency control. Preserve the value returned from `GetAppProfile` when calling `UpdateAppProfile` to fail the request if there has been a modification in the mean time. The `update_mask` of the request need not include `etag` for this protection to apply. See [Wikipedia](https://en.wikipedia.org/wiki/HTTP_ETag) and [RFC 7232](https://tools.ietf.org/html/rfc7232#section-2.3) for more details.

* `description`: Long form description of the use case for this AppProfile.

* `multi_cluster_routing_use_any`: Read/write requests are routed to the nearest cluster in the instance, and will fail over to the nearest cluster that is available in the event of transient errors or delays. Clusters in a region are considered equidistant. Choosing this option sacrifices read-your-writes consistency to improve availability.

* `cluster_ids`: The set of clusters to route to. The order is ignored; clusters will be tried in order of distance. If left empty, all clusters are eligible.

* `single_cluster_routing`: Unconditionally routes all read/write requests to a specific cluster. This option preserves read-your-writes consistency but does not improve availability.

* `cluster_id`: The cluster to which read/write requests should be routed.

* `allow_transactional_writes`: Whether or not `CheckAndMutateRow` and `ReadModifyWriteRow` requests are allowed by this app profile. It is unsafe to send these requests to the same table/row/column in multiple clusters.

* `priority`: This field has been deprecated in favor of `standard_isolation.priority`. If you set this field, `standard_isolation.priority` will be set instead. The priority of requests sent using this app profile.
Possible values:
* PRIORITY_UNSPECIFIED
* PRIORITY_LOW
* PRIORITY_MEDIUM
* PRIORITY_HIGH

* `standard_isolation`: Standard options for isolating this app profile's traffic from other use cases.

* `priority`: The priority of requests sent using this app profile.
Possible values:
* PRIORITY_UNSPECIFIED
* PRIORITY_LOW
* PRIORITY_MEDIUM
* PRIORITY_HIGH

* `data_boost_isolation_read_only`: Data Boost is a serverless compute capability that lets you run high-throughput read jobs and queries on your Bigtable data, without impacting the performance of the clusters that handle your application traffic. Data Boost supports read-only use cases with single-cluster routing.

* `compute_billing_owner`: The Compute Billing Owner for this Data Boost App Profile.
Possible values:
* COMPUTE_BILLING_OWNER_UNSPECIFIED
* HOST_PAYS


## GCP Permissions

Ensure the [https://bigtableadmin.googleapis.com/](https://console.cloud.google.com/apis/library/bigtableadmin.googleapis.com/) is enabled for the current project.
63 changes: 63 additions & 0 deletions docs/resources/google_bigtableadmin_instance_app_profiles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
+++

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


[menu.inspec]

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

Use the `google_bigtableadmin_instance_app_profiles` InSpec audit resource to test the properties of a test a Google InstanceAppProfile.

## Installation
{{% inspec_gcp_install %}}

## Syntax
A `google_bigtableadmin_instance_app_profiles` is used to test a Google InstanceAppProfile resource

## Examples
```
describe google_bigtableadmin_instance_app_profiles(parent: ' value_parent') do
it { should exist }
its('names') { should include 'value_name' }
end
```

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

See [google_bigtableadmin_instance_app_profile.md](google_bigtableadmin_instance_app_profile.md) for more detailed information
* `names`: an array of `google_bigtableadmin_instance_app_profile` name
* `etags`: an array of `google_bigtableadmin_instance_app_profile` etag
* `descriptions`: an array of `google_bigtableadmin_instance_app_profile` description
* `multi_cluster_routing_use_anies`: an array of `google_bigtableadmin_instance_app_profile` multi_cluster_routing_use_any
* `single_cluster_routings`: an array of `google_bigtableadmin_instance_app_profile` single_cluster_routing
* `priorities`: an array of `google_bigtableadmin_instance_app_profile` priority
* `standard_isolations`: an array of `google_bigtableadmin_instance_app_profile` standard_isolation
* `data_boost_isolation_read_onlies`: an array of `google_bigtableadmin_instance_app_profile` data_boost_isolation_read_only
## Properties
Properties that can be accessed from the `google_bigtableadmin_instance_app_profiles` resource:

See [google_bigtableadmin_instance_app_profile.md](google_bigtableadmin_instance_app_profile.md) for more detailed information
* `names`: an array of `google_bigtableadmin_instance_app_profile` name
* `etags`: an array of `google_bigtableadmin_instance_app_profile` etag
* `descriptions`: an array of `google_bigtableadmin_instance_app_profile` description
* `multi_cluster_routing_use_anies`: an array of `google_bigtableadmin_instance_app_profile` multi_cluster_routing_use_any
* `single_cluster_routings`: an array of `google_bigtableadmin_instance_app_profile` single_cluster_routing
* `priorities`: an array of `google_bigtableadmin_instance_app_profile` priority
* `standard_isolations`: an array of `google_bigtableadmin_instance_app_profile` standard_isolation
* `data_boost_isolation_read_onlies`: an array of `google_bigtableadmin_instance_app_profile` data_boost_isolation_read_only

## 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.
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 InstanceAppProfileDataBoostIsolationReadOnly
attr_reader :compute_billing_owner

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

def to_s
"#{@parent_identifier} InstanceAppProfileDataBoostIsolationReadOnly"
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 InstanceAppProfileMultiClusterRoutingUseAny
attr_reader :cluster_ids

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

def to_s
"#{@parent_identifier} InstanceAppProfileMultiClusterRoutingUseAny"
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 InstanceAppProfileSingleClusterRouting
attr_reader :cluster_id

attr_reader :allow_transactional_writes

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@cluster_id = args['clusterId']
@allow_transactional_writes = args['allowTransactionalWrites']
end

def to_s
"#{@parent_identifier} InstanceAppProfileSingleClusterRouting"
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 InstanceAppProfileStandardIsolation
attr_reader :priority

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

def to_s
"#{@parent_identifier} InstanceAppProfileStandardIsolation"
end
end
end
end
end
73 changes: 73 additions & 0 deletions libraries/google_bigtableadmin_instance_app_profile.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# 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 'gcp_backend'
require 'google/bigtableadmin/property/instanceappprofile_data_boost_isolation_read_only'
require 'google/bigtableadmin/property/instanceappprofile_multi_cluster_routing_use_any'
require 'google/bigtableadmin/property/instanceappprofile_single_cluster_routing'
require 'google/bigtableadmin/property/instanceappprofile_standard_isolation'

# A provider to manage bigtableadmin resources.
class BigtableadminInstanceAppProfile < GcpResourceBase
name 'google_bigtableadmin_instance_app_profile'
desc 'InstanceAppProfile'
supports platform: 'gcp'

attr_reader :params
attr_reader :name
attr_reader :etag
attr_reader :description
attr_reader :multi_cluster_routing_use_any
attr_reader :single_cluster_routing
attr_reader :priority
attr_reader :standard_isolation
attr_reader :data_boost_isolation_read_only

def initialize(params)
super(params.merge({ use_http_transport: true }))
@params = params
@fetched = @connection.fetch(product_url(params[:beta]), resource_base_url, params, 'Get')
parse unless @fetched.nil?
end

def parse
@name = @fetched['name']
@etag = @fetched['etag']
@description = @fetched['description']
@multi_cluster_routing_use_any = GoogleInSpec::Bigtableadmin::Property::InstanceAppProfileMultiClusterRoutingUseAny.new(@fetched['multiClusterRoutingUseAny'], to_s)
@single_cluster_routing = GoogleInSpec::Bigtableadmin::Property::InstanceAppProfileSingleClusterRouting.new(@fetched['singleClusterRouting'], to_s)
@priority = @fetched['priority']
@standard_isolation = GoogleInSpec::Bigtableadmin::Property::InstanceAppProfileStandardIsolation.new(@fetched['standardIsolation'], to_s)
@data_boost_isolation_read_only = GoogleInSpec::Bigtableadmin::Property::InstanceAppProfileDataBoostIsolationReadOnly.new(@fetched['dataBoostIsolationReadOnly'], to_s)
end

def exists?
!@fetched.nil?
end

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

private

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

def resource_base_url
'{{name}}'
end
end
Loading

0 comments on commit 6a2f1db

Please sign in to comment.