Class: Fog::AWS::Elasticache::Real
- Inherits:
-
Object
- Object
- Fog::AWS::Elasticache::Real
- Includes:
- CredentialFetcher::ConnectionMethods
- Defined in:
- lib/fog/aws/elasticache.rb,
lib/fog/aws/requests/elasticache/describe_events.rb,
lib/fog/aws/requests/elasticache/create_cache_cluster.rb,
lib/fog/aws/requests/elasticache/delete_cache_cluster.rb,
lib/fog/aws/requests/elasticache/modify_cache_cluster.rb,
lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb,
lib/fog/aws/requests/elasticache/describe_cache_clusters.rb,
lib/fog/aws/requests/elasticache/describe_cache_parameters.rb,
lib/fog/aws/requests/elasticache/create_cache_security_group.rb,
lib/fog/aws/requests/elasticache/delete_cache_security_group.rb,
lib/fog/aws/requests/elasticache/reset_cache_parameter_group.rb,
lib/fog/aws/requests/elasticache/create_cache_parameter_group.rb,
lib/fog/aws/requests/elasticache/delete_cache_parameter_group.rb,
lib/fog/aws/requests/elasticache/modify_cache_parameter_group.rb,
lib/fog/aws/requests/elasticache/describe_cache_security_groups.rb,
lib/fog/aws/requests/elasticache/describe_cache_parameter_groups.rb,
lib/fog/aws/requests/elasticache/describe_engine_default_parameters.rb,
lib/fog/aws/requests/elasticache/revoke_cache_security_group_ingress.rb,
lib/fog/aws/requests/elasticache/authorize_cache_security_group_ingress.rb
Instance Method Summary collapse
-
#authorize_cache_security_group_ingress(name, ec2_name, ec2_owner_id) ⇒ Object
Authorize ingress to a CacheSecurityGroup using EC2 Security Groups.
-
#create_cache_cluster(id, options = {}) ⇒ Object
creates a cache cluster.
-
#create_cache_parameter_group(name, description = name, family = 'memcached1.4') ⇒ Object
creates a cache parameter group.
-
#create_cache_security_group(name, description = name) ⇒ Object
creates a cache security group.
-
#delete_cache_cluster(cluster_id) ⇒ Object
Deletes a Cache Cluster.
-
#delete_cache_parameter_group(name) ⇒ Object
deletes a cache parameter group.
-
#delete_cache_security_group(name) ⇒ Object
deletes a cache security group.
-
#describe_cache_clusters(id = nil, options = {}) ⇒ Object
Returns a list of Cache Cluster descriptions.
-
#describe_cache_parameter_groups(name = nil, options = {}) ⇒ Object
Returns a list of CacheParameterGroup descriptions.
-
#describe_cache_parameters(name = nil, options = {}) ⇒ Object
Returns a list of CacheParameterGroup descriptions.
-
#describe_cache_security_groups(name = nil, options = {}) ⇒ Object
Returns a list of CacheSecurityGroup descriptions.
-
#describe_engine_default_parameters(options = {}) ⇒ Object
Returns the default engine and system parameter information for the specified cache engine.
-
#describe_events(options = {}) ⇒ Object
Returns a list of service events.
-
#initialize(options = {}) ⇒ Real
constructor
A new instance of Real.
-
#modify_cache_cluster(id, options = {}) ⇒ Object
Modifies an existing cache cluster Returns a cache cluster description.
-
#modify_cache_parameter_group(id, new_parameters) ⇒ Object
Modifies an existing cache parameter group Returns a the name of the modified parameter group.
-
#reboot_cache_cluster(id, nodes_to_reboot) ⇒ Object
Reboots some or all of an existing cache cluster’s nodes Returns a cache cluster description.
- #reload ⇒ Object
-
#reset_cache_parameter_group(id, parameter_names = []) ⇒ Object
Resets an existing cache parameter group Returns a the name of the modified parameter group.
-
#revoke_cache_security_group_ingress(name, ec2_name, ec2_owner_id) ⇒ Object
Revoke ingress to a CacheSecurityGroup using EC2 Security Groups.
Methods included from CredentialFetcher::ConnectionMethods
#refresh_credentials_if_expired
Constructor Details
#initialize(options = {}) ⇒ Real
Returns a new instance of Real.
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/fog/aws/elasticache.rb', line 46 def initialize(={}) @use_iam_profile = [:use_iam_profile] setup_credentials() [:region] ||= 'us-east-1' @host = [:host] || "elasticache.#{[:region]}.amazonaws.com" @path = [:path] || '/' @port = [:port] || 443 @scheme = [:scheme] || 'https' @connection = Fog::Connection.new( "#{@scheme}://#{@host}:#{@port}#{@path}", [:persistent] ) end |
Instance Method Details
#authorize_cache_security_group_ingress(name, ec2_name, ec2_owner_id) ⇒ Object
Authorize ingress to a CacheSecurityGroup using EC2 Security Groups
Parameters
-
name <~String> - The name of the cache security group
-
ec2_name <~String> - The name of the EC2 security group to authorize
-
ec2_owner_id <~String> - The AWS Account Number of the EC2 security group
Returns
-
response <~Excon::Response>:
-
body <~Hash>
-
17 18 19 20 21 22 23 24 25 |
# File 'lib/fog/aws/requests/elasticache/authorize_cache_security_group_ingress.rb', line 17 def (name, ec2_name, ec2_owner_id) request({ 'Action' => 'AuthorizeCacheSecurityGroupIngress', 'CacheSecurityGroupName' => name, 'EC2SecurityGroupName' => ec2_name, 'EC2SecurityGroupOwnerId' => ec2_owner_id, :parser => Fog::Parsers::AWS::Elasticache::SingleSecurityGroup.new }) end |
#create_cache_cluster(id, options = {}) ⇒ Object
creates a cache cluster
Required Parameters
-
id <~String> - A unique cluster ID - 20 characters max.
Optional Parameters
-
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>
-
Returns
-
response <~Excon::Response>:
-
body <~Hash>
-
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/fog/aws/requests/elasticache/create_cache_cluster.rb', line 27 def create_cache_cluster(id, = {}) # Construct Cache Security Group parameters in the format: # CacheSecurityGroupNames.member.N => "security_group_name" group_names = [: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' => [:node_type] || 'cache.m1.large', 'Engine' => [:engine] || 'memcached', 'NumCacheNodes' => [:num_nodes] || 1, 'AutoMinorVersionUpgrade' => [:auto_minor_version_upgrade], 'CacheParameterGroupName' => [:parameter_group_name], 'EngineVersion' => [:engine_version], 'NotificationTopicArn' => [:notification_topic_arn], 'Port' => [:port], 'PreferredAvailabilityZone' => [:preferred_availablility_zone], 'PreferredMaintenanceWindow' => [:preferred_maintenance_window], :parser => Fog::Parsers::AWS::Elasticache::SingleCacheCluster.new )) end |
#create_cache_parameter_group(name, description = name, family = 'memcached1.4') ⇒ Object
creates a cache parameter group
Parameters
-
name <~String> - The name for the Cache Parameter Group
Optional Parameters
-
description <~String> - The description for the Cache Parameter Group
-
family <~String> - The description for the Cache Parameter Group
Returns
-
response <~Excon::Response>:
-
body <~Hash>
-
18 19 20 21 22 23 24 25 26 |
# 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 |
#create_cache_security_group(name, description = name) ⇒ Object
creates a cache security group
Parameters
-
name <~String> - The name for the Cache Security Group
-
description <~String> - The description for the Cache Security Group
Returns
-
response <~Excon::Response>:
-
body <~Hash>
-
16 17 18 19 20 21 22 23 |
# 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 |
#delete_cache_cluster(cluster_id) ⇒ Object
Deletes a Cache Cluster
Parameter (required):
-
id <~String> - The ID of the cache cluster to delete
Returns
-
response <~Excon::Response>:
-
body <~Hash>
-
15 16 17 18 19 20 21 |
# 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 |
#delete_cache_parameter_group(name) ⇒ Object
deletes a cache parameter group
Parameters
-
name <~String> - The name for the Cache Parameter Group
Returns
-
response <~Excon::Response>:
-
body <~Hash>
-
15 16 17 18 19 20 21 |
# 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 |
#delete_cache_security_group(name) ⇒ Object
deletes a cache security group
Parameters
-
name <~String> - The name for the Cache Security Group
Returns
-
response <~Excon::Response>:
-
body <~Hash>
-
15 16 17 18 19 20 21 |
# 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 |
#describe_cache_clusters(id = nil, options = {}) ⇒ Object
Returns a list of Cache Cluster descriptions
Parameters (optional)
-
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
Returns
-
response <~Excon::Response>:
-
body <~Hash>
-
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fog/aws/requests/elasticache/describe_cache_clusters.rb', line 19 def describe_cache_clusters(id = nil, = {}) request({ 'Action' => 'DescribeCacheClusters', 'CacheClusterId' => id, 'Marker' => [:marker], 'MaxRecords' => [:max_records], 'ShowCacheNodeInfo' => [:show_node_info], :parser => Fog::Parsers::AWS::Elasticache::DescribeCacheClusters.new }) end |
#describe_cache_parameter_groups(name = nil, options = {}) ⇒ Object
Returns a list of CacheParameterGroup descriptions
Parameters (optional)
-
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
15 16 17 18 19 20 21 22 23 |
# File 'lib/fog/aws/requests/elasticache/describe_cache_parameter_groups.rb', line 15 def describe_cache_parameter_groups(name = nil, = {}) request({ 'Action' => 'DescribeCacheParameterGroups', 'CacheParameterGroupName' => name, 'Marker' => [:marker], 'MaxRecords' => [:max_records], :parser => Fog::Parsers::AWS::Elasticache::DescribeParameterGroups.new }.merge()) end |
#describe_cache_parameters(name = nil, options = {}) ⇒ Object
Returns a list of CacheParameterGroup descriptions
Parameters (optional)
-
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.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fog/aws/requests/elasticache/describe_cache_parameters.rb', line 16 def describe_cache_parameters(name = nil, = {}) request({ 'Action' => 'DescribeCacheParameters', 'CacheParameterGroupName' => name, 'Marker' => [:marker], 'MaxRecords' => [:max_records], 'Source' => [:source], :parser => Fog::Parsers::AWS::Elasticache::DescribeCacheParameters.new }) end |
#describe_cache_security_groups(name = nil, options = {}) ⇒ Object
Returns a list of CacheSecurityGroup descriptions
Parameters (optional)
-
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
15 16 17 18 19 20 21 22 23 |
# File 'lib/fog/aws/requests/elasticache/describe_cache_security_groups.rb', line 15 def describe_cache_security_groups(name = nil, = {}) request({ 'Action' => 'DescribeCacheSecurityGroups', 'CacheSecurityGroupName' => name, 'Marker' => [:marker], 'MaxRecords' => [:max_records], :parser => Fog::Parsers::AWS::Elasticache::DescribeSecurityGroups.new }.merge()) end |
#describe_engine_default_parameters(options = {}) ⇒ Object
Returns the default engine and system parameter information for the specified cache engine.
Parameters (optional)
-
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
16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/aws/requests/elasticache/describe_engine_default_parameters.rb', line 16 def describe_engine_default_parameters( = {}) request({ 'Action' => 'DescribeEngineDefaultParameters', 'CacheParameterGroupFamily' => [:engine] || 'memcached1.4', 'Marker' => [:marker], 'MaxRecords' => [:max_records], :parser => Fog::Parsers::AWS::Elasticache::DescribeEngineDefaultParameters.new }) end |
#describe_events(options = {}) ⇒ Object
Returns a list of service events
Parameters (optional)
-
options <~Hash> (optional):
-
:start_time <~DateTime> - starting time for event records
-
:end_time <~DateTime> - ending time for event records
-
:duration <~DateTime> - 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 <~DateTime> - identifier of the event source
-
:source_type <~DateTime> - event type, one of:
(cache-cluster | cache-parameter-group | cache-security-group)
Returns
-
response <~Excon::Response>:
-
body <~Hash>
-
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fog/aws/requests/elasticache/describe_events.rb', line 23 def describe_events( = {}) request( 'Action' => 'DescribeEvents', 'StartTime' => [:sart_time], 'EndTime' => [:end_time], 'Duration' => [:duration], 'Marker' => [:marker], 'MaxRecords' => [:max_records], 'SourceIdentifier' => [:source_identifier], 'SourceType' => [:source_type], :parser => Fog::Parsers::AWS::Elasticache::EventListParser.new ) end |
#modify_cache_cluster(id, options = {}) ⇒ Object
Modifies an existing cache cluster Returns a cache cluster description
Required Parameters
-
id <~String> - The ID of the existing cluster to be modified
Optional Parameters
-
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>
-
Returns
-
response <~Excon::Response>:
-
body <~Hash>
-
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/fog/aws/requests/elasticache/modify_cache_cluster.rb', line 28 def modify_cache_cluster(id, = {}) # Construct Cache Security Group parameters in the format: # CacheSecurityGroupNames.member.N => "security_group_name" group_names = [: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 = [: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' => [:apply_immediately], 'NumCacheNodes' => [:num_nodes], 'AutoMinorVersionUpgrade' => [:auto_minor_version_upgrade], 'CacheParameterGroupName' => [:parameter_group_name], 'EngineVersion' => [:engine_version], 'NotificationTopicArn' => [:notification_topic_arn], 'NotificationTopicStatus' => [:notification_topic_status], 'PreferredMaintenanceWindow' => [:preferred_maintenance_window], :parser => Fog::Parsers::AWS::Elasticache::SingleCacheCluster.new ))) end |
#modify_cache_parameter_group(id, new_parameters) ⇒ Object
Modifies an existing cache parameter group Returns a the name of the modified parameter group
Required Parameters
-
id <~String> - The ID of the parameter group to be modified
-
new_parameters <~Hash> - The parameters to modify, and their values
Returns
-
response <~Excon::Response>:
-
body <~Hash>
-
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# 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 |
#reboot_cache_cluster(id, nodes_to_reboot) ⇒ Object
Reboots some or all of an existing cache cluster’s nodes Returns a cache cluster description
Required Parameters
-
id <~String> - The ID of the existing cluster to be rebooted
Optional Parameters
-
nodes_to_reboot <~Array> - Array of node IDs to reboot
Returns
-
response <~Excon::Response>:
-
body <~Hash>
-
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# 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 |
#reload ⇒ Object
60 61 62 |
# File 'lib/fog/aws/elasticache.rb', line 60 def reload @connection.reset end |
#reset_cache_parameter_group(id, parameter_names = []) ⇒ Object
Resets an existing cache parameter group Returns a the name of the modified parameter group
Required Parameters
-
id <~String> - The ID of the parameter group to be modified
Optional Parameters
-
parameter_names <~Array> - The parameters to reset
Returns
-
response <~Excon::Response>:
-
body <~Hash>
-
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# 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_cache_security_group_ingress(name, ec2_name, ec2_owner_id) ⇒ Object
Revoke ingress to a CacheSecurityGroup using EC2 Security Groups
Parameters
-
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
Returns
-
response <~Excon::Response>:
-
body <~Hash>
-
18 19 20 21 22 23 24 25 26 |
# 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 |