Skip to content

Commit 8e391e4

Browse files
YitongFeng-gitYitong Feng
andauthored
[AKS] Remove TrustedAccess commands in aks-preview (#8650)
Co-authored-by: Yitong Feng <yife@microsoft.com>
1 parent 9ac09b5 commit 8e391e4

10 files changed

Lines changed: 1 addition & 2077 deletions

src/aks-preview/HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ To release a new version, please select a new version number (usually plus 1 to
1111

1212
Pending
1313
+++++++
14+
* Remove TrustedAccess commands from aks-preview extension as it is GA and exists in azure-cli for long time.
1415

1516
14.0.0b6
1617
+++++++

src/aks-preview/azext_aks_preview/_client_factory.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,6 @@ def get_mc_snapshots_client(cli_ctx, subscription_id=None):
6363
return get_container_service_client(cli_ctx, subscription_id=subscription_id).managed_cluster_snapshots
6464

6565

66-
def cf_trustedaccess_role(cli_ctx, *_):
67-
return get_container_service_client(cli_ctx).trusted_access_roles
68-
69-
70-
def cf_trustedaccess_role_binding(cli_ctx, *_):
71-
return get_container_service_client(cli_ctx).trusted_access_role_bindings
72-
73-
7466
def get_compute_client(cli_ctx, *_):
7567
return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_COMPUTE)
7668

src/aks-preview/azext_aks_preview/_help.py

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -2754,80 +2754,6 @@
27542754
short-summary: Delete a nodepool snapshot.
27552755
"""
27562756

2757-
helps['aks trustedaccess'] = """
2758-
type: group
2759-
short-summary: Commands to manage trusted access security features.
2760-
"""
2761-
2762-
helps['aks trustedaccess role'] = """
2763-
type: group
2764-
short-summary: Commands to manage trusted access roles.
2765-
"""
2766-
2767-
helps['aks trustedaccess role list'] = """
2768-
type: command
2769-
short-summary: List trusted access roles.
2770-
"""
2771-
2772-
helps['aks trustedaccess rolebinding'] = """
2773-
type: group
2774-
short-summary: Commands to manage trusted access role bindings.
2775-
"""
2776-
2777-
helps['aks trustedaccess rolebinding list'] = """
2778-
type: command
2779-
short-summary: List all the trusted access role bindings.
2780-
"""
2781-
2782-
helps['aks trustedaccess rolebinding show'] = """
2783-
type: command
2784-
short-summary: Get the specific trusted access role binding according to binding name.
2785-
parameters:
2786-
- name: --name -n
2787-
type: string
2788-
short-summary: Specify the role binding name.
2789-
"""
2790-
2791-
helps['aks trustedaccess rolebinding create'] = """
2792-
type: command
2793-
short-summary: Create a new trusted access role binding.
2794-
parameters:
2795-
- name: --name -n
2796-
type: string
2797-
short-summary: Specify the role binding name.
2798-
- name: --roles
2799-
type: string
2800-
short-summary: Specify the space-separated roles.
2801-
- name: --source-resource-id
2802-
type: string
2803-
short-summary: Specify the source resource id of the binding.
2804-
2805-
examples:
2806-
- name: Create a new trusted access role binding
2807-
text: az aks trustedaccess rolebinding create -g myResourceGroup --cluster-name myCluster -n bindingName --source-resource-id /subscriptions/0000/resourceGroups/myResourceGroup/providers/Microsoft.Demo/samples --roles Microsoft.Demo/samples/reader,Microsoft.Demo/samples/writer
2808-
"""
2809-
2810-
helps['aks trustedaccess rolebinding update'] = """
2811-
type: command
2812-
short-summary: Update a trusted access role binding.
2813-
parameters:
2814-
- name: --name -n
2815-
type: string
2816-
short-summary: Specify the role binding name.
2817-
- name: --roles
2818-
type: string
2819-
short-summary: Specify the space-separated roles.
2820-
"""
2821-
2822-
helps['aks trustedaccess rolebinding delete'] = """
2823-
type: command
2824-
short-summary: Delete a trusted access role binding according to name.
2825-
parameters:
2826-
- name: --name -n
2827-
type: string
2828-
short-summary: Specify the role binding name.
2829-
"""
2830-
28312757
helps['aks draft'] = """
28322758
type: group
28332759
short-summary: Commands to build deployment files in a project directory and deploy to an AKS cluster.

src/aks-preview/azext_aks_preview/_params.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2201,39 +2201,6 @@ def load_arguments(self, _):
22012201
action="store_true",
22022202
)
22032203

2204-
with self.argument_context("aks trustedaccess rolebinding") as c:
2205-
c.argument("cluster_name", help="The cluster name.")
2206-
2207-
for scope in [
2208-
"aks trustedaccess rolebinding show",
2209-
"aks trustedaccess rolebinding create",
2210-
"aks trustedaccess rolebinding update",
2211-
"aks trustedaccess rolebinding delete",
2212-
]:
2213-
with self.argument_context(scope) as c:
2214-
c.argument(
2215-
"role_binding_name",
2216-
options_list=["--name", "-n"],
2217-
required=True,
2218-
help="The role binding name.",
2219-
)
2220-
2221-
with self.argument_context("aks trustedaccess rolebinding create") as c:
2222-
c.argument(
2223-
"roles",
2224-
help="comma-separated roles: Microsoft.Demo/samples/reader,Microsoft.Demo/samples/writer,...",
2225-
)
2226-
c.argument(
2227-
"source_resource_id",
2228-
help="The source resource id of the binding",
2229-
)
2230-
2231-
with self.argument_context("aks trustedaccess rolebinding update") as c:
2232-
c.argument(
2233-
"roles",
2234-
help="comma-separated roles: Microsoft.Demo/samples/reader,Microsoft.Demo/samples/writer,...",
2235-
)
2236-
22372204
with self.argument_context("aks mesh enable-ingress-gateway") as c:
22382205
c.argument(
22392206
"ingress_gateway_type", arg_type=get_enum_type(ingress_gateway_types)

src/aks-preview/azext_aks_preview/commands.py

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
cf_managed_clusters,
1212
cf_mc_snapshots,
1313
cf_nodepool_snapshots,
14-
cf_trustedaccess_role,
15-
cf_trustedaccess_role_binding,
1614
cf_machines,
1715
cf_operations,
1816
cf_load_balancers,
@@ -126,18 +124,6 @@ def load_command_table(self, _):
126124
client_factory=cf_mc_snapshots,
127125
)
128126

129-
trustedaccess_role_sdk = CliCommandType(
130-
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
131-
"operations._trusted_access_roles_operations#TrustedAccessRolesOperations.{}",
132-
client_factory=cf_trustedaccess_role,
133-
)
134-
135-
trustedaccess_role_binding_sdk = CliCommandType(
136-
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
137-
"operations._trusted_access_role_bindings_operations#TrustedAccessRoleBindingsOperations.{}",
138-
client_factory=cf_trustedaccess_role_binding,
139-
)
140-
141127
# AKS managed cluster commands
142128
with self.command_group(
143129
"aks",
@@ -369,28 +355,6 @@ def load_command_table(self, _):
369355
g.custom_command("create", "aks_snapshot_create", supports_no_wait=True)
370356
g.custom_command("delete", "aks_snapshot_delete", supports_no_wait=True)
371357

372-
# AKS trusted access role commands
373-
with self.command_group(
374-
"aks trustedaccess role",
375-
trustedaccess_role_sdk,
376-
client_factory=cf_trustedaccess_role,
377-
) as g:
378-
g.custom_command("list", "aks_trustedaccess_role_list")
379-
380-
# AKS trusted access rolebinding commands
381-
with self.command_group(
382-
"aks trustedaccess rolebinding",
383-
trustedaccess_role_binding_sdk,
384-
client_factory=cf_trustedaccess_role_binding,
385-
) as g:
386-
g.custom_command("list", "aks_trustedaccess_role_binding_list")
387-
g.custom_show_command("show", "aks_trustedaccess_role_binding_get")
388-
g.custom_command("create", "aks_trustedaccess_role_binding_create")
389-
g.custom_command("update", "aks_trustedaccess_role_binding_update")
390-
g.custom_command(
391-
"delete", "aks_trustedaccess_role_binding_delete", confirmation=True
392-
)
393-
394358
# AKS mesh commands
395359
with self.command_group(
396360
"aks mesh", managed_clusters_sdk, client_factory=cf_managed_clusters

src/aks-preview/azext_aks_preview/custom.py

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2963,60 +2963,6 @@ def aks_nodepool_snapshot_list(cmd, client, resource_group_name=None): # pylint
29632963
return client.list_by_resource_group(resource_group_name)
29642964

29652965

2966-
def aks_trustedaccess_role_list(cmd, client, location): # pylint: disable=unused-argument
2967-
return client.list(location)
2968-
2969-
2970-
def aks_trustedaccess_role_binding_list(cmd, client, resource_group_name, cluster_name): # pylint: disable=unused-argument
2971-
return client.list(resource_group_name, cluster_name)
2972-
2973-
2974-
def aks_trustedaccess_role_binding_get(cmd, client, resource_group_name, cluster_name, role_binding_name):
2975-
return client.get(resource_group_name, cluster_name, role_binding_name)
2976-
2977-
2978-
def aks_trustedaccess_role_binding_create(cmd, client, resource_group_name, cluster_name, role_binding_name,
2979-
source_resource_id, roles):
2980-
TrustedAccessRoleBinding = cmd.get_models(
2981-
"TrustedAccessRoleBinding",
2982-
resource_type=CUSTOM_MGMT_AKS_PREVIEW,
2983-
operation_group="trusted_access_role_bindings",
2984-
)
2985-
existedBinding = None
2986-
try:
2987-
existedBinding = client.get(resource_group_name, cluster_name, role_binding_name)
2988-
except ResourceNotFoundError:
2989-
pass
2990-
2991-
if existedBinding:
2992-
raise Exception( # pylint: disable=broad-exception-raised
2993-
"TrustedAccess RoleBinding " +
2994-
role_binding_name +
2995-
" already existed, please use 'az aks trustedaccess rolebinding update' command to update!"
2996-
)
2997-
2998-
roleList = roles.split(',')
2999-
roleBinding = TrustedAccessRoleBinding(source_resource_id=source_resource_id, roles=roleList)
3000-
return client.begin_create_or_update(resource_group_name, cluster_name, role_binding_name, roleBinding)
3001-
3002-
3003-
def aks_trustedaccess_role_binding_update(cmd, client, resource_group_name, cluster_name, role_binding_name, roles):
3004-
TrustedAccessRoleBinding = cmd.get_models(
3005-
"TrustedAccessRoleBinding",
3006-
resource_type=CUSTOM_MGMT_AKS_PREVIEW,
3007-
operation_group="trusted_access_role_bindings",
3008-
)
3009-
existedBinding = client.get(resource_group_name, cluster_name, role_binding_name)
3010-
3011-
roleList = roles.split(',')
3012-
roleBinding = TrustedAccessRoleBinding(source_resource_id=existedBinding.source_resource_id, roles=roleList)
3013-
return client.begin_create_or_update(resource_group_name, cluster_name, role_binding_name, roleBinding)
3014-
3015-
3016-
def aks_trustedaccess_role_binding_delete(cmd, client, resource_group_name, cluster_name, role_binding_name):
3017-
return client.begin_delete(resource_group_name, cluster_name, role_binding_name)
3018-
3019-
30202966
def aks_mesh_enable(
30212967
cmd,
30222968
client,

0 commit comments

Comments
 (0)