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:
parent
47eea00ade
commit
351fc7c2f5
5 changed files with 53 additions and 14 deletions
|
@ -10,7 +10,7 @@ module Fog
|
|||
request_path 'fog/aws/requests/elasticache'
|
||||
|
||||
request :create_cache_cluster
|
||||
#request :delete_cache_cluster
|
||||
request :delete_cache_cluster
|
||||
request :describe_cache_clusters
|
||||
#request :modify_cache_cluster
|
||||
#request :reboot_cache_cluster
|
||||
|
|
32
lib/fog/aws/requests/elasticache/delete_cache_cluster.rb
Normal file
32
lib/fog/aws/requests/elasticache/delete_cache_cluster.rb
Normal 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
|
|
@ -5,7 +5,7 @@ module Fog
|
|||
|
||||
require 'fog/aws/parsers/elasticache/describe_cache_clusters'
|
||||
|
||||
# Returns a list of CacheCluster descriptions
|
||||
# Returns a list of Cache Cluster descriptions
|
||||
#
|
||||
# === Parameters
|
||||
# * options <~Hash> (optional):
|
||||
|
|
|
@ -44,16 +44,24 @@ Shindo.tests('AWS::Elasticache | cache cluster requests', ['aws', 'elasticache']
|
|||
|
||||
#cluster = AWS[:elasticache].clusters.get(cluster_id)
|
||||
#cluster.wait_for {ready?}
|
||||
#
|
||||
#tests(
|
||||
#'#delete_cache_security_group'
|
||||
#).formats(AWS::Elasticache::Formats::SINGLE_CACHE_CLUSTER) do
|
||||
# body = AWS[:elasticache].delete_cache_security_group(cluster_id).body
|
||||
#cluster = body['CacheCluster']
|
||||
#returns(cluster_id) { cluster['CacheClusterId'] }
|
||||
#returns('deleting') { cluster['CacheClusterStatus'] }
|
||||
#body
|
||||
#end
|
||||
|
||||
tests(
|
||||
'#delete_cache_security_group'
|
||||
).formats(AWS::Elasticache::Formats::CACHE_CLUSTER_RUNNING) do
|
||||
body = AWS[:elasticache].delete_cache_cluster(cluster_id).body
|
||||
# make sure this particular cluster is in the returned list
|
||||
returns(true, "has #{cluster_id}") do
|
||||
body['CacheClusters'].any? do |cluster|
|
||||
cluster['CacheClusterId'] == cluster_id
|
||||
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
|
||||
|
||||
tests('failure') do
|
||||
|
|
|
@ -31,8 +31,7 @@ class AWS
|
|||
}
|
||||
CACHE_CLUSTER_RUNNING = CACHE_CLUSTER.merge(
|
||||
'CacheClusterCreateTime' => DateTime,
|
||||
'PreferredAvailabilityZone' => String,
|
||||
'CacheNodes' => Array
|
||||
'PreferredAvailabilityZone' => String
|
||||
)
|
||||
CACHE_CLUSTER_MODIFIED = CACHE_CLUSTER_RUNNING.merge(
|
||||
'NotificationConfiguration' => Hash,
|
||||
|
|
Loading…
Reference in a new issue