1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[stormondemand|dns] Add DNS Zone APIs

This commit is contained in:
Eric Wong 2013-05-23 16:28:28 +08:00
parent 37574c2e8d
commit 5bd1658876
11 changed files with 177 additions and 2 deletions

View file

@ -17,6 +17,8 @@ module Fog
model :record
collection :records
model :reverse
model :zone
collection :zones
request_path 'fog/storm_on_demand/requests/dns'
request :list_domains
@ -33,6 +35,13 @@ module Fog
request :delete_reverse
request :update_reverse
request :create_zone
request :check_zone_delegation
request :delete_zone
request :get_zone
request :list_zones
request :update_zone
class Mock

View file

@ -1,5 +1,5 @@
require 'fog/core/collection'
require 'fog/storm_on_demand/models/dns'
require 'fog/storm_on_demand/models/dns/domain'
module Fog
module DNS

View file

@ -1,5 +1,5 @@
require 'fog/core/collection'
require 'fog/storm_on_demand/models/dns'
require 'fog/storm_on_demand/models/dns/record'
module Fog
module DNS

View file

@ -0,0 +1,40 @@
require 'fog/core/model'
module Fog
module DNS
class StormOnDemand
class Zone < Fog::Model
identity :id
attribute :active
attribute :delegation_checked
attribute :delegation_status
attribute :master
attribute :name
attribute :notified_serial
attribute :region_support
attribute :type
def initialize(attributes={})
super
end
def delegation
requires :identity
service.check_zone_delegation(:id => identity).body['delegation']
end
def destroy
requires :identity
service.delete_zone(:id => identity).body['deleted']
end
def update(options={})
requires :identity
service.update_zone({:id => identity}.merge!(options))
end
end
end
end
end

View file

@ -0,0 +1,30 @@
require 'fog/core/collection'
require 'fog/storm_on_demand/models/dns/zone'
module Fog
module DNS
class StormOnDemand
class Zones < Fog::Collection
model Fog::DNS::StormOnDemand::Zone
def create(options)
zone = service.create_zone(options).body
new(zone)
end
def get(zone_id)
zone = service.get_zone(:id => zone_id).body
new(zone)
end
def all(options={})
zones = service.list_zones(options).body['items']
load(zones)
end
end
end
end
end

View file

@ -0,0 +1,16 @@
module Fog
module DNS
class StormOnDemand
class Real
def check_zone_delegation(options={})
request(
:path => '/Network/DNS/Zone/delegation',
:body => Fog::JSON.encode(:params => options)
)
end
end
end
end
end

View file

@ -0,0 +1,16 @@
module Fog
module DNS
class StormOnDemand
class Real
def create_zone(options={})
request(
:path => '/Network/DNS/Zone/create',
:body => Fog::JSON.encode(:params => options)
)
end
end
end
end
end

View file

@ -0,0 +1,16 @@
module Fog
module DNS
class StormOnDemand
class Real
def delete_zone(options={})
request(
:path => '/Network/DNS/Zone/delete',
:body => Fog::JSON.encode(:params => options)
)
end
end
end
end
end

View file

@ -0,0 +1,16 @@
module Fog
module DNS
class StormOnDemand
class Real
def get_zone(options={})
request(
:path => '/Network/DNS/Zone/details',
:body => Fog::JSON.encode(:params => options)
)
end
end
end
end
end

View file

@ -0,0 +1,16 @@
module Fog
module DNS
class StormOnDemand
class Real
def list_zones(options={})
request(
:path => '/Network/DNS/Zone/list',
:body => Fog::JSON.encode(:params => options)
)
end
end
end
end
end

View file

@ -0,0 +1,16 @@
module Fog
module DNS
class StormOnDemand
class Real
def update_zone(options={})
request(
:path => '/Network/DNS/Zone/update',
:body => Fog::JSON.encode(:params => options)
)
end
end
end
end
end