class Fog::AWS::RDS::SecurityGroup

Public Instance Methods

authorize_cidrip(cidrip) click to toggle source
# File lib/fog/aws/models/rds/security_group.rb, line 39
def authorize_cidrip(cidrip)
  authorize_ingress({'CIDRIP' => cidrip})
end
authorize_ec2_security_group(group_name, group_owner_id=owner_id) click to toggle source

group_owner_id defaults to the current owner_id

# File lib/fog/aws/models/rds/security_group.rb, line 31
def authorize_ec2_security_group(group_name, group_owner_id=owner_id)
  key = group_name.match(/^sg-/) ? 'EC2SecurityGroupId' : 'EC2SecurityGroupName'
  authorize_ingress({
    key                       => group_name,
    'EC2SecurityGroupOwnerId' => group_owner_id
  })
end
authorize_ingress(opts) click to toggle source
# File lib/fog/aws/models/rds/security_group.rb, line 53
def authorize_ingress(opts)
  data = service.authorize_db_security_group_ingress(id, opts).body['AuthorizeDBSecurityGroupIngressResult']['DBSecurityGroup']
  merge_attributes(data)
end
authorize_ip_address(ip) click to toggle source

Add the ip address to the RDS security group.

# File lib/fog/aws/models/rds/security_group.rb, line 49
def authorize_ip_address(ip)
  authorize_cidrip("#{ip}/32")
end
authorize_me() click to toggle source

Add the current machine to the RDS security group.

# File lib/fog/aws/models/rds/security_group.rb, line 44
def authorize_me
  authorize_ip_address(Fog::CurrentMachine.ip_address)
end
destroy() click to toggle source
# File lib/fog/aws/models/rds/security_group.rb, line 15
def destroy
  requires :id
  service.delete_db_security_group(id)
  true
end
ready?() click to toggle source
# 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) click to toggle source
# 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) click to toggle source

group_owner_id defaults to the current owner_id

# 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) click to toggle source
# 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() click to toggle source
# 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