@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getRepositoryArn() == null) ? 0 : getRepositoryArn().hashCode()); hashCode = prime * hashCode + ((getRegistryId() == null) ? 0 : getRegistryId().hashCode()); hashCode = prime * hashCode + ((getRepositoryName() == null) ? 0 : getRepositoryName().hashCode()); hashCode = prime * hashCode + ((getRepositoryUri() == null) ? 0 : getRepositoryUri().hashCode()); hashCode = prime * hashCode + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode()); return hashCode; }
holder.tvRepositoryName.setText(repository.getRepositoryName()); holder.tvLanguage.setText(repository.getLanguage()); holder.tvBranchCount.setText(repository.getBranchCount()); holder.tvInFavoriteCount.setText(repository.getInFavoriteCount());
public List<ContainerRepo> listRepositories(PageIterator pageIterator) { int pageSize = pageIterator.getPageSize(); if(pageSize > 100) throw(new IllegalArgumentException("Page Size cannot be greater than 100")); DescribeRepositoriesRequest request = new DescribeRepositoriesRequest(); request.setMaxResults(pageSize); request.setNextToken(pageIterator.getMarker()); DescribeRepositoriesResult result = _awsEcrClient.describeRepositories(request); pageIterator.setMarker(result.getNextToken()); List<Repository> ecrRepos = result.getRepositories(); List<ContainerRepo> containerRepos = new ArrayList<ContainerRepo>(); for(Repository ecrRepo : ecrRepos) { ContainerRepo repo = ContainerRepo .builder() .provider(RegistryProvider.ECR) .credId(_registryCred.getId()) .region(_registryCred.getRegion()) .name(ecrRepo.getRepositoryName()) .registryId(ecrRepo.getRegistryId()) .endpoint(URI.create(ecrRepo.getRepositoryUri()).getHost()) .build(); containerRepos.add(repo); } return containerRepos; }
public Repository unmarshall(JsonUnmarshallerContext context) throws Exception { Repository repository = new Repository(); if (context.testExpression("repositoryArn", targetDepth)) { context.nextToken(); repository.setRepositoryArn(context.getUnmarshaller(String.class).unmarshall(context)); repository.setRegistryId(context.getUnmarshaller(String.class).unmarshall(context)); repository.setRepositoryName(context.getUnmarshaller(String.class).unmarshall(context)); repository.setRepositoryUri(context.getUnmarshaller(String.class).unmarshall(context)); repository.setCreatedAt(DateJsonUnmarshallerFactory.getInstance("unixTimestamp").unmarshall(context));
public ContainerRepo getRepository(String repoName) { DescribeRepositoriesRequest request = new DescribeRepositoriesRequest(); List<String> repoNames = new ArrayList<String>(); repoNames.add(repoName); request.setRepositoryNames(repoNames); DescribeRepositoriesResult result = _awsEcrClient.describeRepositories(request); List<Repository> ecrRepos = result.getRepositories(); if(ecrRepos == null || ecrRepos.size() == 0) return null; Repository ecrRepo = ecrRepos.get(0); ContainerRepo repo = ContainerRepo .builder() .provider(RegistryProvider.ECR) .credId(_registryCred.getId()) .region(_registryCred.getRegion()) .name(ecrRepo.getRepositoryName()) .registryId(ecrRepo.getRegistryId()) .build(); return repo; }
@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 CreateRepositoryResult == false) return false; CreateRepositoryResult other = (CreateRepositoryResult) obj; if (other.getRepository() == null ^ this.getRepository() == null) return false; if (other.getRepository() != null && other.getRepository().equals(this.getRepository()) == false) return false; return true; }
public Repository unmarshall(JsonUnmarshallerContext context) throws Exception { Repository repository = new Repository(); if (context.testExpression("repositoryArn", targetDepth)) { context.nextToken(); repository.setRepositoryArn(context.getUnmarshaller(String.class).unmarshall(context)); repository.setRegistryId(context.getUnmarshaller(String.class).unmarshall(context)); repository.setRepositoryName(context.getUnmarshaller(String.class).unmarshall(context)); repository.setRepositoryUri(context.getUnmarshaller(String.class).unmarshall(context)); repository.setCreatedAt(DateJsonUnmarshallerFactory.getInstance("unixTimestamp").unmarshall(context));
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DeleteRepositoryResult == false) return false; DeleteRepositoryResult other = (DeleteRepositoryResult) obj; if (other.getRepository() == null ^ this.getRepository() == null) return false; if (other.getRepository() != null && other.getRepository().equals(this.getRepository()) == false) return false; return true; }
return false; Repository other = (Repository) obj; if (other.getRepositoryArn() == null ^ this.getRepositoryArn() == null) return false; if (other.getRepositoryArn() != null && other.getRepositoryArn().equals(this.getRepositoryArn()) == false) return false; if (other.getRegistryId() == null ^ this.getRegistryId() == null) return false; if (other.getRegistryId() != null && other.getRegistryId().equals(this.getRegistryId()) == false) return false; if (other.getRepositoryName() == null ^ this.getRepositoryName() == null) return false; if (other.getRepositoryName() != null && other.getRepositoryName().equals(this.getRepositoryName()) == false) return false; if (other.getRepositoryUri() == null ^ this.getRepositoryUri() == null) return false; if (other.getRepositoryUri() != null && other.getRepositoryUri().equals(this.getRepositoryUri()) == false) return false; if (other.getCreatedAt() == null ^ this.getCreatedAt() == null) return false; if (other.getCreatedAt() != null && other.getCreatedAt().equals(this.getCreatedAt()) == false) return false; return true;
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreateRepositoryResult == false) return false; CreateRepositoryResult other = (CreateRepositoryResult) obj; if (other.getRepository() == null ^ this.getRepository() == null) return false; if (other.getRepository() != null && other.getRepository().equals(this.getRepository()) == 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 (getRepositoryArn() != null) sb.append("RepositoryArn: ").append(getRepositoryArn()).append(","); if (getRegistryId() != null) sb.append("RegistryId: ").append(getRegistryId()).append(","); if (getRepositoryName() != null) sb.append("RepositoryName: ").append(getRepositoryName()).append(","); if (getRepositoryUri() != null) sb.append("RepositoryUri: ").append(getRepositoryUri()).append(","); if (getCreatedAt() != null) sb.append("CreatedAt: ").append(getCreatedAt()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DeleteRepositoryResult == false) return false; DeleteRepositoryResult other = (DeleteRepositoryResult) obj; if (other.getRepository() == null ^ this.getRepository() == null) return false; if (other.getRepository() != null && other.getRepository().equals(this.getRepository()) == false) return false; return true; }
/** * Marshall the given parameter object. */ public void marshall(Repository repository, ProtocolMarshaller protocolMarshaller) { if (repository == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(repository.getRepositoryArn(), REPOSITORYARN_BINDING); protocolMarshaller.marshall(repository.getRegistryId(), REGISTRYID_BINDING); protocolMarshaller.marshall(repository.getRepositoryName(), REPOSITORYNAME_BINDING); protocolMarshaller.marshall(repository.getRepositoryUri(), REPOSITORYURI_BINDING); protocolMarshaller.marshall(repository.getCreatedAt(), CREATEDAT_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getRepositoryArn() == null) ? 0 : getRepositoryArn().hashCode()); hashCode = prime * hashCode + ((getRegistryId() == null) ? 0 : getRegistryId().hashCode()); hashCode = prime * hashCode + ((getRepositoryName() == null) ? 0 : getRepositoryName().hashCode()); hashCode = prime * hashCode + ((getRepositoryUri() == null) ? 0 : getRepositoryUri().hashCode()); hashCode = prime * hashCode + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode()); return hashCode; }
return false; Repository other = (Repository) obj; if (other.getRepositoryArn() == null ^ this.getRepositoryArn() == null) return false; if (other.getRepositoryArn() != null && other.getRepositoryArn().equals(this.getRepositoryArn()) == false) return false; if (other.getRegistryId() == null ^ this.getRegistryId() == null) return false; if (other.getRegistryId() != null && other.getRegistryId().equals(this.getRegistryId()) == false) return false; if (other.getRepositoryName() == null ^ this.getRepositoryName() == null) return false; if (other.getRepositoryName() != null && other.getRepositoryName().equals(this.getRepositoryName()) == false) return false; if (other.getRepositoryUri() == null ^ this.getRepositoryUri() == null) return false; if (other.getRepositoryUri() != null && other.getRepositoryUri().equals(this.getRepositoryUri()) == false) return false; if (other.getCreatedAt() == null ^ this.getCreatedAt() == null) return false; if (other.getCreatedAt() != null && other.getCreatedAt().equals(this.getCreatedAt()) == 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 (getRepositoryArn() != null) sb.append("RepositoryArn: ").append(getRepositoryArn()).append(","); if (getRegistryId() != null) sb.append("RegistryId: ").append(getRegistryId()).append(","); if (getRepositoryName() != null) sb.append("RepositoryName: ").append(getRepositoryName()).append(","); if (getRepositoryUri() != null) sb.append("RepositoryUri: ").append(getRepositoryUri()).append(","); if (getCreatedAt() != null) sb.append("CreatedAt: ").append(getCreatedAt()); sb.append("}"); return sb.toString(); }
/** * Marshall the given parameter object. */ public void marshall(Repository repository, ProtocolMarshaller protocolMarshaller) { if (repository == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(repository.getRepositoryArn(), REPOSITORYARN_BINDING); protocolMarshaller.marshall(repository.getRegistryId(), REGISTRYID_BINDING); protocolMarshaller.marshall(repository.getRepositoryName(), REPOSITORYNAME_BINDING); protocolMarshaller.marshall(repository.getRepositoryUri(), REPOSITORYURI_BINDING); protocolMarshaller.marshall(repository.getCreatedAt(), CREATEDAT_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } }