org/licenses/>.
package App::MtAws::Glacier::Inventory::JSON;
our $VERSION = '1.120';
use strict;
use warnings;
use utf8;
use Carp;
use JSON::XS 1.00;
use App::MtAws::Glacier::Inventory ();
use b
elf = { rawdata => \$_[0] };
bless $self, $class;
$self;
}
sub _parse
{
my ($self) = @_;
$self->{data} = JSON::XS->new->allow_nonref->utf8->decode(${ delete $self->{rawdata} || confess });
}
1;
:Journal;
use App::MtAws::MetaData;
use App::MtAws::DateTime;
use App::MtAws::Glacier::Inventory::JSON;
use App::MtAws::Glacier::Inventory::CSV;
use App::MtAws::QueueJob::FetchAndDownloadInventory;
ttachmentref) = @_;
my $data = do {
if ($inventory_type eq INVENTORY_TYPE_JSON) {
App::MtAws::Glacier::Inventory::JSON->new($$attachmentref)
} elsif ($inventory_type eq INVENTORY_TYPE_CSV) {
validation(option('request-inventory-format', default => 'json'),
message('request-inventory-format must be "json" or "csv"'), sub { /^(json|csv)$/ });
validation positional('vault-name'), messa
etrieve_inventory
{
my ($self, $format) = @_;
$format or confess;
if ($format eq 'json') {
$format = 'JSON';
} elsif ($format eq 'csv') {
$format = 'CSV';
} else {
confess "unknown invent
ype;
if ($ct eq 'text/csv') {
INVENTORY_TYPE_CSV
} elsif ($ct eq 'application/json') {
INVENTORY_TYPE_JSON
} else {
confess "Unknown mime-type $ct";
}
};
return ($resp->content, $it
resp->content_type && $resp->content_type eq 'application/json') {
my $json = JSON::XS->new->allow_nonref;
my $scalar = eval { $json->decode( $resp->content ); }; # we assume content always
ment download, in megabytes
check-local-hash
retrieve-inventory
--request-inventory-format - json or csv
download-inventory
--new-journal - Write inventory as new journal
create-vault VAULT-
our $VERSION = '1.120';
use strict;
use warnings;
use utf8;
use Encode;
use MIME::Base64;
use JSON::XS;
use POSIX;
use Time::Local;
use App::MtAws::DateTime;
use constant MAX_SIZE => 1024;
use co
ed, characters '+', '/' replaced with '-', '_' resp. and no new lines.
json_utf8() - input - Hash, output - byte sequence
JSON string in UTF-8 representation. Can contain not-escaped UTF-8 character
': FILENAME, 'mtime': iso8601(MTIME)}
Hash with two keys: 'filename' and 'mtime'. Corresponds to JSON 'Object'.
Input data:
=====================
FILENAME (character string)
Is a relative filename
MtAws::LineProtocol;
our $VERSION = '1.120';
use strict;
use warnings;
use utf8;
use Carp;
use JSON::XS;
use App::MtAws::Utils;
use Exporter 'import';
our @EXPORT = qw/ get_data send_data/;
our @
n unit-test it (JSON and YAML have different serialization implementeation)
my $json_coder = JSON::XS->new->ascii(1)->allow_nonref;
sub decode_data
{
my ($data_e) = @_;
return $json_coder->decode($
data_e);
}
sub encode_data
{
my ($data) = @_;
return $json_coder->encode($data);
}
sub get_data
{
my ($fh) = @_;
my ($len, $line);
sysreadfull_chk($fh, $len, 8) &&
sysreadfull_chk($fh, $lin
mentref = \$r;
$console_out = "Downloaded inventory in ".($inventory_type eq INVENTORY_TYPE_JSON ? "JSON" : "CSV")." format";
} elsif ($action eq 'retrieve_archive') {
my $req = App::MtAws::Glaci
tAws::QueueJob';
sub init
{
my ($self) = @_;
$self->{format} or confess;
$self->{format} =~ /^json|csv$/ or confess;
$self->enter('retrieve');
}
sub on_retrieve
{
my ($self) = @_;
return state
Glacier::ListVaults;
our $VERSION = '1.120';
use strict;
use warnings;
use utf8;
use Carp;
use JSON::XS 1.00;
use App::MtAws::Utils;
use App::MtAws::MetaData;
sub new
{
my $class = shift;
my $
elf, $class;
$self;
}
sub _parse
{
my ($self) = @_;
return if $self->{data};
$self->{data} = JSON::XS->new->allow_nonref->decode(${ delete $self->{rawdata} || confess });
}
sub get_list_vaults
::Glacier::ListJobs;
our $VERSION = '1.120';
use strict;
use warnings;
use utf8;
use Carp;
use JSON::XS 1.00;
use App::MtAws::Utils;
use App::MtAws::MetaData;
sub new
{
my $class = shift;
my $
f->{data};
$self->{data} = JSON::XS->new->allow_nonref->decode(${ delete $self->{rawdata} || confess });
# get rid of JSON::XS boolean object, just in case.
# also JSON::XS between versions 1.0 an
use Exporter 'import';
use constant INVENTORY_TYPE_CSV => 'CSV';
use constant INVENTORY_TYPE_JSON => 'JSON';
our @EXPORT = qw/set_filename_encoding get_filename_encoding binaryfilename
sanity_relati
ze file_mtime file_exists file_inodev
is_64bit_os is_64bit_time is_y2038_supported
INVENTORY_TYPE_JSON INVENTORY_TYPE_CSV/;
BEGIN {
if ($File::Spec::VERSION lt '3.13') {
our $__orig_abs_to_rel =
->status_line."\n";
$out .= $resp->headers->as_string;
if ($resp->content_type eq 'application/json' && $resp->content && length($resp->content)) {
$out .= "\n".$resp->content;
}
$out .= "\n\n"
::Harness;
use strict;
use warnings;
use utf8;
use FindBin;
use Config;
# build requirements
use JSON::XS ();
use Test::Deep ();
use Test::Simple ();
use File::Temp ();
use Test::More ();
use Test::M