| 1 | package API::DirectAdmin::Domain; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use Modern::Perl '2010'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use Data::Dumper; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use base 'API::DirectAdmin::Component'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | our $VERSION = 0.05; | |||||||||
| 9 | |||||||||||
| 10 | # Return domains list | ||||||||||
| 11 | # INPUT | ||||||||||
| 12 | # connection data for USER, not admin | ||||||||||
| 13 | 0 | ▶ | sub list { | ||||||||
|
Subroutine
list: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 14 | 0 | my ($self ) = @_; | |||||||||
| 15 | |||||||||||
| 16 | 0 | my $responce = $self->directadmin->query( | |||||||||
| 17 | command => 'CMD_API_SHOW_DOMAINS', | ||||||||||
| 18 | ); | ||||||||||
| 19 | |||||||||||
| 20 | 0 | ▶ | return $responce->{list} if ref $responce eq 'HASH'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | 0 | return []; | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | # Add Domain to user account | ||||||||||
| 25 | # params: domain, php (ON|OFF), cgi (ON|OFF) | ||||||||||
| 26 | 2 | ▶ | sub add { | ||||||||
|
Subroutine
add: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||
| 27 | 2 | my ($self, $params ) = @_; | |||||||||
| 28 | |||||||||||
| 29 | 2 | my %add_params = ( | |||||||||
| 30 | action => 'create', | ||||||||||
| 31 | ); | ||||||||||
| 32 | |||||||||||
| 33 | 2 | my %params = (%$params, %add_params); | |||||||||
| 34 | |||||||||||
| 35 | #warn 'params ' . Dumper(\%params) if $DEBUG; | ||||||||||
| 36 | |||||||||||
| 37 | 2 | my $responce = $self->directadmin->query( | |||||||||
| 38 | params => \%params, | ||||||||||
| 39 | command => 'CMD_API_DOMAIN', | ||||||||||
| 40 | method => 'POST', | ||||||||||
| 41 | allowed_fields => | ||||||||||
| 42 | 'action | ||||||||||
| 43 | domain | ||||||||||
| 44 | php | ||||||||||
| 45 | cgi', | ||||||||||
| 46 | ); | ||||||||||
| 47 | |||||||||||
| 48 | 2 | ▶ | warn 'responce ' . Dumper(\$responce) if $self->{debug}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | |||||||||||
| 50 | 2 | ▶ | warn "Creating domain: $responce->{text}, $responce->{details}" if $self->{debug}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | 2 | return $responce; | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | 1 | 1; | |||||||||