api

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: May 15, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package api provides functionality for making requests against the Vault API. This can be used by clients to perform actions manually that are not yet supported by vaultx.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	// Write sends data to the Vault API.
	Write(ctx context.Context, path string, vaultToken string, payload interface{}) (*Response, error)

	// Read retrieves data from the Vault API.
	Read(ctx context.Context, path string, vaultToken string) (*Response, error)
}

API makes requests against the Vault API.

type Client

type Client struct {
	HTTP *http.Client
	URL  string
}

Client executes actions against the Vault API manually.

This is primarily used by the various vaultx clients to communicate with Vault but can also be used by consumers for functionality not yet implemented by the package.

func (*Client) Read

func (c *Client) Read(ctx context.Context, path string, vaultToken string) (*Response, error)

func (*Client) Write

func (c *Client) Write(ctx context.Context, path string, vaultToken string, payload interface{}) (*Response, error)

type Response

type Response struct {
	StatusCode int
	RawBody    io.ReadCloser
}

func (*Response) JSON

func (r *Response) JSON(v interface{}) error

Jump to

Keyboard shortcuts

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