Class: AWSCDK::Autoscaling::ScheduledActionProps

Inherits:
BasicScheduledActionProps
  • Object
show all
Defined in:
autoscaling/scheduled_action_props.rb

Overview

Properties for a scheduled action on an AutoScalingGroup.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schedule:, desired_capacity: nil, end_time: nil, max_capacity: nil, min_capacity: nil, start_time: nil, time_zone: nil, auto_scaling_group:) ⇒ ScheduledActionProps

Returns a new instance of ScheduledActionProps.

Parameters:

  • schedule (AWSCDK::Autoscaling::Schedule)

    When to perform this action.

  • desired_capacity (Numeric, nil) (defaults to: nil)

    The new desired capacity.

  • end_time (DateTime, nil) (defaults to: nil)

    When this scheduled action expires.

  • max_capacity (Numeric, nil) (defaults to: nil)

    The new maximum capacity.

  • min_capacity (Numeric, nil) (defaults to: nil)

    The new minimum capacity.

  • start_time (DateTime, nil) (defaults to: nil)

    When this scheduled action becomes active.

  • time_zone (String, nil) (defaults to: nil)

    Specifies the time zone for a cron expression.

  • auto_scaling_group (AWSCDK::Interfaces::AWSAutoscaling::IAutoScalingGroupRef)

    The AutoScalingGroup to apply the scheduled actions to.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'autoscaling/scheduled_action_props.rb', line 15

def initialize(schedule:, desired_capacity: nil, end_time: nil, max_capacity: nil, min_capacity: nil, start_time: nil, time_zone: nil, auto_scaling_group:)
  @schedule = schedule
  Jsii::Type.check_type(@schedule, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuU2NoZWR1bGUifQ==")), "schedule")
  @desired_capacity = desired_capacity
  Jsii::Type.check_type(@desired_capacity, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "desiredCapacity") unless @desired_capacity.nil?
  @end_time = end_time
  Jsii::Type.check_type(@end_time, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJkYXRlIn0=")), "endTime") unless @end_time.nil?
  @max_capacity = max_capacity
  Jsii::Type.check_type(@max_capacity, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxCapacity") unless @max_capacity.nil?
  @min_capacity = min_capacity
  Jsii::Type.check_type(@min_capacity, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "minCapacity") unless @min_capacity.nil?
  @start_time = start_time
  Jsii::Type.check_type(@start_time, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJkYXRlIn0=")), "startTime") unless @start_time.nil?
  @time_zone = time_zone
  Jsii::Type.check_type(@time_zone, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "timeZone") unless @time_zone.nil?
  @auto_scaling_group = auto_scaling_group
  Jsii::Type.check_type(@auto_scaling_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19hdXRvc2NhbGluZy5JQXV0b1NjYWxpbmdHcm91cFJlZiJ9")), "autoScalingGroup")
end

Instance Attribute Details

#auto_scaling_groupAWSCDK::Interfaces::AWSAutoscaling::IAutoScalingGroupRef (readonly)

The AutoScalingGroup to apply the scheduled actions to.



97
98
99
# File 'autoscaling/scheduled_action_props.rb', line 97

def auto_scaling_group
  @auto_scaling_group
end

#desired_capacityNumeric? (readonly)

Note:

Default: - No new desired capacity.

The new desired capacity.

At the scheduled time, set the desired capacity to the given capacity.

At least one of maxCapacity, minCapacity, or desiredCapacity must be supplied.

Returns:

  • (Numeric, nil)


50
51
52
# File 'autoscaling/scheduled_action_props.rb', line 50

def desired_capacity
  @desired_capacity
end

#end_timeDateTime? (readonly)

Note:

Default: - The rule never expires.

When this scheduled action expires.

Warning! You should not set this field! After the scheduled end time, the AutoScaling service will delete the ScheduledAction without CloudFormation's knowledge, and subsequent stack deployments that try to modify or delete this ScheduledAction will fail.

Returns:

  • (DateTime, nil)


59
60
61
# File 'autoscaling/scheduled_action_props.rb', line 59

def end_time
  @end_time
end

#max_capacityNumeric? (readonly)

Note:

Default: - No new maximum capacity.

The new maximum capacity.

At the scheduled time, set the maximum capacity to the given capacity.

At least one of maxCapacity, minCapacity, or desiredCapacity must be supplied.

Returns:

  • (Numeric, nil)


68
69
70
# File 'autoscaling/scheduled_action_props.rb', line 68

def max_capacity
  @max_capacity
end

#min_capacityNumeric? (readonly)

Note:

Default: - No new minimum capacity.

The new minimum capacity.

At the scheduled time, set the minimum capacity to the given capacity.

At least one of maxCapacity, minCapacity, or desiredCapacity must be supplied.

Returns:

  • (Numeric, nil)


77
78
79
# File 'autoscaling/scheduled_action_props.rb', line 77

def min_capacity
  @min_capacity
end

#scheduleAWSCDK::Autoscaling::Schedule (readonly)

When to perform this action.

Supports cron expressions.

For more information about cron expressions, see https://en.wikipedia.org/wiki/Cron.



41
42
43
# File 'autoscaling/scheduled_action_props.rb', line 41

def schedule
  @schedule
end

#start_timeDateTime? (readonly)

Note:

Default: - The rule is activate immediately.

When this scheduled action becomes active.

Returns:

  • (DateTime, nil)


82
83
84
# File 'autoscaling/scheduled_action_props.rb', line 82

def start_time
  @start_time
end

#time_zoneString? (readonly)

Note:

Default: - UTC

Specifies the time zone for a cron expression.

If a time zone is not provided, UTC is used by default.

Valid values are the canonical names of the IANA time zones, derived from the IANA Time Zone Database (such as Etc/GMT+9 or Pacific/Tahiti).

For more information, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.

Returns:

  • (String, nil)


93
94
95
# File 'autoscaling/scheduled_action_props.rb', line 93

def time_zone
  @time_zone
end

Class Method Details

.jsii_propertiesObject



99
100
101
102
103
104
105
106
107
108
109
110
# File 'autoscaling/scheduled_action_props.rb', line 99

def self.jsii_properties
  {
    :schedule => "schedule",
    :desired_capacity => "desiredCapacity",
    :end_time => "endTime",
    :max_capacity => "maxCapacity",
    :min_capacity => "minCapacity",
    :start_time => "startTime",
    :time_zone => "timeZone",
    :auto_scaling_group => "autoScalingGroup",
  }
end

Instance Method Details

#to_jsiiObject



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'autoscaling/scheduled_action_props.rb', line 112

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "schedule" => @schedule,
    "desiredCapacity" => @desired_capacity,
    "endTime" => @end_time,
    "maxCapacity" => @max_capacity,
    "minCapacity" => @min_capacity,
    "startTime" => @start_time,
    "timeZone" => @time_zone,
    "autoScalingGroup" => @auto_scaling_group,
  })
  result.compact
end