| 1 | |||||||||||||||||||||||||||||
| 2 | package AWS::S3::Request::CreateBucket; | ||||||||||||||||||||||||||||
| 3 | 6 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 6 | with 'AWS::S3::Roles::Request'; | |||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 6 | has 'bucket' => ( | |||||||||||||||||||||||||||
| 8 | is => 'ro', | ||||||||||||||||||||||||||||
| 9 | isa => 'AWS::S3::BucketName', | ||||||||||||||||||||||||||||
| 10 | required => 1, | ||||||||||||||||||||||||||||
| 11 | ); | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | has 'location' => ( | ||||||||||||||||||||||||||||
| 14 | is => 'ro', | ||||||||||||||||||||||||||||
| 15 | isa => 'Maybe[Str]', | ||||||||||||||||||||||||||||
| 16 | lazy => 1, | ||||||||||||||||||||||||||||
| 17 | required => 0, | ||||||||||||||||||||||||||||
| 18 | 16 | ▶ | default => sub { shift->s3->region || $ENV{AWS_REGION} }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 19 | 6 | ); | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 6 | has '+_expect_nothing' => ( default => 1 ); | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 19 | ▶ | sub request { | ||||||||||||||||||||||||||
|
Subroutine
request: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 24 | 19 | my $s = shift; | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | # By default the bucket is put in us-east-1. But if you _ask_ for | ||||||||||||||||||||||||||||
| 27 | # us-east-1 you get an error. | ||||||||||||||||||||||||||||
| 28 | 19 | my $xml = q{}; | |||||||||||||||||||||||||||
| 29 | 19 | ▶ | if ( $s->location && $s->location ne 'us-east-1' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$s->location and $s->location ne "us-east-1"
MC/DC100%2/2
$s->location and $s->location ne "us-east-1"
$s->location
$s->location ne "us-east-1"
Truth table100%3/3
A and B
A= $s->locationB= $s->location ne "us-east-1"
| |||||||||||||||||||||||||||||
| 30 | 3 | $xml = <<"XML"; | |||||||||||||||||||||||||||
| 31 | <CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> | ||||||||||||||||||||||||||||
| 32 | 3 | <LocationConstraint>@{[ $s->_xml_escape( $s->location ) ]}</LocationConstraint> | |||||||||||||||||||||||||||
| 33 | </CreateBucketConfiguration> | ||||||||||||||||||||||||||||
| 34 | XML | ||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 19 | return $s->_send_request( | |||||||||||||||||||||||||||
| 38 | PUT => URI->new( $s->protocol . '://' . $s->bucket . '.' . $s->endpoint . '/' ) => { | ||||||||||||||||||||||||||||
| 39 | Date => $s->_http_date, | ||||||||||||||||||||||||||||
| 40 | 'content-type' => 'text/plain', | ||||||||||||||||||||||||||||
| 41 | }, | ||||||||||||||||||||||||||||
| 42 | $xml | ||||||||||||||||||||||||||||
| 43 | ); | ||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 6 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||