/* * Copyright 2018-2023 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.devopsguru.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *

* Information about an anomaly that is related to a recommendation. *

* * @see AWS API Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class RecommendationRelatedAnomaly implements Serializable, Cloneable, StructuredPojo { /** *

* An array of objects that represent resources in which DevOps Guru detected anomalous behavior. Each object * contains the name and type of the resource. *

*/ private java.util.List resources; /** *

* Information about where the anomalous behavior related the recommendation was found. For example, details in * Amazon CloudWatch metrics. *

*/ private java.util.List sourceDetails; /** *

* The ID of an anomaly that generated the insight with this recommendation. *

*/ private String anomalyId; /** *

* An array of objects that represent resources in which DevOps Guru detected anomalous behavior. Each object * contains the name and type of the resource. *

* * @return An array of objects that represent resources in which DevOps Guru detected anomalous behavior. Each * object contains the name and type of the resource. */ public java.util.List getResources() { return resources; } /** *

* An array of objects that represent resources in which DevOps Guru detected anomalous behavior. Each object * contains the name and type of the resource. *

* * @param resources * An array of objects that represent resources in which DevOps Guru detected anomalous behavior. Each object * contains the name and type of the resource. */ public void setResources(java.util.Collection resources) { if (resources == null) { this.resources = null; return; } this.resources = new java.util.ArrayList(resources); } /** *

* An array of objects that represent resources in which DevOps Guru detected anomalous behavior. Each object * contains the name and type of the resource. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setResources(java.util.Collection)} or {@link #withResources(java.util.Collection)} if you want to * override the existing values. *

* * @param resources * An array of objects that represent resources in which DevOps Guru detected anomalous behavior. Each object * contains the name and type of the resource. * @return Returns a reference to this object so that method calls can be chained together. */ public RecommendationRelatedAnomaly withResources(RecommendationRelatedAnomalyResource... resources) { if (this.resources == null) { setResources(new java.util.ArrayList(resources.length)); } for (RecommendationRelatedAnomalyResource ele : resources) { this.resources.add(ele); } return this; } /** *

* An array of objects that represent resources in which DevOps Guru detected anomalous behavior. Each object * contains the name and type of the resource. *

* * @param resources * An array of objects that represent resources in which DevOps Guru detected anomalous behavior. Each object * contains the name and type of the resource. * @return Returns a reference to this object so that method calls can be chained together. */ public RecommendationRelatedAnomaly withResources(java.util.Collection resources) { setResources(resources); return this; } /** *

* Information about where the anomalous behavior related the recommendation was found. For example, details in * Amazon CloudWatch metrics. *

* * @return Information about where the anomalous behavior related the recommendation was found. For example, details * in Amazon CloudWatch metrics. */ public java.util.List getSourceDetails() { return sourceDetails; } /** *

* Information about where the anomalous behavior related the recommendation was found. For example, details in * Amazon CloudWatch metrics. *

* * @param sourceDetails * Information about where the anomalous behavior related the recommendation was found. For example, details * in Amazon CloudWatch metrics. */ public void setSourceDetails(java.util.Collection sourceDetails) { if (sourceDetails == null) { this.sourceDetails = null; return; } this.sourceDetails = new java.util.ArrayList(sourceDetails); } /** *

* Information about where the anomalous behavior related the recommendation was found. For example, details in * Amazon CloudWatch metrics. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setSourceDetails(java.util.Collection)} or {@link #withSourceDetails(java.util.Collection)} if you want * to override the existing values. *

* * @param sourceDetails * Information about where the anomalous behavior related the recommendation was found. For example, details * in Amazon CloudWatch metrics. * @return Returns a reference to this object so that method calls can be chained together. */ public RecommendationRelatedAnomaly withSourceDetails(RecommendationRelatedAnomalySourceDetail... sourceDetails) { if (this.sourceDetails == null) { setSourceDetails(new java.util.ArrayList(sourceDetails.length)); } for (RecommendationRelatedAnomalySourceDetail ele : sourceDetails) { this.sourceDetails.add(ele); } return this; } /** *

* Information about where the anomalous behavior related the recommendation was found. For example, details in * Amazon CloudWatch metrics. *

* * @param sourceDetails * Information about where the anomalous behavior related the recommendation was found. For example, details * in Amazon CloudWatch metrics. * @return Returns a reference to this object so that method calls can be chained together. */ public RecommendationRelatedAnomaly withSourceDetails(java.util.Collection sourceDetails) { setSourceDetails(sourceDetails); return this; } /** *

* The ID of an anomaly that generated the insight with this recommendation. *

* * @param anomalyId * The ID of an anomaly that generated the insight with this recommendation. */ public void setAnomalyId(String anomalyId) { this.anomalyId = anomalyId; } /** *

* The ID of an anomaly that generated the insight with this recommendation. *

* * @return The ID of an anomaly that generated the insight with this recommendation. */ public String getAnomalyId() { return this.anomalyId; } /** *

* The ID of an anomaly that generated the insight with this recommendation. *

* * @param anomalyId * The ID of an anomaly that generated the insight with this recommendation. * @return Returns a reference to this object so that method calls can be chained together. */ public RecommendationRelatedAnomaly withAnomalyId(String anomalyId) { setAnomalyId(anomalyId); 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 (getResources() != null) sb.append("Resources: ").append(getResources()).append(","); if (getSourceDetails() != null) sb.append("SourceDetails: ").append(getSourceDetails()).append(","); if (getAnomalyId() != null) sb.append("AnomalyId: ").append(getAnomalyId()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof RecommendationRelatedAnomaly == false) return false; RecommendationRelatedAnomaly other = (RecommendationRelatedAnomaly) obj; if (other.getResources() == null ^ this.getResources() == null) return false; if (other.getResources() != null && other.getResources().equals(this.getResources()) == false) return false; if (other.getSourceDetails() == null ^ this.getSourceDetails() == null) return false; if (other.getSourceDetails() != null && other.getSourceDetails().equals(this.getSourceDetails()) == false) return false; if (other.getAnomalyId() == null ^ this.getAnomalyId() == null) return false; if (other.getAnomalyId() != null && other.getAnomalyId().equals(this.getAnomalyId()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getResources() == null) ? 0 : getResources().hashCode()); hashCode = prime * hashCode + ((getSourceDetails() == null) ? 0 : getSourceDetails().hashCode()); hashCode = prime * hashCode + ((getAnomalyId() == null) ? 0 : getAnomalyId().hashCode()); return hashCode; } @Override public RecommendationRelatedAnomaly clone() { try { return (RecommendationRelatedAnomaly) 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.devopsguru.model.transform.RecommendationRelatedAnomalyMarshaller.getInstance().marshall(this, protocolMarshaller); } }