pluginhttp

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2019 License: BSD-3-Clause Imports: 10 Imported by: 0

README

http Plugin

This plugin permorms an http request.

Configuration

An action of type http requires the following kind of configuration:

action:
  type: http
  configuration:
    # mandatory, string
    url: http://example.org/user
    # mandatory, string
    method: POST
    # optional, string as uint16
    timeout_seconds: "5"
    # optional, object of user and password fields
    basic_auth:
      user: {{.config.basicAuth.user}}
      password: {{.config.basicAuth.password}}
    # optional, string as boolean
    deny_redirects: "false"
    # optional, array of key and value fields
    parameters:
    - key: foo
      value: bar
    # optional, array of name and value fields
    headers:
    - name:  x-request-id
      value: xxx-yyy-zzz
    # optional, string
    body: |
      {
        "name": "pablo"
      }

Requirements

None by default. Sensitive data should be retrieved from configstore and accessed through {{.config.[itemKey]}} rather than hardcoded in your template.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Plugin = taskplugin.New("http", "0.6", exec,
		taskplugin.WithConfig(validConfig, HTTPConfig{}),
	)
)

the HTTP plugin performs an HTTP call

Functions

func ExecutorMetadata

func ExecutorMetadata() string

ExecutorMetadata generates json schema to validate the metadata returned by the http executor

Types

type BasicAuth added in v1.0.1

type BasicAuth struct {
	User     string `json:"user"`
	Password string `json:"password"`
}

BasicAuth represents a HTTP basic auth

type HTTPConfig

type HTTPConfig struct {
	URL            string      `json:"url"`
	Method         string      `json:"method"`
	Body           string      `json:"body,omitempty"`
	Headers        []Header    `json:"headers,omitempty"`
	TimeoutSeconds string      `json:"timeout_seconds,omitempty"`
	HTTPBasicAuth  BasicAuth   `json:"basic_auth,omitempty"`
	DenyRedirects  string      `json:"deny_redirects,omitempty"`
	Parameters     []Parameter `json:"parameters,omitempty"`
}

HTTPConfig is the configuration needed to perform an HTTP call

type Header struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Header represents an HTTP header

type Parameter added in v1.0.1

type Parameter struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Parameter represents HTTP parameters

Jump to

Keyboard shortcuts

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