Module coolipy.services.coolify_api.private_keys
Classes
class PrivatetKeys (http_service: HttpService, base_service_url: str)-
Handles operations related to private keys in the Coolify API.
Initializes the Coolify API service with an HTTP service instance and a specific service URL.
Args
http_service:HttpService- Instance of the HttpService class for making HTTP requests.
base_service_url:str- The endpoint URL for the specific service (e.g., '/servers', '/teams').
Expand source code
class PrivatetKeys(CoolifyApiBase): """ Handles operations related to private keys in the Coolify API. """ def list(self) -> CoolifyAPIResponse: """ Retrieve all private keys. Returns: CoolifyAPIResponse: Response containing a list of private keys. """ content = self._http.get(self._base_url) return self._handle_response( content, COOLIFY_RETURN_TYPES.list, PrivateKeysModel ) def get(self, private_key_uuid: str) -> CoolifyAPIResponse: """ Retrieve a private key by UUID. Args: private_key_uuid (str): The UUID of the private key. Returns: CoolifyAPIResponse: Response containing the private key details. """ content = self._http.get(f"{self._base_url}/{private_key_uuid}") return self._handle_response( content, COOLIFY_RETURN_TYPES.single, PrivateKeysModel ) def create(self, private_key: PrivateKeysModelCreate) -> CoolifyAPIResponse: """ Create a new private key. Args: private_key (PrivateKeysModel): The private key data. Returns: CoolifyAPIResponse: Response from the API. """ model_as_dict = asdict(private_key) content = self._http.post(self._base_url, data=json.dumps(model_as_dict)) return self._handle_response(content, COOLIFY_RETURN_TYPES.raw) def update(self, private_key: PrivateKeysModelCreate) -> CoolifyAPIResponse: """ Update an existing private key. Args: private_key (PrivateKeysModel): The updated private key data. Returns: CoolifyAPIResponse: Response from the API. """ model_as_dict = asdict(private_key) content = self._http.patch(self._base_url, data=json.dumps(model_as_dict)) return self._handle_response(content, COOLIFY_RETURN_TYPES.raw) def delete(self, private_key_uuid: str) -> CoolifyAPIResponse: """ Delete a private key by UUID. Args: private_key_uuid (str): The UUID of the private key. """ content = self._http.delete(f"{self._base_url}/{private_key_uuid}") self._handle_response(content, COOLIFY_RETURN_TYPES.raw)Ancestors
Methods
def create(self, private_key: PrivateKeysModelCreate) ‑> CoolifyAPIResponse-
Create a new private key.
Args
private_key:PrivateKeysModel- The private key data.
Returns
CoolifyAPIResponse- Response from the API.
def delete(self, private_key_uuid: str) ‑> CoolifyAPIResponse-
Delete a private key by UUID.
Args
private_key_uuid:str- The UUID of the private key.
def get(self, private_key_uuid: str) ‑> CoolifyAPIResponse-
Retrieve a private key by UUID.
Args
private_key_uuid:str- The UUID of the private key.
Returns
CoolifyAPIResponse- Response containing the private key details.
def list(self) ‑> CoolifyAPIResponse-
Retrieve all private keys.
Returns
CoolifyAPIResponse- Response containing a list of private keys.
def update(self, private_key: PrivateKeysModelCreate) ‑> CoolifyAPIResponse-
Update an existing private key.
Args
private_key:PrivateKeysModel- The updated private key data.
Returns
CoolifyAPIResponse- Response from the API.