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

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 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 getter(Function g) { return obj -> g.apply((ApiCallDetails) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The name of the operation that was invoked most recently and produced the finding. *

* * @param api * The name of the operation that was invoked most recently and produced the finding. * @return Returns a reference to this object so that method calls can be chained together. */ Builder api(String api); /** *

* The URL of the Amazon Web Service that provides the operation, for example: s3.amazonaws.com. *

* * @param apiServiceName * The URL of the Amazon Web Service that provides the operation, for example: s3.amazonaws.com. * @return Returns a reference to this object so that method calls can be chained together. */ Builder apiServiceName(String apiServiceName); /** *

* The first date and time, in UTC and extended ISO 8601 format, when any operation was invoked and produced the * finding. *

* * @param firstSeen * The first date and time, in UTC and extended ISO 8601 format, when any operation was invoked and * produced the finding. * @return Returns a reference to this object so that method calls can be chained together. */ Builder firstSeen(Instant 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. *

* * @param lastSeen * 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 Returns a reference to this object so that method calls can be chained together. */ Builder lastSeen(Instant lastSeen); } static final class BuilderImpl implements Builder { private String api; private String apiServiceName; private Instant firstSeen; private Instant lastSeen; private BuilderImpl() { } private BuilderImpl(ApiCallDetails model) { api(model.api); apiServiceName(model.apiServiceName); firstSeen(model.firstSeen); lastSeen(model.lastSeen); } public final String getApi() { return api; } public final void setApi(String api) { this.api = api; } @Override public final Builder api(String api) { this.api = api; return this; } public final String getApiServiceName() { return apiServiceName; } public final void setApiServiceName(String apiServiceName) { this.apiServiceName = apiServiceName; } @Override public final Builder apiServiceName(String apiServiceName) { this.apiServiceName = apiServiceName; return this; } public final Instant getFirstSeen() { return firstSeen; } public final void setFirstSeen(Instant firstSeen) { this.firstSeen = firstSeen; } @Override public final Builder firstSeen(Instant firstSeen) { this.firstSeen = firstSeen; return this; } public final Instant getLastSeen() { return lastSeen; } public final void setLastSeen(Instant lastSeen) { this.lastSeen = lastSeen; } @Override public final Builder lastSeen(Instant lastSeen) { this.lastSeen = lastSeen; return this; } @Override public ApiCallDetails build() { return new ApiCallDetails(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy