Class: EcsAutoscalingScheduler::Aws::ApplicationAutoScaling
- Inherits:
-
Object
- Object
- EcsAutoscalingScheduler::Aws::ApplicationAutoScaling
- Defined in:
- lib/ecs_autoscaling_scheduler/aws/application_auto_scaling.rb
Instance Method Summary collapse
- #delete_scheduled_action(cluster_name:, service_name:, scheduled_action_name:) ⇒ Object
- #describe_scheduled_actions(cluster_name:, service_name:) ⇒ Object
-
#initialize(client: ::Aws::ApplicationAutoScaling::Client.new) ⇒ ApplicationAutoScaling
constructor
A new instance of ApplicationAutoScaling.
- #put_scheduled_action(cluster_name:, service_name:, scheduled_action_name:, schedule_datetime:, timezone:, min_capacity:, max_capacity:) ⇒ Object
Constructor Details
#initialize(client: ::Aws::ApplicationAutoScaling::Client.new) ⇒ ApplicationAutoScaling
Returns a new instance of ApplicationAutoScaling.
8 9 10 |
# File 'lib/ecs_autoscaling_scheduler/aws/application_auto_scaling.rb', line 8 def initialize(client: ::Aws::ApplicationAutoScaling::Client.new) @client = client end |
Instance Method Details
#delete_scheduled_action(cluster_name:, service_name:, scheduled_action_name:) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/ecs_autoscaling_scheduler/aws/application_auto_scaling.rb', line 38 def delete_scheduled_action(cluster_name:, service_name:, scheduled_action_name:) client.delete_scheduled_action( { service_namespace: "ecs", scalable_dimension: "ecs:service:DesiredCount", scheduled_action_name: scheduled_action_name, resource_id: resource_id(cluster_name: cluster_name, service_name: service_name), } ) end |
#describe_scheduled_actions(cluster_name:, service_name:) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/ecs_autoscaling_scheduler/aws/application_auto_scaling.rb', line 12 def describe_scheduled_actions(cluster_name:, service_name:) client.describe_scheduled_actions( { service_namespace: "ecs", resource_id: resource_id(cluster_name: cluster_name, service_name: service_name), } ).scheduled_actions end |
#put_scheduled_action(cluster_name:, service_name:, scheduled_action_name:, schedule_datetime:, timezone:, min_capacity:, max_capacity:) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ecs_autoscaling_scheduler/aws/application_auto_scaling.rb', line 21 def put_scheduled_action(cluster_name:, service_name:, scheduled_action_name:, schedule_datetime:, timezone:, min_capacity:, max_capacity:) client.put_scheduled_action( { service_namespace: "ecs", scalable_dimension: "ecs:service:DesiredCount", scheduled_action_name: scheduled_action_name, schedule: "at(#{schedule_datetime.strftime("%FT%T")})", timezone: timezone, scalable_target_action: { min_capacity: min_capacity, max_capacity: max_capacity, }, resource_id: resource_id(cluster_name: cluster_name, service_name: service_name), } ) end |