« lib/WWW/Hetzner/CLI/Cmd/StorageBox/Cmd/Subaccount/Cmd/ResetPassword.pm
↑ Summary
lib/WWW/Hetzner/CLI/Cmd/StorageBox/Cmd/Snapshot/Cmd/Create.pm »
| 1 | package WWW::Hetzner::CLI::Cmd::Record::Cmd::Describe; | ||||||||||||
| 2 | # ABSTRACT: Describe a DNS record | ||||||||||||
| 3 | |||||||||||||
| 4 | 1 | our $VERSION = '0.102'; | |||||||||||
| 5 | |||||||||||||
| 6 | 1 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 1 | ▶ | use MooX::Cmd; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 1 | ▶ | use MooX::Options usage_string => 'USAGE: hcloud.pl record describe --zone <zone-id> --name <name> --type <type>'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | 1 | ▶ | use JSON::MaybeXS qw(encode_json); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | |||||||||||||
| 11 | 1 | option zone => ( | |||||||||||
| 12 | is => 'ro', | ||||||||||||
| 13 | format => 's', | ||||||||||||
| 14 | short => 'z', | ||||||||||||
| 15 | required => 1, | ||||||||||||
| 16 | doc => 'Zone ID', | ||||||||||||
| 17 | ); | ||||||||||||
| 18 | |||||||||||||
| 19 | 1 | option name => ( | |||||||||||
| 20 | is => 'ro', | ||||||||||||
| 21 | format => 's', | ||||||||||||
| 22 | short => 'n', | ||||||||||||
| 23 | required => 1, | ||||||||||||
| 24 | doc => 'Record name', | ||||||||||||
| 25 | ); | ||||||||||||
| 26 | |||||||||||||
| 27 | 1 | option type => ( | |||||||||||
| 28 | is => 'ro', | ||||||||||||
| 29 | format => 's', | ||||||||||||
| 30 | short => 't', | ||||||||||||
| 31 | required => 1, | ||||||||||||
| 32 | doc => 'Record type (A, AAAA, CNAME, MX, TXT, etc.)', | ||||||||||||
| 33 | ); | ||||||||||||
| 34 | |||||||||||||
| 35 | 1 | ▶ | sub execute { | ||||||||||
|
Subroutine
execute: called CC=4 SCAR=14.2
Pod
undocumented
| |||||||||||||
| 36 | 1 | my ($self, $args, $chain) = @_; | |||||||||||
| 37 | |||||||||||||
| 38 | 1 | my $main = $chain->[0]; | |||||||||||
| 39 | 1 | my $cloud = $main->cloud; | |||||||||||
| 40 | |||||||||||||
| 41 | 1 | my $rrsets = $cloud->zones->rrsets($self->zone); | |||||||||||
| 42 | 1 | my $record = $rrsets->get($self->name, uc($self->type)); | |||||||||||
| 43 | |||||||||||||
| 44 | 1 | ▶ | if ($main->output eq 'json') { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 45 | 0 | print encode_json($record->data), "\n"; | |||||||||||
| 46 | 0 | return; | |||||||||||
| 47 | } | ||||||||||||
| 48 | |||||||||||||
| 49 | 1 | print "Record:\n"; | |||||||||||
| 50 | 1 | printf " Name: %s\n", $record->name; | |||||||||||
| 51 | 1 | printf " Type: %s\n", $record->type; | |||||||||||
| 52 | 1 | ▶ | printf " TTL: %s\n", $record->ttl // '-'; | ||||||||||
|
Condition50%1/2
$record->ttl // "-"
MC/DC0%0/1
$record->ttl // "-"
$record->ttl
Truth table50%1/2
A
A= $record->ttl
| |||||||||||||
| 53 | 1 | print " Values:\n"; | |||||||||||
| 54 | 1 | for my $v (@{$record->records}) { | |||||||||||
| 55 | 1 | print " - $v->{value}\n"; | |||||||||||
| 56 | } | ||||||||||||
| 57 | } | ||||||||||||
| 58 | |||||||||||||
| 59 | 1 | 1; | |||||||||||
| 60 | |||||||||||||
| 61 | __END__ | ||||||||||||