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 33
def destroy
  requires :id

  service.delete_vpc(id)
  true
end
ready?() click to toggle source
# File lib/fog/aliyun/models/compute/vpc.rb, line 19
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 69
def save(options = {})
  requires :cidr_block
  options[:name] = name if name
  options[:description] = description if description
  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 54
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 49
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 40
def vswitches
  @vswitches ||= begin
    Fog::Compute::Aliyun::Vswitches.new(
      vpc: self,
      service: service
    )
  end
end