| 1 | ## Domain Registry Interface, OVH Web Services Message | ||||||||||||||||||||||||||||
| 2 | ## | ||||||||||||||||||||||||||||
| 3 | ## Copyright (c) 2008-2010,2013 Patrick Mevzek <netdri@dotandco.com>. All rights reserved. | ||||||||||||||||||||||||||||
| 4 | ## | ||||||||||||||||||||||||||||
| 5 | ## This file is part of Net::DRI | ||||||||||||||||||||||||||||
| 6 | ## | ||||||||||||||||||||||||||||
| 7 | ## Net::DRI is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 8 | ## it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 9 | ## the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||
| 10 | ## (at your option) any later version. | ||||||||||||||||||||||||||||
| 11 | ## | ||||||||||||||||||||||||||||
| 12 | ## See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||
| 13 | #################################################################################################### | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | package Net::DRI::Protocol::OVH::WS::Message; | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use utf8; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use Net::DRI::Protocol::ResultStatus; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 1 | ▶ | use base qw(Class::Accessor::Chained::Fast Net::DRI::Protocol::Message); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | 1 | __PACKAGE__->mk_accessors(qw(version method params result errcode errmsg)); | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | =pod | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | =head1 NAME | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | Net::DRI::Protocol::OVH::WS::Message - OVH Web Services Message for Net::DRI | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | Please see the README file for details. | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | For now, support questions should be sent to: | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | Please also see the SUPPORT file in the distribution. | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt> | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | Patrick Mevzek, E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | Copyright (c) 2008-2010,2013 Patrick Mevzek <netdri@dotandco.com>. | ||||||||||||||||||||||||||||
| 56 | All rights reserved. | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | This program is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 59 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 60 | the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||
| 61 | (at your option) any later version. | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | =cut | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | #################################################################################################### | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | sub new | ||||||||||||||||||||||||||||
| 70 | { | ||||||||||||||||||||||||||||
| 71 | 0 | ▶ | my ($class,$trid,$otype,$oaction)=@_; | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 72 | 0 | my $self={errcode => undef, errmsg => undef}; | |||||||||||||||||||||||||||
| 73 | 0 | bless($self,$class); | |||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 0 | $self->params([]); ## default | |||||||||||||||||||||||||||
| 76 | 0 | return $self; | |||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | sub as_string | ||||||||||||||||||||||||||||
| 80 | { | ||||||||||||||||||||||||||||
| 81 | 0 | ▶ | my ($self)=@_; | ||||||||||||||||||||||||||
|
Subroutine
as_string: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 82 | 0 | my @p=@{$self->params()}; | |||||||||||||||||||||||||||
| 83 | 0 | my @pr; | |||||||||||||||||||||||||||
| 84 | 0 | foreach my $i (0..$#p) | |||||||||||||||||||||||||||
| 85 | { | ||||||||||||||||||||||||||||
| 86 | 0 | push @pr,sprintf 'PARAM%d=%s',$i+1,$p[$i]; | |||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||
| 88 | 0 | return sprintf "METHOD=%s\n%s\n",$self->method(),join("\n",@pr); | |||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | sub add_session | ||||||||||||||||||||||||||||
| 92 | { | ||||||||||||||||||||||||||||
| 93 | 0 | ▶ | my ($self,$sd)=@_; | ||||||||||||||||||||||||||
|
Subroutine
add_session: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 94 | 0 | my $rp=$self->params(); | |||||||||||||||||||||||||||
| 95 | 0 | unshift @$rp,$sd->{id}; | |||||||||||||||||||||||||||
| 96 | 0 | return; | |||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | sub parse | ||||||||||||||||||||||||||||
| 100 | { | ||||||||||||||||||||||||||||
| 101 | 0 | ▶ | my ($self,$dr,$rinfo,$otype,$oaction,$sent)=@_; ## $sent is the original message, we could copy its method/params value into this new message | ||||||||||||||||||||||||||
|
Subroutine
parse: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 102 | 0 | my ($res)=@{$dr->data()}; ## $dr is a Data::Raw object, type=1 | |||||||||||||||||||||||||||
| 103 | 0 | ▶ | if (ref($res) eq 'HASH') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 104 | { | ||||||||||||||||||||||||||||
| 105 | 0 | $self->result($res->{value}); | |||||||||||||||||||||||||||
| 106 | 0 | $self->errcode($res->{status}); | |||||||||||||||||||||||||||
| 107 | 0 | $self->errmsg($res->{msg}); | |||||||||||||||||||||||||||
| 108 | } else | ||||||||||||||||||||||||||||
| 109 | { | ||||||||||||||||||||||||||||
| 110 | 0 | $self->result($res); | |||||||||||||||||||||||||||
| 111 | 0 | $self->errcode(100); ## probably success | |||||||||||||||||||||||||||
| 112 | 0 | $self->errmsg('No status/msg given'); | |||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||
| 114 | 0 | return; | |||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | ## See http://guides.ovh.com/ManagerV3Status and http://wikikillers.eu/index.php?title=Codes_d%27erreurs | ||||||||||||||||||||||||||||
| 118 | 1 | my %CODES=( 201 => 2003,# parametre(s) manquant(s) | |||||||||||||||||||||||||||
| 119 | 202 => 2005,# parametre(s) invalide(s) | ||||||||||||||||||||||||||||
| 120 | 203 => 2306,# parametres incompatibles | ||||||||||||||||||||||||||||
| 121 | 210 => 2306,# donnée inconnue | ||||||||||||||||||||||||||||
| 122 | 211 => 2306,# donnée deja existante | ||||||||||||||||||||||||||||
| 123 | 212 => 2308,# l'action n'a affectée aucune donnée | ||||||||||||||||||||||||||||
| 124 | 213 => 2306,# donnée en doublon | ||||||||||||||||||||||||||||
| 125 | 214 => 2308,# l'action a affectée trop de données | ||||||||||||||||||||||||||||
| 126 | 220 => 2304,# donnée en cours de traitement | ||||||||||||||||||||||||||||
| 127 | 230 => 2101,# fonction inactive | ||||||||||||||||||||||||||||
| 128 | 240 => 2304,# action en cours de traitement | ||||||||||||||||||||||||||||
| 129 | 241 => 2308,# action impossible | ||||||||||||||||||||||||||||
| 130 | 250 => 2101,# fonction non implémenté | ||||||||||||||||||||||||||||
| 131 | 251 => 2000,# fonction obsolète | ||||||||||||||||||||||||||||
| 132 | 252 => 2308,# fonction innaccessible | ||||||||||||||||||||||||||||
| 133 | 260 => 2400,# erreur, pas d'info supplementaire | ||||||||||||||||||||||||||||
| 134 | 266 => 2400,# toutes les fonctions du merge ont échoué: pas de resultat | ||||||||||||||||||||||||||||
| 135 | 267 => 2400,# certaines fonctions ont échoués: l'action devra etre entreprise de nouveau plus tard | ||||||||||||||||||||||||||||
| 136 | 280 => 2400,# erreur interne | ||||||||||||||||||||||||||||
| 137 | 281 => 2400,# traitement échoué | ||||||||||||||||||||||||||||
| 138 | 299 => 2005,# parametres excedentaires | ||||||||||||||||||||||||||||
| 139 | 301 => 2200,# session expirée ## should trigger a new login | ||||||||||||||||||||||||||||
| 140 | 302 => 2200,# session inexistante ## should trigger a new login | ||||||||||||||||||||||||||||
| 141 | 303 => 2200,# session corrompue ## should trigger a new login | ||||||||||||||||||||||||||||
| 142 | 304 => 2502,# trop de sessions actives ## should trigger a call to ClearNicSessions and a retry | ||||||||||||||||||||||||||||
| 143 | 310 => 2200,# erreur login | ||||||||||||||||||||||||||||
| 144 | 320 => 2200,# burst | ||||||||||||||||||||||||||||
| 145 | 401 => 2201,# pas de droit d'acces | ||||||||||||||||||||||||||||
| 146 | 402 => 2201,# droits insuffisants | ||||||||||||||||||||||||||||
| 147 | 403 => 2200,# session en lecture seule | ||||||||||||||||||||||||||||
| 148 | 451 => 2400,# quota dépassé | ||||||||||||||||||||||||||||
| 149 | 461 => 2400,# hacké | ||||||||||||||||||||||||||||
| 150 | 501 => 2400,# probleme connexion base de données | ||||||||||||||||||||||||||||
| 151 | 502 => 2400,# donnée erronée au sein du serveur | ||||||||||||||||||||||||||||
| 152 | 503 => 2400,# probleme connexion | ||||||||||||||||||||||||||||
| 153 | 504 => 2400,# probleme connexion dns | ||||||||||||||||||||||||||||
| 154 | 505 => 2400,# probleme interne au serveur | ||||||||||||||||||||||||||||
| 155 | 506 => 2400,# parametre interne invalide | ||||||||||||||||||||||||||||
| 156 | 510 => 2308,# données introuvable | ||||||||||||||||||||||||||||
| 157 | 601 => 2400,# parametres mysql corrompus | ||||||||||||||||||||||||||||
| 158 | 701 => 2304,# domaine dans un etat incompatible | ||||||||||||||||||||||||||||
| 159 | 702 => 2307,# fonction non supportée par le domaine (ex:multidomain sur un gp) | ||||||||||||||||||||||||||||
| 160 | 703 => 2304,# objet dans un état incompatible | ||||||||||||||||||||||||||||
| 161 | 704 => 2305,# un processus bloquant interdit la création de l'objet | ||||||||||||||||||||||||||||
| 162 | 705 => 2002,# plus de données a traité. | ||||||||||||||||||||||||||||
| 163 | 706 => 2400,# impossible d'obtenir le lock | ||||||||||||||||||||||||||||
| 164 | 777 => 2400,# pas de numero d'erreur donne | ||||||||||||||||||||||||||||
| 165 | ); | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | 0 | ▶ | sub is_success { return (shift->errcode()==100)? 1 : 0; } | ||||||||||||||||||||||||||
|
Subroutine
is_success: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | sub result_status | ||||||||||||||||||||||||||||
| 170 | { | ||||||||||||||||||||||||||||
| 171 | 0 | ▶ | my $self=shift; | ||||||||||||||||||||||||||
|
Subroutine
result_status: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 172 | 0 | my $code=$self->errcode(); | |||||||||||||||||||||||||||
| 173 | 0 | ▶ | my $msg=$self->errmsg() || ''; | ||||||||||||||||||||||||||
|
Condition0%0/2
$self->errmsg || ''
MC/DC0%0/1
$self->errmsg || ''
$self->errmsg
Truth table0%0/2
A
A= $self->errmsg
| |||||||||||||||||||||||||||||
| 174 | 0 | my $ok=$self->is_success(); | |||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | 0 | ▶ | if ($code >= 101 && $code <=199) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$code >= 101 and $code <= 199
MC/DC0%0/2
$code >= 101 and $code <= 199
$code >= 101
$code <= 199
Truth table0%0/3
A and B
A= $code >= 101B= $code <= 199
| |||||||||||||||||||||||||||||
| 177 | { | ||||||||||||||||||||||||||||
| 178 | 0 | carp('Got a "warning" error code, please report: '.$code.' '.$msg); | |||||||||||||||||||||||||||
| 179 | 0 | $ok=1; | |||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | 0 | ▶ | my $eppcode=(defined $code && exists $CODES{$code})? $CODES{$code} : 'COMMAND_FAILED'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $code and exists $CODES{$code}
MC/DC0%0/2
defined $code and exists $CODES{$code}
defined $code
exists $CODES{$code}
Truth table0%0/3
A and B
A= defined $codeB= exists $CODES{$code}
| |||||||||||||||||||||||||||||
| 183 | 0 | ▶ | return Net::DRI::Protocol::ResultStatus->new('ovh_ws',$code,$ok? 'COMMAND_SUCCESSFUL' : $eppcode,$ok,$msg,'en'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | #################################################################################################### | ||||||||||||||||||||||||||||
| 187 | 1 | 1; | |||||||||||||||||||||||||||