You are here

public function SDKConnector::getClient in Apigee Edge 8

Returns the http client.

Return value

\Apigee\Edge\ClientInterface The http client.

Overrides SDKConnectorInterface::getClient

1 call to SDKConnector::getClient()
SDKConnector::testConnection in src/SDKConnector.php
Test connection with the Edge Management Server.

File

src/SDKConnector.php, line 164

Class

SDKConnector
Provides an Apigee Edge SDK connector.

Namespace

Drupal\apigee_edge

Code

public function getClient(?Authentication $authentication = NULL, ?string $endpoint = NULL) : ClientInterface {
  if ($authentication === NULL) {
    if (self::$client === NULL) {
      $credentials = $this
        ->getCredentials();

      /** @var \Drupal\apigee_edge\Plugin\EdgeKeyTypeInterface $key_type */
      self::$client = $this
        ->buildClient($credentials
        ->getAuthentication(), $credentials
        ->getKeyType()
        ->getEndpoint($credentials
        ->getKey()));
    }
    return self::$client;
  }
  else {
    return $this
      ->buildClient($authentication, $endpoint);
  }
}