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

[aws|elasticache] delete cache clusters

This commit is contained in:
Benton Roberts 2011-09-06 16:46:12 -04:00 committed by geemus
parent 47eea00ade
commit 351fc7c2f5
5 changed files with 53 additions and 14 deletions

View file

@ -10,7 +10,7 @@ module Fog
request_path 'fog/aws/requests/elasticache' request_path 'fog/aws/requests/elasticache'
request :create_cache_cluster request :create_cache_cluster
#request :delete_cache_cluster request :delete_cache_cluster
request :describe_cache_clusters request :describe_cache_clusters
#request :modify_cache_cluster #request :modify_cache_cluster
#request :reboot_cache_cluster #request :reboot_cache_cluster

View file

@ -0,0 +1,32 @@
module Fog
module AWS
class Elasticache
class Real
require 'fog/aws/parsers/elasticache/describe_cache_clusters'
# Deletes a Cache Cluster
#
# === Parameter (required):
# * CacheClusterId <~String> - The ID of the cache cluster to delete
# === Returns
# * response <~Excon::Response>:
# * body <~Hash>
def delete_cache_cluster(cluster_id)
request(
'Action' => 'DeleteCacheCluster',
'CacheClusterId' => cluster_id,
:parser => Fog::Parsers::AWS::Elasticache::DescribeCacheClusters.new
)
end
end
class Mock
def describe_cache_clusters
Fog::Mock.not_implemented
end
end
end
end
end

View file

@ -5,7 +5,7 @@ module Fog
require 'fog/aws/parsers/elasticache/describe_cache_clusters' require 'fog/aws/parsers/elasticache/describe_cache_clusters'
# Returns a list of CacheCluster descriptions # Returns a list of Cache Cluster descriptions
# #
# === Parameters # === Parameters
# * options <~Hash> (optional): # * options <~Hash> (optional):

View file

@ -44,16 +44,24 @@ Shindo.tests('AWS::Elasticache | cache cluster requests', ['aws', 'elasticache']
#cluster = AWS[:elasticache].clusters.get(cluster_id) #cluster = AWS[:elasticache].clusters.get(cluster_id)
#cluster.wait_for {ready?} #cluster.wait_for {ready?}
#
#tests( tests(
#'#delete_cache_security_group' '#delete_cache_security_group'
#).formats(AWS::Elasticache::Formats::SINGLE_CACHE_CLUSTER) do ).formats(AWS::Elasticache::Formats::CACHE_CLUSTER_RUNNING) do
# body = AWS[:elasticache].delete_cache_security_group(cluster_id).body body = AWS[:elasticache].delete_cache_cluster(cluster_id).body
#cluster = body['CacheCluster'] # make sure this particular cluster is in the returned list
#returns(cluster_id) { cluster['CacheClusterId'] } returns(true, "has #{cluster_id}") do
#returns('deleting') { cluster['CacheClusterStatus'] } body['CacheClusters'].any? do |cluster|
#body cluster['CacheClusterId'] == cluster_id
#end end
end
# now check that it reports itself as 'deleting'
cluster = body['CacheClusters'].find do |cluster|
cluster['CacheClusterId'] == cluster_id
end
returns('deleting') { cluster['CacheClusterStatus'] }
cluster
end
end end
tests('failure') do tests('failure') do

View file

@ -31,8 +31,7 @@ class AWS
} }
CACHE_CLUSTER_RUNNING = CACHE_CLUSTER.merge( CACHE_CLUSTER_RUNNING = CACHE_CLUSTER.merge(
'CacheClusterCreateTime' => DateTime, 'CacheClusterCreateTime' => DateTime,
'PreferredAvailabilityZone' => String, 'PreferredAvailabilityZone' => String
'CacheNodes' => Array
) )
CACHE_CLUSTER_MODIFIED = CACHE_CLUSTER_RUNNING.merge( CACHE_CLUSTER_MODIFIED = CACHE_CLUSTER_RUNNING.merge(
'NotificationConfiguration' => Hash, 'NotificationConfiguration' => Hash,