Sha256: 2e2568a24d45258c16f2d1f6fe92642ff7cbcef63bd539b1645ff237d60b5d77

Contents?: true

Size: 1.26 KB

Versions: 23

Compression:

Stored size: 1.26 KB

Contents

module Fog
  module Baremetal
    class OpenStack
      class Real
        # Create a new chassis
        #
        # === Attributes ===
        # description  = Free text description of the chassis
        # extra        = Record arbitrary key/value metadata. Can be specified multiple times
        def create_chassis(attributes)
          desired_options = [
            :description,
            :extra
          ]

          # Filter only allowed creation attributes
          data = attributes.select { |key, value| desired_options.include?(key.to_sym) }

          request(
            :body => Fog::JSON.encode(data),
            :expects => [200,201],
            :method => 'POST',
            :path => 'chassis'
          )
        end
      end

      class Mock
        def create_chassis(attributes)
          response = Excon::Response.new
          response.status = 200
          response.headers = {
            "X-Compute-Request-Id" => "req-fdc6f99e-55a2-4ab1-8904-0892753828cf",
            "Content-Type" => "application/json",
            "Content-Length" => "356",
            "Date" => Date.new
          }
          response.body =  self.data[:chassis_collection].first
          response
        end
      end # mock
    end # openstack
  end # baremetal
end # fog

Version data entries

23 entries across 23 versions & 3 rubygems

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