Sha256: 5f8f7f0057390692998439f70132a24a302776c47f21e40ded44a7476a72e884
Contents?: true
Size: 1.84 KB
Versions: 1
Compression:
Stored size: 1.84 KB
Contents
require 'fog/core/model' module Fog module Compute class Aliyun class EipAddress < Fog::Model identity :id, :aliases => 'AllocationId' attribute :allocated_at, :aliases => 'AllocationTime' attribute :bandwidth, :aliases => 'Bandwidth' attribute :server_id, :aliases => 'InstanceId' attribute :charge_type, :aliases => 'InternetChargeType' attribute :ip_address, :aliases => ['IpAddress','EipAddress'] attribute :opertion_locks,:aliases => 'OperationLocks' attribute :region_id, :aliases => 'RegionId' attribute :state, :aliases => 'Status' def destroy requires :id service.release_eip_address(id) true end def ready? requires :state state == 'Available' end def save(options={}) # raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted? # requires :availability_zone options[:bandwidth] = bandwidth if bandwidth options[:internet_charge_type]=charge_type if charge_type data = Fog::JSON.decode(service.allocate_eip_address(options).body) merge_attributes(data) true end def associate(new_server,options={}) unless persisted? @server = new_server else @server = nil self.server_id = new_server.id service.associate_eip_address(server_id,id,options) end end def disassociate(new_server,options={}) @server = nil self.server_id = new_server.id if persisted? service.unassociate_eip_address(server_id,id,options) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fog-aliyun-0.1.0 | lib/fog/aliyun/models/compute/eip_address.rb |