You are here

public function EdgeKeyTypeBase::getInstanceType in Apigee Edge 8

Gets the instance type (public, private or hybrid).

Parameters

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

Return value

string The instance type, either `public`, `private` or `hybrid`.

Overrides EdgeKeyTypeInterface::getInstanceType

4 calls to EdgeKeyTypeBase::getInstanceType()
ApigeeAuthKeyType::getAuthenticationMethod in src/Plugin/KeyType/ApigeeAuthKeyType.php
Gets the authentication method object.
EdgeKeyTypeBase::getAuthenticationType in src/Plugin/EdgeKeyTypeBase.php
Gets the authentication type.
EdgeKeyTypeBase::getEndpoint in src/Plugin/EdgeKeyTypeBase.php
Gets the API endpoint.
EdgeKeyTypeBase::getEndpointType in src/Plugin/EdgeKeyTypeBase.php
Gets the API endpoint type (default or custom).

File

src/Plugin/EdgeKeyTypeBase.php, line 96

Class

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

Namespace

Drupal\apigee_edge\Plugin

Code

public function getInstanceType(KeyInterface $key) : string {
  $key_values = $key
    ->getKeyValues();
  if (isset($key_values['instance_type'])) {
    return $key_values['instance_type'];
  }

  // Backwards compatibility, before Hybrid support.
  if (empty($key_values['endpoint']) || $key_values['endpoint'] === ClientInterface::EDGE_ENDPOINT) {
    return EdgeKeyTypeInterface::INSTANCE_TYPE_PUBLIC;
  }
  return EdgeKeyTypeInterface::INSTANCE_TYPE_PRIVATE;
}