Class: Google::Apis::ComputeV1::AutoscalingPolicy

Inherits:
Object
  • Object
show all
Includes:
Google::Apis::Core::Hashable, Google::Apis::Core::JsonObjectSupport
Defined in:
lib/google/apis/compute_v1/classes.rb,
lib/google/apis/compute_v1/representations.rb,
lib/google/apis/compute_v1/representations.rb

Overview

Cloud Autoscaler policy.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ AutoscalingPolicy

Returns a new instance of AutoscalingPolicy.



2481
2482
2483
# File 'lib/google/apis/compute_v1/classes.rb', line 2481

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#cool_down_period_secFixnum

The number of seconds that your application takes to initialize on a VM instance. This is referred to as the initialization period. Specifying an accurate initialization period improves autoscaler decisions. For example, when scaling out, the autoscaler ignores data from VMs that are still initializing because those VMs might not yet represent normal usage of your application. The default initialization period is 60 seconds. Initialization periods might vary because of numerous factors. We recommend that you test how long your application takes to initialize. To do this, create a VM and time your application's startup process. Corresponds to the JSON property coolDownPeriodSec

Returns:

  • (Fixnum)


2426
2427
2428
# File 'lib/google/apis/compute_v1/classes.rb', line 2426

def cool_down_period_sec
  @cool_down_period_sec
end

#cpu_utilizationGoogle::Apis::ComputeV1::AutoscalingPolicyCpuUtilization

CPU utilization policy. Corresponds to the JSON property cpuUtilization



2431
2432
2433
# File 'lib/google/apis/compute_v1/classes.rb', line 2431

def cpu_utilization
  @cpu_utilization
end

#custom_metric_utilizationsArray<Google::Apis::ComputeV1::AutoscalingPolicyCustomMetricUtilization>

Configuration parameters of autoscaling based on a custom metric. Corresponds to the JSON property customMetricUtilizations



2436
2437
2438
# File 'lib/google/apis/compute_v1/classes.rb', line 2436

def custom_metric_utilizations
  @custom_metric_utilizations
end

#load_balancing_utilizationGoogle::Apis::ComputeV1::AutoscalingPolicyLoadBalancingUtilization

Configuration parameters of autoscaling based on load balancing. Corresponds to the JSON property loadBalancingUtilization



2441
2442
2443
# File 'lib/google/apis/compute_v1/classes.rb', line 2441

def load_balancing_utilization
  @load_balancing_utilization
end

#max_num_replicasFixnum

The maximum number of instances that the autoscaler can scale out to. This is required when creating or updating an autoscaler. The maximum number of replicas must not be lower than minimal number of replicas. Corresponds to the JSON property maxNumReplicas

Returns:

  • (Fixnum)


2448
2449
2450
# File 'lib/google/apis/compute_v1/classes.rb', line 2448

def max_num_replicas
  @max_num_replicas
end

#min_num_replicasFixnum

The minimum number of replicas that the autoscaler can scale in to. This cannot be less than 0. If not provided, autoscaler chooses a default value depending on maximum number of instances allowed. Corresponds to the JSON property minNumReplicas

Returns:

  • (Fixnum)


2455
2456
2457
# File 'lib/google/apis/compute_v1/classes.rb', line 2455

def min_num_replicas
  @min_num_replicas
end

#modeString

Defines the operating mode for this policy. The following modes are available:

  • OFF: Disables the autoscaler but maintains its configuration. - ONLY_SCALE_OUT: Restricts the autoscaler to add VM instances only. - ON: Enables all autoscaler activities according to its policy. For more information, see "Turning off or restricting an autoscaler" Corresponds to the JSON property mode

Returns:

  • (String)


2464
2465
2466
# File 'lib/google/apis/compute_v1/classes.rb', line 2464

def mode
  @mode
end

#scale_in_controlGoogle::Apis::ComputeV1::AutoscalingPolicyScaleInControl

Configuration that allows for slower scale in so that even if Autoscaler recommends an abrupt scale in of a MIG, it will be throttled as specified by the parameters below. Corresponds to the JSON property scaleInControl



2471
2472
2473
# File 'lib/google/apis/compute_v1/classes.rb', line 2471

def scale_in_control
  @scale_in_control
end

#scaling_schedulesHash<String,Google::Apis::ComputeV1::AutoscalingPolicyScalingSchedule>

Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler, and they can overlap. During overlapping periods the greatest min_required_replicas of all scaling schedules is applied. Up to 128 scaling schedules are allowed. Corresponds to the JSON property scalingSchedules



2479
2480
2481
# File 'lib/google/apis/compute_v1/classes.rb', line 2479

def scaling_schedules
  @scaling_schedules
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
# File 'lib/google/apis/compute_v1/classes.rb', line 2486

def update!(**args)
  @cool_down_period_sec = args[:cool_down_period_sec] if args.key?(:cool_down_period_sec)
  @cpu_utilization = args[:cpu_utilization] if args.key?(:cpu_utilization)
  @custom_metric_utilizations = args[:custom_metric_utilizations] if args.key?(:custom_metric_utilizations)
  @load_balancing_utilization = args[:load_balancing_utilization] if args.key?(:load_balancing_utilization)
  @max_num_replicas = args[:max_num_replicas] if args.key?(:max_num_replicas)
  @min_num_replicas = args[:min_num_replicas] if args.key?(:min_num_replicas)
  @mode = args[:mode] if args.key?(:mode)
  @scale_in_control = args[:scale_in_control] if args.key?(:scale_in_control)
  @scaling_schedules = args[:scaling_schedules] if args.key?(:scaling_schedules)
end