
software.amazon.awssdk.services.glue.model.CrawlerHistory 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.glue.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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Contains the information for a run of a crawler.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class CrawlerHistory implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField CRAWL_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CrawlId").getter(getter(CrawlerHistory::crawlId)).setter(setter(Builder::crawlId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CrawlId").build()).build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
.getter(getter(CrawlerHistory::stateAsString)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build();
private static final SdkField START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("StartTime").getter(getter(CrawlerHistory::startTime)).setter(setter(Builder::startTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartTime").build()).build();
private static final SdkField END_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("EndTime").getter(getter(CrawlerHistory::endTime)).setter(setter(Builder::endTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndTime").build()).build();
private static final SdkField SUMMARY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Summary")
.getter(getter(CrawlerHistory::summary)).setter(setter(Builder::summary))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Summary").build()).build();
private static final SdkField ERROR_MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ErrorMessage").getter(getter(CrawlerHistory::errorMessage)).setter(setter(Builder::errorMessage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ErrorMessage").build()).build();
private static final SdkField LOG_GROUP_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LogGroup").getter(getter(CrawlerHistory::logGroup)).setter(setter(Builder::logGroup))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LogGroup").build()).build();
private static final SdkField LOG_STREAM_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LogStream").getter(getter(CrawlerHistory::logStream)).setter(setter(Builder::logStream))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LogStream").build()).build();
private static final SdkField MESSAGE_PREFIX_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MessagePrefix").getter(getter(CrawlerHistory::messagePrefix)).setter(setter(Builder::messagePrefix))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MessagePrefix").build()).build();
private static final SdkField DPU_HOUR_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.memberName("DPUHour").getter(getter(CrawlerHistory::dpuHour)).setter(setter(Builder::dpuHour))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DPUHour").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CRAWL_ID_FIELD, STATE_FIELD,
START_TIME_FIELD, END_TIME_FIELD, SUMMARY_FIELD, ERROR_MESSAGE_FIELD, LOG_GROUP_FIELD, LOG_STREAM_FIELD,
MESSAGE_PREFIX_FIELD, DPU_HOUR_FIELD));
private static final long serialVersionUID = 1L;
private final String crawlId;
private final String state;
private final Instant startTime;
private final Instant endTime;
private final String summary;
private final String errorMessage;
private final String logGroup;
private final String logStream;
private final String messagePrefix;
private final Double dpuHour;
private CrawlerHistory(BuilderImpl builder) {
this.crawlId = builder.crawlId;
this.state = builder.state;
this.startTime = builder.startTime;
this.endTime = builder.endTime;
this.summary = builder.summary;
this.errorMessage = builder.errorMessage;
this.logGroup = builder.logGroup;
this.logStream = builder.logStream;
this.messagePrefix = builder.messagePrefix;
this.dpuHour = builder.dpuHour;
}
/**
*
* A UUID identifier for each crawl.
*
*
* @return A UUID identifier for each crawl.
*/
public final String crawlId() {
return crawlId;
}
/**
*
* The state of the crawl.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link CrawlerHistoryState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state of the crawl.
* @see CrawlerHistoryState
*/
public final CrawlerHistoryState state() {
return CrawlerHistoryState.fromValue(state);
}
/**
*
* The state of the crawl.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link CrawlerHistoryState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state of the crawl.
* @see CrawlerHistoryState
*/
public final String stateAsString() {
return state;
}
/**
*
* The date and time on which the crawl started.
*
*
* @return The date and time on which the crawl started.
*/
public final Instant startTime() {
return startTime;
}
/**
*
* The date and time on which the crawl ended.
*
*
* @return The date and time on which the crawl ended.
*/
public final Instant endTime() {
return endTime;
}
/**
*
* A run summary for the specific crawl in JSON. Contains the catalog tables and partitions that were added,
* updated, or deleted.
*
*
* @return A run summary for the specific crawl in JSON. Contains the catalog tables and partitions that were added,
* updated, or deleted.
*/
public final String summary() {
return summary;
}
/**
*
* If an error occurred, the error message associated with the crawl.
*
*
* @return If an error occurred, the error message associated with the crawl.
*/
public final String errorMessage() {
return errorMessage;
}
/**
*
* The log group associated with the crawl.
*
*
* @return The log group associated with the crawl.
*/
public final String logGroup() {
return logGroup;
}
/**
*
* The log stream associated with the crawl.
*
*
* @return The log stream associated with the crawl.
*/
public final String logStream() {
return logStream;
}
/**
*
* The prefix for a CloudWatch message about this crawl.
*
*
* @return The prefix for a CloudWatch message about this crawl.
*/
public final String messagePrefix() {
return messagePrefix;
}
/**
*
* The number of data processing units (DPU) used in hours for the crawl.
*
*
* @return The number of data processing units (DPU) used in hours for the crawl.
*/
public final Double dpuHour() {
return dpuHour;
}
@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(crawlId());
hashCode = 31 * hashCode + Objects.hashCode(stateAsString());
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(endTime());
hashCode = 31 * hashCode + Objects.hashCode(summary());
hashCode = 31 * hashCode + Objects.hashCode(errorMessage());
hashCode = 31 * hashCode + Objects.hashCode(logGroup());
hashCode = 31 * hashCode + Objects.hashCode(logStream());
hashCode = 31 * hashCode + Objects.hashCode(messagePrefix());
hashCode = 31 * hashCode + Objects.hashCode(dpuHour());
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 CrawlerHistory)) {
return false;
}
CrawlerHistory other = (CrawlerHistory) obj;
return Objects.equals(crawlId(), other.crawlId()) && Objects.equals(stateAsString(), other.stateAsString())
&& Objects.equals(startTime(), other.startTime()) && Objects.equals(endTime(), other.endTime())
&& Objects.equals(summary(), other.summary()) && Objects.equals(errorMessage(), other.errorMessage())
&& Objects.equals(logGroup(), other.logGroup()) && Objects.equals(logStream(), other.logStream())
&& Objects.equals(messagePrefix(), other.messagePrefix()) && Objects.equals(dpuHour(), other.dpuHour());
}
/**
* 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("CrawlerHistory").add("CrawlId", crawlId()).add("State", stateAsString())
.add("StartTime", startTime()).add("EndTime", endTime()).add("Summary", summary())
.add("ErrorMessage", errorMessage()).add("LogGroup", logGroup()).add("LogStream", logStream())
.add("MessagePrefix", messagePrefix()).add("DPUHour", dpuHour()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "CrawlId":
return Optional.ofNullable(clazz.cast(crawlId()));
case "State":
return Optional.ofNullable(clazz.cast(stateAsString()));
case "StartTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "EndTime":
return Optional.ofNullable(clazz.cast(endTime()));
case "Summary":
return Optional.ofNullable(clazz.cast(summary()));
case "ErrorMessage":
return Optional.ofNullable(clazz.cast(errorMessage()));
case "LogGroup":
return Optional.ofNullable(clazz.cast(logGroup()));
case "LogStream":
return Optional.ofNullable(clazz.cast(logStream()));
case "MessagePrefix":
return Optional.ofNullable(clazz.cast(messagePrefix()));
case "DPUHour":
return Optional.ofNullable(clazz.cast(dpuHour()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function