@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getRepositoryName() == null) ? 0 : getRepositoryName().hashCode()); hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); return hashCode; }
/** * <p> * The name to use for the repository. The repository name may be specified on its own (such as * <code>nginx-web-app</code>) or it can be prepended with a namespace to group the repository into a category (such * as <code>project-a/nginx-web-app</code>). * </p> * * @param repositoryName * The name to use for the repository. The repository name may be specified on its own (such as * <code>nginx-web-app</code>) or it can be prepended with a namespace to group the repository into a * category (such as <code>project-a/nginx-web-app</code>). * @return Returns a reference to this object so that method calls can be chained together. */ public CreateRepositoryRequest withRepositoryName(String repositoryName) { setRepositoryName(repositoryName); return this; }
/** * <p/> * * @param tags * @return Returns a reference to this object so that method calls can be chained together. */ public CreateRepositoryRequest withTags(java.util.Collection<Tag> tags) { setTags(tags); return this; }
@TaskAction public void createRepository() { AmazonECRPluginExtension ext = getProject().getExtensions().getByType(AmazonECRPluginExtension.class); AmazonECR ecr = ext.getClient(); String repositoryName = MoreObjects.firstNonNull(getRepositoryName(), ext.getRepositoryName()); try { CreateRepositoryResult result = ecr.createRepository(new CreateRepositoryRequest().withRepositoryName(repositoryName)); repository = result.getRepository(); } catch (RepositoryAlreadyExistsException ex) { DescribeRepositoriesResult describeRepositoriesResult = ecr.describeRepositories(new DescribeRepositoriesRequest()); for (Repository repositoryResult : describeRepositoriesResult.getRepositories()) { if (repositoryResult.getRepositoryName().equals(repositoryName)) { repository = repositoryResult; break; } } } } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreateRepositoryRequest == false) return false; CreateRepositoryRequest other = (CreateRepositoryRequest) obj; if (other.getRepositoryName() == null ^ this.getRepositoryName() == null) return false; if (other.getRepositoryName() != null && other.getRepositoryName().equals(this.getRepositoryName()) == false) return false; if (other.getTags() == null ^ this.getTags() == null) return false; if (other.getTags() != null && other.getTags().equals(this.getTags()) == false) return false; return true; }
/** * <p/> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setTags(java.util.Collection)} or {@link #withTags(java.util.Collection)} if you want to override the * existing values. * </p> * * @param tags * @return Returns a reference to this object so that method calls can be chained together. */ public CreateRepositoryRequest withTags(Tag... tags) { if (this.tags == null) { setTags(new java.util.ArrayList<Tag>(tags.length)); } for (Tag ele : tags) { this.tags.add(ele); } return this; }
/** * <p> * The name to use for the repository. The repository name may be specified on its own (such as * <code>nginx-web-app</code>) or it can be prepended with a namespace to group the repository into a category (such * as <code>project-a/nginx-web-app</code>). * </p> * * @param repositoryName * The name to use for the repository. The repository name may be specified on its own (such as * <code>nginx-web-app</code>) or it can be prepended with a namespace to group the repository into a * category (such as <code>project-a/nginx-web-app</code>). * @return Returns a reference to this object so that method calls can be chained together. */ public CreateRepositoryRequest withRepositoryName(String repositoryName) { setRepositoryName(repositoryName); return this; }
/** * 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. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getRepositoryName() != null) sb.append("RepositoryName: ").append(getRepositoryName()).append(","); if (getTags() != null) sb.append("Tags: ").append(getTags()); sb.append("}"); return sb.toString(); }
/** * <p/> * * @param tags * @return Returns a reference to this object so that method calls can be chained together. */ public CreateRepositoryRequest withTags(java.util.Collection<Tag> tags) { setTags(tags); return this; }
/** * Marshall the given parameter object. */ public void marshall(CreateRepositoryRequest createRepositoryRequest, ProtocolMarshaller protocolMarshaller) { if (createRepositoryRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createRepositoryRequest.getRepositoryName(), REPOSITORYNAME_BINDING); protocolMarshaller.marshall(createRepositoryRequest.getTags(), TAGS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } }
/** * <p/> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setTags(java.util.Collection)} or {@link #withTags(java.util.Collection)} if you want to override the * existing values. * </p> * * @param tags * @return Returns a reference to this object so that method calls can be chained together. */ public CreateRepositoryRequest withTags(Tag... tags) { if (this.tags == null) { setTags(new java.util.ArrayList<Tag>(tags.length)); } for (Tag ele : tags) { this.tags.add(ele); } return this; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getRepositoryName() == null) ? 0 : getRepositoryName().hashCode()); hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreateRepositoryRequest == false) return false; CreateRepositoryRequest other = (CreateRepositoryRequest) obj; if (other.getRepositoryName() == null ^ this.getRepositoryName() == null) return false; if (other.getRepositoryName() != null && other.getRepositoryName().equals(this.getRepositoryName()) == false) return false; if (other.getTags() == null ^ this.getTags() == null) return false; if (other.getTags() != null && other.getTags().equals(this.getTags()) == false) return false; return true; }
/** * 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. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getRepositoryName() != null) sb.append("RepositoryName: ").append(getRepositoryName()).append(","); if (getTags() != null) sb.append("Tags: ").append(getTags()); sb.append("}"); return sb.toString(); }
/** * Marshall the given parameter object. */ public void marshall(CreateRepositoryRequest createRepositoryRequest, ProtocolMarshaller protocolMarshaller) { if (createRepositoryRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createRepositoryRequest.getRepositoryName(), REPOSITORYNAME_BINDING); protocolMarshaller.marshall(createRepositoryRequest.getTags(), TAGS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } }