| 1 | package WWW::Hetzner::Cloud::Zone; | ||||||||||
| 2 | # ABSTRACT: Hetzner Cloud DNS Zone object | ||||||||||
| 3 | |||||||||||
| 4 | 25 | our $VERSION = '0.100'; | |||||||||
| 5 | |||||||||||
| 6 | 25 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 25 | ▶ | use Carp qw(croak); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 25 | ▶ | use WWW::Hetzner::Cloud::API::RRSets; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 25 | ▶ | use namespace::clean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | |||||||||||
| 12 | 25 | has _client => ( | |||||||||
| 13 | is => 'ro', | ||||||||||
| 14 | required => 1, | ||||||||||
| 15 | weak_ref => 1, | ||||||||||
| 16 | init_arg => 'client', | ||||||||||
| 17 | ); | ||||||||||
| 18 | |||||||||||
| 19 | 25 | has id => ( is => 'ro' ); | |||||||||
| 20 | |||||||||||
| 21 | |||||||||||
| 22 | 25 | has name => ( is => 'rw' ); | |||||||||
| 23 | |||||||||||
| 24 | |||||||||||
| 25 | 25 | has status => ( is => 'ro' ); | |||||||||
| 26 | |||||||||||
| 27 | |||||||||||
| 28 | 25 | has ttl => ( is => 'rw' ); | |||||||||
| 29 | |||||||||||
| 30 | |||||||||||
| 31 | 25 | has created => ( is => 'ro' ); | |||||||||
| 32 | |||||||||||
| 33 | |||||||||||
| 34 | 0 | ▶ | has ns => ( is => 'ro', default => sub { [] } ); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 35 | |||||||||||
| 36 | |||||||||||
| 37 | 25 | has records_count => ( is => 'ro' ); | |||||||||
| 38 | |||||||||||
| 39 | |||||||||||
| 40 | 25 | has is_secondary_dns => ( is => 'ro' ); | |||||||||
| 41 | |||||||||||
| 42 | |||||||||||
| 43 | 0 | ▶ | has labels => ( is => 'rw', default => sub { {} } ); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 44 | |||||||||||
| 45 | |||||||||||
| 46 | sub update { | ||||||||||
| 47 | 0 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
update: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 48 | 0 | ▶ | croak "Cannot update zone without ID" unless $self->id; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | |||||||||||
| 50 | 0 | $self->_client->put("/zones/" . $self->id, { | |||||||||
| 51 | name => $self->name, | ||||||||||
| 52 | labels => $self->labels, | ||||||||||
| 53 | }); | ||||||||||
| 54 | 0 | return $self; | |||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | |||||||||||
| 58 | sub delete { | ||||||||||
| 59 | 0 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
delete: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 60 | 0 | ▶ | croak "Cannot delete zone without ID" unless $self->id; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 61 | |||||||||||
| 62 | 0 | $self->_client->delete("/zones/" . $self->id); | |||||||||
| 63 | 0 | return 1; | |||||||||
| 64 | } | ||||||||||
| 65 | |||||||||||
| 66 | |||||||||||
| 67 | sub rrsets { | ||||||||||
| 68 | 0 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
rrsets: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 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 | sub export { | ||||||||||
| 79 | 0 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
export: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 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 | sub data { | ||||||||||
| 87 | 0 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
data: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 88 | return { | ||||||||||
| 89 | 0 | 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 | 25 | 1. | |||||||||
| 104 | |||||||||||
| 105 | __END__ | ||||||||||