Skip to content

Commit 84b010d

Browse files
authored
Alias socialmessaging command (#9450)
1 parent 888e8b1 commit 84b010d

File tree

4 files changed

+54
-0
lines changed

4 files changed

+54
-0
lines changed
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
from awscli.customizations.utils import make_hidden_command_alias
14+
15+
16+
def register_alias_socialmessaging_command(event_emitter):
17+
event_emitter.register(
18+
'building-command-table.socialmessaging',
19+
alias_socialmessaging_command
20+
)
21+
22+
23+
def alias_socialmessaging_command(command_table, **kwargs):
24+
make_hidden_command_alias(
25+
command_table,
26+
existing_name='delete-whatsapp-message-media',
27+
alias_name='delete-whatsapp-media-message',
28+
)

awscli/handlers.py

+2
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
from awscli.customizations.sessendemail import register_ses_send_email
117117
from awscli.customizations.sessionmanager import register_ssm_session
118118
from awscli.customizations.sms_voice import register_sms_voice_hide
119+
from awscli.customizations.socialmessaging import register_alias_socialmessaging_command
119120
from awscli.customizations.streamingoutputarg import add_streaming_output_arg
120121
from awscli.customizations.toplevelbool import register_bool_params
121122
from awscli.customizations.translate import (
@@ -210,6 +211,7 @@ def awscli_initialize(event_handlers):
210211
register_alias_opsworks_cm(event_handlers)
211212
register_alias_mturk_command(event_handlers)
212213
register_alias_sagemaker_runtime_command(event_handlers)
214+
register_alias_socialmessaging_command(event_handlers)
213215
register_servicecatalog_commands(event_handlers)
214216
register_translate_import_terminology(event_handlers)
215217
register_history_mode(event_handlers)

tests/functional/socialmessaging/__init__.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
from awscli.testutils import BaseAWSCommandParamsTest
14+
15+
16+
class TestAlias(BaseAWSCommandParamsTest):
17+
def test_alias(self):
18+
# This command was aliased, both should work
19+
command_template = ('socialmessaging %s --origination-phone-number-id foo '
20+
'--media-id bar')
21+
old_command = command_template % 'delete-whatsapp-media-message'
22+
new_command = command_template % 'delete-whatsapp-message-media'
23+
self.run_cmd(old_command, expected_rc=0)
24+
self.run_cmd(new_command, expected_rc=0)

0 commit comments

Comments
 (0)