Class: Fog::AWS::DataPipeline::Pipeline

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/aws/models/data_pipeline/pipeline.rb

Instance Attribute Summary

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Model

#inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Fog::Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Fog::Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

#initialize(attributes = {}) ⇒ Pipeline

Returns a new instance of Pipeline.



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fog/aws/models/data_pipeline/pipeline.rb', line 17

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

Instance Method Details

#activateObject



39
40
41
42
43
44
45
# File 'lib/fog/aws/models/data_pipeline/pipeline.rb', line 39

def activate
  requires :id

  service.activate_pipeline(id)

  true
end

#destroyObject



55
56
57
58
59
60
61
# File 'lib/fog/aws/models/data_pipeline/pipeline.rb', line 55

def destroy
  requires :id

  service.delete_pipeline(id)

  true
end

#put(objects) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/fog/aws/models/data_pipeline/pipeline.rb', line 47

def put(objects)
  requires :id

  service.put_pipeline_definition(id, objects)

  true
end

#saveObject



29
30
31
32
33
34
35
36
37
# File 'lib/fog/aws/models/data_pipeline/pipeline.rb', line 29

def save
  requires :name
  requires :unique_id

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

  true
end