Skip to content

Commit

Permalink
Merge customizations for QBusiness
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-sdk-python-automation committed Apr 30, 2024
1 parent 331c5fe commit f60fce6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
7 changes: 7 additions & 0 deletions botocore/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,12 @@ def remove_lex_v2_start_conversation(class_attributes, **kwargs):
del class_attributes['start_conversation']


def remove_qbusiness_chat(class_attributes, **kwargs):
"""Operation requires h2 which is currently unsupported in Python"""
if 'chat' in class_attributes:
del class_attributes['chat']


def add_retry_headers(request, **kwargs):
retries_context = request.context.get('retries')
if not retries_context:
Expand Down Expand Up @@ -1185,6 +1191,7 @@ def remove_content_type_header_for_presigning(request, **kwargs):
('creating-client-class.s3', add_generate_presigned_post),
('creating-client-class.iot-data', check_openssl_supports_tls_version_1_2),
('creating-client-class.lex-runtime-v2', remove_lex_v2_start_conversation),
('creating-client-class.qbusiness', remove_qbusiness_chat),
('after-call.iam', json_decode_policies),
('after-call.ec2.GetConsoleOutput', decode_console_output),
('after-call.cloudformation.GetTemplate', json_decode_template_body),
Expand Down
1 change: 1 addition & 0 deletions tests/functional/test_h2_required.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
_H2_REQUIRED = object()
# Service names to list of known HTTP 2 operations
_KNOWN_SERVICES = {
'qbusiness': ['Chat'],
'kinesis': ['SubscribeToShard'],
'lexv2-runtime': ['StartConversation'],
}
Expand Down
23 changes: 23 additions & 0 deletions tests/functional/test_qbusiness.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2024 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.
import pytest

from botocore.session import get_session


def test_chat_removal():
"""Chat operation removed due to h2 requirement"""
session = get_session()
qbusiness = session.create_client('qbusiness', 'us-west-2')
with pytest.raises(AttributeError):
qbusiness.chat

0 comments on commit f60fce6

Please sign in to comment.