Core API

This is the primary API to interact with MESG Core functionalities. It can be consumed by any applications or tools that you'd like to interact with MESG Core. It is actually used by the MESG CLI and MESG Application libraries.

This API is only accessible through gRPC.

Services must not use this API, but rather use the Service API.

The source file of this API is hosted on GitHub.

ListenEvent

Subscribe to a stream that listens for events from a service.

ListenEventRequest

The request's data for the ListenEvent stream's API.

Example

{
  "serviceID":   "__SERVICE_ID__",
  "eventFilter": "__EVENT_KEY_TO_MATCH__"
}
Field Type Description
serviceID string The Service ID. Generated when using the DeployService API.
eventFilter string Optional. Event's key to filter. The event must match this key. The default is * which matches any event.

EventData

The data received from the stream of the ListenEvent API. The data will be received over time as long as the stream is open.

Example

{
  "eventKey":  "__EVENT_KEY__",
  "eventData": "{\"foo\":\"bar\"}"
}
Field Type Description
eventKey string The event's key.
eventData string The event's data encoded in JSON.

ListenResult

Subscribe to a stream that listens for task's result from a service.

ListenResultRequest

The request's data for the ListenResult stream API.

Example

{
  "serviceID":     "__SERVICE_ID__",
  "taskFilter":    "__TASK_KEY_TO_MATCH__",
  "outputFilter":  "__OUTPUT_KEY_TO_MATCH__",
  "tagFilters":     ["tagX"]
}
Field Type Description
serviceID string The Service ID. Generated when using the DeployService API.
taskFilter string Optional. The task's key to filter. The task must match this key. The default is * which matches any task.
outputFilter string Optional. The output's key from the task to filter. The task must return this output's key. The default is * which matches any output.
tagFilters string[] Optional. The list of tags to filter. This is a "match all" list. All tags in parameters should be included in the execution to match.

ResultData

The data received from the stream of the ListenResult API. The data will be received over time as long as the stream is open.

Example

{
  "executionID":   "__EXECUTION_ID__",
  "taskKey":       "__TASK_KEY__",
  "outputKey":     "__OUTPUT_KEY__",
  "outputData":    "{\"foo\":\"bar\"}",
  "executionTags": ["executionX", "test"]
}
Field Type Description
executionID string The unique identifier of the execution.
taskKey string The key of the executed task.
outputKey string The output's key from the returned task.
outputData string The output's data from the returned task, encoded in JSON.
executionTags string[] The list of tags associated with the execution

ExecuteTask

Execute a service's task through Core.

ExecuteTaskRequest

The request's data for the ExecuteTask API.

Example

{
  "serviceID":     "__SERVICE_ID__",
  "taskKey":       "__TASK_KEY__",
  "inputData":     "{\"foo\":\"bar\"}",
  "executionTags": ["executionX", "test"]
}
Field Type Description
serviceID string The Service ID. Generated when using the DeployService API.
taskKey string The task's key to execute.
inputData string The inputs of the task to execute, encoded in JSON.
executionTags string[] Optional. The list of tags to associate with the execution

ExecuteTaskReply

The reply's data of the ExecuteTask API.

Example

{
  "executionID": "__EXECUTION_ID__"
}
Field Type Description
executionID string The unique identifier of the execution.

StartService

Start a service. The service must be already deployed to Core.

StartServiceRequest

The request's data for the StartService API.

Example

{
  "serviceID": "__SERVICE_ID__"
}
Field Type Description
serviceID string The Service ID. Generated when using the DeployService API.

StartServiceReply

Reply of StartService API doesn't contain any data.

StopService

Stop a service. The service must be already deployed to Core.

StopServiceRequest

The request's data for the StopService API.

Example

{
  "serviceID": "__SERVICE_ID__"
}
Field Type Description
serviceID string The Service ID. Generated when using the DeployService API.

StopServiceReply

Reply of StopService API doesn't contain any data.

DeployService

Deploy a service to Core. This will give you an unique identifier which is used to interact with the service.

DeployServiceRequest

The data sent to the request stream of the DeployService API. Stream should be closed after url or all chunks sent to server.

Example

{
  "url": "__SERVICE_GIT_URL__"
}

or

{
  "chunk": "__SERVICE_GZIPPED_TAR_FILE_CHUNK__"
}
Field Type Description
url string Git repo url of service. When url provided, stream will be closed after the first receive.
chunk bytes Chunks of gzipped tar archive of service. If chunk provided, stream should be closed by client after all chunks sent.

DeployServiceReply

The data received from the reply stream of the DeployService API. Stream will be closed by server after deployment is done.

Example

{
  "status": {
    "message": "__STATUS_MESSAGE__",
    "type": "__STATUS_TYPE__",
  }
}

or

{
  "serviceID": "__SERVICE_ID__"
}

or

{
  "validationError": "__SERVICE_VALIDATION_ERROR__"
}
Field Type Description
status DeployServiceReply.Status status will be sent after each status change.
serviceID string serviceID will be sent as the last message of stream when service deployed successfully.
validationError string validationError will be sent as the last message of stream when there is a validation error.

DeleteService

Delete a service from Core. This function only deletes a deployed service in Core. If the service's code is on your computer, the source code will not be deleted.

DeleteServiceRequest

Request's data of the DeleteService API.

Example

{
  "serviceID": "__SERVICE_ID__"
}
Field Type Description
serviceID string The Service ID. Generated when using the DeployService API.
deleteData bool When enabled, any persistent data (volumes) that belongs to service and its dependencies will be also deleted.

DeleteServiceReply

Reply of DeleteService API doesn't contain any data.

ListServices

List all services already deployed in Core.

ListServicesRequest

Reply of ListServices API doesn't contain any data.

ListServicesReply

The reply's data of the ListServices API.

Example

{
  "services": [{
    "id": "idX",
    "name": "serviceX",
    "description": "descriptionX",
    "status": "statusX",
    "events": [{
      "key": "eventX",
      "name": "nameX",
      "description": "descriptionX",
      "data": [{  
        "key": "dataX",
        "name": "nameX",
        "description": "descriptionX",
        "type": "String",
        "optional": true
      }]
    }],
    "tasks": [{
      "key": "taskX",
      "name": "nameX",
      "description": "descriptionX",
      "inputs": [{
        "key": "foo",
        "name": "nameX",
        "description": "descriptionX",
        "type": "String",
        "optional": true
      }],
      "outputs": [{
        "key": "outputX",
        "name": "nameX",
        "description": "descriptionX",
        "data": [{  
          "key": "resX",
          "name": "nameX",
          "description": "descriptionX",
          "type": "String",
          "optional": false
        }]
      }]
    }]
  }]
}
Field Type Description
services Service[] The list of previously-deployed services' definitions.

GetService

Get the definition of an already-deployed service from its ID.

GetServiceRequest

The request's data for the GetService API.

Example

{
  "serviceID": "__SERVICE_ID__"
}
Field Type Description
serviceID string The Service ID. Generated when using the DeployService API.

GetServiceReply

The reply's data of the GetService API.

Example

{
  "service": {
    "id": "idX",
    "name": "serviceX",
    "description": "descriptionX",
    "status": "statusX",
    "events": [{  
      "key": "eventX",
      "name": "nameX",
      "description": "descriptionX",
      "data": [{  
        "key": "dataX",
        "name": "nameX",
        "description": "descriptionX",
        "type": "String",
        "optional": true
      }]
    }],
    "tasks": [{
      "key": "taskX",
      "name": "nameX",
      "description": "descriptionX",
      "inputs": [{  
        "key": "foo",
        "name": "nameX",
        "description": "descriptionX",
        "type": "String",
        "optional": true
      }],
      "outputs": [{
        "key": "outputX",
        "name": "nameX",
        "description": "descriptionX",
        "data": [{  
          "key": "resX",
          "name": "nameX",
          "description": "descriptionX",
          "type": "String",
          "optional": false
        }]
      }]
    }]
  }
}
Field Type Description
service Service Service's definition.

ServiceLogs

ServiceLogs gives a stream for dependency logs of a service.

ServiceLogsRequest

The request's data for ServiceLogs API.

Example

{
  "serviceID": "__SERVICE_ID__",
  "dependencies": ["__SERVICE_DEPENDENCY__"]
}
Field Type Description
serviceID string The Service ID. Generated when using the DeployService API.
dependencies string[] Optional. List of dependencies to filter service logs. All by default.

LogData

The data received from the stream of the ServiceLogs API. The data will be received over time as long as the stream is open.

Example

{
  "dependency":  "__SERVICE_DEPENDENCY__",
  "type": "__LOG_TYPE__",
  "data":  "__LOG_CHUNK__",
}
Field Type Description
dependency string Service dependency that data belongs.
type LogData.Type The log type.
data bytes Log data chunk.

CreateWorkflow

CreateWorkflow creates and runs a new workflow.

CreateWorkflowRequest

The request's data for the CreateWorkflow API.

Example

{
  "file":   __FILE__,
  "name": "__UNIQUE_WORKFLOW_NAME__"
}
Field Type Description
definition CreateWorkflowRequest.WorkflowDefinition Workflow definition.
name string An optional unique name for workflow.

CreateWorkflowReply

The reply's data of the CreateWorkflow API.

Example

{
  "id": "__WORKFLOW_ID__"
}
Field Type Description
ID string Unique ID of workflow.

DeleteWorkflow

DeleteWorkflow stops and deletes a workflow.

DeleteWorkflowRequest

The request's data for the DeleteWorkflow API.

Example

{
  "id": "__WORKFLOW_ID__"
}
Field Type Description
ID string Unique name or ID of workflow.

DeleteWorkflowReply

Reply of DeleteWorkflow API doesn't contain any data.

Last Updated: 12/3/2018, 8:44:19 AM