You are here

public function VclHandler::insertCondition in Fastly 8.3

Prepare condition for insert.

@data

Return value

array Response data or empty array.

2 calls to VclHandler::insertCondition()
VclHandler::prepareCondition in src/VclHandler.php
Prepares condition for insertion.
VclHandler::uploadMaintenancePage in src/VclHandler.php
Upload maintenance page.

File

src/VclHandler.php, line 870

Class

VclHandler
Class to control the VCL handling.

Namespace

Drupal\fastly

Code

public function insertCondition($data) {
  $url = $this->versionBaseUrl . '/' . $this->lastClonedVersion . '/condition';
  $request = [
    'url' => $url,
    'data' => $data,
    'type' => 'POST',
  ];
  $response = $this
    ->vclRequestWrapper($request['url'], $this->headersPost, $request['data'], $request['type']);
  $responseData = json_decode($response
    ->getBody());
  if ($responseData) {
    return $responseData;
  }
  else {
    return [];
  }
}