Skip to content

Latest commit

 

History

History
930 lines (607 loc) · 27.8 KB

VclAPI.md

File metadata and controls

930 lines (607 loc) · 27.8 KB

VclAPI

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

Create a custom VCL file

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.
    content := "content_example" // string | The VCL code to be included. (optional)
    main := true // bool | Set to `true` when this is the main VCL, otherwise `false`. (optional)
    name := "name_example" // string | The name of this VCL. (optional)

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VclAPI.CreateCustomVcl(ctx, serviceID, versionID).Content(content).Main(main).Name(name).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VclAPI.CreateCustomVcl`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `CreateCustomVcl`: VclResponse
    fmt.Fprintf(os.Stdout, "Response from `VclAPI.CreateCustomVcl`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.

Other Parameters

Other parameters are passed through a pointer to a apiCreateCustomVclRequest struct via the builder pattern

Name Type Description Notes
content string The VCL code to be included. main

Return type

VclResponse

Authorization

API Token

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: application/json

Back to top | Back to API list | Back to README

DeleteCustomVcl

Delete a custom VCL file

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.
    vclName := "vclName_example" // string | The name of this VCL.

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VclAPI.DeleteCustomVcl(ctx, serviceID, versionID, vclName).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VclAPI.DeleteCustomVcl`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `DeleteCustomVcl`: InlineResponse200
    fmt.Fprintf(os.Stdout, "Response from `VclAPI.DeleteCustomVcl`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.
vclName string The name of this VCL.

Other Parameters

Other parameters are passed through a pointer to a apiDeleteCustomVclRequest struct via the builder pattern

Name Type Description Notes

Return type

InlineResponse200

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

GetCustomVcl

Get a custom VCL file

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.
    vclName := "vclName_example" // string | The name of this VCL.
    noContent := "noContent_example" // string | Omit VCL content. (optional) (default to "0")

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VclAPI.GetCustomVcl(ctx, serviceID, versionID, vclName).NoContent(noContent).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VclAPI.GetCustomVcl`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetCustomVcl`: VclResponse
    fmt.Fprintf(os.Stdout, "Response from `VclAPI.GetCustomVcl`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.
vclName string The name of this VCL.

Other Parameters

Other parameters are passed through a pointer to a apiGetCustomVclRequest struct via the builder pattern

Name Type Description Notes
noContent string Omit VCL content. [default to "0"]

Return type

VclResponse

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

GetCustomVclBoilerplate

Get boilerplate VCL

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VclAPI.GetCustomVclBoilerplate(ctx, serviceID, versionID).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VclAPI.GetCustomVclBoilerplate`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetCustomVclBoilerplate`: string
    fmt.Fprintf(os.Stdout, "Response from `VclAPI.GetCustomVclBoilerplate`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.

Other Parameters

Other parameters are passed through a pointer to a apiGetCustomVclBoilerplateRequest struct via the builder pattern

Name Type Description Notes

Return type

string

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: text/plain

Back to top | Back to API list | Back to README

GetCustomVclGenerated

Get the generated VCL for a service

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VclAPI.GetCustomVclGenerated(ctx, serviceID, versionID).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VclAPI.GetCustomVclGenerated`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetCustomVclGenerated`: VclResponse
    fmt.Fprintf(os.Stdout, "Response from `VclAPI.GetCustomVclGenerated`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.

Other Parameters

Other parameters are passed through a pointer to a apiGetCustomVclGeneratedRequest struct via the builder pattern

Name Type Description Notes

Return type

VclResponse

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

GetCustomVclGeneratedHighlighted

Get the generated VCL with syntax highlighting

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VclAPI.GetCustomVclGeneratedHighlighted(ctx, serviceID, versionID).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VclAPI.GetCustomVclGeneratedHighlighted`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetCustomVclGeneratedHighlighted`: VclSyntaxHighlightingResponse
    fmt.Fprintf(os.Stdout, "Response from `VclAPI.GetCustomVclGeneratedHighlighted`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.

Other Parameters

Other parameters are passed through a pointer to a apiGetCustomVclGeneratedHighlightedRequest struct via the builder pattern

Name Type Description Notes

Return type

VclSyntaxHighlightingResponse

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

GetCustomVclHighlighted

Get a custom VCL file with syntax highlighting

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.
    vclName := "vclName_example" // string | The name of this VCL.

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VclAPI.GetCustomVclHighlighted(ctx, serviceID, versionID, vclName).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VclAPI.GetCustomVclHighlighted`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetCustomVclHighlighted`: VclSyntaxHighlightingResponse
    fmt.Fprintf(os.Stdout, "Response from `VclAPI.GetCustomVclHighlighted`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.
vclName string The name of this VCL.

Other Parameters

Other parameters are passed through a pointer to a apiGetCustomVclHighlightedRequest struct via the builder pattern

Name Type Description Notes

Return type

VclSyntaxHighlightingResponse

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

GetCustomVclRaw

Download a custom VCL file

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.
    vclName := "vclName_example" // string | The name of this VCL.

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VclAPI.GetCustomVclRaw(ctx, serviceID, versionID, vclName).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VclAPI.GetCustomVclRaw`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetCustomVclRaw`: string
    fmt.Fprintf(os.Stdout, "Response from `VclAPI.GetCustomVclRaw`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.
vclName string The name of this VCL.

Other Parameters

Other parameters are passed through a pointer to a apiGetCustomVclRawRequest struct via the builder pattern

Name Type Description Notes

Return type

string

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: text/plain

Back to top | Back to API list | Back to README

LintVclDefault

Lint (validate) VCL using a default set of flags.

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    inlineObject1 := *openapiclient.NewInlineObject1("Vcl_example") // InlineObject1 | 

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VclAPI.LintVclDefault(ctx).InlineObject1(inlineObject1).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VclAPI.LintVclDefault`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `LintVclDefault`: ValidatorResult
    fmt.Fprintf(os.Stdout, "Response from `VclAPI.LintVclDefault`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiLintVclDefaultRequest struct via the builder pattern

Name Type Description Notes
inlineObject1 InlineObject1

Return type

ValidatorResult

Authorization

API Token

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

Back to top | Back to API list | Back to README

LintVclForService

Lint (validate) VCL using flags set for the service.

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    inlineObject := *openapiclient.NewInlineObject("Vcl_example") // InlineObject | 

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VclAPI.LintVclForService(ctx, serviceID).InlineObject(inlineObject).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VclAPI.LintVclForService`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `LintVclForService`: ValidatorResult
    fmt.Fprintf(os.Stdout, "Response from `VclAPI.LintVclForService`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.

Other Parameters

Other parameters are passed through a pointer to a apiLintVclForServiceRequest struct via the builder pattern

Name Type Description Notes
inlineObject InlineObject

Return type

ValidatorResult

Authorization

API Token

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

Back to top | Back to API list | Back to README

ListCustomVcl

List custom VCL files

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VclAPI.ListCustomVcl(ctx, serviceID, versionID).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VclAPI.ListCustomVcl`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `ListCustomVcl`: []VclResponse
    fmt.Fprintf(os.Stdout, "Response from `VclAPI.ListCustomVcl`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.

Other Parameters

Other parameters are passed through a pointer to a apiListCustomVclRequest struct via the builder pattern

Name Type Description Notes

Return type

[]VclResponse

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

SetCustomVclMain

Set a custom VCL file as main

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.
    vclName := "vclName_example" // string | The name of this VCL.

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VclAPI.SetCustomVclMain(ctx, serviceID, versionID, vclName).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VclAPI.SetCustomVclMain`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `SetCustomVclMain`: VclResponse
    fmt.Fprintf(os.Stdout, "Response from `VclAPI.SetCustomVclMain`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.
vclName string The name of this VCL.

Other Parameters

Other parameters are passed through a pointer to a apiSetCustomVclMainRequest struct via the builder pattern

Name Type Description Notes

Return type

VclResponse

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

UpdateCustomVcl

Update a custom VCL file

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.
    vclName := "vclName_example" // string | The name of this VCL.
    content := "content_example" // string | The VCL code to be included. (optional)
    main := true // bool | Set to `true` when this is the main VCL, otherwise `false`. (optional)
    name := "name_example" // string | The name of this VCL. (optional)

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VclAPI.UpdateCustomVcl(ctx, serviceID, versionID, vclName).Content(content).Main(main).Name(name).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VclAPI.UpdateCustomVcl`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `UpdateCustomVcl`: VclResponse
    fmt.Fprintf(os.Stdout, "Response from `VclAPI.UpdateCustomVcl`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.
vclName string The name of this VCL.

Other Parameters

Other parameters are passed through a pointer to a apiUpdateCustomVclRequest struct via the builder pattern

Name Type Description Notes
content string The VCL code to be included. main

Return type

VclResponse

Authorization

API Token

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: application/json

Back to top | Back to API list | Back to README