Skip to content

[Container Registry] addressing issues #18486

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
1 commit merged into from
May 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sdk/containerregistry/azure-containerregistry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Use the client library for Azure Container Registry to:
- Set read/write/delete properties on registry items
- Delete images and artifacts, repositories and tags

[Source code][source] | [Package (Pypi)][package] | [API reference documentation]<!--[docs]--> | [REST API documentation][rest_docs] | [Product documentation][product_docs]
[Source code][source] | [Package (Pypi)][package] | [API reference documentation][docs] | [REST API documentation][rest_docs] | [Product documentation][product_docs]

## Getting started

Expand Down Expand Up @@ -100,7 +100,7 @@ additional questions or comments.
<!-- LINKS -->
[source]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/containerregistry/azure-containerregistry
[package]: https://pypi.org/project/azure-containerregistry/
<!-- [docs]: https://docs.microsoft.com/python/api/overview/azure/container-registry?view=azure-python-preview -->
[docs]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-containerregistry/1.0.0b1/index.html
[rest_docs]: https://docs.microsoft.com/rest/api/containerregistry/
[product_docs]: https://docs.microsoft.com/azure/container-registry
[pip_link]: https://pypi.org
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ Check out the [API reference documentation][rest_docs] to learn more about what
[rest_docs]: https://docs.microsoft.com/rest/api/containerregistry/

[container_registry_docs]: https://docs.microsoft.com/azure/container-registry/container-registry-intro

[create_client]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/containerregistry/azure-containerregistry/samples/sample_create_client.py
[create_client_async]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/containerregistry/azure-containerregistry/samples/async_samples/sample_create_client_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
1) AZURE_CONTAINERREGISTRY_URL - The URL of you Container Registry account
"""

import asyncio
from dotenv import find_dotenv, load_dotenv
import os

Expand All @@ -28,7 +29,7 @@ def __init__(self):
load_dotenv(find_dotenv())
self.account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"]

def create_registry_client(self):
async def create_registry_client(self):
# Instantiate the ContainerRegistryClient
# [START create_registry_client]
from azure.containerregistry.aio import ContainerRegistryClient
Expand All @@ -37,7 +38,7 @@ def create_registry_client(self):
client = ContainerRegistryClient(self.account_url, DefaultAzureCredential())
# [END create_registry_client]

def create_repository_client(self):
async def create_repository_client(self):
# Instantiate the ContainerRegistryClient
# [START create_repository_client]
from azure.containerregistry.aio import ContainerRepositoryClient
Expand Down Expand Up @@ -66,7 +67,13 @@ async def basic_sample(self):
print(tag.digest)


if __name__ == "__main__":
async def main():
sample = CreateClients()
sample.create_registry_client()
sample.create_repository_client()
await sample.create_registry_client()
await sample.create_repository_client()
await sample.basic_sample()


if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(main())