httpapi

package
v0.0.0-...-1eb86f4 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package httpapi provides a client and server for a remote http api.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Endpoint   string
	HTTPClient HTTPClient
}

A Client marshals requests to send over the wire to a remote http server.

func (*Client) Apply

func (c *Client) Apply(ctx context.Context, req *api.ApplyRequest) (*api.ApplyResponse, error)

Apply marshals an ApplyRequest and sends it over the wire.

The type of req.Config must be *hclpack.Body.

type Error

type Error struct {
	Msg string `json:"message"`
}

An Error is a json encoded error message from the api.

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is the client to use for communication.

type Server

type Server struct {
	API    api.API
	Logger *zap.Logger
	// contains filtered or unexported fields
}

Server is func http api server.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler.

Jump to

Keyboard shortcuts

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