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
2 changes: 1 addition & 1 deletion src/azure-cli-core/azure/cli/core/profiles/_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def default_api_version(self):
'role_definitions': '2018-01-01-preview',
'provider_operations_metadata': '2018-01-01-preview'
}),
ResourceType.MGMT_CONTAINERREGISTRY: SDKProfile('2020-11-01-preview', {
ResourceType.MGMT_CONTAINERREGISTRY: SDKProfile('2021-06-01-preview', {
'agent_pools': '2019-06-01-preview',
'tasks': '2019-06-01-preview',
'task_runs': '2019-06-01-preview',
Expand Down
1 change: 1 addition & 0 deletions src/azure-cli/azure/cli/command_modules/acr/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def load_arguments(self, _): # pylint: disable=too-many-statements
c.argument('cmd', options_list=['--__cmd__'])
c.argument('cmd_value', help="Commands to execute.", options_list=['--cmd'])
c.argument('zone_redundancy', is_preview=True, arg_type=get_enum_type(ZoneRedundancy), help="Indicates whether or not zone redundancy should be enabled for this registry or replication. For more information, such as supported locations, please visit https://aka.ms/acr/az. Zone-redundancy cannot be updated. Defaults to 'Disabled'.")
c.argument('allow_exports', arg_type=get_three_state_flag(), is_preview=True, help="Configure exportPolicy to allow/disallow artifacts from being exported from this registry. Artifacts can be exported via import or transfer operations. For more information, please visit https://aka.ms/acr/export-policy.")

for scope in ['acr create', 'acr update']:
with self.argument_context(scope, arg_group='Network Rule') as c:
Expand Down
20 changes: 20 additions & 0 deletions src/azure-cli/azure/cli/command_modules/acr/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

# pylint: disable=too-many-locals

from knack.util import CLIError
from knack.log import get_logger
from azure.cli.core.util import user_confirmation
Expand Down Expand Up @@ -51,6 +53,7 @@ def acr_create(cmd,
public_network_enabled=None,
zone_redundancy=None,
allow_trusted_services=None,
allow_exports=None,
tags=None):

if default_action and sku not in get_premium_sku(cmd):
Expand All @@ -72,6 +75,7 @@ def acr_create(cmd,
_configure_cmk(cmd, registry, resource_group_name, identity, key_encryption_key)

_handle_network_bypass(cmd, registry, allow_trusted_services)
_handle_export_policy(cmd, registry, allow_exports)

lro_poller = client.begin_create(resource_group_name, registry_name, registry)

Expand Down Expand Up @@ -112,6 +116,7 @@ def acr_update_custom(cmd,
public_network_enabled=None,
allow_trusted_services=None,
anonymous_pull_enabled=None,
allow_exports=None,
tags=None):
if sku is not None:
Sku = cmd.get_models('Sku')
Expand All @@ -137,6 +142,7 @@ def acr_update_custom(cmd,
instance.anonymous_pull_enabled = anonymous_pull_enabled

_handle_network_bypass(cmd, instance, allow_trusted_services)
_handle_export_policy(cmd, instance, allow_exports)

return instance

Expand All @@ -153,6 +159,20 @@ def _handle_network_bypass(cmd, registry, allow_trusted_services):
if allow_trusted_services else NetworkRuleBypassOptions.none)


def _handle_export_policy(cmd, registry, allow_exports):
if allow_exports is not None:
Policies, ExportPolicy, ExportPolicyStatus = cmd.get_models('Policies', 'ExportPolicy', 'ExportPolicyStatus')

if registry.policies is None:
registry.policies = Policies()

status = ExportPolicyStatus.DISABLED if not allow_exports else ExportPolicyStatus.ENABLED
try:
registry.policies.export_policy.status = status
except AttributeError:
registry.policies.export_policy = ExportPolicy(status=status)


def acr_update_get(cmd):
"""Returns an empty RegistryUpdateParameters object.
"""
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading