Class: Fog::Compute::Aliyun::VPC
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Aliyun::VPC
- Defined in:
- lib/fog/aliyun/models/compute/vpc.rb
Instance Method Summary collapse
-
#destroy ⇒ Object
Removes an existing vpc.
- #ready? ⇒ Boolean
-
#save(options = {}) ⇒ Object
Create a vpc.
- #security_groups ⇒ Object
- #vrouter ⇒ Object
- #vswitches ⇒ Object
Instance Method Details
#destroy ⇒ Object
Removes an existing vpc
vpc.destroy
Returns
True or false depending on the result
33 34 35 36 37 38 |
# File 'lib/fog/aliyun/models/compute/vpc.rb', line 33 def destroy requires :id service.delete_vpc(id) true end |
#ready? ⇒ Boolean
19 20 21 22 |
# File 'lib/fog/aliyun/models/compute/vpc.rb', line 19 def ready? requires :state state == 'Available' end |
#save(options = {}) ⇒ Object
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.
69 70 71 72 73 74 75 |
# File 'lib/fog/aliyun/models/compute/vpc.rb', line 69 def save( = {}) requires :cidr_block [:name] = name if name [:description] = description if description Fog::JSON.decode(service.create_vpc(cidr_block, ).body) true end |
#security_groups ⇒ Object
54 55 56 57 |
# 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 |