Sha256: 987b55eed4916399e990a971e36a538217485f5300bbf005bb48fdf353bc2281

Contents?: true

Size: 1.19 KB

Versions: 6

Compression:

Stored size: 1.19 KB

Contents

module Fog
  module Compute
    class Aliyun
      class Real
        # Start the server.
        #
        # === Parameters
        # * server_id <~String> - The ID of the server to be started.
        # === Returns
        # * success <~Boolean>
        # {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.3.1.DGkmH7#/pub/ecs/open-api/instance&staetinstance]
        def start_server(server_id)
          _action = 'StartInstance'
          _sigNonce = randonStr
          _time = Time.new.utc

          _parameters = defalutParameters(_action, _sigNonce, _time)
          _pathURL = defaultAliyunUri(_action, _sigNonce, _time)

          _parameters['InstanceId'] = server_id
          _pathURL += '&InstanceId=' + server_id

          _signature = sign(@aliyun_accesskey_secret, _parameters)
          _pathURL += '&Signature=' + _signature

          request(
            expects: [200, 204],
            method: 'GET',
            path: _pathURL
          )
        end # def start_server
      end # class Real

      class Mock
        def start_server(_server_id)
          true
        end # def start_server
      end # class Mock
    end # class aliyun
  end # module Compute
end # module Fog

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
fog-aliyun-0.3.0 lib/fog/aliyun/requests/compute/start_server.rb
fog-aliyun-0.2.2 lib/fog/aliyun/requests/compute/start_server.rb
fog-xiaozhu-0.2.2 lib/fog/aliyun/requests/compute/start_server.rb
fog-xiaozhu-0.2.1 lib/fog/aliyun/requests/compute/start_server.rb
fog-aliyun-0.2.1 lib/fog/aliyun/requests/compute/start_server.rb
fog-aliyun-0.2.0 lib/fog/aliyun/requests/compute/start_server.rb