Created
July 17, 2018 17:35
-
-
Save punya-asapp/2ab6a19e07a3178fe9aed4cf39280edf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gather_pages(func, *args, **kwargs): | |
result = func(*args, **kwargs) | |
yield result | |
while 'nextToken' in result: | |
result = func(*args, kwargs, nextToken=result['nextToken']) | |
yield result | |
def describe_all_images(registry_id, repository_name): | |
client = boto3.client('ecr') | |
return [image | |
for image in resp['imageDetails'] | |
for resp in gather_pages(client.describe_images, | |
registryId=registry_id, | |
repositoryName=repository_name, | |
maxResults=100)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment