software.amazon.awssdk.services.codegurureviewer.model.CodeReviewSummary Maven / Gradle / Ivy
Show all versions of codegurureviewer 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.codegurureviewer.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 summary of the code review.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class CodeReviewSummary implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(CodeReviewSummary::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField CODE_REVIEW_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CodeReviewArn").getter(getter(CodeReviewSummary::codeReviewArn)).setter(setter(Builder::codeReviewArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CodeReviewArn").build()).build();
private static final SdkField REPOSITORY_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RepositoryName").getter(getter(CodeReviewSummary::repositoryName))
.setter(setter(Builder::repositoryName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RepositoryName").build()).build();
private static final SdkField OWNER_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Owner")
.getter(getter(CodeReviewSummary::owner)).setter(setter(Builder::owner))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Owner").build()).build();
private static final SdkField PROVIDER_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ProviderType").getter(getter(CodeReviewSummary::providerTypeAsString))
.setter(setter(Builder::providerType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProviderType").build()).build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
.getter(getter(CodeReviewSummary::stateAsString)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build();
private static final SdkField CREATED_TIME_STAMP_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreatedTimeStamp").getter(getter(CodeReviewSummary::createdTimeStamp))
.setter(setter(Builder::createdTimeStamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedTimeStamp").build()).build();
private static final SdkField LAST_UPDATED_TIME_STAMP_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastUpdatedTimeStamp").getter(getter(CodeReviewSummary::lastUpdatedTimeStamp))
.setter(setter(Builder::lastUpdatedTimeStamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdatedTimeStamp").build())
.build();
private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Type")
.getter(getter(CodeReviewSummary::typeAsString)).setter(setter(Builder::type))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Type").build()).build();
private static final SdkField PULL_REQUEST_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PullRequestId").getter(getter(CodeReviewSummary::pullRequestId)).setter(setter(Builder::pullRequestId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PullRequestId").build()).build();
private static final SdkField METRICS_SUMMARY_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("MetricsSummary")
.getter(getter(CodeReviewSummary::metricsSummary)).setter(setter(Builder::metricsSummary))
.constructor(MetricsSummary::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MetricsSummary").build()).build();
private static final SdkField SOURCE_CODE_TYPE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("SourceCodeType")
.getter(getter(CodeReviewSummary::sourceCodeType)).setter(setter(Builder::sourceCodeType))
.constructor(SourceCodeType::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceCodeType").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD,
CODE_REVIEW_ARN_FIELD, REPOSITORY_NAME_FIELD, OWNER_FIELD, PROVIDER_TYPE_FIELD, STATE_FIELD,
CREATED_TIME_STAMP_FIELD, LAST_UPDATED_TIME_STAMP_FIELD, TYPE_FIELD, PULL_REQUEST_ID_FIELD, METRICS_SUMMARY_FIELD,
SOURCE_CODE_TYPE_FIELD));
private static final long serialVersionUID = 1L;
private final String name;
private final String codeReviewArn;
private final String repositoryName;
private final String owner;
private final String providerType;
private final String state;
private final Instant createdTimeStamp;
private final Instant lastUpdatedTimeStamp;
private final String type;
private final String pullRequestId;
private final MetricsSummary metricsSummary;
private final SourceCodeType sourceCodeType;
private CodeReviewSummary(BuilderImpl builder) {
this.name = builder.name;
this.codeReviewArn = builder.codeReviewArn;
this.repositoryName = builder.repositoryName;
this.owner = builder.owner;
this.providerType = builder.providerType;
this.state = builder.state;
this.createdTimeStamp = builder.createdTimeStamp;
this.lastUpdatedTimeStamp = builder.lastUpdatedTimeStamp;
this.type = builder.type;
this.pullRequestId = builder.pullRequestId;
this.metricsSummary = builder.metricsSummary;
this.sourceCodeType = builder.sourceCodeType;
}
/**
*
* The name of the code review.
*
*
* @return The name of the code review.
*/
public final String name() {
return name;
}
/**
*
* The Amazon Resource Name (ARN) of the CodeReview object.
*
*
* @return The Amazon Resource Name (ARN) of the CodeReview
* object.
*/
public final String codeReviewArn() {
return codeReviewArn;
}
/**
*
* The name of the repository.
*
*
* @return The name of the repository.
*/
public final String repositoryName() {
return repositoryName;
}
/**
*
* The owner of the repository. For an Amazon Web Services CodeCommit repository, this is the Amazon Web Services
* account ID of the account that owns the repository. For a GitHub, GitHub Enterprise Server, or Bitbucket
* repository, this is the username for the account that owns the repository. For an S3 repository, it can be the
* username or Amazon Web Services account ID.
*
*
* @return The owner of the repository. For an Amazon Web Services CodeCommit repository, this is the Amazon Web
* Services account ID of the account that owns the repository. For a GitHub, GitHub Enterprise Server, or
* Bitbucket repository, this is the username for the account that owns the repository. For an S3
* repository, it can be the username or Amazon Web Services account ID.
*/
public final String owner() {
return owner;
}
/**
*
* The provider type of the repository association.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #providerType} will
* return {@link ProviderType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #providerTypeAsString}.
*
*
* @return The provider type of the repository association.
* @see ProviderType
*/
public final ProviderType providerType() {
return ProviderType.fromValue(providerType);
}
/**
*
* The provider type of the repository association.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #providerType} will
* return {@link ProviderType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #providerTypeAsString}.
*
*
* @return The provider type of the repository association.
* @see ProviderType
*/
public final String providerTypeAsString() {
return providerType;
}
/**
*
* The state of the code review.
*
*
* The valid code review states are:
*
*
* -
*
* Completed
: The code review is complete.
*
*
* -
*
* Pending
: The code review started and has not completed or failed.
*
*
* -
*
* Failed
: The code review failed.
*
*
* -
*
* Deleting
: The code review is being deleted.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link JobState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state of the code review.
*
* The valid code review states are:
*
*
* -
*
* Completed
: The code review is complete.
*
*
* -
*
* Pending
: The code review started and has not completed or failed.
*
*
* -
*
* Failed
: The code review failed.
*
*
* -
*
* Deleting
: The code review is being deleted.
*
*
* @see JobState
*/
public final JobState state() {
return JobState.fromValue(state);
}
/**
*
* The state of the code review.
*
*
* The valid code review states are:
*
*
* -
*
* Completed
: The code review is complete.
*
*
* -
*
* Pending
: The code review started and has not completed or failed.
*
*
* -
*
* Failed
: The code review failed.
*
*
* -
*
* Deleting
: The code review is being deleted.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link JobState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state of the code review.
*
* The valid code review states are:
*
*
* -
*
* Completed
: The code review is complete.
*
*
* -
*
* Pending
: The code review started and has not completed or failed.
*
*
* -
*
* Failed
: The code review failed.
*
*
* -
*
* Deleting
: The code review is being deleted.
*
*
* @see JobState
*/
public final String stateAsString() {
return state;
}
/**
*
* The time, in milliseconds since the epoch, when the code review was created.
*
*
* @return The time, in milliseconds since the epoch, when the code review was created.
*/
public final Instant createdTimeStamp() {
return createdTimeStamp;
}
/**
*
* The time, in milliseconds since the epoch, when the code review was last updated.
*
*
* @return The time, in milliseconds since the epoch, when the code review was last updated.
*/
public final Instant lastUpdatedTimeStamp() {
return lastUpdatedTimeStamp;
}
/**
*
* The type of the code review.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link Type#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The type of the code review.
* @see Type
*/
public final Type type() {
return Type.fromValue(type);
}
/**
*
* The type of the code review.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link Type#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The type of the code review.
* @see Type
*/
public final String typeAsString() {
return type;
}
/**
*
* The pull request ID for the code review.
*
*
* @return The pull request ID for the code review.
*/
public final String pullRequestId() {
return pullRequestId;
}
/**
*
* The statistics from the code review.
*
*
* @return The statistics from the code review.
*/
public final MetricsSummary metricsSummary() {
return metricsSummary;
}
/**
* Returns the value of the SourceCodeType property for this object.
*
* @return The value of the SourceCodeType property for this object.
*/
public final SourceCodeType sourceCodeType() {
return sourceCodeType;
}
@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(name());
hashCode = 31 * hashCode + Objects.hashCode(codeReviewArn());
hashCode = 31 * hashCode + Objects.hashCode(repositoryName());
hashCode = 31 * hashCode + Objects.hashCode(owner());
hashCode = 31 * hashCode + Objects.hashCode(providerTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(stateAsString());
hashCode = 31 * hashCode + Objects.hashCode(createdTimeStamp());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedTimeStamp());
hashCode = 31 * hashCode + Objects.hashCode(typeAsString());
hashCode = 31 * hashCode + Objects.hashCode(pullRequestId());
hashCode = 31 * hashCode + Objects.hashCode(metricsSummary());
hashCode = 31 * hashCode + Objects.hashCode(sourceCodeType());
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 CodeReviewSummary)) {
return false;
}
CodeReviewSummary other = (CodeReviewSummary) obj;
return Objects.equals(name(), other.name()) && Objects.equals(codeReviewArn(), other.codeReviewArn())
&& Objects.equals(repositoryName(), other.repositoryName()) && Objects.equals(owner(), other.owner())
&& Objects.equals(providerTypeAsString(), other.providerTypeAsString())
&& Objects.equals(stateAsString(), other.stateAsString())
&& Objects.equals(createdTimeStamp(), other.createdTimeStamp())
&& Objects.equals(lastUpdatedTimeStamp(), other.lastUpdatedTimeStamp())
&& Objects.equals(typeAsString(), other.typeAsString()) && Objects.equals(pullRequestId(), other.pullRequestId())
&& Objects.equals(metricsSummary(), other.metricsSummary())
&& Objects.equals(sourceCodeType(), other.sourceCodeType());
}
/**
* 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("CodeReviewSummary").add("Name", name()).add("CodeReviewArn", codeReviewArn())
.add("RepositoryName", repositoryName()).add("Owner", owner()).add("ProviderType", providerTypeAsString())
.add("State", stateAsString()).add("CreatedTimeStamp", createdTimeStamp())
.add("LastUpdatedTimeStamp", lastUpdatedTimeStamp()).add("Type", typeAsString())
.add("PullRequestId", pullRequestId()).add("MetricsSummary", metricsSummary())
.add("SourceCodeType", sourceCodeType()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "CodeReviewArn":
return Optional.ofNullable(clazz.cast(codeReviewArn()));
case "RepositoryName":
return Optional.ofNullable(clazz.cast(repositoryName()));
case "Owner":
return Optional.ofNullable(clazz.cast(owner()));
case "ProviderType":
return Optional.ofNullable(clazz.cast(providerTypeAsString()));
case "State":
return Optional.ofNullable(clazz.cast(stateAsString()));
case "CreatedTimeStamp":
return Optional.ofNullable(clazz.cast(createdTimeStamp()));
case "LastUpdatedTimeStamp":
return Optional.ofNullable(clazz.cast(lastUpdatedTimeStamp()));
case "Type":
return Optional.ofNullable(clazz.cast(typeAsString()));
case "PullRequestId":
return Optional.ofNullable(clazz.cast(pullRequestId()));
case "MetricsSummary":
return Optional.ofNullable(clazz.cast(metricsSummary()));
case "SourceCodeType":
return Optional.ofNullable(clazz.cast(sourceCodeType()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function