Skip to content

Commit

Permalink
AMG: Update azure-mgmt-authorization package version (#7363)
Browse files Browse the repository at this point in the history
* Bump azure-mgmt-authorization pkg version

* Regenerate test recordings

---------

Co-authored-by: Alan Zhang <alanzhang@microsoft.com>
  • Loading branch information
ABZhang0 and Alan Zhang committed Mar 13, 2024
1 parent b25b1d4 commit 16d42e2
Show file tree
Hide file tree
Showing 9 changed files with 2,567 additions and 2,155 deletions.
4 changes: 4 additions & 0 deletions src/amg/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ Release History
1.3.0
++++++
* `az grafana update`: support Grafana major version argument

1.3.1
++++++
* `az grafana delete`: bump azure-mgmt-authorization package version
10 changes: 5 additions & 5 deletions src/amg/azext_amg/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from azure.cli.core.azclierror import ArgumentUsageError, CLIInternalError

from ._client_factory import cf_amg
from .utils import get_yes_or_no_option
from .utils import get_yes_or_no_option, MGMT_SERVICE_CLIENT_API_VERSION

logger = get_logger(__name__)

Expand Down Expand Up @@ -115,7 +115,7 @@ def _create_role_assignment(cli_ctx, principal_id, principal_type, role_definiti
import time
from azure.core.exceptions import ResourceExistsError
assignments_client = get_mgmt_service_client(cli_ctx, ResourceType.MGMT_AUTHORIZATION,
api_version="2022-04-01").role_assignments
api_version=MGMT_SERVICE_CLIENT_API_VERSION).role_assignments
RoleAssignmentCreateParameters = get_sdk(cli_ctx, ResourceType.MGMT_AUTHORIZATION,
'RoleAssignmentCreateParameters', mod='models',
operation_group='role_assignments')
Expand Down Expand Up @@ -147,9 +147,9 @@ def _create_role_assignment(cli_ctx, principal_id, principal_type, role_definiti

def _delete_role_assignment(cli_ctx, principal_id):
assignments_client = get_mgmt_service_client(cli_ctx, ResourceType.MGMT_AUTHORIZATION,
api_version="2020-04-01-preview").role_assignments
api_version=MGMT_SERVICE_CLIENT_API_VERSION).role_assignments
f = f"principalId eq '{principal_id}'"
assignments = list(assignments_client.list(filter=f))
assignments = list(assignments_client.list_for_subscription(filter=f))
for a in assignments or []:
assignments_client.delete_by_id(a.id)

Expand Down Expand Up @@ -249,7 +249,7 @@ def delete_grafana(cmd, grafana_name, resource_group_name=None):
LongRunningOperation(cmd.cli_ctx)(poller)

# delete role assignment
logger.warning("Grafana instance of '%s' was delete. Now removing role assignments for associated with its "
logger.warning("Grafana instance of '%s' was deleted. Now removing role assignments for associated with its "
"managed identity", grafana_name)
_delete_role_assignment(cmd.cli_ctx, grafana.identity.principal_id)

Expand Down
2,496 changes: 1,397 additions & 1,099 deletions src/amg/azext_amg/tests/latest/recordings/test_amg_backup_restore.yaml

Large diffs are not rendered by default.

496 changes: 248 additions & 248 deletions src/amg/azext_amg/tests/latest/recordings/test_amg_crud.yaml

Large diffs are not rendered by default.

1,010 changes: 530 additions & 480 deletions src/amg/azext_amg/tests/latest/recordings/test_amg_e2e.yaml

Large diffs are not rendered by default.

308 changes: 139 additions & 169 deletions src/amg/azext_amg/tests/latest/recordings/test_api_key_e2e.yaml

Large diffs are not rendered by default.

394 changes: 241 additions & 153 deletions src/amg/azext_amg/tests/latest/recordings/test_service_account_e2e.yaml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/amg/azext_amg/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from knack.log import get_logger
from azure.cli.core.style import print_styled_text, Style

MGMT_SERVICE_CLIENT_API_VERSION = '2022-04-01'

logger = get_logger(__name__)


Expand Down
2 changes: 1 addition & 1 deletion src/amg/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# TODO: Confirm this is the right version number you want and it matches your
# HISTORY.rst entry.
VERSION = '1.3.0'
VERSION = '1.3.1'

# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down

0 comments on commit 16d42e2

Please sign in to comment.