Class: Ridley::DataBagResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/ridley/resources/data_bag_resource.rb

Overview

Author:

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#<=>, #==, all, #chef_id, chef_id, chef_json_class, chef_type, create, delete, delete_all, #eql?, #hash, #initialize, #reload, resource_path, #save, set_chef_id, set_chef_json_class, set_chef_type, set_resource_path, #to_s, update, #update

Constructor Details

This class inherits a constructor from Ridley::Resource

Class Method Details

.find(client, object) ⇒ nil, Ridley::DataBagResource


40
41
42
43
44
# File 'lib/ridley/resources/data_bag_resource.rb', line 40

def find(client, object)
  find!(client, object)
rescue Errors::HTTPNotFound
  nil
end

.find!(client, object) ⇒ Ridley::DataBagResource

Raises:


53
54
55
56
57
# File 'lib/ridley/resources/data_bag_resource.rb', line 53

def find!(client, object)
  chef_id = object.respond_to?(:chef_id) ? object.chef_id : object
  client.connection.get("#{self.resource_path}/#{chef_id}")
  new(client, name: chef_id)
end

Instance Method Details

#encrypted_itemObject


70
71
72
# File 'lib/ridley/resources/data_bag_resource.rb', line 70

def encrypted_item
  DBIChainLink.new(self, client, encrypted: true)
end

#itemObject


66
67
68
# File 'lib/ridley/resources/data_bag_resource.rb', line 66

def item
  DBIChainLink.new(self, client)
end