gateway

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package gateway answers whether the Jamf Platform gateway serves a given Jamf Pro or Classic API request, and says so in a way an operator can act on.

The gateway does not expose every Jamf Pro endpoint, and its refusals are not self-describing: an unrouted namespace answers 403 BAD_PERMISSIONS — byte for byte what a missing API-role privilege answers — or Tyk's bare "404 page not found". So without this, `pro app-installer-titles list` on a platform profile sends an operator to grant a privilege that cannot help.

The table is generated (coverage_gen.go) from the gateway's own published artefacts. See generator/gateway for how a verdict is decided and what the two levels mean.

Index

Constants

View Source
const (
	ProAPIVersion     = "11.31.0"
	ClassicAPIVersion = "11.28.0"
	SDKCommit         = "bed9af9"
)

Provenance of the manifest this table was derived from. Empty when the tree held no manifest at generate time, which is the "unknown" case: Lookup then finds nothing and no command is refused.

View Source
const (
	AnyMethod  = "*"
	AnySubpath = "**"
)

AnyMethod and AnySubpath are the wildcards a table entry may carry. A method of "*" matches every method; a terminal "**" segment matches the path it sits under and everything below it. Both are used by Classic entries, whose verdict is resource-wide because a Classic path is assembled at runtime from the resource path plus whichever lookup is in play.

Variables

This section is empty.

Functions

func InstallSuccessorForTest added in v1.29.0

func InstallSuccessorForTest(t interface {
	Helper()
	Fatalf(string, ...any)
}, refused, command, why string,
) func()

InstallSuccessorForTest adds a curated entry for the duration of a test and returns the undo. It exists because successors is unexported and legitimately empty — the one live entry it held was retired when spec-derived resource identity folded the withdrawn v2 computer-groups command into its v3 sibling — while the code that renders an entry lives in three other places (the runtime refusal, the --help caveat and the `commands -o json` catalog), two of them in internal/commands. Without this, those two would have to skip, and a skip is what let the last guard gap in this area ship: the projection that copies the successor into the catalog was dead for a release with every test green.

The first parameter is *testing.T, taken as the narrowest interface that satisfies it rather than by importing testing into a production package. That is also what keeps this out of production use: nothing outside a test has a value to pass.

func Note

func Note(level Level, basis Basis, detail string) string

Note renders the hint appended to a gateway 403 or 404, or "" when there is nothing to add.

Most such requests never reach the wire: checkAPIMatch refuses the command pre-flight. This is for the cases that do — a hand-written command fanning out over many endpoints carries one annotation for the whole batch, so only the request itself knows which endpoint was refused.

func NoteForRequest

func NoteForRequest(method, path string) string

NoteForRequest is Note over the table, for a concrete gateway-form request.

func Refusal

func Refusal(cmdPath string, basis Basis, detail string) string

Refusal renders the pre-flight refusal. cmdPath is the invoked command, e.g. "pro app-installer-titles list".

A probed entry states the fact. An unpublished one says the endpoint is outside the supported surface and that answering today is transitional — refusing it now is the point, because letting it through means a workflow gets built on a route that is going away and the failure arrives later as an unexplained breakage.

func Scopes

func Scopes(method, path string) []string

Scopes returns the Jamf Account capability permissions the gateway requires for a gateway-form request — the path as it will be sent, e.g. "/pro/v1/categories" or "/proclassic/computers/id/3". Returns nil when the table has nothing for it, which includes a tree with no manifest, an unserved operation (the published specs declare no scope for what they do not publish) and the 44 Jamf Pro endpoints that are unauthenticated and therefore declare none.

These are the GA capability permissions granted in Jamf Account (categories:read), never Jamf Pro API-role privilege names — so this is the right answer only for a request actually going through the gateway. Callers discriminate on the /pro/ and /proclassic/ prefixes, which exist only in gateway mode.

func Successor

func Successor(cmdPath string) (command, why string, ok bool)

Successor returns the replacement for a refused command path — the full path as cobra reports it, binary name included, e.g. "jamf-cli pro static-computer-groups list". ok is false when nothing is curated for it, which is the normal answer.

Matched by longest command-path prefix, so one entry covers every subcommand of a refused resource.

func SuccessorNote

func SuccessorNote(cmdPath string) string

SuccessorNote renders the successor sentence for a command path, or "" when nothing is curated. Shared by the refusal and by the --help caveat so the two cannot drift.

func SuccessorTable

func SuccessorTable() map[string]string

SuccessorTable returns the curated entries as refused path -> replacement path, both without the binary name, for the staleness test.

func UnpublishedOverrideWarning

func UnpublishedOverrideWarning(cmdPath, detail string) string

UnpublishedOverrideWarning renders the warning printed in place of the refusal when JAMF_CLI_ALLOW_UNPUBLISHED is set. It is deliberately loud and deliberately not silenceable: the whole point of the escape hatch is that the operator is told, on every affected invocation, that they are running against a route nobody has committed to keeping.

Types

type Basis

type Basis string

Basis is the evidence behind an Unserved verdict. It selects the wording of the refusal and nothing else.

const (
	// BasisProbe: a recorded wire probe found the gateway does not route it.
	BasisProbe Basis = "probe"
	// BasisUnpublished: absent from the gateway's published artefacts. May still
	// be routed today.
	BasisUnpublished Basis = "unpublished"
)

type Finding

type Finding struct {
	Method string
	Path   string
	Level  Level
	Basis  Basis
	Detail string
}

Finding is one entry in the generated table.

func Lookup

func Lookup(method, path string) (Finding, bool)

Lookup reports what is known about a gateway-form request — the path as it will be sent, e.g. "/pro/v1/app-installers/titles/3" or "/proclassic/computerconfigurations". Returns false when the gateway is not known to omit it, which includes every request in a tree with no manifest.

type Level

type Level string

Level is whether the Jamf Platform gateway serves an operation. Mirrors generator/gateway.Level; the runtime does not import the generator.

const (
	// Served means the gateway's published surface carries it.
	Served Level = ""
	// Unserved means it is not part of that surface, and a gateway profile is
	// refused before a request is sent. The gateway currently routes some
	// endpoints its published artefacts omit, and that is transitional — the
	// route set is being narrowed onto the published surface — so "it works
	// today" is not a reason to let a workflow be built on it.
	Unserved Level = "unserved"
)

Jump to

Keyboard shortcuts

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