Mongodb Atlas
The MongoDB Atlas connector enables seamless integration with Swimlane Turbine, allowing for the automation of database management tasks and trigger creation.
MongoDB Atlas is a fully-managed cloud database developed by the same people that build MongoDB. The MongoDB Atlas connector for Swimlane Turbine allows users to automate complex database operations, such as creating triggers for authentication, database, and scheduled events, as well as running queries and retrieving configurations. This integration empowers security teams to streamline their database-related workflows, enhance real-time data processing, and enforce security measures directly within their security automation playbooks.
MongoDB Atlas is a fully managed cloud database service that allows you to deploy, manage, and scale MongoDB databases easily. It offers various features and tools to ensure your database operates efficiently, securely, and reliably.
Prerequisites
To effectively utilize the MongoDB Atlas connector with Swimlane Turbine, ensure you have the following:
- Username and API Key authentication with the following parameters:
- URL: The base endpoint for MongoDB Atlas API access.
- Public API Key: Your MongoDB Atlas account's public API key.
- Private API Key: Your MongoDB Atlas account's private API key.
Capabilities
This connector provides the following capabilities:
- Create a Authentication Trigger
- Create a Database Trigger
- Create a Scheduled Trigger
- Get All Triggers
- Get GraphQL API Configuration
- Run a MongoDB Query
Notes
Configurations
MongoDB Atlas Authentication
Authenticates using Username and API Key.
Configuration Parameters
Parameter | Description | Type | Required |
|---|---|---|---|
url | A URL to the target host. | string | Required |
username | Public API Key. | string | Required |
apiKey | Private API Key. | string | Required |
verify_ssl | Verify SSL certificate. | boolean | Optional |
http_proxy | A proxy to route requests through. | string | Optional |
Actions
Create a Authentication Trigger
Creates a new authentication trigger in MongoDB Atlas using the provided groupId, appId, name, type, and configuration.
Endpoint
- URL: /api/admin/v3.0/groups/{{groupId}}/apps/{{appId}}/triggers
- Method: POST
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
path_parameters.groupId | string | Required | An Atlas Project/Group ID. |
path_parameters.appId | string | Required | The ObjectID of your application. |
name | string | Optional | The trigger's name. |
type | string | Optional | The trigger type. For authentication triggers, this value is always "AUTHENTICATION". |
disabled | boolean | Optional | If true, the trigger is disabled and does not listen for events or execute. |
config | object | Optional | An object that defines configuration values for the trigger. |
config.operation_type | array | Required | The type of authentication event that the trigger listens for. |
config.providers | array | Required | The type(s) of authentication provider that the trigger listens to. |
function_id | string | Optional | The ID of the function that the trigger calls when it fires. |
function_name | string | Optional | The name of the function that the trigger calls when it fires, i.e. the function described by function_id. |
event_processors | object | Optional | An object where each field name is an event processor ID and each value is an object that configures its corresponding event processor. |
event_processors.FUNCTION | object | Optional | Parameter for Create a Authentication Trigger |
event_processors.FUNCTION.config | object | Optional | Parameter for Create a Authentication Trigger |
event_processors.FUNCTION.config.function_id | string | Optional | The ID of the function that the trigger calls when it fires. |
event_processors.FUNCTION.config.function_name | string | Optional | The name of the function that the trigger calls when it fires, i.e. the function described by function_id. |
event_processors.AWS_EVENTBRIDGE | object | Optional | Unique identifier |
event_processors.AWS_EVENTBRIDGE.config | object | Optional | Unique identifier |
event_processors.AWS_EVENTBRIDGE.config.account_id | string | Optional | An AWS Account ID. |
event_processors.AWS_EVENTBRIDGE.config.region | string | Optional | An AWS region. |
event_processors.AWS_EVENTBRIDGE.config.extended_json_enabled | boolean | Optional | If true, event objects are serialized using EJSON. |
_id | string | Optional | The trigger's unique ID. |
Input Example
{"json_body":{"name":"onNewApiKey","type":"AUTHENTICATION","disabled":true,"config":{"operation_type":["CREATE"],"providers":["api-key"]},"function_id":"5eea9ca4ca0e356e2c2a148a","function_name":"","event_processors":{"FUNCTION":{"config":{"function_id":"","function_name":""}},"AWS_EVENTBRIDGE":{"config":{"account_id":"","region":"","extended_json_enabled":true}}},"_id":""},"path_parameters":{"groupId":"57879f6cc4b32dbe440bb8c5","appId":"5997529e46224c6e42gb6dd9"}}
Output
Parameter | Type | Description |
|---|---|---|
status_code | number | HTTP status code of the response |
reason | string | Response reason phrase |
name | string | Name of the resource |
type | string | Type of the resource |
function_id | string | Unique identifier |
config | object | Output field: config |
config.operation_type | array | Type of the resource |
config.providers | array | Unique identifier |
Output Example
{"status_code":201,"response_headers":{},"reason":"Successfully created","json_body":{"name":"onNewApiKey","type":"AUTHENTICATION","function_id":"5eea9ca4ca0e356e2c2a148a","config":{"operation_type":[],"providers":[]}}}
Create a Database Trigger
Creates a new database trigger in MongoDB Atlas with specified group and app IDs, allowing customization of name, type, and config.
Endpoint
- URL: /api/admin/v3.0/groups/{{groupId}}/apps/{{appId}}/triggers
- Method: POST
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
path_parameters.groupId | string | Required | An Atlas Project/Group ID. |
path_parameters.appId | string | Required | The ObjectID of your application. |
name | string | Optional | The trigger's name. |
type | string | Optional | The trigger type. For database triggers, this value is always "DATABASE". |
disabled | boolean | Optional | If true, the trigger is disabled and does not listen for events or execute. |
config | object | Optional | An object that defines configuration values for the trigger. |
config.service_id | string | Required | The _id value of a linked MongoDB data source. |
config.database | string | Required | The name of a database in the linked data source. |
config.collection | string | Required | The name of a collection in the specified database. The trigger listens to events from this collection. |
config.operation_types | array | Required | The type(s) of MongoDB change event that the trigger listens for. |
config.match | object | Required | A $match expression filters change events. The trigger will only fire if the expression evaluates to true for a given change event. |
config.project | object | Optional | A $project expression returns only the specified fields. You can include or exclude specific fields, or include newly-computed fields. |
config.full_document | boolean | Required | If true, indicates that UPDATE change events should include the most current majority-committed version of the modified document in the fullDocument field. |
config.full_document_before_change | boolean | Required | If true, indicates that UPDATE change events should include a snapshot of the modified document from immediately before the update was applied. |
config.skip_catchup_events | boolean | Optional | If true, enabling the Trigger after it was disabled will not invoke events that occurred while the Trigger was disabled. |
config.tolerate_resume_errors | boolean | Optional | If true, when this Trigger's resume token cannot be found in the cluster's oplog, the Trigger automatically resumes processing events at the next relevant change stream event. |
config.maximum_throughput | boolean | Optional | If true, the trigger will use the maximize throughput option. |
config.unordered | boolean | Required | If true, event ordering is disabled and this Trigger can process events in parallel. If false, event ordering is enabled and the Trigger executes events serially. |
function_id | string | Optional | The ID of the function that the trigger calls when it fires. |
function_name | string | Optional | The name of the function that the trigger calls when it fires, i.e. the function described by function_id. |
event_processors | object | Optional | An object where each field name is an event processor ID and each value is an object that configures its corresponding event processor. |
event_processors.FUNCTION | object | Optional | Parameter for Create a Database Trigger |
event_processors.FUNCTION.config | object | Optional | Parameter for Create a Database Trigger |
event_processors.FUNCTION.config.function_id | string | Optional | The ID of the function that the trigger calls when it fires. |
event_processors.FUNCTION.config.function_name | string | Optional | The name of the function that the trigger calls when it fires, i.e. the function described by function_id. |
Input Example
{"json_body":{"name":"onNewEmployee","type":"DATABASE","disabled":true,"config":{"service_id":"5adeb649b8b998486770ae7c","database":"HR","collection":"employees","operation_types":["INSERT"],"match":{},"project":{},"full_document":true,"full_document_before_change":true,"skip_catchup_events":true,"tolerate_resume_errors":true,"maximum_throughput":true,"unordered":true},"function_id":"","function_name":"","event_processors":{"FUNCTION":{"config":{"function_id":"","function_name":""}},"AWS_EVENTBRIDGE":{"config":{"account_id":"","region":"","extended_json_enabled":true}}},"error_handler":{"config":{"enabled":true,"function_id":""}},"_id":""},"path_parameters":{"groupId":"57879f6cc4b32dbe440bb8c5","appId":"5997529e46224c6e42gb6dd9"}}
Output
Parameter | Type | Description |
|---|---|---|
status_code | number | HTTP status code of the response |
reason | string | Response reason phrase |
name | string | Name of the resource |
type | string | Type of the resource |
function_id | string | Unique identifier |
config | object | Output field: config |
config.operation_types | array | Type of the resource |
config.database | string | Response data |
config.collection | string | Output field: config.collection |
config.service_id | string | Unique identifier |
config.match | object | Output field: config.match |
config.project | object | Output field: config.project |
config.full_document | boolean | Output field: config.full_document |
Output Example
{"status_code":201,"response_headers":{},"reason":"Successfully created","json_body":{"name":"onNewEmployee","type":"DATABASE","function_id":"5eea9ca4ca0e356e2c2a148a","config":{"operation_types":[],"database":"HR","collection":"employees","service_id":"5adeb649b8b998486770ae7c","match":{},"project":{},"full_document":true}}}
Create a Scheduled Trigger
Creates a new scheduled trigger in MongoDB Atlas using the provided name, type, and configuration along with groupId and appId.
Endpoint
- URL: /api/admin/v3.0/groups/{{groupId}}/apps/{{appId}}/triggers
- Method: POST
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
path_parameters.groupId | string | Required | An Atlas Project/Group ID. |
path_parameters.appId | string | Required | The ObjectID of your application. |
name | string | Optional | The trigger's name. |
type | string | Optional | The trigger type. For scheduled triggers, this value is always "SCHEDULED". |
disabled | boolean | Optional | If true, the trigger is disabled and does not listen for events or execute. |
config | object | Optional | An object that defines configuration values for the trigger. |
config.schedule | string | Required | A cron expression that specifies when the trigger executes. |
config.skip_catchup_events | boolean | Optional | If true, enabling the trigger after it was disabled will not invoke events that occurred while the trigger was disabled. |
function_id | string | Optional | The ID of the function that the trigger calls when it fires. |
function_name | string | Optional | The name of the function that the trigger calls when it fires, i.e. the function described by function_id. |
event_processors | object | Optional | An object where each field name is an event processor ID and each value is an object that configures its corresponding event processor. |
event_processors.FUNCTION | object | Optional | Parameter for Create a Scheduled Trigger |
event_processors.FUNCTION.config | object | Optional | Parameter for Create a Scheduled Trigger |
event_processors.FUNCTION.config.function_id | string | Optional | The ID of the function that the trigger calls when it fires. |
event_processors.FUNCTION.config.function_name | string | Optional | The name of the function that the trigger calls when it fires, i.e. the function described by function_id. |
event_processors.AWS_EVENTBRIDGE | object | Optional | Unique identifier |
event_processors.AWS_EVENTBRIDGE.config | object | Optional | Unique identifier |
event_processors.AWS_EVENTBRIDGE.config.account_id | string | Optional | An AWS Account ID. |
event_processors.AWS_EVENTBRIDGE.config.region | string | Optional | An AWS region. |
event_processors.AWS_EVENTBRIDGE.config.extended_json_enabled | boolean | Optional | If true, event objects are serialized using EJSON. |
_id | string | Optional | The trigger's unique ID. |
Input Example
{"json_body":{"name":"createDailyReport","type":"SCHEDULED","disabled":true,"config":{"schedule":"0 8 * * *","skip_catchup_events":true},"function_id":"5eea9ca4ca0e356e2c2a148a","function_name":"","event_processors":{"FUNCTION":{"config":{"function_id":"","function_name":""}},"AWS_EVENTBRIDGE":{"config":{"account_id":"","region":"","extended_json_enabled":true}}},"_id":""},"path_parameters":{"groupId":"57879f6cc4b32dbe440bb8c5","appId":"5997529e46224c6e42gb6dd9"}}
Output
Parameter | Type | Description |
|---|---|---|
status_code | number | HTTP status code of the response |
reason | string | Response reason phrase |
name | string | Name of the resource |
type | string | Type of the resource |
function_id | string | Unique identifier |
config | object | Output field: config |
config.schedule | string | Output field: config.schedule |
Output Example
{"status_code":201,"response_headers":{},"reason":"Successfully created","json_body":{"name":"createDailyReport","type":"SCHEDULED","function_id":"5eea9ca4ca0e356e2c2a148a","config":{"schedule":"0 8 * * *"}}}
Get all Triggers
Retrieve all triggers for a given group and application in MongoDB Atlas, requiring 'groupId' and 'appId' as path parameters.
Endpoint
- URL: /api/admin/v3.0/groups/{{groupId}}/apps/{{appId}}/triggers
- Method: GET
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
path_parameters.groupId | string | Required | An Atlas Project/Group ID. |
path_parameters.appId | string | Required | The ObjectID of your application. |
Input Example
{"path_parameters":{"groupId":"57879f6cc4b32dbe440bb8c5","appId":"5997529e46224c6e42gb6dd9"}}
Output
Parameter | Type | Description |
|---|---|---|
status_code | number | HTTP status code of the response |
reason | string | Response reason phrase |
Output Example
{"status_code":200,"response_headers":{},"reason":"Successfully listed triggers","json_body":[{"name":"onNewEmployee","type":"DATABASE","function_id":"5eea9ca4ca0e356e2c2a148a","config":{}}]}
Get GraphQL API Configuration
Retrieve the GraphQL API configuration for a specified app in a MongoDB Atlas project, using group and app IDs.
Endpoint
- URL: /api/admin/v3.0/groups/{{groupId}}/apps/{{appId}}/graphql/config
- Method: GET
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
path_parameters.groupId | string | Required | An Atlas Project/Group ID. |
path_parameters.appId | string | Required | The ObjectID of your application. |
Input Example
{"path_parameters":{"groupId":"57879f6cc4b32dbe440bb8c5","appId":"5997529e46224c6e42gb6dd9"}}
Output
Parameter | Type | Description |
|---|---|---|
status_code | number | HTTP status code of the response |
reason | string | Response reason phrase |
use_natural_pluralization | boolean | Output field: use_natural_pluralization |
disable_schema_introspection | boolean | Output field: disable_schema_introspection |
Output Example
{"status_code":200,"response_headers":{},"reason":"OK","json_body":{"use_natural_pluralization":true,"disable_schema_introspection":true}}
Run a MongoDB Query
Executes a specified query or mutation directly in MongoDB Atlas with system-level privileges, requiring groupId, appId, and the query.
Endpoint
- URL: /api/admin/v3.0/groups/{{groupId}}/apps/{{appId}}/graphql
- Method: POST
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
path_parameters.groupId | string | Required | An Atlas Project/Group ID. |
path_parameters.appId | string | Required | he ObjectID of your application. |
query | string | Optional | A stringified .graphql file that contains one or more valid GraphQL operations for your API. |
variables | string | Optional | A stringified JSON object where each field name maps a value to a variable in the specified operation. |
operationName | string | Optional | he name of the GraphQL operation specified in query to run. |
Input Example
{"json_body":{"query":"query AllTasks { tasks(query: { status: $status }) { _id owner } }","variables":"{ \"status\": \"complete\" }","operationName":"AllTasks"},"path_parameters":{"groupId":"57879f6cc4b32dbe440bb8c5","appId":"5997529e46224c6e42gb6dd9"}}
Output
Parameter | Type | Description |
|---|---|---|
status_code | number | HTTP status code of the response |
reason | string | Response reason phrase |
data | object | Response data |
errors | array | Error message if any |
errors.message | string | Response message |
errors.locations | array | Error message if any |
errors.locations.line | number | Error message if any |
errors.locations.column | number | Error message if any |
Output Example
{"status_code":200,"response_headers":{},"reason":"OK","json_body":{"data":{},"errors":[{}]}}
Response Headers
Header | Description | Example |
|---|---|---|
Content-Type | The media type of the resource | application/json |
Date | The date and time at which the message was originated | Thu, 01 Jan 2024 00:00:00 GMT |