integrations
Creates, updates, deletes, gets or lists an integrations
resource.
Overview
Name | integrations |
Type | Resource |
Id | vercel.log_drains.integrations |
Fields
The following fields are returned by SELECT
queries:
- get_integration_log_drains
A list of log drains
Name | Datatype | Description |
---|---|---|
id | string | The unique identifier of the log drain. Always prefixed with ld_ (example: ld_nBuA7zCID8g4QZ8g) |
name | string | The name of the log drain (example: My first log drain) |
branch | string | The branch regexp of log drain (example: feature/*) |
clientId | string | The oauth2 client application id that created this log drain (example: oac_xRhY4LAB7yLhUADD69EvV7ct) |
configurationId | string | The client configuration this log drain was created with (example: icfg_cuwj0AdCdH3BwWT4LPijCC7t) |
createdAt | number | A timestamp that tells you when the log drain was created |
createdFrom | string | Whether the log drain was created by an integration or by a user (example: integration) |
deliveryFormat | string | The delivery log format (example: json) |
environment | string | The environment of log drain (example: production) |
headers | object | The headers to send with the request (example: {"Authorization": "Bearer 123"}) |
ownerId | string | The identifier of the team or user whose events will trigger the log drain (example: kr1PsOIzqEL5Xg6M4VZcZosf) |
projectId | string | (example: AbCgVkqoxXeXCDWehVir51LHGrrcWL4mkYm14W6UBPWQeb) |
projectIds | array | The identifier of the projects this log drain is associated with (example: AbCgVkqoxXeXCDWehVir51LHGrrcWL4mkYm14W6UBPWQeb) |
sources | array | The sources from which logs are currently being delivered to this log drain. |
url | string | The URL to call when logs are generated (example: https://example.com/log-drain) |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get_integration_log_drains | select | teamId | Retrieves a list of all Integration log drains that are defined for the authenticated user or team. When using an OAuth2 token, the list is limited to log drains created by the authenticated integration. | |
create_log_drain | insert | teamId , data__name , data__url | Creates an Integration log drain. This endpoint must be called with an OAuth2 client (integration), since log drains are tied to integrations. If it is called with a different token type it will produce a 400 error. | |
delete_integration_log_drain | delete | id , teamId | updateFlow | Deletes the Integration log drain with the provided id . When using an OAuth2 Token, the log drain can be deleted only if the integration owns it. |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
id | string | ID of the log drain to be deleted |
teamId | string | The Team identifier or slug to perform the request on behalf of. |
updateFlow | boolean | If this API is being called as part of an update flow, this should be set to true |
SELECT
examples
- get_integration_log_drains
Retrieves a list of all Integration log drains that are defined for the authenticated user or team. When using an OAuth2 token, the list is limited to log drains created by the authenticated integration.
SELECT
id,
name,
branch,
clientId,
configurationId,
createdAt,
createdFrom,
deliveryFormat,
environment,
headers,
ownerId,
projectId,
projectIds,
sources,
url
FROM vercel.log_drains.integrations
WHERE teamId = '{{ teamId }}' -- required
;
INSERT
examples
- create_log_drain
- Manifest
Creates an Integration log drain. This endpoint must be called with an OAuth2 client (integration), since log drains are tied to integrations. If it is called with a different token type it will produce a 400 error.
INSERT INTO vercel.log_drains.integrations (
data__name,
data__projectIds,
data__secret,
data__deliveryFormat,
data__url,
data__sources,
data__headers,
data__environment,
data__branch,
data__previousLogDrainId,
teamId
)
SELECT
'{{ name }}' /* required */,
'{{ projectIds }}',
'{{ secret }}',
'{{ deliveryFormat }}',
'{{ url }}' /* required */,
'{{ sources }}',
'{{ headers }}',
'{{ environment }}',
'{{ branch }}',
'{{ previousLogDrainId }}',
'{{ teamId }}'
RETURNING
id,
name,
branch,
clientId,
configurationId,
createdAt,
createdFrom,
deliveryFormat,
environment,
headers,
ownerId,
projectId,
projectIds,
sources,
url
;
# Description fields are for documentation purposes
- name: integrations
props:
- name: teamId
value: string
description: Required parameter for the integrations resource.
- name: name
value: string
description: |
The name of the log drain
- name: projectIds
value: array
- name: secret
value: string
description: |
A secret to sign log drain notification headers so a consumer can verify their authenticity
- name: deliveryFormat
value: string
description: |
The delivery log format
valid_values: ['json', 'ndjson', 'syslog']
- name: url
value: string
description: |
The url where you will receive logs. The protocol must be `https://` or `http://` when type is `json` and `ndjson`, and `syslog+tls:` or `syslog:` when the type is `syslog`.
- name: sources
value: array
- name: headers
value: object
description: |
Headers to be sent together with the request
- name: environment
value: string
description: |
The environment of log drain
valid_values: ['preview', 'production']
- name: branch
value: string
description: |
The branch regexp of log drain
- name: previousLogDrainId
value: string
description: |
The id of the log drain that was previously created and deleted
DELETE
examples
- delete_integration_log_drain
Deletes the Integration log drain with the provided id
. When using an OAuth2 Token, the log drain can be deleted only if the integration owns it.
DELETE FROM vercel.log_drains.integrations
WHERE id = '{{ id }}' --required
AND teamId = '{{ teamId }}' --required
AND updateFlow = '{{ updateFlow }}'
;