| 1 | |||||||||||
| 2 | package AWS::S3::Types; | ||||||||||
| 3 | |||||||||||
| 4 | 9 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 9 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 9 | ▶ | use Moose::Util::TypeConstraints; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | # The name of a bucket is interpolated into the host (and sometimes the path) | ||||||||||
| 10 | # of every request we make, so it must not be able to change the structure of | ||||||||||
| 11 | # the URL: no "/", "?", "#", "@", ":", "%", whitespace and so on, otherwise | ||||||||||
| 12 | # the (signed) request, including any session token, could be sent to an | ||||||||||
| 13 | # arbitrary host or be turned into a different S3 operation. | ||||||||||
| 14 | # | ||||||||||
| 15 | # This is deliberately more permissive than the current S3 naming rules (no | ||||||||||
| 16 | # lowercase only restriction, underscores and up to 255 characters allowed) | ||||||||||
| 17 | # as legacy buckets and S3 compatible stores still use such names. | ||||||||||
| 18 | # | ||||||||||
| 19 | # Note \z rather than $, the latter would allow a trailing newline. | ||||||||||
| 20 | subtype 'AWS::S3::BucketName', | ||||||||||
| 21 | as 'Str', | ||||||||||
| 22 | 489 | ▶ | where { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||
| 23 | 489 | ▶ | length( $_ ) <= 255 | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | && $_ =~ /\A[A-Za-z0-9][A-Za-z0-9._-]*\z/ | ||||||||||
| 25 | }, | ||||||||||
| 26 | 253 | ▶ | message { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
| |||||||||||
| 27 | 253 | ▶ | "Invalid S3 bucket name '" . ( defined $_ ? $_ : 'undef' ) . "'" | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | 9 | }; | |||||||||
| 29 | |||||||||||
| 30 | 9 | 1; | |||||||||