Skip to content

Commit

Permalink
Merge pull request #615 from inspec/CHEF-7200_1-MAGIC-MODULE-compute_…
Browse files Browse the repository at this point in the history
…v1-RegionAutoscaler

CHEF-7200_1-MAGIC-MODULE-compute_v1-RegionAutoscaler - Resource Implementation
  • Loading branch information
balasubramanian-s authored Apr 24, 2024
2 parents 388a376 + d789379 commit 0f25a34
Show file tree
Hide file tree
Showing 17 changed files with 975 additions and 0 deletions.
173 changes: 173 additions & 0 deletions docs/resources/google_compute_region_autoscaler.md

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions docs/resources/google_compute_region_autoscalers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: About the google_compute_region_autoscalers resource
platform: gcp
---

## Syntax
A `google_compute_region_autoscalers` is used to test a Google RegionAutoscaler resource

## Examples
```
describe google_compute_region_autoscalers(project: 'chef-gcp-inspec', region: ' value_region') do
it { should exist }
end
```

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

See [google_compute_region_autoscaler.md](google_compute_region_autoscaler.md) for more detailed information
* `kinds`: an array of `google_compute_region_autoscaler` kind
* `ids`: an array of `google_compute_region_autoscaler` id
* `creation_timestamps`: an array of `google_compute_region_autoscaler` creation_timestamp
* `names`: an array of `google_compute_region_autoscaler` name
* `descriptions`: an array of `google_compute_region_autoscaler` description
* `targets`: an array of `google_compute_region_autoscaler` target
* `autoscaling_policies`: an array of `google_compute_region_autoscaler` autoscaling_policy
* `zones`: an array of `google_compute_region_autoscaler` zone
* `regions`: an array of `google_compute_region_autoscaler` region
* `self_links`: an array of `google_compute_region_autoscaler` self_link
* `self_link_with_ids`: an array of `google_compute_region_autoscaler` self_link_with_id
* `statuses`: an array of `google_compute_region_autoscaler` status
* `status_details`: an array of `google_compute_region_autoscaler` status_details
* `recommended_sizes`: an array of `google_compute_region_autoscaler` recommended_size
* `scaling_schedule_statuses`: an array of `google_compute_region_autoscaler` scaling_schedule_status

## 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 [Compute Engine API](https://console.cloud.google.com/apis/library/compute.googleapis.com/) is enabled for the current project.
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# 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/compute/property/regionautoscaler_autoscaling_policy_cpu_utilization'
require 'google/compute/property/regionautoscaler_autoscaling_policy_custom_metric_utilizations'
require 'google/compute/property/regionautoscaler_autoscaling_policy_load_balancing_utilization'
require 'google/compute/property/regionautoscaler_autoscaling_policy_scale_down_control'
require 'google/compute/property/regionautoscaler_autoscaling_policy_scale_down_control_max_scaled_down_replicas'
require 'google/compute/property/regionautoscaler_autoscaling_policy_scale_in_control'
require 'google/compute/property/regionautoscaler_autoscaling_policy_scale_in_control_max_scaled_in_replicas'
require 'google/compute/property/regionautoscaler_autoscaling_policy_scaling_schedules'
module GoogleInSpec
module Compute
module Property
class RegionAutoscalerAutoscalingPolicy
attr_reader :min_num_replicas

attr_reader :max_num_replicas

attr_reader :scale_down_control

attr_reader :scale_in_control

attr_reader :cool_down_period_sec

attr_reader :cpu_utilization

attr_reader :custom_metric_utilizations

attr_reader :load_balancing_utilization

attr_reader :mode

attr_reader :scaling_schedules

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@min_num_replicas = args['minNumReplicas']
@max_num_replicas = args['maxNumReplicas']
@scale_down_control = GoogleInSpec::Compute::Property::RegionAutoscalerAutoscalingPolicyScaleDownControl.new(args['scaleDownControl'], to_s)
@scale_in_control = GoogleInSpec::Compute::Property::RegionAutoscalerAutoscalingPolicyScaleInControl.new(args['scaleInControl'], to_s)
@cool_down_period_sec = args['coolDownPeriodSec']
@cpu_utilization = GoogleInSpec::Compute::Property::RegionAutoscalerAutoscalingPolicyCpuUtilization.new(args['cpuUtilization'], to_s)
@custom_metric_utilizations = GoogleInSpec::Compute::Property::RegionAutoscalerAutoscalingPolicyCustomMetricUtilizationsArray.parse(args['customMetricUtilizations'], to_s)
@load_balancing_utilization = GoogleInSpec::Compute::Property::RegionAutoscalerAutoscalingPolicyLoadBalancingUtilization.new(args['loadBalancingUtilization'], to_s)
@mode = args['mode']
@scaling_schedules = GoogleInSpec::Compute::Property::RegionAutoscalerAutoscalingPolicyScalingSchedules.new(args['scalingSchedules'], to_s)
end

def to_s
"#{@parent_identifier} RegionAutoscalerAutoscalingPolicy"
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 Compute
module Property
class RegionAutoscalerAutoscalingPolicyCpuUtilization
attr_reader :utilization_target

attr_reader :predictive_method

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@utilization_target = args['utilizationTarget']
@predictive_method = args['predictiveMethod']
end

def to_s
"#{@parent_identifier} RegionAutoscalerAutoscalingPolicyCpuUtilization"
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 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 Compute
module Property
class RegionAutoscalerAutoscalingPolicyCustomMetricUtilizations
attr_reader :metric

attr_reader :filter

attr_reader :utilization_target

attr_reader :single_instance_assignment

attr_reader :utilization_target_type

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@metric = args['metric']
@filter = args['filter']
@utilization_target = args['utilizationTarget']
@single_instance_assignment = args['singleInstanceAssignment']
@utilization_target_type = args['utilizationTargetType']
end

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

class RegionAutoscalerAutoscalingPolicyCustomMetricUtilizationsArray
def self.parse(value, parent_identifier)
return if value.nil?
return RegionAutoscalerAutoscalingPolicyCustomMetricUtilizations.new(value, parent_identifier) unless value.is_a?(::Array)
value.map { |v| RegionAutoscalerAutoscalingPolicyCustomMetricUtilizations.new(v, parent_identifier) }
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 Compute
module Property
class RegionAutoscalerAutoscalingPolicyLoadBalancingUtilization
attr_reader :utilization_target

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

def to_s
"#{@parent_identifier} RegionAutoscalerAutoscalingPolicyLoadBalancingUtilization"
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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/compute/property/regionautoscaler_autoscaling_policy_scale_down_control_max_scaled_down_replicas'
module GoogleInSpec
module Compute
module Property
class RegionAutoscalerAutoscalingPolicyScaleDownControl
attr_reader :max_scaled_down_replicas

attr_reader :time_window_sec

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@max_scaled_down_replicas = GoogleInSpec::Compute::Property::RegionAutoscalerAutoscalingPolicyScaleDownControlMaxScaledDownReplicas.new(args['maxScaledDownReplicas'], to_s)
@time_window_sec = args['timeWindowSec']
end

def to_s
"#{@parent_identifier} RegionAutoscalerAutoscalingPolicyScaleDownControl"
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 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 Compute
module Property
class RegionAutoscalerAutoscalingPolicyScaleDownControlMaxScaledDownReplicas
attr_reader :fixed

attr_reader :percent

attr_reader :calculated

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

def to_s
"#{@parent_identifier} RegionAutoscalerAutoscalingPolicyScaleDownControlMaxScaledDownReplicas"
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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/compute/property/regionautoscaler_autoscaling_policy_scale_in_control_max_scaled_in_replicas'
module GoogleInSpec
module Compute
module Property
class RegionAutoscalerAutoscalingPolicyScaleInControl
attr_reader :max_scaled_in_replicas

attr_reader :time_window_sec

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@max_scaled_in_replicas = GoogleInSpec::Compute::Property::RegionAutoscalerAutoscalingPolicyScaleInControlMaxScaledInReplicas.new(args['maxScaledInReplicas'], to_s)
@time_window_sec = args['timeWindowSec']
end

def to_s
"#{@parent_identifier} RegionAutoscalerAutoscalingPolicyScaleInControl"
end
end
end
end
end
Loading

0 comments on commit 0f25a34

Please sign in to comment.