Sha256: 19b29d6e727b4d5592c04b34c22c6115f10021e2cb86ce2fc14689a10595b5ea

Contents?: true

Size: 1.24 KB

Versions: 6

Compression:

Stored size: 1.24 KB

Contents

module Fog
  module Compute
    class Aliyun
      class Real
        # Allocate an avalable public IP address to the given instance.
        #
        # ==== Parameters
        # * server_id<~String> - id of the instance
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'IpAddress'<~String> - The allocated ip address
        #     * 'RequestId'<~String> - Id of the request
        #
        # {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.201.106.DGkmH7#/pub/ecs/open-api/network&allocatepublicipaddress]
        def allocate_public_ip_address(server_id)
          _action = 'AllocatePublicIpAddress'
          _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
      end
    end # aliyun
  end # compute
end

Version data entries

6 entries across 6 versions & 2 rubygems

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