class Ridley::DataBagResource

Attributes

item_resource[R]

Public Class Methods

new(connection_registry, data_bag_secret) click to toggle source

@param [Celluloid::Registry] connection_registry @param [String] data_bag_secret

Calls superclass method Ridley::Resource::new
# File lib/ridley/resources/data_bag_resource.rb, line 14
def initialize(connection_registry, data_bag_secret)
  super(connection_registry)
  @item_resource = DataBagItemResource.new_link(connection_registry, data_bag_secret)
end

Public Instance Methods

find(object) click to toggle source

@param [String, chef_id] object

@return [nil, Ridley::DataBagResource]

# File lib/ridley/resources/data_bag_resource.rb, line 22
def find(object)
  chef_id = object.respond_to?(:chef_id) ? object.chef_id : object
  request(:get, "#{self.class.resource_path}/#{chef_id}")
  new(name: chef_id)
rescue AbortError => ex
  return nil if ex.cause.is_a?(Errors::HTTPNotFound)
  abort(ex.cause)
end

Private Instance Methods

finalize_callback() click to toggle source
# File lib/ridley/resources/data_bag_resource.rb, line 33
def finalize_callback
  item_resource.async.terminate if item_resource
end