Note
All URIs are relative to https://api.fastly.com
| Method | HTTP request | Description |
|---|---|---|
| CreateService | POST /service |
Create a service |
| DeleteService | DELETE /service/{service_id} |
Delete a service |
| GetService | GET /service/{service_id} |
Get a service |
| GetServiceDetail | GET /service/{service_id}/details |
Get service details |
| ListServiceDomains | GET /service/{service_id}/domain |
List the domains within a service |
| ListServices | GET /service |
List services |
| SearchService | GET /service/search |
Search for a service by name |
| UpdateService | PUT /service/{service_id} |
Update a service |
Create a service
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
comment := "comment_example" // string | A freeform descriptive note. (optional)
name := "name_example" // string | The name of the service. (optional)
customerId := "customerId_example" // string | Alphanumeric string identifying the customer. (optional)
type_ := "type__example" // string | The type of this service. (optional)
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.ServiceAPI.CreateService(ctx).Comment(comment).Name(name).CustomerId(customerId).Type_(type_).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServiceAPI.CreateService`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `CreateService`: ServiceResponse
fmt.Fprintf(os.Stdout, "Response from `ServiceAPI.CreateService`: %v\n", resp)
}Other parameters are passed through a pointer to a apiCreateServiceRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| comment | string | A freeform descriptive note. | name |
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json
Back to top | Back to API list | Back to README
Delete a service
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
serviceId := "serviceId_example" // string | Alphanumeric string identifying the service.
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.ServiceAPI.DeleteService(ctx, serviceId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServiceAPI.DeleteService`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `DeleteService`: InlineResponse200
fmt.Fprintf(os.Stdout, "Response from `ServiceAPI.DeleteService`: %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. |
Other parameters are passed through a pointer to a apiDeleteServiceRequest 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
Get a service
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
serviceId := "serviceId_example" // string | Alphanumeric string identifying the service.
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.ServiceAPI.GetService(ctx, serviceId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServiceAPI.GetService`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetService`: ServiceResponse
fmt.Fprintf(os.Stdout, "Response from `ServiceAPI.GetService`: %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. |
Other parameters are passed through a pointer to a apiGetServiceRequest 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
Get service details
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
serviceId := "serviceId_example" // string | Alphanumeric string identifying the service.
version := int32(56) // int32 | Number identifying a version of the service. (optional)
filterVersionsActive := true // bool | Limits the versions array to the active versions. Accepts `true` or `false` (defaults to false). (optional)
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.ServiceAPI.GetServiceDetail(ctx, serviceId).Version(version).FilterVersionsActive(filterVersionsActive).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServiceAPI.GetServiceDetail`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetServiceDetail`: ServiceDetail
fmt.Fprintf(os.Stdout, "Response from `ServiceAPI.GetServiceDetail`: %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. |
Other parameters are passed through a pointer to a apiGetServiceDetailRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| version | int32 | Number identifying a version of the service. | filterVersionsActive |
- Content-Type: Not defined
- Accept: application/json
Back to top | Back to API list | Back to README
List the domains within a service
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
serviceId := "serviceId_example" // string | Alphanumeric string identifying the service.
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.ServiceAPI.ListServiceDomains(ctx, serviceId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServiceAPI.ListServiceDomains`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `ListServiceDomains`: []DomainResponse
fmt.Fprintf(os.Stdout, "Response from `ServiceAPI.ListServiceDomains`: %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. |
Other parameters are passed through a pointer to a apiListServiceDomainsRequest 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
List services
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
page := int32(1) // int32 | Current page. (optional)
perPage := int32(20) // int32 | Number of records per page. (optional) (default to 20)
sort := "created" // string | Field on which to sort. (optional) (default to "created")
direction := "ascend" // string | Direction in which to sort results. (optional) (default to "ascend")
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.ServiceAPI.ListServices(ctx).Page(page).PerPage(perPage).Sort(sort).Direction(direction).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServiceAPI.ListServices`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `ListServices`: []ServiceListResponse
fmt.Fprintf(os.Stdout, "Response from `ServiceAPI.ListServices`: %v\n", resp)
}Other parameters are passed through a pointer to a apiListServicesRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| page | int32 | Current page. | perPage |
- Content-Type: Not defined
- Accept: application/json
Back to top | Back to API list | Back to README
Search for a service by name
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
name := "name_example" // string | The name of the service.
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.ServiceAPI.SearchService(ctx).Name(name).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServiceAPI.SearchService`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `SearchService`: ServiceResponse
fmt.Fprintf(os.Stdout, "Response from `ServiceAPI.SearchService`: %v\n", resp)
}Other parameters are passed through a pointer to a apiSearchServiceRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| name | string | The name of the service. |
- Content-Type: Not defined
- Accept: application/json
Back to top | Back to API list | Back to README
Update a service
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
serviceId := "serviceId_example" // string | Alphanumeric string identifying the service.
comment := "comment_example" // string | A freeform descriptive note. (optional)
name := "name_example" // string | The name of the service. (optional)
customerId := "customerId_example" // string | Alphanumeric string identifying the customer. (optional)
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.ServiceAPI.UpdateService(ctx, serviceId).Comment(comment).Name(name).CustomerId(customerId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServiceAPI.UpdateService`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `UpdateService`: ServiceResponse
fmt.Fprintf(os.Stdout, "Response from `ServiceAPI.UpdateService`: %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. |
Other parameters are passed through a pointer to a apiUpdateServiceRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| comment | string | A freeform descriptive note. | name |
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json