Class: Fog::AWS::RDS::SecurityGroup
- Inherits:
-
Model
- Object
- Model
- Fog::AWS::RDS::SecurityGroup
- Defined in:
- lib/fog/aws/models/rds/security_group.rb
Instance Method Summary collapse
- #authorize_cidrip(cidrip) ⇒ Object
-
#authorize_ec2_security_group(group_name, group_owner_id = owner_id) ⇒ Object
group_owner_id defaults to the current owner_id.
- #authorize_ingress(opts) ⇒ Object
-
#authorize_ip_address(ip) ⇒ Object
Add the ip address to the RDS security group.
-
#authorize_me ⇒ Object
Add the current machine to the RDS security group.
- #destroy ⇒ Object
- #ready? ⇒ Boolean
- #revoke_cidrip(cidrip) ⇒ Object
-
#revoke_ec2_security_group(group_name, group_owner_id = owner_id) ⇒ Object
group_owner_id defaults to the current owner_id.
- #revoke_ingress(opts) ⇒ Object
- #save ⇒ Object
Instance Method Details
#authorize_cidrip(cidrip) ⇒ Object
39 40 41 |
# File 'lib/fog/aws/models/rds/security_group.rb', line 39 def (cidrip) ({'CIDRIP' => cidrip}) end |
#authorize_ec2_security_group(group_name, group_owner_id = owner_id) ⇒ Object
group_owner_id defaults to the current owner_id
31 32 33 34 35 36 37 |
# File 'lib/fog/aws/models/rds/security_group.rb', line 31 def (group_name, group_owner_id=owner_id) key = group_name.match(/^sg-/) ? 'EC2SecurityGroupId' : 'EC2SecurityGroupName' ({ key => group_name, 'EC2SecurityGroupOwnerId' => group_owner_id }) end |
#authorize_ingress(opts) ⇒ Object
53 54 55 56 |
# File 'lib/fog/aws/models/rds/security_group.rb', line 53 def (opts) data = service.(id, opts).body['AuthorizeDBSecurityGroupIngressResult']['DBSecurityGroup'] merge_attributes(data) end |
#authorize_ip_address(ip) ⇒ Object
Add the ip address to the RDS security group.
49 50 51 |
# File 'lib/fog/aws/models/rds/security_group.rb', line 49 def (ip) ("#{ip}/32") end |
#authorize_me ⇒ Object
Add the current machine to the RDS security group.
44 45 46 |
# File 'lib/fog/aws/models/rds/security_group.rb', line 44 def (Fog::CurrentMachine.ip_address) end |
#destroy ⇒ Object
15 16 17 18 19 |
# File 'lib/fog/aws/models/rds/security_group.rb', line 15 def destroy requires :id service.delete_db_security_group(id) true end |
#ready? ⇒ Boolean
11 12 13 |
# File 'lib/fog/aws/models/rds/security_group.rb', line 11 def ready? (ec2_security_groups + ip_ranges).all?{|ingress| ingress['Status'] == 'authorized'} end |
#revoke_cidrip(cidrip) ⇒ Object
67 68 69 |
# File 'lib/fog/aws/models/rds/security_group.rb', line 67 def revoke_cidrip(cidrip) revoke_ingress({'CIDRIP' => cidrip}) end |
#revoke_ec2_security_group(group_name, group_owner_id = owner_id) ⇒ Object
group_owner_id defaults to the current owner_id
59 60 61 62 63 64 65 |
# File 'lib/fog/aws/models/rds/security_group.rb', line 59 def revoke_ec2_security_group(group_name, group_owner_id=owner_id) key = group_name.match(/^sg-/) ? 'EC2SecurityGroupId' : 'EC2SecurityGroupName' revoke_ingress({ key => group_name, 'EC2SecurityGroupOwnerId' => group_owner_id }) end |
#revoke_ingress(opts) ⇒ Object
71 72 73 74 |
# File 'lib/fog/aws/models/rds/security_group.rb', line 71 def revoke_ingress(opts) data = service.revoke_db_security_group_ingress(id, opts).body['RevokeDBSecurityGroupIngressResult']['DBSecurityGroup'] merge_attributes(data) end |
#save ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/fog/aws/models/rds/security_group.rb', line 21 def save requires :id requires :description data = service.create_db_security_group(id, description).body['CreateDBSecurityGroupResult']['DBSecurityGroup'] merge_attributes(data) true end |