curlbee

command module
v0.0.0-...-6276ac1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

README

curlbee

Calling APIs with a YAML instruction.

Bee Charts

The YAML files instruction for calling API and templating the result is called a bee chart.

Example
call:
  clusters: 
    method: "get"
    url: "10.30.35.23/clusters"
    query:
      page: 1
      limit: 3
    headers:
      - name: "X-Auth-Token"
        value: "{{env.OPEN_STACK_TOKEN}}"
response:
  - if:
      status: 200
      value:
        ok: true
        exists:
          - "$Res.clusters.list"
    return:
      ok: true
      list: "$Res.clusters.list"

The instruction above will call

GET 10.30.35.23/clusters?page=1&limit=3

with a header X-Auth-Token: {{env.OPEN_STACK_TOKEN}} where the value is from an environment variable OPEN_STACK_TOKEN.

Templating

call:
  clusters: 
    method: "post"
    url: "10.30.35.23/clusters"
    body:
      name: {{.Values.clusterName}}
      description: {{.Values.clusterDescription}}
      origin: {{env.SERVER_ORIGIN}}
    headers:
      - name: "X-Auth-Token"
        value: "{{env.OPEN_STACK_TOKEN}}"

In Command Line

$ curlbee cluster.yaml
Passing variables to template

Based on the template above you can pass both clusterName and clusterDescription by running

$ $ curlbee cluster.yaml -p clusterName="My Cluster" -p clusterDescription="hello"

As a Service

# running it on port 3001
$ curlbee start -p 3001

# pass yaml to the api
POST localhost:3000/call 

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL