You are here

private function SDKConnector::getCredentials in Apigee Edge 8

Returns the credentials object used by the API client.

Return value

\Drupal\apigee_edge\CredentialsInterface The key entity.

3 calls to SDKConnector::getCredentials()
SDKConnector::getClient in src/SDKConnector.php
Returns the http client.
SDKConnector::getOrganization in src/SDKConnector.php
Gets the organization.
SDKConnector::testConnection in src/SDKConnector.php
Test connection with the Edge Management Server.

File

src/SDKConnector.php, line 196

Class

SDKConnector
Provides an Apigee Edge SDK connector.

Namespace

Drupal\apigee_edge

Code

private function getCredentials() : CredentialsInterface {
  if (self::$credentials === NULL) {
    $active_key = $this->configFactory
      ->get('apigee_edge.auth')
      ->get('active_key');
    if (empty($active_key)) {
      throw new AuthenticationKeyException('Apigee Edge API authentication key is not set.');
    }
    if (!($key = $this->keyRepository
      ->getKey($active_key))) {
      throw new AuthenticationKeyNotFoundException($active_key, 'Apigee Edge API authentication key not found with "@id" id.');
    }
    self::$credentials = $this
      ->buildCredentials($key);
  }
  return self::$credentials;
}