software.amazon.awssdk.services.ecr.model.Repository Maven / Gradle / Ivy
Show all versions of ecr Show documentation
/*
* Copyright 2012-2017 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.ecr.model;
import java.time.Instant;
import java.util.Optional;
import javax.annotation.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.protocol.ProtocolMarshaller;
import software.amazon.awssdk.core.protocol.StructuredPojo;
import software.amazon.awssdk.services.ecr.transform.RepositoryMarshaller;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* An object representing a repository.
*
*/
@Generated("software.amazon.awssdk:codegen")
public class Repository implements StructuredPojo, ToCopyableBuilder {
private final String repositoryArn;
private final String registryId;
private final String repositoryName;
private final String repositoryUri;
private final Instant createdAt;
private Repository(BuilderImpl builder) {
this.repositoryArn = builder.repositoryArn;
this.registryId = builder.registryId;
this.repositoryName = builder.repositoryName;
this.repositoryUri = builder.repositoryUri;
this.createdAt = builder.createdAt;
}
/**
*
* The Amazon Resource Name (ARN) that identifies the repository. The ARN contains the arn:aws:ecr
* namespace, followed by the region of the repository, the AWS account ID of the repository owner, the repository
* namespace, and then the repository name. For example,
* arn:aws:ecr:region:012345678910:repository/test
.
*
*
* @return The Amazon Resource Name (ARN) that identifies the repository. The ARN contains the
* arn:aws:ecr
namespace, followed by the region of the repository, the AWS account ID of the
* repository owner, the repository namespace, and then the repository name. For example,
* arn:aws:ecr:region:012345678910:repository/test
.
*/
public String repositoryArn() {
return repositoryArn;
}
/**
*
* The AWS account ID associated with the registry that contains the repository.
*
*
* @return The AWS account ID associated with the registry that contains the repository.
*/
public String registryId() {
return registryId;
}
/**
*
* The name of the repository.
*
*
* @return The name of the repository.
*/
public String repositoryName() {
return repositoryName;
}
/**
*
* The URI for the repository. You can use this URI for Docker push
and pull
operations.
*
*
* @return The URI for the repository. You can use this URI for Docker push
and pull
* operations.
*/
public String repositoryUri() {
return repositoryUri;
}
/**
*
* The date and time, in JavaScript date/time format, when the repository was created.
*
*
* @return The date and time, in JavaScript date/time format, when the repository was created.
*/
public Instant createdAt() {
return createdAt;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + ((repositoryArn() == null) ? 0 : repositoryArn().hashCode());
hashCode = 31 * hashCode + ((registryId() == null) ? 0 : registryId().hashCode());
hashCode = 31 * hashCode + ((repositoryName() == null) ? 0 : repositoryName().hashCode());
hashCode = 31 * hashCode + ((repositoryUri() == null) ? 0 : repositoryUri().hashCode());
hashCode = 31 * hashCode + ((createdAt() == null) ? 0 : createdAt().hashCode());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof Repository)) {
return false;
}
Repository other = (Repository) obj;
if (other.repositoryArn() == null ^ this.repositoryArn() == null) {
return false;
}
if (other.repositoryArn() != null && !other.repositoryArn().equals(this.repositoryArn())) {
return false;
}
if (other.registryId() == null ^ this.registryId() == null) {
return false;
}
if (other.registryId() != null && !other.registryId().equals(this.registryId())) {
return false;
}
if (other.repositoryName() == null ^ this.repositoryName() == null) {
return false;
}
if (other.repositoryName() != null && !other.repositoryName().equals(this.repositoryName())) {
return false;
}
if (other.repositoryUri() == null ^ this.repositoryUri() == null) {
return false;
}
if (other.repositoryUri() != null && !other.repositoryUri().equals(this.repositoryUri())) {
return false;
}
if (other.createdAt() == null ^ this.createdAt() == null) {
return false;
}
if (other.createdAt() != null && !other.createdAt().equals(this.createdAt())) {
return false;
}
return true;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("{");
if (repositoryArn() != null) {
sb.append("RepositoryArn: ").append(repositoryArn()).append(",");
}
if (registryId() != null) {
sb.append("RegistryId: ").append(registryId()).append(",");
}
if (repositoryName() != null) {
sb.append("RepositoryName: ").append(repositoryName()).append(",");
}
if (repositoryUri() != null) {
sb.append("RepositoryUri: ").append(repositoryUri()).append(",");
}
if (createdAt() != null) {
sb.append("CreatedAt: ").append(createdAt()).append(",");
}
if (sb.length() > 1) {
sb.setLength(sb.length() - 1);
}
sb.append("}");
return sb.toString();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "repositoryArn":
return Optional.of(clazz.cast(repositoryArn()));
case "registryId":
return Optional.of(clazz.cast(registryId()));
case "repositoryName":
return Optional.of(clazz.cast(repositoryName()));
case "repositoryUri":
return Optional.of(clazz.cast(repositoryUri()));
case "createdAt":
return Optional.of(clazz.cast(createdAt()));
default:
return Optional.empty();
}
}
@SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
RepositoryMarshaller.getInstance().marshall(this, protocolMarshaller);
}
public interface Builder extends CopyableBuilder {
/**
*
* The Amazon Resource Name (ARN) that identifies the repository. The ARN contains the arn:aws:ecr
* namespace, followed by the region of the repository, the AWS account ID of the repository owner, the
* repository namespace, and then the repository name. For example,
* arn:aws:ecr:region:012345678910:repository/test
.
*
*
* @param repositoryArn
* The Amazon Resource Name (ARN) that identifies the repository. The ARN contains the
* arn:aws:ecr
namespace, followed by the region of the repository, the AWS account ID of
* the repository owner, the repository namespace, and then the repository name. For example,
* arn:aws:ecr:region:012345678910:repository/test
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder repositoryArn(String repositoryArn);
/**
*
* The AWS account ID associated with the registry that contains the repository.
*
*
* @param registryId
* The AWS account ID associated with the registry that contains the repository.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder registryId(String registryId);
/**
*
* 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 URI for the repository. You can use this URI for Docker push
and pull
* operations.
*
*
* @param repositoryUri
* The URI for the repository. You can use this URI for Docker push
and pull
* operations.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder repositoryUri(String repositoryUri);
/**
*
* The date and time, in JavaScript date/time format, when the repository was created.
*
*
* @param createdAt
* The date and time, in JavaScript date/time format, when the repository was created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder createdAt(Instant createdAt);
}
static final class BuilderImpl implements Builder {
private String repositoryArn;
private String registryId;
private String repositoryName;
private String repositoryUri;
private Instant createdAt;
private BuilderImpl() {
}
private BuilderImpl(Repository model) {
repositoryArn(model.repositoryArn);
registryId(model.registryId);
repositoryName(model.repositoryName);
repositoryUri(model.repositoryUri);
createdAt(model.createdAt);
}
public final String getRepositoryArn() {
return repositoryArn;
}
@Override
public final Builder repositoryArn(String repositoryArn) {
this.repositoryArn = repositoryArn;
return this;
}
public final void setRepositoryArn(String repositoryArn) {
this.repositoryArn = repositoryArn;
}
public final String getRegistryId() {
return registryId;
}
@Override
public final Builder registryId(String registryId) {
this.registryId = registryId;
return this;
}
public final void setRegistryId(String registryId) {
this.registryId = registryId;
}
public final String getRepositoryName() {
return repositoryName;
}
@Override
public final Builder repositoryName(String repositoryName) {
this.repositoryName = repositoryName;
return this;
}
public final void setRepositoryName(String repositoryName) {
this.repositoryName = repositoryName;
}
public final String getRepositoryUri() {
return repositoryUri;
}
@Override
public final Builder repositoryUri(String repositoryUri) {
this.repositoryUri = repositoryUri;
return this;
}
public final void setRepositoryUri(String repositoryUri) {
this.repositoryUri = repositoryUri;
}
public final Instant getCreatedAt() {
return createdAt;
}
@Override
public final Builder createdAt(Instant createdAt) {
this.createdAt = createdAt;
return this;
}
public final void setCreatedAt(Instant createdAt) {
this.createdAt = createdAt;
}
@Override
public Repository build() {
return new Repository(this);
}
}
}