Class: AWSCDK::ApplicationAutoScaling::BaseScalableAttribute
- Inherits:
-
Constructs::Construct
- Object
- Constructs::Construct
- AWSCDK::ApplicationAutoScaling::BaseScalableAttribute
- Includes:
- Interfaces::AWSApplicationautoscaling::IScalableTargetRef
- Defined in:
- application_auto_scaling/base_scalable_attribute.rb
Overview
Represent an attribute for which autoscaling can be configured.
This class is basically a light wrapper around ScalableTarget, but with all methods protected instead of public so they can be selectively exposed and/or more specific versions of them can be exposed by derived classes for individual services support autoscaling.
Typical use cases:
- Hide away the PredefinedMetric enum for target tracking policies.
- Don't expose all scaling methods (for example Dynamo tables don't support Step Scaling, so the Dynamo subclass won't expose this method).
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#do_scale_on_metric(id, props) ⇒ void
Scale out or in based on a metric value.
-
#do_scale_on_schedule(id, props) ⇒ void
Scale out or in based on time.
-
#do_scale_to_track_metric(id, props) ⇒ void
Scale out or in in order to keep a metric around a target value.
-
#env ⇒ AWSCDK::Interfaces::ResourceEnvironment
The environment this resource belongs to.
-
#initialize(scope, id, props) ⇒ BaseScalableAttribute
constructor
A new instance of BaseScalableAttribute.
-
#node ⇒ Constructs::Node
The tree node.
- #props ⇒ AWSCDK::ApplicationAutoScaling::BaseScalableAttributeProps
-
#scalable_target_ref ⇒ AWSCDK::Interfaces::AWSApplicationautoscaling::ScalableTargetReference
A reference to a ScalableTarget resource.
-
#to_string ⇒ String
Returns a string representation of this construct.
-
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Constructor Details
#initialize(scope, id, props) ⇒ BaseScalableAttribute
Returns a new instance of BaseScalableAttribute.
23 24 25 26 27 28 29 |
# File 'application_auto_scaling/base_scalable_attribute.rb', line 23 def initialize(scope, id, props) props = props.is_a?(Hash) ? ::AWSCDK::ApplicationAutoScaling::BaseScalableAttributeProps.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope") Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBwbGljYXRpb25hdXRvc2NhbGluZy5CYXNlU2NhbGFibGVBdHRyaWJ1dGVQcm9wcyJ9")), "props") Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props) end |
Class Method Details
.jsii_overridable_methods ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'application_auto_scaling/base_scalable_attribute.rb', line 31 def self.jsii_overridable_methods { :node => { kind: :property, name: "node", is_optional: false }, :env => { kind: :property, name: "env", is_optional: false }, :props => { kind: :property, name: "props", is_optional: false }, :scalable_target_ref => { kind: :property, name: "scalableTargetRef", is_optional: false }, :to_string => { kind: :method, name: "toString", is_optional: false }, :with => { kind: :method, name: "with", is_optional: false }, :do_scale_on_metric => { kind: :method, name: "doScaleOnMetric", is_optional: false }, :do_scale_on_schedule => { kind: :method, name: "doScaleOnSchedule", is_optional: false }, :do_scale_to_track_metric => { kind: :method, name: "doScaleToTrackMetric", is_optional: false }, } end |
Instance Method Details
#do_scale_on_metric(id, props) ⇒ void
This method returns an undefined value.
Scale out or in based on a metric value.
107 108 109 110 111 112 |
# File 'application_auto_scaling/base_scalable_attribute.rb', line 107 def do_scale_on_metric(id, props) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") props = props.is_a?(Hash) ? ::AWSCDK::ApplicationAutoScaling::BasicStepScalingPolicyProps.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBwbGljYXRpb25hdXRvc2NhbGluZy5CYXNpY1N0ZXBTY2FsaW5nUG9saWN5UHJvcHMifQ==")), "props") jsii_call_method("doScaleOnMetric", [id, props]) end |
#do_scale_on_schedule(id, props) ⇒ void
This method returns an undefined value.
Scale out or in based on time.
119 120 121 122 123 124 |
# File 'application_auto_scaling/base_scalable_attribute.rb', line 119 def do_scale_on_schedule(id, props) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") props = props.is_a?(Hash) ? ::AWSCDK::ApplicationAutoScaling::ScalingSchedule.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBwbGljYXRpb25hdXRvc2NhbGluZy5TY2FsaW5nU2NoZWR1bGUifQ==")), "props") jsii_call_method("doScaleOnSchedule", [id, props]) end |
#do_scale_to_track_metric(id, props) ⇒ void
This method returns an undefined value.
Scale out or in in order to keep a metric around a target value.
131 132 133 134 135 136 |
# File 'application_auto_scaling/base_scalable_attribute.rb', line 131 def do_scale_to_track_metric(id, props) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") props = props.is_a?(Hash) ? ::AWSCDK::ApplicationAutoScaling::BasicTargetTrackingScalingPolicyProps.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBwbGljYXRpb25hdXRvc2NhbGluZy5CYXNpY1RhcmdldFRyYWNraW5nU2NhbGluZ1BvbGljeVByb3BzIn0=")), "props") jsii_call_method("doScaleToTrackMetric", [id, props]) end |
#env ⇒ AWSCDK::Interfaces::ResourceEnvironment
The environment this resource belongs to.
For resources that are created and managed in a Stack (those created by
creating new class instances like new Role(), new Bucket(), etc.), this
is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like
Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be
different than the stack they were imported into.
63 64 65 |
# File 'application_auto_scaling/base_scalable_attribute.rb', line 63 def env() jsii_get_property("env") end |
#node ⇒ Constructs::Node
The tree node.
48 49 50 |
# File 'application_auto_scaling/base_scalable_attribute.rb', line 48 def node() jsii_get_property("node") end |
#props ⇒ AWSCDK::ApplicationAutoScaling::BaseScalableAttributeProps
68 69 70 |
# File 'application_auto_scaling/base_scalable_attribute.rb', line 68 def props() jsii_get_property("props") end |
#scalable_target_ref ⇒ AWSCDK::Interfaces::AWSApplicationautoscaling::ScalableTargetReference
A reference to a ScalableTarget resource.
75 76 77 |
# File 'application_auto_scaling/base_scalable_attribute.rb', line 75 def scalable_target_ref() jsii_get_property("scalableTargetRef") end |
#to_string ⇒ String
Returns a string representation of this construct.
82 83 84 |
# File 'application_auto_scaling/base_scalable_attribute.rb', line 82 def to_string() jsii_call_method("toString", []) end |
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
95 96 97 98 99 100 |
# File 'application_auto_scaling/base_scalable_attribute.rb', line 95 def with(*mixins) mixins.each_with_index do |item, index| Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]") end jsii_call_method("with", [*mixins]) end |