line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::DigitalOcean::Role::DomainRecords; |
2
|
|
|
|
|
|
|
# ABSTRACT: Domain Records role for DigitalOcean WebService |
3
|
2
|
|
|
2
|
|
1533
|
use utf8; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
19
|
|
4
|
2
|
|
|
2
|
|
66
|
use Moo::Role; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
16
|
|
5
|
2
|
|
|
2
|
|
737
|
use feature 'state'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
221
|
|
6
|
2
|
|
|
2
|
|
11
|
use Types::Standard qw/Str Int Object Dict Optional/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
16
|
|
7
|
2
|
|
|
2
|
|
1685
|
use Type::Utils; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
21
|
|
8
|
2
|
|
|
2
|
|
2645
|
use Type::Params qw/compile/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
12
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
requires 'make_request'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.024'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub domain_record_create { |
15
|
0
|
|
|
0
|
1
|
|
state $check = compile(Object, |
16
|
|
|
|
|
|
|
Dict[ |
17
|
|
|
|
|
|
|
domain => Str, |
18
|
|
|
|
|
|
|
type => Str, |
19
|
|
|
|
|
|
|
name => Optional[Str], |
20
|
|
|
|
|
|
|
data => Optional[Str], |
21
|
|
|
|
|
|
|
priority => Optional[Int], |
22
|
|
|
|
|
|
|
port => Optional[Int], |
23
|
|
|
|
|
|
|
weight => Optional[Int], |
24
|
|
|
|
|
|
|
], |
25
|
|
|
|
|
|
|
); |
26
|
0
|
|
|
|
|
|
my ($self, $opts) = $check->(@_); |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my $domain = delete $opts->{domain}; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
return $self->make_request(POST => "/domains/$domain/records", $opts); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub domain_record_list { |
34
|
0
|
|
|
0
|
1
|
|
state $check = compile(Object, Str); |
35
|
0
|
|
|
|
|
|
my ($self, $domain) = $check->(@_); |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
return $self->make_request(GET => "/domains/$domain/records"); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub domain_record_get { |
41
|
0
|
|
|
0
|
1
|
|
state $check = compile(Object, |
42
|
|
|
|
|
|
|
Dict[ |
43
|
|
|
|
|
|
|
domain => Str, |
44
|
|
|
|
|
|
|
id => Int, |
45
|
|
|
|
|
|
|
], |
46
|
|
|
|
|
|
|
); |
47
|
0
|
|
|
|
|
|
my ($self, $opts) = $check->(@_); |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
return $self->make_request(GET => "/domains/$opts->{domain}/records/$opts->{id}"); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub domain_record_delete { |
53
|
0
|
|
|
0
|
1
|
|
state $check = compile(Object, |
54
|
|
|
|
|
|
|
Dict[ |
55
|
|
|
|
|
|
|
domain => Str, |
56
|
|
|
|
|
|
|
id => Int, |
57
|
|
|
|
|
|
|
], |
58
|
|
|
|
|
|
|
); |
59
|
0
|
|
|
|
|
|
my ($self, $opts) = $check->(@_); |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
return $self->make_request(DELETE => "/domains/$opts->{domain}/records/$opts->{id}"); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# TODO: |
65
|
|
|
|
|
|
|
# domain_record_update |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
__END__ |