# File lib/fog/aws/elasticache.rb, line 47 def initialize(options={}) @use_iam_profile = options[:use_iam_profile] setup_credentials(options) options[:region] ||= 'us-east-1' @host = options[:host] || "elasticache.#{options[:region]}.amazonaws.com" @path = options[:path] || '/' @port = options[:port] || 443 @scheme = options[:scheme] || 'https' @connection = Fog::Connection.new( "#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent] ) end
creates a cache cluster
id <~String> - A unique cluster ID - 20 characters max.
options <~Hash> - All optional parameters should be set in this Hash:
:node_type <~String> - The size (flavor) of the cache Nodes
:security_group_names <~Array> - Array of Elasticache::SecurityGroup names
:num_nodes <~Integer> - The number of nodes in the Cluster
:auto_minor_version_upgrade <~TrueFalseClass>
:parameter_group_name <~String> - Name of the Cluster's ParameterGroup
:engine <~String> - The Cluster's caching software (memcached)
:engine_version <~String> - The Cluster's caching software version
:notification_topic_arn <~String> - Amazon SNS Resource Name
:port <~Integer> - The memcached port number
:preferred_availablility_zone <~String>
:preferred_maintenance_window <~String>
response <~Excon::Response>:
body <~Hash>
# File lib/fog/aws/requests/elasticache/create_cache_cluster.rb, line 27 def create_cache_cluster(id, options = {}) # Construct Cache Security Group parameters in the format: # CacheSecurityGroupNames.member.N => "security_group_name" group_names = options[:security_group_names] || ['default'] sec_group_params = group_names.inject({}) do |group_hash, name| index = group_names.index(name) + 1 group_hash["CacheSecurityGroupNames.member.#{index}"] = name group_hash end # Merge the Cache Security Group parameters with the normal options request(sec_group_params.merge( 'Action' => 'CreateCacheCluster', 'CacheClusterId' => id.strip, 'CacheNodeType' => options[:node_type] || 'cache.m1.large', 'Engine' => options[:engine] || 'memcached', 'NumCacheNodes' => options[:num_nodes] || 1, 'AutoMinorVersionUpgrade' => options[:auto_minor_version_upgrade], 'CacheParameterGroupName' => options[:parameter_group_name], 'EngineVersion' => options[:engine_version], 'NotificationTopicArn' => options[:notification_topic_arn], 'Port' => options[:port], 'PreferredAvailabilityZone' => options[:preferred_availablility_zone], 'PreferredMaintenanceWindow' => options[:preferred_maintenance_window], :parser => Fog::Parsers::AWS::Elasticache::SingleCacheCluster.new )) end
creates a cache parameter group
name <~String> - The name for the Cache Parameter Group
description <~String> - The description for the Cache Parameter Group
family <~String> - The description for the Cache Parameter Group
response <~Excon::Response>:
body <~Hash>
# File lib/fog/aws/requests/elasticache/create_cache_parameter_group.rb, line 18 def create_cache_parameter_group(name, description = name, family = 'memcached1.4') request({ 'Action' => 'CreateCacheParameterGroup', 'CacheParameterGroupName' => name, 'Description' => description, 'CacheParameterGroupFamily' => family, :parser => Fog::Parsers::AWS::Elasticache::SingleParameterGroup.new }) end
creates a cache security group
name <~String> - The name for the Cache Security Group
description <~String> - The description for the Cache Security Group
response <~Excon::Response>:
body <~Hash>
# File lib/fog/aws/requests/elasticache/create_cache_security_group.rb, line 16 def create_cache_security_group(name, description = name) request({ 'Action' => 'CreateCacheSecurityGroup', 'CacheSecurityGroupName' => name, 'Description' => description, :parser => Fog::Parsers::AWS::Elasticache::SingleSecurityGroup.new }) end
Deletes a Cache Cluster
id <~String> - The ID of the cache cluster to delete
response <~Excon::Response>:
body <~Hash>
# File lib/fog/aws/requests/elasticache/delete_cache_cluster.rb, line 15 def delete_cache_cluster(cluster_id) request( 'Action' => 'DeleteCacheCluster', 'CacheClusterId' => cluster_id, :parser => Fog::Parsers::AWS::Elasticache::DescribeCacheClusters.new ) end
deletes a cache parameter group
name <~String> - The name for the Cache Parameter Group
response <~Excon::Response>:
body <~Hash>
# File lib/fog/aws/requests/elasticache/delete_cache_parameter_group.rb, line 15 def delete_cache_parameter_group(name) request({ 'Action' => 'DeleteCacheParameterGroup', 'CacheParameterGroupName' => name, :parser => Fog::Parsers::AWS::Elasticache::Base.new }) end
deletes a cache security group
name <~String> - The name for the Cache Security Group
response <~Excon::Response>:
body <~Hash>
# File lib/fog/aws/requests/elasticache/delete_cache_security_group.rb, line 15 def delete_cache_security_group(name) request({ 'Action' => 'DeleteCacheSecurityGroup', 'CacheSecurityGroupName' => name, :parser => Fog::Parsers::AWS::Elasticache::Base.new }) end
Returns a list of Cache Cluster descriptions
id - The ID of an existing cache cluster
options <~Hash> (optional):
:marker <~String> - marker provided in the previous request
:max_records <~Integer> - the maximum number of records to include
:show_node_info <~Boolean> - whether to show node info
response <~Excon::Response>:
body <~Hash>
# File lib/fog/aws/requests/elasticache/describe_cache_clusters.rb, line 19 def describe_cache_clusters(id = nil, options = {}) request({ 'Action' => 'DescribeCacheClusters', 'CacheClusterId' => id, 'Marker' => options[:marker], 'MaxRecords' => options[:max_records], 'ShowCacheNodeInfo' => options[:show_node_info], :parser => Fog::Parsers::AWS::Elasticache::DescribeCacheClusters.new }) end
Returns a list of CacheParameterGroup descriptions
name <~String> - The name of an existing cache parameter group
options <~Hash> (optional):
:marker <~String> - marker provided in the previous request
:max_records <~Integer> - the maximum number of records to include
# File lib/fog/aws/requests/elasticache/describe_cache_parameter_groups.rb, line 15 def describe_cache_parameter_groups(name = nil, options = {}) request({ 'Action' => 'DescribeCacheParameterGroups', 'CacheParameterGroupName' => name, 'Marker' => options[:marker], 'MaxRecords' => options[:max_records], :parser => Fog::Parsers::AWS::Elasticache::DescribeParameterGroups.new }.merge(options)) end
Returns a list of CacheParameterGroup descriptions
name <~String> - The name of an existing cache parameter group
options <~Hash> (optional):
:marker <~String> - marker provided in the previous request
:max_records <~Integer> - the maximum number of records to include
:source <~String> - the parameter types to return.
# File lib/fog/aws/requests/elasticache/describe_cache_parameters.rb, line 16 def describe_cache_parameters(name = nil, options = {}) request({ 'Action' => 'DescribeCacheParameters', 'CacheParameterGroupName' => name, 'Marker' => options[:marker], 'MaxRecords' => options[:max_records], 'Source' => options[:source], :parser => Fog::Parsers::AWS::Elasticache::DescribeCacheParameters.new }) end
Returns a list of CacheSecurityGroup descriptions
name <~String> - The name of an existing cache security group
options <~Hash> (optional):
:marker <~String> - marker provided in the previous request
:max_records <~Integer> - the maximum number of records to include
# File lib/fog/aws/requests/elasticache/describe_cache_security_groups.rb, line 15 def describe_cache_security_groups(name = nil, options = {}) request({ 'Action' => 'DescribeCacheSecurityGroups', 'CacheSecurityGroupName' => name, 'Marker' => options[:marker], 'MaxRecords' => options[:max_records], :parser => Fog::Parsers::AWS::Elasticache::DescribeSecurityGroups.new }.merge(options)) end
Returns the default engine and system parameter information for the specified cache engine.
options <~Hash>:
:engine <~String> - the engine whose parameters are requested
:marker <~String> - marker provided in the previous request
:max_records <~Integer> - the maximum number of records to include
# File lib/fog/aws/requests/elasticache/describe_engine_default_parameters.rb, line 16 def describe_engine_default_parameters(options = {}) request({ 'Action' => 'DescribeEngineDefaultParameters', 'CacheParameterGroupFamily' => options[:engine] || 'memcached1.4', 'Marker' => options[:marker], 'MaxRecords' => options[:max_records], :parser => Fog::Parsers::AWS::Elasticache::DescribeEngineDefaultParameters.new }) end
Returns a list of service events
For more information see: docs.amazonwebservices.com/AmazonElastiCache/latest/APIReference/API_DescribeEvents.html
options <~Hash> (optional):
:start_time <~DateTime> - starting time for event records
:end_time <~DateTime> - ending time for event records
:duration <~Integer> - time span for event records
:marker <~String> - marker provided in the previous request
:max_records <~Integer> - the maximum number of records to include
:source_identifier <~String> - identifier of the event source
:source_type <~String> - event type, one of:
(cache-cluster | cache-parameter-group | cache-security-group)
response <~Excon::Response>:
body <~Hash>
# File lib/fog/aws/requests/elasticache/describe_events.rb, line 26 def describe_events(options = {}) request( 'Action' => 'DescribeEvents', 'StartTime' => options[:start_time], 'EndTime' => options[:end_time], 'Duration' => options[:duration], 'Marker' => options[:marker], 'MaxRecords' => options[:max_records], 'SourceIdentifier' => options[:source_identifier], 'SourceType' => options[:source_type], :parser => Fog::Parsers::AWS::Elasticache::EventListParser.new ) end
Describe all or specified reserved Elasticache nodes docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_DescribeReservedCacheNodes.html
ReservedCacheNodeId <~String> - ID of node to retrieve information for. If absent, information for all nodes is returned.
response<~Excon::Response>:
body<~Hash>:
# File lib/fog/aws/requests/elasticache/describe_reserved_cache_nodes.rb, line 15 def describe_reserved_cache_nodes(identifier=nil, opts={}) params = {} params['ReservedCacheNodeId'] = identifier if identifier if opts[:marker] params['Marker'] = opts[:marker] end if opts[:max_records] params['MaxRecords'] = opts[:max_records] end request({ 'Action' => 'DescribeReservedCacheNodes', :parser => Fog::Parsers::AWS::Elasticache::DescribeReservedCacheNodes.new }.merge(params)) end
Modifies an existing cache cluster Returns a cache cluster description
id <~String> - The ID of the existing cluster to be modified
options <~Hash> - All optional parameters should be set in this Hash:
:apply_immediately <~TrueFalseClass> - whether to apply changes now
:auto_minor_version_upgrade <~TrueFalseClass>
:num_nodes <~Integer> - The number of nodes in the Cluster
:nodes_to_remove <~Array> - Array of node IDs to delete
:security_group_names <~Array> - Array of Elasticache::SecurityGroup names
:parameter_group_name <~String> - Name of the Cluster's ParameterGroup
:engine_version <~String> - The Cluster's caching software version
:notification_topic_arn <~String> - Amazon SNS Resource Name
:notification_topic_status <~String> - Amazon SNS Topic status
:preferred_maintenance_window <~String>
response <~Excon::Response>:
body <~Hash>
# File lib/fog/aws/requests/elasticache/modify_cache_cluster.rb, line 28 def modify_cache_cluster(id, options = {}) # Construct Cache Security Group parameters in the format: # CacheSecurityGroupNames.member.N => "security_group_name" group_names = options[:security_group_names] || [] sec_group_params = group_names.inject({}) do |group_hash, name| index = group_names.index(name) + 1 group_hash["CacheSecurityGroupNames.member.#{index}"] = name group_hash end # Construct CacheNodeIdsToRemove parameters in the format: # CacheNodeIdsToRemove.member.N => "node_id" node_ids = options[:nodes_to_remove] || [] node_id_params = node_ids.inject({}) do |node_hash, node_id| index = node_ids.index(node_id) + 1 node_hash["CacheNodeIdsToRemove.member.#{index}"] = node_id node_hash end # Merge the Cache Security Group parameters with the normal options request(node_id_params.merge(sec_group_params.merge( 'Action' => 'ModifyCacheCluster', 'CacheClusterId' => id.strip, 'ApplyImmediately' => options[:apply_immediately], 'NumCacheNodes' => options[:num_nodes], 'AutoMinorVersionUpgrade' => options[:auto_minor_version_upgrade], 'CacheParameterGroupName' => options[:parameter_group_name], 'EngineVersion' => options[:engine_version], 'NotificationTopicArn' => options[:notification_topic_arn], 'NotificationTopicStatus' => options[:notification_topic_status], 'PreferredMaintenanceWindow' => options[:preferred_maintenance_window], :parser => Fog::Parsers::AWS::Elasticache::SingleCacheCluster.new ))) end
Modifies an existing cache parameter group Returns a the name of the modified parameter group
id <~String> - The ID of the parameter group to be modified
new_parameters <~Hash> - The parameters to modify, and their values
response <~Excon::Response>:
body <~Hash>
# File lib/fog/aws/requests/elasticache/modify_cache_parameter_group.rb, line 17 def modify_cache_parameter_group(id, new_parameters) # Construct Parameter Modifications in the format: # ParameterNameValues.member.N.ParameterName => "param_name" # ParameterNameValues.member.N.ParameterValue => "param_value" n = 0 # n is the parameter index parameter_changes = new_parameters.inject({}) do |new_args,pair| n += 1 new_args["ParameterNameValues.member.#{n}.ParameterName"] = pair[0] new_args["ParameterNameValues.member.#{n}.ParameterValue"] = pair[1] new_args end # Merge the Cache Security Group parameters with the normal options request(parameter_changes.merge( 'Action' => 'ModifyCacheParameterGroup', 'CacheParameterGroupName' => id, :parser => Fog::Parsers::AWS::Elasticache::ModifyParameterGroup.new )) end
Reboots some or all of an existing cache cluster's nodes Returns a cache cluster description
id <~String> - The ID of the existing cluster to be rebooted
nodes_to_reboot <~Array> - Array of node IDs to reboot
response <~Excon::Response>:
body <~Hash>
# File lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb, line 18 def reboot_cache_cluster(id, nodes_to_reboot) # Construct CacheNodeIdsToReboot parameters in the format: # CacheNodeIdsToReboot.member.N => "node_id" node_ids = nodes_to_reboot || [] node_id_params = node_ids.inject({}) do |node_hash, node_id| index = node_ids.index(node_id) + 1 node_hash["CacheNodeIdsToReboot.member.#{index}"] = node_id node_hash end # Merge the CacheNodeIdsToReboot parameters with the normal options request(node_id_params.merge( 'Action' => 'RebootCacheCluster', 'CacheClusterId' => id, :parser => Fog::Parsers::AWS::Elasticache::SingleCacheCluster.new )) end
# File lib/fog/aws/elasticache.rb, line 61 def reload @connection.reset end
Resets an existing cache parameter group Returns a the name of the modified parameter group
id <~String> - The ID of the parameter group to be modified
parameter_names <~Array> - The parameters to reset
response <~Excon::Response>:
body <~Hash>
# File lib/fog/aws/requests/elasticache/reset_cache_parameter_group.rb, line 18 def reset_cache_parameter_group(id, parameter_names = []) # Construct Parameter resets in the format: # ParameterNameValues.member.N => "param_name" parameter_changes = parameter_names.inject({}) do |new_args, param| index = parameter_names.index(param) + 1 new_args["ParameterNameValues.member.#{index}"] = param new_args end if parameter_changes.empty? parameter_changes = {'ResetAllParameters' => 'true'} end # Merge the Cache Security Group parameters with the normal options request(parameter_changes.merge( 'Action' => 'ResetCacheParameterGroup', 'CacheParameterGroupName' => id, :parser => Fog::Parsers::AWS::Elasticache::ResetParameterGroup.new )) end
Revoke ingress to a CacheSecurityGroup using EC2 Security Groups
name <~String> - The name of the cache security group
ec2_name <~String> - The name of the EC2 security group to revoke
ec2_owner_id <~String> - The AWS Account Number of the EC2 security group
response <~Excon::Response>:
body <~Hash>
# File lib/fog/aws/requests/elasticache/revoke_cache_security_group_ingress.rb, line 18 def revoke_cache_security_group_ingress(name, ec2_name, ec2_owner_id) request({ 'Action' => 'RevokeCacheSecurityGroupIngress', 'CacheSecurityGroupName' => name, 'EC2SecurityGroupName' => ec2_name, 'EC2SecurityGroupOwnerId' => ec2_owner_id, :parser => Fog::Parsers::AWS::Elasticache::SingleSecurityGroup.new }) end
Generated with the Darkfish Rdoc Generator 2.