Method: Fog::AWS::Elasticache::Mock#create_cache_cluster

Defined in:
lib/fog/aws/requests/elasticache/create_cache_cluster.rb

#create_cache_cluster(id, options = {}) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/fog/aws/requests/elasticache/create_cache_cluster.rb', line 56

def create_cache_cluster(id, options = {})
  response        = Excon::Response.new
  cluster         = { # create an in-memory representation of this cluster
    'CacheClusterId'  => id.strip,
    'NumCacheNodes'   => options[:num_nodes]      || 1,
    'CacheNodeType'   => options[:node_type]      || 'cache.m1.large',
    'Engine'          => options[:engine]         || 'memcached',
    'EngineVersion'   => options[:engine_version] || '1.4.5',
    'CacheClusterStatus'  => 'available',
    'CacheNodes'          => create_cache_nodes(id.strip, options[:num_nodes]),
    'CacheSecurityGroups' => [],
    'CacheParameterGroup' => { 'CacheParameterGroupName' =>
        options[:parameter_group_name] || 'default.memcached1.4' },
    'PendingModifiedValues'       => {},
    'AutoMinorVersionUpgrade'     =>
      options[:auto_minor_version_upgrade]    || 'true',
    'PreferredMaintenanceWindow'  =>
      options[:preferred_maintenance_window]  || 'sun:05:00-sun:09:00',
  }
  self.data[:clusters][id] = cluster  # store the in-memory cluster
  response.body = {
    'CacheCluster' => cluster.merge({'CacheClusterStatus' => 'creating'}),
    'ResponseMetadata' => { 'RequestId' => Fog::AWS::Mock.request_id }
  }
  response
end