httpKey

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2017 License: BSD-3-Clause Imports: 6 Imported by: 1

Documentation

Overview

Package httpKey provides a HTTP client to an external key service that can respond to HTTP requests defined here.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyNotFound         = errorRegistry.MustAddMessageError(1000, "Key Not Found")
	ErrKeyRefAlreadyExists = errorRegistry.MustAddMessageError(1001, "Key Reference Already Exists")
	ErrKeyRefRequired      = errorRegistry.MustAddMessageError(1002, "Key Reference Required")
)

Errors that are returned from the HTTP server.

Functions

This section is empty.

Types

type Client added in v0.5.2

type Client struct {
	*apiClient.Client
}

Client implements gopherpit.com/gopherpit/services/key.Service interface.

func NewClient added in v0.5.2

func NewClient(c *apiClient.Client) *Client

NewClient creates a new Client.

func (Client) CreateKey added in v0.5.2

func (c Client) CreateKey(ref string, o *key.Options) (k *key.Key, err error)

CreateKey creates a new Key with Options by making a HTTP POST request to {Client.Endpoint}/keys/{ref}. Post body is a JSON-encoded key.Options instance.

func (Client) DeleteKey added in v0.5.2

func (c Client) DeleteKey(ref string) error

DeleteKey deletes an existing Key by making a HTTP DELETE request to {Client.Endpoint}/keys/{ref}.

func (Client) KeyByRef added in v0.5.2

func (c Client) KeyByRef(ref string) (k *key.Key, err error)

KeyByRef retrieves a Key instance by making a HTTP GET request to {Client.Endpoint}/keys/{ref}.

func (Client) KeyBySecret added in v0.5.2

func (c Client) KeyBySecret(secret string) (k *key.Key, err error)

KeyBySecret validates a password of an existing User by making a HTTP POST request to {Client.Endpoint}/authenticate. Request body is a JSON-encoded KeyBySecretRequest instance. Expected response body is a JSON-encoded instance of key.Key.

func (Client) Keys added in v0.5.2

func (c Client) Keys(startID string, limit int) (page key.KeysPage, err error)

Keys retrieves a paginated list of Key instances by making a HTTP GET request to {Client.Endpoint}/keys.

func (Client) RegenerateSecret added in v0.5.2

func (c Client) RegenerateSecret(ref string) (secret string, err error)

RegenerateSecret generates a new secret key by making a HTTP POST request to {Client.Endpoint}/keys/{ref}/secret.

func (Client) UpdateKey added in v0.5.2

func (c Client) UpdateKey(ref string, o *key.Options) (k *key.Key, err error)

UpdateKey changes the data of an existing Key by making a HTTP PUT request to {Client.Endpoint}/keys/{ref}. Post body is a JSON-encoded key.Options instance.

type KeyBySecretRequest

type KeyBySecretRequest struct {
	Secret string `json:"secret"`
}

KeyBySecretRequest is a structure that is passed as JSON-encoded body to KeyBySecret HTTP request.

type RegenerateSecretResponse

type RegenerateSecretResponse struct {
	Secret string `json:"secret"`
}

RegenerateSecretResponse is a structure that is returned as JSON-encoded body from RegenerateSecret HTTP request.

Jump to

Keyboard shortcuts

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