gotruevault

package module
v0.0.0-...-7bde5dc Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

README

go-truevault

Golang wrapper for the TrueVault API

Documentation

Index

Constants

View Source
const (
	// And ...
	And FilterType = "and"
	// Or ...
	Or FilterType = "or"

	// Asc ...
	Asc SortOrder = "asc"
	// Desc ...
	Desc SortOrder = "desc"
)
View Source
const (
	//ContentTypeApplicationJSON application/json mime type
	ContentTypeApplicationJSON = "application/json"
)

Variables

View Source
var (
	// ErrUnauthorized ...
	ErrUnauthorized = errors.New("error: authorization failed")

	// ErrServerError ...
	ErrServerError = errors.New("error: server error")

	// ErrBadRequest ...
	ErrBadRequest = errors.New("error: bad request")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	URLBuilder URLBuilder
	// contains filtered or unexported fields
}

Client contains the base http requirements to make requests to TrueVault

func New

func New(h *http.Client, ub URLBuilder, accessTokenOrKey string) Client

New creates a new Client instance

func NewDefaultClient

func NewDefaultClient(h *http.Client, accessTokenOrKey string) Client

NewDefaultClient creates a Client with the default URLBuilder

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) error

Do sends an HTTP request and returns an HTTP response, following policy (e.g. redirects, cookies, auth) as configured on the client

func (*Client) NewRequest

func (c *Client) NewRequest(ctx context.Context, method, path, contentType string, body io.Reader) (*http.Request, error)

NewRequest builds an http.Request that contains the Authorization and Content-Type header

func (*Client) WithNewAccessTokenOrKey

func (c *Client) WithNewAccessTokenOrKey(accessTokenOrKey string) Client

WithNewAccessTokenOrKey creates a new Client instance with new Access Token or API key

type DefaultURLBuilder

type DefaultURLBuilder struct{}

DefaultURLBuilder implements URLBuilder interface

func (*DefaultURLBuilder) SearchDocumentURL

func (t *DefaultURLBuilder) SearchDocumentURL(vaultID string) string

SearchDocumentURL ...

type Eq

type Eq struct {
	Value         SearchValue
	CaseSensitive bool
}

Eq ...

func (Eq) MarshalJSON

func (i Eq) MarshalJSON() (data []byte, err error)

MarshalJSON returns JSON encoding of Eq

type FilterType

type FilterType string

FilterType ...

type Float64

type Float64 struct {
	Value float64
}

Float64 implements SearchValue that holds a float64 value

func (Float64) MarshalJSON

func (i Float64) MarshalJSON() (data []byte, err error)

MarshalJSON returns JSON encoding of Float64

type In

type In struct {
	Value         []SearchValue
	CaseSensitive bool
}

In ...

func (In) MarshalJSON

func (i In) MarshalJSON() (data []byte, err error)

MarshalJSON returns JSON encoding of In

type Int

type Int struct {
	Value int
}

Int implements SearchValue that holds an int value

func (Int) MarshalJSON

func (i Int) MarshalJSON() (data []byte, err error)

MarshalJSON returns JSON encoding of Int

type Not

type Not struct {
	Value         SearchValue
	CaseSensitive bool
}

Not ...

func (Not) MarshalJSON

func (i Not) MarshalJSON() (data []byte, err error)

MarshalJSON returns JSON encoding of Not

type NotIn

type NotIn struct {
	Value         []SearchValue
	CaseSensitive bool
}

NotIn ...

func (NotIn) MarshalJSON

func (i NotIn) MarshalJSON() (data []byte, err error)

MarshalJSON returns JSON encoding of NotIn

type Range

type Range struct {
	Value RangeValue
}

Range ...

func (Range) MarshalJSON

func (i Range) MarshalJSON() (data []byte, err error)

MarshalJSON returns JSON encoding of Range

type RangeValue

type RangeValue struct {
	Gt  float64 `json:"gt,omitempty"`
	Gte float64 `json:"gte,omitempty"`
	Lt  float64 `json:"lt,omitempty"`
	Lte float64 `json:"lte,omitempty"`
}

RangeValue implements SearchValue that holds range values

type SearchOption

type SearchOption struct {
	Filter     map[string]SearchType  `json:"filter,omitempty"`
	FilterType FilterType             `json:"filter_type,omitempty"`
	Page       int                    `json:"page,omitempty"`
	PerPage    int                    `json:"per_page,omitempty"`
	Sort       []map[string]SortOrder `json:"sort,omitempty"`
	SchemaID   uuid.UUID              `json:"schema_id,omitempty"`
}

SearchOption ...

type SearchType

type SearchType interface {
	// contains filtered or unexported methods
}

SearchType ...

type SearchTypes

type SearchTypes []SearchType

SearchTypes ...

type SearchValue

type SearchValue interface {
	// contains filtered or unexported methods
}

SearchValue an interface that represents an search value

type SearchValues

type SearchValues []SearchValue

SearchValues alias for a list of SearchValue

type SortOrder

type SortOrder string

SortOrder ...

type String

type String struct {
	Value string
}

String implements SearchValue that holds a string value

func (String) MarshalJSON

func (i String) MarshalJSON() (data []byte, err error)

MarshalJSON returns JSON encoding of String

type Time

type Time struct {
	Value time.Time
}

Time implements SearchValue that holds an time.Time value

func (Time) MarshalJSON

func (i Time) MarshalJSON() (data []byte, err error)

MarshalJSON returns JSON encoding of Time

type URLBuilder

type URLBuilder interface {
	SearchDocumentURL(vaultID string) string
}

URLBuilder is the interface for building URLs

type Wildcard

type Wildcard struct {
	Value         SearchValue
	CaseSensitive bool
}

Wildcard ...

func (Wildcard) MarshalJSON

func (i Wildcard) MarshalJSON() (data []byte, err error)

MarshalJSON returns JSON encoding of Wildcard

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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