software.amazon.awssdk.services.codegurureviewer.model.RepositoryAssociation 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 a repository association. The DescribeRepositoryAssociation operation returns a RepositoryAssociation
object.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class RepositoryAssociation implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ASSOCIATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AssociationId").getter(getter(RepositoryAssociation::associationId))
.setter(setter(Builder::associationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AssociationId").build()).build();
private static final SdkField ASSOCIATION_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AssociationArn").getter(getter(RepositoryAssociation::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(RepositoryAssociation::connectionArn))
.setter(setter(Builder::connectionArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConnectionArn").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(RepositoryAssociation::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(RepositoryAssociation::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(RepositoryAssociation::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(RepositoryAssociation::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(RepositoryAssociation::stateReason)).setter(setter(Builder::stateReason))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StateReason").build()).build();
private static final SdkField LAST_UPDATED_TIME_STAMP_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastUpdatedTimeStamp").getter(getter(RepositoryAssociation::lastUpdatedTimeStamp))
.setter(setter(Builder::lastUpdatedTimeStamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdatedTimeStamp").build())
.build();
private static final SdkField CREATED_TIME_STAMP_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreatedTimeStamp").getter(getter(RepositoryAssociation::createdTimeStamp))
.setter(setter(Builder::createdTimeStamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedTimeStamp").build()).build();
private static final SdkField KMS_KEY_DETAILS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("KMSKeyDetails")
.getter(getter(RepositoryAssociation::kmsKeyDetails)).setter(setter(Builder::kmsKeyDetails))
.constructor(KMSKeyDetails::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KMSKeyDetails").build()).build();
private static final SdkField S3_REPOSITORY_DETAILS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("S3RepositoryDetails")
.getter(getter(RepositoryAssociation::s3RepositoryDetails)).setter(setter(Builder::s3RepositoryDetails))
.constructor(S3RepositoryDetails::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("S3RepositoryDetails").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ASSOCIATION_ID_FIELD,
ASSOCIATION_ARN_FIELD, CONNECTION_ARN_FIELD, NAME_FIELD, OWNER_FIELD, PROVIDER_TYPE_FIELD, STATE_FIELD,
STATE_REASON_FIELD, LAST_UPDATED_TIME_STAMP_FIELD, CREATED_TIME_STAMP_FIELD, KMS_KEY_DETAILS_FIELD,
S3_REPOSITORY_DETAILS_FIELD));
private static final long serialVersionUID = 1L;
private final String associationId;
private final String associationArn;
private final String connectionArn;
private final String name;
private final String owner;
private final String providerType;
private final String state;
private final String stateReason;
private final Instant lastUpdatedTimeStamp;
private final Instant createdTimeStamp;
private final KMSKeyDetails kmsKeyDetails;
private final S3RepositoryDetails s3RepositoryDetails;
private RepositoryAssociation(BuilderImpl builder) {
this.associationId = builder.associationId;
this.associationArn = builder.associationArn;
this.connectionArn = builder.connectionArn;
this.name = builder.name;
this.owner = builder.owner;
this.providerType = builder.providerType;
this.state = builder.state;
this.stateReason = builder.stateReason;
this.lastUpdatedTimeStamp = builder.lastUpdatedTimeStamp;
this.createdTimeStamp = builder.createdTimeStamp;
this.kmsKeyDetails = builder.kmsKeyDetails;
this.s3RepositoryDetails = builder.s3RepositoryDetails;
}
/**
*
* The ID of the repository association.
*
*
* @return The ID of the repository association.
*/
public final String associationId() {
return associationId;
}
/**
*
* The Amazon Resource Name (ARN) identifying the repository association.
*
*
* @return The Amazon Resource Name (ARN) identifying the repository association.
*/
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 name of the repository.
*
*
* @return The name of the repository.
*/
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;
}
/**
*
* A description of why the repository association is in the current state.
*
*
* @return A description of why the repository association is in the current state.
*/
public final String stateReason() {
return stateReason;
}
/**
*
* The time, in milliseconds since the epoch, when the repository association was last updated.
*
*
* @return The time, in milliseconds since the epoch, when the repository association was last updated.
*/
public final Instant lastUpdatedTimeStamp() {
return lastUpdatedTimeStamp;
}
/**
*
* The time, in milliseconds since the epoch, when the repository association was created.
*
*
* @return The time, in milliseconds since the epoch, when the repository association was created.
*/
public final Instant createdTimeStamp() {
return createdTimeStamp;
}
/**
*
* A KMSKeyDetails
object that contains:
*
*
* -
*
* The encryption option for this repository association. It is either owned by Amazon Web Services Key Management
* Service (KMS) (AWS_OWNED_CMK
) or customer managed (CUSTOMER_MANAGED_CMK
).
*
*
* -
*
* The ID of the Amazon Web Services KMS key that is associated with this repository association.
*
*
*
*
* @return A KMSKeyDetails
object that contains:
*
* -
*
* The encryption option for this repository association. It is either owned by Amazon Web Services Key
* Management Service (KMS) (AWS_OWNED_CMK
) or customer managed (
* CUSTOMER_MANAGED_CMK
).
*
*
* -
*
* The ID of the Amazon Web Services KMS key that is associated with this repository association.
*
*
*/
public final KMSKeyDetails kmsKeyDetails() {
return kmsKeyDetails;
}
/**
* Returns the value of the S3RepositoryDetails property for this object.
*
* @return The value of the S3RepositoryDetails property for this object.
*/
public final S3RepositoryDetails s3RepositoryDetails() {
return s3RepositoryDetails;
}
@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(associationId());
hashCode = 31 * hashCode + Objects.hashCode(associationArn());
hashCode = 31 * hashCode + Objects.hashCode(connectionArn());
hashCode = 31 * hashCode + Objects.hashCode(name());
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(lastUpdatedTimeStamp());
hashCode = 31 * hashCode + Objects.hashCode(createdTimeStamp());
hashCode = 31 * hashCode + Objects.hashCode(kmsKeyDetails());
hashCode = 31 * hashCode + Objects.hashCode(s3RepositoryDetails());
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 RepositoryAssociation)) {
return false;
}
RepositoryAssociation other = (RepositoryAssociation) obj;
return Objects.equals(associationId(), other.associationId()) && Objects.equals(associationArn(), other.associationArn())
&& Objects.equals(connectionArn(), other.connectionArn()) && Objects.equals(name(), other.name())
&& Objects.equals(owner(), other.owner()) && Objects.equals(providerTypeAsString(), other.providerTypeAsString())
&& Objects.equals(stateAsString(), other.stateAsString()) && Objects.equals(stateReason(), other.stateReason())
&& Objects.equals(lastUpdatedTimeStamp(), other.lastUpdatedTimeStamp())
&& Objects.equals(createdTimeStamp(), other.createdTimeStamp())
&& Objects.equals(kmsKeyDetails(), other.kmsKeyDetails())
&& Objects.equals(s3RepositoryDetails(), other.s3RepositoryDetails());
}
/**
* 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("RepositoryAssociation").add("AssociationId", associationId())
.add("AssociationArn", associationArn()).add("ConnectionArn", connectionArn()).add("Name", name())
.add("Owner", owner()).add("ProviderType", providerTypeAsString()).add("State", stateAsString())
.add("StateReason", stateReason()).add("LastUpdatedTimeStamp", lastUpdatedTimeStamp())
.add("CreatedTimeStamp", createdTimeStamp()).add("KMSKeyDetails", kmsKeyDetails())
.add("S3RepositoryDetails", s3RepositoryDetails()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AssociationId":
return Optional.ofNullable(clazz.cast(associationId()));
case "AssociationArn":
return Optional.ofNullable(clazz.cast(associationArn()));
case "ConnectionArn":
return Optional.ofNullable(clazz.cast(connectionArn()));
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()));
case "StateReason":
return Optional.ofNullable(clazz.cast(stateReason()));
case "LastUpdatedTimeStamp":
return Optional.ofNullable(clazz.cast(lastUpdatedTimeStamp()));
case "CreatedTimeStamp":
return Optional.ofNullable(clazz.cast(createdTimeStamp()));
case "KMSKeyDetails":
return Optional.ofNullable(clazz.cast(kmsKeyDetails()));
case "S3RepositoryDetails":
return Optional.ofNullable(clazz.cast(s3RepositoryDetails()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function