All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.codegurureviewer.model.CodeReview Maven / Gradle / Ivy

Go to download

The AWS Java SDK for CodeGuru Reviewer module holds the client classes that are used for communicating with CodeGuru Reviewer.

There is a newer version: 2.29.15
Show newest version
/*
 * 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.Collection;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Information about a code review. A code review belongs to the associated repository that contains the reviewed code. *

*/ @Generated("software.amazon.awssdk:codegen") public final class CodeReview implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name") .getter(getter(CodeReview::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(CodeReview::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(CodeReview::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(CodeReview::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(CodeReview::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(CodeReview::stateAsString)).setter(setter(Builder::state)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build(); private static final SdkField STATE_REASON_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("StateReason").getter(getter(CodeReview::stateReason)).setter(setter(Builder::stateReason)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StateReason").build()).build(); private static final SdkField CREATED_TIME_STAMP_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("CreatedTimeStamp").getter(getter(CodeReview::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(CodeReview::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(CodeReview::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(CodeReview::pullRequestId)).setter(setter(Builder::pullRequestId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PullRequestId").build()).build(); private static final SdkField SOURCE_CODE_TYPE_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("SourceCodeType") .getter(getter(CodeReview::sourceCodeType)).setter(setter(Builder::sourceCodeType)) .constructor(SourceCodeType::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceCodeType").build()).build(); private static final SdkField ASSOCIATION_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("AssociationArn").getter(getter(CodeReview::associationArn)).setter(setter(Builder::associationArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AssociationArn").build()).build(); private static final SdkField METRICS_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("Metrics").getter(getter(CodeReview::metrics)).setter(setter(Builder::metrics)) .constructor(Metrics::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Metrics").build()).build(); private static final SdkField> ANALYSIS_TYPES_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("AnalysisTypes") .getter(getter(CodeReview::analysisTypesAsStrings)) .setter(setter(Builder::analysisTypesWithStrings)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AnalysisTypes").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField CONFIG_FILE_STATE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ConfigFileState").getter(getter(CodeReview::configFileStateAsString)) .setter(setter(Builder::configFileState)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConfigFileState").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, STATE_REASON_FIELD, CREATED_TIME_STAMP_FIELD, LAST_UPDATED_TIME_STAMP_FIELD, TYPE_FIELD, PULL_REQUEST_ID_FIELD, SOURCE_CODE_TYPE_FIELD, ASSOCIATION_ARN_FIELD, METRICS_FIELD, ANALYSIS_TYPES_FIELD, CONFIG_FILE_STATE_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 String stateReason; private final Instant createdTimeStamp; private final Instant lastUpdatedTimeStamp; private final String type; private final String pullRequestId; private final SourceCodeType sourceCodeType; private final String associationArn; private final Metrics metrics; private final List analysisTypes; private final String configFileState; private CodeReview(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.stateReason = builder.stateReason; this.createdTimeStamp = builder.createdTimeStamp; this.lastUpdatedTimeStamp = builder.lastUpdatedTimeStamp; this.type = builder.type; this.pullRequestId = builder.pullRequestId; this.sourceCodeType = builder.sourceCodeType; this.associationArn = builder.associationArn; this.metrics = builder.metrics; this.analysisTypes = builder.analysisTypes; this.configFileState = builder.configFileState; } /** *

* 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 type of repository that contains the reviewed code (for example, GitHub or Bitbucket). *

*

* 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 type of repository that contains the reviewed code (for example, GitHub or Bitbucket). * @see ProviderType */ public final ProviderType providerType() { return ProviderType.fromValue(providerType); } /** *

* The type of repository that contains the reviewed code (for example, GitHub or Bitbucket). *

*

* 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 type of repository that contains the reviewed code (for example, GitHub or Bitbucket). * @see ProviderType */ public final String providerTypeAsString() { return providerType; } /** *

* 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 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 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 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 reason for the state of the code review. *

      * * @return The reason for the state of the code review. */ public final String stateReason() { return stateReason; } /** *

      * 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 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 code review. * @see Type */ public final Type type() { return Type.fromValue(type); } /** *

      * The type of 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 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 type of the source code for the code review. *

      * * @return The type of the source code for the code review. */ public final SourceCodeType sourceCodeType() { return sourceCodeType; } /** *

      * The Amazon Resource Name (ARN) of the RepositoryAssociation that contains the reviewed source code. You can retrieve associated repository ARNs by * calling * ListRepositoryAssociations. *

      * * @return The Amazon Resource Name (ARN) of the RepositoryAssociation that contains the reviewed source code. You can retrieve associated repository * ARNs by calling ListRepositoryAssociations. */ public final String associationArn() { return associationArn; } /** *

      * The statistics from the code review. *

      * * @return The statistics from the code review. */ public final Metrics metrics() { return metrics; } /** *

      * The types of analysis performed during a repository analysis or a pull request review. You can specify either * Security, CodeQuality, or both. *

      *

      * Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

      *

      * This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasAnalysisTypes} method. *

      * * @return The types of analysis performed during a repository analysis or a pull request review. You can specify * either Security, CodeQuality, or both. */ public final List analysisTypes() { return AnalysisTypesCopier.copyStringToEnum(analysisTypes); } /** * For responses, this returns true if the service returned a value for the AnalysisTypes property. This DOES NOT * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasAnalysisTypes() { return analysisTypes != null && !(analysisTypes instanceof SdkAutoConstructList); } /** *

      * The types of analysis performed during a repository analysis or a pull request review. You can specify either * Security, CodeQuality, or both. *

      *

      * Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

      *

      * This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasAnalysisTypes} method. *

      * * @return The types of analysis performed during a repository analysis or a pull request review. You can specify * either Security, CodeQuality, or both. */ public final List analysisTypesAsStrings() { return analysisTypes; } /** *

      * The state of the aws-codeguru-reviewer.yml configuration file that allows the configuration of the * CodeGuru Reviewer analysis. The file either exists, doesn't exist, or exists with errors at the root directory of * your repository. *

      *

      * If the service returns an enum value that is not available in the current SDK version, {@link #configFileState} * will return {@link ConfigFileState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #configFileStateAsString}. *

      * * @return The state of the aws-codeguru-reviewer.yml configuration file that allows the configuration * of the CodeGuru Reviewer analysis. The file either exists, doesn't exist, or exists with errors at the * root directory of your repository. * @see ConfigFileState */ public final ConfigFileState configFileState() { return ConfigFileState.fromValue(configFileState); } /** *

      * The state of the aws-codeguru-reviewer.yml configuration file that allows the configuration of the * CodeGuru Reviewer analysis. The file either exists, doesn't exist, or exists with errors at the root directory of * your repository. *

      *

      * If the service returns an enum value that is not available in the current SDK version, {@link #configFileState} * will return {@link ConfigFileState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #configFileStateAsString}. *

      * * @return The state of the aws-codeguru-reviewer.yml configuration file that allows the configuration * of the CodeGuru Reviewer analysis. The file either exists, doesn't exist, or exists with errors at the * root directory of your repository. * @see ConfigFileState */ public final String configFileStateAsString() { return configFileState; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class 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(stateReason()); 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(sourceCodeType()); hashCode = 31 * hashCode + Objects.hashCode(associationArn()); hashCode = 31 * hashCode + Objects.hashCode(metrics()); hashCode = 31 * hashCode + Objects.hashCode(hasAnalysisTypes() ? analysisTypesAsStrings() : null); hashCode = 31 * hashCode + Objects.hashCode(configFileStateAsString()); 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 CodeReview)) { return false; } CodeReview other = (CodeReview) 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(stateReason(), other.stateReason()) && Objects.equals(createdTimeStamp(), other.createdTimeStamp()) && Objects.equals(lastUpdatedTimeStamp(), other.lastUpdatedTimeStamp()) && Objects.equals(typeAsString(), other.typeAsString()) && Objects.equals(pullRequestId(), other.pullRequestId()) && Objects.equals(sourceCodeType(), other.sourceCodeType()) && Objects.equals(associationArn(), other.associationArn()) && Objects.equals(metrics(), other.metrics()) && hasAnalysisTypes() == other.hasAnalysisTypes() && Objects.equals(analysisTypesAsStrings(), other.analysisTypesAsStrings()) && Objects.equals(configFileStateAsString(), other.configFileStateAsString()); } /** * 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("CodeReview").add("Name", name()).add("CodeReviewArn", codeReviewArn()) .add("RepositoryName", repositoryName()).add("Owner", owner()).add("ProviderType", providerTypeAsString()) .add("State", stateAsString()).add("StateReason", stateReason()).add("CreatedTimeStamp", createdTimeStamp()) .add("LastUpdatedTimeStamp", lastUpdatedTimeStamp()).add("Type", typeAsString()) .add("PullRequestId", pullRequestId()).add("SourceCodeType", sourceCodeType()) .add("AssociationArn", associationArn()).add("Metrics", metrics()) .add("AnalysisTypes", hasAnalysisTypes() ? analysisTypesAsStrings() : null) .add("ConfigFileState", configFileStateAsString()).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 "StateReason": return Optional.ofNullable(clazz.cast(stateReason())); 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 "SourceCodeType": return Optional.ofNullable(clazz.cast(sourceCodeType())); case "AssociationArn": return Optional.ofNullable(clazz.cast(associationArn())); case "Metrics": return Optional.ofNullable(clazz.cast(metrics())); case "AnalysisTypes": return Optional.ofNullable(clazz.cast(analysisTypesAsStrings())); case "ConfigFileState": return Optional.ofNullable(clazz.cast(configFileStateAsString())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((CodeReview) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

      * The name of the code review. *

      * * @param name * The name of the code review. * @return Returns a reference to this object so that method calls can be chained together. */ Builder name(String name); /** *

      * The Amazon Resource Name (ARN) of the CodeReview object. *

      * * @param codeReviewArn * The Amazon Resource Name (ARN) of the CodeReview * object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder codeReviewArn(String codeReviewArn); /** *

      * The name of the repository. *

      * * @param repositoryName * The name of the repository. * @return Returns a reference to this object so that method calls can be chained together. */ Builder repositoryName(String 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. *

      * * @param owner * 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 Returns a reference to this object so that method calls can be chained together. */ Builder owner(String owner); /** *

      * The type of repository that contains the reviewed code (for example, GitHub or Bitbucket). *

      * * @param providerType * The type of repository that contains the reviewed code (for example, GitHub or Bitbucket). * @see ProviderType * @return Returns a reference to this object so that method calls can be chained together. * @see ProviderType */ Builder providerType(String providerType); /** *

      * The type of repository that contains the reviewed code (for example, GitHub or Bitbucket). *

      * * @param providerType * The type of repository that contains the reviewed code (for example, GitHub or Bitbucket). * @see ProviderType * @return Returns a reference to this object so that method calls can be chained together. * @see ProviderType */ Builder providerType(ProviderType providerType); /** *

      * 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. *

        *
      • *
      * * @param state * 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 * @return Returns a reference to this object so that method calls can be chained together. * @see JobState */ Builder state(String state); /** *

        * 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. *

          *
        • *
        * * @param state * 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 * @return Returns a reference to this object so that method calls can be chained together. * @see JobState */ Builder state(JobState state); /** *

          * The reason for the state of the code review. *

          * * @param stateReason * The reason for the state of the code review. * @return Returns a reference to this object so that method calls can be chained together. */ Builder stateReason(String stateReason); /** *

          * The time, in milliseconds since the epoch, when the code review was created. *

          * * @param createdTimeStamp * The time, in milliseconds since the epoch, when the code review was created. * @return Returns a reference to this object so that method calls can be chained together. */ Builder createdTimeStamp(Instant createdTimeStamp); /** *

          * The time, in milliseconds since the epoch, when the code review was last updated. *

          * * @param lastUpdatedTimeStamp * The time, in milliseconds since the epoch, when the code review was last updated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastUpdatedTimeStamp(Instant lastUpdatedTimeStamp); /** *

          * The type of code review. *

          * * @param type * The type of code review. * @see Type * @return Returns a reference to this object so that method calls can be chained together. * @see Type */ Builder type(String type); /** *

          * The type of code review. *

          * * @param type * The type of code review. * @see Type * @return Returns a reference to this object so that method calls can be chained together. * @see Type */ Builder type(Type type); /** *

          * The pull request ID for the code review. *

          * * @param pullRequestId * The pull request ID for the code review. * @return Returns a reference to this object so that method calls can be chained together. */ Builder pullRequestId(String pullRequestId); /** *

          * The type of the source code for the code review. *

          * * @param sourceCodeType * The type of the source code for the code review. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sourceCodeType(SourceCodeType sourceCodeType); /** *

          * The type of the source code for the code review. *

          * This is a convenience method that creates an instance of the {@link SourceCodeType.Builder} avoiding the need * to create one manually via {@link SourceCodeType#builder()}. * *

          * When the {@link Consumer} completes, {@link SourceCodeType.Builder#build()} is called immediately and its * result is passed to {@link #sourceCodeType(SourceCodeType)}. * * @param sourceCodeType * a consumer that will call methods on {@link SourceCodeType.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #sourceCodeType(SourceCodeType) */ default Builder sourceCodeType(Consumer sourceCodeType) { return sourceCodeType(SourceCodeType.builder().applyMutation(sourceCodeType).build()); } /** *

          * The Amazon Resource Name (ARN) of the RepositoryAssociation that contains the reviewed source code. You can retrieve associated repository * ARNs by calling ListRepositoryAssociations. *

          * * @param associationArn * The Amazon Resource Name (ARN) of the RepositoryAssociation that contains the reviewed source code. You can retrieve associated * repository ARNs by calling ListRepositoryAssociations. * @return Returns a reference to this object so that method calls can be chained together. */ Builder associationArn(String associationArn); /** *

          * The statistics from the code review. *

          * * @param metrics * The statistics from the code review. * @return Returns a reference to this object so that method calls can be chained together. */ Builder metrics(Metrics metrics); /** *

          * The statistics from the code review. *

          * This is a convenience method that creates an instance of the {@link Metrics.Builder} avoiding the need to * create one manually via {@link Metrics#builder()}. * *

          * When the {@link Consumer} completes, {@link Metrics.Builder#build()} is called immediately and its result is * passed to {@link #metrics(Metrics)}. * * @param metrics * a consumer that will call methods on {@link Metrics.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #metrics(Metrics) */ default Builder metrics(Consumer metrics) { return metrics(Metrics.builder().applyMutation(metrics).build()); } /** *

          * The types of analysis performed during a repository analysis or a pull request review. You can specify either * Security, CodeQuality, or both. *

          * * @param analysisTypes * The types of analysis performed during a repository analysis or a pull request review. You can specify * either Security, CodeQuality, or both. * @return Returns a reference to this object so that method calls can be chained together. */ Builder analysisTypesWithStrings(Collection analysisTypes); /** *

          * The types of analysis performed during a repository analysis or a pull request review. You can specify either * Security, CodeQuality, or both. *

          * * @param analysisTypes * The types of analysis performed during a repository analysis or a pull request review. You can specify * either Security, CodeQuality, or both. * @return Returns a reference to this object so that method calls can be chained together. */ Builder analysisTypesWithStrings(String... analysisTypes); /** *

          * The types of analysis performed during a repository analysis or a pull request review. You can specify either * Security, CodeQuality, or both. *

          * * @param analysisTypes * The types of analysis performed during a repository analysis or a pull request review. You can specify * either Security, CodeQuality, or both. * @return Returns a reference to this object so that method calls can be chained together. */ Builder analysisTypes(Collection analysisTypes); /** *

          * The types of analysis performed during a repository analysis or a pull request review. You can specify either * Security, CodeQuality, or both. *

          * * @param analysisTypes * The types of analysis performed during a repository analysis or a pull request review. You can specify * either Security, CodeQuality, or both. * @return Returns a reference to this object so that method calls can be chained together. */ Builder analysisTypes(AnalysisType... analysisTypes); /** *

          * The state of the aws-codeguru-reviewer.yml configuration file that allows the configuration of * the CodeGuru Reviewer analysis. The file either exists, doesn't exist, or exists with errors at the root * directory of your repository. *

          * * @param configFileState * The state of the aws-codeguru-reviewer.yml configuration file that allows the * configuration of the CodeGuru Reviewer analysis. The file either exists, doesn't exist, or exists with * errors at the root directory of your repository. * @see ConfigFileState * @return Returns a reference to this object so that method calls can be chained together. * @see ConfigFileState */ Builder configFileState(String configFileState); /** *

          * The state of the aws-codeguru-reviewer.yml configuration file that allows the configuration of * the CodeGuru Reviewer analysis. The file either exists, doesn't exist, or exists with errors at the root * directory of your repository. *

          * * @param configFileState * The state of the aws-codeguru-reviewer.yml configuration file that allows the * configuration of the CodeGuru Reviewer analysis. The file either exists, doesn't exist, or exists with * errors at the root directory of your repository. * @see ConfigFileState * @return Returns a reference to this object so that method calls can be chained together. * @see ConfigFileState */ Builder configFileState(ConfigFileState configFileState); } static final class BuilderImpl implements Builder { private String name; private String codeReviewArn; private String repositoryName; private String owner; private String providerType; private String state; private String stateReason; private Instant createdTimeStamp; private Instant lastUpdatedTimeStamp; private String type; private String pullRequestId; private SourceCodeType sourceCodeType; private String associationArn; private Metrics metrics; private List analysisTypes = DefaultSdkAutoConstructList.getInstance(); private String configFileState; private BuilderImpl() { } private BuilderImpl(CodeReview model) { name(model.name); codeReviewArn(model.codeReviewArn); repositoryName(model.repositoryName); owner(model.owner); providerType(model.providerType); state(model.state); stateReason(model.stateReason); createdTimeStamp(model.createdTimeStamp); lastUpdatedTimeStamp(model.lastUpdatedTimeStamp); type(model.type); pullRequestId(model.pullRequestId); sourceCodeType(model.sourceCodeType); associationArn(model.associationArn); metrics(model.metrics); analysisTypesWithStrings(model.analysisTypes); configFileState(model.configFileState); } public final String getName() { return name; } public final void setName(String name) { this.name = name; } @Override public final Builder name(String name) { this.name = name; return this; } public final String getCodeReviewArn() { return codeReviewArn; } public final void setCodeReviewArn(String codeReviewArn) { this.codeReviewArn = codeReviewArn; } @Override public final Builder codeReviewArn(String codeReviewArn) { this.codeReviewArn = codeReviewArn; return this; } public final String getRepositoryName() { return repositoryName; } public final void setRepositoryName(String repositoryName) { this.repositoryName = repositoryName; } @Override public final Builder repositoryName(String repositoryName) { this.repositoryName = repositoryName; return this; } public final String getOwner() { return owner; } public final void setOwner(String owner) { this.owner = owner; } @Override public final Builder owner(String owner) { this.owner = owner; return this; } public final String getProviderType() { return providerType; } public final void setProviderType(String providerType) { this.providerType = providerType; } @Override public final Builder providerType(String providerType) { this.providerType = providerType; return this; } @Override public final Builder providerType(ProviderType providerType) { this.providerType(providerType == null ? null : providerType.toString()); return this; } public final String getState() { return state; } public final void setState(String state) { this.state = state; } @Override public final Builder state(String state) { this.state = state; return this; } @Override public final Builder state(JobState state) { this.state(state == null ? null : state.toString()); return this; } public final String getStateReason() { return stateReason; } public final void setStateReason(String stateReason) { this.stateReason = stateReason; } @Override public final Builder stateReason(String stateReason) { this.stateReason = stateReason; return this; } public final Instant getCreatedTimeStamp() { return createdTimeStamp; } public final void setCreatedTimeStamp(Instant createdTimeStamp) { this.createdTimeStamp = createdTimeStamp; } @Override public final Builder createdTimeStamp(Instant createdTimeStamp) { this.createdTimeStamp = createdTimeStamp; return this; } public final Instant getLastUpdatedTimeStamp() { return lastUpdatedTimeStamp; } public final void setLastUpdatedTimeStamp(Instant lastUpdatedTimeStamp) { this.lastUpdatedTimeStamp = lastUpdatedTimeStamp; } @Override public final Builder lastUpdatedTimeStamp(Instant lastUpdatedTimeStamp) { this.lastUpdatedTimeStamp = lastUpdatedTimeStamp; return this; } public final String getType() { return type; } public final void setType(String type) { this.type = type; } @Override public final Builder type(String type) { this.type = type; return this; } @Override public final Builder type(Type type) { this.type(type == null ? null : type.toString()); return this; } public final String getPullRequestId() { return pullRequestId; } public final void setPullRequestId(String pullRequestId) { this.pullRequestId = pullRequestId; } @Override public final Builder pullRequestId(String pullRequestId) { this.pullRequestId = pullRequestId; return this; } public final SourceCodeType.Builder getSourceCodeType() { return sourceCodeType != null ? sourceCodeType.toBuilder() : null; } public final void setSourceCodeType(SourceCodeType.BuilderImpl sourceCodeType) { this.sourceCodeType = sourceCodeType != null ? sourceCodeType.build() : null; } @Override public final Builder sourceCodeType(SourceCodeType sourceCodeType) { this.sourceCodeType = sourceCodeType; return this; } public final String getAssociationArn() { return associationArn; } public final void setAssociationArn(String associationArn) { this.associationArn = associationArn; } @Override public final Builder associationArn(String associationArn) { this.associationArn = associationArn; return this; } public final Metrics.Builder getMetrics() { return metrics != null ? metrics.toBuilder() : null; } public final void setMetrics(Metrics.BuilderImpl metrics) { this.metrics = metrics != null ? metrics.build() : null; } @Override public final Builder metrics(Metrics metrics) { this.metrics = metrics; return this; } public final Collection getAnalysisTypes() { if (analysisTypes instanceof SdkAutoConstructList) { return null; } return analysisTypes; } public final void setAnalysisTypes(Collection analysisTypes) { this.analysisTypes = AnalysisTypesCopier.copy(analysisTypes); } @Override public final Builder analysisTypesWithStrings(Collection analysisTypes) { this.analysisTypes = AnalysisTypesCopier.copy(analysisTypes); return this; } @Override @SafeVarargs public final Builder analysisTypesWithStrings(String... analysisTypes) { analysisTypesWithStrings(Arrays.asList(analysisTypes)); return this; } @Override public final Builder analysisTypes(Collection analysisTypes) { this.analysisTypes = AnalysisTypesCopier.copyEnumToString(analysisTypes); return this; } @Override @SafeVarargs public final Builder analysisTypes(AnalysisType... analysisTypes) { analysisTypes(Arrays.asList(analysisTypes)); return this; } public final String getConfigFileState() { return configFileState; } public final void setConfigFileState(String configFileState) { this.configFileState = configFileState; } @Override public final Builder configFileState(String configFileState) { this.configFileState = configFileState; return this; } @Override public final Builder configFileState(ConfigFileState configFileState) { this.configFileState(configFileState == null ? null : configFileState.toString()); return this; } @Override public CodeReview build() { return new CodeReview(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy