software.amazon.awssdk.services.securityhub.model.ThreatIntelIndicator 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.securityhub.model;
import java.io.Serializable;
import java.util.Arrays;
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.Function;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Details about the threat intelligence related to a finding.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ThreatIntelIndicator implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Type")
.getter(getter(ThreatIntelIndicator::typeAsString)).setter(setter(Builder::type))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Type").build()).build();
private static final SdkField VALUE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Value")
.getter(getter(ThreatIntelIndicator::value)).setter(setter(Builder::value))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Value").build()).build();
private static final SdkField CATEGORY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Category").getter(getter(ThreatIntelIndicator::categoryAsString)).setter(setter(Builder::category))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Category").build()).build();
private static final SdkField LAST_OBSERVED_AT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LastObservedAt").getter(getter(ThreatIntelIndicator::lastObservedAt))
.setter(setter(Builder::lastObservedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastObservedAt").build()).build();
private static final SdkField SOURCE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Source")
.getter(getter(ThreatIntelIndicator::source)).setter(setter(Builder::source))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Source").build()).build();
private static final SdkField SOURCE_URL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SourceUrl").getter(getter(ThreatIntelIndicator::sourceUrl)).setter(setter(Builder::sourceUrl))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceUrl").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TYPE_FIELD, VALUE_FIELD,
CATEGORY_FIELD, LAST_OBSERVED_AT_FIELD, SOURCE_FIELD, SOURCE_URL_FIELD));
private static final long serialVersionUID = 1L;
private final String type;
private final String value;
private final String category;
private final String lastObservedAt;
private final String source;
private final String sourceUrl;
private ThreatIntelIndicator(BuilderImpl builder) {
this.type = builder.type;
this.value = builder.value;
this.category = builder.category;
this.lastObservedAt = builder.lastObservedAt;
this.source = builder.source;
this.sourceUrl = builder.sourceUrl;
}
/**
*
* The type of threat intelligence indicator.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link ThreatIntelIndicatorType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The type of threat intelligence indicator.
* @see ThreatIntelIndicatorType
*/
public final ThreatIntelIndicatorType type() {
return ThreatIntelIndicatorType.fromValue(type);
}
/**
*
* The type of threat intelligence indicator.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link ThreatIntelIndicatorType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The type of threat intelligence indicator.
* @see ThreatIntelIndicatorType
*/
public final String typeAsString() {
return type;
}
/**
*
* The value of a threat intelligence indicator.
*
*
* @return The value of a threat intelligence indicator.
*/
public final String value() {
return value;
}
/**
*
* The category of a threat intelligence indicator.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #category} will
* return {@link ThreatIntelIndicatorCategory#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #categoryAsString}.
*
*
* @return The category of a threat intelligence indicator.
* @see ThreatIntelIndicatorCategory
*/
public final ThreatIntelIndicatorCategory category() {
return ThreatIntelIndicatorCategory.fromValue(category);
}
/**
*
* The category of a threat intelligence indicator.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #category} will
* return {@link ThreatIntelIndicatorCategory#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #categoryAsString}.
*
*
* @return The category of a threat intelligence indicator.
* @see ThreatIntelIndicatorCategory
*/
public final String categoryAsString() {
return category;
}
/**
*
* Indicates when the most recent instance of a threat intelligence indicator was observed.
*
*
* Uses the date-time format specified in RFC
* 3339 section 5.6, Internet Date/Time Format. The value cannot contain spaces, and date and time should be
* separated by T. For example, 2020-03-22T13:22:13.933Z.
*
*
* @return Indicates when the most recent instance of a threat intelligence indicator was observed.
*
* Uses the date-time format specified in RFC 3339 section 5.6, Internet Date/Time
* Format. The value cannot contain spaces, and date and time should be separated by T. For
* example, 2020-03-22T13:22:13.933Z.
*/
public final String lastObservedAt() {
return lastObservedAt;
}
/**
*
* The source of the threat intelligence indicator.
*
*
* @return The source of the threat intelligence indicator.
*/
public final String source() {
return source;
}
/**
*
* The URL to the page or site where you can get more information about the threat intelligence indicator.
*
*
* @return The URL to the page or site where you can get more information about the threat intelligence indicator.
*/
public final String sourceUrl() {
return sourceUrl;
}
@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(typeAsString());
hashCode = 31 * hashCode + Objects.hashCode(value());
hashCode = 31 * hashCode + Objects.hashCode(categoryAsString());
hashCode = 31 * hashCode + Objects.hashCode(lastObservedAt());
hashCode = 31 * hashCode + Objects.hashCode(source());
hashCode = 31 * hashCode + Objects.hashCode(sourceUrl());
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 ThreatIntelIndicator)) {
return false;
}
ThreatIntelIndicator other = (ThreatIntelIndicator) obj;
return Objects.equals(typeAsString(), other.typeAsString()) && Objects.equals(value(), other.value())
&& Objects.equals(categoryAsString(), other.categoryAsString())
&& Objects.equals(lastObservedAt(), other.lastObservedAt()) && Objects.equals(source(), other.source())
&& Objects.equals(sourceUrl(), other.sourceUrl());
}
/**
* 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("ThreatIntelIndicator").add("Type", typeAsString()).add("Value", value())
.add("Category", categoryAsString()).add("LastObservedAt", lastObservedAt()).add("Source", source())
.add("SourceUrl", sourceUrl()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Type":
return Optional.ofNullable(clazz.cast(typeAsString()));
case "Value":
return Optional.ofNullable(clazz.cast(value()));
case "Category":
return Optional.ofNullable(clazz.cast(categoryAsString()));
case "LastObservedAt":
return Optional.ofNullable(clazz.cast(lastObservedAt()));
case "Source":
return Optional.ofNullable(clazz.cast(source()));
case "SourceUrl":
return Optional.ofNullable(clazz.cast(sourceUrl()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function