classic

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const CodegenHeader = "// Code generated by jamf-cli generator (classic). DO NOT EDIT."

CodegenHeader is the marker line at the top of every classic API generated file. Must match the first line of classicResourceTemplate and classicRegistryTemplate.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClassicResource

type ClassicResource struct {
	Name        string // e.g., "policies"
	Path        string // URL segment under /JSSResource/: "policies"
	CLIName     string // e.g., "classic-policies"
	GoName      string // e.g., "ClassicPolicies"
	Singular    string // JSON root key for a single object: "policy"
	Description string
	Operations  []string // ["list", "get", "create", "update", "delete"]
	Lookups     []string // ["id", "name", "serialnumber", "macaddress", "udid"]
	HasScope    bool     // true if the resource supports scope operations
	IDPath      string   // path segment between base path and ID value; defaults to "id" (e.g. "groupid" → /accounts/groupid/{id})
}

ClassicResource represents a Classic API resource parsed from the YAML manifest.

func ParseManifest

func ParseManifest(path string) ([]ClassicResource, error)

ParseManifest reads the Classic API YAML manifest and returns a sorted slice of ClassicResource structs with all defaults applied.

func (*ClassicResource) ExtraLookups

func (r *ClassicResource) ExtraLookups() []string

ExtraLookups returns lookups beyond "id" (e.g., name, serialnumber, macaddress, udid).

func (*ClassicResource) HasLookup

func (r *ClassicResource) HasLookup(lookup string) bool

HasLookup returns true if the resource supports the given lookup type.

func (*ClassicResource) HasOperation

func (r *ClassicResource) HasOperation(op string) bool

HasOperation returns true if the resource supports the given operation.

type Generator

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

Generator generates Go command files from ClassicResource definitions.

func NewGenerator

func NewGenerator(outputDir string) *Generator

NewGenerator creates a new Classic API code generator.

func (*Generator) Generate

func (g *Generator) Generate(resource ClassicResource) (string, error)

Generate writes a Go command file for a single Classic API resource.

func (*Generator) GenerateRegistry

func (g *Generator) GenerateRegistry(resources []ClassicResource) (string, error)

GenerateRegistry writes the classic_registry.go file that registers all Classic commands.

Jump to

Keyboard shortcuts

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