software.amazon.awssdk.services.codebuild.model.Report Maven / Gradle / Ivy
Show all versions of codebuild 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.codebuild.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;
/**
*
* Information about the results from running a series of test cases during the run of a build project. The test cases
* are specified in the buildspec for the build project using one or more paths to the test case files. You can specify
* any type of tests you want, such as unit tests, integration tests, and functional tests.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Report implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Report::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build();
private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Report::typeAsString)).setter(setter(Builder::type))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("type").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Report::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();
private static final SdkField REPORT_GROUP_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Report::reportGroupArn)).setter(setter(Builder::reportGroupArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("reportGroupArn").build()).build();
private static final SdkField EXECUTION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Report::executionId)).setter(setter(Builder::executionId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("executionId").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Report::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField CREATED_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(Report::created)).setter(setter(Builder::created))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("created").build()).build();
private static final SdkField EXPIRED_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(Report::expired)).setter(setter(Builder::expired))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("expired").build()).build();
private static final SdkField EXPORT_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).getter(getter(Report::exportConfig))
.setter(setter(Builder::exportConfig)).constructor(ReportExportConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("exportConfig").build()).build();
private static final SdkField TRUNCATED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.getter(getter(Report::truncated)).setter(setter(Builder::truncated))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("truncated").build()).build();
private static final SdkField TEST_SUMMARY_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).getter(getter(Report::testSummary))
.setter(setter(Builder::testSummary)).constructor(TestReportSummary::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("testSummary").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, TYPE_FIELD,
NAME_FIELD, REPORT_GROUP_ARN_FIELD, EXECUTION_ID_FIELD, STATUS_FIELD, CREATED_FIELD, EXPIRED_FIELD,
EXPORT_CONFIG_FIELD, TRUNCATED_FIELD, TEST_SUMMARY_FIELD));
private static final long serialVersionUID = 1L;
private final String arn;
private final String type;
private final String name;
private final String reportGroupArn;
private final String executionId;
private final String status;
private final Instant created;
private final Instant expired;
private final ReportExportConfig exportConfig;
private final Boolean truncated;
private final TestReportSummary testSummary;
private Report(BuilderImpl builder) {
this.arn = builder.arn;
this.type = builder.type;
this.name = builder.name;
this.reportGroupArn = builder.reportGroupArn;
this.executionId = builder.executionId;
this.status = builder.status;
this.created = builder.created;
this.expired = builder.expired;
this.exportConfig = builder.exportConfig;
this.truncated = builder.truncated;
this.testSummary = builder.testSummary;
}
/**
*
* The ARN of the report run.
*
*
* @return The ARN of the report run.
*/
public String arn() {
return arn;
}
/**
*
* The type of the report that was run.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link ReportType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The type of the report that was run.
* @see ReportType
*/
public ReportType type() {
return ReportType.fromValue(type);
}
/**
*
* The type of the report that was run.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link ReportType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The type of the report that was run.
* @see ReportType
*/
public String typeAsString() {
return type;
}
/**
*
* The name of the report that was run.
*
*
* @return The name of the report that was run.
*/
public String name() {
return name;
}
/**
*
* The ARN of the report group associated with this report.
*
*
* @return The ARN of the report group associated with this report.
*/
public String reportGroupArn() {
return reportGroupArn;
}
/**
*
* The ARN of the build run that generated this report.
*
*
* @return The ARN of the build run that generated this report.
*/
public String executionId() {
return executionId;
}
/**
*
* The status of this report.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ReportStatusType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of this report.
* @see ReportStatusType
*/
public ReportStatusType status() {
return ReportStatusType.fromValue(status);
}
/**
*
* The status of this report.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ReportStatusType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of this report.
* @see ReportStatusType
*/
public String statusAsString() {
return status;
}
/**
*
* The date and time this report run occurred.
*
*
* @return The date and time this report run occurred.
*/
public Instant created() {
return created;
}
/**
*
* The date and time a report expires. A report expires 30 days after it is created. An expired report is not
* available to view in CodeBuild.
*
*
* @return The date and time a report expires. A report expires 30 days after it is created. An expired report is
* not available to view in CodeBuild.
*/
public Instant expired() {
return expired;
}
/**
*
* Information about where the raw data used to generate this report was exported.
*
*
* @return Information about where the raw data used to generate this report was exported.
*/
public ReportExportConfig exportConfig() {
return exportConfig;
}
/**
*
* A boolean that specifies if this report run is truncated. The list of test cases is truncated after the maximum
* number of test cases is reached.
*
*
* @return A boolean that specifies if this report run is truncated. The list of test cases is truncated after the
* maximum number of test cases is reached.
*/
public Boolean truncated() {
return truncated;
}
/**
*
* A TestReportSummary
object that contains information about this test report.
*
*
* @return A TestReportSummary
object that contains information about this test report.
*/
public TestReportSummary testSummary() {
return testSummary;
}
@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(arn());
hashCode = 31 * hashCode + Objects.hashCode(typeAsString());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(reportGroupArn());
hashCode = 31 * hashCode + Objects.hashCode(executionId());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(created());
hashCode = 31 * hashCode + Objects.hashCode(expired());
hashCode = 31 * hashCode + Objects.hashCode(exportConfig());
hashCode = 31 * hashCode + Objects.hashCode(truncated());
hashCode = 31 * hashCode + Objects.hashCode(testSummary());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof Report)) {
return false;
}
Report other = (Report) obj;
return Objects.equals(arn(), other.arn()) && Objects.equals(typeAsString(), other.typeAsString())
&& Objects.equals(name(), other.name()) && Objects.equals(reportGroupArn(), other.reportGroupArn())
&& Objects.equals(executionId(), other.executionId()) && Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(created(), other.created()) && Objects.equals(expired(), other.expired())
&& Objects.equals(exportConfig(), other.exportConfig()) && Objects.equals(truncated(), other.truncated())
&& Objects.equals(testSummary(), other.testSummary());
}
/**
* 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("Report").add("Arn", arn()).add("Type", typeAsString()).add("Name", name())
.add("ReportGroupArn", reportGroupArn()).add("ExecutionId", executionId()).add("Status", statusAsString())
.add("Created", created()).add("Expired", expired()).add("ExportConfig", exportConfig())
.add("Truncated", truncated()).add("TestSummary", testSummary()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "arn":
return Optional.ofNullable(clazz.cast(arn()));
case "type":
return Optional.ofNullable(clazz.cast(typeAsString()));
case "name":
return Optional.ofNullable(clazz.cast(name()));
case "reportGroupArn":
return Optional.ofNullable(clazz.cast(reportGroupArn()));
case "executionId":
return Optional.ofNullable(clazz.cast(executionId()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "created":
return Optional.ofNullable(clazz.cast(created()));
case "expired":
return Optional.ofNullable(clazz.cast(expired()));
case "exportConfig":
return Optional.ofNullable(clazz.cast(exportConfig()));
case "truncated":
return Optional.ofNullable(clazz.cast(truncated()));
case "testSummary":
return Optional.ofNullable(clazz.cast(testSummary()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function