Class: OVH::Provisioner::CliDomain

Inherits:
Thor
  • Object
show all
Defined in:
lib/ovh/provisioner/cli_domain.rb

Overview

Command line for domain (actually domain/zone)

Constant Summary collapse

SUBDOMAIN =

options

[
  :subdomain,
  default: '',
  desc: 'Record subdomain',
  aliases: ['-d']
].freeze
TYPE =
[
  :type,
  default: '',
  desc: 'Record type',
  aliases: ['-y']
].freeze
TARGET =
[
  :target,
  default: '',
  desc: 'Record target',
  aliases: ['-t']
].freeze
TTL =
[
  :ttl,
  default: '0',
  desc: 'Record TTL',
  aliases: ['-l']
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ThorPatching

#banner

Class Method Details

.exit_on_failure?Boolean

Exit 1 on failure

Returns:

  • (Boolean)


29
30
31
# File 'lib/ovh/provisioner/cli_domain.rb', line 29

def self.exit_on_failure?
  true
end

Instance Method Details

#add(domain) ⇒ Object



77
78
79
80
81
82
83
84
# File 'lib/ovh/provisioner/cli_domain.rb', line 77

def add(domain)
  spawner = Provisioner.init(options)
  zones = spawner.get('DomainZone', domain).list
  return unless check_zone_input(domain, zones, false)

  zone = zones.first
  add_record(zone, options)
end

#list(*targets) ⇒ Object



63
64
65
66
# File 'lib/ovh/provisioner/cli_domain.rb', line 63

def list(*targets)
  spawner = Provisioner.init(options)
  puts spawner.get('DomainZone', *Cli.all(targets)).format
end

#rm(domain) ⇒ Object



88
89
90
91
92
93
94
95
96
# File 'lib/ovh/provisioner/cli_domain.rb', line 88

def rm(domain)
  spawner = Provisioner.init(options)
  zones = spawner.get('DomainZone', domain).list
  return unless check_zone_input(domain, zones, false)

  zone = zones.first
  matches = zone.filter_records(Provisioner.config)
  rm_records(zone, matches)
end

#show(domain) ⇒ Object



69
70
71
72
73
# File 'lib/ovh/provisioner/cli_domain.rb', line 69

def show(domain)
  spawner = Provisioner.init(options)
  zones = spawner.get('DomainZone', domain).list
  zones.each { |z| puts z.details } if check_zone_input(domain, zones)
end