Skip to content

Latest commit

 

History

History
534 lines (386 loc) · 13.8 KB

VclApi.md

File metadata and controls

534 lines (386 loc) · 13.8 KB

Fastly.VclApi

const apiInstance = new Fastly.VclApi();

Methods

Note

All URIs are relative to https://api.fastly.com

Method HTTP request Description
createCustomVcl POST /service/{service_id}/version/{version_id}/vcl Create a custom VCL file
deleteCustomVcl DELETE /service/{service_id}/version/{version_id}/vcl/{vcl_name} Delete a custom VCL file
getCustomVcl GET /service/{service_id}/version/{version_id}/vcl/{vcl_name} Get a custom VCL file
getCustomVclBoilerplate GET /service/{service_id}/version/{version_id}/boilerplate Get boilerplate VCL
getCustomVclGenerated GET /service/{service_id}/version/{version_id}/generated_vcl Get the generated VCL for a service
getCustomVclGeneratedHighlighted GET /service/{service_id}/version/{version_id}/generated_vcl/content Get the generated VCL with syntax highlighting
getCustomVclHighlighted GET /service/{service_id}/version/{version_id}/vcl/{vcl_name}/content Get a custom VCL file with syntax highlighting
getCustomVclRaw GET /service/{service_id}/version/{version_id}/vcl/{vcl_name}/download Download a custom VCL file
lintVclDefault POST /vcl_lint Lint (validate) VCL using a default set of flags.
lintVclForService POST /service/{service_id}/lint Lint (validate) VCL using flags set for the service.
listCustomVcl GET /service/{service_id}/version/{version_id}/vcl List custom VCL files
setCustomVclMain PUT /service/{service_id}/version/{version_id}/vcl/{vcl_name}/main Set a custom VCL file as main
updateCustomVcl PUT /service/{service_id}/version/{version_id}/vcl/{vcl_name} Update a custom VCL file

createCustomVcl

createCustomVcl({ service_id, version_id, [content, ][main, ][name] })

Upload a VCL for a particular service and version.

Example

const options = {
  service_id: "service_id_example", // required
  version_id: 56, // required
  content: "content_example",
  main: true,
  name: "name_example",
};

apiInstance.createCustomVcl(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
version_id Number Integer identifying a service version.
content String The VCL code to be included. [optional]
main Boolean Set to true when this is the main VCL, otherwise false. [optional]
name String The name of this VCL. [optional]

Return type

VclResponse

deleteCustomVcl

deleteCustomVcl({ service_id, version_id, vcl_name })

Delete the uploaded VCL for a particular service and version.

Example

const options = {
  service_id: "service_id_example", // required
  version_id: 56, // required
  vcl_name: "vcl_name_example", // required
};

apiInstance.deleteCustomVcl(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
version_id Number Integer identifying a service version.
vcl_name String The name of this VCL.

Return type

InlineResponse200

getCustomVcl

getCustomVcl({ service_id, version_id, vcl_name, [no_content] })

Get the uploaded VCL for a particular service and version.

Example

const options = {
  service_id: "service_id_example", // required
  version_id: 56, // required
  vcl_name: "vcl_name_example", // required
  no_content: "'0'",
};

apiInstance.getCustomVcl(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
version_id Number Integer identifying a service version.
vcl_name String The name of this VCL.
no_content String Omit VCL content. [optional] [defaults to '0']

Return type

VclResponse

getCustomVclBoilerplate

getCustomVclBoilerplate({ service_id, version_id })

Return boilerplate VCL with the service's TTL from the settings.

Example

const options = {
  service_id: "service_id_example", // required
  version_id: 56, // required
};

apiInstance.getCustomVclBoilerplate(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
version_id Number Integer identifying a service version.

Return type

String

getCustomVclGenerated

getCustomVclGenerated({ service_id, version_id })

Display the generated VCL for a particular service and version.

Example

const options = {
  service_id: "service_id_example", // required
  version_id: 56, // required
};

apiInstance.getCustomVclGenerated(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
version_id Number Integer identifying a service version.

Return type

VclResponse

getCustomVclGeneratedHighlighted

getCustomVclGeneratedHighlighted({ service_id, version_id })

Display the content of generated VCL with HTML syntax highlighting. Include line numbers by sending lineno=true as a request parameter.

Example

const options = {
  service_id: "service_id_example", // required
  version_id: 56, // required
};

apiInstance.getCustomVclGeneratedHighlighted(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
version_id Number Integer identifying a service version.

Return type

VclSyntaxHighlightingResponse

getCustomVclHighlighted

getCustomVclHighlighted({ service_id, version_id, vcl_name })

Get the uploaded VCL for a particular service and version with HTML syntax highlighting. Include line numbers by sending lineno=true as a request parameter.

Example

const options = {
  service_id: "service_id_example", // required
  version_id: 56, // required
  vcl_name: "vcl_name_example", // required
};

apiInstance.getCustomVclHighlighted(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
version_id Number Integer identifying a service version.
vcl_name String The name of this VCL.

Return type

VclSyntaxHighlightingResponse

getCustomVclRaw

getCustomVclRaw({ service_id, version_id, vcl_name })

Download the specified VCL.

Example

const options = {
  service_id: "service_id_example", // required
  version_id: 56, // required
  vcl_name: "vcl_name_example", // required
};

apiInstance.getCustomVclRaw(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
version_id Number Integer identifying a service version.
vcl_name String The name of this VCL.

Return type

String

lintVclDefault

lintVclDefault({ inline_object1 })

This endpoint validates the submitted VCL against a default set of enabled flags. Consider using the /service/{service_id}/lint operation to validate VCL in the context of a specific service.

Example

const options = {
  inline_object1: new Fastly.InlineObject1(), // required
};

apiInstance.lintVclDefault(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
inline_object1 InlineObject1

Return type

ValidatorResult

lintVclForService

lintVclForService({ service_id, inline_object })

Services may have flags set by a Fastly employee or by the purchase of products as addons to the service, which modify the way VCL is interpreted by that service. This endpoint validates the submitted VCL in the context of the specified service.

Example

const options = {
  service_id: "service_id_example", // required
  inline_object: new Fastly.InlineObject(), // required
};

apiInstance.lintVclForService(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
inline_object InlineObject

Return type

ValidatorResult

listCustomVcl

listCustomVcl({ service_id, version_id })

List the uploaded VCLs for a particular service and version.

Example

const options = {
  service_id: "service_id_example", // required
  version_id: 56, // required
};

apiInstance.listCustomVcl(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
version_id Number Integer identifying a service version.

Return type

[VclResponse]

setCustomVclMain

setCustomVclMain({ service_id, version_id, vcl_name })

Set the specified VCL as the main.

Example

const options = {
  service_id: "service_id_example", // required
  version_id: 56, // required
  vcl_name: "vcl_name_example", // required
};

apiInstance.setCustomVclMain(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
version_id Number Integer identifying a service version.
vcl_name String The name of this VCL.

Return type

VclResponse

updateCustomVcl

updateCustomVcl({ service_id, version_id, vcl_name, [content, ][main, ][name] })

Update the uploaded VCL for a particular service and version.

Example

const options = {
  service_id: "service_id_example", // required
  version_id: 56, // required
  vcl_name: "vcl_name_example", // required
  content: "content_example",
  main: true,
  name: "name_example",
};

apiInstance.updateCustomVcl(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
version_id Number Integer identifying a service version.
vcl_name String The name of this VCL.
content String The VCL code to be included. [optional]
main Boolean Set to true when this is the main VCL, otherwise false. [optional]
name String The name of this VCL. [optional]

Return type

VclResponse

[Back to top] [Back to API list] [Back to README]