Sha256: 15bd87bd66c2aea159f71908d9b98d69452174a3d69e8c16008b931d6d905faa

Contents?: true

Size: 1.99 KB

Versions: 50

Compression:

Stored size: 1.99 KB

Contents

module Fog
  module AWS
    class DataPipeline
      class Real
        # Create a pipeline
        # http://docs.aws.amazon.com/datapipeline/latest/APIReference/API_CreatePipeline.html
        # ==== Parameters
        # * UniqueId <~String> - A unique ID for of the pipeline
        # * Name <~String> - The name of the pipeline
        # * Tags <~Hash> - Key/value string pairs to categorize the pipeline
        # * Description <~String> - Description of the pipeline
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        def create_pipeline(unique_id, name, description=nil, tags=nil)
          params = {
            'uniqueId' => unique_id,
            'name' => name,
          }
          params['tags'] = tags.map {|k,v| {"key" => k.to_s, "value" => v.to_s}} unless tags.nil? || tags.empty?
          params['Description'] = description if description

          response = request({
            :body => Fog::JSON.encode(params),
            :headers => { 'X-Amz-Target' => 'DataPipeline.CreatePipeline' },
          })
        end
      end

      class Mock
        def create_pipeline(unique_id, name, description=nil, tags=nil)
          response = Excon::Response.new

          if existing_pipeline = self.data[:pipelines][unique_id]
            {"pipelineId" => existing_pipeline["pipelineId"]}
          else
            pipeline_id = Fog::AWS::Mock.data_pipeline_id
            mapped_tags = if tags
                            tags.map { |k,v| {"key" => k.to_s, "value" => v.to_s}}
                          else
                            []
                          end

            pipeline = {
              "name"        => name,
              "description" => description,
              "fields"      => mapped_tags,
              "pipelineId"  => pipeline_id,
            }

            self.data[:pipelines][unique_id] = pipeline

            response.body = {"pipelineId" => pipeline_id}
          end
          response
        end
      end
    end
  end
end

Version data entries

50 entries across 48 versions & 2 rubygems

Version Path
fog-aws-3.29.0 lib/fog/aws/requests/data_pipeline/create_pipeline.rb
fog-aws-3.28.0 lib/fog/aws/requests/data_pipeline/create_pipeline.rb
fog-aws-3.27.0 lib/fog/aws/requests/data_pipeline/create_pipeline.rb
fog-aws-3.26.0 lib/fog/aws/requests/data_pipeline/create_pipeline.rb
fog-aws-3.25.0 lib/fog/aws/requests/data_pipeline/create_pipeline.rb
fog-aws-3.24.0 lib/fog/aws/requests/data_pipeline/create_pipeline.rb
fog-aws-3.23.0 lib/fog/aws/requests/data_pipeline/create_pipeline.rb
fog-aws-3.22.0 lib/fog/aws/requests/data_pipeline/create_pipeline.rb
fog-aws-3.21.1 lib/fog/aws/requests/data_pipeline/create_pipeline.rb
fog-aws-3.21.0 lib/fog/aws/requests/data_pipeline/create_pipeline.rb
fog-aws-3.20.0 lib/fog/aws/requests/data_pipeline/create_pipeline.rb
fog-aws-3.19.0 lib/fog/aws/requests/data_pipeline/create_pipeline.rb
fog-aws-3.18.0 lib/fog/aws/requests/data_pipeline/create_pipeline.rb
fog-aws-3.17.0 lib/fog/aws/requests/data_pipeline/create_pipeline.rb
fog-aws-3.16.0 lib/fog/aws/requests/data_pipeline/create_pipeline.rb
fog-aws-3.15.0 lib/fog/aws/requests/data_pipeline/create_pipeline.rb
fog-aws-3.14.0 lib/fog/aws/requests/data_pipeline/create_pipeline.rb
fog-aws-3.13.0 lib/fog/aws/requests/data_pipeline/create_pipeline.rb
fog-aws-3.12.0 lib/fog/aws/requests/data_pipeline/create_pipeline.rb
fog-aws-3.11.0 lib/fog/aws/requests/data_pipeline/create_pipeline.rb