
software.amazon.awssdk.services.macie2.model.ApiCallDetails 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.macie2.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;
/**
*
* Provides information about an API operation that an entity invoked for an affected resource.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ApiCallDetails implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField API_FIELD = SdkField. builder(MarshallingType.STRING).memberName("api")
.getter(getter(ApiCallDetails::api)).setter(setter(Builder::api))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("api").build()).build();
private static final SdkField API_SERVICE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("apiServiceName").getter(getter(ApiCallDetails::apiServiceName)).setter(setter(Builder::apiServiceName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("apiServiceName").build()).build();
private static final SdkField FIRST_SEEN_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("firstSeen")
.getter(getter(ApiCallDetails::firstSeen))
.setter(setter(Builder::firstSeen))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("firstSeen").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final SdkField LAST_SEEN_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("lastSeen")
.getter(getter(ApiCallDetails::lastSeen))
.setter(setter(Builder::lastSeen))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastSeen").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(API_FIELD,
API_SERVICE_NAME_FIELD, FIRST_SEEN_FIELD, LAST_SEEN_FIELD));
private static final long serialVersionUID = 1L;
private final String api;
private final String apiServiceName;
private final Instant firstSeen;
private final Instant lastSeen;
private ApiCallDetails(BuilderImpl builder) {
this.api = builder.api;
this.apiServiceName = builder.apiServiceName;
this.firstSeen = builder.firstSeen;
this.lastSeen = builder.lastSeen;
}
/**
*
* The name of the operation that was invoked most recently and produced the finding.
*
*
* @return The name of the operation that was invoked most recently and produced the finding.
*/
public final String api() {
return api;
}
/**
*
* The URL of the Amazon Web Service that provides the operation, for example: s3.amazonaws.com.
*
*
* @return The URL of the Amazon Web Service that provides the operation, for example: s3.amazonaws.com.
*/
public final String apiServiceName() {
return apiServiceName;
}
/**
*
* The first date and time, in UTC and extended ISO 8601 format, when any operation was invoked and produced the
* finding.
*
*
* @return The first date and time, in UTC and extended ISO 8601 format, when any operation was invoked and produced
* the finding.
*/
public final Instant firstSeen() {
return firstSeen;
}
/**
*
* The most recent date and time, in UTC and extended ISO 8601 format, when the specified operation (api) was
* invoked and produced the finding.
*
*
* @return The most recent date and time, in UTC and extended ISO 8601 format, when the specified operation (api)
* was invoked and produced the finding.
*/
public final Instant lastSeen() {
return lastSeen;
}
@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(api());
hashCode = 31 * hashCode + Objects.hashCode(apiServiceName());
hashCode = 31 * hashCode + Objects.hashCode(firstSeen());
hashCode = 31 * hashCode + Objects.hashCode(lastSeen());
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 ApiCallDetails)) {
return false;
}
ApiCallDetails other = (ApiCallDetails) obj;
return Objects.equals(api(), other.api()) && Objects.equals(apiServiceName(), other.apiServiceName())
&& Objects.equals(firstSeen(), other.firstSeen()) && Objects.equals(lastSeen(), other.lastSeen());
}
/**
* 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("ApiCallDetails").add("Api", api()).add("ApiServiceName", apiServiceName())
.add("FirstSeen", firstSeen()).add("LastSeen", lastSeen()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "api":
return Optional.ofNullable(clazz.cast(api()));
case "apiServiceName":
return Optional.ofNullable(clazz.cast(apiServiceName()));
case "firstSeen":
return Optional.ofNullable(clazz.cast(firstSeen()));
case "lastSeen":
return Optional.ofNullable(clazz.cast(lastSeen()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy