Class: OVH::Provisioner::CliIP

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

Overview

The command line runner

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_ip.rb', line 29

def self.exit_on_failure?
  true
end

Instance Method Details

#list(*targets) ⇒ Object



34
35
36
37
# File 'lib/ovh/provisioner/cli_ip.rb', line 34

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

#rm_reverse(ip) ⇒ Object



52
53
54
55
56
57
58
59
60
61
# File 'lib/ovh/provisioner/cli_ip.rb', line 52

def rm_reverse(ip)
  spawner = Provisioner.init(options)
  ips = spawner.get('IP', ip).list
  return unless Cli.check_service_input(ip, ips, false)

  ip = ips.first
  ask = "You are going to remove the reverse of #{ip.id}"
  Cli.ask_validation(ask)
  puts ip.rm_reverse
end

#set_reverse(ip, reverse) ⇒ Object



40
41
42
43
44
45
46
47
48
49
# File 'lib/ovh/provisioner/cli_ip.rb', line 40

def set_reverse(ip, reverse)
  spawner = Provisioner.init(options)
  ips = spawner.get('IP', ip).list
  return unless Cli.check_service_input(ip, ips, false)

  ip = ips.first
  ask = "You are going to set the reverse of #{ip.id} to #{reverse}"
  Cli.ask_validation(ask)
  puts ip.add_reverse(reverse)
end