Skip to content

Commit fe3d16c

Browse files
committed
Add alias to runtime.sagemaker for backwards compatibility
1 parent 787b2cc commit fe3d16c

File tree

4 files changed

+58
-0
lines changed

4 files changed

+58
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "bugfix",
3+
"category": "sagemaker-runtime",
4+
"description": "Renamed the runtime.sagemaker service to sagemaker-runtime to be more consistent with existing services. The old service name is now aliased to sagemaker-runtime to maintain backwards compatibility."
5+
}

awscli/customizations/sagemaker.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright 2017 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_sagemaker_runtime_command(event_emitter):
17+
event_emitter.register(
18+
'building-command-table.main',
19+
alias_sagemaker_runtime_command
20+
)
21+
22+
23+
def alias_sagemaker_runtime_command(command_table, **kwargs):
24+
make_hidden_command_alias(
25+
command_table,
26+
existing_name='sagemaker-runtime',
27+
alias_name='runtime.sagemaker',
28+
)

awscli/handlers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
from awscli.customizations.waiters import register_add_waiters
7878
from awscli.customizations.opsworkscm import register_alias_opsworks_cm
7979
from awscli.customizations.mturk import register_alias_mturk_command
80+
from awscli.customizations.sagemaker import register_alias_sagemaker_runtime_command
8081
from awscli.customizations.servicecatalog import register_servicecatalog_commands
8182

8283

@@ -155,6 +156,7 @@ def awscli_initialize(event_handlers):
155156
cloudformation_init(event_handlers)
156157
register_alias_opsworks_cm(event_handlers)
157158
register_alias_mturk_command(event_handlers)
159+
register_alias_sagemaker_runtime_command(event_handlers)
158160
register_servicecatalog_commands(event_handlers)
159161
register_history_mode(event_handlers)
160162
register_history_commands(event_handlers)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2017 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 = '%s invoke-endpoint --endpoint-name foo --body bar f'
20+
old_command = command_template % 'runtime.sagemaker'
21+
new_command = command_template % 'sagemaker-runtime'
22+
self.run_cmd(old_command, expected_rc=0)
23+
self.run_cmd(new_command, expected_rc=0)

0 commit comments

Comments
 (0)