software.amazon.awssdk.services.backup.model.ReportJob Maven / Gradle / Ivy
Show all versions of backup Show documentation
/*
* 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.backup.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.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;
/**
*
* Contains detailed information about a report job. A report job compiles a report based on a report plan and publishes
* it to Amazon S3.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ReportJob implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField REPORT_JOB_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ReportJobId").getter(getter(ReportJob::reportJobId)).setter(setter(Builder::reportJobId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReportJobId").build()).build();
private static final SdkField REPORT_PLAN_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ReportPlanArn").getter(getter(ReportJob::reportPlanArn)).setter(setter(Builder::reportPlanArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReportPlanArn").build()).build();
private static final SdkField REPORT_TEMPLATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ReportTemplate").getter(getter(ReportJob::reportTemplate)).setter(setter(Builder::reportTemplate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReportTemplate").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationTime").getter(getter(ReportJob::creationTime)).setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build();
private static final SdkField COMPLETION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CompletionTime").getter(getter(ReportJob::completionTime)).setter(setter(Builder::completionTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CompletionTime").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(ReportJob::status)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField STATUS_MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StatusMessage").getter(getter(ReportJob::statusMessage)).setter(setter(Builder::statusMessage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StatusMessage").build()).build();
private static final SdkField REPORT_DESTINATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ReportDestination")
.getter(getter(ReportJob::reportDestination)).setter(setter(Builder::reportDestination))
.constructor(ReportDestination::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReportDestination").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(REPORT_JOB_ID_FIELD,
REPORT_PLAN_ARN_FIELD, REPORT_TEMPLATE_FIELD, CREATION_TIME_FIELD, COMPLETION_TIME_FIELD, STATUS_FIELD,
STATUS_MESSAGE_FIELD, REPORT_DESTINATION_FIELD));
private static final long serialVersionUID = 1L;
private final String reportJobId;
private final String reportPlanArn;
private final String reportTemplate;
private final Instant creationTime;
private final Instant completionTime;
private final String status;
private final String statusMessage;
private final ReportDestination reportDestination;
private ReportJob(BuilderImpl builder) {
this.reportJobId = builder.reportJobId;
this.reportPlanArn = builder.reportPlanArn;
this.reportTemplate = builder.reportTemplate;
this.creationTime = builder.creationTime;
this.completionTime = builder.completionTime;
this.status = builder.status;
this.statusMessage = builder.statusMessage;
this.reportDestination = builder.reportDestination;
}
/**
*
* The identifier for a report job. A unique, randomly generated, Unicode, UTF-8 encoded string that is at most
* 1,024 bytes long. Report job IDs cannot be edited.
*
*
* @return The identifier for a report job. A unique, randomly generated, Unicode, UTF-8 encoded string that is at
* most 1,024 bytes long. Report job IDs cannot be edited.
*/
public final String reportJobId() {
return reportJobId;
}
/**
*
* An Amazon Resource Name (ARN) that uniquely identifies a resource. The format of the ARN depends on the resource
* type.
*
*
* @return An Amazon Resource Name (ARN) that uniquely identifies a resource. The format of the ARN depends on the
* resource type.
*/
public final String reportPlanArn() {
return reportPlanArn;
}
/**
*
* Identifies the report template for the report. Reports are built using a report template. The report templates
* are:
*
*
* RESOURCE_COMPLIANCE_REPORT | CONTROL_COMPLIANCE_REPORT | BACKUP_JOB_REPORT | COPY_JOB_REPORT | RESTORE_JOB_REPORT
*
*
* @return Identifies the report template for the report. Reports are built using a report template. The report
* templates are:
*
* RESOURCE_COMPLIANCE_REPORT | CONTROL_COMPLIANCE_REPORT | BACKUP_JOB_REPORT | COPY_JOB_REPORT | RESTORE_JOB_REPORT
*/
public final String reportTemplate() {
return reportTemplate;
}
/**
*
* The date and time that a report job is created, in Unix format and Coordinated Universal Time (UTC). The value of
* CreationTime
is accurate to milliseconds. For example, the value 1516925490.087 represents Friday,
* January 26, 2018 12:11:30.087 AM.
*
*
* @return The date and time that a report job is created, in Unix format and Coordinated Universal Time (UTC). The
* value of CreationTime
is accurate to milliseconds. For example, the value 1516925490.087
* represents Friday, January 26, 2018 12:11:30.087 AM.
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* The date and time that a report job is completed, in Unix format and Coordinated Universal Time (UTC). The value
* of CompletionTime
is accurate to milliseconds. For example, the value 1516925490.087 represents
* Friday, January 26, 2018 12:11:30.087 AM.
*
*
* @return The date and time that a report job is completed, in Unix format and Coordinated Universal Time (UTC).
* The value of CompletionTime
is accurate to milliseconds. For example, the value
* 1516925490.087 represents Friday, January 26, 2018 12:11:30.087 AM.
*/
public final Instant completionTime() {
return completionTime;
}
/**
*
* The status of a report job. The statuses are:
*
*
* CREATED | RUNNING | COMPLETED | FAILED
*
*
* COMPLETED
means that the report is available for your review at your designated destination. If the
* status is FAILED
, review the StatusMessage
for the reason.
*
*
* @return The status of a report job. The statuses are:
*
* CREATED | RUNNING | COMPLETED | FAILED
*
*
* COMPLETED
means that the report is available for your review at your designated destination.
* If the status is FAILED
, review the StatusMessage
for the reason.
*/
public final String status() {
return status;
}
/**
*
* A message explaining the status of the report job.
*
*
* @return A message explaining the status of the report job.
*/
public final String statusMessage() {
return statusMessage;
}
/**
*
* The S3 bucket name and S3 keys for the destination where the report job publishes the report.
*
*
* @return The S3 bucket name and S3 keys for the destination where the report job publishes the report.
*/
public final ReportDestination reportDestination() {
return reportDestination;
}
@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(reportJobId());
hashCode = 31 * hashCode + Objects.hashCode(reportPlanArn());
hashCode = 31 * hashCode + Objects.hashCode(reportTemplate());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(completionTime());
hashCode = 31 * hashCode + Objects.hashCode(status());
hashCode = 31 * hashCode + Objects.hashCode(statusMessage());
hashCode = 31 * hashCode + Objects.hashCode(reportDestination());
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 ReportJob)) {
return false;
}
ReportJob other = (ReportJob) obj;
return Objects.equals(reportJobId(), other.reportJobId()) && Objects.equals(reportPlanArn(), other.reportPlanArn())
&& Objects.equals(reportTemplate(), other.reportTemplate())
&& Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(completionTime(), other.completionTime()) && Objects.equals(status(), other.status())
&& Objects.equals(statusMessage(), other.statusMessage())
&& Objects.equals(reportDestination(), other.reportDestination());
}
/**
* 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("ReportJob").add("ReportJobId", reportJobId()).add("ReportPlanArn", reportPlanArn())
.add("ReportTemplate", reportTemplate()).add("CreationTime", creationTime())
.add("CompletionTime", completionTime()).add("Status", status()).add("StatusMessage", statusMessage())
.add("ReportDestination", reportDestination()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ReportJobId":
return Optional.ofNullable(clazz.cast(reportJobId()));
case "ReportPlanArn":
return Optional.ofNullable(clazz.cast(reportPlanArn()));
case "ReportTemplate":
return Optional.ofNullable(clazz.cast(reportTemplate()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "CompletionTime":
return Optional.ofNullable(clazz.cast(completionTime()));
case "Status":
return Optional.ofNullable(clazz.cast(status()));
case "StatusMessage":
return Optional.ofNullable(clazz.cast(statusMessage()));
case "ReportDestination":
return Optional.ofNullable(clazz.cast(reportDestination()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function