Class: Waterworks::PipelineDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/waterworks/containers/pipeline_definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uid, name, client = nil) ⇒ PipelineDefinition

Returns a new instance of PipelineDefinition.



7
8
9
10
11
12
# File 'lib/waterworks/containers/pipeline_definition.rb', line 7

def initialize(uid, name, client = nil)
  @uid = uid
  @name = name
  client = Aws::DataPipeline::Client.new if client.nil?
  @client = client
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



5
6
7
# File 'lib/waterworks/containers/pipeline_definition.rb', line 5

def description
  @description
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/waterworks/containers/pipeline_definition.rb', line 5

def name
  @name
end

#pipeline_idObject

Returns the value of attribute pipeline_id.



5
6
7
# File 'lib/waterworks/containers/pipeline_definition.rb', line 5

def pipeline_id
  @pipeline_id
end

#pipeline_objectsObject

Returns the value of attribute pipeline_objects.



5
6
7
# File 'lib/waterworks/containers/pipeline_definition.rb', line 5

def pipeline_objects
  @pipeline_objects
end

#tagsObject

Returns the value of attribute tags.



5
6
7
# File 'lib/waterworks/containers/pipeline_definition.rb', line 5

def tags
  @tags
end

#uidObject

Returns the value of attribute uid.



5
6
7
# File 'lib/waterworks/containers/pipeline_definition.rb', line 5

def uid
  @uid
end

Instance Method Details

#activate_pipeline!Object



32
33
34
35
36
# File 'lib/waterworks/containers/pipeline_definition.rb', line 32

def activate_pipeline!
  @client.activate_pipeline(
    pipeline_id: @pipeline_id
  )
end

#create_pipeline!Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/waterworks/containers/pipeline_definition.rb', line 14

def create_pipeline!
  resp = @client.create_pipeline(
    name: @name,
    unique_id: @uid,
    description: @description,
    tags: [@tags].flatten.map(&:to_hash)
  )
  @pipeline_id = resp.pipeline_id
  resp
end

#go_baby_go!Object



38
39
40
41
42
43
44
# File 'lib/waterworks/containers/pipeline_definition.rb', line 38

def go_baby_go!
  responses = {}
  responses[:create] = create_pipeline!
  responses[:put] = put_pipeline!
  responses[:activate] = activate_pipeline!
  responses
end

#put_pipeline!Object



25
26
27
28
29
30
# File 'lib/waterworks/containers/pipeline_definition.rb', line 25

def put_pipeline!
  @client.put_pipeline_definition(
    pipeline_id: @pipeline_id,
    pipeline_objects: @pipeline_objects.map(&:to_fhash)
  )
end

#validate!Object



46
47
48
# File 'lib/waterworks/containers/pipeline_definition.rb', line 46

def validate!
  @uid && @name && @pipeline_object.any?
end