Class: Fog::AWS::RDS::SecurityGroup
- Defined in:
- lib/fog/aws/models/rds/security_group.rb
Instance Attribute Summary
Attributes inherited from Model
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
Methods inherited from Model
#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Fog::Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Core::DeprecatedConnectionAccessors
#connection, #connection=, #prepare_service_value
Methods included from Fog::Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Model
Instance Method Details
#authorize_cidrip(cidrip) ⇒ Object
43 44 45 |
# File 'lib/fog/aws/models/rds/security_group.rb', line 43 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
36 37 38 39 40 41 |
# File 'lib/fog/aws/models/rds/security_group.rb', line 36 def (group_name, group_owner_id=owner_id) ({ 'EC2SecurityGroupName' => group_name, 'EC2SecurityGroupOwnerId' => group_owner_id }) end |
#authorize_ingress(opts) ⇒ Object
57 58 59 60 |
# File 'lib/fog/aws/models/rds/security_group.rb', line 57 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.
53 54 55 |
# File 'lib/fog/aws/models/rds/security_group.rb', line 53 def (ip) ("#{ip}/32") end |
#authorize_me ⇒ Object
Add the current machine to the RDS security group.
48 49 50 |
# File 'lib/fog/aws/models/rds/security_group.rb', line 48 def (Fog::CurrentMachine.ip_address) end |
#destroy ⇒ Object
20 21 22 23 24 |
# File 'lib/fog/aws/models/rds/security_group.rb', line 20 def destroy requires :id service.delete_db_security_group(id) true end |
#ready? ⇒ Boolean
16 17 18 |
# File 'lib/fog/aws/models/rds/security_group.rb', line 16 def ready? (ec2_security_groups + ip_ranges).all?{|ingress| ingress['Status'] == 'authorized'} end |
#revoke_cidrip(cidrip) ⇒ Object
70 71 72 |
# File 'lib/fog/aws/models/rds/security_group.rb', line 70 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
63 64 65 66 67 68 |
# File 'lib/fog/aws/models/rds/security_group.rb', line 63 def revoke_ec2_security_group(group_name, group_owner_id=owner_id) revoke_ingress({ 'EC2SecurityGroupName' => group_name, 'EC2SecurityGroupOwnerId' => group_owner_id }) end |
#revoke_ingress(opts) ⇒ Object
74 75 76 77 |
# File 'lib/fog/aws/models/rds/security_group.rb', line 74 def revoke_ingress(opts) data = service.revoke_db_security_group_ingress(id, opts).body['RevokeDBSecurityGroupIngressResult']['DBSecurityGroup'] merge_attributes(data) end |
#save ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/fog/aws/models/rds/security_group.rb', line 26 def save requires :id requires :description data = service.create_db_security_group(id, description).body['CreateDBSecurityGroupResult']['DBSecurityGroup'] merge_attributes(data) true end |