public static function Zone::assertValidCredentials in CloudFlare 8
Asserts that credentials are valid. Does NOT pull settings from CMI.
Parameters
string $apikey: The secret Api key used to authenticate against CloudFlare.
string $email: Email of the account used to authenticate against CloudFlare.
\Drupal\cloudflare\CloudFlareComposerDependenciesCheckInterface $composer_dependency_check: Checks that composer dependencies are met.
\Drupal\cloudflare\CloudFlareStateInterface $state: Tracks rate limits associated with CloudFlare Api.
Throws
CloudFlarePhpSdk\Exceptions\CloudFlareInvalidCredentialException Thrown if $apikey and $email fail to authenticate against the Api.
CloudFlarePhpSdk\Exceptions\CloudFlareTimeoutException Thrown if the connection to the Api times out.
CloudFlarePhpSdk\Exceptions\CloudFlareException Thrown if an unknown exception occurs when connecting to the Api.
Overrides CloudFlareZoneInterface::assertValidCredentials
File
- src/
Zone.php, line 209
Class
- Zone
- Zone methods for CloudFlare.
Namespace
Drupal\cloudflareCode
public static function assertValidCredentials($apikey, $email, CloudFlareComposerDependenciesCheckInterface $composer_dependency_check, CloudFlareStateInterface $state) {
$composer_dependency_check
->assert();
$zone_api_direct = new ZoneApi($apikey, $email);
try {
$zones = $zone_api_direct
->listZones();
} catch (Exception $e) {
throw $e;
} finally {
$state
->incrementApiRateCount();
}
}