Skip to content

Latest commit

 

History

History
150 lines (98 loc) · 4.82 KB

PackageAPI.md

File metadata and controls

150 lines (98 loc) · 4.82 KB

PackageAPI

Note

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

Method HTTP request Description
GetPackage GET /service/{service_id}/version/{version_id}/package Get details of the service's Compute package.
PutPackage PUT /service/{service_id}/version/{version_id}/package Upload a Compute package.

GetPackage

Get details of the service's Compute package.

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.PackageAPI.GetPackage(ctx, serviceID, versionID).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `PackageAPI.GetPackage`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetPackage`: PackageResponse
    fmt.Fprintf(os.Stdout, "Response from `PackageAPI.GetPackage`: %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 apiGetPackageRequest struct via the builder pattern

Name Type Description Notes

Return type

PackageResponse

Authorization

API Token

HTTP request headers

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

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

PutPackage

Upload a Compute package.

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.
    expect := "100-continue" // string | We recommend using the Expect header because it may identify issues with the request based upon the headers alone instead of requiring you to wait until the entire binary package upload has completed. (optional)
    computePackage := os.NewFile(1234, "some_file") // *os.File | The content of the Wasm binary package. (optional)

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.PackageAPI.PutPackage(ctx, serviceID, versionID).Expect(expect).ComputePackage(computePackage).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `PackageAPI.PutPackage`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `PutPackage`: PackageResponse
    fmt.Fprintf(os.Stdout, "Response from `PackageAPI.PutPackage`: %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 apiPutPackageRequest struct via the builder pattern

Name Type Description Notes
expect string We recommend using the Expect header because it may identify issues with the request based upon the headers alone instead of requiring you to wait until the entire binary package upload has completed. computePackage

Return type

PackageResponse

Authorization

API Token

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

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