public static async Task <BatchDeleteImageResponse> BatchDeleteImagesByTag(this ECRHelper ecr, string imageTag, string registryId, string repositoryName, CancellationToken cancellationToken = default(CancellationToken)) { if (imageTag.IsNullOrEmpty()) { return(await ecr.BatchDeleteUntaggedImages(registryId, repositoryName, cancellationToken)); } var images = (await ecr.GetImagesByTag(imageTag, registryId, repositoryName, cancellationToken)) .Select(i => i.ImageId).ToArray(); return(await ecr.BatchDeleteImageAsync(images, registryId, repositoryName, cancellationToken)); }
public static async Task <BatchDeleteImageResponse> BatchDeleteUntaggedImages(this ECRHelper ecr, string registryId, string repositoryName, CancellationToken cancellationToken = default(CancellationToken)) { var iIDs = await ecr.ListImagesAsync(TagStatus.UNTAGGED, registryId : registryId, repositoryName : repositoryName, cancellationToken : cancellationToken); if (iIDs.Length <= 0) { return new BatchDeleteImageResponse() { HttpStatusCode = System.Net.HttpStatusCode.OK } } ; return(await ecr.BatchDeleteImageAsync(iIDs, registryId, repositoryName, cancellationToken)); }