Create Custom Adapter in Golang

This section provides information on creating a custom adapter in GoLang:

  1. Set up Git access to the Longhorn Bitbucket repositories, contact CloudCenter Suite Support team.

  2. Install Golang locally, see https://golang.org/doc/.

  3. Fetch source code of Golang template adapter by performing the following:

    1. git clone, see GoLang Adapter Template.

    2. Under the template folder, git checkout dev

  4. Make a clone of the adapter-template-go folder. Rename the folder to an appropriate custom adapter name.

  5. Open the custom adapter project in an IDE like Visual Studio Code and update the following files:

    1. Under actions folder, rename DemoAction.go to appropriate activity name, then update activity inputs and outputs using proper convention.

    2. Under actions folder, update verify_target.go for target and account key verification.

    3. Under events folder, update events.go to import proper classes. 

    4. Under yaml folder, replace all demo-adapter occurrences with the custom adapter name in demo-adapter.yaml.

  6. To create schema for adapters from UI, see Manage Schemas.

  7. On command line, go under the custom adapter folder and perform the following:

    1. Update Vendor folder to include any additional libraries:

      govendor init

      govendor fetch +e

    2. Run docker build command to build a docker image. Change demo-adapter-name in the command to proper adapter name defined in demo-adapter.yaml:

      docker build . -t demo-adapter-name -f Dockerfile

    3. Run the following kubectl command to deploy the custom adapter in Kubernetes cluster:

      kubectl create -f 
      yaml/demo-adapter.yaml -n orch-platform

  8. Open Action Orchestrator UI and create custom adapter target and account key.

  9. Create New Workflow. Make sure that the custom adapter activities show up in the Workflow Editor toolbox and validate those activities. 

Related Topic

  • No labels
© 2017-2019 Cisco Systems, Inc. All rights reserved