| 1 | package WWW::Hetzner::Cloud::Zone; | ||||||||||
| 2 | # ABSTRACT: Hetzner Cloud DNS Zone object | ||||||||||
| 3 | |||||||||||
| 4 | 60 | our $VERSION = '0.102'; | |||||||||
| 5 | |||||||||||
| 6 | 60 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 60 | with 'WWW::Hetzner::Role::HasAction'; | |||||||||
| 8 | 60 | ▶ | use Carp qw(croak); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 60 | ▶ | use WWW::Hetzner::Cloud::API::RRSets; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 60 | ▶ | use namespace::clean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | |||||||||||
| 13 | 60 | has _client => ( | |||||||||
| 14 | is => 'ro', | ||||||||||
| 15 | required => 1, | ||||||||||
| 16 | weak_ref => 1, | ||||||||||
| 17 | init_arg => 'client', | ||||||||||
| 18 | ); | ||||||||||
| 19 | |||||||||||
| 20 | 60 | has id => ( is => 'ro' ); | |||||||||
| 21 | |||||||||||
| 22 | |||||||||||
| 23 | 60 | has name => ( is => 'rw' ); | |||||||||
| 24 | |||||||||||
| 25 | |||||||||||
| 26 | 60 | has status => ( is => 'ro' ); | |||||||||
| 27 | |||||||||||
| 28 | |||||||||||
| 29 | 60 | has ttl => ( is => 'rw' ); | |||||||||
| 30 | |||||||||||
| 31 | |||||||||||
| 32 | 60 | has created => ( is => 'ro' ); | |||||||||
| 33 | |||||||||||
| 34 | |||||||||||
| 35 | 0 | ▶ | has ns => ( is => 'ro', default => sub { [] } ); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 36 | |||||||||||
| 37 | |||||||||||
| 38 | 60 | has records_count => ( is => 'ro' ); | |||||||||
| 39 | |||||||||||
| 40 | |||||||||||
| 41 | 60 | has is_secondary_dns => ( is => 'ro' ); | |||||||||
| 42 | |||||||||||
| 43 | |||||||||||
| 44 | 0 | ▶ | has labels => ( is => 'rw', default => sub { {} } ); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 45 | |||||||||||
| 46 | |||||||||||
| 47 | 0 | ▶ | sub update { | ||||||||
|
Subroutine
update: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 48 | 0 | my ($self) = @_; | |||||||||
| 49 | 0 | ▶ | croak "Cannot update zone without ID" unless $self->id; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | |||||||||||
| 51 | 0 | $self->_client->put("/zones/" . $self->id, { | |||||||||
| 52 | name => $self->name, | ||||||||||
| 53 | labels => $self->labels, | ||||||||||
| 54 | }); | ||||||||||
| 55 | 0 | return $self; | |||||||||
| 56 | } | ||||||||||
| 57 | |||||||||||
| 58 | |||||||||||
| 59 | 1 | ▶ | sub delete { | ||||||||
|
Subroutine
delete: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||
| 60 | 1 | my ($self) = @_; | |||||||||
| 61 | 1 | ▶ | croak "Cannot delete zone without ID" unless $self->id; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 62 | |||||||||||
| 63 | 1 | return $self->_client->zones->delete($self->id); | |||||||||
| 64 | } | ||||||||||
| 65 | |||||||||||
| 66 | |||||||||||
| 67 | 0 | ▶ | sub rrsets { | ||||||||
|
Subroutine
rrsets: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 68 | 0 | my ($self) = @_; | |||||||||
| 69 | 0 | ▶ | croak "Cannot get rrsets without zone ID" unless $self->id; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 70 | |||||||||||
| 71 | 0 | return WWW::Hetzner::Cloud::API::RRSets->new( | |||||||||
| 72 | client => $self->_client, | ||||||||||
| 73 | zone_id => $self->id, | ||||||||||
| 74 | ); | ||||||||||
| 75 | } | ||||||||||
| 76 | |||||||||||
| 77 | |||||||||||
| 78 | 0 | ▶ | sub export { | ||||||||
|
Subroutine
export: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 79 | 0 | my ($self) = @_; | |||||||||
| 80 | 0 | ▶ | croak "Cannot export zone without ID" unless $self->id; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 81 | |||||||||||
| 82 | 0 | return $self->_client->get("/zones/" . $self->id . "/export"); | |||||||||
| 83 | } | ||||||||||
| 84 | |||||||||||
| 85 | |||||||||||
| 86 | 1 | ▶ | sub data { | ||||||||
|
Subroutine
data: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 87 | 1 | my ($self) = @_; | |||||||||
| 88 | return { | ||||||||||
| 89 | 1 | id => $self->id, | |||||||||
| 90 | name => $self->name, | ||||||||||
| 91 | status => $self->status, | ||||||||||
| 92 | ttl => $self->ttl, | ||||||||||
| 93 | created => $self->created, | ||||||||||
| 94 | ns => $self->ns, | ||||||||||
| 95 | records_count => $self->records_count, | ||||||||||
| 96 | is_secondary_dns => $self->is_secondary_dns, | ||||||||||
| 97 | labels => $self->labels, | ||||||||||
| 98 | }; | ||||||||||
| 99 | } | ||||||||||
| 100 | |||||||||||
| 101 | |||||||||||
| 102 | |||||||||||
| 103 | 60 | 1. | |||||||||
| 104 | |||||||||||
| 105 | __END__ | ||||||||||