You are here

public function Vcl::check_if_vcl_exists in Fastly 7.2

Checks if VCL exists.

@name string

Return value

bool

1 call to Vcl::check_if_vcl_exists()
Vcl::prepare_vcl in ./fastly.vcl.inc
Prepares VCL request.

File

./fastly.vcl.inc, line 292

Class

Vcl
Class to control the VCL handling.

Code

public function check_if_vcl_exists($name) {
  if (empty($this->_last_version_data)) {
    return FALSE;
  }
  $uri = $this->_version_base_url . "/" . $this->_last_cloned_version . '/snippet/' . $name;
  $response = $this->_api
    ->makeRequest($uri, array(), "GET", $this->_headers_get);
  if ($response->code != 404) {
    return TRUE;
  }
  return FALSE;
}