s::Standard qw(InstanceOf Str Int Bool HashRef ArrayRef);
use MIME::Base64;
use Data::Dumper;
use JSON;
with 'Net::Etcd::Role::Actions';
use namespace::clean;
=head1 NAME
Net::Etcd::KV::Op
=cut
=head2 create
create op
=cut
#TODO this dirty hack should be a perl data object and then make json.
sub create {
my $self = shift;
my @op;
my $put = $self->request_put;
my $range
Put":' . $put->json_args . '}' if defined $put;
push @op, '{"requestRange":' . $range->json_args . '}' if defined $range;
push @op, '{"requestDeleteRange":' . $delete_range->json_args . '}' if
warnings;
use Moo;
use Types::Standard qw(Str Int Bool HashRef ArrayRef);
use MIME::Base64;
use JSON;
with 'Net::Etcd::Role::Actions';
use namespace::clean;
=head1 NAME
Net::Etcd::Range
=cut
o
is => 'ro',
isa => Bool,
coerce => sub { no strict 'refs'; return $_[0] ? JSON::true : JSON::false }
);
=head2 limit
limit is a limit on the number of keys returned for the reques
is => 'ro',
isa => Bool,
coerce => sub { no strict 'refs'; return $_[0] ? JSON::true : JSON::false }
);
=head2 keys_only
keys_only when set returns only the keys and not the values
use utf8;
package Net::Etcd::Auth;
use strict;
use warnings;
=encoding utf8
=cut
use JSON;
use Carp;
use Types::Standard qw(Str);
use Net::Etcd::Auth::Role;
use Moo;
with 'Net::Etcd::Role::Action
nless ($self->password && $self->name);
$self->request;
my $auth;
eval { $auth = from_json($self->{response}{content}) };
if ($@) {
$self->{response}{content} = 'error: ' . $@;
sub enable {
my ( $self, $options ) = @_;
$self->{endpoint} = '/auth/enable';
$self->{json_args} = '{}';
$self->request;
# init token
$self->etcd->auth()->authenticate;
re
use Moo;
use Types::Standard qw(Str Int Bool HashRef ArrayRef);
use Data::Dumper;
use Carp;
use JSON;
with 'Net::Etcd::Role::Actions';
use namespace::clean;
=head1 NAME
Net::Etcd::Lease
=cut
o
s => 'ro',
isa => Bool,
coerce => sub { no strict 'refs'; return $_[0] ? JSON::true : JSON::false }
);
=head1 PUBLIC METHODS
=head2 grant
LeaseGrant creates a lease which expires
ng leases.
$etcd->lease()->leases
=cut
sub leases {
my $self = shift;
$self->{endpoint} = '/kv/lease/leases';
$self->{json_args} = '{}';
$self->request;
return $self;
}
1;
s::Standard qw(InstanceOf Str Int Bool HashRef ArrayRef);
use MIME::Base64;
use Data::Dumper;
use JSON;
with 'Net::Etcd::Role::Actions';
use namespace::clean;
=head1 NAME
Net::Etcd::KV::Txn
=cut
failure;
$txn .= '"failure":[ ' . join(',', @$failure) . ']' if defined $failure;
$self->{json_args} = '{' . $txn . '}';
# print STDERR Dumper($self);
$self->request;
return $self;
{
my ( $self, $options ) = @_;
my $cb = pop if ref $_[-1] eq 'CODE';
$self->{endpoint} = '/cluster/member/list';
$self->{json_args} = '{}';
$self->request;
return $self;
}
1;
warnings;
use Moo;
use Types::Standard qw(Str Int Bool HashRef ArrayRef);
use MIME::Base64;
use JSON;
with 'Net::Etcd::Role::Actions';
use namespace::clean;
=head1 NAME
Net::Etcd::DeleteRange
=
is => 'ro',
isa => Bool,
coerce => sub { no strict 'refs'; return $_[0] ? JSON::true : JSON::false }
);
=head2 range_end
range_end is the upper bound on the requested range [key, r
warnings;
use Moo;
use Types::Standard qw(Str Int Bool HashRef ArrayRef);
use MIME::Base64;
use JSON;
with 'Net::Etcd::Role::Actions';
use namespace::clean;
=head1 NAME
Net::Etcd::Put
=cut
our
value pair will be returned in the put response.
=cut
has prev_kv => (
is => 'ro',
isa => Bool,
coerce => sub { no strict 'refs'; return $_[0] ? JSON::true : JSON::false }
);
1;
ngs;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = ();
our @EXPORT = ();
use JSON::MaybeXS;
use LWP::UserAgent;
use Object::Result;
use URI;
our $VERSION = '0.04';
sub new {
my $error;
if ($response->is_success()) {
local $@;
my $data = eval { decode_json($content) };
$error = $@;
if ($data) {
$error = $data->{error};
ntent());
if ($response->code() != 204) {
local $@;
my $data = eval { decode_json($content) };
my $error = $@;
$error = $data->{error} if (!$error && $data);
:Dispatcher->dispatch($c) || die "response is not generated";
}
__PACKAGE__->load_plugins( 'Web::JSON' );
# for your security
__PACKAGE__->add_trigger(
AFTER_DISPATCH => sub {
my ( $c, $
my $message = join("\n", map { $_->{message} } @$errors);
my $res = $c->render_json( +{ error => +{ message => $message } } );
$res->code(400);
return $res;
$controller->{code}->($c, $args);
if (ref $res eq 'HASH') {
return $c->render_json($res); # succeeded
} else {
return $res; # succeeded
}
} else {
ackage Net::Etcd;
# ABSTRACT: Provide access to the etcd v3 API.
use strict;
use warnings;
use JSON;
use MIME::Base64;
use Types::Standard qw(Str Int Bool HashRef);
use Net::Etcd::Auth;
use Net::E
wFunctions' ],
%$view_conf
});
};
}
__PACKAGE__->load_plugins(
'Web::JSON',
'Web::PlackSession',
'Web::CSRFDefender',
);
# for your security
__PACKAGE__->add_trig
$options ) = @_;
my $cb = pop if ref $_[-1] eq 'CODE';
my $cmp = Net::Etcd::KV::Compare->new(
%$self,
( $options ? %$options : () ),
);
return $cmp->json_args;
}
1;
y $cb = pop if ref $_[-1] eq 'CODE';
$self->{endpoint} = '/maintenance/snapshot';
$self->{json_args} = '{}';
$self->request;
return $self;
}
=head2 status
Status gets the status of t
my $cb = pop if ref $_[-1] eq 'CODE';
$self->{endpoint} = '/maintenance/status';
$self->{json_args} = '{}';
$self->request;
return $self;
}
=head2 defragment
Defragment defragments
$cb = pop if ref $_[-1] eq 'CODE';
$self->{endpoint} = '/maintenance/defragment';
$self->{json_args} = '{}';
$self->request;
return $self;
}
=head2 version
Returns the member version
o;
use Types::Standard qw(Str Int Bool HashRef ArrayRef);
use MIME::Base64;
use Data::Dumper;
use JSON;
with 'Net::Etcd::Role::Actions';
use namespace::clean;
=head1 NAME
Net::Etcd::Watch
=cut
o
is => 'ro',
isa => Bool,
coerce => sub { no strict 'refs'; return $_[0] ? JSON::true : JSON::false }
);
=head2 filters
filter out put event. filter out delete event. filters filter
is => 'ro',
isa => Bool,
coerce => sub { no strict 'refs'; return $_[0] ? JSON::true : JSON::false }
);
=head2 watch_id
watch_id is the watcher id to cancel so that no more events
interfaces to xkcd comics
$WWW::xkcd::VERSION = '0.009';
use strict;
use warnings;
use Carp;
use JSON::MaybeXS;
use HTTP::Tiny;
my $can_async = eval { require AnyEvent; require AnyEvent::HTTP; 1 };
shift;
my %args = (
'baseurl' => 'https://xkcd.com',
'infopath' => 'info.0.json',
@_,
);
return bless { %args }, $class;
}
sub fetch_metadata {
my $self
::HTTP::http_get( $url, sub {
my $body = shift;
my $meta = $self->_decode_json($body);
return $cb->($meta);
} );
return 0;
}
# this is sy
gs;
use Data::Dumper;
use LWP::UserAgent;
use HTTP::Request::Common qw{ POST };
use CGI;
use JSON;
# Create Module for Action Request POST :
# ------------------------------------------------
package NKTI::general::dbconnect;
use strict;
use warnings;
use JSON::XS;
use DBI;
# Create Module for Connection MySQL Database :
# ---------------------------------------------------------
# ----------------------------------------------------------------
my $db_config = decode_json($get_db_config);
my $db_user = $db_config->{'db_user'};
my $db_pass = $db_config->{'db_
# ----------------------------------------------------------------
my $db_config = decode_json($get_db_config);
my $db_user = $db_config->{'db_user'};
my $db_pass = $db_config->{'db_
package NKTI::general::check;
use strict;
use warnings;
use JSON;
use NKTI::general::request::post;
use NKTI::general::dbconnect;
use NKTI::general::char::split;
# Items to export into call
----------------------------------------
_db_config => Parameter yang berisi String JSON Konfigurasi Database.
_query_get => Parameter yang berisi query untuk mengambil data A
----------------------------------------------------------------
my $unpack_dbconf = decode_json($db_config);
my $prefix_db = $unpack_dbconf->{'prefix_table'};
# Action for Check Aut