Sha256: da872265ca332acb2a8c9164b5c1cbd8f0af0df4f971205062e1c2aa6602ad17

Contents?: true

Size: 1.86 KB

Versions: 16

Compression:

Stored size: 1.86 KB

Contents

require 'fog/openstack/models/collection'
require 'fog/openstack/models/orchestration/stack'

module Fog
  module Orchestration
    class OpenStack
      class Stacks < Fog::OpenStack::Collection
        model Fog::Orchestration::OpenStack::Stack

        def all(options = {})
          # TODO(lsmola) we can uncomment this when https://bugs.launchpad.net/heat/+bug/1468318 is fixed, till then
          # we will use non detailed list
          # data = service.list_stack_data_detailed(options).body['stacks']
          data = service.list_stack_data(options)
          load_response(data, 'stacks')
        end

        def summary(options = {})
          data = service.list_stack_data(options)
          load_response(data, 'stacks')
        end

        # Deprecated
        def find_by_id(id)
          Fog::Logger.deprecation("#find_by_id(id) is deprecated, use #get(name, id) instead [light_black](#{caller.first})[/]")
          self.find {|stack| stack.id == id}
        end

        def get(arg1, arg2 = nil)
          if arg2.nil?
            # Deprecated: get(id)
            Fog::Logger.deprecation("#get(id) is deprecated, use #get(name, id) instead [light_black](#{caller.first})[/]")
            return find_by_id(arg1)
          end

          # Normal use: get(name, id)
          name = arg1
          id = arg2
          data = service.show_stack_details(name, id).body['stack']
          new(data)
        rescue Fog::Compute::OpenStack::NotFound
          nil
        end

        def adopt(options={})
          service.create_stack(options)
        end

        def create(options={})
          service.create_stack(options).body['stack']
        end

        def preview(options={})
          data = service.preview_stack(options).body['stack']
          new(data)
        end

        def build_info
          service.build_info.body
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
fog-openstack-0.1.10 lib/fog/openstack/models/orchestration/stacks.rb
fog-openstack-0.1.9 lib/fog/openstack/models/orchestration/stacks.rb
fog-openstack-0.1.8 lib/fog/openstack/models/orchestration/stacks.rb
fog-openstack-0.1.7 lib/fog/openstack/models/orchestration/stacks.rb
fog-openstack-0.1.6 lib/fog/openstack/models/orchestration/stacks.rb
fog-openstack-0.1.5 lib/fog/openstack/models/orchestration/stacks.rb
fog-openstack-0.1.4 lib/fog/openstack/models/orchestration/stacks.rb
fog-openstack-0.1.3 lib/fog/openstack/models/orchestration/stacks.rb
fog-openstack-0.1.2 lib/fog/openstack/models/orchestration/stacks.rb
fog-openstack-0.1.1 lib/fog/openstack/models/orchestration/stacks.rb
fog-openstack-0.1.0 lib/fog/openstack/models/orchestration/stacks.rb
fog-1.37.0 lib/fog/openstack/models/orchestration/stacks.rb
fog-1.36.0 lib/fog/openstack/models/orchestration/stacks.rb
fog-1.35.0 lib/fog/openstack/models/orchestration/stacks.rb
fog-2.0.0.pre.0 lib/fog/openstack/models/orchestration/stacks.rb
fog-1.34.0 lib/fog/openstack/models/orchestration/stacks.rb