Skip to content

Commit

Permalink
Merge branch 'release-1.35.2'
Browse files Browse the repository at this point in the history
* release-1.35.2:
  Bumping version to 1.35.2
  Update changelog based on model updates
  S3 Expires timestamp deprecation (#8956)
  • Loading branch information
aws-sdk-python-automation committed Oct 8, 2024
2 parents 9330ca8 + fd8c126 commit 1519e76
Show file tree
Hide file tree
Showing 10 changed files with 105 additions and 5 deletions.
17 changes: 17 additions & 0 deletions .changes/1.35.2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
{
"category": "``elasticache``",
"description": "AWS ElastiCache SDK now supports using APIs with newly launched Valkey engine. Please refer to updated AWS ElastiCache public documentation for detailed information on API usage.",
"type": "api-change"
},
{
"category": "``memorydb``",
"description": "Amazon MemoryDB SDK now supports all APIs for newly launched Valkey engine. Please refer to the updated Amazon MemoryDB public documentation for detailed information on API usage.",
"type": "api-change"
},
{
"category": "``s3``",
"description": "Adds logic to gracefully handle invalid timestamps returned in the Expires header.",
"type": "enhancement"
}
]
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
CHANGELOG
=========

1.35.2
======

* api-change:``elasticache``: AWS ElastiCache SDK now supports using APIs with newly launched Valkey engine. Please refer to updated AWS ElastiCache public documentation for detailed information on API usage.
* api-change:``memorydb``: Amazon MemoryDB SDK now supports all APIs for newly launched Valkey engine. Please refer to the updated Amazon MemoryDB public documentation for detailed information on API usage.
* enhancement:``s3``: Adds logic to gracefully handle invalid timestamps returned in the Expires header.


1.35.1
======

Expand Down
2 changes: 1 addition & 1 deletion awscli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import os

__version__ = '1.35.1'
__version__ = '1.35.2'

#
# Get our data path to be added to botocore's search path
Expand Down
17 changes: 17 additions & 0 deletions awscli/bcdoc/restdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,23 @@ def push_write(self, s):
"""
self._writes.append(s)

def find_last_write(self, content):
"""
Returns the index of the last occurrence of the content argument
in the stack, or returns None if content is not on the stack.
"""
try:
return len(self._writes) - self._writes[::-1].index(content) - 1
except ValueError:
return None

def insert_write(self, index, content):
"""
Inserts the content argument to the stack directly before the
supplied index.
"""
self._writes.insert(index, content)

def getvalue(self):
"""
Returns the current content of the document as a string.
Expand Down
30 changes: 30 additions & 0 deletions awscli/customizations/s3events.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ def register_event_stream_arg(event_handlers):
)


def register_document_expires_string(event_handlers):
event_handlers.register_last(
'doc-output.s3api',
document_expires_string
)

def add_event_stream_output_arg(argument_table, operation_model,
session, **kwargs):
argument_table['outfile'] = S3SelectStreamOutputArgument(
Expand All @@ -56,6 +62,30 @@ def replace_event_stream_docs(help_command, **kwargs):
doc.write("This command generates no output. The selected "
"object content is written to the specified outfile.\n")

def document_expires_string(help_command, **kwargs):
doc = help_command.doc
expires_field_idx = doc.find_last_write('Expires -> (timestamp)')

if expires_field_idx is None:
return

deprecation_note_and_expires_string = [
f'\n\n\n{" " * doc.style.indentation * doc.style.indent_width}',
'.. note::',
f'\n\n\n{" " * (doc.style.indentation + 1) * doc.style.indent_width}',
'This member has been deprecated. Please use `ExpiresString` instead.\n',
f'\n\n{" " * doc.style.indentation * doc.style.indent_width}',
f'\n\n{" " * doc.style.indentation * doc.style.indent_width}',
'ExpiresString -> (string)\n\n',
'\tThe raw, unparsed value of the ``Expires`` field.',
f'\n\n{" " * doc.style.indentation * doc.style.indent_width}'
]

for idx, write in enumerate(deprecation_note_and_expires_string):
# We add 4 to the index of the expires field name because each
# field in the output section consists of exactly 4 elements.
doc.insert_write(expires_field_idx + idx + 4, write)


class S3SelectStreamOutputArgument(CustomArgument):
_DOCUMENT_AS_REQUIRED = True
Expand Down
3 changes: 2 additions & 1 deletion awscli/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
from awscli.customizations.route53 import register_create_hosted_zone_doc_fix
from awscli.customizations.s3.s3 import s3_plugin_initialize
from awscli.customizations.s3errormsg import register_s3_error_msg
from awscli.customizations.s3events import register_event_stream_arg
from awscli.customizations.s3events import register_event_stream_arg, register_document_expires_string
from awscli.customizations.sagemaker import (
register_alias_sagemaker_runtime_command,
)
Expand Down Expand Up @@ -215,6 +215,7 @@ def awscli_initialize(event_handlers):
register_history_mode(event_handlers)
register_history_commands(event_handlers)
register_event_stream_arg(event_handlers)
register_document_expires_string(event_handlers)
dlm_initialize(event_handlers)
register_ssm_session(event_handlers)
register_sms_voice_hide(event_handlers)
Expand Down
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
# The short X.Y version.
version = '1.35'
# The full version, including alpha/beta/rc tags.
release = '1.35.1'
release = '1.35.2'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ universal = 0

[metadata]
requires_dist =
botocore==1.35.35
botocore==1.35.36
docutils>=0.10,<0.17
s3transfer>=0.10.0,<0.11.0
PyYAML>=3.10,<6.1
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def find_version(*file_paths):


install_requires = [
'botocore==1.35.35',
'botocore==1.35.36',
'docutils>=0.10,<0.17',
's3transfer>=0.10.0,<0.11.0',
'PyYAML>=3.10,<6.1',
Expand Down
27 changes: 27 additions & 0 deletions tests/unit/bcdoc/test_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@

class TestReSTDocument(unittest.TestCase):

def _write_array(self, doc, arr):
for elt in arr:
doc.write(elt)

def test_write(self):
doc = ReSTDocument()
doc.write('foo')
Expand All @@ -36,6 +40,29 @@ def test_writeln(self):
doc.writeln('foo')
self.assertEqual(doc.getvalue(), b'foo\n')

def test_find_last_write(self):
doc = ReSTDocument()
self._write_array(doc, ['a', 'b', 'c', 'd', 'e'])
expected_index = 0
self.assertEqual(doc.find_last_write('a'), expected_index)

def test_find_last_write_duplicates(self):
doc = ReSTDocument()
self._write_array(doc, ['a', 'b', 'c', 'a', 'e'])
expected_index = 3
self.assertEqual(doc.find_last_write('a'), expected_index)

def test_find_last_write_not_found(self):
doc = ReSTDocument()
self._write_array(doc, ['a', 'b', 'c', 'd', 'e'])
self.assertIsNone(doc.find_last_write('f'))

def test_insert_write(self):
doc = ReSTDocument()
self._write_array(doc, ['foo', 'bar'])
doc.insert_write(1, 'baz')
self.assertEqual(doc.getvalue(), b'foobazbar')

def test_include_doc_string(self):
doc = ReSTDocument()
doc.include_doc_string('<p>this is a <code>test</code></p>')
Expand Down

0 comments on commit 1519e76

Please sign in to comment.