From 717aa681838d14ae21eca0f82dffe1b7e2af5919 Mon Sep 17 00:00:00 2001 From: sweta Date: Fri, 17 Apr 2020 14:36:59 -0700 Subject: [PATCH 1/4] Handle positional argument in resource batch action handle positional argument --- .changes/next-release/bugfix-Resource-25025.json | 5 +++++ boto3/resources/action.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changes/next-release/bugfix-Resource-25025.json diff --git a/.changes/next-release/bugfix-Resource-25025.json b/.changes/next-release/bugfix-Resource-25025.json new file mode 100644 index 0000000000..f5606eb41e --- /dev/null +++ b/.changes/next-release/bugfix-Resource-25025.json @@ -0,0 +1,5 @@ +{ + "type": "bugfix", + "category": "Resource", + "description": "fixes `#2361 `__" +} diff --git a/boto3/resources/action.py b/boto3/resources/action.py index 52dea55d1a..0b6b8d6ac1 100644 --- a/boto3/resources/action.py +++ b/boto3/resources/action.py @@ -145,11 +145,11 @@ def __call__(self, parent, *args, **kwargs): break params.update(kwargs) - + logger.debug('Calling %s:%s with %r', service_name, operation_name, params) - response = getattr(client, operation_name)(**params) + response = getattr(client, operation_name)(*args, **params) logger.debug('Response: %r', response) From 330c294c50ebd04b3bb0cc0327b86977e513fab3 Mon Sep 17 00:00:00 2001 From: sweta Date: Wed, 22 Apr 2020 12:45:12 -0700 Subject: [PATCH 2/4] Add check for ServiceAction and test cases --- boto3/resources/action.py | 4 +-- tests/unit/resources/test_action.py | 42 +++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/boto3/resources/action.py b/boto3/resources/action.py index 0b6b8d6ac1..b643426a4c 100644 --- a/boto3/resources/action.py +++ b/boto3/resources/action.py @@ -80,7 +80,7 @@ def __call__(self, parent, *args, **kwargs): logger.debug('Calling %s:%s with %r', parent.meta.service_name, operation_name, params) - response = getattr(parent.meta.client, operation_name)(**params) + response = getattr(parent.meta.client, operation_name)(*args, **params) logger.debug('Response: %r', response) @@ -145,7 +145,7 @@ def __call__(self, parent, *args, **kwargs): break params.update(kwargs) - + logger.debug('Calling %s:%s with %r', service_name, operation_name, params) diff --git a/tests/unit/resources/test_action.py b/tests/unit/resources/test_action.py index 5a21f4fb92..24b98daf2a 100644 --- a/tests/unit/resources/test_action.py +++ b/tests/unit/resources/test_action.py @@ -123,6 +123,21 @@ def test_service_action_calls_resource_handler(self, handler_mock, params_mock): operation_name='GetFrobs' ) + def test_service_action_call_positional_argument(self): + def _api_call(*args, **kwargs): + if args: + raise TypeError( + "%s() only accepts keyword arguments." % 'get_frobs') + + resource = mock.Mock() + resource.meta = ResourceMeta('test', client=mock.Mock()) + resource.meta.client.get_frobs = _api_call + + action = ServiceAction(self.action) + + with self.assertRaises(TypeError): + action(resource, 'item1') + class TestWaiterActionCall(BaseTestCase): def setUp(self): @@ -274,3 +289,30 @@ def side_effect(resource, model, params=None, index=None): crp_mock.assert_called_with(item, model.request, params={'foo': 'bar'}, index=0) client.get_frobs.assert_called_with(foo='bar') + + @mock.patch('boto3.resources.action.create_request_parameters') + def test_batch_action_with_positional_argument(self, crp_mock): + def side_effect(resource, model, params=None, index=None): + params['foo'] = 'bar' + + def _api_call(*args, **kwargs): + if args: + raise TypeError( + "%s() only accepts keyword arguments." % 'get_frobs') + + crp_mock.side_effect = side_effect + + client = mock.Mock() + client.get_frobs = _api_call + + item = mock.Mock() + item.meta = ResourceMeta('test', client=client) + + collection = mock.Mock() + collection.pages.return_value = [[item]] + + model = self.model + action = BatchAction(model) + + with self.assertRaises(TypeError): + action(collection, 'item1') From 2976b4d5bca6f0fa0855002e4cc22426da5305e8 Mon Sep 17 00:00:00 2001 From: aws-sdk-python-automation Date: Mon, 27 Apr 2020 18:06:57 +0000 Subject: [PATCH 3/4] Add changelog entries from botocore --- .changes/next-release/api-change-accessanalyzer-60744.json | 5 +++++ .changes/next-release/api-change-dataexchange-36314.json | 5 +++++ .changes/next-release/api-change-dms-39923.json | 5 +++++ .changes/next-release/api-change-sagemaker-12344.json | 5 +++++ 4 files changed, 20 insertions(+) create mode 100644 .changes/next-release/api-change-accessanalyzer-60744.json create mode 100644 .changes/next-release/api-change-dataexchange-36314.json create mode 100644 .changes/next-release/api-change-dms-39923.json create mode 100644 .changes/next-release/api-change-sagemaker-12344.json diff --git a/.changes/next-release/api-change-accessanalyzer-60744.json b/.changes/next-release/api-change-accessanalyzer-60744.json new file mode 100644 index 0000000000..7040fd37e7 --- /dev/null +++ b/.changes/next-release/api-change-accessanalyzer-60744.json @@ -0,0 +1,5 @@ +{ + "category": "``accessanalyzer``", + "type": "api-change", + "description": "[``botocore``] Update accessanalyzer client to latest version" +} diff --git a/.changes/next-release/api-change-dataexchange-36314.json b/.changes/next-release/api-change-dataexchange-36314.json new file mode 100644 index 0000000000..7a0f1301b7 --- /dev/null +++ b/.changes/next-release/api-change-dataexchange-36314.json @@ -0,0 +1,5 @@ +{ + "category": "``dataexchange``", + "type": "api-change", + "description": "[``botocore``] Update dataexchange client to latest version" +} diff --git a/.changes/next-release/api-change-dms-39923.json b/.changes/next-release/api-change-dms-39923.json new file mode 100644 index 0000000000..6d21155fad --- /dev/null +++ b/.changes/next-release/api-change-dms-39923.json @@ -0,0 +1,5 @@ +{ + "category": "``dms``", + "type": "api-change", + "description": "[``botocore``] Update dms client to latest version" +} diff --git a/.changes/next-release/api-change-sagemaker-12344.json b/.changes/next-release/api-change-sagemaker-12344.json new file mode 100644 index 0000000000..ba636d3c6f --- /dev/null +++ b/.changes/next-release/api-change-sagemaker-12344.json @@ -0,0 +1,5 @@ +{ + "category": "``sagemaker``", + "type": "api-change", + "description": "[``botocore``] Update sagemaker client to latest version" +} From 3a196e0a8b434ff1873e3a1aa6e8c12124d24863 Mon Sep 17 00:00:00 2001 From: aws-sdk-python-automation Date: Mon, 27 Apr 2020 18:06:57 +0000 Subject: [PATCH 4/4] Bumping version to 1.12.47 --- .changes/1.12.47.json | 27 +++++++++++++++++++ .../api-change-accessanalyzer-60744.json | 5 ---- .../api-change-dataexchange-36314.json | 5 ---- .../next-release/api-change-dms-39923.json | 5 ---- .../api-change-sagemaker-12344.json | 5 ---- .../next-release/bugfix-Resource-25025.json | 5 ---- CHANGELOG.rst | 10 +++++++ boto3/__init__.py | 2 +- setup.cfg | 2 +- setup.py | 2 +- 10 files changed, 40 insertions(+), 28 deletions(-) create mode 100644 .changes/1.12.47.json delete mode 100644 .changes/next-release/api-change-accessanalyzer-60744.json delete mode 100644 .changes/next-release/api-change-dataexchange-36314.json delete mode 100644 .changes/next-release/api-change-dms-39923.json delete mode 100644 .changes/next-release/api-change-sagemaker-12344.json delete mode 100644 .changes/next-release/bugfix-Resource-25025.json diff --git a/.changes/1.12.47.json b/.changes/1.12.47.json new file mode 100644 index 0000000000..4dc67bf541 --- /dev/null +++ b/.changes/1.12.47.json @@ -0,0 +1,27 @@ +[ + { + "category": "Resource", + "description": "fixes `#2361 `__", + "type": "bugfix" + }, + { + "category": "``dms``", + "description": "[``botocore``] Update dms client to latest version", + "type": "api-change" + }, + { + "category": "``dataexchange``", + "description": "[``botocore``] Update dataexchange client to latest version", + "type": "api-change" + }, + { + "category": "``accessanalyzer``", + "description": "[``botocore``] Update accessanalyzer client to latest version", + "type": "api-change" + }, + { + "category": "``sagemaker``", + "description": "[``botocore``] Update sagemaker client to latest version", + "type": "api-change" + } +] \ No newline at end of file diff --git a/.changes/next-release/api-change-accessanalyzer-60744.json b/.changes/next-release/api-change-accessanalyzer-60744.json deleted file mode 100644 index 7040fd37e7..0000000000 --- a/.changes/next-release/api-change-accessanalyzer-60744.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "category": "``accessanalyzer``", - "type": "api-change", - "description": "[``botocore``] Update accessanalyzer client to latest version" -} diff --git a/.changes/next-release/api-change-dataexchange-36314.json b/.changes/next-release/api-change-dataexchange-36314.json deleted file mode 100644 index 7a0f1301b7..0000000000 --- a/.changes/next-release/api-change-dataexchange-36314.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "category": "``dataexchange``", - "type": "api-change", - "description": "[``botocore``] Update dataexchange client to latest version" -} diff --git a/.changes/next-release/api-change-dms-39923.json b/.changes/next-release/api-change-dms-39923.json deleted file mode 100644 index 6d21155fad..0000000000 --- a/.changes/next-release/api-change-dms-39923.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "category": "``dms``", - "type": "api-change", - "description": "[``botocore``] Update dms client to latest version" -} diff --git a/.changes/next-release/api-change-sagemaker-12344.json b/.changes/next-release/api-change-sagemaker-12344.json deleted file mode 100644 index ba636d3c6f..0000000000 --- a/.changes/next-release/api-change-sagemaker-12344.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "category": "``sagemaker``", - "type": "api-change", - "description": "[``botocore``] Update sagemaker client to latest version" -} diff --git a/.changes/next-release/bugfix-Resource-25025.json b/.changes/next-release/bugfix-Resource-25025.json deleted file mode 100644 index f5606eb41e..0000000000 --- a/.changes/next-release/bugfix-Resource-25025.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "bugfix", - "category": "Resource", - "description": "fixes `#2361 `__" -} diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 95700f7169..09662b486c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,16 @@ CHANGELOG ========= +1.12.47 +======= + +* bugfix:Resource: fixes `#2361 `__ +* api-change:``dms``: [``botocore``] Update dms client to latest version +* api-change:``dataexchange``: [``botocore``] Update dataexchange client to latest version +* api-change:``accessanalyzer``: [``botocore``] Update accessanalyzer client to latest version +* api-change:``sagemaker``: [``botocore``] Update sagemaker client to latest version + + 1.12.46 ======= diff --git a/boto3/__init__.py b/boto3/__init__.py index 1a363fd486..562a0f0d1e 100644 --- a/boto3/__init__.py +++ b/boto3/__init__.py @@ -17,7 +17,7 @@ __author__ = 'Amazon Web Services' -__version__ = '1.12.46' +__version__ = '1.12.47' # The default Boto3 session; autoloaded when needed. diff --git a/setup.cfg b/setup.cfg index 147560f5d4..559b07c2ee 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,6 +3,6 @@ universal = 1 [metadata] requires-dist = - botocore>=1.15.46,<1.16.0 + botocore>=1.15.47,<1.16.0 jmespath>=0.7.1,<1.0.0 s3transfer>=0.3.0,<0.4.0 diff --git a/setup.py b/setup.py index 50ba57b19f..cf43a7895a 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ requires = [ - 'botocore>=1.15.46,<1.16.0', + 'botocore>=1.15.47,<1.16.0', 'jmespath>=0.7.1,<1.0.0', 's3transfer>=0.3.0,<0.4.0' ]