Class: Fog::AWS::RDS::SecurityGroup

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/aws/models/rds/security_group.rb

Instance Attribute Summary

Attributes inherited from Model

#collection, #connection

Instance Method Summary collapse

Methods inherited from Model

#initialize, #inspect, #reload, #to_json, #wait_for

Methods included from Fog::Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Fog::Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#authorize_cidrip(cidrip) ⇒ Object



42
43
44
# File 'lib/fog/aws/models/rds/security_group.rb', line 42

def authorize_cidrip(cidrip)
  authorize_ingress({'CIDRIP' => cidrip})
end

#authorize_ec2_security_group(group_name, group_owner_id = owner_id) ⇒ Object

group_owner_id defaults to the current owner_id



35
36
37
38
39
40
# File 'lib/fog/aws/models/rds/security_group.rb', line 35

def authorize_ec2_security_group(group_name, group_owner_id=owner_id)
  authorize_ingress({
    'EC2SecurityGroupName' => group_name,
    'EC2SecurityGroupOwnerId' => group_owner_id
  })
end

#authorize_ingress(opts) ⇒ Object



46
47
48
49
# File 'lib/fog/aws/models/rds/security_group.rb', line 46

def authorize_ingress(opts)
  data = connection.authorize_db_security_group_ingress(id, opts).body['AuthorizeDBSecurityGroupIngressResult']['DBSecurityGroup']
  merge_attributes(data)
end

#destroyObject



19
20
21
22
23
# File 'lib/fog/aws/models/rds/security_group.rb', line 19

def destroy
  requires :id
  connection.delete_db_security_group(id)
  true
end

#ready?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/fog/aws/models/rds/security_group.rb', line 15

def ready?
  (ec2_security_groups + ip_ranges).all?{|ingress| ingress['Status'] == 'authorized'}
end

#revoke_cidrip(cidrip) ⇒ Object



59
60
61
# File 'lib/fog/aws/models/rds/security_group.rb', line 59

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



52
53
54
55
56
57
# File 'lib/fog/aws/models/rds/security_group.rb', line 52

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



63
64
65
66
# File 'lib/fog/aws/models/rds/security_group.rb', line 63

def revoke_ingress(opts)
  data = connection.revoke_db_security_group_ingress(id, opts).body['RevokeDBSecurityGroupIngressResult']['DBSecurityGroup']
  merge_attributes(data)
end

#saveObject



25
26
27
28
29
30
31
32
# File 'lib/fog/aws/models/rds/security_group.rb', line 25

def save
  requires :id
  requires :description

  data = connection.create_db_security_group(id, description).body['CreateDBSecurityGroupResult']['DBSecurityGroup']
  merge_attributes(data)
  true
end