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
1 change: 1 addition & 0 deletions src/aks-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ To release a new version, please select a new version number (usually plus 1 to

Pending
+++++++
* [BREAKING CHANGE] Since the service no longer supports updating source resource id for role binding, so remove --source-resource-id of `aks trustedaccess rolebinding update` command

0.5.92
++++++
Expand Down
3 changes: 0 additions & 3 deletions src/aks-preview/azext_aks_preview/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -1850,9 +1850,6 @@
- name: --roles
type: string
short-summary: Specify the space-separated roles.
- name: --source-resource-id -s
type: string
short-summary: Specify the source resource id of the binding.
"""

helps['aks trustedaccess rolebinding delete'] = """
Expand Down
12 changes: 6 additions & 6 deletions src/aks-preview/azext_aks_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,12 +692,12 @@ def load_arguments(self, _):
c.argument('role_binding_name', options_list=[
'--name', '-n'], required=True, help='The role binding name.')

for scope in ['aks trustedaccess rolebinding create', 'aks trustedaccess rolebinding update']:
with self.argument_context(scope) as c:
c.argument('roles', nargs='*',
help='space-separated roles: Microsoft.Demo/samples/reader Microsoft.Demo/samples/writer ...')
c.argument('source_resource_id', options_list=['--source-resource-id', '-s'],
help='The source resource id of the binding')
with self.argument_context('aks trustedaccess rolebinding create') as c:
c.argument('roles', nargs='*', help='space-separated roles: Microsoft.Demo/samples/reader Microsoft.Demo/samples/writer ...')
c.argument('source_resource_id', options_list=['--source-resource-id', '-s'], help='The source resource id of the binding')

with self.argument_context('aks trustedaccess rolebinding update') as c:
c.argument('roles', nargs='*', help='space-separated roles: Microsoft.Demo/samples/reader Microsoft.Demo/samples/writer ...')


def _get_default_install_location(exe_name):
Expand Down
4 changes: 2 additions & 2 deletions src/aks-preview/azext_aks_preview/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,6 @@ def load_command_table(self, _):
with self.command_group('aks trustedaccess rolebinding', trustedaccess_role_binding_sdk, client_factory=cf_trustedaccess_role_binding) as g:
g.custom_command('list', 'aks_trustedaccess_role_binding_list')
g.custom_show_command('show', 'aks_trustedaccess_role_binding_get')
g.custom_command('create', 'aks_trustedaccess_role_binding_create_or_update')
g.custom_command('update', 'aks_trustedaccess_role_binding_create_or_update')
g.custom_command('create', 'aks_trustedaccess_role_binding_create')
g.custom_command('update', 'aks_trustedaccess_role_binding_update')
g.custom_command('delete', 'aks_trustedaccess_role_binding_delete', confirmation=True)
16 changes: 14 additions & 2 deletions src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -2218,8 +2218,8 @@ def aks_trustedaccess_role_binding_get(cmd, client, resource_group_name, cluster
return client.get(resource_group_name, cluster_name, role_binding_name)


def aks_trustedaccess_role_binding_create_or_update(cmd, client, resource_group_name, cluster_name, role_binding_name,
source_resource_id, roles):
def aks_trustedaccess_role_binding_create(cmd, client, resource_group_name, cluster_name, role_binding_name,
source_resource_id, roles):
TrustedAccessRoleBinding = cmd.get_models(
"TrustedAccessRoleBinding",
resource_type=CUSTOM_MGMT_AKS_PREVIEW,
Expand All @@ -2229,5 +2229,17 @@ def aks_trustedaccess_role_binding_create_or_update(cmd, client, resource_group_
return client.create_or_update(resource_group_name, cluster_name, role_binding_name, roleBinding)


def aks_trustedaccess_role_binding_update(cmd, client, resource_group_name, cluster_name, role_binding_name, roles):
TrustedAccessRoleBinding = cmd.get_models(
"TrustedAccessRoleBinding",
resource_type=CUSTOM_MGMT_AKS_PREVIEW,
operation_group="trusted_access_role_bindings",
)
existedBinding = client.get(resource_group_name, cluster_name, role_binding_name)

roleBinding = TrustedAccessRoleBinding(source_resource_id=existedBinding.source_resource_id, roles=roles)
return client.create_or_update(resource_group_name, cluster_name, role_binding_name, roleBinding)


def aks_trustedaccess_role_binding_delete(cmd, client, resource_group_name, cluster_name, role_binding_name):
return client.delete(resource_group_name, cluster_name, role_binding_name)