Sha256: 9de7459d488058604a068cc02cc7557e269d1e09c88ef93407a1c10a5f11cae7

Contents?: true

Size: 936 Bytes

Versions: 1

Compression:

Stored size: 936 Bytes

Contents

# frozen_string_literal: true

module Fog
  module Compute
    class CloudAtCost
      class Real
        def console(id)
          body = { sid: id.to_s }
          request(
            expects: [200],
            method: 'POST',
            path: 'api/v1/console.php',
            body: body
          )
        end
      end

      class Mock
        def console(_id, _hostname)
          console_url =
            'http:\/\/panel.cloudatcost.com:12345\/console.html?servername=123456&hostname=1.1.1.1'\
            '&sshkey=123456&sha1hash=aBcDeFgG'
          response = Excon::Response.new
          response.status = 200
          response.body = {
            'server_id'  => Fog::Mock.random_numbers(1).to_i,
            'api'        => 'v1',
            'status'     => 'ok',
            'console'    => console_url,
            'time'       => 12_312_323
          }
          response
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-cloudatcost-0.4.0 lib/fog/cloudatcost/requests/console.rb