| 1 | |||
| 2 | package AWS::S3::Request::DeleteMulti; | ||
| 3 | |||
| 4 | 5 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 5 | ▶ | use AWS::S3::ResponseParser; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 5 | with 'AWS::S3::Roles::Request'; | |
| 8 | |||
| 9 | 5 | has 'bucket' => ( | |
| 10 | is => 'ro', | ||
| 11 | isa => 'AWS::S3::BucketName', | ||
| 12 | required => 1, | ||
| 13 | ); | ||
| 14 | |||
| 15 | 5 | has 'keys' => ( | |
| 16 | is => 'ro', | ||
| 17 | isa => 'ArrayRef[Str]', | ||
| 18 | required => 1, | ||
| 19 | ); | ||
| 20 | |||
| 21 | 5 | has '_subresource' => ( | |
| 22 | is => 'ro', | ||
| 23 | isa => 'Str', | ||
| 24 | init_arg => undef, | ||
| 25 | default => 'delete' | ||
| 26 | ); | ||
| 27 | |||
| 28 | |||
| 29 | |||
| 30 | 5 | has '+_expect_nothing' => ( default => 0 ); | |
| 31 | |||
| 32 | 6 | ▶ | sub request { |
|
Subroutine
request: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 33 | 6 | my $s = shift; | |
| 34 | |||
| 35 | # keys are arbitrary strings so must be escaped, otherwise a crafted key | ||
| 36 | # can inject extra <Object> elements and delete unintended objects | ||
| 37 | my $objects = join "\n", | ||
| 38 | 12 | map { '<Object><Key>' . $s->_xml_escape( $_ ) . '</Key></Object>' } | |
| 39 | 6 | @{ $s->keys }; | |
| 40 | |||
| 41 | 6 | my $xml = <<"XML"; | |
| 42 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 43 | <Delete> | ||
| 44 | $objects | ||
| 45 | </Delete> | ||
| 46 | XML | ||
| 47 | |||
| 48 | 6 | $s->_send_request( | |
| 49 | POST => $s->_uri => { | ||
| 50 | Date => $s->_http_date, | ||
| 51 | 'content-md5' => $s->_content_md5( $xml ), | ||
| 52 | }, | ||
| 53 | $xml | ||
| 54 | ); | ||
| 55 | } | ||
| 56 | |||
| 57 | 5 | __PACKAGE__->meta->make_immutable; | |