
software.amazon.awssdk.services.lambda.model.GetEventSourceMappingResponse Maven / Gradle / Ivy
/*
* Copyright 2014-2019 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.lambda.model;
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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* A mapping between an AWS resource and an AWS Lambda function. See CreateEventSourceMapping for details.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class GetEventSourceMappingResponse extends LambdaResponse implements
ToCopyableBuilder {
private static final SdkField UUID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(GetEventSourceMappingResponse::uuid)).setter(setter(Builder::uuid))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UUID").build()).build();
private static final SdkField BATCH_SIZE_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(GetEventSourceMappingResponse::batchSize)).setter(setter(Builder::batchSize))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BatchSize").build()).build();
private static final SdkField EVENT_SOURCE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(GetEventSourceMappingResponse::eventSourceArn)).setter(setter(Builder::eventSourceArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EventSourceArn").build()).build();
private static final SdkField FUNCTION_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(GetEventSourceMappingResponse::functionArn)).setter(setter(Builder::functionArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FunctionArn").build()).build();
private static final SdkField LAST_MODIFIED_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(GetEventSourceMappingResponse::lastModified)).setter(setter(Builder::lastModified))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModified").build()).build();
private static final SdkField LAST_PROCESSING_RESULT_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(GetEventSourceMappingResponse::lastProcessingResult)).setter(setter(Builder::lastProcessingResult))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastProcessingResult").build())
.build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(GetEventSourceMappingResponse::state)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build();
private static final SdkField STATE_TRANSITION_REASON_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(GetEventSourceMappingResponse::stateTransitionReason)).setter(setter(Builder::stateTransitionReason))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StateTransitionReason").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(UUID_FIELD, BATCH_SIZE_FIELD,
EVENT_SOURCE_ARN_FIELD, FUNCTION_ARN_FIELD, LAST_MODIFIED_FIELD, LAST_PROCESSING_RESULT_FIELD, STATE_FIELD,
STATE_TRANSITION_REASON_FIELD));
private final String uuid;
private final Integer batchSize;
private final String eventSourceArn;
private final String functionArn;
private final Instant lastModified;
private final String lastProcessingResult;
private final String state;
private final String stateTransitionReason;
private GetEventSourceMappingResponse(BuilderImpl builder) {
super(builder);
this.uuid = builder.uuid;
this.batchSize = builder.batchSize;
this.eventSourceArn = builder.eventSourceArn;
this.functionArn = builder.functionArn;
this.lastModified = builder.lastModified;
this.lastProcessingResult = builder.lastProcessingResult;
this.state = builder.state;
this.stateTransitionReason = builder.stateTransitionReason;
}
/**
*
* The identifier of the event source mapping.
*
*
* @return The identifier of the event source mapping.
*/
public String uuid() {
return uuid;
}
/**
*
* The maximum number of items to retrieve in a single batch.
*
*
* @return The maximum number of items to retrieve in a single batch.
*/
public Integer batchSize() {
return batchSize;
}
/**
*
* The Amazon Resource Name (ARN) of the event source.
*
*
* @return The Amazon Resource Name (ARN) of the event source.
*/
public String eventSourceArn() {
return eventSourceArn;
}
/**
*
* The ARN of the Lambda function.
*
*
* @return The ARN of the Lambda function.
*/
public String functionArn() {
return functionArn;
}
/**
*
* The date that the event source mapping was last updated.
*
*
* @return The date that the event source mapping was last updated.
*/
public Instant lastModified() {
return lastModified;
}
/**
*
* The result of the last AWS Lambda invocation of your Lambda function.
*
*
* @return The result of the last AWS Lambda invocation of your Lambda function.
*/
public String lastProcessingResult() {
return lastProcessingResult;
}
/**
*
* The state of the event source mapping. It can be one of the following: Creating
,
* Enabling
, Enabled
, Disabling
, Disabled
, Updating
* , or Deleting
.
*
*
* @return The state of the event source mapping. It can be one of the following: Creating
,
* Enabling
, Enabled
, Disabling
, Disabled
,
* Updating
, or Deleting
.
*/
public String state() {
return state;
}
/**
*
* The cause of the last state change, either User initiated
or Lambda initiated
.
*
*
* @return The cause of the last state change, either User initiated
or Lambda initiated
.
*/
public String stateTransitionReason() {
return stateTransitionReason;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(uuid());
hashCode = 31 * hashCode + Objects.hashCode(batchSize());
hashCode = 31 * hashCode + Objects.hashCode(eventSourceArn());
hashCode = 31 * hashCode + Objects.hashCode(functionArn());
hashCode = 31 * hashCode + Objects.hashCode(lastModified());
hashCode = 31 * hashCode + Objects.hashCode(lastProcessingResult());
hashCode = 31 * hashCode + Objects.hashCode(state());
hashCode = 31 * hashCode + Objects.hashCode(stateTransitionReason());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof GetEventSourceMappingResponse)) {
return false;
}
GetEventSourceMappingResponse other = (GetEventSourceMappingResponse) obj;
return Objects.equals(uuid(), other.uuid()) && Objects.equals(batchSize(), other.batchSize())
&& Objects.equals(eventSourceArn(), other.eventSourceArn()) && Objects.equals(functionArn(), other.functionArn())
&& Objects.equals(lastModified(), other.lastModified())
&& Objects.equals(lastProcessingResult(), other.lastProcessingResult()) && Objects.equals(state(), other.state())
&& Objects.equals(stateTransitionReason(), other.stateTransitionReason());
}
/**
* 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 String toString() {
return ToString.builder("GetEventSourceMappingResponse").add("UUID", uuid()).add("BatchSize", batchSize())
.add("EventSourceArn", eventSourceArn()).add("FunctionArn", functionArn()).add("LastModified", lastModified())
.add("LastProcessingResult", lastProcessingResult()).add("State", state())
.add("StateTransitionReason", stateTransitionReason()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "UUID":
return Optional.ofNullable(clazz.cast(uuid()));
case "BatchSize":
return Optional.ofNullable(clazz.cast(batchSize()));
case "EventSourceArn":
return Optional.ofNullable(clazz.cast(eventSourceArn()));
case "FunctionArn":
return Optional.ofNullable(clazz.cast(functionArn()));
case "LastModified":
return Optional.ofNullable(clazz.cast(lastModified()));
case "LastProcessingResult":
return Optional.ofNullable(clazz.cast(lastProcessingResult()));
case "State":
return Optional.ofNullable(clazz.cast(state()));
case "StateTransitionReason":
return Optional.ofNullable(clazz.cast(stateTransitionReason()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function