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_clientfrom values held in aConfigManagerand handed toJamfClient(the API client) at instantiation time.client_secretis held aspydantic.SecretStrso accidental serialization (repr,model_dump, traceback frames, etc.) renders the masked placeholder rather than the actual secret. Callcredentials.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:
client_id (str)
client_secret (
pydantic.SecretStr)server (str)
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:
- 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
httpsregardless 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 typedhttp://out of habit.
- classmethod not_empty(value)[source]ΒΆ
Ensures that the client_id and client_secret fields are not empty, raising a
PatcherErrorif they are.- Parameters:
value (str) β The value to validate.
- Returns:
The validated value.
- Return type:
- Raises:
PatcherError β If the value is empty.
- 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 --setupwhen 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.