~percona-toolkit-dev/percona-toolkit/pt-mysql-summary-Blank-InnoDB-Section-for-5.6-1254233

« back to all changes in this revision

Viewing changes to lib/Percona/WebAPI/Resource/Agent.pm

  • Committer: Daniel Nichter
  • Date: 2013-06-19 21:23:55 UTC
  • mfrom: (582.1.5 release-2.2.3)
  • Revision ID: daniel@percona.com-20130619212355-nf6bmx23j3b76afe
Tags: 2.2.3
Merge release-2.2.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# This program is copyright 2012-2013 Percona Inc.
 
2
# Feedback and improvements are welcome.
 
3
#
 
4
# THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
 
5
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 
6
# MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
7
#
 
8
# This program is free software; you can redistribute it and/or modify it under
 
9
# the terms of the GNU General Public License as published by the Free Software
 
10
# Foundation, version 2; OR the Perl Artistic License.  On UNIX and similar
 
11
# systems, you can issue `man perlgpl' or `man perlartistic' to read these
 
12
# licenses.
 
13
#
 
14
# You should have received a copy of the GNU General Public License along with
 
15
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 
16
# Place, Suite 330, Boston, MA  02111-1307  USA.
 
17
# ###########################################################################
 
18
# Percona::WebAPI::Resource::Agent package
 
19
# ###########################################################################
 
20
{
 
21
package Percona::WebAPI::Resource::Agent;
 
22
 
 
23
use Lmo;
 
24
 
 
25
has 'uuid' => (
 
26
   is       => 'ro',
 
27
   isa      => 'Str',
 
28
   required => 0,
 
29
);
 
30
 
 
31
has 'username' => (
 
32
   is       => 'rw',
 
33
   isa      => 'Str',
 
34
   required => 0,
 
35
   default  => sub { return $ENV{USER} || $ENV{LOGNAME} },
 
36
);
 
37
 
 
38
has 'hostname' => (
 
39
   is       => 'rw',
 
40
   isa      => 'Str',
 
41
   required => 0,
 
42
   default  => sub {
 
43
      chomp(my $hostname = `hostname`);
 
44
      return $hostname;
 
45
   },
 
46
);
 
47
 
 
48
has 'alias' => (
 
49
   is       => 'rw',
 
50
   isa      => 'Str',
 
51
   required => 0,
 
52
);
 
53
 
 
54
has 'versions' => (
 
55
   is       => 'rw',
 
56
   isa      => 'Maybe[HashRef]',
 
57
   required => 0,
 
58
);
 
59
 
 
60
has 'links' => (
 
61
   is       => 'rw',
 
62
   isa      => 'Maybe[HashRef]',
 
63
   required => 0,
 
64
   default  => sub { return {} },
 
65
);
 
66
 
 
67
sub name {
 
68
   my ($self) = @_;
 
69
   return $self->alias || $self->hostname || $self->uuid || 'Unknown';
 
70
}
 
71
 
 
72
no Lmo;
 
73
1;
 
74
}
 
75
# ###########################################################################
 
76
# End Percona::WebAPI::Resource::Agent package
 
77
# ###########################################################################