Class: DLDInternet::DOctl::Compute::Domain::Records::Command

Inherits:
Thor::Command
  • Object
show all
Defined in:
lib/dldinternet/doctl/compute/domain/records/command.rb

Instance Method Summary collapse

Instance Method Details

#create(domain) ⇒ Object



36
37
38
39
40
41
# File 'lib/dldinternet/doctl/compute/domain/records/command.rb', line 36

def create(domain)
  records_formats
  command_pre(domain)
  command_out(DLDInternet::DOctl::API::Compute::Domain::Records::Create.new(options, @logger).CreateDomainRecord(domain, record_from_options))
  0
end

#delete(domain, id) ⇒ Object



46
47
48
49
50
51
52
53
54
# File 'lib/dldinternet/doctl/compute/domain/records/command.rb', line 46

def delete(domain, id)
  # @header = -> {  }
  # @format = ->(o) { o.ai }
  records_formats
  command_pre(domain)
  DLDInternet::DOctl::API::Compute::Domain::Records::Delete.new(options, @logger).DeleteDomainRecord(domain, id)
  command_out(DLDInternet::DOctl::API::Compute::Domain::Records::List.new(options, @logger).GetDomainRecordsList(domain))
  0
end

#list(domain) ⇒ Object



20
21
22
23
24
25
# File 'lib/dldinternet/doctl/compute/domain/records/command.rb', line 20

def list(domain)
  records_formats
  command_pre(domain)
  command_out(DLDInternet::DOctl::API::Compute::Domain::Records::List.new(options, @logger).GetDomainRecordsList(domain))
  0
end

#update(domain) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/dldinternet/doctl/compute/domain/records/command.rb', line 66

def update(domain)
  records_formats
  command_pre(domain)
  res = DLDInternet::DOctl::API::Compute::Domain::Records::Update.new(options, @logger).UpdateDomainRecord(domain, record_from_options, options[:record_id])
  if res.is_a?(::DropletKit::DomainRecord)
    res = DLDInternet::DOctl::API::Compute::Domain::Records::Delete.new(options, @logger).DeleteDomainRecord(domain, options[:record_id])
    if res === true
      command_out(DLDInternet::DOctl::API::Compute::Domain::Records::List.new(options, @logger).GetDomainRecordsList(domain))
      0
    else
      command_out(res)
      1
    end
  else
    command_out(res)
    1
  end
end