Module: KnifeCloudformation::Utils::ObjectStorage

Included in:
Chef::Knife::CloudformationExport, Chef::Knife::CloudformationImport, KnifeCloudformation::Utils
Defined in:
lib/knife-cloudformation/utils/object_storage.rb

Overview

Storage helpers

Instance Method Summary collapse

Instance Method Details

#file_store(object, path, directory) ⇒ String

Write to file

Parameters:

  • object (Object)
  • path (String)

    path to write object

  • directory (Miasma::Models::Storage::Directory)

Returns:

  • (String)

    file path



15
16
17
18
19
20
21
22
23
24
# File 'lib/knife-cloudformation/utils/object_storage.rb', line 15

def file_store(object, path, directory)
  raise NotImplementedError.new 'Internal updated required! :('
  content = object.is_a?(String) ? object : Utils._format_json(object)
  directory.files.create(
    :identity => path,
    :body => content
  )
  loc = directory.service.service.name.split('::').last.downcase
  "#{loc}://#{directory.identity}/#{path}"
end