| 1 | package WWW::Hetzner::CLI::Cmd::Record::Cmd::Delete; | ||||||||||
| 2 | # ABSTRACT: Delete 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 delete --zone <zone-id> --name <name> --type <type>'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | with 'WWW::Hetzner::CLI::Role::WaitsForAction'; | |||||||||
| 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 | 2 | ▶ | sub execute { | ||||||||
|
Subroutine
execute: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 36 | 2 | my ($self, $args, $chain) = @_; | |||||||||
| 37 | |||||||||||
| 38 | 2 | my $main = $chain->[0]; | |||||||||
| 39 | 2 | my $cloud = $main->cloud; | |||||||||
| 40 | |||||||||||
| 41 | 2 | my $rrsets = $cloud->zones->rrsets($self->zone); | |||||||||
| 42 | 2 | my $action = $rrsets->delete($self->name, uc($self->type)); | |||||||||
| 43 | 2 | $self->handle_action($action); | |||||||||
| 44 | |||||||||||
| 45 | 2 | ▶ | print "Record ", $self->name, "/", uc($self->type), | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | $self->no_wait ? " delete requested.\n" : " deleted.\n"; | ||||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | 1 | 1; | |||||||||
| 50 | |||||||||||
| 51 | __END__ | ||||||||||