Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.guardduty.model.AwsApiCallAction Maven / Gradle / Ivy
Go to download
The AWS Java SDK for Amazon GuardDuty module holds the client classes that are used for communicating
with Amazon GuardDuty Service
/*
* 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.guardduty.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
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.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Contains information about the API action.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AwsApiCallAction implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField API_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Api")
.getter(getter(AwsApiCallAction::api)).setter(setter(Builder::api))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("api").build()).build();
private static final SdkField CALLER_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CallerType").getter(getter(AwsApiCallAction::callerType)).setter(setter(Builder::callerType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("callerType").build()).build();
private static final SdkField DOMAIN_DETAILS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("DomainDetails")
.getter(getter(AwsApiCallAction::domainDetails)).setter(setter(Builder::domainDetails))
.constructor(DomainDetails::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("domainDetails").build()).build();
private static final SdkField ERROR_CODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ErrorCode").getter(getter(AwsApiCallAction::errorCode)).setter(setter(Builder::errorCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("errorCode").build()).build();
private static final SdkField USER_AGENT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("UserAgent").getter(getter(AwsApiCallAction::userAgent)).setter(setter(Builder::userAgent))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("userAgent").build()).build();
private static final SdkField REMOTE_IP_DETAILS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("RemoteIpDetails")
.getter(getter(AwsApiCallAction::remoteIpDetails)).setter(setter(Builder::remoteIpDetails))
.constructor(RemoteIpDetails::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("remoteIpDetails").build()).build();
private static final SdkField SERVICE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ServiceName").getter(getter(AwsApiCallAction::serviceName)).setter(setter(Builder::serviceName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("serviceName").build()).build();
private static final SdkField REMOTE_ACCOUNT_DETAILS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("RemoteAccountDetails")
.getter(getter(AwsApiCallAction::remoteAccountDetails)).setter(setter(Builder::remoteAccountDetails))
.constructor(RemoteAccountDetails::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("remoteAccountDetails").build())
.build();
private static final SdkField> AFFECTED_RESOURCES_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("AffectedResources")
.getter(getter(AwsApiCallAction::affectedResources))
.setter(setter(Builder::affectedResources))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("affectedResources").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(API_FIELD, CALLER_TYPE_FIELD,
DOMAIN_DETAILS_FIELD, ERROR_CODE_FIELD, USER_AGENT_FIELD, REMOTE_IP_DETAILS_FIELD, SERVICE_NAME_FIELD,
REMOTE_ACCOUNT_DETAILS_FIELD, AFFECTED_RESOURCES_FIELD));
private static final long serialVersionUID = 1L;
private final String api;
private final String callerType;
private final DomainDetails domainDetails;
private final String errorCode;
private final String userAgent;
private final RemoteIpDetails remoteIpDetails;
private final String serviceName;
private final RemoteAccountDetails remoteAccountDetails;
private final Map affectedResources;
private AwsApiCallAction(BuilderImpl builder) {
this.api = builder.api;
this.callerType = builder.callerType;
this.domainDetails = builder.domainDetails;
this.errorCode = builder.errorCode;
this.userAgent = builder.userAgent;
this.remoteIpDetails = builder.remoteIpDetails;
this.serviceName = builder.serviceName;
this.remoteAccountDetails = builder.remoteAccountDetails;
this.affectedResources = builder.affectedResources;
}
/**
*
* The Amazon Web Services API name.
*
*
* @return The Amazon Web Services API name.
*/
public final String api() {
return api;
}
/**
*
* The Amazon Web Services API caller type.
*
*
* @return The Amazon Web Services API caller type.
*/
public final String callerType() {
return callerType;
}
/**
*
* The domain information for the Amazon Web Services API call.
*
*
* @return The domain information for the Amazon Web Services API call.
*/
public final DomainDetails domainDetails() {
return domainDetails;
}
/**
*
* The error code of the failed Amazon Web Services API action.
*
*
* @return The error code of the failed Amazon Web Services API action.
*/
public final String errorCode() {
return errorCode;
}
/**
*
* The agent through which the API request was made.
*
*
* @return The agent through which the API request was made.
*/
public final String userAgent() {
return userAgent;
}
/**
*
* The remote IP information of the connection that initiated the Amazon Web Services API call.
*
*
* @return The remote IP information of the connection that initiated the Amazon Web Services API call.
*/
public final RemoteIpDetails remoteIpDetails() {
return remoteIpDetails;
}
/**
*
* The Amazon Web Services service name whose API was invoked.
*
*
* @return The Amazon Web Services service name whose API was invoked.
*/
public final String serviceName() {
return serviceName;
}
/**
*
* The details of the Amazon Web Services account that made the API call. This field appears if the call was made
* from outside your account.
*
*
* @return The details of the Amazon Web Services account that made the API call. This field appears if the call was
* made from outside your account.
*/
public final RemoteAccountDetails remoteAccountDetails() {
return remoteAccountDetails;
}
/**
* For responses, this returns true if the service returned a value for the AffectedResources property. This DOES
* NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasAffectedResources() {
return affectedResources != null && !(affectedResources instanceof SdkAutoConstructMap);
}
/**
*
* The details of the Amazon Web Services account that made the API call. This field identifies the resources that
* were affected by this API call.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasAffectedResources} method.
*
*
* @return The details of the Amazon Web Services account that made the API call. This field identifies the
* resources that were affected by this API call.
*/
public final Map affectedResources() {
return affectedResources;
}
@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(callerType());
hashCode = 31 * hashCode + Objects.hashCode(domainDetails());
hashCode = 31 * hashCode + Objects.hashCode(errorCode());
hashCode = 31 * hashCode + Objects.hashCode(userAgent());
hashCode = 31 * hashCode + Objects.hashCode(remoteIpDetails());
hashCode = 31 * hashCode + Objects.hashCode(serviceName());
hashCode = 31 * hashCode + Objects.hashCode(remoteAccountDetails());
hashCode = 31 * hashCode + Objects.hashCode(hasAffectedResources() ? affectedResources() : null);
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 AwsApiCallAction)) {
return false;
}
AwsApiCallAction other = (AwsApiCallAction) obj;
return Objects.equals(api(), other.api()) && Objects.equals(callerType(), other.callerType())
&& Objects.equals(domainDetails(), other.domainDetails()) && Objects.equals(errorCode(), other.errorCode())
&& Objects.equals(userAgent(), other.userAgent()) && Objects.equals(remoteIpDetails(), other.remoteIpDetails())
&& Objects.equals(serviceName(), other.serviceName())
&& Objects.equals(remoteAccountDetails(), other.remoteAccountDetails())
&& hasAffectedResources() == other.hasAffectedResources()
&& Objects.equals(affectedResources(), other.affectedResources());
}
/**
* 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("AwsApiCallAction").add("Api", api()).add("CallerType", callerType())
.add("DomainDetails", domainDetails()).add("ErrorCode", errorCode()).add("UserAgent", userAgent())
.add("RemoteIpDetails", remoteIpDetails()).add("ServiceName", serviceName())
.add("RemoteAccountDetails", remoteAccountDetails())
.add("AffectedResources", hasAffectedResources() ? affectedResources() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Api":
return Optional.ofNullable(clazz.cast(api()));
case "CallerType":
return Optional.ofNullable(clazz.cast(callerType()));
case "DomainDetails":
return Optional.ofNullable(clazz.cast(domainDetails()));
case "ErrorCode":
return Optional.ofNullable(clazz.cast(errorCode()));
case "UserAgent":
return Optional.ofNullable(clazz.cast(userAgent()));
case "RemoteIpDetails":
return Optional.ofNullable(clazz.cast(remoteIpDetails()));
case "ServiceName":
return Optional.ofNullable(clazz.cast(serviceName()));
case "RemoteAccountDetails":
return Optional.ofNullable(clazz.cast(remoteAccountDetails()));
case "AffectedResources":
return Optional.ofNullable(clazz.cast(affectedResources()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((AwsApiCallAction) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SdkPojo, CopyableBuilder {
/**
*
* The Amazon Web Services API name.
*
*
* @param api
* The Amazon Web Services API name.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder api(String api);
/**
*
* The Amazon Web Services API caller type.
*
*
* @param callerType
* The Amazon Web Services API caller type.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder callerType(String callerType);
/**
*
* The domain information for the Amazon Web Services API call.
*
*
* @param domainDetails
* The domain information for the Amazon Web Services API call.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder domainDetails(DomainDetails domainDetails);
/**
*
* The domain information for the Amazon Web Services API call.
*
* This is a convenience method that creates an instance of the {@link DomainDetails.Builder} avoiding the need
* to create one manually via {@link DomainDetails#builder()}.
*
*
* When the {@link Consumer} completes, {@link DomainDetails.Builder#build()} is called immediately and its
* result is passed to {@link #domainDetails(DomainDetails)}.
*
* @param domainDetails
* a consumer that will call methods on {@link DomainDetails.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #domainDetails(DomainDetails)
*/
default Builder domainDetails(Consumer domainDetails) {
return domainDetails(DomainDetails.builder().applyMutation(domainDetails).build());
}
/**
*
* The error code of the failed Amazon Web Services API action.
*
*
* @param errorCode
* The error code of the failed Amazon Web Services API action.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder errorCode(String errorCode);
/**
*
* The agent through which the API request was made.
*
*
* @param userAgent
* The agent through which the API request was made.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder userAgent(String userAgent);
/**
*
* The remote IP information of the connection that initiated the Amazon Web Services API call.
*
*
* @param remoteIpDetails
* The remote IP information of the connection that initiated the Amazon Web Services API call.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder remoteIpDetails(RemoteIpDetails remoteIpDetails);
/**
*
* The remote IP information of the connection that initiated the Amazon Web Services API call.
*
* This is a convenience method that creates an instance of the {@link RemoteIpDetails.Builder} avoiding the
* need to create one manually via {@link RemoteIpDetails#builder()}.
*
*
* When the {@link Consumer} completes, {@link RemoteIpDetails.Builder#build()} is called immediately and its
* result is passed to {@link #remoteIpDetails(RemoteIpDetails)}.
*
* @param remoteIpDetails
* a consumer that will call methods on {@link RemoteIpDetails.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #remoteIpDetails(RemoteIpDetails)
*/
default Builder remoteIpDetails(Consumer remoteIpDetails) {
return remoteIpDetails(RemoteIpDetails.builder().applyMutation(remoteIpDetails).build());
}
/**
*
* The Amazon Web Services service name whose API was invoked.
*
*
* @param serviceName
* The Amazon Web Services service name whose API was invoked.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder serviceName(String serviceName);
/**
*
* The details of the Amazon Web Services account that made the API call. This field appears if the call was
* made from outside your account.
*
*
* @param remoteAccountDetails
* The details of the Amazon Web Services account that made the API call. This field appears if the call
* was made from outside your account.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder remoteAccountDetails(RemoteAccountDetails remoteAccountDetails);
/**
*
* The details of the Amazon Web Services account that made the API call. This field appears if the call was
* made from outside your account.
*
* This is a convenience method that creates an instance of the {@link RemoteAccountDetails.Builder} avoiding
* the need to create one manually via {@link RemoteAccountDetails#builder()}.
*
*
* When the {@link Consumer} completes, {@link RemoteAccountDetails.Builder#build()} is called immediately and
* its result is passed to {@link #remoteAccountDetails(RemoteAccountDetails)}.
*
* @param remoteAccountDetails
* a consumer that will call methods on {@link RemoteAccountDetails.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #remoteAccountDetails(RemoteAccountDetails)
*/
default Builder remoteAccountDetails(Consumer remoteAccountDetails) {
return remoteAccountDetails(RemoteAccountDetails.builder().applyMutation(remoteAccountDetails).build());
}
/**
*
* The details of the Amazon Web Services account that made the API call. This field identifies the resources
* that were affected by this API call.
*
*
* @param affectedResources
* The details of the Amazon Web Services account that made the API call. This field identifies the
* resources that were affected by this API call.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder affectedResources(Map affectedResources);
}
static final class BuilderImpl implements Builder {
private String api;
private String callerType;
private DomainDetails domainDetails;
private String errorCode;
private String userAgent;
private RemoteIpDetails remoteIpDetails;
private String serviceName;
private RemoteAccountDetails remoteAccountDetails;
private Map affectedResources = DefaultSdkAutoConstructMap.getInstance();
private BuilderImpl() {
}
private BuilderImpl(AwsApiCallAction model) {
api(model.api);
callerType(model.callerType);
domainDetails(model.domainDetails);
errorCode(model.errorCode);
userAgent(model.userAgent);
remoteIpDetails(model.remoteIpDetails);
serviceName(model.serviceName);
remoteAccountDetails(model.remoteAccountDetails);
affectedResources(model.affectedResources);
}
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 getCallerType() {
return callerType;
}
public final void setCallerType(String callerType) {
this.callerType = callerType;
}
@Override
public final Builder callerType(String callerType) {
this.callerType = callerType;
return this;
}
public final DomainDetails.Builder getDomainDetails() {
return domainDetails != null ? domainDetails.toBuilder() : null;
}
public final void setDomainDetails(DomainDetails.BuilderImpl domainDetails) {
this.domainDetails = domainDetails != null ? domainDetails.build() : null;
}
@Override
public final Builder domainDetails(DomainDetails domainDetails) {
this.domainDetails = domainDetails;
return this;
}
public final String getErrorCode() {
return errorCode;
}
public final void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
@Override
public final Builder errorCode(String errorCode) {
this.errorCode = errorCode;
return this;
}
public final String getUserAgent() {
return userAgent;
}
public final void setUserAgent(String userAgent) {
this.userAgent = userAgent;
}
@Override
public final Builder userAgent(String userAgent) {
this.userAgent = userAgent;
return this;
}
public final RemoteIpDetails.Builder getRemoteIpDetails() {
return remoteIpDetails != null ? remoteIpDetails.toBuilder() : null;
}
public final void setRemoteIpDetails(RemoteIpDetails.BuilderImpl remoteIpDetails) {
this.remoteIpDetails = remoteIpDetails != null ? remoteIpDetails.build() : null;
}
@Override
public final Builder remoteIpDetails(RemoteIpDetails remoteIpDetails) {
this.remoteIpDetails = remoteIpDetails;
return this;
}
public final String getServiceName() {
return serviceName;
}
public final void setServiceName(String serviceName) {
this.serviceName = serviceName;
}
@Override
public final Builder serviceName(String serviceName) {
this.serviceName = serviceName;
return this;
}
public final RemoteAccountDetails.Builder getRemoteAccountDetails() {
return remoteAccountDetails != null ? remoteAccountDetails.toBuilder() : null;
}
public final void setRemoteAccountDetails(RemoteAccountDetails.BuilderImpl remoteAccountDetails) {
this.remoteAccountDetails = remoteAccountDetails != null ? remoteAccountDetails.build() : null;
}
@Override
public final Builder remoteAccountDetails(RemoteAccountDetails remoteAccountDetails) {
this.remoteAccountDetails = remoteAccountDetails;
return this;
}
public final Map getAffectedResources() {
if (affectedResources instanceof SdkAutoConstructMap) {
return null;
}
return affectedResources;
}
public final void setAffectedResources(Map affectedResources) {
this.affectedResources = AffectedResourcesCopier.copy(affectedResources);
}
@Override
public final Builder affectedResources(Map affectedResources) {
this.affectedResources = AffectedResourcesCopier.copy(affectedResources);
return this;
}
@Override
public AwsApiCallAction build() {
return new AwsApiCallAction(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}