com.amazonaws.services.applicationsignals.model.ServiceLevelIndicatorMetricConfig Maven / Gradle / Ivy
Show all versions of aws-java-sdk-applicationsignals Show documentation
/*
* Copyright 2019-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.applicationsignals.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Use this structure to specify the information for the metric that the SLO will monitor.
*
*
* @see AWS API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ServiceLevelIndicatorMetricConfig implements Serializable, Cloneable, StructuredPojo {
/**
*
* If this SLO is related to a metric collected by Application Signals, you must use this field to specify which
* service the SLO metric is related to. To do so, you must specify at least the Type
,
* Name
, and Environment
attributes.
*
*
* This is a string-to-string map. It can include the following fields.
*
*
* -
*
* Type
designates the type of object this is.
*
*
* -
*
* ResourceType
specifies the type of the resource. This field is used only when the value of the
* Type
field is Resource
or AWS::Resource
.
*
*
* -
*
* Name
specifies the name of the object. This is used only if the value of the Type
field
* is Service
, RemoteService
, or AWS::Service
.
*
*
* -
*
* Identifier
identifies the resource objects of this resource. This is used only if the value of the
* Type
field is Resource
or AWS::Resource
.
*
*
* -
*
* Environment
specifies the location where this object is hosted, or what it belongs to.
*
*
*
*/
private java.util.Map keyAttributes;
/**
*
* If the SLO is to monitor a specific operation of the service, use this field to specify the name of that
* operation.
*
*/
private String operationName;
/**
*
* If the SLO is to monitor either the LATENCY
or AVAILABILITY
metric that Application
* Signals collects, use this field to specify which of those metrics is used.
*
*/
private String metricType;
/**
*
* The statistic to use for comparison to the threshold. It can be any CloudWatch statistic or extended statistic.
* For more information about statistics, see CloudWatch
* statistics definitions.
*
*/
private String statistic;
/**
*
* The number of seconds to use as the period for SLO evaluation. Your application's performance is compared to the
* SLI during each period. For each period, the application is determined to have either achieved or not achieved
* the necessary performance.
*
*/
private Integer periodSeconds;
/**
*
* If this SLO monitors a CloudWatch metric or the result of a CloudWatch metric math expression, use this structure
* to specify that metric or expression.
*
*/
private java.util.List metricDataQueries;
/**
*
* If this SLO is related to a metric collected by Application Signals, you must use this field to specify which
* service the SLO metric is related to. To do so, you must specify at least the Type
,
* Name
, and Environment
attributes.
*
*
* This is a string-to-string map. It can include the following fields.
*
*
* -
*
* Type
designates the type of object this is.
*
*
* -
*
* ResourceType
specifies the type of the resource. This field is used only when the value of the
* Type
field is Resource
or AWS::Resource
.
*
*
* -
*
* Name
specifies the name of the object. This is used only if the value of the Type
field
* is Service
, RemoteService
, or AWS::Service
.
*
*
* -
*
* Identifier
identifies the resource objects of this resource. This is used only if the value of the
* Type
field is Resource
or AWS::Resource
.
*
*
* -
*
* Environment
specifies the location where this object is hosted, or what it belongs to.
*
*
*
*
* @return If this SLO is related to a metric collected by Application Signals, you must use this field to specify
* which service the SLO metric is related to. To do so, you must specify at least the Type
,
* Name
, and Environment
attributes.
*
* This is a string-to-string map. It can include the following fields.
*
*
* -
*
* Type
designates the type of object this is.
*
*
* -
*
* ResourceType
specifies the type of the resource. This field is used only when the value of
* the Type
field is Resource
or AWS::Resource
.
*
*
* -
*
* Name
specifies the name of the object. This is used only if the value of the
* Type
field is Service
, RemoteService
, or AWS::Service
* .
*
*
* -
*
* Identifier
identifies the resource objects of this resource. This is used only if the value
* of the Type
field is Resource
or AWS::Resource
.
*
*
* -
*
* Environment
specifies the location where this object is hosted, or what it belongs to.
*
*
*/
public java.util.Map getKeyAttributes() {
return keyAttributes;
}
/**
*
* If this SLO is related to a metric collected by Application Signals, you must use this field to specify which
* service the SLO metric is related to. To do so, you must specify at least the Type
,
* Name
, and Environment
attributes.
*
*
* This is a string-to-string map. It can include the following fields.
*
*
* -
*
* Type
designates the type of object this is.
*
*
* -
*
* ResourceType
specifies the type of the resource. This field is used only when the value of the
* Type
field is Resource
or AWS::Resource
.
*
*
* -
*
* Name
specifies the name of the object. This is used only if the value of the Type
field
* is Service
, RemoteService
, or AWS::Service
.
*
*
* -
*
* Identifier
identifies the resource objects of this resource. This is used only if the value of the
* Type
field is Resource
or AWS::Resource
.
*
*
* -
*
* Environment
specifies the location where this object is hosted, or what it belongs to.
*
*
*
*
* @param keyAttributes
* If this SLO is related to a metric collected by Application Signals, you must use this field to specify
* which service the SLO metric is related to. To do so, you must specify at least the Type
,
* Name
, and Environment
attributes.
*
* This is a string-to-string map. It can include the following fields.
*
*
* -
*
* Type
designates the type of object this is.
*
*
* -
*
* ResourceType
specifies the type of the resource. This field is used only when the value of
* the Type
field is Resource
or AWS::Resource
.
*
*
* -
*
* Name
specifies the name of the object. This is used only if the value of the
* Type
field is Service
, RemoteService
, or AWS::Service
.
*
*
* -
*
* Identifier
identifies the resource objects of this resource. This is used only if the value
* of the Type
field is Resource
or AWS::Resource
.
*
*
* -
*
* Environment
specifies the location where this object is hosted, or what it belongs to.
*
*
*/
public void setKeyAttributes(java.util.Map keyAttributes) {
this.keyAttributes = keyAttributes;
}
/**
*
* If this SLO is related to a metric collected by Application Signals, you must use this field to specify which
* service the SLO metric is related to. To do so, you must specify at least the Type
,
* Name
, and Environment
attributes.
*
*
* This is a string-to-string map. It can include the following fields.
*
*
* -
*
* Type
designates the type of object this is.
*
*
* -
*
* ResourceType
specifies the type of the resource. This field is used only when the value of the
* Type
field is Resource
or AWS::Resource
.
*
*
* -
*
* Name
specifies the name of the object. This is used only if the value of the Type
field
* is Service
, RemoteService
, or AWS::Service
.
*
*
* -
*
* Identifier
identifies the resource objects of this resource. This is used only if the value of the
* Type
field is Resource
or AWS::Resource
.
*
*
* -
*
* Environment
specifies the location where this object is hosted, or what it belongs to.
*
*
*
*
* @param keyAttributes
* If this SLO is related to a metric collected by Application Signals, you must use this field to specify
* which service the SLO metric is related to. To do so, you must specify at least the Type
,
* Name
, and Environment
attributes.
*
* This is a string-to-string map. It can include the following fields.
*
*
* -
*
* Type
designates the type of object this is.
*
*
* -
*
* ResourceType
specifies the type of the resource. This field is used only when the value of
* the Type
field is Resource
or AWS::Resource
.
*
*
* -
*
* Name
specifies the name of the object. This is used only if the value of the
* Type
field is Service
, RemoteService
, or AWS::Service
.
*
*
* -
*
* Identifier
identifies the resource objects of this resource. This is used only if the value
* of the Type
field is Resource
or AWS::Resource
.
*
*
* -
*
* Environment
specifies the location where this object is hosted, or what it belongs to.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ServiceLevelIndicatorMetricConfig withKeyAttributes(java.util.Map keyAttributes) {
setKeyAttributes(keyAttributes);
return this;
}
/**
* Add a single KeyAttributes entry
*
* @see ServiceLevelIndicatorMetricConfig#withKeyAttributes
* @returns a reference to this object so that method calls can be chained together.
*/
public ServiceLevelIndicatorMetricConfig addKeyAttributesEntry(String key, String value) {
if (null == this.keyAttributes) {
this.keyAttributes = new java.util.HashMap();
}
if (this.keyAttributes.containsKey(key))
throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
this.keyAttributes.put(key, value);
return this;
}
/**
* Removes all the entries added into KeyAttributes.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ServiceLevelIndicatorMetricConfig clearKeyAttributesEntries() {
this.keyAttributes = null;
return this;
}
/**
*
* If the SLO is to monitor a specific operation of the service, use this field to specify the name of that
* operation.
*
*
* @param operationName
* If the SLO is to monitor a specific operation of the service, use this field to specify the name of that
* operation.
*/
public void setOperationName(String operationName) {
this.operationName = operationName;
}
/**
*
* If the SLO is to monitor a specific operation of the service, use this field to specify the name of that
* operation.
*
*
* @return If the SLO is to monitor a specific operation of the service, use this field to specify the name of that
* operation.
*/
public String getOperationName() {
return this.operationName;
}
/**
*
* If the SLO is to monitor a specific operation of the service, use this field to specify the name of that
* operation.
*
*
* @param operationName
* If the SLO is to monitor a specific operation of the service, use this field to specify the name of that
* operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ServiceLevelIndicatorMetricConfig withOperationName(String operationName) {
setOperationName(operationName);
return this;
}
/**
*
* If the SLO is to monitor either the LATENCY
or AVAILABILITY
metric that Application
* Signals collects, use this field to specify which of those metrics is used.
*
*
* @param metricType
* If the SLO is to monitor either the LATENCY
or AVAILABILITY
metric that
* Application Signals collects, use this field to specify which of those metrics is used.
* @see ServiceLevelIndicatorMetricType
*/
public void setMetricType(String metricType) {
this.metricType = metricType;
}
/**
*
* If the SLO is to monitor either the LATENCY
or AVAILABILITY
metric that Application
* Signals collects, use this field to specify which of those metrics is used.
*
*
* @return If the SLO is to monitor either the LATENCY
or AVAILABILITY
metric that
* Application Signals collects, use this field to specify which of those metrics is used.
* @see ServiceLevelIndicatorMetricType
*/
public String getMetricType() {
return this.metricType;
}
/**
*
* If the SLO is to monitor either the LATENCY
or AVAILABILITY
metric that Application
* Signals collects, use this field to specify which of those metrics is used.
*
*
* @param metricType
* If the SLO is to monitor either the LATENCY
or AVAILABILITY
metric that
* Application Signals collects, use this field to specify which of those metrics is used.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ServiceLevelIndicatorMetricType
*/
public ServiceLevelIndicatorMetricConfig withMetricType(String metricType) {
setMetricType(metricType);
return this;
}
/**
*
* If the SLO is to monitor either the LATENCY
or AVAILABILITY
metric that Application
* Signals collects, use this field to specify which of those metrics is used.
*
*
* @param metricType
* If the SLO is to monitor either the LATENCY
or AVAILABILITY
metric that
* Application Signals collects, use this field to specify which of those metrics is used.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ServiceLevelIndicatorMetricType
*/
public ServiceLevelIndicatorMetricConfig withMetricType(ServiceLevelIndicatorMetricType metricType) {
this.metricType = metricType.toString();
return this;
}
/**
*
* The statistic to use for comparison to the threshold. It can be any CloudWatch statistic or extended statistic.
* For more information about statistics, see CloudWatch
* statistics definitions.
*
*
* @param statistic
* The statistic to use for comparison to the threshold. It can be any CloudWatch statistic or extended
* statistic. For more information about statistics, see CloudWatch statistics definitions.
*/
public void setStatistic(String statistic) {
this.statistic = statistic;
}
/**
*
* The statistic to use for comparison to the threshold. It can be any CloudWatch statistic or extended statistic.
* For more information about statistics, see CloudWatch
* statistics definitions.
*
*
* @return The statistic to use for comparison to the threshold. It can be any CloudWatch statistic or extended
* statistic. For more information about statistics, see CloudWatch statistics definitions.
*/
public String getStatistic() {
return this.statistic;
}
/**
*
* The statistic to use for comparison to the threshold. It can be any CloudWatch statistic or extended statistic.
* For more information about statistics, see CloudWatch
* statistics definitions.
*
*
* @param statistic
* The statistic to use for comparison to the threshold. It can be any CloudWatch statistic or extended
* statistic. For more information about statistics, see CloudWatch statistics definitions.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ServiceLevelIndicatorMetricConfig withStatistic(String statistic) {
setStatistic(statistic);
return this;
}
/**
*
* The number of seconds to use as the period for SLO evaluation. Your application's performance is compared to the
* SLI during each period. For each period, the application is determined to have either achieved or not achieved
* the necessary performance.
*
*
* @param periodSeconds
* The number of seconds to use as the period for SLO evaluation. Your application's performance is compared
* to the SLI during each period. For each period, the application is determined to have either achieved or
* not achieved the necessary performance.
*/
public void setPeriodSeconds(Integer periodSeconds) {
this.periodSeconds = periodSeconds;
}
/**
*
* The number of seconds to use as the period for SLO evaluation. Your application's performance is compared to the
* SLI during each period. For each period, the application is determined to have either achieved or not achieved
* the necessary performance.
*
*
* @return The number of seconds to use as the period for SLO evaluation. Your application's performance is compared
* to the SLI during each period. For each period, the application is determined to have either achieved or
* not achieved the necessary performance.
*/
public Integer getPeriodSeconds() {
return this.periodSeconds;
}
/**
*
* The number of seconds to use as the period for SLO evaluation. Your application's performance is compared to the
* SLI during each period. For each period, the application is determined to have either achieved or not achieved
* the necessary performance.
*
*
* @param periodSeconds
* The number of seconds to use as the period for SLO evaluation. Your application's performance is compared
* to the SLI during each period. For each period, the application is determined to have either achieved or
* not achieved the necessary performance.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ServiceLevelIndicatorMetricConfig withPeriodSeconds(Integer periodSeconds) {
setPeriodSeconds(periodSeconds);
return this;
}
/**
*
* If this SLO monitors a CloudWatch metric or the result of a CloudWatch metric math expression, use this structure
* to specify that metric or expression.
*
*
* @return If this SLO monitors a CloudWatch metric or the result of a CloudWatch metric math expression, use this
* structure to specify that metric or expression.
*/
public java.util.List getMetricDataQueries() {
return metricDataQueries;
}
/**
*
* If this SLO monitors a CloudWatch metric or the result of a CloudWatch metric math expression, use this structure
* to specify that metric or expression.
*
*
* @param metricDataQueries
* If this SLO monitors a CloudWatch metric or the result of a CloudWatch metric math expression, use this
* structure to specify that metric or expression.
*/
public void setMetricDataQueries(java.util.Collection metricDataQueries) {
if (metricDataQueries == null) {
this.metricDataQueries = null;
return;
}
this.metricDataQueries = new java.util.ArrayList(metricDataQueries);
}
/**
*
* If this SLO monitors a CloudWatch metric or the result of a CloudWatch metric math expression, use this structure
* to specify that metric or expression.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setMetricDataQueries(java.util.Collection)} or {@link #withMetricDataQueries(java.util.Collection)} if
* you want to override the existing values.
*
*
* @param metricDataQueries
* If this SLO monitors a CloudWatch metric or the result of a CloudWatch metric math expression, use this
* structure to specify that metric or expression.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ServiceLevelIndicatorMetricConfig withMetricDataQueries(MetricDataQuery... metricDataQueries) {
if (this.metricDataQueries == null) {
setMetricDataQueries(new java.util.ArrayList(metricDataQueries.length));
}
for (MetricDataQuery ele : metricDataQueries) {
this.metricDataQueries.add(ele);
}
return this;
}
/**
*
* If this SLO monitors a CloudWatch metric or the result of a CloudWatch metric math expression, use this structure
* to specify that metric or expression.
*
*
* @param metricDataQueries
* If this SLO monitors a CloudWatch metric or the result of a CloudWatch metric math expression, use this
* structure to specify that metric or expression.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ServiceLevelIndicatorMetricConfig withMetricDataQueries(java.util.Collection metricDataQueries) {
setMetricDataQueries(metricDataQueries);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getKeyAttributes() != null)
sb.append("KeyAttributes: ").append(getKeyAttributes()).append(",");
if (getOperationName() != null)
sb.append("OperationName: ").append(getOperationName()).append(",");
if (getMetricType() != null)
sb.append("MetricType: ").append(getMetricType()).append(",");
if (getStatistic() != null)
sb.append("Statistic: ").append(getStatistic()).append(",");
if (getPeriodSeconds() != null)
sb.append("PeriodSeconds: ").append(getPeriodSeconds()).append(",");
if (getMetricDataQueries() != null)
sb.append("MetricDataQueries: ").append(getMetricDataQueries());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ServiceLevelIndicatorMetricConfig == false)
return false;
ServiceLevelIndicatorMetricConfig other = (ServiceLevelIndicatorMetricConfig) obj;
if (other.getKeyAttributes() == null ^ this.getKeyAttributes() == null)
return false;
if (other.getKeyAttributes() != null && other.getKeyAttributes().equals(this.getKeyAttributes()) == false)
return false;
if (other.getOperationName() == null ^ this.getOperationName() == null)
return false;
if (other.getOperationName() != null && other.getOperationName().equals(this.getOperationName()) == false)
return false;
if (other.getMetricType() == null ^ this.getMetricType() == null)
return false;
if (other.getMetricType() != null && other.getMetricType().equals(this.getMetricType()) == false)
return false;
if (other.getStatistic() == null ^ this.getStatistic() == null)
return false;
if (other.getStatistic() != null && other.getStatistic().equals(this.getStatistic()) == false)
return false;
if (other.getPeriodSeconds() == null ^ this.getPeriodSeconds() == null)
return false;
if (other.getPeriodSeconds() != null && other.getPeriodSeconds().equals(this.getPeriodSeconds()) == false)
return false;
if (other.getMetricDataQueries() == null ^ this.getMetricDataQueries() == null)
return false;
if (other.getMetricDataQueries() != null && other.getMetricDataQueries().equals(this.getMetricDataQueries()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getKeyAttributes() == null) ? 0 : getKeyAttributes().hashCode());
hashCode = prime * hashCode + ((getOperationName() == null) ? 0 : getOperationName().hashCode());
hashCode = prime * hashCode + ((getMetricType() == null) ? 0 : getMetricType().hashCode());
hashCode = prime * hashCode + ((getStatistic() == null) ? 0 : getStatistic().hashCode());
hashCode = prime * hashCode + ((getPeriodSeconds() == null) ? 0 : getPeriodSeconds().hashCode());
hashCode = prime * hashCode + ((getMetricDataQueries() == null) ? 0 : getMetricDataQueries().hashCode());
return hashCode;
}
@Override
public ServiceLevelIndicatorMetricConfig clone() {
try {
return (ServiceLevelIndicatorMetricConfig) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.applicationsignals.model.transform.ServiceLevelIndicatorMetricConfigMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}