mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[cdn] consolidate
This commit is contained in:
parent
39c30d44cf
commit
6ca767317a
18 changed files with 33 additions and 12 deletions
|
@ -8,6 +8,7 @@ module Fog
|
|||
|
||||
end
|
||||
|
||||
# FIXME: these should go away (force usage of Fog::[Compute, CDN, DNS, Storage] etc)
|
||||
require 'fog/aws'
|
||||
require 'fog/bluebox'
|
||||
require 'fog/brightbox'
|
||||
|
@ -23,5 +24,6 @@ require 'fog/vcloud'
|
|||
require 'fog/zerigo'
|
||||
|
||||
require 'fog/compute'
|
||||
require 'fog/cdn'
|
||||
require 'fog/dns'
|
||||
require 'fog/storage'
|
||||
|
|
|
@ -8,7 +8,7 @@ module Fog
|
|||
|
||||
extend Fog::Provider
|
||||
|
||||
service(:cdn, 'aws/cdn')
|
||||
service(:cdn, 'cdn/aws')
|
||||
service(:compute, 'compute/aws')
|
||||
service(:dns, 'dns/aws')
|
||||
service(:ec2, 'aws/ec2')
|
||||
|
|
19
lib/fog/cdn.rb
Normal file
19
lib/fog/cdn.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
module Fog
|
||||
class CDN
|
||||
|
||||
def self.new(attributes)
|
||||
attributes = attributes.dup # prevent delete from having side effects
|
||||
case provider = attributes.delete(:provider)
|
||||
when 'AWS'
|
||||
require 'fog/aws'
|
||||
Fog::AWS::CDN.new(attributes)
|
||||
when 'Rackspace'
|
||||
require 'fog/rackspace'
|
||||
Fog::Rackspace::CDN.new(attributes)
|
||||
else
|
||||
raise ArgumentError.new("#{provider} is not a recognized storage provider")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -5,9 +5,9 @@ module Fog
|
|||
requires :aws_access_key_id, :aws_secret_access_key
|
||||
recognizes :host, :path, :port, :scheme, :version, :persistent
|
||||
|
||||
model_path 'fog/aws/models/cdn'
|
||||
model_path 'fog/cdn/models/aws'
|
||||
|
||||
request_path 'fog/aws/requests/cdn'
|
||||
request_path 'fog/cdn/requests/aws'
|
||||
request 'delete_distribution'
|
||||
request 'get_distribution'
|
||||
request 'get_distribution_list'
|
|
@ -5,9 +5,9 @@ module Fog
|
|||
requires :rackspace_api_key, :rackspace_username
|
||||
recognizes :rackspace_auth_url, :persistent
|
||||
|
||||
model_path 'fog/rackspace/models/cdn'
|
||||
model_path 'fog/cdn/models/rackspace'
|
||||
|
||||
request_path 'fog/rackspace/requests/cdn'
|
||||
request_path 'fog/cdn/requests/rackspace'
|
||||
request :get_containers
|
||||
request :head_container
|
||||
request :put_container
|
|
@ -3,7 +3,7 @@ module Fog
|
|||
class CDN
|
||||
class Real
|
||||
|
||||
require 'fog/aws/parsers/cdn/distribution'
|
||||
require 'fog/cdn/parsers/aws/distribution'
|
||||
|
||||
# Get information about a distribution from CloudFront
|
||||
#
|
|
@ -3,7 +3,7 @@ module Fog
|
|||
class CDN
|
||||
class Real
|
||||
|
||||
require 'fog/aws/parsers/cdn/get_distribution_list'
|
||||
require 'fog/cdn/parsers/aws/get_distribution_list'
|
||||
|
||||
# List information about distributions in CloudFront
|
||||
#
|
|
@ -3,7 +3,7 @@ module Fog
|
|||
class CDN
|
||||
class Real
|
||||
|
||||
require 'fog/aws/parsers/cdn/distribution'
|
||||
require 'fog/cdn/parsers/aws/distribution'
|
||||
|
||||
# create a new distribution in CloudFront
|
||||
#
|
|
@ -3,7 +3,7 @@ module Fog
|
|||
class CDN
|
||||
class Real
|
||||
|
||||
require 'fog/aws/parsers/cdn/post_invalidation'
|
||||
require 'fog/cdn/parsers/aws/post_invalidation'
|
||||
|
||||
# List information about distributions in CloudFront
|
||||
#
|
|
@ -3,7 +3,7 @@ module Fog
|
|||
class CDN
|
||||
class Real
|
||||
|
||||
require 'fog/aws/parsers/cdn/distribution'
|
||||
require 'fog/cdn/parsers/aws/distribution'
|
||||
|
||||
# update a distribution in CloudFront
|
||||
#
|
|
@ -2,10 +2,10 @@ require File.join(File.dirname(__FILE__), 'core')
|
|||
|
||||
module Fog
|
||||
module Rackspace
|
||||
|
||||
|
||||
extend Fog::Provider
|
||||
|
||||
service(:cdn, 'rackspace/cdn')
|
||||
service(:cdn, 'cdn/rackspace')
|
||||
service(:compute, 'rackspace/compute')
|
||||
service(:files, 'rackspace/files')
|
||||
service(:servers, 'rackspace/servers')
|
||||
|
|
Loading…
Add table
Reference in a new issue