Sha256: 8cf5118a9323eb3ce3185b85e25c4f9fd6e127bea9d7c5db3fe028c4be876a5b

Contents?: true

Size: 1.02 KB

Versions: 20

Compression:

Stored size: 1.02 KB

Contents

module Fog
  module OpenStack
    class Volume
      module Real
        def create_volume_type(options = {})
          data = {
            'volume_type' => {}
          }

          vanilla_options = [:name, :extra_specs]
          vanilla_options.select { |o| options[o] }.each do |key|
            data['volume_type'][key] = options[key]
          end
          request(
            :body    => Fog::JSON.encode(data),
            :expects => [200, 202],
            :method  => 'POST',
            :path    => "types"
          )
        end
      end

      module Mock
        def create_volume_type(_options = {})
          response = Excon::Response.new
          response.status = 202
          response.body = {
            "volume_type" => {
              "id"          => "6685584b-1eac-4da6-b5c3-555430cf68ff",
              "name"        => "vol-type-001",
              "extra_specs" => {
                "capabilities" => "gpu"
              }
            }
          }
          response
        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/volume/requests/create_volume_type.rb
fog-openstack-1.1.2 lib/fog/openstack/volume/requests/create_volume_type.rb
fog-openstack-fork-99 lib/fog/openstack/volume/requests/create_volume_type.rb
fog-openstack-1.1.0 lib/fog/openstack/volume/requests/create_volume_type.rb
fog-openstack-1.1.0.pre lib/fog/openstack/volume/requests/create_volume_type.rb
fog-openstack-apibank-1.0.102 lib/fog/openstack/volume/requests/create_volume_type.rb
fog-openstack-1.0.11 lib/fog/openstack/volume/requests/create_volume_type.rb
fog-openstack-apibank-1.0.101 lib/fog/openstack/volume/requests/create_volume_type.rb
fog-openstack-1.0.10 lib/fog/openstack/volume/requests/create_volume_type.rb
fog-openstack-1.0.9 lib/fog/openstack/volume/requests/create_volume_type.rb
fog-openstack-1.0.8 lib/fog/openstack/volume/requests/create_volume_type.rb
fog-openstack-1.0.7 lib/fog/openstack/volume/requests/create_volume_type.rb
fog-openstack-1.0.6 lib/fog/openstack/volume/requests/create_volume_type.rb
fog-openstack-1.0.5 lib/fog/openstack/volume/requests/create_volume_type.rb
fog-openstack-1.0.4 lib/fog/openstack/volume/requests/create_volume_type.rb
fog-openstack-1.0.3 lib/fog/openstack/volume/requests/create_volume_type.rb
fog-openstack-1.0.2 lib/fog/openstack/volume/requests/create_volume_type.rb
fog-openstack-1.0.1 lib/fog/openstack/volume/requests/create_volume_type.rb
fog-openstack-1.0.0 lib/fog/openstack/volume/requests/create_volume_type.rb
fog-openstack-0.3.1 lib/fog/openstack/volume/requests/create_volume_type.rb