api

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2019 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithInstanceConfig

func WithInstanceConfig(ctx context.Context, config *conf.Configuration, instanceID string) (context.Context, error)

Types

type API

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

API is the main REST API

func NewAPI

func NewAPI(globalConfig *conf.GlobalConfiguration, db storage.Connection) *API

NewAPI instantiates a new REST API

func NewAPIFromConfigFile

func NewAPIFromConfigFile(filename string, version string) (*API, error)

NewAPIFromConfigFile creates a new REST API using the provided configuration file.

func NewAPIWithVersion

func NewAPIWithVersion(ctx context.Context, globalConfig *conf.GlobalConfiguration, db storage.Connection, version string) *API

NewAPIWithVersion creates a new REST API using the specified version

func (*API) CreateInstance

func (a *API) CreateInstance(w http.ResponseWriter, r *http.Request) error

func (*API) DeleteInstance

func (a *API) DeleteInstance(w http.ResponseWriter, r *http.Request) error

func (*API) GetAppManifest

func (a *API) GetAppManifest(w http.ResponseWriter, r *http.Request) error

func (*API) GetInstance

func (a *API) GetInstance(w http.ResponseWriter, r *http.Request) error

func (*API) HealthCheck

func (a *API) HealthCheck(w http.ResponseWriter, r *http.Request) error

func (*API) ListenAndServe

func (a *API) ListenAndServe(hostAndPort string)

ListenAndServe starts the REST API

func (*API) Settings added in v0.4.0

func (a *API) Settings(w http.ResponseWriter, r *http.Request) error

func (*API) UpdateInstance

func (a *API) UpdateInstance(w http.ResponseWriter, r *http.Request) error

type BitBucketGateway added in v0.6.0

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

func NewBitBucketGateway added in v0.6.0

func NewBitBucketGateway() *BitBucketGateway

func (*BitBucketGateway) ServeHTTP added in v0.6.0

func (bb *BitBucketGateway) ServeHTTP(w http.ResponseWriter, r *http.Request)

type BitBucketTransport added in v0.6.0

type BitBucketTransport struct{}

func (*BitBucketTransport) RoundTrip added in v0.6.0

func (t *BitBucketTransport) RoundTrip(r *http.Request) (*http.Response, error)

type GatewayClaims

type GatewayClaims struct {
	jwt.StandardClaims
	Email        string                 `json:"email"`
	AppMetaData  map[string]interface{} `json:"app_metadata"`
	UserMetaData map[string]interface{} `json:"user_metadata"`
}

type GitHubGateway

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

GitHubGateway acts as a proxy to GitHub

func NewGitHubGateway

func NewGitHubGateway() *GitHubGateway

func (*GitHubGateway) ServeHTTP

func (gh *GitHubGateway) ServeHTTP(w http.ResponseWriter, r *http.Request)

type GitHubTransport added in v0.3.5

type GitHubTransport struct{}

func (*GitHubTransport) RoundTrip added in v0.3.5

func (t *GitHubTransport) RoundTrip(r *http.Request) (*http.Response, error)

type GitLabGateway added in v0.4.0

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

GitLabGateway acts as a proxy to Gitlab

func NewGitLabGateway added in v0.4.0

func NewGitLabGateway() *GitLabGateway

func (*GitLabGateway) ServeHTTP added in v0.4.0

func (gl *GitLabGateway) ServeHTTP(w http.ResponseWriter, r *http.Request)

type GitLabTransport added in v0.4.0

type GitLabTransport struct{}

func (*GitLabTransport) RoundTrip added in v0.4.0

func (t *GitLabTransport) RoundTrip(r *http.Request) (*http.Response, error)

type HTTPError

type HTTPError struct {
	Code            int    `json:"code"`
	Message         string `json:"msg"`
	InternalError   error  `json:"-"`
	InternalMessage string `json:"-"`
	ErrorID         string `json:"error_id,omitempty"`
}

HTTPError is an error with a message and an HTTP status code.

func (*HTTPError) Cause

func (e *HTTPError) Cause() error

Cause returns the root cause error

func (*HTTPError) Error

func (e *HTTPError) Error() string

func (*HTTPError) WithInternalError

func (e *HTTPError) WithInternalError(err error) *HTTPError

WithInternalError adds internal error information to the error

func (*HTTPError) WithInternalMessage

func (e *HTTPError) WithInternalMessage(fmtString string, args ...interface{}) *HTTPError

WithInternalMessage adds internal message information to the error

type InstanceRequestParams

type InstanceRequestParams struct {
	UUID       string              `json:"uuid"`
	BaseConfig *conf.Configuration `json:"config"`
}

type InstanceResponse

type InstanceResponse struct {
	models.Instance
	Endpoint string `json:"endpoint"`
	State    string `json:"state"`
}

type NetlifyMicroserviceClaims

type NetlifyMicroserviceClaims struct {
	SiteURL    string `json:"site_url"`
	InstanceID string `json:"id"`
	NetlifyID  string `json:"netlify_id"`
	jwt.StandardClaims
}

type OAuthError

type OAuthError struct {
	Err             string `json:"error"`
	Description     string `json:"description,omitempty"`
	InternalError   error  `json:"-"`
	InternalMessage string `json:"-"`
}

OAuthError is the JSON handler for OAuth2 error responses

func (*OAuthError) Cause

func (e *OAuthError) Cause() error

Cause returns the root cause error

func (*OAuthError) Error

func (e *OAuthError) Error() string

func (*OAuthError) WithInternalError

func (e *OAuthError) WithInternalError(err error) *OAuthError

WithInternalError adds internal error information to the error

func (*OAuthError) WithInternalMessage

func (e *OAuthError) WithInternalMessage(fmtString string, args ...interface{}) *OAuthError

WithInternalMessage adds internal message information to the error

type Role

type Role struct {
	Name string
}

type Settings added in v0.4.0

type Settings struct {
	GitHub    bool     `json:"github_enabled"`
	GitLab    bool     `json:"gitlab_enabled"`
	BitBucket bool     `json:"bitbucket_enabled"`
	Roles     []string `json:"roles"`
}

Jump to

Keyboard shortcuts

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