Class: Ridley::DataBagResource
- Defined in:
- lib/ridley/resources/data_bag_resource.rb
Overview
Instance Attribute Summary collapse
-
#item_resource ⇒ Object
readonly
Returns the value of attribute item_resource.
Instance Method Summary collapse
- #find(object) ⇒ nil, Ridley::DataBagResource
-
#initialize(connection_registry, data_bag_secret) ⇒ DataBagResource
constructor
A new instance of DataBagResource.
Methods inherited from Resource
#all, #connection, #create, #delete, #delete_all, #new, representation, represented_by, resource_path, set_resource_path, #update
Constructor Details
#initialize(connection_registry, data_bag_secret) ⇒ DataBagResource
Returns a new instance of DataBagResource.
15 16 17 18 |
# File 'lib/ridley/resources/data_bag_resource.rb', line 15 def initialize(connection_registry, data_bag_secret) super(connection_registry) @item_resource = DataBagItemResource.new_link(connection_registry, data_bag_secret) end |
Instance Attribute Details
#item_resource ⇒ Object (readonly)
Returns the value of attribute item_resource.
9 10 11 |
# File 'lib/ridley/resources/data_bag_resource.rb', line 9 def item_resource @item_resource end |
Instance Method Details
#find(object) ⇒ nil, Ridley::DataBagResource
23 24 25 26 27 28 29 30 |
# File 'lib/ridley/resources/data_bag_resource.rb', line 23 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 |