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

* The details of a DDoS attack. *

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

* The unique identifier (ID) of the attack. *

*/ private String attackId; /** *

* The ARN (Amazon Resource Name) of the resource that was attacked. *

*/ private String resourceArn; /** *

* If applicable, additional detail about the resource being attacked, for example, IP address or URL. *

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

* The time the attack started, in Unix time in seconds. *

*/ private java.util.Date startTime; /** *

* The time the attack ended, in Unix time in seconds. *

*/ private java.util.Date endTime; /** *

* List of counters that describe the attack for the specified time period. *

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

* The array of objects that provide details of the Shield event. *

*

* For infrastructure layer events (L3 and L4 events), you can view metrics for top contributors in Amazon * CloudWatch metrics. For more information, see Shield * metrics and alarms in the WAF Developer Guide. *

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

* List of mitigation actions taken for the attack. *

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

* The unique identifier (ID) of the attack. *

* * @param attackId * The unique identifier (ID) of the attack. */ public void setAttackId(String attackId) { this.attackId = attackId; } /** *

* The unique identifier (ID) of the attack. *

* * @return The unique identifier (ID) of the attack. */ public String getAttackId() { return this.attackId; } /** *

* The unique identifier (ID) of the attack. *

* * @param attackId * The unique identifier (ID) of the attack. * @return Returns a reference to this object so that method calls can be chained together. */ public AttackDetail withAttackId(String attackId) { setAttackId(attackId); return this; } /** *

* The ARN (Amazon Resource Name) of the resource that was attacked. *

* * @param resourceArn * The ARN (Amazon Resource Name) of the resource that was attacked. */ public void setResourceArn(String resourceArn) { this.resourceArn = resourceArn; } /** *

* The ARN (Amazon Resource Name) of the resource that was attacked. *

* * @return The ARN (Amazon Resource Name) of the resource that was attacked. */ public String getResourceArn() { return this.resourceArn; } /** *

* The ARN (Amazon Resource Name) of the resource that was attacked. *

* * @param resourceArn * The ARN (Amazon Resource Name) of the resource that was attacked. * @return Returns a reference to this object so that method calls can be chained together. */ public AttackDetail withResourceArn(String resourceArn) { setResourceArn(resourceArn); return this; } /** *

* If applicable, additional detail about the resource being attacked, for example, IP address or URL. *

* * @return If applicable, additional detail about the resource being attacked, for example, IP address or URL. */ public java.util.List getSubResources() { return subResources; } /** *

* If applicable, additional detail about the resource being attacked, for example, IP address or URL. *

* * @param subResources * If applicable, additional detail about the resource being attacked, for example, IP address or URL. */ public void setSubResources(java.util.Collection subResources) { if (subResources == null) { this.subResources = null; return; } this.subResources = new java.util.ArrayList(subResources); } /** *

* If applicable, additional detail about the resource being attacked, for example, IP address or URL. *

*

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

* * @param subResources * If applicable, additional detail about the resource being attacked, for example, IP address or URL. * @return Returns a reference to this object so that method calls can be chained together. */ public AttackDetail withSubResources(SubResourceSummary... subResources) { if (this.subResources == null) { setSubResources(new java.util.ArrayList(subResources.length)); } for (SubResourceSummary ele : subResources) { this.subResources.add(ele); } return this; } /** *

* If applicable, additional detail about the resource being attacked, for example, IP address or URL. *

* * @param subResources * If applicable, additional detail about the resource being attacked, for example, IP address or URL. * @return Returns a reference to this object so that method calls can be chained together. */ public AttackDetail withSubResources(java.util.Collection subResources) { setSubResources(subResources); return this; } /** *

* The time the attack started, in Unix time in seconds. *

* * @param startTime * The time the attack started, in Unix time in seconds. */ public void setStartTime(java.util.Date startTime) { this.startTime = startTime; } /** *

* The time the attack started, in Unix time in seconds. *

* * @return The time the attack started, in Unix time in seconds. */ public java.util.Date getStartTime() { return this.startTime; } /** *

* The time the attack started, in Unix time in seconds. *

* * @param startTime * The time the attack started, in Unix time in seconds. * @return Returns a reference to this object so that method calls can be chained together. */ public AttackDetail withStartTime(java.util.Date startTime) { setStartTime(startTime); return this; } /** *

* The time the attack ended, in Unix time in seconds. *

* * @param endTime * The time the attack ended, in Unix time in seconds. */ public void setEndTime(java.util.Date endTime) { this.endTime = endTime; } /** *

* The time the attack ended, in Unix time in seconds. *

* * @return The time the attack ended, in Unix time in seconds. */ public java.util.Date getEndTime() { return this.endTime; } /** *

* The time the attack ended, in Unix time in seconds. *

* * @param endTime * The time the attack ended, in Unix time in seconds. * @return Returns a reference to this object so that method calls can be chained together. */ public AttackDetail withEndTime(java.util.Date endTime) { setEndTime(endTime); return this; } /** *

* List of counters that describe the attack for the specified time period. *

* * @return List of counters that describe the attack for the specified time period. */ public java.util.List getAttackCounters() { return attackCounters; } /** *

* List of counters that describe the attack for the specified time period. *

* * @param attackCounters * List of counters that describe the attack for the specified time period. */ public void setAttackCounters(java.util.Collection attackCounters) { if (attackCounters == null) { this.attackCounters = null; return; } this.attackCounters = new java.util.ArrayList(attackCounters); } /** *

* List of counters that describe the attack for the specified time period. *

*

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

* * @param attackCounters * List of counters that describe the attack for the specified time period. * @return Returns a reference to this object so that method calls can be chained together. */ public AttackDetail withAttackCounters(SummarizedCounter... attackCounters) { if (this.attackCounters == null) { setAttackCounters(new java.util.ArrayList(attackCounters.length)); } for (SummarizedCounter ele : attackCounters) { this.attackCounters.add(ele); } return this; } /** *

* List of counters that describe the attack for the specified time period. *

* * @param attackCounters * List of counters that describe the attack for the specified time period. * @return Returns a reference to this object so that method calls can be chained together. */ public AttackDetail withAttackCounters(java.util.Collection attackCounters) { setAttackCounters(attackCounters); return this; } /** *

* The array of objects that provide details of the Shield event. *

*

* For infrastructure layer events (L3 and L4 events), you can view metrics for top contributors in Amazon * CloudWatch metrics. For more information, see Shield * metrics and alarms in the WAF Developer Guide. *

* * @return The array of objects that provide details of the Shield event.

*

* For infrastructure layer events (L3 and L4 events), you can view metrics for top contributors in Amazon * CloudWatch metrics. For more information, see Shield metrics and alarms in the WAF Developer Guide. */ public java.util.List getAttackProperties() { return attackProperties; } /** *

* The array of objects that provide details of the Shield event. *

*

* For infrastructure layer events (L3 and L4 events), you can view metrics for top contributors in Amazon * CloudWatch metrics. For more information, see Shield * metrics and alarms in the WAF Developer Guide. *

* * @param attackProperties * The array of objects that provide details of the Shield event.

*

* For infrastructure layer events (L3 and L4 events), you can view metrics for top contributors in Amazon * CloudWatch metrics. For more information, see Shield metrics and alarms in the WAF Developer Guide. */ public void setAttackProperties(java.util.Collection attackProperties) { if (attackProperties == null) { this.attackProperties = null; return; } this.attackProperties = new java.util.ArrayList(attackProperties); } /** *

* The array of objects that provide details of the Shield event. *

*

* For infrastructure layer events (L3 and L4 events), you can view metrics for top contributors in Amazon * CloudWatch metrics. For more information, see Shield * metrics and alarms in the WAF Developer Guide. *

*

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

* * @param attackProperties * The array of objects that provide details of the Shield event.

*

* For infrastructure layer events (L3 and L4 events), you can view metrics for top contributors in Amazon * CloudWatch metrics. For more information, see Shield metrics and alarms in the WAF Developer Guide. * @return Returns a reference to this object so that method calls can be chained together. */ public AttackDetail withAttackProperties(AttackProperty... attackProperties) { if (this.attackProperties == null) { setAttackProperties(new java.util.ArrayList(attackProperties.length)); } for (AttackProperty ele : attackProperties) { this.attackProperties.add(ele); } return this; } /** *

* The array of objects that provide details of the Shield event. *

*

* For infrastructure layer events (L3 and L4 events), you can view metrics for top contributors in Amazon * CloudWatch metrics. For more information, see Shield * metrics and alarms in the WAF Developer Guide. *

* * @param attackProperties * The array of objects that provide details of the Shield event.

*

* For infrastructure layer events (L3 and L4 events), you can view metrics for top contributors in Amazon * CloudWatch metrics. For more information, see Shield metrics and alarms in the WAF Developer Guide. * @return Returns a reference to this object so that method calls can be chained together. */ public AttackDetail withAttackProperties(java.util.Collection attackProperties) { setAttackProperties(attackProperties); return this; } /** *

* List of mitigation actions taken for the attack. *

* * @return List of mitigation actions taken for the attack. */ public java.util.List getMitigations() { return mitigations; } /** *

* List of mitigation actions taken for the attack. *

* * @param mitigations * List of mitigation actions taken for the attack. */ public void setMitigations(java.util.Collection mitigations) { if (mitigations == null) { this.mitigations = null; return; } this.mitigations = new java.util.ArrayList(mitigations); } /** *

* List of mitigation actions taken for the attack. *

*

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

* * @param mitigations * List of mitigation actions taken for the attack. * @return Returns a reference to this object so that method calls can be chained together. */ public AttackDetail withMitigations(Mitigation... mitigations) { if (this.mitigations == null) { setMitigations(new java.util.ArrayList(mitigations.length)); } for (Mitigation ele : mitigations) { this.mitigations.add(ele); } return this; } /** *

* List of mitigation actions taken for the attack. *

* * @param mitigations * List of mitigation actions taken for the attack. * @return Returns a reference to this object so that method calls can be chained together. */ public AttackDetail withMitigations(java.util.Collection mitigations) { setMitigations(mitigations); 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 (getAttackId() != null) sb.append("AttackId: ").append(getAttackId()).append(","); if (getResourceArn() != null) sb.append("ResourceArn: ").append(getResourceArn()).append(","); if (getSubResources() != null) sb.append("SubResources: ").append(getSubResources()).append(","); if (getStartTime() != null) sb.append("StartTime: ").append(getStartTime()).append(","); if (getEndTime() != null) sb.append("EndTime: ").append(getEndTime()).append(","); if (getAttackCounters() != null) sb.append("AttackCounters: ").append(getAttackCounters()).append(","); if (getAttackProperties() != null) sb.append("AttackProperties: ").append(getAttackProperties()).append(","); if (getMitigations() != null) sb.append("Mitigations: ").append(getMitigations()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof AttackDetail == false) return false; AttackDetail other = (AttackDetail) obj; if (other.getAttackId() == null ^ this.getAttackId() == null) return false; if (other.getAttackId() != null && other.getAttackId().equals(this.getAttackId()) == false) return false; if (other.getResourceArn() == null ^ this.getResourceArn() == null) return false; if (other.getResourceArn() != null && other.getResourceArn().equals(this.getResourceArn()) == false) return false; if (other.getSubResources() == null ^ this.getSubResources() == null) return false; if (other.getSubResources() != null && other.getSubResources().equals(this.getSubResources()) == false) return false; if (other.getStartTime() == null ^ this.getStartTime() == null) return false; if (other.getStartTime() != null && other.getStartTime().equals(this.getStartTime()) == false) return false; if (other.getEndTime() == null ^ this.getEndTime() == null) return false; if (other.getEndTime() != null && other.getEndTime().equals(this.getEndTime()) == false) return false; if (other.getAttackCounters() == null ^ this.getAttackCounters() == null) return false; if (other.getAttackCounters() != null && other.getAttackCounters().equals(this.getAttackCounters()) == false) return false; if (other.getAttackProperties() == null ^ this.getAttackProperties() == null) return false; if (other.getAttackProperties() != null && other.getAttackProperties().equals(this.getAttackProperties()) == false) return false; if (other.getMitigations() == null ^ this.getMitigations() == null) return false; if (other.getMitigations() != null && other.getMitigations().equals(this.getMitigations()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getAttackId() == null) ? 0 : getAttackId().hashCode()); hashCode = prime * hashCode + ((getResourceArn() == null) ? 0 : getResourceArn().hashCode()); hashCode = prime * hashCode + ((getSubResources() == null) ? 0 : getSubResources().hashCode()); hashCode = prime * hashCode + ((getStartTime() == null) ? 0 : getStartTime().hashCode()); hashCode = prime * hashCode + ((getEndTime() == null) ? 0 : getEndTime().hashCode()); hashCode = prime * hashCode + ((getAttackCounters() == null) ? 0 : getAttackCounters().hashCode()); hashCode = prime * hashCode + ((getAttackProperties() == null) ? 0 : getAttackProperties().hashCode()); hashCode = prime * hashCode + ((getMitigations() == null) ? 0 : getMitigations().hashCode()); return hashCode; } @Override public AttackDetail clone() { try { return (AttackDetail) 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.shield.model.transform.AttackDetailMarshaller.getInstance().marshall(this, protocolMarshaller); } }