een set to C<text/html> with
L</expect_mime_type>. The C<html> option is incompatible with the
L</json> and L</png> options.
=item HTTP_COOKIE
$options{HTTP_COOKIE} = 'nice=day';
$test->ru
riable. See also L</content_length>.
=item json
$options{json} = 1;
$test->run (\%options);
Validate the body of the output as JSON using L<JSON::Parse>. The
validation is run after decom
a warning
message if the mime type has not been set to C<application/json> or
C<text/plain> with L</expect_mime_type>. The C<json> option is
incompatible with the L</html> and L</png> options.
=item
elsif ($options->{json} && ! $self->{no_warn}) {
my $mime_type = $self->{mime_type};
if ($mime_type) {
if ($mime_type ne 'text/plain' && $mime_type ne 'application/json') {
carp "Your exp
e_type is not valid for JSON";
}
}
else {
carp "There is no expected mime type, use expect_mime_type ('application/json') or expect_mime_type ('text/plain') for JSON output";
}
}
ml} || $options->{json}) {
carp "Contradictory options png and json/html";
}
}
elsif ($options->{html}) {
if ($options->{json}) {
carp "Contradictory options json and html";
}
se strict;
use Moose::Role;
use namespace::autoclean;
use JSV::Validator;
use Path::Class ();
use JSON::MaybeXS ();
our $VERSION = '0.03';
our $JSV;
our %SCHEMA = ();
after BUILD => sub {
$JSV
$json_file = $self->attributes->{JSONSchema}->[0];
if (exists $SCHEMA{ $json_file } ) {
$request_schema = $SCHEMA{ $json_file };
$c->log->debug("load memory json schema: ".$json_
my $load_schema_json = Path::Class::file($c->config->{home}, $json_file);
$request_schema = JSON::MaybeXS::decode_json($load_schema_json->slurp);
$SCHEMA{ $json_file } = $request_s
equest(GET => $self->url . $namespace_path));
if ($res->is_success) {
my $ns = $self->json->decode($res->content);
# Somewhere between Kubernetes 1.2 and 1.5, the self link for na
$self->json->encode({
metadata => {
name => $namespace
}
}),
));
if ($res->is_success) {
my $ns = $self->json->decode($res->c
t($self->create_request(GET => $uri));
if ($res->is_success) {
my $node_list = $self->json->decode($res->content);
my (@nodes) = ();
foreach my $node (@{$node_list->{items}
package WebService::Mackerel;
use 5.008001;
use strict;
use warnings;
use Carp qw/croak/;
use JSON;
use HTTP::Tiny;
use URI;
our $VERSION = "0.05";
sub new {
my ($class, %args) = @_;
$args{a
'GET', $uri->as_string, {
headers => {
'content-type' => 'application/json',
'X-Api-Key' => $self->{api_key},
},
});
return $res-
ckerel_origin} . $path, {
content => encode_json $args,
headers => {
'content-type' => 'application/json',
'X-Api-Key' => $self->{api_key},
st($self->create_request(GET => $uri));
if ($res->is_success) {
my $pod_list = $self->json->decode($res->content);
my (@pods) = ();
foreach my $pod (@{$pod_list->{items}})
st($self->create_request(GET => $uri));
if ($res->is_success) {
my $set_list = $self->json->decode($res->content);
my @sets;
foreach my $rs (@{$set_list->{items}}) {
st($self->create_request(GET => $uri));
if ($res->is_success) {
my $pod_list = $self->json->decode($res->content);
my (@pods) = ();
foreach my $pod (@{$pod_list->{items}})
itic (Capitalization)
sub REST_CLIENT { return shift->JIRA_REST->{rest} }
sub JSON { return shift->JIRA_REST->{json} }
## use critic
sub make_object { return shift->factory->make_object( @_ ) }
d $thing ) {
if ( $class eq 'JSON::PP::Boolean' ) {
return $thing ? 'JSON::PP::true' : 'JSON::PP::false';
}
if ( $class eq 'JSON' ) {
return "$thing";
ent> object inside the L<JIRA::REST|JIRA::REST> object being used.
=head2 B<JSON>
An accessor that returns the L<JSON|JSON> object inside the L<JIRA::REST|JIRA::REST> object being used.
=head2 B<ma
elf->create_request(GET => $self->path));
if ($res->is_success) {
my ($data) = $self->json->decode($res->content);
$self->status($data->{status});
return 1;
}
retur
# Handle serializing data
if (uc($data->{$key}{type}) eq 'JSON') {
$value = $self->json->encode($data->{$key}{value});
}
elsif (uc($data->{$
s "type" and "value".
Valid types are "JSON", "YAML" or "String" (anything other that "JSON" or
"YAML") will be assumed to be of type "String". If either "JSON" or "YAML" the
"value" will be serializ
ssh-public-key => '/home/dave/.ssh/id_rsa.pub',
super-secret-data => {
type => 'JSON',
value => { username => 'Dave', password => 'Imnottelling' },
}
});
=head1 AUTHOR
e enough
use Modern::Perl;
use Moose;
use namespace::autoclean;
use Class::Load;
use Clone;
use JSON::XS;
our $VERSION = '0.18';
=head2 data
You can pass hashref or arrayref as data
When it is a
02d-%02d %02d:%02d:%02d', $yyyy, $mm, $dd, $hh, $mi, $ss;
if ( ref $text ) {
$text = JSON::XS->new->allow_unknown->allow_blessed->encode( $text );
}
return sprintf "%s\t%s\t%s\t%
eturn $self->create_resource_object($self->json->decode($res->content));
}
else {
my $message;
try {
my $obj = $self->json->decode($res->content);
$mess
th 'Net::Kubernetes::Role::ResourceFactory';
requires 'ua';
requires 'create_request';
requires 'json';
requires 'namespace';
sub create_from_file {
my ($self, $file) = @_;
if (!-f $file) {
a?ml$/i) {
$object = YAML::XS::LoadFile($file);
}
else {
$object = $self->json->decode(scalar(read_file($file)));
}
return $self->create($object);
}
sub create {
lue as 1 or 0 which json does not switch back to
# true or false. This is not JSON's fault, but I'm not
# sure just now how I want to solve it.
my $content = $self->json->encode($object);
the REST api
use Moose::Role;
require LWP::UserAgent;
require HTTP::Request;
use JSON::MaybeXS;
require Cpanel::JSON::XS;
require URI;
use MIME::Base64;
use syntax "try";
has url => (
is
tr',
required => 0
);
has 'json' => (
is => 'ro',
isa => JSON::MaybeXS::JSON,
required => 1,
lazy => 1,
builder => '_build_json',
);
has 'ssl_cert_file' => (
unless ($res->is_success) {
my $message;
try {
my $obj = $self->json->decode($res->content);
$message = $obj->{message};
}
catch($e) {
th 'Net::Kubernetes::Role::ResourceCatalog';
requires 'ua';
requires 'create_request';
requires 'json';
sub list_pods {
my $self = shift;
return $self->_retrieve_list('Pod', @_);
}
sub li
elf->create_request(GET => $uri));
if ($res->is_success) {
my $resource_list = $self->json->decode($res->content);
my @resources;
foreach my $resource (@{$resource_list->{
ect::ExtendedAttributeItems;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
Object::HttpResponseMessage;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
loud::Object::OrdinalNumber;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
asksCloud::Object::TaskType;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da