| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WWW::GoDaddy::REST::Shell::GetCommand; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
33
|
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
38
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
|
|
7
|
use Sub::Exporter -setup => { |
|
7
|
|
|
|
|
|
|
exports => [qw(run_get smry_get help_get comp_get)], |
|
8
|
|
|
|
|
|
|
groups => { default => [qw(run_get smry_get help_get comp_get)] } |
|
9
|
1
|
|
|
1
|
|
3
|
}; |
|
|
1
|
|
|
|
|
1
|
|
|
10
|
1
|
|
|
1
|
|
317
|
use WWW::GoDaddy::REST::Shell::Util qw(get_resource_by_schema_or_uri); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
6
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub run_get { |
|
13
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
14
|
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
my $usage = "Usage:\n get [schema] [id]\n get /uri/id\n"; |
|
16
|
0
|
|
|
|
|
|
my $resource = eval { return get_resource_by_schema_or_uri( $self, @_ ); }; |
|
|
0
|
|
|
|
|
|
|
|
17
|
0
|
0
|
|
|
|
|
if ($@) { |
|
18
|
0
|
0
|
|
|
|
|
if ( UNIVERSAL::isa( $@, 'WWW::GoDaddy::REST::Resource' ) ) { |
|
19
|
0
|
|
|
|
|
|
$self->page( $@->to_string(1) . "\n" ); |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
else { |
|
22
|
0
|
|
|
|
|
|
warn($@); |
|
23
|
0
|
|
|
|
|
|
warn($usage); |
|
24
|
|
|
|
|
|
|
} |
|
25
|
0
|
|
|
|
|
|
return 0; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
eval { $self->page( $resource->to_string(1) . "\n" ); }; |
|
|
0
|
|
|
|
|
|
|
|
29
|
0
|
0
|
|
|
|
|
if ($@) { |
|
30
|
0
|
|
|
|
|
|
warn($@); |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
return 1; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub smry_get { |
|
37
|
0
|
|
|
0
|
0
|
|
return "load a specific resource" |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub help_get { |
|
41
|
|
|
|
|
|
|
return <<HELP |
|
42
|
|
|
|
|
|
|
Load a specific resource. This can be done either by schema and id, or |
|
43
|
|
|
|
|
|
|
by specifying a URL path. |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Usage: |
|
46
|
|
|
|
|
|
|
get [schema] [id] |
|
47
|
|
|
|
|
|
|
get [/uri/to/id] |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Example: |
|
50
|
|
|
|
|
|
|
get user 1 |
|
51
|
|
|
|
|
|
|
get /user/1 |
|
52
|
|
|
|
|
|
|
get /users?filter=... |
|
53
|
|
|
|
|
|
|
HELP |
|
54
|
0
|
|
|
0
|
0
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub comp_get { |
|
57
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
58
|
0
|
|
|
|
|
|
my $client = $self->client; |
|
59
|
0
|
|
|
|
|
|
return grep { $client->schema($_)->is_queryable } $self->schema_completion(@_); |
|
|
0
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 AUTHOR |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
David Bartle, C<< <davidb@mediatemple.net> >> |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Copyright (c) 2014 Go Daddy Operating Company, LLC |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a |
|
73
|
|
|
|
|
|
|
copy of this software and associated documentation files (the "Software"), |
|
74
|
|
|
|
|
|
|
to deal in the Software without restriction, including without limitation |
|
75
|
|
|
|
|
|
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
|
76
|
|
|
|
|
|
|
and/or sell copies of the Software, and to permit persons to whom the |
|
77
|
|
|
|
|
|
|
Software is furnished to do so, subject to the following conditions: |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in |
|
80
|
|
|
|
|
|
|
all copies or substantial portions of the Software. |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
83
|
|
|
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
84
|
|
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
85
|
|
|
|
|
|
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
86
|
|
|
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
87
|
|
|
|
|
|
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
|
88
|
|
|
|
|
|
|
DEALINGS IN THE SOFTWARE. |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |