Class: VectorAmp::GoogleDriveSource

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

Overview

Google Drive ingestion source.

Constant Summary

Constants inherited from Source

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(name: nil, folder_ids: nil, file_ids: nil, auth_mode: nil, service_account_json: nil, oauth_credentials: nil, connection_id: nil, description: nil, metadata: nil, id: nil, **config) ⇒ GoogleDriveSource

Parameters:

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

    defaults to google-drive-<first id> or google-drive-source.

  • folder_ids (String, Array<String>, nil) (defaults to: nil)

    folder ids to ingest; required if file_ids is empty.

  • file_ids (String, Array<String>, nil) (defaults to: nil)

    file ids to ingest; required if folder_ids is empty.

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

    auth strategy (service_account, oauth); omitted from config when nil.

  • service_account_json (Hash, String, nil) (defaults to: nil)

    service-account credentials for service_account auth.

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

    OAuth credentials for oauth auth.

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

    optional managed connection id used in place of inline credentials.

  • 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 Google Drive-source config forwarded to the API.



256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/vector_amp/source.rb', line 256

def initialize(name: nil, folder_ids: nil, file_ids: nil, auth_mode: nil, service_account_json: nil,
               oauth_credentials: nil, connection_id: nil, description: nil, metadata: nil, id: nil, **config)
  if Array(folder_ids).empty? && Array(file_ids).empty?
    raise ArgumentError, "folder_ids or file_ids is required"
  end

  super(
    id: id,
    source_type: "gdrive",
    name: name || SourceNames.google_drive(folder_ids: folder_ids, file_ids: file_ids),
    description: description,
    metadata: ,
    config: Utils.compact_hash(config.merge(
      folder_ids: folder_ids,
      file_ids: file_ids,
      auth_mode: auth_mode,
      service_account_json: ,
      oauth_credentials: oauth_credentials,
      connection_id: connection_id
    ))
  )
end