Class: VectorAmp::ConnectionsResource

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

Overview

Managed OAuth/credential connections used by ingestion sources.

Connections live at the gateway root (/connections), not under /ingestion. A connection captures a provider authorization (e.g. Google Drive, Confluence) that ingestion sources can then reference via connection_id instead of embedding raw credentials.

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ ConnectionsResource

Parameters:

  • transport (#request)

    API transport.



15
16
17
# File 'lib/vector_amp/connections.rb', line 15

def initialize(transport)
  @transport = transport
end

Instance Method Details

#create(provider, source_type: nil) ⇒ Hash

Create a connection and begin the provider authorization flow.

Parameters:

  • provider (String)

    provider identifier (e.g. google_drive, confluence).

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

    optional source type the connection will be used with.

Returns:

  • (Hash)

    created connection with id, provider, status, and authorization_url.



30
31
32
33
# File 'lib/vector_amp/connections.rb', line 30

def create(provider, source_type: nil)
  body = Utils.compact_hash(provider: provider, source_type: source_type)
  @transport.request(:post, "/connections", body: body)
end

#delete(connection_id) ⇒ Hash

Delete a connection.

Parameters:

  • connection_id (String)

    connection id.

Returns:

  • (Hash)

    delete response.



45
46
47
# File 'lib/vector_amp/connections.rb', line 45

def delete(connection_id)
  @transport.request(:delete, "/connections/#{connection_id}")
end

#get(connection_id) ⇒ Hash

Fetch a connection.

Parameters:

  • connection_id (String)

    connection id.

Returns:

  • (Hash)

    connection resource.



38
39
40
# File 'lib/vector_amp/connections.rb', line 38

def get(connection_id)
  @transport.request(:get, "/connections/#{connection_id}")
end

#list(provider: nil) ⇒ Hash

List connections, optionally filtered by provider.

Parameters:

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

    optional provider filter (e.g. google_drive, confluence).

Returns:

  • (Hash)

    response envelope with connections.



22
23
24
# File 'lib/vector_amp/connections.rb', line 22

def list(provider: nil)
  @transport.request(:get, "/connections", query: Utils.compact_hash(provider: provider))
end