Skip to content

Commit 4c487bd

Browse files
authored
feat!: registry endpoint management command updates and preview flag removal (#738)
1 parent 7c685fc commit 4c487bd

File tree

7 files changed

+64
-66
lines changed

7 files changed

+64
-66
lines changed

azext_edge/edge/_help.py

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -754,41 +754,40 @@ def load_iotops_help():
754754
"""
755755

756756
helps[
757-
"iot ops registry add"
757+
"iot ops registry create"
758758
] = """
759759
type: command
760-
short-summary: Add a container registry endpoint to an instance.
760+
short-summary: Create a container registry endpoint for an instance.
761761
long-summary: |
762-
Only Azure Container Registry (ACR) endpoints are supported.
763762
By default, the registry endpoint will use System Assigned Managed Identity authentication.
764763
Use the --no-auth flag to explicitly configure anonymous authentication.
765764
766765
examples:
767-
- name: Add a registry endpoint with default System Assigned Managed Identity authentication.
766+
- name: Create a registry endpoint with default System Assigned Managed Identity authentication.
768767
text: >
769-
az iot ops registry add -n myregistry --host myregistry.azurecr.io -i myinstance -g myresourcegroup
770-
- name: Add a registry endpoint with explicit anonymous authentication.
768+
az iot ops registry create -n myregistry --host myregistry.azurecr.io -i myinstance -g myresourcegroup
769+
- name: Create a registry endpoint with explicit anonymous authentication.
771770
text: >
772-
az iot ops registry add -n myregistry --host myregistry.azurecr.io -i myinstance -g myresourcegroup --no-auth
773-
- name: Add a registry endpoint with system-assigned managed identity and optional audience configuration
771+
az iot ops registry create -n myregistry --host myregistry.azurecr.io -i myinstance -g myresourcegroup --no-auth
772+
- name: Create a registry endpoint with system-assigned managed identity and optional audience configuration
774773
text: >
775-
az iot ops registry add -n myregistry --host myregistry.azurecr.io -i myinstance -g myresourcegroup
774+
az iot ops registry create -n myregistry --host myregistry.azurecr.io -i myinstance -g myresourcegroup
776775
--auth-type SystemAssignedManagedIdentity --aud myaudience
777-
- name: Add a registry endpoint with kubernetes secret reference authentication
776+
- name: Create a registry endpoint with kubernetes secret reference authentication
778777
text: >
779-
az iot ops registry add -n myregistry --host myregistry.azurecr.io -i myinstance -g myresourcegroup
778+
az iot ops registry create -n myregistry --host myregistry.azurecr.io -i myinstance -g myresourcegroup
780779
--auth-type ArtifactPullSecret --secret-ref mysecret
781-
- name: Add a registry endpoint with user-assigned managed identity configuration
780+
- name: Create a registry endpoint with user-assigned managed identity configuration
782781
text: >
783-
az iot ops registry add -n myregistry --host myregistry.azurecr.io -i myinstance -g myresourcegroup
782+
az iot ops registry create -n myregistry --host myregistry.azurecr.io -i myinstance -g myresourcegroup
784783
--auth-type UserAssignedManagedIdentity --scope myscope --cid myclientid --tid mytenantid
785-
- name: Add a registry endpoint with a code signing CA secret reference
784+
- name: Create a registry endpoint with a code signing CA secret reference
786785
text: >
787-
az iot ops registry add -n myregistry --host myregistry.azurecr.io -i myinstance -g myresourcegroup
786+
az iot ops registry create -n myregistry --host myregistry.azurecr.io -i myinstance -g myresourcegroup
788787
--cs-secret-refs mysecret
789-
- name: Add a registry endpoint with multiple code signing CA secret and configmap references
788+
- name: Create a registry endpoint with multiple code signing CA secret and configmap references
790789
text: >
791-
az iot ops registry add -n myregistry --host myregistry.azurecr.io -i myinstance -g myresourcegroup
790+
az iot ops registry create -n myregistry --host myregistry.azurecr.io -i myinstance -g myresourcegroup
792791
--cs-config-map-refs configmap1 configmap2 --cs-secret-refs secret1 secret2
793792
"""
794793

@@ -837,15 +836,15 @@ def load_iotops_help():
837836
"""
838837

839838
helps[
840-
"iot ops registry remove"
839+
"iot ops registry delete"
841840
] = """
842841
type: command
843-
short-summary: Remove a container registry endpoint.
842+
short-summary: Delete a container registry endpoint.
844843
845844
examples:
846-
- name: Remove a registry endpoint.
845+
- name: Delete a registry endpoint.
847846
text: >
848-
az iot ops registry remove -n myregistry -i myinstance -g myresourcegroup
847+
az iot ops registry delete -n myregistry -i myinstance -g myresourcegroup
849848
"""
850849

851850
helps[

azext_edge/edge/command_map.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,11 @@ def load_iotops_commands(self, _):
182182
with self.command_group(
183183
"iot ops registry",
184184
command_type=registry_endpoint_resource_ops,
185-
is_preview=True,
186185
) as cmd_group:
187186
cmd_group.command("list", "list_registry_endpoints")
188-
cmd_group.command("add", "add_registry_endpoint")
187+
cmd_group.command("create", "create_registry_endpoint")
189188
cmd_group.command("update", "update_registry_endpoint")
190-
cmd_group.command("remove", "remove_registry_endpoint")
189+
cmd_group.command("delete", "delete_registry_endpoint")
191190
cmd_group.show_command("show", "show_registry_endpoint")
192191

193192
with self.command_group(

azext_edge/edge/commands_registry_endpoints.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from .providers.orchestration.resources import RegistryEndpoints
1414

1515

16-
def add_registry_endpoint(
16+
def create_registry_endpoint(
1717
cmd,
1818
instance_name: str,
1919
resource_group_name: str,
@@ -30,8 +30,8 @@ def add_registry_endpoint(
3030
code_signing_secret_refs: Optional[list] = None,
3131
**kwargs,
3232
) -> dict:
33-
"""Add a registry endpoint to an IoT Operations instance."""
34-
return RegistryEndpoints(cmd).add(
33+
"""Create a registry endpoint for an IoT Operations instance."""
34+
return RegistryEndpoints(cmd).create(
3535
instance_name=instance_name,
3636
resource_group_name=resource_group_name,
3737
registry_endpoint_name=registry_endpoint_name,
@@ -102,16 +102,16 @@ def list_registry_endpoints(cmd, instance_name: str, resource_group_name: str) -
102102
)
103103

104104

105-
def remove_registry_endpoint(
105+
def delete_registry_endpoint(
106106
cmd,
107107
registry_endpoint_name: str,
108108
instance_name: str,
109109
resource_group_name: str,
110110
confirm_yes: Optional[bool] = None,
111111
**kwargs,
112112
) -> None:
113-
"""Remove a registry endpoint from an IoT Operations instance."""
114-
return RegistryEndpoints(cmd).remove(
113+
"""Delete a registry endpoint from an IoT Operations instance."""
114+
return RegistryEndpoints(cmd).delete(
115115
instance_name=instance_name,
116116
resource_group_name=resource_group_name,
117117
registry_endpoint_name=registry_endpoint_name,

azext_edge/edge/providers/orchestration/resources/registryendpoints.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def _process_code_signing_cas(
183183

184184
return cas
185185

186-
def add(
186+
def create(
187187
self,
188188
instance_name: str,
189189
resource_group_name: str,
@@ -201,7 +201,7 @@ def add(
201201
**kwargs,
202202
) -> dict:
203203
"""
204-
Add a registry endpoint to an IoT Operations instance.
204+
Create a registry endpoint for an IoT Operations Instance.
205205
206206
:param instance_name: Name of the IoT Operations instance.
207207
:param resource_group_name: Name of the resource group.
@@ -223,7 +223,7 @@ def add(
223223
status_text = kwargs.pop("status_text", "Working...")
224224
no_status = kwargs.pop("no_status", False)
225225
headers = kwargs.pop("headers", None)
226-
operation_kwargs = {"headers": headers or {"CommandName": "iot ops registry add"}}
226+
operation_kwargs = {"headers": headers or {"CommandName": "iot ops registry create"}}
227227

228228
# Process authentication configuration
229229
auth_config = self._process_registry_endpoint_authentication(
@@ -347,7 +347,7 @@ def update(
347347
)
348348
return wait_for_terminal_state(poller, **kwargs)
349349

350-
def remove(
350+
def delete(
351351
self,
352352
instance_name: str,
353353
resource_group_name: str,
@@ -356,7 +356,7 @@ def remove(
356356
**kwargs,
357357
) -> None:
358358
"""
359-
Remove a registry endpoint from an IoT Operations instance.
359+
Delete a registry endpoint from an IoT Operations instance.
360360
361361
:param instance_name: Name of the IoT Operations instance.
362362
:param resource_group_name: Name of the resource group.
@@ -368,14 +368,14 @@ def remove(
368368
if should_bail:
369369
return
370370

371-
with console.status(f"Removing registry endpoint '{registry_endpoint_name}'..."):
371+
with console.status(f"Deleting registry endpoint '{registry_endpoint_name}'..."):
372372
poller = self.registry_endpoints.begin_delete(
373373
resource_group_name=resource_group_name,
374374
instance_name=instance_name,
375375
registry_endpoint_name=registry_endpoint_name,
376376
)
377377
wait_for_terminal_state(poller, **kwargs)
378-
logger.info(f"Registry endpoint '{registry_endpoint_name}' removed successfully.")
378+
logger.info(f"Registry endpoint '{registry_endpoint_name}' deleted successfully.")
379379

380380
def _identify_authentication_method(
381381
self,

azext_edge/edge/providers/orchestration/upgrade2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def _apply_instance_update(self, needs_adr_update: bool, needs_spc_update: bool,
297297
)
298298

299299
def _create_default_registry_endpoint(self, headers: dict) -> dict:
300-
return self.registry_endpoints.add(
300+
return self.registry_endpoints.create(
301301
instance_name=self.instance_name,
302302
resource_group_name=self.resource_group_name,
303303
registry_endpoint_name="default",

azext_edge/tests/edge/orchestration/resources/registry_endpoint/test_registry_endpoints_int.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def test_registry_endpoint_lifecycle_anonymous(registry_endpoint_test_setup, tra
4242
try:
4343
# CREATE - SAMI authentication (default)
4444
registry_endpoint = run(
45-
f"az iot ops registry add -n {registry_endpoint_name} "
45+
f"az iot ops registry create -n {registry_endpoint_name} "
4646
f"-g {resource_group} --instance {instance_name} "
4747
f"--host {host}"
4848
)
@@ -93,7 +93,7 @@ def test_registry_endpoint_lifecycle_anonymous(registry_endpoint_test_setup, tra
9393

9494
# REMOVE
9595
run(
96-
f"az iot ops registry remove -n {registry_endpoint_name} "
96+
f"az iot ops registry delete -n {registry_endpoint_name} "
9797
f"-g {resource_group} --instance {instance_name} -y"
9898
)
9999
tracked_resources.remove(registry_endpoint["id"])
@@ -108,7 +108,7 @@ def test_registry_endpoint_lifecycle_anonymous(registry_endpoint_test_setup, tra
108108
if registry_endpoint.get("id") in tracked_resources:
109109
try:
110110
run(
111-
f"az iot ops registry remove -n {registry_endpoint_name} "
111+
f"az iot ops registry delete -n {registry_endpoint_name} "
112112
f"-g {resource_group} --instance {instance_name} -y"
113113
)
114114
tracked_resources.remove(registry_endpoint["id"])
@@ -128,7 +128,7 @@ def test_registry_endpoint_artifact_pull_secret(registry_endpoint_test_setup, tr
128128
try:
129129
# CREATE - ArtifactPullSecret authentication
130130
registry_endpoint = run(
131-
f"az iot ops registry add -n {registry_endpoint_name} "
131+
f"az iot ops registry create -n {registry_endpoint_name} "
132132
f"-g {resource_group} --instance {instance_name} "
133133
f"--host {host} --secret-ref {secret_ref}"
134134
)
@@ -158,7 +158,7 @@ def test_registry_endpoint_artifact_pull_secret(registry_endpoint_test_setup, tr
158158

159159
# REMOVE
160160
run(
161-
f"az iot ops registry remove -n {registry_endpoint_name} "
161+
f"az iot ops registry delete -n {registry_endpoint_name} "
162162
f"-g {resource_group} --instance {instance_name} -y"
163163
)
164164
tracked_resources.remove(registry_endpoint["id"])
@@ -168,7 +168,7 @@ def test_registry_endpoint_artifact_pull_secret(registry_endpoint_test_setup, tr
168168
if registry_endpoint.get("id") in tracked_resources:
169169
try:
170170
run(
171-
f"az iot ops registry remove -n {registry_endpoint_name} "
171+
f"az iot ops registry delete -n {registry_endpoint_name} "
172172
f"-g {resource_group} --instance {instance_name} -y"
173173
)
174174
tracked_resources.remove(registry_endpoint["id"])
@@ -188,7 +188,7 @@ def test_registry_endpoint_system_assigned_auth(registry_endpoint_test_setup, tr
188188
try:
189189
# CREATE - SystemAssigned authentication with audience
190190
registry_endpoint = run(
191-
f"az iot ops registry add -n {registry_endpoint_name} "
191+
f"az iot ops registry create -n {registry_endpoint_name} "
192192
f"-g {resource_group} --instance {instance_name} "
193193
f"--host {host} --auth-type SystemAssignedManagedIdentity --audience {audience}"
194194
)
@@ -218,7 +218,7 @@ def test_registry_endpoint_system_assigned_auth(registry_endpoint_test_setup, tr
218218

219219
# REMOVE
220220
run(
221-
f"az iot ops registry remove -n {registry_endpoint_name} "
221+
f"az iot ops registry delete -n {registry_endpoint_name} "
222222
f"-g {resource_group} --instance {instance_name} -y"
223223
)
224224
tracked_resources.remove(registry_endpoint["id"])
@@ -228,7 +228,7 @@ def test_registry_endpoint_system_assigned_auth(registry_endpoint_test_setup, tr
228228
if registry_endpoint.get("id") in tracked_resources:
229229
try:
230230
run(
231-
f"az iot ops registry remove -n {registry_endpoint_name} "
231+
f"az iot ops registry delete -n {registry_endpoint_name} "
232232
f"-g {resource_group} --instance {instance_name} -y"
233233
)
234234
tracked_resources.remove(registry_endpoint["id"])
@@ -250,7 +250,7 @@ def test_registry_endpoint_user_assigned_auth(registry_endpoint_test_setup, trac
250250
try:
251251
# CREATE - UserAssigned authentication with full parameters
252252
registry_endpoint = run(
253-
f"az iot ops registry add -n {registry_endpoint_name} "
253+
f"az iot ops registry create -n {registry_endpoint_name} "
254254
f"-g {resource_group} --instance {instance_name} "
255255
f"--host {host} --auth-type UserAssignedManagedIdentity "
256256
f"--client-id {client_id} --tenant-id {tenant_id} --scope {scope}"
@@ -281,7 +281,7 @@ def test_registry_endpoint_user_assigned_auth(registry_endpoint_test_setup, trac
281281

282282
# REMOVE
283283
run(
284-
f"az iot ops registry remove -n {registry_endpoint_name} "
284+
f"az iot ops registry delete -n {registry_endpoint_name} "
285285
f"-g {resource_group} --instance {instance_name} -y"
286286
)
287287
tracked_resources.remove(registry_endpoint["id"])
@@ -291,7 +291,7 @@ def test_registry_endpoint_user_assigned_auth(registry_endpoint_test_setup, trac
291291
if registry_endpoint.get("id") in tracked_resources:
292292
try:
293293
run(
294-
f"az iot ops registry remove -n {registry_endpoint_name} "
294+
f"az iot ops registry delete -n {registry_endpoint_name} "
295295
f"-g {resource_group} --instance {instance_name} -y"
296296
)
297297
tracked_resources.remove(registry_endpoint["id"])
@@ -335,7 +335,7 @@ def test_registry_endpoint_authentication_auto_detection(registry_endpoint_test_
335335
# Auto-detect ArtifactPullSecret (secret_ref provided)
336336
name1 = f"test-registry-{generate_random_string(force_lower=True, size=8)}"
337337
endpoint1 = run(
338-
f"az iot ops registry add -n {name1} "
338+
f"az iot ops registry create -n {name1} "
339339
f"-g {resource_group} --instance {instance_name} "
340340
f"--host registry1.azurecr.io --secret-ref my-secret"
341341
)
@@ -352,7 +352,7 @@ def test_registry_endpoint_authentication_auto_detection(registry_endpoint_test_
352352
# Auto-detect SystemAssigned (no auth parameters provided)
353353
name2 = f"test-registry-{generate_random_string(force_lower=True, size=8)}"
354354
endpoint2 = run(
355-
f"az iot ops registry add -n {name2} "
355+
f"az iot ops registry create -n {name2} "
356356
f"-g {resource_group} --instance {instance_name} "
357357
f"--host registry2.azurecr.io"
358358
)
@@ -369,7 +369,7 @@ def test_registry_endpoint_authentication_auto_detection(registry_endpoint_test_
369369
# Auto-detect UserAssigned (client-id and tenant-id provided)
370370
name3 = f"test-registry-{generate_random_string(force_lower=True, size=8)}"
371371
endpoint3 = run(
372-
f"az iot ops registry add -n {name3} "
372+
f"az iot ops registry create -n {name3} "
373373
f"-g {resource_group} --instance {instance_name} "
374374
f"--host registry3.azurecr.io --client-id my-client --tenant-id my-tenant"
375375
)
@@ -386,7 +386,7 @@ def test_registry_endpoint_authentication_auto_detection(registry_endpoint_test_
386386
# Auto-detect Anonymous --no-auth
387387
name4 = f"test-registry-{generate_random_string(force_lower=True, size=8)}"
388388
endpoint4 = run(
389-
f"az iot ops registry add -n {name4} "
389+
f"az iot ops registry create -n {name4} "
390390
f"-g {resource_group} --instance {instance_name} "
391391
f"--host registry4.azurecr.io --no-auth"
392392
)
@@ -402,15 +402,15 @@ def test_registry_endpoint_authentication_auto_detection(registry_endpoint_test_
402402

403403
# Cleanup all endpoints
404404
for ep_id, ep_name in endpoints_to_cleanup:
405-
run(f"az iot ops registry remove -n {ep_name} " f"-g {resource_group} --instance {instance_name} -y")
405+
run(f"az iot ops registry delete -n {ep_name} " f"-g {resource_group} --instance {instance_name} -y")
406406
tracked_resources.append(ep_id) # Add to tracked for safety
407407
tracked_resources.remove(ep_id) # Remove after successful deletion
408408

409409
except Exception:
410410
# Cleanup in case of failure
411411
for ep_id, ep_name in endpoints_to_cleanup:
412412
try:
413-
run(f"az iot ops registry remove -n {ep_name} " f"-g {resource_group} --instance {instance_name} -y")
413+
run(f"az iot ops registry delete -n {ep_name} " f"-g {resource_group} --instance {instance_name} -y")
414414
except Exception:
415415
pass # Best effort cleanup
416416
raise
@@ -432,7 +432,7 @@ def test_registry_endpoint_code_signing_cas(registry_endpoint_test_setup, tracke
432432
try:
433433
# CREATE - with one configmap
434434
registry_endpoint = run(
435-
f"az iot ops registry add -n {registry_endpoint_name} "
435+
f"az iot ops registry create -n {registry_endpoint_name} "
436436
f"-g {resource_group} --instance {instance_name} "
437437
f"--host {host} --cs-config-map-refs {configmap1}"
438438
)
@@ -514,7 +514,7 @@ def test_registry_endpoint_code_signing_cas(registry_endpoint_test_setup, tracke
514514

515515
# REMOVE
516516
run(
517-
f"az iot ops registry remove -n {registry_endpoint_name} "
517+
f"az iot ops registry delete -n {registry_endpoint_name} "
518518
f"-g {resource_group} --instance {instance_name} -y"
519519
)
520520
tracked_resources.remove(registry_endpoint["id"])
@@ -524,7 +524,7 @@ def test_registry_endpoint_code_signing_cas(registry_endpoint_test_setup, tracke
524524
if registry_endpoint.get("id") in tracked_resources:
525525
try:
526526
run(
527-
f"az iot ops registry remove -n {registry_endpoint_name} "
527+
f"az iot ops registry delete -n {registry_endpoint_name} "
528528
f"-g {resource_group} --instance {instance_name} -y"
529529
)
530530
tracked_resources.remove(registry_endpoint["id"])

0 commit comments

Comments
 (0)