class DLDInternet::DOctl::API::Compute::Domain::Create

Public Instance Methods

CreateDomain(domain, ip_address) click to toggle source

noinspection RubyUnnecessaryReturnValue

# File lib/dldinternet/doctl/api/compute/domain/create.rb, line 12
def CreateDomain(domain, ip_address)
  client.domains.create(Hashie::Mash.new({name: domain, ip_address: ip_address}))
rescue ::DropletKit::Error => e
  if matches = e.message.match(%r{^([0-9]{3}):\s+(\{.*\})\s*$})
    json = JSON.parse(matches[2])
    @logger.fatal json['message']
  else
    @logger.fatal e.message
  end
  exit 1
end