interfaces

package
v0.0.0-...-3eb98cc Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2017 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Adapt

func Adapt(h http.Handler, adapters ...Adapter) http.Handler

Adapt takes several Adapters and calls them in order

Types

type Adapter

type Adapter func(http.Handler) http.Handler

Adapter is the signature of an HTTPHandler for middlewares

func GetToken

func GetToken(apiURL string, salt string) Adapter

GetToken gets the token from the users microservice

type DOInteractor

type DOInteractor interface {
	GetOauthURL(id, redirectURI string, scope []string) string
	GetToken(code, id, secret, redirectURL string) (*domain.DOToken, error)
	ShowKeys(token string) ([]domain.Key, error)
	CreateKey(name, publicKey, token string) (*domain.Key, error)
	CreateDroplet(droplet domain.DropletRequest, token string) (*usecases.Instance, error)
	ListDroplets(token string) ([]domain.Droplet, error)
	GetDroplet(id int, token string) (*usecases.Instance, error)
	DestroyDroplet(id int, token string) error
}

DOInteractor defines the functions that the digital ocean interactor should perform

type WebServiceHandler

type WebServiceHandler struct {
	Interactor  DOInteractor
	ID          string
	Secret      string
	RedirectURI string
	Scopes      []string
	APIHost     string
}

WebServiceHandler has the necessary fields for a web interface to perform its operations

func (WebServiceHandler) CreateDroplet

func (handler WebServiceHandler) CreateDroplet(res http.ResponseWriter, req *http.Request)

CreateDroplet creates a droplet in Digital Ocean

func (WebServiceHandler) CreateKey

func (handler WebServiceHandler) CreateKey(res http.ResponseWriter, req *http.Request)

CreateKey saves a key in a provider

func (WebServiceHandler) DOCallback

func (handler WebServiceHandler) DOCallback(res http.ResponseWriter, req *http.Request)

DOCallback receives the OAUTH callback from Digital Ocean

func (WebServiceHandler) DestroyDroplet

func (handler WebServiceHandler) DestroyDroplet(res http.ResponseWriter, req *http.Request)

func (WebServiceHandler) GetInstance

func (handler WebServiceHandler) GetInstance(res http.ResponseWriter, req *http.Request)

GetInstance gets an instance from any provider

func (WebServiceHandler) ListDroplets

func (handler WebServiceHandler) ListDroplets(res http.ResponseWriter, req *http.Request)

ListDroplets lists all the droplets in Digital Ocean

func (WebServiceHandler) Login

func (handler WebServiceHandler) Login(res http.ResponseWriter, req *http.Request)

Login is a helper method to create an OAUTH token

func (WebServiceHandler) ShowKeys

func (handler WebServiceHandler) ShowKeys(res http.ResponseWriter, req *http.Request)

ShowKeys returns all the keys of an user in the different providers

Jump to

Keyboard shortcuts

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