Skip to content

Commit

Permalink
Merge branch 'release-1.27.75'
Browse files Browse the repository at this point in the history
* release-1.27.75:
  Bumping version to 1.27.75
  Update to latest models
  aws_is_virtual_hostable_bucket endpoint provider standard library function (#2762)
  • Loading branch information
aws-sdk-python-automation committed Sep 16, 2022
2 parents ecbc47a + 68f04a8 commit 55b9fc7
Show file tree
Hide file tree
Showing 11 changed files with 288 additions and 53 deletions.
12 changes: 12 additions & 0 deletions .changes/1.27.75.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"category": "``codestar-notifications``",
"description": "This release adds tag based access control for the UntagResource API.",
"type": "api-change"
},
{
"category": "``ecs``",
"description": "This release supports new task definition sizes.",
"type": "api-change"
}
]
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exclude: "\
botocore/compat.py|\
docs/|\
tests/unit/auth/aws4_testsuite|\
tests/unit/data/endpoints/|\
tests/unit/response_parsing/xml|\
CHANGELOG.rst\
)"
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
CHANGELOG
=========

1.27.75
=======

* api-change:``codestar-notifications``: This release adds tag based access control for the UntagResource API.
* api-change:``ecs``: This release supports new task definition sizes.


1.27.74
=======

Expand Down
2 changes: 1 addition & 1 deletion botocore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import os
import re

__version__ = '1.27.74'
__version__ = '1.27.75'


class NullHandler(logging.Handler):
Expand Down
92 changes: 53 additions & 39 deletions botocore/data/codestar-notifications/2019-10-15/service-2.json

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions botocore/data/ecs/2014-11-13/service-2.json

Large diffs are not rendered by default.

33 changes: 32 additions & 1 deletion botocore/endpoint_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from typing import NamedTuple

from botocore import xform_name
from botocore.compat import quote, urlparse
from botocore.compat import IPV4_RE, quote, urlparse
from botocore.exceptions import EndpointResolutionError
from botocore.utils import (
ArnParser,
Expand Down Expand Up @@ -377,6 +377,37 @@ def _not(self, value):
"""
return not value

def aws_is_virtual_hostable_s3_bucket(self, value, allow_subdomains):
"""Evaluates whether a value is a valid bucket name for virtual host
style bucket URLs. To pass, the value must meet the following criteria:
1. is_valid_host_label(value) is True
2. length between 3 and 63 characters (inclusive)
3. does not contain uppercase characters
4. is not formatted as an IP address
If allow_subdomains is True, split on `.` and validate
each component separately.
:type value: str
:type allow_subdomains: bool
:rtype: bool
"""
if (
value is None
or len(value) < 3
or value.lower() != value
or IPV4_RE.match(value) is not None
):
return False

if allow_subdomains is True:
return all(
self.aws_is_virtual_hostable_s3_bucket(label, False)
for label in value.split(".")
)

return self.is_valid_host_label(value, allow_subdomains=False)


class BaseRule:
"""Base interface for individual endpoint rules."""
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
# The short X.Y version.
version = '1.27.'
# The full version, including alpha/beta/rc tags.
release = '1.27.74'
release = '1.27.75'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{
"version": "1.0",
"testCases": [
{
"documentation": "bucket-name: isVirtualHostable",
"params": {
"BucketName": "bucket-name"
},
"expect": {
"endpoint": {
"url": "https://bucket-name.s3.amazonaws.com"
}
}
},
{
"documentation": "bucket-with-number-1: isVirtualHostable",
"params": {
"BucketName": "bucket-with-number-1"
},
"expect": {
"endpoint": {
"url": "https://bucket-with-number-1.s3.amazonaws.com"
}
}
},
{
"documentation": "BucketName: not isVirtualHostable (uppercase characters)",
"params": {
"BucketName": "BucketName"
},
"expect": {
"error": "not isVirtualHostableS3Bucket"
}
},
{
"documentation": "bucket_name: not isVirtualHostable (underscore)",
"params": {
"BucketName": "bucket_name"
},
"expect": {
"error": "not isVirtualHostableS3Bucket"
}
},
{
"documentation": "bucket.name: isVirtualHostable (http only)",
"params": {
"BucketName": "bucket.name"
},
"expect": {
"endpoint": {
"url": "http://bucket.name.s3.amazonaws.com"
}
}
},
{
"documentation": "bucket.name.multiple.dots1: isVirtualHostable (http only)",
"params": {
"BucketName": "bucket.name.multiple.dots1"
},
"expect": {
"endpoint": {
"url": "http://bucket.name.multiple.dots1.s3.amazonaws.com"
}
}
},
{
"documentation": "-bucket-name: not isVirtualHostable (leading dash)",
"params": {
"BucketName": "-bucket-name"
},
"expect": {
"error": "not isVirtualHostableS3Bucket"
}
},
{
"documentation": "bucket-name-: not isVirtualHostable (trailing dash)",
"params": {
"BucketName": "bucket-name-"
},
"expect": {
"error": "not isVirtualHostableS3Bucket"
}
},
{
"documentation": "aa: not isVirtualHostable (< 3 characters)",
"params": {
"BucketName": "aa"
},
"expect": {
"error": "not isVirtualHostableS3Bucket"
}
},
{
"documentation": "'a'*64: not isVirtualHostable (> 63 characters)",
"params": {
"BucketName": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
},
"expect": {
"error": "not isVirtualHostableS3Bucket"
}
},
{
"documentation": ".bucket-name: not isVirtualHostable (leading dot)",
"params": {
"BucketName": ".bucket-name"
},
"expect": {
"error": "not isVirtualHostableS3Bucket"
}
},
{
"documentation": "bucket-name.: not isVirtualHostable (trailing dot)",
"params": {
"BucketName": "bucket-name."
},
"expect": {
"error": "not isVirtualHostableS3Bucket"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"version": "1.3",
"parameters": {
"BucketName": {
"type": "string",
"required": true,
"documentation": "the input used to test isVirtualHostableS3Bucket"
}
},
"rules": [
{
"conditions": [
{
"fn": "aws.isVirtualHostableS3Bucket",
"argv": [
"{BucketName}",
false
]
}
],
"endpoint": {
"url": "https://{BucketName}.s3.amazonaws.com"
},
"type": "endpoint"
},
{
"conditions": [
{
"fn": "aws.isVirtualHostableS3Bucket",
"argv": [
"{BucketName}",
true
]
}
],
"endpoint": {
"url": "http://{BucketName}.s3.amazonaws.com"
},
"type": "endpoint"
},
{
"conditions": [
],
"error": "not isVirtualHostableS3Bucket",
"type": "error"
}
]
}
1 change: 1 addition & 0 deletions tests/unit/test_endpoints_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def ruleset_testcases():
"eventbridge",
"fns",
"headers",
"is-virtual-hostable-s3-bucket",
"local-region-override",
"parse-arn",
"parse-url",
Expand Down

0 comments on commit 55b9fc7

Please sign in to comment.