line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package cPanel::APIClient::Service; |
2
|
|
|
|
|
|
|
|
3
|
10
|
|
|
10
|
|
4489
|
use strict; |
|
10
|
|
|
|
|
23
|
|
|
10
|
|
|
|
|
278
|
|
4
|
10
|
|
|
10
|
|
94
|
use warnings; |
|
10
|
|
|
|
|
15
|
|
|
10
|
|
|
|
|
2471
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=encoding utf-8 |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
cPanel::APIClient::Service - base class for service objects |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
See L for example usage. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
This is a base class for objects that represent access to |
19
|
|
|
|
|
|
|
a specific service with a specific configuration. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub new { |
26
|
7
|
|
|
7
|
0
|
20
|
my ( $class, $transporter, $authn ) = @_; |
27
|
|
|
|
|
|
|
|
28
|
7
|
|
|
|
|
44
|
my %self = ( |
29
|
|
|
|
|
|
|
transporter => $transporter, |
30
|
|
|
|
|
|
|
authn => $authn, |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
7
|
|
|
|
|
45
|
return bless \%self, $class; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 METHODS |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 $name = I->service_name() |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Returns the name (e.g., C, C) of the service that I |
41
|
|
|
|
|
|
|
accesses. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub service_name { |
46
|
6
|
|
|
6
|
1
|
13
|
my ($self) = @_; |
47
|
|
|
|
|
|
|
|
48
|
6
|
|
|
|
|
12
|
my $name = ref($self); |
49
|
6
|
|
|
|
|
66
|
$name =~ s<.+::><>; |
50
|
|
|
|
|
|
|
|
51
|
6
|
|
|
|
|
24
|
return $name; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 I->cancel( @ARGUMENTS ) |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Cancels an API call. If the configured transport mechanism |
57
|
|
|
|
|
|
|
cannot cancel requests, an exception is thrown. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
See your transport mechanism’s documentation for details about |
60
|
|
|
|
|
|
|
what @ARGUMENTS should be and what this method returns. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub cancel { |
65
|
0
|
|
|
0
|
1
|
|
my ( $self, @cancel_args ) = @_; |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
my $transport_obj = $self->{'transporter'}; |
68
|
|
|
|
|
|
|
|
69
|
0
|
0
|
|
|
|
|
if ( !$self->can('cancel') ) { |
70
|
0
|
|
|
|
|
|
my $transport_class = ref $transport_obj; |
71
|
0
|
|
|
|
|
|
die "$transport_class cannot cancel() a request!"; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
return $transport_obj->cancel(@cancel_args); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 LICENSE |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Copyright 2020 cPanel, L. L. C. All rights reserved. L |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under the |
82
|
|
|
|
|
|
|
same terms as Perl itself. See L. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
1; |