You are here

class SDKConnector in Apigee Edge 8

Same name in this branch
  1. 8 src/SDKConnector.php \Drupal\apigee_edge\SDKConnector
  2. 8 modules/apigee_edge_debug/src/SDKConnector.php \Drupal\apigee_edge_debug\SDKConnector
  3. 8 tests/modules/apigee_edge_test/src/SDKConnector.php \Drupal\apigee_edge_test\SDKConnector

Service decorator for SDKConnector.

Hierarchy

Expanded class hierarchy of SDKConnector

2 files declare their use of SDKConnector
ApiClientProfiler.php in modules/apigee_edge_debug/src/HttpClientMiddleware/ApiClientProfiler.php
DevelKintApiClientProfiler.php in modules/apigee_edge_debug/src/HttpClientMiddleware/DevelKintApiClientProfiler.php
1 string reference to 'SDKConnector'
apigee_edge_debug.services.yml in modules/apigee_edge_debug/apigee_edge_debug.services.yml
modules/apigee_edge_debug/apigee_edge_debug.services.yml
1 service uses SDKConnector
apigee_edge_debug.sdk_connector in modules/apigee_edge_debug/apigee_edge_debug.services.yml
Drupal\apigee_edge_debug\SDKConnector

File

modules/apigee_edge_debug/src/SDKConnector.php, line 35

Namespace

Drupal\apigee_edge_debug
View source
class SDKConnector extends OriginalSDKConnector implements SDKConnectorInterface {

  /**
   * Customer http request header.
   *
   * This tells the ApiClientProfiler to profile requests made by the underlying
   * HTTP client.
   *
   * @see \Drupal\apigee_edge_debug\HttpClientMiddleware\ApiClientProfiler
   *
   * @var string
   */
  public const HEADER = 'X-Apigee-Edge-Api-Client-Profiler';

  /**
   * The inner SDK connector service.
   *
   * @var \Drupal\apigee_edge\SDKConnector
   */
  private $innerService;

  /**
   * Constructs a new SDKConnector.
   *
   * @param \Drupal\apigee_edge\SDKConnectorInterface $inner_service
   *   The decorated SDK connector service.
   * @param \Drupal\Core\Http\ClientFactory $client_factory
   *   Http client.
   * @param \Drupal\key\KeyRepositoryInterface $key_repository
   *   The key repository.
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   Entity type manager service.
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The factory for configuration objects.
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
   *   Module handler service.
   * @param \Drupal\Core\Extension\InfoParserInterface $info_parser
   *   Info file parser service.
   */
  public function __construct(SDKConnectorInterface $inner_service, ClientFactory $client_factory, KeyRepositoryInterface $key_repository, EntityTypeManagerInterface $entity_type_manager, ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler, InfoParserInterface $info_parser) {
    $this->innerService = $inner_service;
    parent::__construct($client_factory, $key_repository, $entity_type_manager, $config_factory, $module_handler, $info_parser);
  }

  /**
   * {@inheritdoc}
   */
  protected function httpClientConfiguration() : array {
    $config = $this->innerService
      ->httpClientConfiguration();
    $config['headers'][static::HEADER] = static::HEADER;
    return $config;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SDKConnector::$client private static property The client object.
SDKConnector::$clientFactory private property The HTTP client factory.
SDKConnector::$configFactory protected property The config factory.
SDKConnector::$credentials private static property The currently used credentials object.
SDKConnector::$entityTypeManager protected property The entity type manager.
SDKConnector::$infoParser protected property The info parser.
SDKConnector::$innerService private property The inner SDK connector service.
SDKConnector::$keyRepository protected property The key repository.
SDKConnector::$moduleHandler protected property The module handler service.
SDKConnector::$userAgentPrefix private static property Custom user agent prefix.
SDKConnector::buildClient public function Returns a pre-configured API client with the provided credentials. Overrides SDKConnectorInterface::buildClient 1
SDKConnector::buildCredentials private function Builds credentials, which depends on the KeyType of the key entity.
SDKConnector::getClient public function Returns the http client. Overrides SDKConnectorInterface::getClient
SDKConnector::getCredentials private function Returns the credentials object used by the API client.
SDKConnector::getOrganization public function Gets the organization. Overrides SDKConnectorInterface::getOrganization
SDKConnector::HEADER public constant Customer http request header.
SDKConnector::httpClientConfiguration protected function Get HTTP client overrides for Apigee Edge API client. Overrides SDKConnector::httpClientConfiguration
SDKConnector::setCredentials private function Changes credentials used by the API client.
SDKConnector::testConnection public function Test connection with the Edge Management Server. Overrides SDKConnectorInterface::testConnection
SDKConnector::userAgentPrefix protected function Generates a custom user agent prefix.
SDKConnector::__construct public function Constructs a new SDKConnector. Overrides SDKConnector::__construct