Class: AWSCDK::ApplicationSignals::CfnServiceLevelObjective::MetricDataQueryProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
application_signals/cfn_service_level_objective.rb

Overview

Use this structure to define a metric or metric math expression that you want to use as for a service level objective.

Each MetricDataQuery in the MetricDataQueries array specifies either a metric to retrieve, or a metric math expression to be performed on retrieved metrics. A single MetricDataQueries array can include as many as 20 MetricDataQuery structures in the array. The 20 structures can include as many as 10 structures that contain a MetricStat parameter to retrieve a metric, and as many as 10 structures that contain the Expression parameter to perform a math expression. Of those Expression structures, exactly one must have true as the value for ReturnData . The result of this expression used for the SLO.

For more information about metric math expressions, see Use metric math .

Within each MetricDataQuery object, you must specify either Expression or MetricStat but not both.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, account_id: nil, expression: nil, metric_stat: nil, return_data: nil) ⇒ MetricDataQueryProperty

Returns a new instance of MetricDataQueryProperty.

Parameters:

  • id (String)

    A short name used to tie this object to the results in the response.

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

    The ID of the account where this metric is located.

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

    This field can contain a metric math expression to be performed on the other metrics that you are retrieving within this MetricDataQueries structure.

  • metric_stat (AWSCDK::IResolvable, AWSCDK::ApplicationSignals::CfnServiceLevelObjective::MetricStatProperty, nil) (defaults to: nil)

    A metric to be used directly for the SLO, or to be used in the math expression that will be used for the SLO.

  • return_data (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Use this only if you are using a metric math expression for the SLO.



1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
# File 'application_signals/cfn_service_level_objective.rb', line 1129

def initialize(id:, account_id: nil, expression: nil, metric_stat: nil, return_data: nil)
  @id = id
  Jsii::Type.check_type(@id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  @account_id = 
  Jsii::Type.check_type(@account_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "accountId") unless @account_id.nil?
  @expression = expression
  Jsii::Type.check_type(@expression, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "expression") unless @expression.nil?
  @metric_stat = metric_stat.is_a?(Hash) ? ::AWSCDK::ApplicationSignals::CfnServiceLevelObjective::MetricStatProperty.new(**metric_stat.transform_keys(&:to_sym)) : metric_stat
  Jsii::Type.check_type(@metric_stat, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hcHBsaWNhdGlvbnNpZ25hbHMuQ2ZuU2VydmljZUxldmVsT2JqZWN0aXZlLk1ldHJpY1N0YXRQcm9wZXJ0eSJ9XX19")), "metricStat") unless @metric_stat.nil?
  @return_data = return_data
  Jsii::Type.check_type(@return_data, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "returnData") unless @return_data.nil?
end

Instance Attribute Details

#account_idString? (readonly)

The ID of the account where this metric is located.

If you are performing this operation in a monitoring account, use this to specify which source account to retrieve this metric from.



1155
1156
1157
# File 'application_signals/cfn_service_level_objective.rb', line 1155

def 
  @account_id
end

#expressionString? (readonly)

This field can contain a metric math expression to be performed on the other metrics that you are retrieving within this MetricDataQueries structure.

A math expression can use the Id of the other metrics or queries to refer to those metrics, and can also use the Id of other expressions to use the result of those expressions. For more information about metric math expressions, see Metric Math Syntax and Functions in the Amazon CloudWatch User Guide .

Within each MetricDataQuery object, you must specify either Expression or MetricStat but not both.



1164
1165
1166
# File 'application_signals/cfn_service_level_objective.rb', line 1164

def expression
  @expression
end

#idString (readonly)

A short name used to tie this object to the results in the response.

This Id must be unique within a MetricDataQueries array. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the metric math expression. The valid characters are letters, numbers, and underscore. The first character must be a lowercase letter.



1148
1149
1150
# File 'application_signals/cfn_service_level_objective.rb', line 1148

def id
  @id
end

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

A metric to be used directly for the SLO, or to be used in the math expression that will be used for the SLO.

Within one MetricDataQuery object, you must specify either Expression or MetricStat but not both.



1171
1172
1173
# File 'application_signals/cfn_service_level_objective.rb', line 1171

def metric_stat
  @metric_stat
end

#return_dataBoolean, ... (readonly)

Use this only if you are using a metric math expression for the SLO.

Specify true for ReturnData for only the one expression result to use as the alarm. For all other metrics and expressions in the same CreateServiceLevelObjective operation, specify ReturnData as false .



1178
1179
1180
# File 'application_signals/cfn_service_level_objective.rb', line 1178

def return_data
  @return_data
end

Class Method Details

.jsii_propertiesObject



1180
1181
1182
1183
1184
1185
1186
1187
1188
# File 'application_signals/cfn_service_level_objective.rb', line 1180

def self.jsii_properties
  {
    :id => "id",
    :account_id => "accountId",
    :expression => "expression",
    :metric_stat => "metricStat",
    :return_data => "returnData",
  }
end

Instance Method Details

#to_jsiiObject



1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
# File 'application_signals/cfn_service_level_objective.rb', line 1190

def to_jsii
  result = {}
  result.merge!({
    "id" => @id,
    "accountId" => @account_id,
    "expression" => @expression,
    "metricStat" => @metric_stat,
    "returnData" => @return_data,
  })
  result.compact
end