apphttp

package
v1.162.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package apphttp serves applications on the portal (#2411, #2412): the listing, an application's parts, releases and what each changed, and the actions the manage_application tool takes, through the same service and under the same rules. Everyone signed in reads; an application's owner and administrators edit it; administrators release, roll back, export and import. Every write is audited as a manage_application call from the portal.

Index

Constants

View Source
const DatabasesPath = "/api/v1/portal/application-databases"

DatabasesPath is the route the New application dialog fills its connection and schema choices from. It is beside Prefix, not under it, so no application's name is shadowed by it.

View Source
const Prefix = "/api/v1/portal/applications"

Prefix opens every route.

Variables

This section is empty.

Functions

func Register

func Register(mux *http.ServeMux, wrap func(http.Handler) http.Handler, cfg Config)

Register mounts the routes behind wrap, the portal's authentication.

Types

type Bundles

type Bundles interface {
	Bundle(ctx context.Context, actor application.Actor, ref string, release int) (*appbundle.Bundle, error)
	ImportBundle(ctx context.Context, actor application.Actor, bundle *appbundle.Bundle, mapping map[string]string) (*appbundle.Imported, error)
}

Bundles assembles a release's bundle and imports one.

type Config

type Config struct {
	Service *appsvc.Service
	// Bundles exports and imports; nil refuses both. The portal downloads a
	// bundle and uploads one, where the tool writes and reads a managed
	// resource.
	Bundles Bundles
	// Actor is who made a request, nil for none.
	Actor func(r *http.Request) *application.Actor
	Audit middleware.AuditLogger
	// Databases lists the application database connections a request's
	// caller reaches and their schemas (#2491); nil leaves the route
	// unmounted.
	Databases func(r *http.Request, actor application.Actor) []DatabaseChoice
	// ViewAsset reports whether a request's caller opens an asset, which an
	// asset part's name is told only to (#2527); nil tells it to no one but
	// administrators.
	ViewAsset appsvc.AssetViewer
}

Config is what the routes use.

type DatabaseChoice added in v1.153.2

type DatabaseChoice struct {
	Connection  string         `json:"connection" example:"orders"`
	Description string         `json:"description,omitempty"`
	Schemas     []SchemaChoice `json:"schemas"`
	// Problem says the schemas could not be read, empty when they were. It
	// never repeats the database's error, which can name its address.
	Problem string `json:"problem,omitempty"`
}

DatabaseChoice is one application database connection the caller reaches, with the schemas it holds.

type SchemaChoice added in v1.153.2

type SchemaChoice struct {
	Name   string `json:"name" example:"shop"`
	HeldBy string `json:"held_by,omitempty" example:"shop"`
}

SchemaChoice is one schema of a connection, and the application holding it, if any: a schema is held by one application.

Jump to

Keyboard shortcuts

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