You are here

public function EdgeKeyTypeBase::getEndpoint in Apigee Edge 8

Gets the API endpoint.

Parameters

\Drupal\key\KeyInterface $key: The key entity.

Return value

string The API endpoint.

Overrides EdgeKeyTypeInterface::getEndpoint

File

src/Plugin/EdgeKeyTypeBase.php, line 70

Class

EdgeKeyTypeBase
Defines a base class for Apigee Edge Key Type plugins.

Namespace

Drupal\apigee_edge\Plugin

Code

public function getEndpoint(KeyInterface $key) : string {
  if ($this
    ->getInstanceType($key) === EdgeKeyTypeInterface::INSTANCE_TYPE_HYBRID) {
    return ClientInterface::APIGEE_ON_GCP_ENDPOINT;
  }
  elseif ($this
    ->getInstanceType($key) === EdgeKeyTypeInterface::INSTANCE_TYPE_PUBLIC) {
    return Client::EDGE_ENDPOINT;
  }
  return $key
    ->getKeyValues()['endpoint'];
}