Hosting-Handler

lock()

Signatur

public function lock(ProductHosting $productHosting): ServerHostingLockedResponse

Beschreibung

Sperrung des Produkts. Das passiert, wenn die Zahlung überfällig ist oder der Admin den Sperrvorgang initiiert hat.

Rückgabewert

ServerHostingLockedResponse bei Erfolg, Exception mit der Meldung bei Fehler. Beispiel:

return new ServerHostingLockedResponse()

Beispiel

/**
 * @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();
}
War das hilfreich?