forked from Azure/azure-sdk-for-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
…into regen_qna * 'main' of https://github.com/Azure/azure-sdk-for-python: (38 commits) update code owner for identity and synapse (Azure#20941) [AutoRelease] t2-quota-2021-09-07-50984 (Azure#20558) [AutoRelease] t2-fluidrelay-2021-09-30-54645 (Azure#20962) [formrecognizer] Update doc strings for v3 (Azure#20920) update changelog (Azure#20958) [SchemaRegistry] add lru cache to avro serializer (Azure#20813) [formrecognizer] fixing error on ModelOperation to include details (Azure#20954) [rest] fix aiohttp read in rest (Azure#20952) docstring feedback from service team (Azure#20955) Prepare EG for release (Azure#20956) [formrecognizer] Print fields in custom documents samples (Azure#20904) Ma test fixes (Azure#20946) Update samples in ACR (Azure#20902) New Events (Azure#20951) skip v2.0 compatibility tests (Azure#20949) [Key Vault] Get default API version from sync client base (Azure#20379) [purview scanning] new release by new LLC version (Azure#20823) [Purview catalog] release for new api-version `2021-09-01` (Azure#20822) disable regression testing for beta version of questionanswering (Azure#20924) Oct release (Azure#20890) ...
- Loading branch information
Showing
1,081 changed files
with
139,337 additions
and
219,438 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ | |
import argparse | ||
import os | ||
import logging | ||
import sys | ||
|
||
from common_tasks import run_check_call | ||
|
||
|
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
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
64 changes: 64 additions & 0 deletions
64
...ainerregistry/azure-containerregistry/samples/async_samples/sample_delete_images_async.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# coding: utf-8 | ||
|
||
# ------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for | ||
# license information. | ||
# -------------------------------------------------------------------------- | ||
|
||
""" | ||
FILE: sample_delete_images_async.py | ||
DESCRIPTION: | ||
This sample demonstrates deleting all but the most recent three images for each repository. | ||
USAGE: | ||
python sample_delete_images_async.py | ||
Set the environment variables with your own values before running the sample: | ||
1) CONTAINERREGISTRY_ENDPOINT - The URL of you Container Registry account | ||
""" | ||
|
||
import asyncio | ||
from dotenv import find_dotenv, load_dotenv | ||
import os | ||
|
||
from azure.containerregistry import ManifestOrder | ||
from azure.containerregistry.aio import ContainerRegistryClient | ||
from azure.identity.aio import DefaultAzureCredential | ||
|
||
|
||
class DeleteImagesAsync(object): | ||
def __init__(self): | ||
load_dotenv(find_dotenv()) | ||
|
||
async def delete_images(self): | ||
# [START list_repository_names] | ||
audience = "https://management.azure.com" | ||
account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"] | ||
credential = DefaultAzureCredential() | ||
client = ContainerRegistryClient(account_url, credential, audience=audience) | ||
|
||
async with client: | ||
async for repository in client.list_repository_names(): | ||
print(repository) | ||
# [END list_repository_names] | ||
|
||
# [START list_manifest_properties] | ||
# Keep the three most recent images, delete everything else | ||
manifest_count = 0 | ||
async for manifest in client.list_manifest_properties(repository, order_by=ManifestOrder.LAST_UPDATE_TIME_DESCENDING): | ||
manifest_count += 1 | ||
if manifest_count > 3: | ||
await client.delete_manifest(repository, manifest.digest) | ||
# [END list_manifest_properties] | ||
|
||
|
||
async def main(): | ||
sample = DeleteImagesAsync() | ||
await sample.delete_images() | ||
|
||
|
||
if __name__ == "__main__": | ||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(main()) |
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
Oops, something went wrong.