Sha256: 7098f337f56c818650d0f510c13b52471f30aff1b294d5c0983c061c32f26841

Contents?: true

Size: 1.77 KB

Versions: 19

Compression:

Stored size: 1.77 KB

Contents

module Fog
  module Orchestration
    class OpenStack
      class Real
        def list_resources(options = {}, options_deprecated = {})
          if options.is_a?(Hash)
            if !options.key?(:stack) && !(options.key?(:stack_name) && options.key?(:stack_id))
              raise(ArgumentError, "Missing required options keys: :stack or :stack_name and :stack_id, while calling "\
                                   " .list_resources(options)")
            end

            stack        = options.delete(:stack)
            stack_name   = options.delete(:stack_name)
            stack_name ||=  stack.stack_name if stack && stack.respond_to?(:stack_name)
            stack_id     = options.delete(:stack_id)
            stack_id   ||=  stack.id if stack && stack.respond_to?(:id)
            path         = "stacks/#{stack_name}/#{stack_id}/resources"
            params       = options
          else
            Fog::Logger.deprecation('Calling OpenStack[:orchestration].list_resources(stack, options) is deprecated, '\
                                    ' call .list_resources(:stack => stack) or '\
                                    ' .list_resources(:stack_name => value, :stack_id => value) instead')
            path   = "stacks/#{options.stack_name}/#{options.id}/resources"
            params = options_deprecated
          end

          request(:method  => 'GET',
                  :path    => path,
                  :expects => 200,
                  :query   => params)
        end
      end

      class Mock
        def list_resources(options = {}, options_deprecated = {})
          resources = self.data[:resources].values

          Excon::Response.new(
            :body   => { 'resources' => resources },
            :status => 200
          )
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 3 rubygems

Version Path
fog-openstack-0.1.10 lib/fog/openstack/requests/orchestration/list_resources.rb
fog-openstack-0.1.9 lib/fog/openstack/requests/orchestration/list_resources.rb
fog-openstack-0.1.8 lib/fog/openstack/requests/orchestration/list_resources.rb
fog-openstack-0.1.7 lib/fog/openstack/requests/orchestration/list_resources.rb
fog-openstack-0.1.6 lib/fog/openstack/requests/orchestration/list_resources.rb
fog-openstack-0.1.5 lib/fog/openstack/requests/orchestration/list_resources.rb
fog-openstack-0.1.4 lib/fog/openstack/requests/orchestration/list_resources.rb
fog-openstack-0.1.3 lib/fog/openstack/requests/orchestration/list_resources.rb
fog-openstack-0.1.2 lib/fog/openstack/requests/orchestration/list_resources.rb
fog-openstack-0.1.1 lib/fog/openstack/requests/orchestration/list_resources.rb
fog-openstack-0.1.0 lib/fog/openstack/requests/orchestration/list_resources.rb
fog-1.37.0 lib/fog/openstack/requests/orchestration/list_resources.rb
fog-1.36.0 lib/fog/openstack/requests/orchestration/list_resources.rb
fog-1.35.0 lib/fog/openstack/requests/orchestration/list_resources.rb
fog-2.0.0.pre.0 lib/fog/openstack/requests/orchestration/list_resources.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/openstack/requests/orchestration/list_resources.rb
fog-1.34.0 lib/fog/openstack/requests/orchestration/list_resources.rb
fog-1.33.0 lib/fog/openstack/requests/orchestration/list_resources.rb
fog-1.32.0 lib/fog/openstack/requests/orchestration/list_resources.rb