Hosting-Handler

unlock()

Signatur

public function unlock(ProductHosting $productHosting): ServerHostingLockedResponse

Beschreibung

Entsperrung des Produkts. Das passiert, wenn die überfällige Rechnung bezahlt wird / das gesperrte Hosting wieder aktiviert wird

Rückgabewert

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

return new ServerHostingUnlockedResponse()

Beispiel

/**
 * @param ProductHosting $productHosting
 * @return ServerHostingUnlockedResponse
 * @throws GuzzleException
 */
public function unlock(ProductHosting $productHosting): ServerHostingLockedResponse {
        // API request to enable the user
        $res = $this->getClient($productHosting->host)->enableUser($productHosting->custom_fields['nextcloudUser']);
        
        // error handling
        if (isset($res['meta']) && $res['meta']['statuscode'] !== "100") {
		throw new Exception(json_encode($res));
        }

        // success
	return new ServerHostingUnlockedResponse();
}
War das hilfreich?