Class: Fog::AWS::Elasticache::Real

Inherits:
Object
  • Object
show all
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/create_cache_subnet_group.rb,
lib/fog/aws/requests/elasticache/delete_cache_subnet_group.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/describe_cache_subnet_groups.rb,
lib/fog/aws/requests/elasticache/modify_cache_parameter_group.rb,
lib/fog/aws/requests/elasticache/describe_reserved_cache_nodes.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

Methods included from CredentialFetcher::ConnectionMethods

#refresh_credentials_if_expired

Constructor Details

#initialize(options = {}) ⇒ Real

Returns a new instance of Real.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/fog/aws/elasticache.rb', line 54

def initialize(options={})
  @use_iam_profile = options[:use_iam_profile]

  @instrumentor       = options[:instrumentor]
  @instrumentor_name  = options[:instrumentor_name] || 'fog.aws.elasticache'
  options[:region] ||= 'us-east-1'

  @region = options[:region]
  @host = options[:host] || "elasticache.#{options[:region]}.amazonaws.com"
  @path       = options[:path]      || '/'
  @port       = options[:port]      || 443
  @scheme     = options[:scheme]    || 'https'
  @connection = Fog::XML::Connection.new(
    "#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent]
  )

  setup_credentials(options)
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>



16
17
18
19
20
21
22
23
24
# File 'lib/fog/aws/requests/elasticache/authorize_cache_security_group_ingress.rb', line 16

def authorize_cache_security_group_ingress(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

    • :vpc_security_groups <~Array> - Array

    • :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_availability_zone <~String>

    • :preferred_maintenance_window <~String>

    • :cache_subnet_group_name <~String>

    • :s3_snapshot_location <~String> - Amazon resource location for snapshot

Returns

  • response <~Excon::Response>:

    • body <~Hash>



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
60
# File 'lib/fog/aws/requests/elasticache/create_cache_cluster.rb', line 29

def create_cache_cluster(id, options = {})
  req_options = {
    '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],
    'CacheSubnetGroupName'        => options[:cache_subnet_group_name],
    'EngineVersion'               => options[:engine_version],
    'NotificationTopicArn'        => options[:notification_topic_arn],
    'Port'                        => options[:port],
    'PreferredAvailabilityZone'   => options[:preferred_availability_zone],
    'PreferredMaintenanceWindow'  => options[:preferred_maintenance_window],
    :parser => Fog::Parsers::AWS::Elasticache::SingleCacheCluster.new
  }

  if s3_snapshot_location = options.delete(:s3_snapshot_location)
    req_options.merge!(Fog::AWS.indexed_param('SnapshotArns.member.%d', [*s3_snapshot_location]))
  end

  if cache_security_groups = options.delete(:security_group_names)
      req_options.merge!(Fog::AWS.indexed_param('CacheSecurityGroupNames.member.%d', [*cache_security_groups]))
  end

  if vpc_security_groups = options.delete(:vpc_security_groups)
      req_options.merge!(Fog::AWS.indexed_param('SecurityGroupIds.member.%d', [*vpc_security_groups]))
  end

  request( req_options )
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>



17
18
19
20
21
22
23
24
25
# File 'lib/fog/aws/requests/elasticache/create_cache_parameter_group.rb', line 17

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>



15
16
17
18
19
20
21
22
# File 'lib/fog/aws/requests/elasticache/create_cache_security_group.rb', line 15

def create_cache_security_group(name, description = name)
  request({
    'Action' => 'CreateCacheSecurityGroup',
    'CacheSecurityGroupName' => name,
    'Description' => description,
    :parser => Fog::Parsers::AWS::Elasticache::SingleSecurityGroup.new
  })
end

#create_cache_subnet_group(name, subnet_ids, description = name) ⇒ Object

Creates a cache subnet group docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_CreateCacheSubnetGroup.html

Parameters

  • CacheSubnetGroupName <~String> - A name for the cache subnet group. This value is stored as a lowercase string. Must contain no more than 255 alphanumeric characters or hyphens.

  • SubnetIds <~Array> - The VPC subnet IDs for the cache subnet group.

  • CacheSubnetGroupDescription <~String> - A description for the cache subnet group.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



17
18
19
20
21
22
23
24
25
26
# File 'lib/fog/aws/requests/elasticache/create_cache_subnet_group.rb', line 17

def create_cache_subnet_group(name, subnet_ids, description = name)
  params = {
    'Action' => 'CreateCacheSubnetGroup',
    'CacheSubnetGroupName' => name,
    'CacheSubnetGroupDescription' => description,
    :parser => Fog::Parsers::AWS::Elasticache::CreateCacheSubnetGroup.new
  }
  params.merge!(Fog::AWS.indexed_param("SubnetIds.member", Array(subnet_ids)))
  request(params)
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>



14
15
16
17
18
19
20
# File 'lib/fog/aws/requests/elasticache/delete_cache_cluster.rb', line 14

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>



14
15
16
17
18
19
20
# File 'lib/fog/aws/requests/elasticache/delete_cache_parameter_group.rb', line 14

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>



14
15
16
17
18
19
20
# File 'lib/fog/aws/requests/elasticache/delete_cache_security_group.rb', line 14

def delete_cache_security_group(name)
  request({
    'Action' => 'DeleteCacheSecurityGroup',
    'CacheSecurityGroupName' => name,
    :parser => Fog::Parsers::AWS::Elasticache::Base.new
  })
end

#delete_cache_subnet_group(name) ⇒ Object

deletes a cache subnet group

Parameters

  • name <~String> - The name for the Cache Subnet Group

Returns

  • response <~Excon::Response>:

    • body <~Hash>



14
15
16
17
18
19
20
# File 'lib/fog/aws/requests/elasticache/delete_cache_subnet_group.rb', line 14

def delete_cache_subnet_group(name)
  request({
    'Action' => 'DeleteCacheSubnetGroup',
    'CacheSubnetGroupName' => 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>



18
19
20
21
22
23
24
25
26
27
# File 'lib/fog/aws/requests/elasticache/describe_cache_clusters.rb', line 18

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

#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



14
15
16
17
18
19
20
21
22
# File 'lib/fog/aws/requests/elasticache/describe_cache_parameter_groups.rb', line 14

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

#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.



15
16
17
18
19
20
21
22
23
24
# File 'lib/fog/aws/requests/elasticache/describe_cache_parameters.rb', line 15

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

#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



14
15
16
17
18
19
20
21
22
# File 'lib/fog/aws/requests/elasticache/describe_cache_security_groups.rb', line 14

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

#describe_cache_subnet_groups(name = nil, opts = {}) ⇒ Object

This API returns a list of CacheSubnetGroup descriptions. If a CacheSubnetGroupName is specified, the list will contain only the descriptions of the specified CacheSubnetGroup docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_DescribeCacheSubnetGroups.html

Parameters

  • CacheSubnetGroupName <~String> - The name of a specific database subnet group to return details for.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fog/aws/requests/elasticache/describe_cache_subnet_groups.rb', line 15

def describe_cache_subnet_groups(name = nil, opts = {})
  params = {}
  if opts[:marker]
    params['Marker'] = opts[:marker]
  end
  if name
    params['CacheSubnetGroupName'] = name
  end
  if opts[:max_records]
    params['MaxRecords'] = opts[:max_records]
  end

  request({
    'Action'  => 'DescribeCacheSubnetGroups',
    :parser   => Fog::Parsers::AWS::Elasticache::DescribeCacheSubnetGroups.new
  }.merge(params))
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



15
16
17
18
19
20
21
22
23
# File 'lib/fog/aws/requests/elasticache/describe_engine_default_parameters.rb', line 15

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

#describe_events(options = {}) ⇒ Object

docs.amazonwebservices.com/AmazonElastiCache/latest/APIReference/API_DescribeEvents.html

Parameters (optional)

  • 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)
    

Returns

  • response <~Excon::Response>:

    • body <~Hash>



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/fog/aws/requests/elasticache/describe_events.rb', line 25

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_reserved_cache_nodes(identifier = nil, opts = {}) ⇒ Object

Describe all or specified reserved Elasticache nodes docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_DescribeReservedCacheNodes.html

Parameters

  • ReservedCacheNodeId <~String> - ID of node to retrieve information for. If absent, information for all nodes is returned.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/fog/aws/requests/elasticache/describe_reserved_cache_nodes.rb', line 14

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

#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>



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
53
54
55
56
57
58
# File 'lib/fog/aws/requests/elasticache/modify_cache_cluster.rb', line 27

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.reduce({}) 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.reduce({}) 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

#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>



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fog/aws/requests/elasticache/modify_cache_parameter_group.rb', line 16

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.reduce({}) 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>



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fog/aws/requests/elasticache/reboot_cache_cluster.rb', line 17

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.reduce({}) 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

#reloadObject



73
74
75
# File 'lib/fog/aws/elasticache.rb', line 73

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>



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/fog/aws/requests/elasticache/reset_cache_parameter_group.rb', line 17

def reset_cache_parameter_group(id, parameter_names = [])
  # Construct Parameter resets in the format:
  #   ParameterNameValues.member.N => "param_name"
  parameter_changes = parameter_names.reduce({}) 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>



17
18
19
20
21
22
23
24
25
# File 'lib/fog/aws/requests/elasticache/revoke_cache_security_group_ingress.rb', line 17

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