Amazon-S3
view release on metacpan or search on metacpan
lib/Amazon/S3/BucketV2.pm view on Meta::CPAN
put_public_access_block => 'publicAccessBlock',
restore_object => sub {
return { method => 'POST', api => 'restore' };
},
upload_part => $EMPTY,
upload_part_copy => $EMPTY,
);
create_methods(
type => 'object',
method => 'PUT',
method_def => \@PUT_OBJECT_METHODS,
);
######################################################################
our @DELETE_OBJECT_METHODS = (
######################################################################
delete_object => $EMPTY,
delete_objects => sub {
return { method => 'POST', api => 'delete' };
},
delete_object_tagging => 'tagging',
);
create_methods(
type => 'object',
method => 'DELETE',
method_def => \@DELETE_OBJECT_METHODS,
);
######################################################################
our @DELETE_BUCKET_METHODS = (
######################################################################
delete_bucket => $EMPTY,
delete_bucket_analytics_configuration => 'analytics',
delete_bucket_cors => 'cors',
delete_bucket_encryption => 'encryption',
delete_bucket_intelligent_tiering => 'intelligent-tiering',
delete_bucket_inventory_configuration => 'inventory',
delete_bucket_lifecycle => 'lifecycle',
delete_bucket_metrics_configuration => 'metrics',
delete_bucket_ownership_controls => 'ownershipControls',
delete_bucket_policy => 'policy',
delete_bucket_replication => 'replication',
delete_bucket_tagging => 'tagging',
delete_bucket_website => 'website',
delete_public_access_block => 'publicAccessBlock',
);
create_methods(
type => 'bucket',
method => 'DELETE',
method_def => \@DELETE_BUCKET_METHODS
);
########################################################################
sub new {
########################################################################
my ( $class, @args ) = @_;
return $class->SUPER::new(@args);
}
########################################################################
sub to_camel_case {
########################################################################
my ($method) = @_;
return join $EMPTY, map { ucfirst $_ } split /_/xsm, $method;
}
########################################################################
# send_request()
########################################################################
# This is a general purpose method to send requests that may include an
# XML payload. These requests may also accept headers or query string
# parameters.
#
# args is a hash ref or list of key/value pairs
# api => name of the API to invoke (example: 'versioning')
# content_key => optional root element for XML serialzation
# headers => optional headers - create a Content-MD5 key in the headers
# object if you want to add the MD5 value
# bucket => optional bucket name
# key => optional key value for APIs that accept a key
# data => optional object that will be converted to an XML payload
# method => HTTP method
#
# NOTES:
# 1. If the 'data' object is included, the default method is 'PUT'
# 2. If no 'data' object is included, the default method is 'GET'
# 3. If 'content_key' is not provided when including a 'data' object
# the method will attempt to guess the root element (content_key)
# when serializing the data object to XML. If you include
# additional elements to be used as query string parameters,
# you should specify 'content_key'..
########################################################################
sub send_request {
########################################################################
my ( $self, @args ) = @_;
my $parameters = get_parameters(@args);
my $account = $self->account;
my $headers = delete $parameters->{headers};
$headers //= {};
my $bucket = delete $parameters->{bucket};
$bucket //= $self->bucket;
croak 'no bucket'
if !$bucket;
my $key = delete $parameters->{key} // $EMPTY;
my $api = delete $parameters->{api};
croak 'no api'
if !defined $api;
( run in 1.218 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )