Jamf Client#
- class JamfClient(*, client_id: str, client_secret: str, server: str)[source]#
Represents a Jamf client configuration.
This class is responsible for holding the configuration necessary to interact with the Jamf API, including client credentials, server information, and
AccessToken
objects.- 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 API.
- Parameters:
Removed in version 2.0
AccessToken
objects are handled exclusively by theTokenManager
class. This ensures ‘stale’ tokens are not used, causing 401 responses.- 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.
This method checks if the provided URL has a scheme (e.g., ‘https’) and a network location (netloc). If the scheme is missing, ‘https’ is assumed. The method returns the validated and correctly formatted URL.
- classmethod not_empty()[source]#
Wrap a classmethod, staticmethod, property or unbound function and act as a descriptor that allows us to detect decorated items from the class’ attributes.
This class’ __get__ returns the wrapped item’s __get__ result, which makes it transparent for classmethods and staticmethods.
- Attributes:
wrapped: The decorator that has to be wrapped. decorator_info: The decorator info. shim: A wrapper function to wrap V1 style function.
- classmethod validate_url()[source]#
Wrap a classmethod, staticmethod, property or unbound function and act as a descriptor that allows us to detect decorated items from the class’ attributes.
This class’ __get__ returns the wrapped item’s __get__ result, which makes it transparent for classmethods and staticmethods.
- Attributes:
wrapped: The decorator that has to be wrapped. decorator_info: The decorator info. shim: A wrapper function to wrap V1 style function.
- class ApiRoleModel(*, display_name: str = 'Patcher-Role', privileges: ~typing.List[str] = <factory>)[source]#
Represents an API role with specific privileges required for Patcher to operate.
- class ApiClientModel(*, auth_scopes: ~typing.List[str] = <factory>, display_name: str = 'Patcher-Client', enabled: bool = True, token_lifetime: int = 1800)[source]#
The
ApiClient
class defines the configuration for an API client, including its authentication scopes, display name, whether it is enabled, and the token lifetime.- 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: