mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
complete work on Slicehost DNS functions. all functions now supported
all DNS functions are now working and tested. any functions that have optional parameters can now accept these comments cleaned up note, no mocks or test cases. will speak to geemus to learn more about how these work.
This commit is contained in:
parent
5d78577099
commit
3c69e06f07
10 changed files with 76 additions and 64 deletions
|
@ -15,6 +15,7 @@ module Fog
|
||||||
@response[name] = @value.to_i
|
@response[name] = @value.to_i
|
||||||
when 'record-type', 'name', 'data', 'active', 'aux'
|
when 'record-type', 'name', 'data', 'active', 'aux'
|
||||||
@response[name] = @value
|
@response[name] = @value
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,22 +5,41 @@ module Fog
|
||||||
|
|
||||||
require 'fog/slicehost/parsers/compute/create_record'
|
require 'fog/slicehost/parsers/compute/create_record'
|
||||||
|
|
||||||
# Create a new record in a DNS zone
|
# Create a new record in a DNS zone - or update an existing one
|
||||||
# ==== Parameters
|
# ==== Parameters
|
||||||
# * record_type<~String> - type of DNS record to create (A, CNAME, etc)
|
# * record_type<~String> - type of DNS record to create (A, CNAME, etc)
|
||||||
# * zone_id<~Integer> - ID of the zone record should be a part of
|
# * zone_id<~Integer> - ID of the zone to update
|
||||||
# * name<~String> - DNS name record should be for (ie for an A record, the host name)
|
# * name<~String> - host name this DNS record is for
|
||||||
# * data<~String> - data for the DNS record (ie for an A record, the IP address)
|
# * data<~String> - data for the DNS record (ie for an A record, the IP address)
|
||||||
#
|
# * options<~Hash> - extra parameters that are not mandatory
|
||||||
|
# * ttl<~Integer> - time to live in seconds
|
||||||
|
# * active<~String> - whether this record is active or not ('Y' or 'N')
|
||||||
|
# * aux<~String> - extra data required by the record
|
||||||
# ==== Returns
|
# ==== Returns
|
||||||
# * response<~Excon::Response>:
|
# * response<~Excon::Response>:
|
||||||
# * 'name'<~String> - domain added
|
# * body<~Hash>:
|
||||||
# * 'id'<~Integer> - Id of zone/domain
|
# * 'name'<~String> - as above
|
||||||
# * 'ttl'<~Integer> - TimeToLive for zone (how long client can cache)
|
# * 'id'<~Integer> - Id of zone/domain - used in future API calls for this zone
|
||||||
# * 'active'<~String> - whether zone is active or disabled
|
# * 'ttl'<~Integer> - as above
|
||||||
def create_record( record_type, zone_id, name, data)
|
# * 'data'<~String> - as above
|
||||||
|
# * 'active'<~String> - as above
|
||||||
|
# * 'aux'<~String> - as above
|
||||||
|
def create_record( record_type, zone_id, name, data, options = {})
|
||||||
|
|
||||||
|
optional_tags= ''
|
||||||
|
options.each { |option, value|
|
||||||
|
case option
|
||||||
|
when :ttl
|
||||||
|
optional_tags+= "<ttl type='integer'>#{value}</ttl>"
|
||||||
|
when :active
|
||||||
|
optional_tags+= "<active>#{value}</active>"
|
||||||
|
when :aux
|
||||||
|
optional_tags+= "<aux>#{value}</aux>"
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:body => %Q{<?xml version="1.0" encoding="UTF-8"?><record><record_type>#{record_type}</record_type><zone_id type="integer">#{zone_id}</zone_id><name>#{name}</name><data>#{data}</data></record>},
|
:body => %Q{<?xml version="1.0" encoding="UTF-8"?><record><record_type>#{record_type}</record_type><zone_id type="integer">#{zone_id}</zone_id><name>#{name}</name><data>#{data}</data>#{optional_tags}</record>},
|
||||||
:expects => 201,
|
:expects => 201,
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:parser => Fog::Parsers::Slicehost::Compute::CreateRecord.new,
|
:parser => Fog::Parsers::Slicehost::Compute::CreateRecord.new,
|
||||||
|
|
|
@ -5,7 +5,7 @@ module Fog
|
||||||
|
|
||||||
require 'fog/slicehost/parsers/compute/create_slice'
|
require 'fog/slicehost/parsers/compute/create_slice'
|
||||||
|
|
||||||
# Get list of slices
|
# Create a new slice
|
||||||
# ==== Parameters
|
# ==== Parameters
|
||||||
# * flavor_id<~Integer> - Id of flavor to create slice with
|
# * flavor_id<~Integer> - Id of flavor to create slice with
|
||||||
# * image_id<~Integer> - Id of image to create slice with
|
# * image_id<~Integer> - Id of image to create slice with
|
||||||
|
@ -13,7 +13,7 @@ module Fog
|
||||||
#
|
#
|
||||||
# ==== Returns
|
# ==== Returns
|
||||||
# * response<~Excon::Response>:
|
# * response<~Excon::Response>:
|
||||||
# * body<~Array>:
|
# * body<~Hash>:
|
||||||
# * 'addresses'<~Array> - Ip addresses for the slice
|
# * 'addresses'<~Array> - Ip addresses for the slice
|
||||||
# * 'backup-id'<~Integer> - Id of backup slice was booted from
|
# * 'backup-id'<~Integer> - Id of backup slice was booted from
|
||||||
# * 'bw-in'<~Integer> - Incoming bandwidth total for current billing cycle, in Gigabytes
|
# * 'bw-in'<~Integer> - Incoming bandwidth total for current billing cycle, in Gigabytes
|
||||||
|
|
|
@ -8,19 +8,31 @@ module Fog
|
||||||
# Create a new zone for Slicehost's DNS servers to serve/host
|
# Create a new zone for Slicehost's DNS servers to serve/host
|
||||||
# ==== Parameters
|
# ==== Parameters
|
||||||
# * origin<~String> - domain name to host (ie example.com)
|
# * origin<~String> - domain name to host (ie example.com)
|
||||||
# * ttl<~Integer> - TimeToLive (ttl) for the domain, in seconds (> 60)
|
# * options<~Hash> - optional paramaters
|
||||||
# * active<~String> - whether zone is active in Slicehost DNS server - 'Y' or 'N'
|
# * ttl<~Integer> - TimeToLive (ttl) for the domain, in seconds (> 60)
|
||||||
|
# * active<~String> - whether zone is active in Slicehost DNS server - 'Y' or 'N'
|
||||||
#
|
#
|
||||||
# ==== Returns
|
# ==== Returns
|
||||||
# * response<~Excon::Response>:
|
# * response<~Excon::Response>:
|
||||||
# * body<~Array>:
|
# * body<~Hash>:
|
||||||
# * 'origin'<~String> - domain added
|
# * 'origin'<~String> - as above
|
||||||
# * 'id'<~Integer> - Id of zone/domain
|
# * 'id'<~Integer> - Id of zone/domain - used in future API calls
|
||||||
# * 'ttl'<~Integer> - TimeToLive for zone (how long client can cache)
|
# * 'ttl'<~Integer> - as above
|
||||||
# * 'active'<~String> - whether zone is active or disabled
|
# * 'active'<~String> - as above
|
||||||
def create_zone(origin, ttl, active)
|
def create_zone(origin, options = {})
|
||||||
|
|
||||||
|
optional_tags= ''
|
||||||
|
options.each { |option, value|
|
||||||
|
case option
|
||||||
|
when :ttl
|
||||||
|
optional_tags+= "<ttl type='interger'>#{value}</ttl>"
|
||||||
|
when :active
|
||||||
|
optional_tags+= "<active>#{value}</active>"
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:body => %Q{<?xml version="1.0" encoding="UTF-8"?><zone><origin>#{origin}</origin><ttl type="integer">#{ttl}</ttl><active>#{active}</active></zone>},
|
:body => %Q{<?xml version="1.0" encoding="UTF-8"?><zone><origin>#{origin}</origin>#{optional_tags}</zone>},
|
||||||
:expects => 201,
|
:expects => 201,
|
||||||
:method => 'POST',
|
:method => 'POST',
|
||||||
:parser => Fog::Parsers::Slicehost::Compute::CreateZone.new,
|
:parser => Fog::Parsers::Slicehost::Compute::CreateZone.new,
|
||||||
|
|
|
@ -3,12 +3,12 @@ module Fog
|
||||||
class Compute
|
class Compute
|
||||||
class Real
|
class Real
|
||||||
|
|
||||||
# Delete a record from DNS zone
|
# Delete a record from the specified DNS zone
|
||||||
# ==== Parameters
|
# ==== Parameters
|
||||||
# * record_id<~Integer> - Id of DNS record to delete
|
# * record_id<~Integer> - Id of DNS record to delete
|
||||||
#
|
#
|
||||||
# ==== Returns
|
# ==== Returns
|
||||||
# * response<~Excon::Response>:
|
# * response<~Excon::Response>: - HTTP status code will be result
|
||||||
def delete_record(record_id)
|
def delete_record(record_id)
|
||||||
request(
|
request(
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
|
|
|
@ -3,26 +3,12 @@ module Fog
|
||||||
class Compute
|
class Compute
|
||||||
class Real
|
class Real
|
||||||
|
|
||||||
# Get list of slices
|
# Delete a given slice
|
||||||
# ==== Parameters
|
# ==== Parameters
|
||||||
# * flavor_id<~Integer> - Id of flavor to create slice with
|
# * slice_id<~Integer> - Id of slice to delete
|
||||||
# * image_id<~Integer> - Id of image to create slice with
|
|
||||||
# * name<~String> - Name of slice
|
|
||||||
#
|
#
|
||||||
# ==== Returns
|
# ==== Returns
|
||||||
# * response<~Excon::Response>:
|
# * response<~Excon::Response>: - HTTP status code is the return value
|
||||||
# * body<~Array>:
|
|
||||||
# * 'addresses'<~Array> - Ip addresses for the slice
|
|
||||||
# * 'backup-id'<~Integer> - Id of backup slice was booted from
|
|
||||||
# * 'bw-in'<~Integer> - Incoming bandwidth total for current billing cycle, in Gigabytes
|
|
||||||
# * 'bw-out'<~Integer> - Outgoing bandwidth total for current billing cycle, in Gigabytes
|
|
||||||
# * 'flavor-id'<~Integer> - Id of flavor slice was booted from
|
|
||||||
# * 'id'<~Integer> - Id of the slice
|
|
||||||
# * 'image-id'<~Integer> - Id of image slice was booted from
|
|
||||||
# * 'name'<~String> - Name of the slice
|
|
||||||
# * 'progress'<~Integer> - Progress of current action, in percentage
|
|
||||||
# * 'root-password'<~String> - Root password of slice
|
|
||||||
# * 'status'<~String> - Current status of the slice
|
|
||||||
def delete_slice(slice_id)
|
def delete_slice(slice_id)
|
||||||
request(
|
request(
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
|
|
|
@ -8,8 +8,7 @@ module Fog
|
||||||
# * zone_id<~Integer> - Id of zone to delete
|
# * zone_id<~Integer> - Id of zone to delete
|
||||||
#
|
#
|
||||||
# ==== Returns
|
# ==== Returns
|
||||||
# * response<~Excon::Response>:
|
# * response<~Excon::Response>: - HTTP status code will be result
|
||||||
# * body<~Array>:
|
|
||||||
def delete_zone(zone_id)
|
def delete_zone(zone_id)
|
||||||
request(
|
request(
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
|
|
|
@ -5,19 +5,18 @@ module Fog
|
||||||
|
|
||||||
require 'fog/slicehost/parsers/compute/get_record'
|
require 'fog/slicehost/parsers/compute/get_record'
|
||||||
|
|
||||||
# Get all the DNS records across all the DNS zones for this account
|
# Get an individual DNS record from the specified zone
|
||||||
#
|
#
|
||||||
# ==== Returns
|
# ==== Returns
|
||||||
# * response<~Excon::Response>:
|
# * response<~Excon::Response>:
|
||||||
# * body<~Array>:
|
# * body<~Hash>:
|
||||||
# * 'addresses'<~Array> - Ip addresses for the slice
|
# * 'record_type'<~String> - type of DNS record to create (A, CNAME, etc)
|
||||||
# * 'backup-id'<~Integer> - Id of backup slice was booted from
|
# * 'zone_id'<~Integer> - ID of the zone to update
|
||||||
# * 'flavor_id'<~Integer> - Id of flavor slice was booted from
|
# * 'name'<~String> - host name this DNS record is for
|
||||||
# * 'id'<~Integer> - Id of the slice
|
# * 'data'<~String> - data for the DNS record (ie for an A record, the IP address)
|
||||||
# * 'image-id'<~Integer> - Id of image slice was booted from
|
# * 'ttl'<~Integer> - time to live in seconds
|
||||||
# * 'name'<~String> - Name of the slice
|
# * 'active'<~String> - whether this record is active or not ('Y' or 'N')
|
||||||
# * 'progress'<~Integer> - Progress of current action, in percentage
|
# * 'aux'<~String> - extra data required by the record
|
||||||
# * 'status'<~String> - Current status of the slice
|
|
||||||
def get_record( record_id)
|
def get_record( record_id)
|
||||||
request(
|
request(
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
|
|
|
@ -13,10 +13,10 @@ module Fog
|
||||||
# ==== Returns
|
# ==== Returns
|
||||||
# * response<~Excon::Response>:
|
# * response<~Excon::Response>:
|
||||||
# * body<~Hash>:
|
# * body<~Hash>:
|
||||||
# * 'origin'<~String> - Name of zone details are being requested of
|
# * 'origin'<~String> - domain name to host (ie example.com)
|
||||||
# * 'id'<~Integer> - Id of the zone
|
# * 'id'<~Integer> - Id of the zone
|
||||||
# * 'ttl'<~Integer> - TimeToLive (ttl) for the zone
|
# * 'ttl'<~Integer> - TimeToLive (ttl) for the domain, in seconds (> 60)
|
||||||
# * 'active'<~String> - 'Y' or 'N' - if the zone is active or disabled
|
# * 'active'<~String> - whether zone is active in Slicehost DNS server - 'Y' or 'N'
|
||||||
def get_zone(zone_id)
|
def get_zone(zone_id)
|
||||||
request(
|
request(
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
|
|
|
@ -5,19 +5,15 @@ module Fog
|
||||||
|
|
||||||
require 'fog/slicehost/parsers/compute/get_zones'
|
require 'fog/slicehost/parsers/compute/get_zones'
|
||||||
|
|
||||||
# Get list of DNS zones
|
# Get list of all DNS zones hosted on Slicehost (for this account)
|
||||||
#
|
#
|
||||||
# ==== Returns
|
# ==== Returns
|
||||||
# * response<~Excon::Response>:
|
# * response<~Excon::Response>:
|
||||||
# * body<~Array>:
|
# * body<~Array>:
|
||||||
# * 'addresses'<~Array> - Ip addresses for the slice
|
# * 'origin'<~String> - domain name to host (ie example.com)
|
||||||
# * 'backup-id'<~Integer> - Id of backup slice was booted from
|
# * 'id'<~Integer> - Id of the zone
|
||||||
# * 'flavor_id'<~Integer> - Id of flavor slice was booted from
|
# * 'ttl'<~Integer> - TimeToLive (ttl) for the domain, in seconds (> 60)
|
||||||
# * 'id'<~Integer> - Id of the slice
|
# * 'active'<~String> - whether zone is active in Slicehost DNS server - 'Y' or 'N'
|
||||||
# * 'image-id'<~Integer> - Id of image slice was booted from
|
|
||||||
# * 'name'<~String> - Name of the slice
|
|
||||||
# * 'progress'<~Integer> - Progress of current action, in percentage
|
|
||||||
# * 'status'<~String> - Current status of the slice
|
|
||||||
def get_zones
|
def get_zones
|
||||||
request(
|
request(
|
||||||
:expects => 200,
|
:expects => 200,
|
||||||
|
|
Loading…
Add table
Reference in a new issue