Sha256: c9fbc0da62716cc628d752566c4ec3e2c8e2c6f9310db57f6dadbb56aed6e343

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 KB

Contents

require 'fog/openstack/models/collection'
require 'fog/openstack/models/monitoring/notification_method'

module Fog
  module Monitoring
    class OpenStack
      class NotificationMethods < Fog::OpenStack::Collection
        model Fog::Monitoring::OpenStack::NotificationMethod

        def all(options = {})
          load_response(service.list_notification_methods(options), 'elements')
        end

        def create(attributes)
          super(attributes)
        end

        def patch(attributes)
          super(attributes)
        end

        def find_by_id(id)
          cached_notification_method = detect { |notification_method| notification_method.id == id }
          return cached_notification_method if cached_notification_method
          notification_method_hash = service.get_notification_method(id).body
          Fog::Monitoring::OpenStack::NotificationMethod.new(
            notification_method_hash.merge(:service => service)
          )
        end

        def destroy(id)
          notification_method = find_by_id(id)
          notification_method.destroy
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-openstack-0.1.10 lib/fog/openstack/models/monitoring/notification_methods.rb
fog-openstack-0.1.9 lib/fog/openstack/models/monitoring/notification_methods.rb
fog-openstack-0.1.8 lib/fog/openstack/models/monitoring/notification_methods.rb
fog-openstack-0.1.7 lib/fog/openstack/models/monitoring/notification_methods.rb