software.amazon.awssdk.services.codegurureviewer.model.RepositoryAssociationSummary 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.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;
/**
*
* Summary information about a repository association. The ListRepositoryAssociations operation returns a list of RepositoryAssociationSummary
objects.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class RepositoryAssociationSummary implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ASSOCIATION_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AssociationArn").getter(getter(RepositoryAssociationSummary::associationArn))
.setter(setter(Builder::associationArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AssociationArn").build()).build();
private static final SdkField CONNECTION_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ConnectionArn").getter(getter(RepositoryAssociationSummary::connectionArn))
.setter(setter(Builder::connectionArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConnectionArn").build()).build();
private static final SdkField LAST_UPDATED_TIME_STAMP_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastUpdatedTimeStamp").getter(getter(RepositoryAssociationSummary::lastUpdatedTimeStamp))
.setter(setter(Builder::lastUpdatedTimeStamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdatedTimeStamp").build())
.build();
private static final SdkField ASSOCIATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AssociationId").getter(getter(RepositoryAssociationSummary::associationId))
.setter(setter(Builder::associationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AssociationId").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(RepositoryAssociationSummary::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField OWNER_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Owner")
.getter(getter(RepositoryAssociationSummary::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(RepositoryAssociationSummary::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(RepositoryAssociationSummary::stateAsString)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ASSOCIATION_ARN_FIELD,
CONNECTION_ARN_FIELD, LAST_UPDATED_TIME_STAMP_FIELD, ASSOCIATION_ID_FIELD, NAME_FIELD, OWNER_FIELD,
PROVIDER_TYPE_FIELD, STATE_FIELD));
private static final long serialVersionUID = 1L;
private final String associationArn;
private final String connectionArn;
private final Instant lastUpdatedTimeStamp;
private final String associationId;
private final String name;
private final String owner;
private final String providerType;
private final String state;
private RepositoryAssociationSummary(BuilderImpl builder) {
this.associationArn = builder.associationArn;
this.connectionArn = builder.connectionArn;
this.lastUpdatedTimeStamp = builder.lastUpdatedTimeStamp;
this.associationId = builder.associationId;
this.name = builder.name;
this.owner = builder.owner;
this.providerType = builder.providerType;
this.state = builder.state;
}
/**
*
* The Amazon Resource Name (ARN) of the RepositoryAssociation object. You can retrieve this ARN by calling ListRepositoryAssociations.
*
*
* @return The Amazon Resource Name (ARN) of the RepositoryAssociation object. You can retrieve this ARN by calling ListRepositoryAssociations.
*/
public final String associationArn() {
return associationArn;
}
/**
*
* The Amazon Resource Name (ARN) of an Amazon Web Services CodeStar Connections connection. Its format is
* arn:aws:codestar-connections:region-id:aws-account_id:connection/connection-id
. For more
* information, see Connection in
* the Amazon Web Services CodeStar Connections API Reference.
*
*
* @return The Amazon Resource Name (ARN) of an Amazon Web Services CodeStar Connections connection. Its format is
* arn:aws:codestar-connections:region-id:aws-account_id:connection/connection-id
. For more
* information, see Connection in the Amazon Web Services CodeStar Connections API Reference.
*/
public final String connectionArn() {
return connectionArn;
}
/**
*
* The time, in milliseconds since the epoch, since the repository association was last updated.
*
*
* @return The time, in milliseconds since the epoch, since the repository association was last updated.
*/
public final Instant lastUpdatedTimeStamp() {
return lastUpdatedTimeStamp;
}
/**
*
* The repository association ID.
*
*
* @return The repository association ID.
*/
public final String associationId() {
return associationId;
}
/**
*
* The name of the repository association.
*
*
* @return The name of the repository association.
*/
public final String name() {
return name;
}
/**
*
* 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 repository association.
*
*
* The valid repository association states are:
*
*
* -
*
* Associated: The repository association is complete.
*
*
* -
*
* Associating: CodeGuru Reviewer is:
*
*
* -
*
* Setting up pull request notifications. This is required for pull requests to trigger a CodeGuru Reviewer review.
*
*
*
* If your repository ProviderType
is GitHub
, GitHub Enterprise Server
, or
* Bitbucket
, CodeGuru Reviewer creates webhooks in your repository to trigger CodeGuru Reviewer
* reviews. If you delete these webhooks, reviews of code in your repository cannot be triggered.
*
*
* -
*
* Setting up source code access. This is required for CodeGuru Reviewer to securely clone code in your repository.
*
*
*
*
* -
*
* Failed: The repository failed to associate or disassociate.
*
*
* -
*
* Disassociating: CodeGuru Reviewer is removing the repository's pull request notifications and source code
* access.
*
*
* -
*
* Disassociated: CodeGuru Reviewer successfully disassociated the repository. You can create a new
* association with this repository if you want to review source code in it later. You can control access to code
* reviews created in anassociated repository with tags after it has been disassociated. For more information, see
* Using
* tags to control access to associated repositories in the Amazon CodeGuru Reviewer User Guide.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link RepositoryAssociationState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #stateAsString}.
*
*
* @return The state of the repository association.
*
* The valid repository association states are:
*
*
* -
*
* Associated: The repository association is complete.
*
*
* -
*
* Associating: CodeGuru Reviewer is:
*
*
* -
*
* Setting up pull request notifications. This is required for pull requests to trigger a CodeGuru Reviewer
* review.
*
*
*
* If your repository ProviderType
is GitHub
,
* GitHub Enterprise Server
, or Bitbucket
, CodeGuru Reviewer creates webhooks in
* your repository to trigger CodeGuru Reviewer reviews. If you delete these webhooks, reviews of code in
* your repository cannot be triggered.
*
*
* -
*
* Setting up source code access. This is required for CodeGuru Reviewer to securely clone code in your
* repository.
*
*
*
*
* -
*
* Failed: The repository failed to associate or disassociate.
*
*
* -
*
* Disassociating: CodeGuru Reviewer is removing the repository's pull request notifications and
* source code access.
*
*
* -
*
* Disassociated: CodeGuru Reviewer successfully disassociated the repository. You can create a new
* association with this repository if you want to review source code in it later. You can control access to
* code reviews created in anassociated repository with tags after it has been disassociated. For more
* information, see Using tags to control access to associated repositories in the Amazon CodeGuru Reviewer User
* Guide.
*
*
* @see RepositoryAssociationState
*/
public final RepositoryAssociationState state() {
return RepositoryAssociationState.fromValue(state);
}
/**
*
* The state of the repository association.
*
*
* The valid repository association states are:
*
*
* -
*
* Associated: The repository association is complete.
*
*
* -
*
* Associating: CodeGuru Reviewer is:
*
*
* -
*
* Setting up pull request notifications. This is required for pull requests to trigger a CodeGuru Reviewer review.
*
*
*
* If your repository ProviderType
is GitHub
, GitHub Enterprise Server
, or
* Bitbucket
, CodeGuru Reviewer creates webhooks in your repository to trigger CodeGuru Reviewer
* reviews. If you delete these webhooks, reviews of code in your repository cannot be triggered.
*
*
* -
*
* Setting up source code access. This is required for CodeGuru Reviewer to securely clone code in your repository.
*
*
*
*
* -
*
* Failed: The repository failed to associate or disassociate.
*
*
* -
*
* Disassociating: CodeGuru Reviewer is removing the repository's pull request notifications and source code
* access.
*
*
* -
*
* Disassociated: CodeGuru Reviewer successfully disassociated the repository. You can create a new
* association with this repository if you want to review source code in it later. You can control access to code
* reviews created in anassociated repository with tags after it has been disassociated. For more information, see
* Using
* tags to control access to associated repositories in the Amazon CodeGuru Reviewer User Guide.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link RepositoryAssociationState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #stateAsString}.
*
*
* @return The state of the repository association.
*
* The valid repository association states are:
*
*
* -
*
* Associated: The repository association is complete.
*
*
* -
*
* Associating: CodeGuru Reviewer is:
*
*
* -
*
* Setting up pull request notifications. This is required for pull requests to trigger a CodeGuru Reviewer
* review.
*
*
*
* If your repository ProviderType
is GitHub
,
* GitHub Enterprise Server
, or Bitbucket
, CodeGuru Reviewer creates webhooks in
* your repository to trigger CodeGuru Reviewer reviews. If you delete these webhooks, reviews of code in
* your repository cannot be triggered.
*
*
* -
*
* Setting up source code access. This is required for CodeGuru Reviewer to securely clone code in your
* repository.
*
*
*
*
* -
*
* Failed: The repository failed to associate or disassociate.
*
*
* -
*
* Disassociating: CodeGuru Reviewer is removing the repository's pull request notifications and
* source code access.
*
*
* -
*
* Disassociated: CodeGuru Reviewer successfully disassociated the repository. You can create a new
* association with this repository if you want to review source code in it later. You can control access to
* code reviews created in anassociated repository with tags after it has been disassociated. For more
* information, see Using tags to control access to associated repositories in the Amazon CodeGuru Reviewer User
* Guide.
*
*
* @see RepositoryAssociationState
*/
public final String stateAsString() {
return state;
}
@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(associationArn());
hashCode = 31 * hashCode + Objects.hashCode(connectionArn());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedTimeStamp());
hashCode = 31 * hashCode + Objects.hashCode(associationId());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(owner());
hashCode = 31 * hashCode + Objects.hashCode(providerTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(stateAsString());
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 RepositoryAssociationSummary)) {
return false;
}
RepositoryAssociationSummary other = (RepositoryAssociationSummary) obj;
return Objects.equals(associationArn(), other.associationArn()) && Objects.equals(connectionArn(), other.connectionArn())
&& Objects.equals(lastUpdatedTimeStamp(), other.lastUpdatedTimeStamp())
&& Objects.equals(associationId(), other.associationId()) && Objects.equals(name(), other.name())
&& Objects.equals(owner(), other.owner()) && Objects.equals(providerTypeAsString(), other.providerTypeAsString())
&& Objects.equals(stateAsString(), other.stateAsString());
}
/**
* 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("RepositoryAssociationSummary").add("AssociationArn", associationArn())
.add("ConnectionArn", connectionArn()).add("LastUpdatedTimeStamp", lastUpdatedTimeStamp())
.add("AssociationId", associationId()).add("Name", name()).add("Owner", owner())
.add("ProviderType", providerTypeAsString()).add("State", stateAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AssociationArn":
return Optional.ofNullable(clazz.cast(associationArn()));
case "ConnectionArn":
return Optional.ofNullable(clazz.cast(connectionArn()));
case "LastUpdatedTimeStamp":
return Optional.ofNullable(clazz.cast(lastUpdatedTimeStamp()));
case "AssociationId":
return Optional.ofNullable(clazz.cast(associationId()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "Owner":
return Optional.ofNullable(clazz.cast(owner()));
case "ProviderType":
return Optional.ofNullable(clazz.cast(providerTypeAsString()));
case "State":
return Optional.ofNullable(clazz.cast(stateAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function