From 4609ab2b66fb7c0ed814ed51575ea30718f21f43 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Fri, 14 Mar 2014 00:10:49 -0400 Subject: Add documentation for Chef::EncryptedDataBag.load --- lib/chef/encrypted_data_bag_item.rb | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'lib/chef/encrypted_data_bag_item.rb') diff --git a/lib/chef/encrypted_data_bag_item.rb b/lib/chef/encrypted_data_bag_item.rb index b38a6f3512..65dfc3df9a 100644 --- a/lib/chef/encrypted_data_bag_item.rb +++ b/lib/chef/encrypted_data_bag_item.rb @@ -49,6 +49,22 @@ require 'open-uri' class Chef::EncryptedDataBagItem ALGORITHM = 'aes-256-cbc' + # + # === Synopsis + # + # EncryptedDataBagItem.new(hash, secret) + # + # === Args + # + # +enc_hash+:: + # The encrypted hash to be decrypted + # +secret+:: + # The raw secret key + # + # === Description + # + # Create a new encrypted data bag item for reading (decryption) + # def initialize(enc_hash, secret) @enc_hash = enc_hash @secret = secret @@ -82,6 +98,26 @@ class Chef::EncryptedDataBagItem end end + # + # === Synopsis + # + # EncryptedDataBagItem.load(data_bag, name, secret = nil) + # + # === Args + # + # +data_bag+:: + # The name of the data bag to fetch + # +name+:: + # The name of the data bag item to fetch + # +secret+:: + # The raw secret key. If the +secret+ is nil, the value of the file at + # +Chef::Config[:encrypted_data_bag_secret]+ is loaded. See +load_secret+ + # for more information. + # + # === Description + # + # Loads and decrypts the data bag item with the given name. + # def self.load(data_bag, name, secret = nil) raw_hash = Chef::DataBagItem.load(data_bag, name) secret = secret || self.load_secret -- cgit v1.2.1