Jamf ModelsΒΆ

class JamfCredentials(*, client_id: str, client_secret: SecretStr, server: str)[source]ΒΆ

Pydantic model carrying the credentials needed to authenticate against a Jamf Pro instance: client ID, client secret, and server URL.

Constructed by attach_client from values held in a ConfigManager and handed to JamfClient (the API client) at instantiation time.

client_secret is held as pydantic.SecretStr so accidental serialization (repr, model_dump, traceback frames, etc.) renders the masked placeholder rather than the actual secret. Call credentials.client_secret.get_secret_value() when the plaintext is needed (e.g. building the OAuth token request body).

Variables:
  • client_id – The client ID used for authentication with the Jamf API.

  • client_secret – The client secret used for authentication with the Jamf API.

  • server – The server URL for the Jamf instance.

Parameters:

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

property base_url[source]ΒΆ

Gets the base URL of the Jamf server.

Returns:

The base URL of the Jamf server.

Return type:

str

static valid_url(url: str) str[source]ΒΆ

Validates and formats a URL to ensure it has the correct scheme and structure.

The scheme is forced to https regardless of what the caller passed; the Jamf Pro API does not accept plain HTTP and silently upgrading prevents bearer tokens from ever being shipped over an unencrypted connection by a user who typed http:// out of habit.

Parameters:

url (str) – The URL to validate and format.

Returns:

The validated and formatted URL, always https://....

Return type:

str

classmethod not_empty(value)[source]ΒΆ

Ensures that the client_id and client_secret fields are not empty, raising a PatcherError if they are.

Parameters:

value (str) – The value to validate.

Returns:

The validated value.

Return type:

str

Raises:

PatcherError – If the value is empty.

classmethod validate_url(v)[source]ΒΆ

Validates that the ~patcher.core.models.jamf.JamfCredentials.server field contains a valid and properly formatted URL by calling the ~patcher.core.models.jamf.JamfCredentials.valid_url method.

Parameters:

v (str) – The server URL to validate.

Returns:

The validated and formatted server URL.

Return type:

str

class ApiRoleModel(*, display_name: str = 'Patcher-Role', privileges: list[str] = <factory>)[source]ΒΆ

Represents an API role with specific privileges required for Patcher to operate.

Variables:
  • display_name – The name of the API role.

  • privileges – A list of privileges assigned to the API role. These privileges determine the actions that the role can perform.

Parameters:

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

class ApiClientModel(*, auth_scopes: list[str] = <factory>, display_name: str = 'Patcher-Client', enabled: bool = True, token_lifetime: int = 1800)[source]ΒΆ

Configuration for a Jamf Pro API client (auth scopes, display name, enabled flag, token lifetime). Constructed during patcherctl --setup when Patcher creates the API client on the Jamf side via the Standard setup flow.

Variables:
  • auth_scopes – A list of authentication scopes assigned to the API client. These scopes define the level of access the client has.

  • display_name – The name of the API client.

  • enabled – Indicates whether the API client is currently enabled or disabled.

  • token_lifetime – The lifetime of the access token in seconds. This value determines how long the token remains valid.

Parameters:

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.