Class: AWSCDK::Autoscaling::CfnScalingPolicy::MetricProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
autoscaling/cfn_scaling_policy.rb

Overview

Represents a specific metric.

Metric is a property of the AWS::AutoScaling::ScalingPolicy MetricStat property type.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metric_name:, namespace:, dimensions: nil) ⇒ MetricProperty

Returns a new instance of MetricProperty.

Parameters:



913
914
915
916
917
918
919
920
# File 'autoscaling/cfn_scaling_policy.rb', line 913

def initialize(metric_name:, namespace:, dimensions: nil)
  @metric_name = metric_name
  Jsii::Type.check_type(@metric_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricName")
  @namespace = namespace
  Jsii::Type.check_type(@namespace, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "namespace")
  @dimensions = dimensions
  Jsii::Type.check_type(@dimensions, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuQ2ZuU2NhbGluZ1BvbGljeS5NZXRyaWNEaW1lbnNpb25Qcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "dimensions") unless @dimensions.nil?
end

Instance Attribute Details

#dimensionsAWSCDK::IResolvable, ... (readonly)

The dimensions for the metric.

For the list of available dimensions, see the AWS documentation available from the table in AWS services that publish CloudWatch metrics in the Amazon CloudWatch User Guide .

Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.



942
943
944
# File 'autoscaling/cfn_scaling_policy.rb', line 942

def dimensions
  @dimensions
end

#metric_nameString (readonly)

The name of the metric.



926
927
928
# File 'autoscaling/cfn_scaling_policy.rb', line 926

def metric_name
  @metric_name
end

#namespaceString (readonly)

The namespace of the metric.

For more information, see the table in AWS services that publish CloudWatch metrics in the Amazon CloudWatch User Guide .



933
934
935
# File 'autoscaling/cfn_scaling_policy.rb', line 933

def namespace
  @namespace
end

Class Method Details

.jsii_propertiesObject



944
945
946
947
948
949
950
# File 'autoscaling/cfn_scaling_policy.rb', line 944

def self.jsii_properties
  {
    :metric_name => "metricName",
    :namespace => "namespace",
    :dimensions => "dimensions",
  }
end

Instance Method Details

#to_jsiiObject



952
953
954
955
956
957
958
959
960
# File 'autoscaling/cfn_scaling_policy.rb', line 952

def to_jsii
  result = {}
  result.merge!({
    "metricName" => @metric_name,
    "namespace" => @namespace,
    "dimensions" => @dimensions,
  })
  result.compact
end