of 'rolling your own' API
use strict;
use warnings;
use parent qw(APIExample Amazon::API);
use JSON::PP;
use Data::Dumper;
use English qw(-no_match_vars);
our $DESCRIPTIONS = {
PutParameter =>
=> 'AmazonSSM',
api_methods => \@API_METHODS,
content_type => 'application/x-amz-json-1.1',
debug => $ENV{DEBUG},
%options
}
);
return $self;
}
##########
ame,
Value => $value,
Type => 'SecureString',
Overwrite => JSON::PP::true
}
)
);
}
else {
print {*STDOUT} "usage: $PROGRAM_NAME run Put
use DBI qw(:sql_types);
use Digest::MD5 qw(md5_hex);
use Encode;
use Exporter qw( import );
use JSON::PP;
use Log::Any qw( $log );
use POSIX qw( strftime );
use Readonly;
use Try::Tiny;
use Zonemas
ted_at} = $self->to_iso8601( $result->{created_at} );
return $result;
}
# "$new_results" is JSON encoded
sub store_results {
my ( $self, $test_id, $new_results ) = @_;
my $rows_affected
$result->{params} = decode_json( $result->{params} );
@result_entries = map {
{
%$_,
args => decode_json( $_->{args} ),
}
se 5.14.2;
use Exporter qw( import );
use File::Spec::Functions qw( file_name_is_absolute );
use JSON::Validator::Joi;
use Readonly;
use Locale::TextDomain qw[Zonemaster-Backend];
use Net::IP::XS;
us
sql|sqlite)$/i;
Readonly my $IPADDR_RE => qr/^$|$IPV4_RE|$IPV6_RE/;
Readonly my $JSONRPC_METHOD_RE => qr/^[a-z0-9_-]*$/i;
Readonly my $LANGUAGE_RE => qr/^[a-z]
Readonly my $BOOL_RE => qr/^$BOOL_TRUE_RE|$BOOL_FALSE_RE$/i;
sub joi {
return JSON::Validator::Joi->new;
}
sub new {
my ( $type ) = @_;
my $self = {};
bless( $self, $
strict;
use warnings;
package Zonemaster::Backend::Log;
use English qw( $PID );
use POSIX;
use JSON::PP;
use IO::Handle;
use Log::Any::Adapter::Util ();
use Carp;
use Data::Dumper;
use base qw(Log
flush(1);
if ( !exists $self->{formatter} ) {
if ( $self->{json} ) {
$self->{formatter} = \&format_json;
} else {
$self->{formatter} = \&format_text;
sg .= " Extra parameters: $data";
}
return $msg
}
sub format_json {
my ($self, $log_params) = @_;
my $js = JSON::PP->new;
$js->canonical( 1 );
return $js->encode( $log_para
(append_file);
use HTML::Entities;
use JSON::PP;
use JSON::Validator::Joi;
use Log::Any qw($log);
use Mojo::JSON::Pointer;
use Scalar::Util qw(blessed);
use JSON::Validator::Schema::Draft7;
use Locale
_validator = Zonemaster::Backend::Validator->new;
our %json_schemas;
my $recursor = Zonemaster::Engine::Recursor->new;
sub joi {
return JSON::Validator::Joi->new;
}
sub new {
my ( $type, $pa
{
$log->info($exception->as_string, $log_extra);
}
die $exception->as_hash;
}
$json_schemas{version_info} = joi->object->strict;
sub version_info {
my ( $self ) = @_;
my %v
estAgent;
our $VERSION = '1.1.0';
use strict;
use warnings;
use 5.14.2;
use DBI qw(:utils);
use JSON::PP;
use Scalar::Util qw( blessed );
use File::Slurp;
use Locale::TextDomain qw[Zonemaster-Backen
use strict;
use warnings;
use JSON::PP;
use DBI qw(:utils);
use Zonemaster::Backend::Config;
use Zonemaster::Backend::DB::SQLite;
my $config = Zonemaster::Backend::Config->load_config();
if ( $conf
y $row = $sth1->fetchrow_hashref ) {
my $id = $row->{id};
my $raw_params = decode_json($row->{params});
my $ds_info_values = scalar grep !/^$/, map { values %$_ } @{$raw_params
use strict;
use warnings;
use JSON::PP;
use DBI qw(:utils);
use Zonemaster::Backend::Config;
use Zonemaster::Backend::DB::MySQL;
my $config = Zonemaster::Backend::Config->load_config();
if ( $confi
y $row = $sth1->fetchrow_hashref ) {
my $id = $row->{id};
my $raw_params = decode_json($row->{params});
my $ds_info_values = scalar grep !/^$/, map { values %$_ } @{$raw_params
use strict;
use warnings;
use JSON::PP;
use Encode;
use DBI qw(:utils);
use Zonemaster::Backend::Config;
use Zonemaster::Backend::DB::PostgreSQL;
my $config = Zonemaster::Backend::Config->load_conf
$row->{params}) ) {
$raw_params = decode_json( encode_utf8 ( $row->{params} ) );
} else {
$raw_params = decode_json( $row->{params} );
}
my $ds_info_va
rror;
use strict;
use warnings;
use Data::Dumper;
use English qw( -no_match_vars );
use JSON qw( decode_json );
use Scalar::Util qw( reftype );
use XML::Simple qw( XMLin );
__PACKAGE__->follow_best
=~ /json/xmsi ) {
$message = eval { return decode_json($raw_message); };
}
# try a little harder...
if ( !$message || $EVAL_ERROR ) {
$message = eval { return decode_json($ra
_END__
=pod
=head1 NAME
C<Amazon::API::Error>
=head1 SYNOPSIS
my $result = eval {
decode_json(
$cwe->PutPermission(
{ Action => "PutEvents",
Principal => "12345465
ColloDB::PackedFile;
use DiaColloDB::PackedFile::MMap;
use DiaColloDB::Utils qw(:fcntl :env :run :json :pack);
use Fcntl qw(:DEFAULT :seek);
use strict;
##============================================
##========================================================================
## I/O: JSON
*TO_JSON = \&TO_JSON__table;
##=======================================================================
k-best trimming,
stringification,
basic algebraic manipulation,
and serialization (text, HTML, or JSON).
=cut
##----------------------------------------------------------------
## DESCRIPTION: DiaCo
I/O: JSON
=pod
=head2 I/O: JSON
=over 4
=item TO_JSON__table
$thingy = $obj->TO_JSON__table()
test alternative JSON format (small but slow).
=item TO_JSON__flat
$thingy = $obj->TO_JSON__flat
ColloDB::PackedFile;
use DiaColloDB::PackedFile::MMap;
use DiaColloDB::Utils qw(:fcntl :env :run :json :pack :temp :sort :jobs);
use Fcntl qw(:DEFAULT :seek);
use File::Basename qw(dirname);
use versi
s upgrade, for use with default rollback() implementation
sub revert_updated {
return qw(header.json);
}
##==============================================================================
## Footer
is from their L<upgrade|/upgrade>() method.
Default implementation just backs up C<"$dbdir/header.json">, emitting a warning
if C<$up-E<gt>{backup}> is false.
=item backupdir
$dir = $up->backupdir(
eader information C<$dbdir/header.json> for the
local L<DiaColloDB|DiaColloDB> index in C<$dbdir>.
Wraps L<DiaColloDB::Utils::loadJsonFile()|DiaColloDB::Utils/loadJsonFile>.
Default implementation use
_uinfo, \%extra_header_data);
Updates L<DiaColloDB|DiaColloDB> header C<"$up-E<gt>{dbdir}/header.json">
by prepending the upgrade-info structure returned by
C<$up-E<gt>L<uinfo|/uinfo>($coldb,%extra_u
="${_}_2x";
map {"$base.$_"} qw(hdr ma mb)
} @{$hdr->{attrs}};
return (@mmfiles, 'header.json');
}
##==============================================================================
## Footer
ent}}
=item ddcQuery
$results = $rel->ddcQuery($coldb, $query_or_str, %opts);
Returns decoded JSON results for DDC client query $query_or_str,
optionally logging the query and tracking errors.
%o
es should call this from $up->upgrade()
## + default implementation just backs up "$dbdir/header.json", emitting a warning
## if $up->{backup} is false
sub backup {
my $up = shift;
##-- were
using backup directory $backd/");
$up->info("backing up $dbdir/header.json");
DiaColloDB::Utils::copyto_a("$dbdir/header.json", $backd)
or $up->logconfess("updateHeader(): failed to backup h
==========
## Utilities
## \%hdr = $CLASS_OR_OBJECT->dbheader($dbdir?)
## + reads $dbdir/header.json
## + default uses cached $CLASS_OR_OBJECT->{hdr} if available
sub dbheader {
my ($up,$dbdir) =
ba2.hdr hdr)),
##-- cofreqs
(map {"cof.$_"} qw(dba3 dba3.hdr)),
##-- header
'header.json',
);
}
## @files = $up->revert_updated()
## + returns list of files updated by this upgrade,
##-- cofreqs
(map {"cof.$_"} qw(dba1 dba1.hdr dba2 dba2.hdr hdr)),
##-- header
'header.json',
);
}
##==============================================================================
## Fo
elation;
use DiaColloDB::Relation::TDF::Query;
use DiaColloDB::Utils qw(:pack :fcntl :file :math :json :list :pdl :temp :env :run :jobs :sort);
use DiaColloDB::PackedFile;
#use DiaColloDB::Temp::Hash;
>vlog($logCreate, "$logas: processing input documents [NA=$NA, NC=$nfiles]");
my $json = DiaColloDB::Utils->jsonxs();
my $minDocSize = $vs->{minDocSize} = max2(($vs->{minDocSize}//0),1);
my $m