/** * 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 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; }
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)
/** * 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; }
/** * 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(); }
holder.tvRepositoryName.setText(repository.getRepositoryName()); holder.tvLanguage.setText(repository.getLanguage()); holder.tvBranchCount.setText(repository.getBranchCount());
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)
/** * 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); } }
@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; } } } } }
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; }
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; }