You are here

public function AkamaiClientV3::createPurgeBody in Akamai 8.3

Create an array to pass to Akamai's purge function.

Parameters

string[] $objects: A list of URLs.

Return value

array An array suitable for sending to the Akamai purge endpoint.

Overrides AkamaiClientBase::createPurgeBody

1 call to AkamaiClientV3::createPurgeBody()
AkamaiClientV3::purgeRequest in src/Plugin/Client/AkamaiClientV3.php
Ask the API to purge an object.

File

src/Plugin/Client/AkamaiClientV3.php, line 96

Class

AkamaiClientV3
Defines the CCUv3 client version for Akamai.

Namespace

Drupal\akamai\Plugin\Client

Code

public function createPurgeBody(array $objects) {
  $body = [
    'objects' => $objects,
  ];
  if ($this->type == 'url') {
    $purge_urls_with_hostname = $this->configFactory
      ->get('akamai.settings')
      ->get('purge_urls_with_hostname');
    if ($purge_urls_with_hostname) {
      $body['hostname'] = $this->baseUrl;
    }
  }
  return (object) $body;
}