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. |
Get details of the service's Compute package.
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)
}
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 are passed through a pointer to a apiGetPackageRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
- Content-Type: Not defined
- Accept: application/json
Back to top | Back to API list | Back to README
Upload a Compute package.
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)
}
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 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 |
- Content-Type: multipart/form-data
- Accept: application/json