class Chef::Provider::AwsCacheSubnetGroup
Protected Instance Methods
create_aws_object()
click to toggle source
# File lib/chef/provider/aws_cache_subnet_group.rb, line 8 def create_aws_object converge_by "create ElastiCache subnet group #{new_resource.name} in #{region}" do driver.create_cache_subnet_group(desired_options) end end
destroy_aws_object(cache_subnet_group)
click to toggle source
# File lib/chef/provider/aws_cache_subnet_group.rb, line 22 def destroy_aws_object(cache_subnet_group) converge_by "delete ElastiCache subnet group #{new_resource.name} in #{region}" do driver.delete_cache_subnet_group( cache_subnet_group_name: cache_subnet_group[:cache_subnet_group_name] ) end end
update_aws_object(cache_subnet_group)
click to toggle source
# File lib/chef/provider/aws_cache_subnet_group.rb, line 14 def update_aws_object(cache_subnet_group) if update_required?(cache_subnet_group) converge_by "update ElastiCache subnet group #{new_resource.name} in #{region}" do driver.modify_cache_subnet_group(desired_options) end end end
Private Instance Methods
desired_options()
click to toggle source
# File lib/chef/provider/aws_cache_subnet_group.rb, line 40 def desired_options @desired_options ||= begin options = {} options[:cache_subnet_group_name] = new_resource.group_name options[:cache_subnet_group_description] = new_resource.description options[:subnet_ids] = new_resource.subnets AWSResource.lookup_options(options, resource: new_resource) end end
driver()
click to toggle source
# File lib/chef/provider/aws_cache_subnet_group.rb, line 32 def driver new_resource.driver.elasticache end
update_cache_subnet_group()
click to toggle source
# File lib/chef/provider/aws_cache_subnet_group.rb, line 36 def update_cache_subnet_group new_resource.driver.elasticache.modify_cache_subnet_group(desired_options) end
update_required?(cache_subnet_group)
click to toggle source
# File lib/chef/provider/aws_cache_subnet_group.rb, line 50 def update_required?(cache_subnet_group) current_subnet_ids = cache_subnet_group[:subnets] .map { |subnet| subnet[:subnet_identifier] }.sort current_description = cache_subnet_group[:cache_subnet_group_description] if new_resource.description != current_description || desired_options[:subnet_ids].sort != current_subnet_ids true else false end end