File: subnet_group.rb

package info (click to toggle)
ruby-fog-aws 3.3.0-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,816 kB
  • sloc: ruby: 68,587; makefile: 6
file content (30 lines) | stat: -rw-r--r-- 819 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
module Fog
  module AWS
    class Elasticache
      class SubnetGroup < Fog::Model
        identity   :id, :aliases => ['CacheSubnetGroupName', :name]
        attribute  :description, :aliases => 'CacheSubnetGroupDescription'
        attribute  :vpc_id, :aliases => 'VpcId'
        attribute  :subnet_ids, :aliases => 'Subnets'

        def ready?
          # Just returning true, as Elasticache subnet groups
          # seem to not have a status, unlike RDS subnet groups.
          true
        end

        def save
          requires :description, :id, :subnet_ids
          service.create_cache_subnet_group(id, subnet_ids, description)
          reload
        end

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