bioshed / bioshed_utils

GNU General Public License v3.0
0 stars 0 forks source link

figure out list containers in public ECR #4

Closed bioshed closed 1 year ago

bioshed commented 2 years ago

boto3 ?

bioshed commented 1 year ago

def list_containers(): containers = {} client = boto3.client('ecr-public', region_name='us-east-1') next_token = 'first' while next_token != '': metadata = client.describe_repositories( registryId=REPO_REGISTRY_ID, maxResults=1000 ) if next_token == 'first' else \ client.describe_repositories( registryId=REPO_REGISTRY_ID, maxResults=1000, nextToken=next_token ) repos = metadata['repositories'] for repo in repos: containers[repo['repositoryName']] = repo['repositoryUri'] next_token = metadata['nextToken'] if 'nextToken' in metadata else '' return containers