From a8bec65c20fe933514492640ded530d53d51f1da Mon Sep 17 00:00:00 2001 From: Gianluca Cacace Date: Fri, 17 Apr 2026 23:06:34 +0000 Subject: [PATCH] Rename CloudWatch o-tel commands to otel with hidden backward-compat aliases Rename the 3 CloudWatch OTel enrichment CLI commands from o-tel to otel naming, consistent with the OpenTelemetry community convention: - get-o-tel-enrichment -> get-otel-enrichment - start-o-tel-enrichment -> start-otel-enrichment - stop-o-tel-enrichment -> stop-otel-enrichment The old o-tel names are kept as hidden/undocumented aliases for backward compatibility. --- .../next-release/cloudwatch-otel-rename.json | 7 ++++ awscli/customizations/cloudwatch.py | 32 +++++++++++++++++++ awscli/handlers.py | 2 ++ .../functional/cloudwatch/test_otel_alias.py | 27 ++++++++++++++++ 4 files changed, 68 insertions(+) create mode 100644 .changes/next-release/cloudwatch-otel-rename.json create mode 100644 awscli/customizations/cloudwatch.py create mode 100644 tests/functional/cloudwatch/test_otel_alias.py diff --git a/.changes/next-release/cloudwatch-otel-rename.json b/.changes/next-release/cloudwatch-otel-rename.json new file mode 100644 index 000000000000..d611abf8bab2 --- /dev/null +++ b/.changes/next-release/cloudwatch-otel-rename.json @@ -0,0 +1,7 @@ +[ + { + "category": "``cloudwatch``", + "description": "Rename ``get-o-tel-enrichment``, ``start-o-tel-enrichment``, and ``stop-o-tel-enrichment`` commands to ``get-otel-enrichment``, ``start-otel-enrichment``, and ``stop-otel-enrichment``. The old names are kept as hidden aliases for backward compatibility.", + "type": "bugfix" + } +] diff --git a/awscli/customizations/cloudwatch.py b/awscli/customizations/cloudwatch.py new file mode 100644 index 000000000000..35e38cc6fb2d --- /dev/null +++ b/awscli/customizations/cloudwatch.py @@ -0,0 +1,32 @@ +# Copyright 2026 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You +# may not use this file except in compliance with the License. A copy of +# the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is +# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF +# ANY KIND, either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +from awscli.customizations.utils import alias_command + + +def register_rename_otel_commands(event_emitter): + event_emitter.register( + 'building-command-table.cloudwatch', + rename_otel_commands + ) + + +def rename_otel_commands(command_table, **kwargs): + """Rename o-tel commands to otel, keeping o-tel as hidden aliases.""" + renames = { + 'get-o-tel-enrichment': 'get-otel-enrichment', + 'start-o-tel-enrichment': 'start-otel-enrichment', + 'stop-o-tel-enrichment': 'stop-otel-enrichment', + } + for old_name, new_name in renames.items(): + if old_name in command_table: + alias_command(command_table, old_name, new_name) diff --git a/awscli/handlers.py b/awscli/handlers.py index 9c605dc37c33..3f0aa0180078 100644 --- a/awscli/handlers.py +++ b/awscli/handlers.py @@ -34,6 +34,7 @@ from awscli.customizations.cloudsearch import initialize as cloudsearch_init from awscli.customizations.cloudsearchdomain import register_cloudsearchdomain from awscli.customizations.cloudtrail import initialize as cloudtrail_init +from awscli.customizations.cloudwatch import register_rename_otel_commands from awscli.customizations.codeartifact import register_codeartifact_commands from awscli.customizations.codecommit import initialize as codecommit_init from awscli.customizations.codedeploy.codedeploy import ( @@ -223,6 +224,7 @@ def awscli_initialize(event_handlers): cloudformation_init(event_handlers) register_servicecatalog_commands(event_handlers) register_translate_import_terminology(event_handlers) + register_rename_otel_commands(event_handlers) register_history_mode(event_handlers) register_history_commands(event_handlers) register_event_stream_arg(event_handlers) diff --git a/tests/functional/cloudwatch/test_otel_alias.py b/tests/functional/cloudwatch/test_otel_alias.py new file mode 100644 index 000000000000..c8929b1681d5 --- /dev/null +++ b/tests/functional/cloudwatch/test_otel_alias.py @@ -0,0 +1,27 @@ +# Copyright 2026 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You +# may not use this file except in compliance with the License. A copy of +# the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is +# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF +# ANY KIND, either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +from awscli.testutils import BaseAWSCommandParamsTest + + +class TestOTelAlias(BaseAWSCommandParamsTest): + def test_get_otel_enrichment_alias(self): + self.run_cmd('cloudwatch get-otel-enrichment', expected_rc=0) + self.run_cmd('cloudwatch get-o-tel-enrichment', expected_rc=0) + + def test_start_otel_enrichment_alias(self): + self.run_cmd('cloudwatch start-otel-enrichment', expected_rc=0) + self.run_cmd('cloudwatch start-o-tel-enrichment', expected_rc=0) + + def test_stop_otel_enrichment_alias(self): + self.run_cmd('cloudwatch stop-otel-enrichment', expected_rc=0) + self.run_cmd('cloudwatch stop-o-tel-enrichment', expected_rc=0)