diff --git a/lib/fog/aws.rb b/lib/fog/aws.rb index 8e4b7bc630..1054c88fd8 100644 --- a/lib/fog/aws.rb +++ b/lib/fog/aws.rb @@ -5,10 +5,6 @@ require File.expand_path('../aws/version', __FILE__) module Fog - module CDN - autoload :AWS, File.expand_path('../aws/cdn', __FILE__) - end - module AWS extend Fog::Provider @@ -20,6 +16,7 @@ module AWS # Services autoload :AutoScaling, File.expand_path('../aws/auto_scaling', __FILE__) + autoload :CDN, File.expand_path('../aws/cdn', __FILE__) autoload :CloudFormation, File.expand_path('../aws/cloud_formation', __FILE__) autoload :CloudWatch, File.expand_path('../aws/cloud_watch', __FILE__) autoload :Compute, File.expand_path('../aws/compute', __FILE__) diff --git a/lib/fog/aws/cdn.rb b/lib/fog/aws/cdn.rb index d1ee356088..8129e781e6 100644 --- a/lib/fog/aws/cdn.rb +++ b/lib/fog/aws/cdn.rb @@ -1,6 +1,6 @@ module Fog - module CDN - class AWS < Fog::Service + module AWS + class CDN < Fog::Service extend Fog::AWS::CredentialFetcher::ServiceMethods requires :aws_access_key_id, :aws_secret_access_key @@ -200,4 +200,17 @@ def signature(params) end end end + + # @deprecated + module CDN + # @deprecated + class AWS < Fog::AWS::CDN + # @deprecated + # @overrides Fog::Service.new (from the fog-core gem) + def self.new(*) + Fog::Logger.deprecation 'Fog::CDN::AWS is deprecated, please use Fog::AWS::CDN.' + super + end + end + end end diff --git a/lib/fog/aws/models/cdn/distribution.rb b/lib/fog/aws/models/cdn/distribution.rb index d7e568c5dd..39b473b4bc 100644 --- a/lib/fog/aws/models/cdn/distribution.rb +++ b/lib/fog/aws/models/cdn/distribution.rb @@ -2,10 +2,10 @@ require 'fog/aws/models/cdn/distribution_helper' module Fog - module CDN - class AWS + module AWS + class CDN class Distribution < Fog::Model - include Fog::CDN::AWS::DistributionHelper + include Fog::AWS::CDN::DistributionHelper identity :id, :aliases => 'Id' @@ -33,7 +33,7 @@ def initialize(new_attributes = {}) def invalidations @invalidations ||= begin - Fog::CDN::AWS::Invalidations.new( + Fog::AWS::CDN::Invalidations.new( :distribution => self, :service => service ) diff --git a/lib/fog/aws/models/cdn/distribution_helper.rb b/lib/fog/aws/models/cdn/distribution_helper.rb index b815df0990..f1c54c1387 100644 --- a/lib/fog/aws/models/cdn/distribution_helper.rb +++ b/lib/fog/aws/models/cdn/distribution_helper.rb @@ -1,6 +1,6 @@ module Fog - module CDN - class AWS + module AWS + class CDN module DistributionHelper def destroy requires :identity, :etag, :caller_reference diff --git a/lib/fog/aws/models/cdn/distributions.rb b/lib/fog/aws/models/cdn/distributions.rb index 8346bc7e75..02a07967f3 100644 --- a/lib/fog/aws/models/cdn/distributions.rb +++ b/lib/fog/aws/models/cdn/distributions.rb @@ -2,12 +2,12 @@ require 'fog/aws/models/cdn/distributions_helper' module Fog - module CDN - class AWS + module AWS + class CDN class Distributions < Fog::Collection - include Fog::CDN::AWS::DistributionsHelper + include Fog::AWS::CDN::DistributionsHelper - model Fog::CDN::AWS::Distribution + model Fog::AWS::CDN::Distribution attribute :marker, :aliases => 'Marker' attribute :max_items, :aliases => 'MaxItems' diff --git a/lib/fog/aws/models/cdn/distributions_helper.rb b/lib/fog/aws/models/cdn/distributions_helper.rb index 4e497729c2..ac048871a7 100644 --- a/lib/fog/aws/models/cdn/distributions_helper.rb +++ b/lib/fog/aws/models/cdn/distributions_helper.rb @@ -1,6 +1,6 @@ module Fog - module CDN - class AWS + module AWS + class CDN module DistributionsHelper def all(options = {}) diff --git a/lib/fog/aws/models/cdn/invalidation.rb b/lib/fog/aws/models/cdn/invalidation.rb index 7727744937..cf4929ac15 100644 --- a/lib/fog/aws/models/cdn/invalidation.rb +++ b/lib/fog/aws/models/cdn/invalidation.rb @@ -1,6 +1,6 @@ module Fog - module CDN - class AWS + module AWS + class CDN class Invalidation < Fog::Model identity :id, :aliases => 'Id' diff --git a/lib/fog/aws/models/cdn/invalidations.rb b/lib/fog/aws/models/cdn/invalidations.rb index 2cc608d920..35adf1fc01 100644 --- a/lib/fog/aws/models/cdn/invalidations.rb +++ b/lib/fog/aws/models/cdn/invalidations.rb @@ -1,8 +1,8 @@ require 'fog/aws/models/cdn/invalidation' module Fog - module CDN - class AWS + module AWS + class CDN class Invalidations < Fog::Collection attribute :is_truncated, :aliases => ['IsTruncated'] attribute :max_items, :aliases => ['MaxItems'] @@ -11,7 +11,7 @@ class Invalidations < Fog::Collection attribute :distribution - model Fog::CDN::AWS::Invalidation + model Fog::AWS::CDN::Invalidation def all(options = {}) requires :distribution diff --git a/lib/fog/aws/models/cdn/streaming_distribution.rb b/lib/fog/aws/models/cdn/streaming_distribution.rb index fed23271a1..f86b86a252 100644 --- a/lib/fog/aws/models/cdn/streaming_distribution.rb +++ b/lib/fog/aws/models/cdn/streaming_distribution.rb @@ -2,10 +2,10 @@ require 'fog/aws/models/cdn/distribution_helper' module Fog - module CDN - class AWS + module AWS + class CDN class StreamingDistribution < Fog::Model - include Fog::CDN::AWS::DistributionHelper + include Fog::AWS::CDN::DistributionHelper identity :id, :aliases => 'Id' diff --git a/lib/fog/aws/models/cdn/streaming_distributions.rb b/lib/fog/aws/models/cdn/streaming_distributions.rb index 7e367f09a9..0408607300 100644 --- a/lib/fog/aws/models/cdn/streaming_distributions.rb +++ b/lib/fog/aws/models/cdn/streaming_distributions.rb @@ -2,12 +2,12 @@ require 'fog/aws/models/cdn/distributions_helper' module Fog - module CDN - class AWS + module AWS + class CDN class StreamingDistributions < Fog::Collection - include Fog::CDN::AWS::DistributionsHelper + include Fog::AWS::CDN::DistributionsHelper - model Fog::CDN::AWS::StreamingDistribution + model Fog::AWS::CDN::StreamingDistribution attribute :marker, :aliases => 'Marker' attribute :max_items, :aliases => 'MaxItems' diff --git a/lib/fog/aws/parsers/cdn/distribution.rb b/lib/fog/aws/parsers/cdn/distribution.rb index e9caa98904..4d31d2bee7 100644 --- a/lib/fog/aws/parsers/cdn/distribution.rb +++ b/lib/fog/aws/parsers/cdn/distribution.rb @@ -1,7 +1,7 @@ module Fog module Parsers - module CDN - module AWS + module AWS + module CDN class Distribution < Fog::Parsers::Base def reset @response = { 'DistributionConfig' => { 'CNAME' => [], 'Logging' => {}, 'TrustedSigners' => [] } } diff --git a/lib/fog/aws/parsers/cdn/get_distribution_list.rb b/lib/fog/aws/parsers/cdn/get_distribution_list.rb index fdd3df6d14..7c001e7447 100644 --- a/lib/fog/aws/parsers/cdn/get_distribution_list.rb +++ b/lib/fog/aws/parsers/cdn/get_distribution_list.rb @@ -1,7 +1,7 @@ module Fog module Parsers - module CDN - module AWS + module AWS + module CDN class GetDistributionList < Fog::Parsers::Base def reset @distribution_summary = { 'CNAME' => [], 'TrustedSigners' => [] } diff --git a/lib/fog/aws/parsers/cdn/get_invalidation.rb b/lib/fog/aws/parsers/cdn/get_invalidation.rb index 54d41811b7..ed7c26d47c 100644 --- a/lib/fog/aws/parsers/cdn/get_invalidation.rb +++ b/lib/fog/aws/parsers/cdn/get_invalidation.rb @@ -1,7 +1,7 @@ module Fog module Parsers - module CDN - module AWS + module AWS + module CDN class GetInvalidation < Fog::Parsers::Base def reset @response = { 'InvalidationBatch' => { 'Path' => [] } } diff --git a/lib/fog/aws/parsers/cdn/get_invalidation_list.rb b/lib/fog/aws/parsers/cdn/get_invalidation_list.rb index 44e425ef56..f147bb10c5 100644 --- a/lib/fog/aws/parsers/cdn/get_invalidation_list.rb +++ b/lib/fog/aws/parsers/cdn/get_invalidation_list.rb @@ -1,7 +1,7 @@ module Fog module Parsers - module CDN - module AWS + module AWS + module CDN class GetInvalidationList < Fog::Parsers::Base def reset @invalidation_summary = { } diff --git a/lib/fog/aws/parsers/cdn/get_streaming_distribution_list.rb b/lib/fog/aws/parsers/cdn/get_streaming_distribution_list.rb index 6b51c1b56b..ba402362a2 100644 --- a/lib/fog/aws/parsers/cdn/get_streaming_distribution_list.rb +++ b/lib/fog/aws/parsers/cdn/get_streaming_distribution_list.rb @@ -1,7 +1,7 @@ module Fog module Parsers - module CDN - module AWS + module AWS + module CDN class GetStreamingDistributionList < Fog::Parsers::Base def reset @distribution_summary = { 'CNAME' => [], 'TrustedSigners' => [] } diff --git a/lib/fog/aws/parsers/cdn/post_invalidation.rb b/lib/fog/aws/parsers/cdn/post_invalidation.rb index 1ad0efe3c9..f8849a0f6e 100644 --- a/lib/fog/aws/parsers/cdn/post_invalidation.rb +++ b/lib/fog/aws/parsers/cdn/post_invalidation.rb @@ -1,7 +1,7 @@ module Fog module Parsers - module CDN - module AWS + module AWS + module CDN class PostInvalidation < Fog::Parsers::Base def reset @response = { 'InvalidationBatch' => { 'Path' => [] } } diff --git a/lib/fog/aws/parsers/cdn/streaming_distribution.rb b/lib/fog/aws/parsers/cdn/streaming_distribution.rb index 709d5a61e4..d653622bfa 100644 --- a/lib/fog/aws/parsers/cdn/streaming_distribution.rb +++ b/lib/fog/aws/parsers/cdn/streaming_distribution.rb @@ -1,7 +1,7 @@ module Fog module Parsers + module AWS module CDN - module AWS class StreamingDistribution < Fog::Parsers::Base def reset diff --git a/lib/fog/aws/requests/cdn/delete_distribution.rb b/lib/fog/aws/requests/cdn/delete_distribution.rb index 01b9647506..f1bb467eac 100644 --- a/lib/fog/aws/requests/cdn/delete_distribution.rb +++ b/lib/fog/aws/requests/cdn/delete_distribution.rb @@ -1,6 +1,6 @@ module Fog - module CDN - class AWS + module AWS + class CDN class Real # Delete a distribution from CloudFront. # @@ -26,13 +26,13 @@ def delete_distribution(distribution_id, etag) if distribution if distribution['ETag'] != etag - Fog::CDN::AWS::Mock.error(:invalid_if_match_version) + Fog::AWS::CDN::Mock.error(:invalid_if_match_version) end unless distribution['DistributionConfig']['CallerReference'] - Fog::CDN::AWS::Mock.error(:illegal_update) + Fog::AWS::CDN::Mock.error(:illegal_update) end if distribution['DistributionConfig']['Enabled'] - Fog::CDN::AWS::Mock.error(:distribution_not_disabled) + Fog::AWS::CDN::Mock.error(:distribution_not_disabled) end self.data[:distributions].delete(distribution_id) @@ -43,7 +43,7 @@ def delete_distribution(distribution_id, etag) response.body = "x-amz-request-id: #{Fog::AWS::Mock.request_id}" response else - Fog::CDN::AWS::Mock.error(:no_such_distribution) + Fog::AWS::CDN::Mock.error(:no_such_distribution) end end end diff --git a/lib/fog/aws/requests/cdn/delete_streaming_distribution.rb b/lib/fog/aws/requests/cdn/delete_streaming_distribution.rb index 1437055227..fc62b0f076 100644 --- a/lib/fog/aws/requests/cdn/delete_streaming_distribution.rb +++ b/lib/fog/aws/requests/cdn/delete_streaming_distribution.rb @@ -1,6 +1,6 @@ module Fog - module CDN - class AWS + module AWS + class CDN class Real # Delete a streaming distribution from CloudFront. # @@ -26,13 +26,13 @@ def delete_streaming_distribution(distribution_id, etag) if distribution if distribution['ETag'] != etag - Fog::CDN::AWS::Mock.error(:invalid_if_match_version) + Fog::AWS::CDN::Mock.error(:invalid_if_match_version) end unless distribution['StreamingDistributionConfig']['CallerReference'] - Fog::CDN::AWS::Mock.error(:illegal_update) + Fog::AWS::CDN::Mock.error(:illegal_update) end if distribution['StreamingDistributionConfig']['Enabled'] - Fog::CDN::AWS::Mock.error(:distribution_not_disabled) + Fog::AWS::CDN::Mock.error(:distribution_not_disabled) end self.data[:streaming_distributions].delete(distribution_id) @@ -42,7 +42,7 @@ def delete_streaming_distribution(distribution_id, etag) response.body = "x-amz-request-id: #{Fog::AWS::Mock.request_id}" response else - Fog::CDN::AWS::Mock.error(:no_such_streaming_distribution) + Fog::AWS::CDN::Mock.error(:no_such_streaming_distribution) end end end diff --git a/lib/fog/aws/requests/cdn/get_distribution.rb b/lib/fog/aws/requests/cdn/get_distribution.rb index 5061cb7fd4..547cc17182 100644 --- a/lib/fog/aws/requests/cdn/get_distribution.rb +++ b/lib/fog/aws/requests/cdn/get_distribution.rb @@ -1,6 +1,6 @@ module Fog - module CDN - class AWS + module AWS + class CDN class Real require 'fog/aws/parsers/cdn/distribution' @@ -42,7 +42,7 @@ def get_distribution(distribution_id) :expects => 200, :idempotent => true, :method => 'GET', - :parser => Fog::Parsers::CDN::AWS::Distribution.new, + :parser => Fog::Parsers::AWS::CDN::Distribution.new, :path => "/distribution/#{distribution_id}" }) end @@ -54,14 +54,14 @@ def get_distribution(distribution_id) distribution = self.data[:distributions][distribution_id] unless distribution - Fog::CDN::AWS::Mock.error(:no_such_distribution) + Fog::AWS::CDN::Mock.error(:no_such_distribution) end if distribution['Status'] == 'InProgress' && (Time.now - Time.parse(distribution['LastModifiedTime']) >= Fog::Mock.delay * 2) distribution['Status'] = 'Deployed' end - etag = Fog::CDN::AWS::Mock.generic_id + etag = Fog::AWS::CDN::Mock.generic_id response.status = 200 response.body = { 'InProgressInvalidationBatches' => 0, diff --git a/lib/fog/aws/requests/cdn/get_distribution_list.rb b/lib/fog/aws/requests/cdn/get_distribution_list.rb index 80e28e0be1..b08af19dee 100644 --- a/lib/fog/aws/requests/cdn/get_distribution_list.rb +++ b/lib/fog/aws/requests/cdn/get_distribution_list.rb @@ -1,6 +1,6 @@ module Fog - module CDN - class AWS + module AWS + class CDN class Real require 'fog/aws/parsers/cdn/get_distribution_list' @@ -42,7 +42,7 @@ def get_distribution_list(options = {}) :expects => 200, :idempotent => true, :method => 'GET', - :parser => Fog::Parsers::CDN::AWS::GetDistributionList.new, + :parser => Fog::Parsers::AWS::CDN::GetDistributionList.new, :path => "/distribution", :query => options }) diff --git a/lib/fog/aws/requests/cdn/get_invalidation.rb b/lib/fog/aws/requests/cdn/get_invalidation.rb index f1ec500e25..e07b62db77 100644 --- a/lib/fog/aws/requests/cdn/get_invalidation.rb +++ b/lib/fog/aws/requests/cdn/get_invalidation.rb @@ -1,6 +1,6 @@ module Fog - module CDN - class AWS + module AWS + class CDN class Real require 'fog/aws/parsers/cdn/get_invalidation' @@ -24,7 +24,7 @@ def get_invalidation(distribution_id, invalidation_id) :expects => 200, :idempotent => true, :method => 'GET', - :parser => Fog::Parsers::CDN::AWS::GetInvalidation.new, + :parser => Fog::Parsers::AWS::CDN::GetInvalidation.new, :path => "/distribution/#{distribution_id}/invalidation/#{invalidation_id}" }) end @@ -34,12 +34,12 @@ class Mock def get_invalidation(distribution_id, invalidation_id) distribution = self.data[:distributions][distribution_id] unless distribution - Fog::CDN::AWS::Mock.error(:no_such_distribution) + Fog::AWS::CDN::Mock.error(:no_such_distribution) end invalidation = self.data[:invalidations][distribution_id][invalidation_id] unless invalidation - Fog::CDN::AWS::Mock.error(:no_such_invalidation) + Fog::AWS::CDN::Mock.error(:no_such_invalidation) end if invalidation['Status'] == 'InProgress' && (Time.now - Time.parse(invalidation['CreateTime']) >= Fog::Mock.delay * 2) diff --git a/lib/fog/aws/requests/cdn/get_invalidation_list.rb b/lib/fog/aws/requests/cdn/get_invalidation_list.rb index f0f4eb255e..999314974b 100644 --- a/lib/fog/aws/requests/cdn/get_invalidation_list.rb +++ b/lib/fog/aws/requests/cdn/get_invalidation_list.rb @@ -1,6 +1,6 @@ module Fog - module CDN - class AWS + module AWS + class CDN class Real require 'fog/aws/parsers/cdn/get_invalidation_list' @@ -27,7 +27,7 @@ def get_invalidation_list(distribution_id, options = {}) :expects => 200, :idempotent => true, :method => 'GET', - :parser => Fog::Parsers::CDN::AWS::GetInvalidationList.new, + :parser => Fog::Parsers::AWS::CDN::GetInvalidationList.new, :path => "/distribution/#{distribution_id}/invalidation", :query => options }) @@ -38,7 +38,7 @@ class Mock def get_invalidation_list(distribution_id, options = {}) distribution = self.data[:distributions][distribution_id] unless distribution - Fog::CDN::AWS::Mock.error(:no_such_distribution) + Fog::AWS::CDN::Mock.error(:no_such_distribution) end invalidations = (self.data[:invalidations][distribution_id] || {}).values diff --git a/lib/fog/aws/requests/cdn/get_streaming_distribution.rb b/lib/fog/aws/requests/cdn/get_streaming_distribution.rb index b212af16c2..19b688b5df 100644 --- a/lib/fog/aws/requests/cdn/get_streaming_distribution.rb +++ b/lib/fog/aws/requests/cdn/get_streaming_distribution.rb @@ -1,6 +1,6 @@ module Fog - module CDN - class AWS + module AWS + class CDN class Real require 'fog/aws/parsers/cdn/streaming_distribution' @@ -35,7 +35,7 @@ def get_streaming_distribution(distribution_id) :expects => 200, :idempotent => true, :method => 'GET', - :parser => Fog::Parsers::CDN::AWS::StreamingDistribution.new, + :parser => Fog::Parsers::AWS::CDN::StreamingDistribution.new, :path => "/streaming-distribution/#{distribution_id}" }) end @@ -47,14 +47,14 @@ def get_streaming_distribution(distribution_id) distribution = self.data[:streaming_distributions][distribution_id] unless distribution - Fog::CDN::AWS::Mock.error(:no_such_streaming_distribution) + Fog::AWS::CDN::Mock.error(:no_such_streaming_distribution) end if distribution['Status'] == 'InProgress' && (Time.now - Time.parse(distribution['LastModifiedTime']) >= Fog::Mock.delay * 2) distribution['Status'] = 'Deployed' end - etag = Fog::CDN::AWS::Mock.generic_id + etag = Fog::AWS::CDN::Mock.generic_id response.status = 200 response.body = distribution.reject { |k,v| k == 'ETag' } diff --git a/lib/fog/aws/requests/cdn/get_streaming_distribution_list.rb b/lib/fog/aws/requests/cdn/get_streaming_distribution_list.rb index 806de70baa..b07022f1dd 100644 --- a/lib/fog/aws/requests/cdn/get_streaming_distribution_list.rb +++ b/lib/fog/aws/requests/cdn/get_streaming_distribution_list.rb @@ -1,6 +1,6 @@ module Fog - module CDN - class AWS + module AWS + class CDN class Real require 'fog/aws/parsers/cdn/get_streaming_distribution_list' @@ -42,7 +42,7 @@ def get_streaming_distribution_list(options = {}) :expects => 200, :idempotent => true, :method => 'GET', - :parser => Fog::Parsers::CDN::AWS::GetStreamingDistributionList.new, + :parser => Fog::Parsers::AWS::CDN::GetStreamingDistributionList.new, :path => "/streaming-distribution", :query => options }) diff --git a/lib/fog/aws/requests/cdn/post_distribution.rb b/lib/fog/aws/requests/cdn/post_distribution.rb index 98b8efd5ef..e9376aa78c 100644 --- a/lib/fog/aws/requests/cdn/post_distribution.rb +++ b/lib/fog/aws/requests/cdn/post_distribution.rb @@ -1,6 +1,6 @@ module Fog - module CDN - class AWS + module AWS + class CDN class Real require 'fog/aws/parsers/cdn/distribution' @@ -77,7 +77,7 @@ def post_distribution(options = {}) :headers => { 'Content-Type' => 'text/xml' }, :idempotent => true, :method => 'POST', - :parser => Fog::Parsers::CDN::AWS::Distribution.new, + :parser => Fog::Parsers::AWS::CDN::Distribution.new, :path => "/distribution" }) end @@ -88,7 +88,7 @@ class Mock def post_distribution(options = {}) if self.data[:distributions].values.any? { |d| (d['CNAME'] & (options['CNAME']||[])).empty? } - Fog::CDN::AWS::Mock.error(:invalid_argument, 'CNAME is already in use') + Fog::AWS::CDN::Mock.error(:invalid_argument, 'CNAME is already in use') end response = Excon::Response.new @@ -96,10 +96,10 @@ def post_distribution(options = {}) response.status = 201 options['CallerReference'] = Time.now.to_i.to_s - dist_id = Fog::CDN::AWS::Mock.distribution_id + dist_id = Fog::AWS::CDN::Mock.distribution_id distribution = { - 'DomainName' => Fog::CDN::AWS::Mock.domain_name, + 'DomainName' => Fog::AWS::CDN::Mock.domain_name, 'Id' => dist_id, 'Status' => 'InProgress', 'LastModifiedTime' => Time.now.utc.iso8601, diff --git a/lib/fog/aws/requests/cdn/post_invalidation.rb b/lib/fog/aws/requests/cdn/post_invalidation.rb index 36bef96f69..f3abde0404 100644 --- a/lib/fog/aws/requests/cdn/post_invalidation.rb +++ b/lib/fog/aws/requests/cdn/post_invalidation.rb @@ -1,6 +1,6 @@ module Fog - module CDN - class AWS + module AWS + class CDN class Real require 'fog/aws/parsers/cdn/post_invalidation' @@ -35,7 +35,7 @@ def post_invalidation(distribution_id, paths, caller_reference = Time.now.to_i.t :headers => {'Content-Type' => 'text/xml'}, :idempotent => true, :method => 'POST', - :parser => Fog::Parsers::CDN::AWS::PostInvalidation.new, + :parser => Fog::Parsers::AWS::CDN::PostInvalidation.new, :path => "/distribution/#{distribution_id}/invalidation" }) end @@ -45,7 +45,7 @@ class Mock def post_invalidation(distribution_id, paths, caller_reference = Time.now.to_i.to_s) distribution = self.data[:distributions][distribution_id] if distribution - invalidation_id = Fog::CDN::AWS::Mock.distribution_id + invalidation_id = Fog::AWS::CDN::Mock.distribution_id invalidation = { 'Id' => invalidation_id, 'Status' => 'InProgress', @@ -66,7 +66,7 @@ def post_invalidation(distribution_id, paths, caller_reference = Time.now.to_i.t response.body = invalidation response else - Fog::CDN::AWS::Mock.error(:no_such_distribution) + Fog::AWS::CDN::Mock.error(:no_such_distribution) end end end diff --git a/lib/fog/aws/requests/cdn/post_streaming_distribution.rb b/lib/fog/aws/requests/cdn/post_streaming_distribution.rb index 4477a2a893..ed1252dd00 100644 --- a/lib/fog/aws/requests/cdn/post_streaming_distribution.rb +++ b/lib/fog/aws/requests/cdn/post_streaming_distribution.rb @@ -1,6 +1,6 @@ module Fog - module CDN - class AWS + module AWS + class CDN class Real require 'fog/aws/parsers/cdn/streaming_distribution' @@ -64,7 +64,7 @@ def post_streaming_distribution(options = {}) :headers => { 'Content-Type' => 'text/xml' }, :idempotent => true, :method => 'POST', - :parser => Fog::Parsers::CDN::AWS::StreamingDistribution.new, + :parser => Fog::Parsers::AWS::CDN::StreamingDistribution.new, :path => "/streaming-distribution" }) end @@ -75,7 +75,7 @@ class Mock def post_streaming_distribution(options = {}) if self.data[:streaming_distributions].values.any? { |d| (d['CNAME'] & (options['CNAME']||[])).empty? } - Fog::CDN::AWS::Mock.error(:invalid_argument, 'CNAME is already in use') + Fog::AWS::CDN::Mock.error(:invalid_argument, 'CNAME is already in use') end response = Excon::Response.new @@ -83,10 +83,10 @@ def post_streaming_distribution(options = {}) response.status = 201 options['CallerReference'] = Time.now.to_i.to_s - dist_id = Fog::CDN::AWS::Mock.distribution_id + dist_id = Fog::AWS::CDN::Mock.distribution_id distribution = { - 'DomainName' => Fog::CDN::AWS::Mock.domain_name, + 'DomainName' => Fog::AWS::CDN::Mock.domain_name, 'Id' => dist_id, 'Status' => 'InProgress', 'LastModifiedTime' => Time.now.utc.iso8601, diff --git a/lib/fog/aws/requests/cdn/put_distribution_config.rb b/lib/fog/aws/requests/cdn/put_distribution_config.rb index 71d8286316..0f89d0beaa 100644 --- a/lib/fog/aws/requests/cdn/put_distribution_config.rb +++ b/lib/fog/aws/requests/cdn/put_distribution_config.rb @@ -1,6 +1,6 @@ module Fog - module CDN - class AWS + module AWS + class CDN class Real require 'fog/aws/parsers/cdn/distribution' @@ -80,7 +80,7 @@ def put_distribution_config(distribution_id, etag, options = {}) }, :idempotent => true, :method => 'PUT', - :parser => Fog::Parsers::CDN::AWS::Distribution.new, + :parser => Fog::Parsers::AWS::CDN::Distribution.new, :path => "/distribution/#{distribution_id}/config" }) end @@ -92,10 +92,10 @@ def put_distribution_config(distribution_id, etag, options = {}) if distribution if distribution['ETag'] != etag - Fog::CDN::AWS::Mock.error(:invalid_if_match_version) + Fog::AWS::CDN::Mock.error(:invalid_if_match_version) end unless distribution['DistributionConfig']['CallerReference'] - Fog::CDN::AWS::Mock.error(:illegal_update) + Fog::AWS::CDN::Mock.error(:illegal_update) end distribution['DistributionConfig'].merge!(options) @@ -103,11 +103,11 @@ def put_distribution_config(distribution_id, etag, options = {}) response = Excon::Response.new response.status = 200 - response.headers['ETag'] = Fog::CDN::AWS::Mock.generic_id + response.headers['ETag'] = Fog::AWS::CDN::Mock.generic_id response.body = distribution.merge({ 'LastModifiedTime' => Time.now.utc.iso8601 }).reject{ |k,v| k == 'ETag' } response else - Fog::CDN::AWS::Mock.error(:no_such_distribution) + Fog::AWS::CDN::Mock.error(:no_such_distribution) end end end diff --git a/lib/fog/aws/requests/cdn/put_streaming_distribution_config.rb b/lib/fog/aws/requests/cdn/put_streaming_distribution_config.rb index bb6d2a5979..cc477b6254 100644 --- a/lib/fog/aws/requests/cdn/put_streaming_distribution_config.rb +++ b/lib/fog/aws/requests/cdn/put_streaming_distribution_config.rb @@ -1,6 +1,6 @@ module Fog - module CDN - class AWS + module AWS + class CDN class Real require 'fog/aws/parsers/cdn/streaming_distribution' @@ -69,7 +69,7 @@ def put_streaming_distribution_config(distribution_id, etag, options = {}) }, :idempotent => true, :method => 'PUT', - :parser => Fog::Parsers::CDN::AWS::StreamingDistribution.new, + :parser => Fog::Parsers::AWS::CDN::StreamingDistribution.new, :path => "/streaming-distribution/#{distribution_id}/config" }) end @@ -81,10 +81,10 @@ def put_streaming_distribution_config(distribution_id, etag, options = {}) if distribution if distribution['ETag'] != etag - Fog::CDN::AWS::Mock.error(:invalid_if_match_version) + Fog::AWS::CDN::Mock.error(:invalid_if_match_version) end unless distribution['StreamingDistributionConfig']['CallerReference'] - Fog::CDN::AWS::Mock.error(:illegal_update) + Fog::AWS::CDN::Mock.error(:illegal_update) end distribution['StreamingDistributionConfig'].merge!(options) @@ -92,11 +92,11 @@ def put_streaming_distribution_config(distribution_id, etag, options = {}) response = Excon::Response.new response.status = 200 - response.headers['ETag'] = Fog::CDN::AWS::Mock.generic_id + response.headers['ETag'] = Fog::AWS::CDN::Mock.generic_id response.body = distribution.merge({ 'LastModifiedTime' => Time.now.utc.iso8601 }).reject{ |k,v| k == 'ETag' } response else - Fog::CDN::AWS::Mock.error(:no_such_streaming_distribution) + Fog::AWS::CDN::Mock.error(:no_such_streaming_distribution) end end end diff --git a/lib/fog/aws/service_mapper.rb b/lib/fog/aws/service_mapper.rb index a8085c22b3..5ce1efa0b0 100644 --- a/lib/fog/aws/service_mapper.rb +++ b/lib/fog/aws/service_mapper.rb @@ -14,7 +14,7 @@ def self.class_for(key) when :beanstalk Fog::AWS::ElasticBeanstalk when :cdn - Fog::CDN::AWS + Fog::AWS::CDN when :cloud_formation Fog::AWS::CloudFormation when :cloud_watch @@ -126,4 +126,4 @@ def self.services end end end -end \ No newline at end of file +end