All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.shield.model.AttackSummary Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Shield module holds the client classes that are used for communicating with AWS Shield.

There is a newer version: 2.29.39
Show newest version
/*
 * Copyright 2014-2019 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.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) .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) .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) .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) .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) .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 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 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 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 Instant endTime() { return endTime; } /** *

* The list of attacks for a specified time period. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

* * @return The list of attacks for a specified time period. */ public List attackVectors() { return attackVectors; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public 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(attackVectors()); return hashCode; } @Override public boolean equals(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()) && 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 String toString() { return ToString.builder("AttackSummary").add("AttackId", attackId()).add("ResourceArn", resourceArn()) .add("StartTime", startTime()).add("EndTime", endTime()).add("AttackVectors", attackVectors()).build(); } public 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 List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((AttackSummary) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* 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. */ Builder attackId(String attackId); /** *

* 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. */ Builder resourceArn(String resourceArn); /** *

* The start time of the attack, in Unix time in seconds. For more information see timestamp. *

* * @param startTime * The start time of the attack, in Unix time in seconds. For more information see timestamp. * @return Returns a reference to this object so that method calls can be chained together. */ Builder startTime(Instant startTime); /** *

* The end time of the attack, in Unix time in seconds. For more information see timestamp. *

* * @param endTime * The end time of the attack, in Unix time in seconds. For more information see timestamp. * @return Returns a reference to this object so that method calls can be chained together. */ Builder endTime(Instant endTime); /** *

* The list of attacks for a specified time period. *

* * @param attackVectors * The list of attacks for a specified time period. * @return Returns a reference to this object so that method calls can be chained together. */ Builder attackVectors(Collection attackVectors); /** *

* The list of attacks for a specified time period. *

* * @param attackVectors * The list of attacks for a specified time period. * @return Returns a reference to this object so that method calls can be chained together. */ Builder attackVectors(AttackVectorDescription... attackVectors); /** *

* The list of attacks for a specified time period. *

* This is a convenience that creates an instance of the {@link List.Builder} avoiding * the need to create one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called * immediately and its result is passed to {@link #attackVectors(List)}. * * @param attackVectors * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #attackVectors(List) */ Builder attackVectors(Consumer... attackVectors); } static final class BuilderImpl implements Builder { private String attackId; private String resourceArn; private Instant startTime; private Instant endTime; private List attackVectors = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(AttackSummary model) { attackId(model.attackId); resourceArn(model.resourceArn); startTime(model.startTime); endTime(model.endTime); attackVectors(model.attackVectors); } public final String getAttackId() { return attackId; } @Override public final Builder attackId(String attackId) { this.attackId = attackId; return this; } public final void setAttackId(String attackId) { this.attackId = attackId; } public final String getResourceArn() { return resourceArn; } @Override public final Builder resourceArn(String resourceArn) { this.resourceArn = resourceArn; return this; } public final void setResourceArn(String resourceArn) { this.resourceArn = resourceArn; } public final Instant getStartTime() { return startTime; } @Override public final Builder startTime(Instant startTime) { this.startTime = startTime; return this; } public final void setStartTime(Instant startTime) { this.startTime = startTime; } public final Instant getEndTime() { return endTime; } @Override public final Builder endTime(Instant endTime) { this.endTime = endTime; return this; } public final void setEndTime(Instant endTime) { this.endTime = endTime; } public final Collection getAttackVectors() { return attackVectors != null ? attackVectors.stream().map(AttackVectorDescription::toBuilder) .collect(Collectors.toList()) : null; } @Override public final Builder attackVectors(Collection attackVectors) { this.attackVectors = AttackVectorDescriptionListCopier.copy(attackVectors); return this; } @Override @SafeVarargs public final Builder attackVectors(AttackVectorDescription... attackVectors) { attackVectors(Arrays.asList(attackVectors)); return this; } @Override @SafeVarargs public final Builder attackVectors(Consumer... attackVectors) { attackVectors(Stream.of(attackVectors).map(c -> AttackVectorDescription.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final void setAttackVectors(Collection attackVectors) { this.attackVectors = AttackVectorDescriptionListCopier.copyFromBuilder(attackVectors); } @Override public AttackSummary build() { return new AttackSummary(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy