Class: VagrantPlugins::DnsUpdater::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-dns-updater/command.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.synopsisObject



7
8
9
# File 'lib/vagrant-dns-updater/command.rb', line 7

def self.synopsis
  'Get OVH consumer key'
end

Instance Method Details

#executeObject

Raises:

  • (Vagrant::Errors::VagrantError.new)


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/vagrant-dns-updater/command.rb', line 11

def execute
  access = {
      "accessRules" => [
          { "method" => "GET", "path" => "/domain/*" },
          { "method" => "POST", "path" => "/domain/*" },
          { "method" => "PUT", "path" => "/domain/*" },
          { "method" => "DELETE", "path" => "/domain/*" },
      ]
  }

  argv = parse_args

  result = OVH::REST.generate_consumer_key(argv, access)

  raise Vagrant::Errors::VagrantError.new, result['message'] if result['message'] == 'Invalid application key'

  puts <<-EOF
  validationUrl: #{result['validationUrl']}
  consumerkey: #{result['consumerKey']}
  EOF

end