resolve

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: 13 Imported by: 0

Documentation

Overview

Package resolve provides device identifier resolution for Jamf Pro. It translates serial numbers, device names, and numeric IDs into the full set of identifiers (ID, managementId, UDID) required by various API endpoints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeRSQL

func EscapeRSQL(s string) string

EscapeRSQL escapes double quotes in a value for use in RSQL filter expressions.

func FormatDeviceDesc

func FormatDeviceDesc(d *DeviceIdentifiers) string

FormatDeviceDesc returns a human-readable device description for confirmation messages. Example: "Neil's MacBook" (serial: C02X1234, id: 42)

func ResolveClassicComputerGroupID

func ResolveClassicComputerGroupID(ctx context.Context, client registry.HTTPClient, groupName string) (string, error)

ResolveClassicComputerGroupID resolves a computer group name to its Classic API numeric ID. Works for both smart and static computer groups.

func ResolveClassicMobileGroupID

func ResolveClassicMobileGroupID(ctx context.Context, client registry.HTTPClient, groupName string) (string, error)

ResolveClassicMobileGroupID resolves a mobile device group name to its Classic API numeric ID. Works for both smart and static mobile device groups.

Types

type DeviceIdentifiers

type DeviceIdentifiers struct {
	ID           string // numeric ID (string form, e.g. "42")
	ManagementID string // UUID for blank-push, ddm-sync
	UDID         string // device UDID for renew-mdm
	Name         string // display name for confirmation messages
	SerialNumber string // serial number for confirmation messages
}

DeviceIdentifiers holds all ID forms needed by different action endpoints.

func ResolveComputer

func ResolveComputer(ctx context.Context, client registry.HTTPClient, serial, name, id string) (*DeviceIdentifiers, error)

ResolveComputer looks up a computer by serial, name, or ID using the v4 computers-inventory API and returns all identifier forms. Exactly one of serial, name, or id must be non-empty.

func ResolveComputerByManagementID added in v1.22.0

func ResolveComputerByManagementID(ctx context.Context, client registry.HTTPClient, managementID string) (*DeviceIdentifiers, error)

ResolveComputerByManagementID looks up a computer by its MDM management ID (UUID).

func ResolveComputerByUDID added in v1.22.0

func ResolveComputerByUDID(ctx context.Context, client registry.HTTPClient, udid string) (*DeviceIdentifiers, error)

ResolveComputerByUDID looks up a computer by its UDID.

func ResolveComputerGroup

func ResolveComputerGroup(ctx context.Context, client registry.HTTPClient, groupName string) ([]*DeviceIdentifiers, error)

ResolveComputerGroup resolves all members of a computer group by name. Uses the Classic API to list group members, then batch-resolves each via the v3 inventory API to get managementId/UDID.

func ResolveComputersFromFile

func ResolveComputersFromFile(ctx context.Context, client registry.HTTPClient, path string) ([]*DeviceIdentifiers, int, error)

ResolveComputersFromFile reads serials or IDs from a file (one per line) and resolves them to full identifiers. Blank lines and #-comments are skipped.

Returns the resolved devices and the number of entries that could not be resolved. Each unresolvable entry warns to stderr and is skipped — matching the per-member soft-fail of the --group path (batchResolveComputers) so one bad line doesn't abort the whole batch — and the count is returned so callers can fold it into their success/failure tally and exit code. If no entry at all resolves, an error is returned rather than an empty list: a wholly stale file must not read as a successful no-op batch.

Entries are looked up in chunked RSQL `=in=` queries, so an N-line file costs O(N/batchChunkSize) requests rather than one per line.

func ResolveMobileDevice

func ResolveMobileDevice(ctx context.Context, client registry.HTTPClient, serial, name, id string) (*DeviceIdentifiers, error)

ResolveMobileDevice looks up a mobile device by serial, name, or ID using the v2 mobile-devices API and returns all identifier forms.

func ResolveMobileDeviceGroup

func ResolveMobileDeviceGroup(ctx context.Context, client registry.HTTPClient, groupName string) ([]*DeviceIdentifiers, error)

ResolveMobileDeviceGroup resolves all members of a mobile device group by name.

func ResolveMobileDevicesFromFile

func ResolveMobileDevicesFromFile(ctx context.Context, client registry.HTTPClient, path string) ([]*DeviceIdentifiers, int, error)

ResolveMobileDevicesFromFile reads serials or IDs from a file and resolves them. Same contract as ResolveComputersFromFile — see there for the failure policy.

Jump to

Keyboard shortcuts

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