Skip to content
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
97 changes: 49 additions & 48 deletions src/command_modules/azure-cli-acr/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,54 +9,54 @@ Commands to manage Azure container registries
az acr: Commands to manage Azure container registries.

Subgroups:
credential: Manage admin user credential for Azure container registries.
credential: Manage administrator login credentials for Azure container registries.
repository: Manage repositories for Azure container registries.

Commands:
check-name: Check whether the container registry name is available.
create : Create a container registry.
delete : Delete a container registry.
list : List container registries.
show : Get a container registry.
update : Update a container registry.
check-name: Checks whether the container registry name is available for use.
create : Creates or updates a container registry with the specified parameters.
delete : Deletes a container registry.
list : Lists all the available container registries under the current subscription.
show : Gets the properties of the specified container registry.
update : Updates a container registry with the specified parameters.

Create a container registry
-------------
::

Command
az acr create: Create a container registry.
az acr create: Creates or updates a container registry with the specified parameters.

Arguments
--location -l [Required]: Location.
--name -n [Required]: Name of container registry.
--name -n [Required]: The name of the container registry.
--resource-group -g [Required]: Name of resource group.
--admin-enabled : Enable admin user.
--storage-account-name -s : Name of an existing storage account.
--admin-enabled : Enable admin user. Allowed values: false, true.
--storage-account-name : The name of an existing storage account.

Examples
Create a container registry with a new storage account
az acr create -n myRegistry -g myResourceGroup -l southcentralus
Create a container registry with an existing storage account
az acr create -n myRegistry -g myResourceGroup -l southcentralus -s myStorageAccount
az acr create -n myRegistry -g myResourceGroup -l southcentralus --storage-account-name myStorageAccount

Delete a container registry
-------------
::

Command
az acr delete: Delete a container registry.
az acr delete: Deletes a container registry.

Arguments
--name -n [Required]: Name of container registry.
--name -n [Required]: The name of the container registry.
--resource-group -g : Name of resource group.

List container registries
-------------
::

Command
az acr list: List container registries.
az acr list: Lists all the available container registries under the current subscription.

Arguments
--resource-group -g: Name of resource group.
Expand All @@ -72,36 +72,37 @@ Get a container registry
::

Command
az acr show: Get a container registry.
az acr show: Gets the properties of the specified container registry.

Arguments
--name -n [Required]: Name of container registry.
--name -n [Required]: The name of the container registry.
--resource-group -g : Name of resource group.

Update a container registry
-------------
::

Command
az acr update: Update a container registry.
az acr update: Updates a container registry with the specified parameters.

Arguments
--name -n [Required]: Name of container registry.
--resource-group -g : Name of resource group.
--admin-enabled : Whether the admin user account is enabled. Allowed values: false, true.
--storage-account-name : Name of an existing storage account.
--tags : Space separated tags in 'key[=value]' format. Use "" to clear
existing tags.

--name -n [Required]: The name of the container registry.
--admin-enabled : The value that indicates whether the admin user is enabled. Allowed
values: false, true.
--resource-group -g : Name of resource group.
--storage-account-name: The name of an existing storage account.
--tags : Space separated tags in 'key[=value]' format. Use "" to clear existing
tags.

Generic Update Arguments
--add : Add an object to a list of objects by specifying a path and key value
pairs. Example: --add property.listProperty <key=value, string or
JSON string>.
--remove : Remove a property or an element from a list. Example: --remove
property.list <indexToRemove> OR --remove propertyToRemove.
--set : Update an object by specifying a property path and value to set.
Example: --set property1.property2=<value>.
--add : Add an object to a list of objects by specifying a path and key value
pairs. Example: --add property.listProperty <key=value, string or JSON
string>.
--remove : Remove a property or an element from a list. Example: --remove
property.list <indexToRemove> OR --remove propertyToRemove.
--set : Update an object by specifying a property path and value to set.
Example: --set property1.property2=<value>.

Examples
Update tags for a container registry
az acr update -n myRegistry --tags key1=value1 key2=value2
Expand All @@ -115,34 +116,34 @@ Get login credentials for a container registry
::

Command
az acr credential show: Get login credentials for a container registry.
az acr credential show: Gets the administrator login credentials for the specified container registry.

Arguments
--name -n [Required]: Name of container registry.
--name -n [Required]: The name of the container registry.
--resource-group -g : Name of resource group.

Regenerate login credentials for a container registry
-------------
::

Command
az acr credential renew: Regenerate login credentials for a container registry.
az acr credential renew: Regenerates the administrator login credentials for the specified container registry.

Arguments
--name -n [Required]: Name of container registry.
--name -n [Required]: The name of the container registry.
--resource-group -g : Name of resource group.

List repositories in a given container registry
-------------
::

Command
az acr repository list: List repositories in a given container registry.
az acr repository list: Lists repositories in the specified container registry.

Arguments
--name -n [Required]: Name of container registry.
--password -p : Password used to log into a container registry.
--username -u : Username used to log into a container registry.
--name -n [Required]: The name of the container registry.
--password -p : The password used to log into a container registry.
--username -u : The username used to log into a container registry.

Examples
List repositories in a given container registry if admin user is enabled
Expand All @@ -155,17 +156,17 @@ Show tags of a given repository in a given container registry
::

Command
az acr repository show-tags: Show tags of a given repository in a given container registry.
az acr repository show-tags: Shows tags of a given repository in the specified container
registry.

Arguments
--name -n [Required]: Name of container registry.
--name -n [Required]: The name of the container registry.
--repository [Required]: The repository to obtain tags from.
--password -p : Password used to log into a container registry.
--username -u : Username used to log into a container registry.
--password -p : The password used to log into a container registry.
--username -u : The username used to log into a container registry.

Examples
Show tags of a given repository in a given container registry if admin user is enabled
az acr repository show-tags -n myRegistry --repository myRepository
Show tags of a given repository in a given container registry with credentials
az acr repository show-tags -n myRegistry --repository myRepository -u myUsername -p
myPassword
az acr repository show-tags -n myRegistry --repository myRepository -u myUsername -p myPassword
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

helps['acr credential'] = """
type: group
short-summary: Manage admin user credential for Azure container registries.
short-summary: Manage administrator login credentials for Azure container registries.
"""

helps['acr repository'] = """
Expand All @@ -41,12 +41,12 @@
az acr create -n myRegistry -g myResourceGroup -l southcentralus
- name: Create a container registry with an existing storage account
text:
az acr create -n myRegistry -g myResourceGroup -l southcentralus -s myStorageAccount
az acr create -n myRegistry -g myResourceGroup -l southcentralus --storage-account-name myStorageAccount
"""

helps['acr update'] = """
type: command
short-summary: Update a container registry.
short-summary: Updates a container registry with the specified parameters.
examples:
- name: Update tags for a container registry
text:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,27 @@

register_cli_argument('acr', 'registry_name',
options_list=('--name', '-n'),
help='Name of container registry',
help='The name of the container registry',
completer=get_resource_name_completion_list(ACR_RESOURCE_TYPE))
register_cli_argument('acr', 'storage_account_name',
help='Name of an existing storage account',
help='The name of an existing storage account',
completer=get_resource_name_completion_list(STORAGE_RESOURCE_TYPE))

register_cli_argument('acr', 'resource_group_name', resource_group_name_type)
register_cli_argument('acr', 'location', location_type)
register_cli_argument('acr', 'tags', tags_type)
register_cli_argument('acr', 'admin_enabled',
help='Whether the admin user account is enabled.',
help='The value that indicates whether the admin user is enabled',
choices=['true', 'false'])

register_cli_argument('acr', 'username',
options_list=('--username', '-u'),
help='Username used to log into a container registry')
help='The username used to log into a container registry')
register_cli_argument('acr', 'password',
options_list=('--password', '-p'),
help='Password used to log into a container registry')
help='The password used to log into a container registry')

register_cli_argument('acr create', 'registry_name', completer=None)
register_cli_argument('acr create', 'resource_group_name',
validator=validate_resource_group_name)
register_cli_argument('acr check-name', 'registry_name', completer=None)
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
logger = _logging.get_az_logger(__name__)

def acr_credential_show(registry_name, resource_group_name=None):
'''Get login credentials for a container registry.
'''Gets the administrator login credentials for the specified container registry.
:param str registry_name: The name of container registry
:param str resource_group_name: The name of resource group
'''
Expand All @@ -22,7 +22,7 @@ def acr_credential_show(registry_name, resource_group_name=None):
return client.get_credentials(resource_group_name, registry_name)

def acr_credential_renew(registry_name, resource_group_name=None):
'''Regenerate login credentials for a container registry.
'''Regenerates the administrator login credentials for the specified container registry.
:param str registry_name: The name of container registry
:param str resource_group_name: The name of resource group
'''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@

import uuid

from azure.cli.core.commands import (
LongRunningOperation
)
from azure.cli.core.commands import LongRunningOperation

from azure.mgmt.containerregistry.models import (
Registry,
Expand All @@ -26,15 +24,15 @@
logger = _logging.get_az_logger(__name__)

def acr_check_name(registry_name):
'''Check whether the container registry name is available.
'''Checks whether the container registry name is available for use.
:param str registry_name: The name of container registry
'''
client = get_acr_service_client().registries

return client.check_name_availability(registry_name)

def acr_list(resource_group_name=None):
'''List container registries.
'''Lists all the available container registries under the current subscription.
:param str resource_group_name: The name of resource group
'''
client = get_acr_service_client().registries
Expand All @@ -49,7 +47,7 @@ def acr_create(registry_name, #pylint: disable=too-many-arguments
location,
storage_account_name=None,
admin_enabled=None):
'''Create a container registry.
'''Creates or updates a container registry with the specified parameters.
:param str registry_name: The name of container registry
:param str resource_group_name: The name of resource group
:param str location: The name of location
Expand Down Expand Up @@ -95,7 +93,7 @@ def acr_create(registry_name, #pylint: disable=too-many-arguments
return registry

def acr_delete(registry_name, resource_group_name=None):
'''Delete a container registry.
'''Deletes a container registry.
:param str registry_name: The name of container registry
:param str resource_group_name: The name of resource group
'''
Expand All @@ -107,7 +105,7 @@ def acr_delete(registry_name, resource_group_name=None):
return client.delete(resource_group_name, registry_name)

def acr_show(registry_name, resource_group_name=None):
'''Get a container registry.
'''Gets the properties of the specified container registry.
:param str registry_name: The name of container registry
:param str resource_group_name: The name of resource group
'''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def _validate_user_credentials(registry_name, path, resultIndex, username=None,
return _obtain_data_from_registry(login_server, path, resultIndex, username, password)

def acr_repository_list(registry_name, username=None, password=None):
'''List repositories in a given container registry.
'''Lists repositories in the specified container registry.
:param str registry_name: The name of container registry
:param str username: The username used to log into the container registry
:param str password: The password used to log into the container registry
Expand All @@ -78,7 +78,7 @@ def acr_repository_list(registry_name, username=None, password=None):
return _validate_user_credentials(registry_name, path, 'repositories', username, password)

def acr_repository_show_tags(registry_name, repository, username=None, password=None):
'''Show tags of a given repository in a given container registry.
'''Shows tags of a given repository in the specified container registry.
:param str registry_name: The name of container registry
:param str repository: The repository to obtain tags from
:param str username: The username used to log into the container registry
Expand Down