Class: Nifcloud::DNS::Zone
- Defined in:
- lib/nifcloud/dns/zone.rb
Overview
Class that manages DNS zone information
Constant Summary collapse
- HOSTED_ZONE =
'hostedzone'- HOSTED_ZONE_WITH_ID =
'hostedzone/%s'
Constants inherited from Client
Client::AUTHORIZATION_HEADER, Client::DATE_HEADER, Client::ENDPOINT, Client::NAMESPACE, Client::VERSION
Constants inherited from Auth
Instance Attribute Summary
Attributes inherited from Auth
Instance Method Summary collapse
-
#add(zone, comment: '') ⇒ Object
rubocop:disable Metrics/MethodLength.
- #del(zone_id) ⇒ Object
-
#initialize(access_key: nil, secret_key: nil) ⇒ Zone
constructor
A new instance of Zone.
- #list ⇒ Object
- #show(zone_id) ⇒ Object
Methods inherited from Client
Methods inherited from Auth
Constructor Details
#initialize(access_key: nil, secret_key: nil) ⇒ Zone
Returns a new instance of Zone.
13 14 15 |
# File 'lib/nifcloud/dns/zone.rb', line 13 def initialize(access_key: nil, secret_key: nil) super(access_key, secret_key) end |
Instance Method Details
#add(zone, comment: '') ⇒ Object
rubocop:disable Metrics/MethodLength
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/nifcloud/dns/zone.rb', line 25 def add(zone, comment: '') # rubocop:disable Metrics/MethodLength body = { '@xmlns': Nifcloud::Client::NAMESPACE, Name: [content => zone], CallerReference: [content => ''], HostedZoneConfig: [content => ''], Comment: [content => comment] } = { AttrPrefix: true, RootName: 'CreateHostedZoneRequest', ContentKey: 'content' } post(HOSTED_ZONE, XmlSimple.xml_out(body, )) end |
#del(zone_id) ⇒ Object
41 42 43 |
# File 'lib/nifcloud/dns/zone.rb', line 41 def del(zone_id) delete(HOSTED_ZONE_WITH_ID % zone_id) end |
#list ⇒ Object
17 18 19 |
# File 'lib/nifcloud/dns/zone.rb', line 17 def list get HOSTED_ZONE end |
#show(zone_id) ⇒ Object
21 22 23 |
# File 'lib/nifcloud/dns/zone.rb', line 21 def show(zone_id) get(HOSTED_ZONE_WITH_ID % zone_id) end |