Sha256: 8f650eaeb06b51456ab81f886dc3d271ca09070df5ac1de8a201072beba43c82

Contents?: true

Size: 1.18 KB

Versions: 6

Compression:

Stored size: 1.18 KB

Contents

module Fog
  module Compute
    class Aliyun
      class Real
        # Stop the server.
        #
        # === Parameters
        # * server_id <~String> - The ID of the server to be stopped.
        # === Returns
        # * success <~Boolean>
        # {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.3.1.DGkmH7#/pub/ecs/open-api/instance&stopinstance]
        def stop_server(server_id)
          _action = 'StopInstance'
          _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 stop_server
      end # class Real

      class Mock
        def stop_server(_server_id)
          true
        end # def stop_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/stop_server.rb
fog-aliyun-0.2.2 lib/fog/aliyun/requests/compute/stop_server.rb
fog-xiaozhu-0.2.2 lib/fog/aliyun/requests/compute/stop_server.rb
fog-xiaozhu-0.2.1 lib/fog/aliyun/requests/compute/stop_server.rb
fog-aliyun-0.2.1 lib/fog/aliyun/requests/compute/stop_server.rb
fog-aliyun-0.2.0 lib/fog/aliyun/requests/compute/stop_server.rb