File Coverage

blib/lib/Net/Amazon/S3/Operation/Bucket/Create/Request.pm
Criterion Covered Total %
statement 10 10 100.0
branch 2 2 100.0
condition 3 3 100.0
subroutine 3 3 100.0
pod 1 1 100.0
total 19 19 100.0


line stmt bran cond sub pod time code
1             package Net::Amazon::S3::Operation::Bucket::Create::Request;
2             # ABSTRACT: An internal class to create a bucket
3             $Net::Amazon::S3::Operation::Bucket::Create::Request::VERSION = '0.99';
4 99     99   790 use Moose 0.85;
  99         2549  
  99         772  
5             extends 'Net::Amazon::S3::Request::Bucket';
6              
7             with 'Net::Amazon::S3::Request::Role::HTTP::Header::ACL';
8             with 'Net::Amazon::S3::Request::Role::HTTP::Method::PUT';
9             with 'Net::Amazon::S3::Request::Role::XML::Content';
10              
11             has location_constraint => (
12             is => 'ro',
13             isa => 'MaybeLocationConstraint',
14             coerce => 1,
15             required => 0,
16             );
17              
18             __PACKAGE__->meta->make_immutable;
19              
20             sub _request_content {
21 39     39   124 my ($self) = @_;
22              
23 39         103 my $content = '';
24 39 100 100     1595 if (defined $self->location_constraint && $self->location_constraint ne 'us-east-1') {
25 7         261 $content = $self->_build_xml (
26             CreateBucketConfiguration => [
27             { LocationConstraint => $self->location_constraint },
28             ]
29             );
30             }
31              
32 39         1772 return $content;
33             }
34              
35             sub http_request {
36 69     69 1 166 my $self = shift;
37              
38 69         293 return $self->_build_http_request (
39             region => 'us-east-1',
40             );
41             }
42              
43             1;
44              
45             __END__
46              
47             =pod
48              
49             =encoding UTF-8
50              
51             =head1 NAME
52              
53             Net::Amazon::S3::Operation::Bucket::Create::Request - An internal class to create a bucket
54              
55             =head1 VERSION
56              
57             version 0.99
58              
59             =head1 SYNOPSIS
60              
61             my $http_request = Net::Amazon::S3::Operation::Bucket::Create::Request->new(
62             s3 => $s3,
63             bucket => $bucket,
64             acl_short => $acl_short,
65             location_constraint => $location_constraint,
66             )->http_request;
67              
68             =head1 DESCRIPTION
69              
70             This module creates a bucket.
71              
72             Implements operation L<< CreateBucket|https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html >>
73              
74             =for test_synopsis no strict 'vars'
75              
76             =head1 METHODS
77              
78             =head2 http_request
79              
80             This method returns a HTTP::Request object.
81              
82             =head1 AUTHOR
83              
84             Branislav Zahradník <barney@cpan.org>
85              
86             =head1 COPYRIGHT AND LICENSE
87              
88             This software is copyright (c) 2021 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover, Branislav Zahradník.
89              
90             This is free software; you can redistribute it and/or modify it under
91             the same terms as the Perl 5 programming language system itself.
92              
93             =cut