api

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: MIT Imports: 57 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrorUpgradeWebsocket describes an error while upgrading http to a websocket endpoint.
	ErrorUpgradeWebsocket = HTTPError{
		Code: 500,
		Errors: []string{
			"could not upgrade to websocket",
		},
	}

	// ErrorDataWrite describes an error in writing to the database
	ErrorDataWrite = HTTPError{
		Code: 500,
		Errors: []string{
			"could not write to database",
		},
	}

	// ErrorWebsocketWrite describes an error in writing to websocket connection
	ErrorWebsocketWrite = HTTPError{
		Code: 500,
		Errors: []string{
			"could not write data via websocket",
		},
	}

	// ErrorDataRead describes an error when reading from the database
	ErrorDataRead = HTTPError{
		Code: 500,
		Errors: []string{
			"could not read from database",
		},
	}

	// ErrorInternal describes a generic internal server error
	ErrorInternal = HTTPError{
		Code: 500,
		Errors: []string{
			"internal server error",
		},
	}
)

Functions

This section is empty.

Types

type App

type App struct {
	// Server configuration
	ServerConf config.ServerConf

	// Logger for logging
	Logger *lr.Logger

	// Repo implements a query repository
	Repo *repository.Repository

	// session store for cookie-based sessions
	Store sessions.Store

	// agents exposed for testing
	TestAgents *TestAgents

	// An in-cluster agent if service is running in cluster
	InClusterAgent *kubernetes.Agent

	// redis client for redis connection
	RedisConf *config.RedisConf

	// config for db
	DBConf config.DBConf

	// config for capabilities
	Capabilities *AppCapabilities

	// oauth-specific clients
	GithubUserConf    *oauth2.Config
	GithubProjectConf *oauth2.Config
	DOConf            *oauth2.Config
	GoogleUserConf    *oauth2.Config
	// contains filtered or unexported fields
}

App represents an API instance with handler methods attached, a DB connection and a logger instance

func New

func New(conf *AppConfig) (*App, error)

New returns a new App instance

func (*App) FinalizEmailVerifyUser

func (app *App) FinalizEmailVerifyUser(w http.ResponseWriter, r *http.Request)

FinalizEmailVerifyUser completes the email verification flow for a user.

func (*App) FinalizPWResetUser

func (app *App) FinalizPWResetUser(w http.ResponseWriter, r *http.Request)

FinalizPWResetUser completes the password reset flow based on an email.

func (*App) HandleAcceptInvite

func (app *App) HandleAcceptInvite(w http.ResponseWriter, r *http.Request)

HandleAcceptInvite accepts an invite to a new project: if successful, a new role is created for that user in the project

func (*App) HandleAuthCheck

func (app *App) HandleAuthCheck(w http.ResponseWriter, r *http.Request)

HandleAuthCheck checks whether current session is authenticated and returns user ID if so.

func (*App) HandleCLILoginExchangeToken

func (app *App) HandleCLILoginExchangeToken(w http.ResponseWriter, r *http.Request)

HandleCLILoginExchangeToken exchanges an authorization code for a token

func (*App) HandleCLILoginUser

func (app *App) HandleCLILoginUser(w http.ResponseWriter, r *http.Request)

HandleCLILoginUser verifies that a user is logged in, and generates an access token for usage from the CLI

func (*App) HandleCreateAWSIntegration

func (app *App) HandleCreateAWSIntegration(w http.ResponseWriter, r *http.Request)

HandleCreateAWSIntegration creates a new AWS integration in the DB

func (*App) HandleCreateBasicAuthIntegration

func (app *App) HandleCreateBasicAuthIntegration(w http.ResponseWriter, r *http.Request)

HandleCreateBasicAuthIntegration creates a new basic auth integration in the DB

func (*App) HandleCreateConfigMap

func (app *App) HandleCreateConfigMap(w http.ResponseWriter, r *http.Request)

HandleCreateConfigMap deletes the pod given the name and namespace.

func (*App) HandleCreateDNSRecord

func (app *App) HandleCreateDNSRecord(w http.ResponseWriter, r *http.Request)

HandleCreateProjectCluster creates a new cluster

func (*App) HandleCreateGCPIntegration

func (app *App) HandleCreateGCPIntegration(w http.ResponseWriter, r *http.Request)

HandleCreateGCPIntegration creates a new GCP integration in the DB

func (*App) HandleCreateGitAction

func (app *App) HandleCreateGitAction(w http.ResponseWriter, r *http.Request)

HandleCreateGitAction creates a new Github action in a repository for a given release

func (*App) HandleCreateHelmRepo

func (app *App) HandleCreateHelmRepo(w http.ResponseWriter, r *http.Request)

HandleCreateHelmRepo creates a new helm repo for a project

func (*App) HandleCreateInvite

func (app *App) HandleCreateInvite(w http.ResponseWriter, r *http.Request)

HandleCreateInvite creates a new invite for a project

func (*App) HandleCreateNamespace added in v0.3.2

func (app *App) HandleCreateNamespace(w http.ResponseWriter, r *http.Request)

HandleCreateNamespace creates a new namespace given the name.

func (*App) HandleCreateProject

func (app *App) HandleCreateProject(w http.ResponseWriter, r *http.Request)

HandleCreateProject validates a project form entry, converts the project to a gorm model, and saves the user to the database

func (*App) HandleCreateProjectCluster

func (app *App) HandleCreateProjectCluster(w http.ResponseWriter, r *http.Request)

HandleCreateProjectCluster creates a new cluster

func (*App) HandleCreateProjectClusterCandidates

func (app *App) HandleCreateProjectClusterCandidates(w http.ResponseWriter, r *http.Request)

HandleCreateProjectClusterCandidates handles the creation of ClusterCandidates using a kubeconfig and a project id

func (*App) HandleCreateRegistry

func (app *App) HandleCreateRegistry(w http.ResponseWriter, r *http.Request)

HandleCreateRegistry creates a new registry

func (*App) HandleCreateRepository added in v0.4.0

func (app *App) HandleCreateRepository(w http.ResponseWriter, r *http.Request)

HandleCreateRepository creates a new image repository in a registry, if the registry does not allow for create-on-push behavior

func (*App) HandleCreateUser

func (app *App) HandleCreateUser(w http.ResponseWriter, r *http.Request)

HandleCreateUser validates a user form entry, converts the user to a gorm model, and saves the user to the database

func (*App) HandleDOOAuthCallback

func (app *App) HandleDOOAuthCallback(w http.ResponseWriter, r *http.Request)

HandleDOOAuthCallback verifies the callback request by checking that the state parameter has not been modified, and validates the token.

func (*App) HandleDOOAuthStartProject

func (app *App) HandleDOOAuthStartProject(w http.ResponseWriter, r *http.Request)

HandleDOOAuthStartProject starts the oauth2 flow for a project digitalocean request. In this handler, the project id gets written to the session (along with the oauth state param), so that the correct project id can be identified in the callback.

func (*App) HandleDeleteConfigMap

func (app *App) HandleDeleteConfigMap(w http.ResponseWriter, r *http.Request)

HandleDeleteConfigMap deletes the pod given the name and namespace.

func (*App) HandleDeleteJob added in v0.3.4

func (app *App) HandleDeleteJob(w http.ResponseWriter, r *http.Request)

HandleDeleteConfigMap deletes the pod given the name and namespace.

func (*App) HandleDeleteNamespace added in v0.3.2

func (app *App) HandleDeleteNamespace(w http.ResponseWriter, r *http.Request)

HandleDeleteNamespace deletes a namespace given the name.

func (*App) HandleDeletePod

func (app *App) HandleDeletePod(w http.ResponseWriter, r *http.Request)

HandleDeletePod deletes the pod given the name and namespace.

func (*App) HandleDeleteProject

func (app *App) HandleDeleteProject(w http.ResponseWriter, r *http.Request)

HandleDeleteProject deletes a project from the db, reading from the project_id in the URL param

func (*App) HandleDeleteProjectCluster

func (app *App) HandleDeleteProjectCluster(w http.ResponseWriter, r *http.Request)

HandleDeleteProjectCluster handles the deletion of a Cluster via the cluster ID

func (*App) HandleDeleteProjectGitRepo

func (app *App) HandleDeleteProjectGitRepo(w http.ResponseWriter, r *http.Request)

HandleDeleteProjectGitRepo handles the deletion of a Github Repo via the git repo ID

func (*App) HandleDeleteProjectInvite

func (app *App) HandleDeleteProjectInvite(w http.ResponseWriter, r *http.Request)

HandleDeleteProjectInvite handles the deletion of an Invite via the invite ID

func (*App) HandleDeleteProjectRegistry

func (app *App) HandleDeleteProjectRegistry(w http.ResponseWriter, r *http.Request)

HandleDeleteProjectRegistry handles the deletion of a Registry via the registry ID

func (*App) HandleDeleteUser

func (app *App) HandleDeleteUser(w http.ResponseWriter, r *http.Request)

HandleDeleteUser removes a user after checking that the sent password is correct

func (*App) HandleDeployAddon added in v0.4.2

func (app *App) HandleDeployAddon(w http.ResponseWriter, r *http.Request)

HandleDeployAddon triggers a addon deployment from a template

func (*App) HandleDeployTemplate

func (app *App) HandleDeployTemplate(w http.ResponseWriter, r *http.Request)

HandleDeployTemplate triggers a chart deployment from a template

func (*App) HandleDestroyAWSECRInfra

func (app *App) HandleDestroyAWSECRInfra(w http.ResponseWriter, r *http.Request)

HandleDestroyAWSECRInfra destroys ecr infra

func (*App) HandleDestroyAWSEKSInfra

func (app *App) HandleDestroyAWSEKSInfra(w http.ResponseWriter, r *http.Request)

HandleDestroyAWSEKSInfra destroys eks infra

func (*App) HandleDestroyDODOCRInfra

func (app *App) HandleDestroyDODOCRInfra(w http.ResponseWriter, r *http.Request)

HandleDestroyAWSDOCRInfra destroys docr infra

func (*App) HandleDestroyDODOKSInfra

func (app *App) HandleDestroyDODOKSInfra(w http.ResponseWriter, r *http.Request)

HandleDestroyDODOKSInfra destroys DOKS infra

func (*App) HandleDestroyGCPGKEInfra

func (app *App) HandleDestroyGCPGKEInfra(w http.ResponseWriter, r *http.Request)

HandleDestroyGCPGKEInfra destroys gke infra

func (*App) HandleDestroyTestInfra

func (app *App) HandleDestroyTestInfra(w http.ResponseWriter, r *http.Request)

HandleDestroyTestInfra destroys test infra

func (*App) HandleDetectBuildpack added in v0.4.2

func (app *App) HandleDetectBuildpack(w http.ResponseWriter, r *http.Request)

HandleDetectBuildpack attempts to figure which buildpack will be auto used based on directory contents

func (*App) HandleDetectPrometheusInstalled

func (app *App) HandleDetectPrometheusInstalled(w http.ResponseWriter, r *http.Request)

HandleDetectPrometheusInstalled detects a prometheus installation in the target cluster

func (*App) HandleGetBranchContents

func (app *App) HandleGetBranchContents(w http.ResponseWriter, r *http.Request)

HandleGetBranchContents retrieves the contents of a specific branch and subdirectory

func (*App) HandleGetBranches

func (app *App) HandleGetBranches(w http.ResponseWriter, r *http.Request)

HandleGetBranches retrieves a list of branch names for a specified repo

func (*App) HandleGetCapabilities

func (app *App) HandleGetCapabilities(w http.ResponseWriter, r *http.Request)

HandleGetCapabilities gets the capabilities of the server

func (*App) HandleGetConfigMap

func (app *App) HandleGetConfigMap(w http.ResponseWriter, r *http.Request)

HandleGetConfigMap retreives the configmap given the name and namespace.

func (*App) HandleGetIngress

func (app *App) HandleGetIngress(w http.ResponseWriter, r *http.Request)

HandleGetIngress returns the ingress object given the name and namespace.

func (*App) HandleGetJobStatus added in v0.4.4

func (app *App) HandleGetJobStatus(w http.ResponseWriter, r *http.Request)

HandleGetJobStatus gets the status for a specific job

func (*App) HandleGetNode added in v0.4.4

func (app *App) HandleGetNode(w http.ResponseWriter, r *http.Request)

func (*App) HandleGetPodLogs

func (app *App) HandleGetPodLogs(w http.ResponseWriter, r *http.Request)

HandleGetPodLogs returns real-time logs of the pod via websockets TODO: Refactor repeated calls.

func (*App) HandleGetPodMetrics

func (app *App) HandleGetPodMetrics(w http.ResponseWriter, r *http.Request)

func (*App) HandleGetProcfileContents

func (app *App) HandleGetProcfileContents(w http.ResponseWriter, r *http.Request)

HandleGetProcfileContents retrieves the contents of a procfile in a github repo

func (*App) HandleGetProjectRegistryDOCRToken

func (app *App) HandleGetProjectRegistryDOCRToken(w http.ResponseWriter, r *http.Request)

HandleGetProjectRegistryDOCRToken gets a DOCR token for a registry

func (*App) HandleGetProjectRegistryDockerhubToken

func (app *App) HandleGetProjectRegistryDockerhubToken(w http.ResponseWriter, r *http.Request)

HandleGetProjectRegistryDockerhubToken gets a Dockerhub token for a registry

func (*App) HandleGetProjectRegistryECRToken

func (app *App) HandleGetProjectRegistryECRToken(w http.ResponseWriter, r *http.Request)

HandleGetProjectRegistryECRToken gets an ECR token for a registry

func (*App) HandleGetProjectRegistryGCRToken

func (app *App) HandleGetProjectRegistryGCRToken(w http.ResponseWriter, r *http.Request)

HandleGetProjectRegistryGCRToken gets a GCR token for a registry

func (*App) HandleGetProvisioningLogs

func (app *App) HandleGetProvisioningLogs(w http.ResponseWriter, r *http.Request)

HandleGetProvisioningLogs returns real-time logs of the provisioning process via websockets

func (*App) HandleGetRelease

func (app *App) HandleGetRelease(w http.ResponseWriter, r *http.Request)

HandleGetRelease retrieves a single release based on a name and revision

func (*App) HandleGetReleaseAllPods

func (app *App) HandleGetReleaseAllPods(w http.ResponseWriter, r *http.Request)

HandleGetReleaseAllPods retrieves all pods that are associated with a given release.

func (*App) HandleGetReleaseComponents

func (app *App) HandleGetReleaseComponents(w http.ResponseWriter, r *http.Request)

HandleGetReleaseComponents retrieves kubernetes objects listed in a release identified by name and revision

func (*App) HandleGetReleaseControllers

func (app *App) HandleGetReleaseControllers(w http.ResponseWriter, r *http.Request)

HandleGetReleaseControllers retrieves controllers that belong to a release. Used to display status of charts.

func (*App) HandleGetReleaseToken

func (app *App) HandleGetReleaseToken(w http.ResponseWriter, r *http.Request)

HandleGetReleaseToken retrieves the webhook token of a specific release.

func (*App) HandleGetRepoZIPDownloadURL added in v0.4.0

func (app *App) HandleGetRepoZIPDownloadURL(w http.ResponseWriter, r *http.Request)

HandleGetRepoZIPDownloadURL gets the URL for downloading a zip file from a Github repository

func (*App) HandleGetTemporaryKubeconfig

func (app *App) HandleGetTemporaryKubeconfig(w http.ResponseWriter, r *http.Request)

func (*App) HandleGithubOAuthCallback

func (app *App) HandleGithubOAuthCallback(w http.ResponseWriter, r *http.Request)

HandleGithubOAuthCallback verifies the callback request by checking that the state parameter has not been modified, and validates the token. There is a difference between the oauth flow when logging a user in, and when linking a repository.

When logging a user in, the access token gets stored in the session, and no refresh token is requested. We store the access token in the session because a user can be logged in multiple times with a single access token.

NOTE: this user flow will likely be augmented with Dex, or entirely replaced with Dex.

However, when linking a repository, the access token and refresh token are requested when the flow has started. A project also gets linked to the session. After callback, a new github config gets stored for the project, and the user will then get redirected to a URL that allows them to select their repositories they'd like to link. We require a refresh token because we need permanent access to the linked repository.

func (*App) HandleGithubOAuthStartProject

func (app *App) HandleGithubOAuthStartProject(w http.ResponseWriter, r *http.Request)

HandleGithubOAuthStartProject starts the oauth2 flow for a project repo request. In this handler, the project id gets written to the session (along with the oauth state param), so that the correct project id can be identified in the callback.

func (*App) HandleGithubOAuthStartUser

func (app *App) HandleGithubOAuthStartUser(w http.ResponseWriter, r *http.Request)

HandleGithubOAuthStartUser starts the oauth2 flow for a user login request.

func (*App) HandleGoogleOAuthCallback added in v0.3.1

func (app *App) HandleGoogleOAuthCallback(w http.ResponseWriter, r *http.Request)

HandleGithubOAuthCallback verifies the callback request by checking that the state parameter has not been modified, and validates the token.

When logging a user in, the access token gets stored in the session, and no refresh token is requested. We store the access token in the session because a user can be logged in multiple times with a single access token.

func (*App) HandleGoogleStartUser added in v0.3.1

func (app *App) HandleGoogleStartUser(w http.ResponseWriter, r *http.Request)

HandleGoogleStartUser starts the oauth2 flow for a user login request.

func (*App) HandleListClusterIntegrations

func (app *App) HandleListClusterIntegrations(w http.ResponseWriter, r *http.Request)

HandleListClusterIntegrations lists the cluster integrations available to the instance

func (*App) HandleListConfigMaps

func (app *App) HandleListConfigMaps(w http.ResponseWriter, r *http.Request)

HandleListConfigMaps lists all configmaps in a namespace.

func (*App) HandleListHelmRepoCharts

func (app *App) HandleListHelmRepoCharts(w http.ResponseWriter, r *http.Request)

HandleListHelmRepoCharts lists the charts for a given linked helm repo

func (*App) HandleListHelmRepoIntegrations

func (app *App) HandleListHelmRepoIntegrations(w http.ResponseWriter, r *http.Request)

HandleListHelmRepoIntegrations lists the Helm repo integrations available to the instance

func (*App) HandleListImages

func (app *App) HandleListImages(w http.ResponseWriter, r *http.Request)

HandleListImages retrieves a list of repo names

func (*App) HandleListJobPods

func (app *App) HandleListJobPods(w http.ResponseWriter, r *http.Request)

HandleListJobPods lists all pods belonging to a specific job

func (*App) HandleListJobsByChart

func (app *App) HandleListJobsByChart(w http.ResponseWriter, r *http.Request)

HandleListJobsByChart lists all jobs belonging to a specific Helm chart

func (*App) HandleListNGINXIngresses

func (app *App) HandleListNGINXIngresses(w http.ResponseWriter, r *http.Request)

HandleListNGINXIngresses lists all NGINX ingresses in a target cluster

func (*App) HandleListNamespaces

func (app *App) HandleListNamespaces(w http.ResponseWriter, r *http.Request)

HandleListNamespaces retrieves a list of namespaces

func (*App) HandleListNodes added in v0.3.4

func (app *App) HandleListNodes(w http.ResponseWriter, r *http.Request)

func (*App) HandleListPodEvents added in v0.3.0

func (app *App) HandleListPodEvents(w http.ResponseWriter, r *http.Request)

HandleListPodEvents retrieves all events tied to a pod.

func (*App) HandleListPods

func (app *App) HandleListPods(w http.ResponseWriter, r *http.Request)

HandleListPods returns all pods that match the given selectors TODO: Refactor repeated calls.

func (*App) HandleListProjectClusterCandidates

func (app *App) HandleListProjectClusterCandidates(w http.ResponseWriter, r *http.Request)

HandleListProjectClusterCandidates returns a list of externalized ClusterCandidates ([]models.ClusterCandidateExternal) based on a project ID

func (*App) HandleListProjectClusters

func (app *App) HandleListProjectClusters(w http.ResponseWriter, r *http.Request)

HandleListProjectClusters returns a list of clusters that have linked Integrations.

func (*App) HandleListProjectGitRepos

func (app *App) HandleListProjectGitRepos(w http.ResponseWriter, r *http.Request)

HandleListProjectGitRepos returns a list of git repos for a project

func (*App) HandleListProjectHelmRepos

func (app *App) HandleListProjectHelmRepos(w http.ResponseWriter, r *http.Request)

HandleListProjectHelmRepos returns a list of helm repos for a project

func (*App) HandleListProjectInfra

func (app *App) HandleListProjectInfra(w http.ResponseWriter, r *http.Request)

HandleListProjectInfra returns a list of infrasa for a project

func (*App) HandleListProjectInvites

func (app *App) HandleListProjectInvites(w http.ResponseWriter, r *http.Request)

HandleListProjectInvites returns a list of invites for a project

func (*App) HandleListProjectOAuthIntegrations

func (app *App) HandleListProjectOAuthIntegrations(w http.ResponseWriter, r *http.Request)

HandleListProjectOAuthIntegrations lists the oauth integrations for the project

func (*App) HandleListProjectRegistries

func (app *App) HandleListProjectRegistries(w http.ResponseWriter, r *http.Request)

HandleListProjectRegistries returns a list of registries for a project

func (*App) HandleListRegistryIntegrations

func (app *App) HandleListRegistryIntegrations(w http.ResponseWriter, r *http.Request)

HandleListRegistryIntegrations lists the image registry integrations available to the instance

func (*App) HandleListReleaseHistory

func (app *App) HandleListReleaseHistory(w http.ResponseWriter, r *http.Request)

HandleListReleaseHistory retrieves a history of releases based on a release name

func (*App) HandleListReleases

func (app *App) HandleListReleases(w http.ResponseWriter, r *http.Request)

HandleListReleases retrieves a list of releases for a cluster with various filter options

func (*App) HandleListRepoIntegrations

func (app *App) HandleListRepoIntegrations(w http.ResponseWriter, r *http.Request)

HandleListRepoIntegrations lists the repo integrations available to the instance

func (*App) HandleListRepos

func (app *App) HandleListRepos(w http.ResponseWriter, r *http.Request)

HandleListRepos retrieves a list of repo names

func (*App) HandleListRepositories

func (app *App) HandleListRepositories(w http.ResponseWriter, r *http.Request)

HandleListRepositories returns a list of repositories for a given registry

func (*App) HandleListTemplates

func (app *App) HandleListTemplates(w http.ResponseWriter, r *http.Request)

HandleListTemplates retrieves a list of Porter templates TODO: test and reduce fragility (handle untar/parse error for individual charts) TODO: separate markdown retrieval into its own query if necessary

func (*App) HandleListUserProjects

func (app *App) HandleListUserProjects(w http.ResponseWriter, r *http.Request)

HandleListUserProjects lists all projects belonging to a given user

func (*App) HandleLive

func (app *App) HandleLive(w http.ResponseWriter, r *http.Request)

HandleLive responds immediately with an HTTP 200 status.

func (*App) HandleLoginUser

func (app *App) HandleLoginUser(w http.ResponseWriter, r *http.Request)

HandleLoginUser checks the request header for cookie and validates the user.

func (*App) HandleLogoutUser

func (app *App) HandleLogoutUser(w http.ResponseWriter, r *http.Request)

HandleLogoutUser detaches the user from the session

func (*App) HandleOverwriteAWSIntegration added in v0.4.0

func (app *App) HandleOverwriteAWSIntegration(w http.ResponseWriter, r *http.Request)

HandleOverwriteAWSIntegration overwrites the ID of an AWS integration in the DB

func (*App) HandleProvisionAWSECRInfra

func (app *App) HandleProvisionAWSECRInfra(w http.ResponseWriter, r *http.Request)

HandleProvisionAWSECRInfra provisions a new aws ECR instance for a project

func (*App) HandleProvisionAWSEKSInfra

func (app *App) HandleProvisionAWSEKSInfra(w http.ResponseWriter, r *http.Request)

HandleProvisionAWSEKSInfra provisions a new aws EKS instance for a project

func (*App) HandleProvisionDODOCRInfra

func (app *App) HandleProvisionDODOCRInfra(w http.ResponseWriter, r *http.Request)

HandleProvisionDODOCRInfra provisions a new digitalocean DOCR instance for a project

func (*App) HandleProvisionDODOKSInfra

func (app *App) HandleProvisionDODOKSInfra(w http.ResponseWriter, r *http.Request)

HandleProvisionDODOKSInfra provisions a new DO DOKS instance for a project

func (*App) HandleProvisionGCPGCRInfra

func (app *App) HandleProvisionGCPGCRInfra(w http.ResponseWriter, r *http.Request)

HandleProvisionGCPGCRInfra enables GCR for a project

func (*App) HandleProvisionGCPGKEInfra

func (app *App) HandleProvisionGCPGKEInfra(w http.ResponseWriter, r *http.Request)

HandleProvisionGCPGKEInfra provisions a new GKE instance for a project

func (*App) HandleProvisionTestInfra

func (app *App) HandleProvisionTestInfra(w http.ResponseWriter, r *http.Request)

HandleProvisionTestInfra will create a test resource by deploying a provisioner container pod

func (*App) HandleReadProject

func (app *App) HandleReadProject(w http.ResponseWriter, r *http.Request)

HandleReadProject returns an externalized Project (models.ProjectExternal) based on an ID

func (*App) HandleReadProjectCluster

func (app *App) HandleReadProjectCluster(w http.ResponseWriter, r *http.Request)

HandleReadProjectCluster reads a cluster by id

func (*App) HandleReadTemplate

func (app *App) HandleReadTemplate(w http.ResponseWriter, r *http.Request)

HandleReadTemplate reads a given template with name and version field

func (*App) HandleReadUser

func (app *App) HandleReadUser(w http.ResponseWriter, r *http.Request)

HandleReadUser returns an externalized User (models.UserExternal) based on an ID

func (*App) HandleReady

func (app *App) HandleReady(w http.ResponseWriter, r *http.Request)

HandleReady responds with HTTP 200 if healthy, 500 otherwise

func (*App) HandleReleaseDeployWebhook

func (app *App) HandleReleaseDeployWebhook(w http.ResponseWriter, r *http.Request)

HandleReleaseDeployWebhook upgrades a release when a chart specific webhook is called.

func (*App) HandleReleaseUpdateJobImages added in v0.4.0

func (app *App) HandleReleaseUpdateJobImages(w http.ResponseWriter, r *http.Request)

HandleReleaseJobUpdateImage

func (*App) HandleResolveClusterCandidate

func (app *App) HandleResolveClusterCandidate(w http.ResponseWriter, r *http.Request)

HandleResolveClusterCandidate accepts a list of resolving objects (ClusterResolver) for a given ClusterCandidate, which "resolves" that ClusterCandidate and creates a Cluster for a specific project

func (*App) HandleRollbackRelease

func (app *App) HandleRollbackRelease(w http.ResponseWriter, r *http.Request)

HandleRollbackRelease rolls a release back to a specified revision

func (*App) HandleStopJob added in v0.3.0

func (app *App) HandleStopJob(w http.ResponseWriter, r *http.Request)

HandleStopJob stops a running job

func (*App) HandleStreamControllerStatus

func (app *App) HandleStreamControllerStatus(w http.ResponseWriter, r *http.Request)

HandleStreamControllerStatus test calls TODO: Refactor repeated calls.

func (*App) HandleStreamHelmReleases added in v0.4.4

func (app *App) HandleStreamHelmReleases(w http.ResponseWriter, r *http.Request)

func (*App) HandleUninstallTemplate

func (app *App) HandleUninstallTemplate(w http.ResponseWriter, r *http.Request)

HandleUninstallTemplate triggers a chart deployment from a template

func (*App) HandleUpdateConfigMap

func (app *App) HandleUpdateConfigMap(w http.ResponseWriter, r *http.Request)

HandleUpdateConfigMap deletes the pod given the name and namespace.

func (*App) HandleUpdateProjectCluster

func (app *App) HandleUpdateProjectCluster(w http.ResponseWriter, r *http.Request)

HandleUpdateProjectCluster updates a project's cluster

func (*App) HandleUpdateProjectRegistry

func (app *App) HandleUpdateProjectRegistry(w http.ResponseWriter, r *http.Request)

HandleUpdateProjectRegistry updates a registry

func (*App) HandleUpgradeRelease

func (app *App) HandleUpgradeRelease(w http.ResponseWriter, r *http.Request)

HandleUpgradeRelease upgrades a release with new values.yaml

func (*App) InitiateEmailVerifyUser

func (app *App) InitiateEmailVerifyUser(w http.ResponseWriter, r *http.Request)

InitiateEmailVerifyUser initiates the email verification flow for a logged-in user

func (*App) InitiatePWResetUser

func (app *App) InitiatePWResetUser(w http.ResponseWriter, r *http.Request)

InitiatePWResetUser initiates the password reset flow based on an email. The endpoint checks if the email exists, but returns a 200 status code regardless, since we don't want to leak in-use emails

func (*App) VerifyPWResetUser

func (app *App) VerifyPWResetUser(w http.ResponseWriter, r *http.Request)

VerifyPWResetUser makes sure that the token is correct and still valid

type AppCapabilities added in v0.3.1

type AppCapabilities struct {
	Provisioning bool `json:"provisioner"`
	Github       bool `json:"github"`
	BasicLogin   bool `json:"basic_login"`
	GithubLogin  bool `json:"github_login"`
	GoogleLogin  bool `json:"google_login"`
	Email        bool `json:"email"`
	Analytics    bool `json:"analytics"`
}

type AppConfig

type AppConfig struct {
	DB         *gorm.DB
	Logger     *lr.Logger
	Repository *repository.Repository
	ServerConf config.ServerConf
	RedisConf  *config.RedisConf
	DBConf     config.DBConf
	CapConf    config.CapConf

	// TestAgents if API is in testing mode
	TestAgents *TestAgents
}

AppConfig is the configuration required for creating a new App

type AutoBuildpack added in v0.4.2

type AutoBuildpack struct {
	Valid bool   `json:"valid"`
	Name  string `json:"name"`
}

AutoBuildpack represents an automatically detected buildpack

type ContainerEnvConfig

type ContainerEnvConfig struct {
	Container struct {
		Env struct {
			Normal map[string]string `yaml:"normal"`
		} `yaml:"env"`
	} `yaml:"container"`
}

type DirectoryItem

type DirectoryItem struct {
	Path string
	Type string
}

DirectoryItem represents a file or subfolder in a repository

type ErrorCode

type ErrorCode int64

ErrorCode is a custom Porter error code, useful for frontend messages

const (
	ErrK8sDecode ErrorCode = iota + 600
	ErrK8sValidate
	ErrEnvDecode
)

Enumeration of k8s API error codes, represented as int64

const (
	ErrProjectDecode ErrorCode = iota + 600
	ErrProjectValidateFields
	ErrProjectDataRead
)

Enumeration of user API error codes, represented as int64

const (
	ErrReleaseDecode ErrorCode = iota + 600
	ErrReleaseValidateFields
	ErrReleaseReadData
	ErrReleaseDeploy
)

Enumeration of release API error codes, represented as int64

const (
	ErrUserDecode ErrorCode = iota + 600
	ErrUserValidateFields
	ErrUserDataRead
)

Enumeration of user API error codes, represented as int64

type ExchangeRequest

type ExchangeRequest struct {
	AuthorizationCode string `json:"authorization_code"`
}

type ExchangeResponse

type ExchangeResponse struct {
	Token string `json:"token"`
}

type GCRTokenRequestBody

type GCRTokenRequestBody struct {
	ServerURL string `json:"server_url"`
}

type GetJobStatusResult added in v0.4.4

type GetJobStatusResult struct {
	Status string `json:"status"`
}

type GetProcfileContentsResp

type GetProcfileContentsResp map[string]string

type HTTPError

type HTTPError struct {
	Code   ErrorCode `json:"code"`
	Errors []string  `json:"errors"`
}

HTTPError is the object returned when the API encounters an error: this gets marshaled into JSON

type HandleGetRepoZIPDownloadURLResp added in v0.4.0

type HandleGetRepoZIPDownloadURLResp struct {
	URLString       string `json:"url"`
	LatestCommitSHA string `json:"latest_commit_sha"`
}

type KubeconfigResponse

type KubeconfigResponse struct {
	Kubeconfig []byte `json:"kubeconfig"`
}

type PorterRelease

type PorterRelease struct {
	*release.Release
	Form            *models.FormYAML                `json:"form"`
	HasMetrics      bool                            `json:"has_metrics"`
	LatestVersion   string                          `json:"latest_version"`
	GitActionConfig *models.GitActionConfigExternal `json:"git_action_config"`
	ImageRepoURI    string                          `json:"image_repo_uri"`
}

PorterRelease is a helm release with a form attached

type RegTokenResponse

type RegTokenResponse struct {
	Token     string     `json:"token"`
	ExpiresAt *time.Time `json:"expires_at"`
}

temp -- token response

type Repo

type Repo struct {
	FullName string
	Kind     string
}

Repo represents a GitHub or Gitab repository

type SendUserExt

type SendUserExt struct {
	ID            uint   `json:"id"`
	Email         string `json:"email"`
	EmailVerified bool   `json:"email_verified"`
	Redirect      string `json:"redirect,omitempty"`
}

type TestAgents

type TestAgents struct {
	HelmAgent             *helm.Agent
	HelmTestStorageDriver *storage.Storage
	K8sAgent              *kubernetes.Agent
}

TestAgents are the k8s agents used for testing

Jump to

Keyboard shortcuts

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