heroku

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2015 License: BSD-2-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderTwoFactor       = "Heroku-Two-Factor-Code"
	HeaderGitHubTwoFactor = "X-GitHub-OTP"
)
View Source
const AcceptHeader = "application/vnd.heroku+json; version=3"

The Accept header that controls the api version. See https://devcenter.heroku.com/articles/platform-api-reference#clients

Variables

View Source
var (
	ErrBadRequest = &ErrorResource{
		Status:  http.StatusBadRequest,
		ID:      "bad_request",
		Message: "Request invalid, validate usage and try again",
	}
	ErrUnauthorized = &ErrorResource{
		Status:  http.StatusUnauthorized,
		ID:      "unauthorized",
		Message: "Request not authenticated, API token is missing, invalid or expired",
	}
	ErrForbidden = &ErrorResource{
		Status:  http.StatusForbidden,
		ID:      "forbidden",
		Message: "Request not authorized, provided credentials do not provide access to specified resource",
	}
	ErrNotFound = &ErrorResource{
		Status:  http.StatusNotFound,
		ID:      "not_found",
		Message: "Request failed, the specified resource does not exist",
	}
	ErrTwoFactor = &ErrorResource{
		Status:  http.StatusUnauthorized,
		ID:      "two_factor",
		Message: "Two factor code is required.",
	}
)

Named matching heroku's error codes. See https://devcenter.heroku.com/articles/platform-api-reference#error-responses

Functions

func Authenticate

func Authenticate(e *empire.Empire, h httpx.Handler) httpx.Handler

Authenticat wraps an httpx.Handler in the Authentication middleware to authenticate the request.

func Decode

func Decode(r *http.Request, v interface{}) error

Decode json decodes the request body into v.

func Encode

func Encode(w http.ResponseWriter, v interface{}) error

Encode json encodes v into w.

func Error

func Error(w http.ResponseWriter, err error, status int) error

Error is used to respond with errors in the heroku error format, which is specified at https://devcenter.heroku.com/articles/platform-api-reference#errors

If an ErrorResource is provided as the error, and it provides a non-zero status, that will be used as the response status code.

func New

New creates the API routes and returns a new http.Handler to serve them.

func NoContent

func NoContent(w http.ResponseWriter) error

NoContent responds with a 404 and an empty body.

func Stream

func Stream(w http.ResponseWriter, v interface{}) error

Stream encodes and flushes data to the client.

Types

type App

type App heroku.App

type Authentication

type Authentication struct {
	// contains filtered or unexported fields
}

Middleware for handling authentication.

func (*Authentication) ServeHTTPContext

func (h *Authentication) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, r *http.Request) error

ServeHTTPContext implements the httpx.Handler interface. It will ensure that there is a Bearer token present and that it is valid.

type Authorization

type Authorization heroku.OAuthAuthorization

type CertFinder

type CertFinder interface {
	CertificatesFirst(ctx context.Context, q empire.CertificatesQuery) (*empire.Certificate, error)
}

type DeleteApp

type DeleteApp struct {
	*empire.Empire
}

func (*DeleteApp) ServeHTTPContext

func (h *DeleteApp) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type DeleteDomain

type DeleteDomain struct {
	*empire.Empire
}

func (*DeleteDomain) ServeHTTPContext

func (h *DeleteDomain) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type DeleteProcesses

type DeleteProcesses struct {
	*empire.Empire
}

func (*DeleteProcesses) ServeHTTPContext

func (h *DeleteProcesses) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type DeleteSSLEndpoint

type DeleteSSLEndpoint struct {
	*empire.Empire
}

func (*DeleteSSLEndpoint) ServeHTTPContext

func (h *DeleteSSLEndpoint) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type Domain

type Domain heroku.Domain

type Dyno

type Dyno heroku.Dyno

type ErrorResource

type ErrorResource struct {
	Status  int    `json:"-"`
	ID      string `json:"id"`
	Message string `json:"message"`
	URL     string `json:"url"`
}

ErrorResource represents the error response format that we return.

func (*ErrorResource) Error

func (e *ErrorResource) Error() string

Error implements error interface.

type Formation

type Formation heroku.Formation

type GetApps

type GetApps struct {
	*empire.Empire
}

func (*GetApps) ServeHTTPContext

func (h *GetApps) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type GetConfigs

type GetConfigs struct {
	*empire.Empire
}

func (*GetConfigs) ServeHTTPContext

func (h *GetConfigs) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type GetDomains

type GetDomains struct {
	*empire.Empire
}

func (*GetDomains) ServeHTTPContext

func (h *GetDomains) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type GetProcesses

type GetProcesses struct {
	*empire.Empire
}

func (*GetProcesses) ServeHTTPContext

func (h *GetProcesses) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type GetRelease

type GetRelease struct {
	*empire.Empire
}

func (*GetRelease) ServeHTTPContext

func (h *GetRelease) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type GetReleases

type GetReleases struct {
	*empire.Empire
}

func (*GetReleases) ServeHTTPContext

func (h *GetReleases) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type GetSSLEndpoints

type GetSSLEndpoints struct {
	*empire.Empire
}

func (*GetSSLEndpoints) ServeHTTPContext

func (h *GetSSLEndpoints) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type PatchConfigs

type PatchConfigs struct {
	*empire.Empire
}

func (*PatchConfigs) ServeHTTPContext

func (h *PatchConfigs) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type PatchFormation

type PatchFormation struct {
	*empire.Empire
}

func (*PatchFormation) ServeHTTPContext

func (h *PatchFormation) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type PatchFormationForm

type PatchFormationForm struct {
	Updates []struct {
		Process  empire.ProcessType  `json:"process"` // Refers to process type
		Quantity int                 `json:"quantity"`
		Size     *empire.Constraints `json:"size"`
	} `json:"updates"`
}

type PatchSSLEndpoint

type PatchSSLEndpoint struct {
	*empire.Empire
}

func (*PatchSSLEndpoint) ServeHTTPContext

func (h *PatchSSLEndpoint) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type PostApps

type PostApps struct {
	*empire.Empire
}

func (*PostApps) ServeHTTPContext

func (h *PostApps) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type PostAppsForm

type PostAppsForm struct {
	Name string  `json:"name"`
	Repo *string `json:"repo"`
}

type PostAuthorizations

type PostAuthorizations struct {
	*empire.Empire
	authorization.Authorizer
}

func (*PostAuthorizations) ServeHTTPContext

func (h *PostAuthorizations) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type PostDeployForm

type PostDeployForm struct {
	Image empire.Image
}

PostDeployForm is the form object that represents the POST body.

type PostDeploys

type PostDeploys struct {
	*empire.Empire
}

PostDeploys is a Handler for the POST /v1/deploys endpoint.

func (*PostDeploys) ServeHTTPContext

func (h *PostDeploys) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, req *http.Request) error

Serve implements the Handler interface.

type PostDomains

type PostDomains struct {
	*empire.Empire
}

func (*PostDomains) ServeHTTPContext

func (h *PostDomains) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type PostDomainsForm

type PostDomainsForm struct {
	Hostname string `json:"hostname"`
}

type PostProcess

type PostProcess struct {
	*empire.Empire
}

func (*PostProcess) ServeHTTPContext

func (h *PostProcess) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type PostProcessForm

type PostProcessForm struct {
	Command string            `json:"command"`
	Attach  bool              `json:"attach"`
	Env     map[string]string `json:"env"`
	Size    string            `json:"size"`
}

type PostReleases

type PostReleases struct {
	*empire.Empire
}

func (*PostReleases) ServeHTTPContext

func (h *PostReleases) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type PostReleasesForm

type PostReleasesForm struct {
	Version string `json:"release"`
}

func (*PostReleasesForm) ReleaseVersion

func (p *PostReleasesForm) ReleaseVersion() (int, error)

type PostSSLEndpoints

type PostSSLEndpoints struct {
	*empire.Empire
}

func (*PostSSLEndpoints) ServeHTTPContext

func (h *PostSSLEndpoints) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type PostSSLEndpointsForm

type PostSSLEndpointsForm struct {
	CertificateChain string `json:"certificate_chain"`
	Preprocess       bool   `json:"preprocess"`
	PrivateKey       string `json:"private_key"`
}

type Release

type Release heroku.Release

type SSLEndpoint

type SSLEndpoint heroku.SSLEndpoint

Jump to

Keyboard shortcuts

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