class Fog::Compute::Aliyun::VPC

Public Instance Methods

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/vpc.rb, line 32
def destroy
  requires :id

  service.delete_vpc(id)
  true
end
ready?() click to toggle source
# File lib/fog/aliyun/models/compute/vpc.rb, line 18
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/vpc.rb, line 68
def save(options={})
  requires :cidr_block
  options[:name]=name if name
  options[:description]=description if description
  data = Fog::JSON.decode(service.create_vpc(cidr_block,options).body)
  true
end
security_groups() click to toggle source
# File lib/fog/aliyun/models/compute/vpc.rb, line 53
def security_groups
  requires :id
  Fog::Compute::Aliyun::SecurityGroups.new(:service=>service).all(:vpcId=>id)
end
vrouter() click to toggle source
# File lib/fog/aliyun/models/compute/vpc.rb, line 48
def vrouter
  requires :v_router_id
  Fog::Compute::Aliyun::Vrouters.new(:service=>service).all('vRouterId'=>v_router_id)[0]
end
vswitches() click to toggle source
# File lib/fog/aliyun/models/compute/vpc.rb, line 39
def vswitches
  @vswitches ||= begin
    Fog::Compute::Aliyun::Vswitches.new(
      :vpc     => self,
      :service => service
    )
  end
end