#[non_exhaustive]pub struct AutoscalingPolicy {
pub cool_down_period_sec: Option<i32>,
pub cpu_utilization: Option<AutoscalingPolicyCpuUtilization>,
pub custom_metric_utilizations: Vec<AutoscalingPolicyCustomMetricUtilization>,
pub load_balancing_utilization: Option<AutoscalingPolicyLoadBalancingUtilization>,
pub max_num_replicas: Option<i32>,
pub min_num_replicas: Option<i32>,
pub mode: Option<Mode>,
pub scale_in_control: Option<AutoscalingPolicyScaleInControl>,
pub scaling_schedules: HashMap<String, AutoscalingPolicyScalingSchedule>,
/* private fields */
}autoscalers or region-autoscalers only.Expand description
Cloud Autoscaler policy.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.cool_down_period_sec: Option<i32>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.
cpu_utilization: Option<AutoscalingPolicyCpuUtilization>Defines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group.
custom_metric_utilizations: Vec<AutoscalingPolicyCustomMetricUtilization>Configuration parameters of autoscaling based on a custom metric.
load_balancing_utilization: Option<AutoscalingPolicyLoadBalancingUtilization>Configuration parameters of autoscaling based on load balancer.
max_num_replicas: Option<i32>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.
min_num_replicas: Option<i32>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.
mode: Option<Mode>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”
scale_in_control: Option<AutoscalingPolicyScaleInControl>§scaling_schedules: HashMap<String, 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.
Implementations§
Source§impl AutoscalingPolicy
impl AutoscalingPolicy
pub fn new() -> Self
Sourcepub fn set_cool_down_period_sec<T>(self, v: T) -> Self
pub fn set_cool_down_period_sec<T>(self, v: T) -> Self
Sets the value of cool_down_period_sec.
§Example
let x = AutoscalingPolicy::new().set_cool_down_period_sec(42);Sourcepub fn set_or_clear_cool_down_period_sec<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_cool_down_period_sec<T>(self, v: Option<T>) -> Self
Sets or clears the value of cool_down_period_sec.
§Example
let x = AutoscalingPolicy::new().set_or_clear_cool_down_period_sec(Some(42));
let x = AutoscalingPolicy::new().set_or_clear_cool_down_period_sec(None::<i32>);Sourcepub fn set_cpu_utilization<T>(self, v: T) -> Selfwhere
T: Into<AutoscalingPolicyCpuUtilization>,
pub fn set_cpu_utilization<T>(self, v: T) -> Selfwhere
T: Into<AutoscalingPolicyCpuUtilization>,
Sets the value of cpu_utilization.
§Example
use google_cloud_compute_v1::model::AutoscalingPolicyCpuUtilization;
let x = AutoscalingPolicy::new().set_cpu_utilization(AutoscalingPolicyCpuUtilization::default()/* use setters */);Sourcepub fn set_or_clear_cpu_utilization<T>(self, v: Option<T>) -> Selfwhere
T: Into<AutoscalingPolicyCpuUtilization>,
pub fn set_or_clear_cpu_utilization<T>(self, v: Option<T>) -> Selfwhere
T: Into<AutoscalingPolicyCpuUtilization>,
Sets or clears the value of cpu_utilization.
§Example
use google_cloud_compute_v1::model::AutoscalingPolicyCpuUtilization;
let x = AutoscalingPolicy::new().set_or_clear_cpu_utilization(Some(AutoscalingPolicyCpuUtilization::default()/* use setters */));
let x = AutoscalingPolicy::new().set_or_clear_cpu_utilization(None::<AutoscalingPolicyCpuUtilization>);Sourcepub fn set_custom_metric_utilizations<T, V>(self, v: T) -> Self
pub fn set_custom_metric_utilizations<T, V>(self, v: T) -> Self
Sets the value of custom_metric_utilizations.
§Example
use google_cloud_compute_v1::model::AutoscalingPolicyCustomMetricUtilization;
let x = AutoscalingPolicy::new()
.set_custom_metric_utilizations([
AutoscalingPolicyCustomMetricUtilization::default()/* use setters */,
AutoscalingPolicyCustomMetricUtilization::default()/* use (different) setters */,
]);Sourcepub fn set_load_balancing_utilization<T>(self, v: T) -> Selfwhere
T: Into<AutoscalingPolicyLoadBalancingUtilization>,
pub fn set_load_balancing_utilization<T>(self, v: T) -> Selfwhere
T: Into<AutoscalingPolicyLoadBalancingUtilization>,
Sets the value of load_balancing_utilization.
§Example
use google_cloud_compute_v1::model::AutoscalingPolicyLoadBalancingUtilization;
let x = AutoscalingPolicy::new().set_load_balancing_utilization(AutoscalingPolicyLoadBalancingUtilization::default()/* use setters */);Sourcepub fn set_or_clear_load_balancing_utilization<T>(self, v: Option<T>) -> Selfwhere
T: Into<AutoscalingPolicyLoadBalancingUtilization>,
pub fn set_or_clear_load_balancing_utilization<T>(self, v: Option<T>) -> Selfwhere
T: Into<AutoscalingPolicyLoadBalancingUtilization>,
Sets or clears the value of load_balancing_utilization.
§Example
use google_cloud_compute_v1::model::AutoscalingPolicyLoadBalancingUtilization;
let x = AutoscalingPolicy::new().set_or_clear_load_balancing_utilization(Some(AutoscalingPolicyLoadBalancingUtilization::default()/* use setters */));
let x = AutoscalingPolicy::new().set_or_clear_load_balancing_utilization(None::<AutoscalingPolicyLoadBalancingUtilization>);Sourcepub fn set_max_num_replicas<T>(self, v: T) -> Self
pub fn set_max_num_replicas<T>(self, v: T) -> Self
Sets the value of max_num_replicas.
§Example
let x = AutoscalingPolicy::new().set_max_num_replicas(42);Sourcepub fn set_or_clear_max_num_replicas<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_max_num_replicas<T>(self, v: Option<T>) -> Self
Sets or clears the value of max_num_replicas.
§Example
let x = AutoscalingPolicy::new().set_or_clear_max_num_replicas(Some(42));
let x = AutoscalingPolicy::new().set_or_clear_max_num_replicas(None::<i32>);Sourcepub fn set_min_num_replicas<T>(self, v: T) -> Self
pub fn set_min_num_replicas<T>(self, v: T) -> Self
Sets the value of min_num_replicas.
§Example
let x = AutoscalingPolicy::new().set_min_num_replicas(42);Sourcepub fn set_or_clear_min_num_replicas<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_min_num_replicas<T>(self, v: Option<T>) -> Self
Sets or clears the value of min_num_replicas.
§Example
let x = AutoscalingPolicy::new().set_or_clear_min_num_replicas(Some(42));
let x = AutoscalingPolicy::new().set_or_clear_min_num_replicas(None::<i32>);Sourcepub fn set_or_clear_mode<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_mode<T>(self, v: Option<T>) -> Self
Sets or clears the value of mode.
§Example
use google_cloud_compute_v1::model::autoscaling_policy::Mode;
let x0 = AutoscalingPolicy::new().set_or_clear_mode(Some(Mode::On));
let x1 = AutoscalingPolicy::new().set_or_clear_mode(Some(Mode::OnlyScaleOut));
let x2 = AutoscalingPolicy::new().set_or_clear_mode(Some(Mode::OnlyUp));
let x_none = AutoscalingPolicy::new().set_or_clear_mode(None::<Mode>);Sourcepub fn set_scale_in_control<T>(self, v: T) -> Selfwhere
T: Into<AutoscalingPolicyScaleInControl>,
pub fn set_scale_in_control<T>(self, v: T) -> Selfwhere
T: Into<AutoscalingPolicyScaleInControl>,
Sets the value of scale_in_control.
§Example
use google_cloud_compute_v1::model::AutoscalingPolicyScaleInControl;
let x = AutoscalingPolicy::new().set_scale_in_control(AutoscalingPolicyScaleInControl::default()/* use setters */);Sourcepub fn set_or_clear_scale_in_control<T>(self, v: Option<T>) -> Selfwhere
T: Into<AutoscalingPolicyScaleInControl>,
pub fn set_or_clear_scale_in_control<T>(self, v: Option<T>) -> Selfwhere
T: Into<AutoscalingPolicyScaleInControl>,
Sets or clears the value of scale_in_control.
§Example
use google_cloud_compute_v1::model::AutoscalingPolicyScaleInControl;
let x = AutoscalingPolicy::new().set_or_clear_scale_in_control(Some(AutoscalingPolicyScaleInControl::default()/* use setters */));
let x = AutoscalingPolicy::new().set_or_clear_scale_in_control(None::<AutoscalingPolicyScaleInControl>);Sourcepub fn set_scaling_schedules<T, K, V>(self, v: T) -> Self
pub fn set_scaling_schedules<T, K, V>(self, v: T) -> Self
Sets the value of scaling_schedules.
§Example
use google_cloud_compute_v1::model::AutoscalingPolicyScalingSchedule;
let x = AutoscalingPolicy::new().set_scaling_schedules([
("key0", AutoscalingPolicyScalingSchedule::default()/* use setters */),
("key1", AutoscalingPolicyScalingSchedule::default()/* use (different) setters */),
]);Trait Implementations§
Source§impl Clone for AutoscalingPolicy
impl Clone for AutoscalingPolicy
Source§fn clone(&self) -> AutoscalingPolicy
fn clone(&self) -> AutoscalingPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more