Sha256: 4fdf97ebc7a248fa7180f8f172cacf336feb794daee9254b669d3b25519970ba

Contents?: true

Size: 1.41 KB

Versions: 61

Compression:

Stored size: 1.41 KB

Contents

require 'fog/core/model'

module Fog
  module AWS
    class DataPipeline

      class Pipeline < Fog::Model

        identity  :id, :aliases => 'pipelineId'
        attribute :name
        attribute :description
        attribute :user_id, :aliases => 'userId'
        attribute :account_id, :aliases => 'accountId'
        attribute :state, :aliases => 'pipelineState'
        attribute :unique_id, :aliases => 'uniqueId'

        def initialize(attributes={})

          # Extract the 'fields' portion of a response to attributes
          if attributes.include?('fields')
            string_fields = attributes['fields'].select { |f| f.include?('stringValue') }
            field_attributes = Hash[string_fields.map { |f| [f['key'][/^@(.+)$/, 1], f['stringValue']] }]
            merge_attributes(field_attributes)
          end

          super
        end

        def save
          requires :name
          requires :unique_id

          data = service.create_pipeline(unique_id, name)
          merge_attributes(data)

          true
        end

        def activate
          requires :id

          service.activate_pipeline(id)

          true
        end

        def put(objects)
          requires :id

          service.put_pipeline_definition(id, objects)

          true
        end

        def destroy
          requires :id

          service.delete_pipeline(id)

          true
        end

      end

    end
  end
end

Version data entries

61 entries across 61 versions & 6 rubygems

Version Path
fog-1.22.0 lib/fog/aws/models/data_pipeline/pipeline.rb
fog-1.21.0 lib/fog/aws/models/data_pipeline/pipeline.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/aws/models/data_pipeline/pipeline.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/aws/models/data_pipeline/pipeline.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/aws/models/data_pipeline/pipeline.rb
fog-1.20.0 lib/fog/aws/models/data_pipeline/pipeline.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/aws/models/data_pipeline/pipeline.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/aws/models/data_pipeline/pipeline.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/aws/models/data_pipeline/pipeline.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/aws/models/data_pipeline/pipeline.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/aws/models/data_pipeline/pipeline.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/aws/models/data_pipeline/pipeline.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/aws/models/data_pipeline/pipeline.rb
fog-1.19.0 lib/fog/aws/models/data_pipeline/pipeline.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/aws/models/data_pipeline/pipeline.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/aws/models/data_pipeline/pipeline.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/aws/models/data_pipeline/pipeline.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/aws/models/data_pipeline/pipeline.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/aws/models/data_pipeline/pipeline.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/aws/models/data_pipeline/pipeline.rb