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 <PutImageResponse[]> RetagImageAsync(this ECRHelper ecr, string imageTag, string imageTagNew, string registryId, string repositoryName, CancellationToken cancellationToken = default(CancellationToken)) { var images = await ecr.GetImagesByTag(imageTag, registryId, repositoryName, cancellationToken); var piresp = await images.ForEachAsync(i => ecr._ECRClient.PutImageAsync(new PutImageRequest() { ImageManifest = i.ImageManifest, ImageTag = imageTagNew, RegistryId = registryId, RepositoryName = repositoryName }, cancellationToken), cancellationToken : cancellationToken).EnsureSuccess(); return(piresp); }