mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 05:29:30 +00:00
Fix Client to expect X-Percona-Resource-Type else links. Add headers to Mock/UserAgent. Start testing run_agent(). As TO_JSON() magic to Run so encode can encode Service contain blessed Run objs. Use BUILDARGS to convert Run as hashref to real objs.
This commit is contained in:
@@ -46,6 +46,8 @@ has 'output' => (
|
||||
required => 1,
|
||||
);
|
||||
|
||||
sub TO_JSON { return { %{ shift() } }; }
|
||||
|
||||
no Lmo;
|
||||
1;
|
||||
}
|
||||
|
@@ -34,12 +34,25 @@ has 'schedule' => (
|
||||
required => 1,
|
||||
);
|
||||
|
||||
has 'run' => (
|
||||
has 'runs' => (
|
||||
is => 'ro',
|
||||
isa => 'ArrayRef[Percona::WebAPI::Resource::Run]',
|
||||
required => 1,
|
||||
);
|
||||
|
||||
sub BUILDARGS {
|
||||
my ($class, %args) = @_;
|
||||
if ( ref $args{runs} eq 'ARRAY' ) {
|
||||
my @runs;
|
||||
foreach my $run_hashref ( @{$args{runs}} ) {
|
||||
my $run = Percona::WebAPI::Resource::Run->new(%$run_hashref);
|
||||
push @runs, $run;
|
||||
}
|
||||
$args{runs} = \@runs;
|
||||
}
|
||||
return $class->SUPER::BUILDARGS(%args);
|
||||
}
|
||||
|
||||
no Lmo;
|
||||
1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user