lock()
Signature
public function lock(ProductHosting $productHosting): ServerHostingLockedResponseDescription
Suspension of the product. This happens when the payment is overdue or the admin initiated the locking process.
Return value
ServerHostingLockedResponse for success, Exception with the mesage on error. Example:
return new ServerHostingLockedResponse()Example
/**
* @param ProductHosting $productHosting
* @return ServerHostingLockedResponse
* @throws GuzzleException
*/
public function lock(ProductHosting $productHosting): ServerHostingLockedResponse {
// API request to disable the user
$res = $this->getClient($productHosting->host)->disableUser($productHosting->custom_fields['nextcloudUser']);
// error handling
if (isset($res['meta']) && $res['meta']['statuscode'] !== "100") {
throw new Exception(json_encode($res));
}
// success
return new ServerHostingLockedResponse();
}Was this helpful?