Sha256: 57923ec29afd76b5c9568d1ee6e966e6fa1c633ea3b6096e7466930690d51632

Contents?: true

Size: 1.77 KB

Versions: 20

Compression:

Stored size: 1.77 KB

Contents

module Fog
  module OpenStack
    class Orchestration
      class Real
        def list_resources(options = {}, options_deprecated = {})
          if options.kind_of?(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 = data[:resources].values

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

Version data entries

20 entries across 20 versions & 3 rubygems

Version Path
fog-openstack-1.1.3 lib/fog/openstack/orchestration/requests/list_resources.rb
fog-openstack-1.1.2 lib/fog/openstack/orchestration/requests/list_resources.rb
fog-openstack-fork-99 lib/fog/openstack/orchestration/requests/list_resources.rb
fog-openstack-1.1.0 lib/fog/openstack/orchestration/requests/list_resources.rb
fog-openstack-1.1.0.pre lib/fog/openstack/orchestration/requests/list_resources.rb
fog-openstack-apibank-1.0.102 lib/fog/openstack/orchestration/requests/list_resources.rb
fog-openstack-1.0.11 lib/fog/openstack/orchestration/requests/list_resources.rb
fog-openstack-apibank-1.0.101 lib/fog/openstack/orchestration/requests/list_resources.rb
fog-openstack-1.0.10 lib/fog/openstack/orchestration/requests/list_resources.rb
fog-openstack-1.0.9 lib/fog/openstack/orchestration/requests/list_resources.rb
fog-openstack-1.0.8 lib/fog/openstack/orchestration/requests/list_resources.rb
fog-openstack-1.0.7 lib/fog/openstack/orchestration/requests/list_resources.rb
fog-openstack-1.0.6 lib/fog/openstack/orchestration/requests/list_resources.rb
fog-openstack-1.0.5 lib/fog/openstack/orchestration/requests/list_resources.rb
fog-openstack-1.0.4 lib/fog/openstack/orchestration/requests/list_resources.rb
fog-openstack-1.0.3 lib/fog/openstack/orchestration/requests/list_resources.rb
fog-openstack-1.0.2 lib/fog/openstack/orchestration/requests/list_resources.rb
fog-openstack-1.0.1 lib/fog/openstack/orchestration/requests/list_resources.rb
fog-openstack-1.0.0 lib/fog/openstack/orchestration/requests/list_resources.rb
fog-openstack-0.3.1 lib/fog/openstack/orchestration/requests/list_resources.rb