<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package Shared::Examples::Net::Amazon::S3::Error;
$Shared::Examples::Net::Amazon::S3::Error::VERSION = '0.85';
use strict;
use warnings;

use parent qw[ Exporter::Tiny ];

use HTTP::Status;

our @EXPORT_OK = (
    qw[ fixture_error_access_denied ],
    qw[ fixture_error_bucket_already_exists ],
    qw[ fixture_error_bucket_not_empty ],
    qw[ fixture_error_invalid_bucket_name ],
    qw[ fixture_error_no_such_bucket ],
    qw[ fixture_error_no_such_key ],
);

sub _error_fixture {
    my ($error_code, $http_status) = @_;

    my $error_message = $error_code;
    $error_message =~ s/ (?&lt;=[[:lower:]]) ([[:upper:]])/ \L$1\E/gx;
    +(
        with_response_code =&gt; $http_status,
        with_response_data =&gt; &lt;&lt;"XML",
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;Error&gt;
  &lt;Code&gt;$error_code&lt;/Code&gt;
  &lt;Message&gt;$error_message error message&lt;/Message&gt;
  &lt;Resource&gt;/some-resource&lt;/Resource&gt;
  &lt;RequestId&gt;4442587FB7D0A2F9&lt;/RequestId&gt;
&lt;/Error&gt;
XML
    );
}

sub fixture_error_access_denied {
    _error_fixture AccessDenied =&gt; HTTP::Status::HTTP_FORBIDDEN;
}

sub fixture_error_bucket_already_exists {
    _error_fixture BucketAlreadyExists =&gt; HTTP::Status::HTTP_CONFLICT;
}

sub fixture_error_bucket_not_empty {
    _error_fixture BucketNotEmpty =&gt; HTTP::Status::HTTP_CONFLICT;
}

sub fixture_error_invalid_bucket_name {
    _error_fixture InvalidBucketName =&gt; HTTP::Status::HTTP_BAD_REQUEST;
}

sub fixture_error_no_such_bucket {
    _error_fixture NoSuchBucket =&gt; HTTP::Status::HTTP_NOT_FOUND;
}

sub fixture_error_no_such_key {
    _error_fixture NoSuchKey =&gt; HTTP::Status::HTTP_NOT_FOUND;
}

__END__

=pod

=encoding UTF-8

=head1 NAME

Shared::Examples::Net::Amazon::S3::Error

=head1 VERSION

version 0.85

=head1 AUTHOR

Leo Lapworth &lt;llap@cpan.org&gt;

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut
</pre></body></html>