Class: VectorAmp::S3Source

Inherits:
Source
  • Object
show all
Defined in:
lib/vector_amp/source.rb

Overview

S3 ingestion source.

Constant Summary

Constants inherited from Source

VectorAmp::Source::SUPPORTED_SOURCE_TYPES

Instance Attribute Summary

Attributes inherited from Source

#config, #description, #id, #metadata, #name, #source_type

Instance Method Summary collapse

Methods inherited from Source

#[], from_api, #inspect, normalize_hash, #to_create_body, #to_h

Constructor Details

#initialize(bucket:, name: nil, prefix: nil, description: nil, metadata: nil, id: nil, **config) ⇒ S3Source

Parameters:

  • bucket (String)

    required S3 bucket name.

  • name (String, nil) (defaults to: nil)

    defaults to s3-<bucket> or s3-<bucket>-<prefix>.

  • prefix (String, nil) (defaults to: nil)

    optional object prefix.

  • description (String, nil) (defaults to: nil)

    optional description.

  • metadata (Hash, nil) (defaults to: nil)

    optional metadata.

  • id (String, nil) (defaults to: nil)

    optional API source id.

  • config (Hash)

    additional S3-source config forwarded to the API.

Raises:

  • (ArgumentError)


212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/vector_amp/source.rb', line 212

def initialize(bucket:, name: nil, prefix: nil, description: nil, metadata: nil, id: nil, **config)
  raise ArgumentError, "bucket is required" if bucket.nil? || bucket.to_s.empty?

  super(
    id: id,
    source_type: "s3",
    name: name || SourceNames.s3(bucket, prefix),
    description: description,
    metadata: ,
    config: Utils.compact_hash(config.merge(bucket: bucket, prefix: prefix))
  )
end