Documentation
¶
Overview ¶
Package frontend builds and packages frontend project archives for upload.
Index ¶
- func NormalizeAppRoot(raw string) (string, error)
- func ValidateAppRootExists(archiveRoot, appRoot string) error
- type CustomDomainEntry
- type Package
- type PackageOptions
- type Route
- type RouteInput
- type RouteUpdate
- type Service
- func (s Service) CreateCustomDomain(ctx context.Context, identifier string, input api.FrontendCustomDomainInput) (*apiclient.Frontend, *apiclient.FrontendCustomDomainResponse, error)
- func (s Service) CreateRoute(ctx context.Context, identifier string, input RouteInput) (*apiclient.Frontend, Route, error)
- func (s Service) DeleteByID(ctx context.Context, frontendID uuid.UUID) error
- func (s Service) DeleteCustomDomainByID(ctx context.Context, frontendID uuid.UUID) error
- func (s Service) DeleteRouteByID(ctx context.Context, frontendID, routeID uuid.UUID) error
- func (s Service) Deploy(ctx context.Context, input api.FrontendDeployInput) (*apiclient.Frontend, error)
- func (s Service) DeploymentLogs(ctx context.Context, frontendID, deploymentID uuid.UUID, limit int, ...) (*apiclient.LogSearchResponse, error)
- func (s Service) Get(ctx context.Context, identifier string) (*apiclient.Frontend, error)
- func (s Service) GetCustomDomain(ctx context.Context, identifier string) (*apiclient.Frontend, *apiclient.FrontendCustomDomainResponse, error)
- func (s Service) LatestDeployment(ctx context.Context, frontendID uuid.UUID) (*apiclient.FrontendDeployment, error)
- func (s Service) ListCustomDomains(ctx context.Context) ([]CustomDomainEntry, error)
- func (s Service) ListPage(ctx context.Context, page, limit int) (*apiclient.PaginatedFrontends, error)
- func (s Service) ListRoutes(ctx context.Context, identifier string) (*apiclient.Frontend, []Route, error)
- func (s Service) Redeploy(ctx context.Context, identifier string) (*apiclient.Frontend, error)
- func (s Service) Resolve(ctx context.Context, identifier string) (*apiclient.Frontend, error)
- func (s Service) ResolveDeployment(ctx context.Context, frontendID uuid.UUID, deploymentID string) (*apiclient.FrontendDeployment, error)
- func (s Service) ResolveRoute(ctx context.Context, identifier, route string) (*apiclient.Frontend, apiclient.FrontendFunctionRoute, error)
- func (s Service) RouteTargets(ctx context.Context, routes []apiclient.FrontendFunctionRoute) ([]Route, error)
- func (s Service) RuntimeLogs(ctx context.Context, frontendID uuid.UUID, limit int, cursor string) (*apiclient.LogSearchResponse, error)
- func (s Service) StreamDeploymentLogs(ctx context.Context, frontendID, deploymentID uuid.UUID, limit int) (*api.ProjectLogStream, error)
- func (s Service) StreamRuntimeLogs(ctx context.Context, frontendID uuid.UUID, limit int, lastEventID string) (*api.ProjectLogStream, error)
- func (s Service) UpdateRoute(ctx context.Context, identifier, route string, update RouteUpdate) (*apiclient.Frontend, Route, error)
- type TargetNotPublicError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeAppRoot ¶
NormalizeAppRoot validates and normalizes a user-supplied --app-root flag. Empty or "." values become "", meaning the archive root is the app root.
func ValidateAppRootExists ¶
ValidateAppRootExists verifies that --app-root resolves to a directory under the packaged archive root.
Types ¶
type CustomDomainEntry ¶
type CustomDomainEntry struct {
Frontend apiclient.Frontend
Domain apiclient.FrontendCustomDomainResponse
}
CustomDomainEntry contains one frontend custom domain attachment.
type Package ¶
type Package struct {
Archive []byte
Size int64
PackagingRoot string
AppPath string
// SkippedSymlinks lists POSIX-relative archive paths whose symlinks were
// dropped because the archive cannot represent them safely. Callers
// should surface these so users notice missing files (e.g. monorepo
// assets symlinked across packages).
SkippedSymlinks []string
}
Package contains one frontend source archive ready for API upload.
func PackageDirectory ¶
func PackageDirectory(rootDir string, opts PackageOptions) (*Package, error)
PackageDirectory builds a tar.gz archive of rootDir for upload, applying ignore rules and optionally promoting the working tree to a workspace root. Promotion can be disabled via opts.DisableWorkspacePromotion.
type PackageOptions ¶
type PackageOptions struct {
// DisableWorkspacePromotion packages the selected root as-is even when
// it participates in a JS workspace with `workspace:` deps. The caller
// is responsible for telling the server where the app lives.
DisableWorkspacePromotion bool
// AppRoot, when non-empty, is the POSIX-relative path the caller plans
// to send as the server-side `app_root` field. PackageDirectory rejects
// the request when this path would be excluded by the archive ignore
// rules, so the server is never told to build a directory that is not
// in the upload.
AppRoot string
}
PackageOptions tunes how PackageDirectory builds the archive.
type Route ¶ added in v0.42.0
type Route struct {
apiclient.FrontendFunctionRoute
// Function is nil when the target is missing from the function list, such
// as one deleted after the route was read.
Function *apiclient.Function
}
Route is a frontend function route and the function it forwards to.
type RouteInput ¶ added in v0.42.0
RouteInput is the route a create writes. Function is a name or ID.
type RouteUpdate ¶ added in v0.42.0
RouteUpdate changes the fields that are set and keeps the others.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service performs authenticated Volcano frontend workflows.
func NewService ¶
func NewService(deps cliruntime.Deps) Service
NewService returns a frontend service.
func (Service) CreateCustomDomain ¶
func (s Service) CreateCustomDomain(ctx context.Context, identifier string, input api.FrontendCustomDomainInput) (*apiclient.Frontend, *apiclient.FrontendCustomDomainResponse, error)
CreateCustomDomain attaches a custom domain to a frontend.
func (Service) CreateRoute ¶ added in v0.42.0
func (s Service) CreateRoute(ctx context.Context, identifier string, input RouteInput) (*apiclient.Frontend, Route, error)
CreateRoute forwards a path prefix on a frontend to a function.
func (Service) DeleteByID ¶
DeleteByID starts deleting one frontend by ID.
func (Service) DeleteCustomDomainByID ¶
DeleteCustomDomainByID detaches the configured custom domain from a frontend ID.
func (Service) DeleteRouteByID ¶ added in v0.42.0
DeleteRouteByID stops forwarding one route's path prefix.
func (Service) Deploy ¶
func (s Service) Deploy(ctx context.Context, input api.FrontendDeployInput) (*apiclient.Frontend, error)
Deploy uploads one frontend source archive and starts a deployment.
func (Service) DeploymentLogs ¶
func (s Service) DeploymentLogs(ctx context.Context, frontendID, deploymentID uuid.UUID, limit int, cursor string) (*apiclient.LogSearchResponse, error)
DeploymentLogs returns one build log search page for a frontend deployment.
func (Service) GetCustomDomain ¶
func (s Service) GetCustomDomain(ctx context.Context, identifier string) (*apiclient.Frontend, *apiclient.FrontendCustomDomainResponse, error)
GetCustomDomain returns the configured custom domain for a frontend.
func (Service) LatestDeployment ¶
func (s Service) LatestDeployment(ctx context.Context, frontendID uuid.UUID) (*apiclient.FrontendDeployment, error)
LatestDeployment returns the first deployment on the default deployment page.
func (Service) ListCustomDomains ¶
func (s Service) ListCustomDomains(ctx context.Context) ([]CustomDomainEntry, error)
ListCustomDomains lists frontend custom domains in the current project.
func (Service) ListPage ¶
func (s Service) ListPage(ctx context.Context, page, limit int) (*apiclient.PaginatedFrontends, error)
ListPage returns one frontend page in the current project.
func (Service) ListRoutes ¶ added in v0.42.0
func (s Service) ListRoutes(ctx context.Context, identifier string) (*apiclient.Frontend, []Route, error)
ListRoutes returns a frontend's function routes in the order they match.
func (Service) Redeploy ¶
Redeploy starts a new deployment for the named frontend using the previously uploaded archive.
func (Service) ResolveDeployment ¶
func (s Service) ResolveDeployment(ctx context.Context, frontendID uuid.UUID, deploymentID string) (*apiclient.FrontendDeployment, error)
ResolveDeployment returns a frontend deployment by ID, paging internally.
func (Service) ResolveRoute ¶ added in v0.42.0
func (s Service) ResolveRoute(ctx context.Context, identifier, route string) (*apiclient.Frontend, apiclient.FrontendFunctionRoute, error)
ResolveRoute returns one route, found by its path prefix or ID.
func (Service) RouteTargets ¶ added in v0.42.0
func (s Service) RouteTargets(ctx context.Context, routes []apiclient.FrontendFunctionRoute) ([]Route, error)
RouteTargets pairs routes already read with the functions they forward to.
func (Service) RuntimeLogs ¶
func (s Service) RuntimeLogs(ctx context.Context, frontendID uuid.UUID, limit int, cursor string) (*apiclient.LogSearchResponse, error)
RuntimeLogs returns one runtime log search page for a frontend.
func (Service) StreamDeploymentLogs ¶ added in v0.0.4
func (s Service) StreamDeploymentLogs(ctx context.Context, frontendID, deploymentID uuid.UUID, limit int) (*api.ProjectLogStream, error)
StreamDeploymentLogs opens a build log stream for a frontend deployment.
type TargetNotPublicError ¶ added in v0.42.0
TargetNotPublicError reports a route refused because the function it forwards to is not public, which every route target must be.
func (*TargetNotPublicError) Error ¶ added in v0.42.0
func (e *TargetNotPublicError) Error() string
func (*TargetNotPublicError) Unwrap ¶ added in v0.42.0
func (e *TargetNotPublicError) Unwrap() error