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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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