You are here

public function Fastly::updateSettings in Fastly 7.2

Same name and namespace in other branches
  1. 7 fastly.api.inc \Fastly::updateSettings()

Updates the settings for a version.

Parameters

array $data: An array of settings to update.

File

./fastly.api.inc, line 118
Contains Faslt class that handles API calls to the Fastly service.

Class

Fastly
Fastly API for Drupal.

Code

public function updateSettings($data) {
  if ($this->service_id) {
    $active_version = $this
      ->getActiveVersion();
    $new_version = json_decode($this
      ->query('service/' . $this->service_id . '/version/' . $active_version . '/clone', array(), 'PUT')->data);
    $headers['Content-Type'] = 'application/x-www-form-urlencoded';
    $this
      ->query('service/' . $this->service_id . '/version/' . $new_version->number . '/settings', $data, 'PUT', $headers);
    $this
      ->query('service/' . $this->service_id . '/version/' . $new_version->number . '/activate', array(), 'PUT');
  }
}