class Fog::Compute::Aliyun::Vswitch

Public Class Methods

new(attributes={}) click to toggle source
Calls superclass method
# File lib/fog/aliyun/models/compute/vswitch.rb, line 16
def initialize(attributes={})
  super
end

Public Instance Methods

all() click to toggle source
# File lib/fog/aliyun/models/compute/vswitch.rb, line 65
def all()
  data = Fog::JSON.decode(service.list_vswitchs(vpc_id).body)['VSwitches']['VSwitch']
end
destroy() click to toggle source

Removes an existing vpc

vpc.destroy

Returns

True or false depending on the result

# File lib/fog/aliyun/models/compute/vswitch.rb, line 34
def destroy
  requires :id

  service.delete_vswitch(id)
  true
end
ready?() click to toggle source
# File lib/fog/aliyun/models/compute/vswitch.rb, line 20
def ready?
  requires :state
  state == 'Available'
end
save(options={}) click to toggle source

Create a vpc

>> g = Aliyun.vpcs.new(:cidr_block => “10.1.2.0/24”) >> g.save

Returns:

True or an exception depending on the result. Keep in mind that this creates a new vpc. As such, it yields an InvalidGroup.Duplicate exception if you attempt to save an existing vpc.

# File lib/fog/aliyun/models/compute/vswitch.rb, line 52
def save(options={})
  requires :vpc,:cidr_block
  options[:name] = name if name
  options[:description]=description if description
  data = Fog::JSON.decode(service.create_vswitch(vpc.id, cidr_block,options).body)

  true
end
vpc() click to toggle source
# File lib/fog/aliyun/models/compute/vswitch.rb, line 61
def vpc
  $vpc
end