software.amazon.awssdk.services.cloudwatchlogs.model.ExportTask Maven / Gradle / Ivy
Show all versions of cloudwatchlogs Show documentation
/*
* 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.cloudwatchlogs.model;
import java.io.Serializable;
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.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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Represents an export task.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ExportTask implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField TASK_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ExportTask::taskId)).setter(setter(Builder::taskId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("taskId").build()).build();
private static final SdkField TASK_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ExportTask::taskName)).setter(setter(Builder::taskName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("taskName").build()).build();
private static final SdkField LOG_GROUP_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ExportTask::logGroupName)).setter(setter(Builder::logGroupName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("logGroupName").build()).build();
private static final SdkField FROM_FIELD = SdkField. builder(MarshallingType.LONG)
.getter(getter(ExportTask::from)).setter(setter(Builder::from))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("from").build()).build();
private static final SdkField TO_FIELD = SdkField. builder(MarshallingType.LONG).getter(getter(ExportTask::to))
.setter(setter(Builder::to))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("to").build()).build();
private static final SdkField DESTINATION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ExportTask::destination)).setter(setter(Builder::destination))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("destination").build()).build();
private static final SdkField DESTINATION_PREFIX_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ExportTask::destinationPrefix)).setter(setter(Builder::destinationPrefix))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("destinationPrefix").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.getter(getter(ExportTask::status)).setter(setter(Builder::status)).constructor(ExportTaskStatus::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField EXECUTION_INFO_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).getter(getter(ExportTask::executionInfo))
.setter(setter(Builder::executionInfo)).constructor(ExportTaskExecutionInfo::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("executionInfo").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TASK_ID_FIELD,
TASK_NAME_FIELD, LOG_GROUP_NAME_FIELD, FROM_FIELD, TO_FIELD, DESTINATION_FIELD, DESTINATION_PREFIX_FIELD,
STATUS_FIELD, EXECUTION_INFO_FIELD));
private static final long serialVersionUID = 1L;
private final String taskId;
private final String taskName;
private final String logGroupName;
private final Long from;
private final Long to;
private final String destination;
private final String destinationPrefix;
private final ExportTaskStatus status;
private final ExportTaskExecutionInfo executionInfo;
private ExportTask(BuilderImpl builder) {
this.taskId = builder.taskId;
this.taskName = builder.taskName;
this.logGroupName = builder.logGroupName;
this.from = builder.from;
this.to = builder.to;
this.destination = builder.destination;
this.destinationPrefix = builder.destinationPrefix;
this.status = builder.status;
this.executionInfo = builder.executionInfo;
}
/**
*
* The ID of the export task.
*
*
* @return The ID of the export task.
*/
public String taskId() {
return taskId;
}
/**
*
* The name of the export task.
*
*
* @return The name of the export task.
*/
public String taskName() {
return taskName;
}
/**
*
* The name of the log group from which logs data was exported.
*
*
* @return The name of the log group from which logs data was exported.
*/
public String logGroupName() {
return logGroupName;
}
/**
*
* The start time, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp
* before this time are not exported.
*
*
* @return The start time, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a
* timestamp before this time are not exported.
*/
public Long from() {
return from;
}
/**
*
* The end time, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp
* later than this time are not exported.
*
*
* @return The end time, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a
* timestamp later than this time are not exported.
*/
public Long to() {
return to;
}
/**
*
* The name of Amazon S3 bucket to which the log data was exported.
*
*
* @return The name of Amazon S3 bucket to which the log data was exported.
*/
public String destination() {
return destination;
}
/**
*
* The prefix that was used as the start of Amazon S3 key for every object exported.
*
*
* @return The prefix that was used as the start of Amazon S3 key for every object exported.
*/
public String destinationPrefix() {
return destinationPrefix;
}
/**
*
* The status of the export task.
*
*
* @return The status of the export task.
*/
public ExportTaskStatus status() {
return status;
}
/**
*
* Execution info about the export task.
*
*
* @return Execution info about the export task.
*/
public ExportTaskExecutionInfo executionInfo() {
return executionInfo;
}
@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(taskId());
hashCode = 31 * hashCode + Objects.hashCode(taskName());
hashCode = 31 * hashCode + Objects.hashCode(logGroupName());
hashCode = 31 * hashCode + Objects.hashCode(from());
hashCode = 31 * hashCode + Objects.hashCode(to());
hashCode = 31 * hashCode + Objects.hashCode(destination());
hashCode = 31 * hashCode + Objects.hashCode(destinationPrefix());
hashCode = 31 * hashCode + Objects.hashCode(status());
hashCode = 31 * hashCode + Objects.hashCode(executionInfo());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ExportTask)) {
return false;
}
ExportTask other = (ExportTask) obj;
return Objects.equals(taskId(), other.taskId()) && Objects.equals(taskName(), other.taskName())
&& Objects.equals(logGroupName(), other.logGroupName()) && Objects.equals(from(), other.from())
&& Objects.equals(to(), other.to()) && Objects.equals(destination(), other.destination())
&& Objects.equals(destinationPrefix(), other.destinationPrefix()) && Objects.equals(status(), other.status())
&& Objects.equals(executionInfo(), other.executionInfo());
}
/**
* 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("ExportTask").add("TaskId", taskId()).add("TaskName", taskName())
.add("LogGroupName", logGroupName()).add("From", from()).add("To", to()).add("Destination", destination())
.add("DestinationPrefix", destinationPrefix()).add("Status", status()).add("ExecutionInfo", executionInfo())
.build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "taskId":
return Optional.ofNullable(clazz.cast(taskId()));
case "taskName":
return Optional.ofNullable(clazz.cast(taskName()));
case "logGroupName":
return Optional.ofNullable(clazz.cast(logGroupName()));
case "from":
return Optional.ofNullable(clazz.cast(from()));
case "to":
return Optional.ofNullable(clazz.cast(to()));
case "destination":
return Optional.ofNullable(clazz.cast(destination()));
case "destinationPrefix":
return Optional.ofNullable(clazz.cast(destinationPrefix()));
case "status":
return Optional.ofNullable(clazz.cast(status()));
case "executionInfo":
return Optional.ofNullable(clazz.cast(executionInfo()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function