pluginhttp

package
v1.0.1 Latest Latest
Warning

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

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

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
    url: http://example.org/user
    # mandatory
    method: POST
    # optional
    timeout_seconds: 5
    # optional
    basic_auth:
      user: {{.config.basicAuth.user}}
      password: {{.config.basicAuth.password}}
    # optional
    deny_redirects: false
    # optional
    parameters:
    - key: foo
      value: bar
    # optional
    headers:
    - name:  x-request-id
      value: xxx-yyy-zzz
    # optional
    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 int         `json:"timeout_seconds,omitempty"`
	HTTPBasicAuth  BasicAuth   `json:"basic_auth,omitempty"`
	DenyRedirects  bool        `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