GoLang Adapter Template

Overview

This template can be used to create a golang api based adapter. The template is written in Golang.

Template has two actions:

  • get_template

  • create_template.

There is also one action which is supposed to be by default in every adapter, verify_target. Usually verify_target action is used to verify connection and credentials to the target during its creation in UI.

The response of this API request will be the response of the action. Here, we have assumed that every action performs only one API call to the target.

Run adapter locally

Run worker/main.go.

worker/main.go is the main entry point to run the adapter.

Files

  1. Makefile - Used to compile the adapter

  2. Dockerfile - Used to create adapter docker container

  3. Jenkinsfile and Jenkinsfile-lambda - Used in jenkins jobs

  4. event-json - Contains sample api calls to run each action

Golang Packages

Actions folder contains three template actions and target and sample test files:

  1. common folder: It is a common adapter library.

  2. constants folder files: You can change the values of these constants to customize your adapter.

  3. events/events.go: Type resolver for incoming requests. We have 4 event types with corresponding actions.

  4. utils - Contains different models used in actions.

Other folders/files:

  • functions/lambda_function_name/main.go is used to run adapter as aws lambda function. The name lambda_function_name should be the same as name in adapter lambda schema.

  • scripts/run_test.sh - script is used in build to run tests.

  • worker/main.go is used to run adapter as microservice.

For more information on Golang adapter template, contact Action Orchestrator support team.

Related Topics

Back to: Create Custom Adapter in Golang

  • No labels
Terms & Conditions Privacy Statement Cookies Trademarks