********************************
no Moose;
1;
__END__
=head1 NAME
Zenoss::Router::Process - A JSON/ExtDirect interface to operations on processes
=head1 SYNOPSIS
use Zenoss;
my $api = Ze
defaults and return content.
The documentation for this module was mostly taken from the Zenoss JSON API docs. Keep in mind
that their (Zenoss Monitoring System) programming is based around python,
********************************
no Moose;
1;
__END__
=head1 NAME
Zenoss::Router::ZenPack - A JSON/ExtDirect interface to operations on ZenPacks
=head1 SYNOPSIS
use Zenoss;
my $api = Zen
defaults and return content.
The documentation for this module was mostly taken from the Zenoss JSON API docs. Keep in mind
that their (Zenoss Monitoring System) programming is based around python,
use strict;
use warnings;
use JSON;
use Text::TNetstrings qw(:all);
use Benchmark qw(cmpthese);
my $structure = {
'resources' => {
'license' => [
'http://opensource.org/licenses/mit-license.php'
y $tn = encode_tnetstrings($structure);
my $json = encode_json($structure);
print "TNetstrings (" . length($tn) . ")
$tn
JSON (" . length($json) . ")
$json
";
cmpthese(-10, {
'TNetstrings' => sub{d
ecode_tnetstrings(encode_tnetstrings($structure))},
'JSON' => sub{decode_json(encode_json($structure))},
});
defaults and return content.
The documentation for this module was mostly taken from the Zenoss JSON API docs. Keep in mind
that their (Zenoss Monitoring System) programming is based around python,
) copyright notices in .pl and .pm distribution files; (b) for author entry
in META.yml or META.json, which ever peresent; and (c) for existence of LICENSE file, with the
correct license text autog
=pod
=head1 NAME
Examples covering the Zenoss JSON API
=head1 OVERVIEW
This page serves as collection of some quick examples designed to get one started. I will
try to add more occasionally.
=h
eviceName => 'newdevice',
deviceClass => '/Server/Linux',
model => JSON::true,
}
);
# Print the JobID that this device will be processed under
m
e of templates
is to express data in display text.
Decl templates are based pretty closely on JSON::Templates (a system used in Python and Javascript that I rather like).
This class, instead of
$value = scalar @$value;
}
# If the value is a hashref, run it through our JSONifier for output as a debugging value.
# If it's an object, do .... hell, I dunno. If it c
package Zenoss::Response;
use strict;
use JSON qw{};
use Moose;
with 'Zenoss::Error';
#**************************************************************************
# Public Attributes
#***************
,
is => 'ro',
handles => {
# Proxy methods to HTTP::Response
json => 'decoded_content',
raw_response => 'as_string',
time => 'current_age',
},
required => 1,
);
# Perl reference format of the JSON return data
has decoded => (
is => 'ro',
isa => 'Ref',
builder =
t Dumper( \$dump->run );
=head1 DESCRIPTION
It's a simple way to dump data from redis-server in JSON format or any format
you want.
=head1 COMMAND LINE API
This class uses L<MooseX::Getopt> to pro
package Zenoss::Router;
use strict;
use File::Find;
use File::Basename;
use JSON qw{};
use LWP::UserAgent;
use HTTP::Request::Common qw{POST};
use Moose;
use Moose::Util qw {apply_all_roles};
use Zen
***************************************************************
our $JSON_CONTENT_TYPE; *JSON_CONTENT_TYPE = \q{application/json; charset=utf-8};
#************************************************
ease the transaction counter
$self->_increase_transaction_count;
# Build JSON request in HASHREF
my $JSON_DATA = {
action => $args->{'action'},
method => $args->{'method
*********************************
no Moose;
1;
__END__
=head1 NAME
Zenoss::Router::Report - A JSON/ExtDirect interface to operations on reports
=head1 SYNOPSIS
use Zenoss;
my $api = Zeno
defaults and return content.
The documentation for this module was mostly taken from the Zenoss JSON API docs. Keep in mind
that their (Zenoss Monitoring System) programming is based around python,
********************************
no Moose;
1;
__END__
=head1 NAME
Zenoss::Router::Network - A JSON/ExtDirect interface to operations on networks
=head1 SYNOPSIS
use Zenoss;
my $api = Zen
defaults and return content.
The documentation for this module was mostly taken from the Zenoss JSON API docs. Keep in mind
that their (Zenoss Monitoring System) programming is based around python,
equire JSON::PP;
my $encoded = JSON::PP::encode_json($structure);
$benchmarks{'JSON::PP'} = sub{JSON::PP::decode_json($encoded)};
} or warn "Unable to require JSON::PP";
eval {
require JSON::XS;
my $encoded = JSON::XS::encode_json($structure);
$benchmarks{'JSON::XS'} = sub{JSON::XS::decode_json($encoded)};
} or warn "Unable to require JSON::XS";
eval {
require Convert::Bencode;
my $encode
*********************************
no Moose;
1;
__END__
=head1 NAME
Zenoss::Router::Search - A JSON/ExtDirect interface to operations on searches
=head1 SYNOPSIS
use Zenoss;
my $api = Zen
f this module is considered experimental! Zenoss
hasn't documented these calls in the Public API JSON Docs, thus I've pieced together what I could
from reading their code. Also, it would appear that
defaults and return content.
The documentation for this module was mostly taken from the Zenoss JSON API docs. Keep in mind
that their (Zenoss Monitoring System) programming is based around python,
>meta->make_immutable;
no Moose;
1;
__END__
=head1 NAME
Zenoss - Perl interface to the Zenoss JSON API
=head1 SYNOPSIS
use Zenoss;
use Data::Dumper;
# Create a Zenoss object
my
ponse is now an instance of Zenoss::Response
# now we can do things like
print $response->json();
print $response->http_code();
# get the response in a perl reference
my $ref = $r
severity of 0,1,2,3,4 or 5
my $events = $api->events_query(
{
history => JSON::true,
params => {
severity => [0,1,2,3,4,5],
}
::Meta::Dynamic::Config is a L<Dist::Zilla> plugin that allows an author to
specify in the C<META.json> and/or C<META.yml> files produced by L<Dist::Zilla> that their
distribution performs some dynami
vity => '/activities/ID'
);
# transform our api dispatch above into an HTTPS request
# returns JSON decoded result or throws exception otherwise
sub _request {
my ($self, $api, $id, $args) = @_;
uccess and return $tx->res->json;
# we never get here, unless something went wrong
my $message = $tx->error;
$tx->res->json and do {
my $json_err = $tx->res->json->{error}->{message};
$
message = join ' ', $message => $json_err;
};
die "Error: $message";
}
sub new {
my $self = bless {}, shift;
croak "API key required" unless $_[0] and $_[0] eq 'key';
$self->key($_[1]);
'.';
$dist_info = {};
if( -r ( $meta_file = File::Spec->catfile( $dist_root, 'META.json' ) ) or
-r ( $meta_file = File::Spec->catfile( $dist_root, 'META.yml' ) ) )
{
ta } = CPAN::Meta->load_file( $meta_file );
}
else
{
$log->warningf( "No META.json or META.yml file found, " .
"is '%s' a distribution directory?", $dist_root )
uild
./Build test
./Build install
=end readme
=head1 BOOTSTRAPPING WITH META.json/META.yml
Since the META.json/yml file is often generated with an abstract extracted
from the POD, and L<App::po
package WWW::Yahoo::Smushit;
use strict;
use warnings;
use Moose;
use LWP::UserAgent;
use JSON;
our $VERSION = '0.03';
has _ua => (
is => 'rw',
lazy => 1,
required => 1,
d
my $json = JSON->new->allow_nonref;
my $resp = $json->decode($req->content);
return 1
if($self->_create_attrs_from_json($resp));
return 0;
}
sub _create_attrs_from_json {
m
y ($self, $json) = @_;
for (keys %{$json}) {
$self->meta->add_attribute($_, is => 'rw');
$self->$_($json->{$_});
}
$self->meta->make_immutable;
return 0
if not
Net::Ostrich::VERSION = '0.01';
}
use Moose;
# ABSTRACT: Perl interface to Ostrich
use JSON::XS qw(decode_json);
use LWP::UserAgent;
has 'client' => (
is => 'rw',
isa => 'LWP::UserAgent',
self->port . $self->path . 'gc.json');
unless($resp->is_success) {
die("Failed to connect to ostrich: ".$resp->status_line);
}
return decode_json($resp->decoded_content);
}
lf->port . $self->path . 'ping.json');
unless($resp->is_success) {
die("Failed to connect to ostrich: ".$resp->status_line);
}
return decode_json($resp->decoded_content);
}