software.amazon.awssdk.services.shield.model.AttackSummary Maven / Gradle / Ivy
/*
* Copyright 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 software.amazon.awssdk.services.shield.model;
import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Summarizes all DDoS attacks for a specified time period.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AttackSummary implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ATTACK_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AttackId").getter(getter(AttackSummary::attackId)).setter(setter(Builder::attackId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AttackId").build()).build();
private static final SdkField RESOURCE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResourceArn").getter(getter(AttackSummary::resourceArn)).setter(setter(Builder::resourceArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceArn").build()).build();
private static final SdkField START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("StartTime").getter(getter(AttackSummary::startTime)).setter(setter(Builder::startTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartTime").build()).build();
private static final SdkField END_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("EndTime").getter(getter(AttackSummary::endTime)).setter(setter(Builder::endTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndTime").build()).build();
private static final SdkField> ATTACK_VECTORS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("AttackVectors")
.getter(getter(AttackSummary::attackVectors))
.setter(setter(Builder::attackVectors))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AttackVectors").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(AttackVectorDescription::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ATTACK_ID_FIELD,
RESOURCE_ARN_FIELD, START_TIME_FIELD, END_TIME_FIELD, ATTACK_VECTORS_FIELD));
private static final long serialVersionUID = 1L;
private final String attackId;
private final String resourceArn;
private final Instant startTime;
private final Instant endTime;
private final List attackVectors;
private AttackSummary(BuilderImpl builder) {
this.attackId = builder.attackId;
this.resourceArn = builder.resourceArn;
this.startTime = builder.startTime;
this.endTime = builder.endTime;
this.attackVectors = builder.attackVectors;
}
/**
*
* The unique identifier (ID) of the attack.
*
*
* @return The unique identifier (ID) of the attack.
*/
public final String attackId() {
return attackId;
}
/**
*
* The ARN (Amazon Resource Name) of the resource that was attacked.
*
*
* @return The ARN (Amazon Resource Name) of the resource that was attacked.
*/
public final String resourceArn() {
return resourceArn;
}
/**
*
* The start time of the attack, in Unix time in seconds. For more information see timestamp.
*
*
* @return The start time of the attack, in Unix time in seconds. For more information see timestamp.
*/
public final Instant startTime() {
return startTime;
}
/**
*
* The end time of the attack, in Unix time in seconds. For more information see timestamp.
*
*
* @return The end time of the attack, in Unix time in seconds. For more information see timestamp.
*/
public final Instant endTime() {
return endTime;
}
/**
* Returns true if the AttackVectors property was specified by the sender (it may be empty), or false if the sender
* did not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public final boolean hasAttackVectors() {
return attackVectors != null && !(attackVectors instanceof SdkAutoConstructList);
}
/**
*
* The list of attacks for a specified time period.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasAttackVectors()} to see if a value was sent in this field.
*
*
* @return The list of attacks for a specified time period.
*/
public final List attackVectors() {
return attackVectors;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(attackId());
hashCode = 31 * hashCode + Objects.hashCode(resourceArn());
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(endTime());
hashCode = 31 * hashCode + Objects.hashCode(hasAttackVectors() ? attackVectors() : null);
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof AttackSummary)) {
return false;
}
AttackSummary other = (AttackSummary) obj;
return Objects.equals(attackId(), other.attackId()) && Objects.equals(resourceArn(), other.resourceArn())
&& Objects.equals(startTime(), other.startTime()) && Objects.equals(endTime(), other.endTime())
&& hasAttackVectors() == other.hasAttackVectors() && Objects.equals(attackVectors(), other.attackVectors());
}
/**
* 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.
*/
@Override
public final String toString() {
return ToString.builder("AttackSummary").add("AttackId", attackId()).add("ResourceArn", resourceArn())
.add("StartTime", startTime()).add("EndTime", endTime())
.add("AttackVectors", hasAttackVectors() ? attackVectors() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AttackId":
return Optional.ofNullable(clazz.cast(attackId()));
case "ResourceArn":
return Optional.ofNullable(clazz.cast(resourceArn()));
case "StartTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "EndTime":
return Optional.ofNullable(clazz.cast(endTime()));
case "AttackVectors":
return Optional.ofNullable(clazz.cast(attackVectors()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy