software.amazon.awssdk.services.detective.model.InvestigationDetail Maven / Gradle / Ivy
Show all versions of detective Show documentation
/*
* 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.detective.model;
import java.io.Serializable;
import java.time.Instant;
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.core.traits.TimestampFormatTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Details about the investigation related to a potential security event identified by Detective.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class InvestigationDetail implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField INVESTIGATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InvestigationId").getter(getter(InvestigationDetail::investigationId))
.setter(setter(Builder::investigationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InvestigationId").build()).build();
private static final SdkField SEVERITY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Severity").getter(getter(InvestigationDetail::severityAsString)).setter(setter(Builder::severity))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Severity").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(InvestigationDetail::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
.getter(getter(InvestigationDetail::stateAsString)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build();
private static final SdkField CREATED_TIME_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("CreatedTime")
.getter(getter(InvestigationDetail::createdTime))
.setter(setter(Builder::createdTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedTime").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final SdkField ENTITY_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EntityArn").getter(getter(InvestigationDetail::entityArn)).setter(setter(Builder::entityArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EntityArn").build()).build();
private static final SdkField ENTITY_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EntityType").getter(getter(InvestigationDetail::entityTypeAsString)).setter(setter(Builder::entityType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EntityType").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(INVESTIGATION_ID_FIELD,
SEVERITY_FIELD, STATUS_FIELD, STATE_FIELD, CREATED_TIME_FIELD, ENTITY_ARN_FIELD, ENTITY_TYPE_FIELD));
private static final long serialVersionUID = 1L;
private final String investigationId;
private final String severity;
private final String status;
private final String state;
private final Instant createdTime;
private final String entityArn;
private final String entityType;
private InvestigationDetail(BuilderImpl builder) {
this.investigationId = builder.investigationId;
this.severity = builder.severity;
this.status = builder.status;
this.state = builder.state;
this.createdTime = builder.createdTime;
this.entityArn = builder.entityArn;
this.entityType = builder.entityType;
}
/**
*
* The investigation ID of the investigation report.
*
*
* @return The investigation ID of the investigation report.
*/
public final String investigationId() {
return investigationId;
}
/**
*
* Severity based on the likelihood and impact of the indicators of compromise discovered in the investigation.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #severity} will
* return {@link Severity#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #severityAsString}.
*
*
* @return Severity based on the likelihood and impact of the indicators of compromise discovered in the
* investigation.
* @see Severity
*/
public final Severity severity() {
return Severity.fromValue(severity);
}
/**
*
* Severity based on the likelihood and impact of the indicators of compromise discovered in the investigation.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #severity} will
* return {@link Severity#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #severityAsString}.
*
*
* @return Severity based on the likelihood and impact of the indicators of compromise discovered in the
* investigation.
* @see Severity
*/
public final String severityAsString() {
return severity;
}
/**
*
* Status based on the completion status of the investigation.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link Status#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return Status based on the completion status of the investigation.
* @see Status
*/
public final Status status() {
return Status.fromValue(status);
}
/**
*
* Status based on the completion status of the investigation.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link Status#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return Status based on the completion status of the investigation.
* @see Status
*/
public final String statusAsString() {
return status;
}
/**
*
* The current state of the investigation. An archived investigation indicates you have completed reviewing the
* investigation.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link State#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The current state of the investigation. An archived investigation indicates you have completed reviewing
* the investigation.
* @see State
*/
public final State state() {
return State.fromValue(state);
}
/**
*
* The current state of the investigation. An archived investigation indicates you have completed reviewing the
* investigation.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link State#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The current state of the investigation. An archived investigation indicates you have completed reviewing
* the investigation.
* @see State
*/
public final String stateAsString() {
return state;
}
/**
*
* The time stamp of the creation time of the investigation report. The value is an UTC ISO8601 formatted string.
* For example, 2021-08-18T16:35:56.284Z
.
*
*
* @return The time stamp of the creation time of the investigation report. The value is an UTC ISO8601 formatted
* string. For example, 2021-08-18T16:35:56.284Z
.
*/
public final Instant createdTime() {
return createdTime;
}
/**
*
* The unique Amazon Resource Name (ARN) of the IAM user and IAM role.
*
*
* @return The unique Amazon Resource Name (ARN) of the IAM user and IAM role.
*/
public final String entityArn() {
return entityArn;
}
/**
*
* Type of entity. For example, Amazon Web Services accounts, such as IAM user and role.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #entityType} will
* return {@link EntityType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #entityTypeAsString}.
*
*
* @return Type of entity. For example, Amazon Web Services accounts, such as IAM user and role.
* @see EntityType
*/
public final EntityType entityType() {
return EntityType.fromValue(entityType);
}
/**
*
* Type of entity. For example, Amazon Web Services accounts, such as IAM user and role.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #entityType} will
* return {@link EntityType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #entityTypeAsString}.
*
*
* @return Type of entity. For example, Amazon Web Services accounts, such as IAM user and role.
* @see EntityType
*/
public final String entityTypeAsString() {
return entityType;
}
@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(investigationId());
hashCode = 31 * hashCode + Objects.hashCode(severityAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(stateAsString());
hashCode = 31 * hashCode + Objects.hashCode(createdTime());
hashCode = 31 * hashCode + Objects.hashCode(entityArn());
hashCode = 31 * hashCode + Objects.hashCode(entityTypeAsString());
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 InvestigationDetail)) {
return false;
}
InvestigationDetail other = (InvestigationDetail) obj;
return Objects.equals(investigationId(), other.investigationId())
&& Objects.equals(severityAsString(), other.severityAsString())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(stateAsString(), other.stateAsString()) && Objects.equals(createdTime(), other.createdTime())
&& Objects.equals(entityArn(), other.entityArn())
&& Objects.equals(entityTypeAsString(), other.entityTypeAsString());
}
/**
* 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("InvestigationDetail").add("InvestigationId", investigationId())
.add("Severity", severityAsString()).add("Status", statusAsString()).add("State", stateAsString())
.add("CreatedTime", createdTime()).add("EntityArn", entityArn()).add("EntityType", entityTypeAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "InvestigationId":
return Optional.ofNullable(clazz.cast(investigationId()));
case "Severity":
return Optional.ofNullable(clazz.cast(severityAsString()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "State":
return Optional.ofNullable(clazz.cast(stateAsString()));
case "CreatedTime":
return Optional.ofNullable(clazz.cast(createdTime()));
case "EntityArn":
return Optional.ofNullable(clazz.cast(entityArn()));
case "EntityType":
return Optional.ofNullable(clazz.cast(entityTypeAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function