Sha256: 37d8fe424c9c3b1f20f7e4c2e01e51465b8e7ba9525b61a37da776620c7a7551

Contents?: true

Size: 1.22 KB

Versions: 6

Compression:

Stored size: 1.22 KB

Contents

require 'fog/core/model'

module Fog
  module AWS
    class RDS
      class EventSubscription < Fog::Model
        identity :id, :aliases => 'CustSubscriptionId'

        attribute :event_categories, :aliases => 'EventCategories', :type => :array
        attribute :source_type,      :aliases => 'SourceType'
        attribute :enabled,          :aliases => 'Enabled'
        attribute :status,           :aliases => 'Status'
        attribute :creation_time,    :aliases => 'SubscriptionCreationTime'
        attribute :sns_topic_arn,    :aliases => 'SnsTopicArn'

        def ready?
          ! ['deleting', 'creating'].include?(status)
        end

        def destroy
          service.delete_event_subscription(id)
          reload
        end

        def save
          requires :id, :sns_topic_arn

          data = service.create_event_subscription(
            'EventCategories'  => event_categories,
            'SourceType'       => source_type,
            'Enabled'          => enabled || true,
            'SubscriptionName' => id,
            'SnsTopicArn'      => sns_topic_arn
          ).body["CreateEventSubscriptionResult"]["EventSubscription"]
          merge_attributes(data)
          self
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fog-aws-0.1.1 lib/fog/aws/models/rds/event_subscription.rb
fog-aws-0.1.0 lib/fog/aws/models/rds/event_subscription.rb
fog-aws-0.0.8 lib/fog/aws/models/rds/event_subscription.rb
fog-aws-0.0.7 lib/fog/aws/models/rds/event_subscription.rb
fog-aws-0.0.6 lib/fog/aws/models/rds/event_subscription.rb
fog-aws-0.0.5 lib/fog/aws/models/rds/event_subscription.rb