Skip to content
Open
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
7 changes: 7 additions & 0 deletions .changes/next-release/cloudwatch-otel-rename.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
36 changes: 36 additions & 0 deletions awscli/customizations/cloudwatch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 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 make_hidden_command_alias
from awscli.customizations.utils import rename_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:
rename_command(command_table, old_name, new_name)
make_hidden_command_alias(
command_table, new_name, old_name
)
2 changes: 2 additions & 0 deletions awscli/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,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 (
Expand Down Expand Up @@ -208,6 +209,7 @@ def awscli_initialize(event_handlers):
register_alias_mturk_command(event_handlers)
register_alias_sagemaker_runtime_command(event_handlers)
register_alias_socialmessaging_command(event_handlers)
register_rename_otel_commands(event_handlers)
register_servicecatalog_commands(event_handlers)
register_translate_import_terminology(event_handlers)
register_history_mode(event_handlers)
Expand Down
27 changes: 27 additions & 0 deletions tests/functional/cloudwatch/test_otel_alias.py
Original file line number Diff line number Diff line change
@@ -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)