Skip to content

Alias socialmessaging command #9450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2025
Merged
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
28 changes: 28 additions & 0 deletions awscli/customizations/socialmessaging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2025 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


def register_alias_socialmessaging_command(event_emitter):
event_emitter.register(
'building-command-table.socialmessaging',
alias_socialmessaging_command
)


def alias_socialmessaging_command(command_table, **kwargs):
make_hidden_command_alias(
command_table,
existing_name='delete-whatsapp-message-media',
alias_name='delete-whatsapp-media-message',
)
2 changes: 2 additions & 0 deletions awscli/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
from awscli.customizations.sessendemail import register_ses_send_email
from awscli.customizations.sessionmanager import register_ssm_session
from awscli.customizations.sms_voice import register_sms_voice_hide
from awscli.customizations.socialmessaging import register_alias_socialmessaging_command
from awscli.customizations.streamingoutputarg import add_streaming_output_arg
from awscli.customizations.toplevelbool import register_bool_params
from awscli.customizations.translate import (
Expand Down Expand Up @@ -210,6 +211,7 @@ def awscli_initialize(event_handlers):
register_alias_opsworks_cm(event_handlers)
register_alias_mturk_command(event_handlers)
register_alias_sagemaker_runtime_command(event_handlers)
register_alias_socialmessaging_command(event_handlers)
register_servicecatalog_commands(event_handlers)
register_translate_import_terminology(event_handlers)
register_history_mode(event_handlers)
Expand Down
Empty file.
24 changes: 24 additions & 0 deletions tests/functional/socialmessaging/test_alias.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2025 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 TestAlias(BaseAWSCommandParamsTest):
def test_alias(self):
# This command was aliased, both should work
command_template = ('socialmessaging %s --origination-phone-number-id foo '
'--media-id bar')
old_command = command_template % 'delete-whatsapp-media-message'
new_command = command_template % 'delete-whatsapp-message-media'
self.run_cmd(old_command, expected_rc=0)
self.run_cmd(new_command, expected_rc=0)