Sha256: b9877a35988b6bacb00f2ce4ea844364dec995e5880104acb20e520c25384c17

Contents?: true

Size: 1.37 KB

Versions: 75

Compression:

Stored size: 1.37 KB

Contents

module Fog
  module AWS
    class Elasticache
      class SecurityGroup < Fog::Model
        identity :id, :aliases => 'CacheSecurityGroupName'
        attribute :description, :aliases => 'Description'
        attribute :ec2_groups, :aliases => 'EC2SecurityGroups', :type => :array
        attribute :owner_id, :aliases => 'OwnerId'

        def ready?
          ec2_groups.all?{|ingress| ingress['Status'] == 'authorized'}
        end

        def destroy
          requires :id
          service.delete_cache_security_group(id)
          true
        end

        def save
          requires :id
          requires :description
          service.create_cache_security_group(id, description)
        end

        def authorize_ec2_group(group_name, group_owner_id=owner_id)
          requires :id
          requires :owner_id if group_owner_id.nil?
          data = service.authorize_cache_security_group_ingress(
            id, group_name, group_owner_id
          )
          merge_attributes(data.body['CacheSecurityGroup'])
        end

        def revoke_ec2_group(group_name, group_owner_id=owner_id)
          requires :id
          requires :owner_id if group_owner_id.nil?
          data = service.revoke_cache_security_group_ingress(
            id, group_name, group_owner_id
          )
          merge_attributes(data.body['CacheSecurityGroup'])
        end
      end
    end
  end
end

Version data entries

75 entries across 73 versions & 3 rubygems

Version Path
fog-aws-3.10.0 lib/fog/aws/models/elasticache/security_group.rb
fog-aws-3.9.0 lib/fog/aws/models/elasticache/security_group.rb
fog-aws-3.8.0 lib/fog/aws/models/elasticache/security_group.rb
fog-aws-3.7.0 lib/fog/aws/models/elasticache/security_group.rb
fog-aws-3.6.7 lib/fog/aws/models/elasticache/security_group.rb
fog-aws-3.6.6 lib/fog/aws/models/elasticache/security_group.rb
fog-aws-3.6.5 lib/fog/aws/models/elasticache/security_group.rb
fog-aws-3.6.4 lib/fog/aws/models/elasticache/security_group.rb
fog-aws-3.6.3 lib/fog/aws/models/elasticache/security_group.rb
fog-aws-3.6.2 lib/fog/aws/models/elasticache/security_group.rb
fog-aws-3.5.2 lib/fog/aws/models/elasticache/security_group.rb
fog-aws-3.5.1 lib/fog/aws/models/elasticache/security_group.rb
fog-aws-3.5.0 lib/fog/aws/models/elasticache/security_group.rb
fog-aws-3.4.0 lib/fog/aws/models/elasticache/security_group.rb
fog-aws-3.3.0 lib/fog/aws/models/elasticache/security_group.rb
fog-aws-3.2.0 lib/fog/aws/models/elasticache/security_group.rb
fog-aws-3.1.0 lib/fog/aws/models/elasticache/security_group.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-aws-2.0.1/lib/fog/aws/models/elasticache/security_group.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-aws-2.0.1/lib/fog/aws/models/elasticache/security_group.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-aws-2.0.1/lib/fog/aws/models/elasticache/security_group.rb