Sha256: aded4b2947d7c3c8429798f5fdd6d2b079c4189bdc83b92081b34e3b463b7773

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

module Fog
  module Baremetal
    class HuaweiCloud
      class Real
        def set_node_provision_state(node_id, provision_state)
          data = {
            'target' => provision_state
          }

          request(
            :body    => Fog::JSON.encode(data),
            :expects => 202,
            :method  => 'PUT',
            :path    => "nodes/#{node_id}/states/provision",
            :headers => {
              :'X-HuaweiCloud-Ironic-API-Version' => 'latest'
            }
          )
        end
      end

      class Mock
        def set_node_provision_state(_node_id, _provision_state)
          response = Excon::Response.new
          response.status = 202
          response.headers = {
            "X-Compute-Request-Id" => "req-fdc6f99e-55a2-4ab1-8904-0892753828cf",
            "Content-Type"         => "application/json",
            "Content-Length"       => "356",
            "Date"                 => Date.new
          }
          response.body = data[:nodes].first
          response
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-huaweicloud-0.0.3 lib/fog/baremetal/huaweicloud/requests/set_node_provision_state.rb
fog-huaweicloud-0.0.2 lib/fog/baremetal/huaweicloud/requests/set_node_provision_state.rb
fog-huaweicloud-0.1.3 lib/fog/baremetal/huaweicloud/requests/set_node_provision_state.rb
fog-huaweicloud-0.1.2 lib/fog/baremetal/huaweicloud/requests/set_node_provision_state.rb