Class: Fog::Compute::Aliyun::SecurityGroup
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Aliyun::SecurityGroup
- Defined in:
- lib/fog/aliyun/models/compute/security_group.rb
Instance Method Summary collapse
- #authorize_security_group_ip_rule(cidr_ip, direction = 'ingress', options = {}) ⇒ Object
- #authorize_security_group_sg_rule(group_id, direction = 'ingress', options = {}) ⇒ Object
- #destroy ⇒ Object
- #revoke_security_group_ip_rule(cidr_ip, direction = 'ingress', options = {}) ⇒ Object
- #revoke_seurity_group_sg_rule(group_id, direction = 'ingress', options = {}) ⇒ Object
- #save(options = {}) ⇒ Object
- #security_group_rules ⇒ Object
- #vpc ⇒ Object
Instance Method Details
#authorize_security_group_ip_rule(cidr_ip, direction = 'ingress', options = {}) ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/fog/aliyun/models/compute/security_group.rb', line 49 def (cidr_ip, direction = 'ingress', = {}) requires :id nic_type = .fetch(:nic_type, 'internet') if direction == 'egress' service.create_security_group_egress_ip_rule(id, cidr_ip, nic_type, ) else service.create_security_group_ip_rule(id, cidr_ip, nic_type, ) end true end |
#authorize_security_group_sg_rule(group_id, direction = 'ingress', options = {}) ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/fog/aliyun/models/compute/security_group.rb', line 39 def (group_id, direction = 'ingress', = {}) requires :id if direction == 'egress' service.create_security_group_egress_sg_rule(id, group_id, ) else service.create_security_group_sg_rule(id, group_id, ) end true end |
#destroy ⇒ Object
33 34 35 36 37 |
# File 'lib/fog/aliyun/models/compute/security_group.rb', line 33 def destroy requires :id service.delete_security_group(id) true end |
#revoke_security_group_ip_rule(cidr_ip, direction = 'ingress', options = {}) ⇒ Object
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/fog/aliyun/models/compute/security_group.rb', line 70 def revoke_security_group_ip_rule(cidr_ip, direction = 'ingress', = {}) requires :id nic_type = .fetch(:nic_type, 'internet') if direction == 'egress' service.delete_security_group_egress_ip_rule(id, cidr_ip, nic_type, ) else service.delete_security_group_ip_rule(id, cidr_ip, nic_type, ) end true end |
#revoke_seurity_group_sg_rule(group_id, direction = 'ingress', options = {}) ⇒ Object
60 61 62 63 64 65 66 67 68 |
# File 'lib/fog/aliyun/models/compute/security_group.rb', line 60 def revoke_seurity_group_sg_rule(group_id, direction = 'ingress', = {}) requires :id if direction == 'egress' service.delete_security_group_egress_sg_rule(id, group_id, ) else service.delete_security_group_sg_rule(id, group_id, ) end true end |
#save(options = {}) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/fog/aliyun/models/compute/security_group.rb', line 25 def save( = {}) [:vpcId] = vpc_id if vpc_id [:name] = name if name [:description] = description if description Fog::JSON.decode(service.create_security_group().body) true end |
#security_group_rules ⇒ Object
20 21 22 23 |
# File 'lib/fog/aliyun/models/compute/security_group.rb', line 20 def security_group_rules requires :id service.security_group_rules.get(id) end |
#vpc ⇒ Object
15 16 17 18 |
# File 'lib/fog/aliyun/models/compute/security_group.rb', line 15 def vpc requires :vpc_id service.vpcs.get(vpc_id) end |