Note
All URIs are relative to https://api.fastly.com
| Method | HTTP request | Description |
|---|---|---|
| DdosProtectionEventGet | GET /ddos-protection/v1/events/{event_id} |
Get event by ID |
| DdosProtectionEventList | GET /ddos-protection/v1/events |
Get events |
| DdosProtectionEventRuleList | GET /ddos-protection/v1/events/{event_id}/rules |
Get all rules for an event |
| DdosProtectionRuleGet | GET /ddos-protection/v1/rules/{rule_id} |
Get a rule by ID |
| DdosProtectionRulePatch | PATCH /ddos-protection/v1/rules/{rule_id} |
Update rule |
| DdosProtectionTrafficStatsRuleGet | GET /ddos-protection/v1/events/{event_id}/rules/{rule_id}/traffic-stats |
Get traffic stats for a rule |
Get event by ID
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
eventId := "eventId_example" // string | Unique ID of the event.
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.DdosProtectionAPI.DdosProtectionEventGet(ctx, eventId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DdosProtectionAPI.DdosProtectionEventGet`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `DdosProtectionEventGet`: DdosProtectionEvent
fmt.Fprintf(os.Stdout, "Response from `DdosProtectionAPI.DdosProtectionEventGet`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| eventId | string | Unique ID of the event. |
Other parameters are passed through a pointer to a apiDdosProtectionEventGetRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
- Content-Type: Not defined
- Accept: application/json, application/problem+json
Back to top | Back to API list | Back to README
Get events
package main
import (
"context"
"fmt"
"os"
"time"
"github.com/fastly/fastly-go/fastly"
)
func main() {
cursor := "cursor_example" // string | Cursor value from the `next_cursor` field of a previous response, used to retrieve the next page. To request the first page, this should be empty. (optional)
limit := int32(56) // int32 | Limit how many results are returned. (optional) (default to 20)
serviceId := "serviceId_example" // string | Filter results based on a service_id. (optional)
from := time.Now() // time.Time | Represents the start of a date-time range expressed in RFC 3339 format. (optional)
to := time.Now() // time.Time | Represents the end of a date-time range expressed in RFC 3339 format. (optional)
name := "name_example" // string | (optional)
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.DdosProtectionAPI.DdosProtectionEventList(ctx).Cursor(cursor).Limit(limit).ServiceId(serviceId).From(from).To(to).Name(name).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DdosProtectionAPI.DdosProtectionEventList`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `DdosProtectionEventList`: InlineResponse20012
fmt.Fprintf(os.Stdout, "Response from `DdosProtectionAPI.DdosProtectionEventList`: %v\n", resp)
}Other parameters are passed through a pointer to a apiDdosProtectionEventListRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| cursor | string | Cursor value from the next_cursor field of a previous response, used to retrieve the next page. To request the first page, this should be empty. |
limit |
- Content-Type: Not defined
- Accept: application/json, application/problem+json
Back to top | Back to API list | Back to README
Get all rules for an event
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
eventId := "eventId_example" // string | Unique ID of the event.
cursor := "cursor_example" // string | Cursor value from the `next_cursor` field of a previous response, used to retrieve the next page. To request the first page, this should be empty. (optional)
limit := int32(56) // int32 | Limit how many results are returned. (optional) (default to 20)
include := "include_example" // string | Include relationships. Optional. Comma-separated values. (optional)
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.DdosProtectionAPI.DdosProtectionEventRuleList(ctx, eventId).Cursor(cursor).Limit(limit).Include(include).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DdosProtectionAPI.DdosProtectionEventRuleList`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `DdosProtectionEventRuleList`: InlineResponse20013
fmt.Fprintf(os.Stdout, "Response from `DdosProtectionAPI.DdosProtectionEventRuleList`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| eventId | string | Unique ID of the event. |
Other parameters are passed through a pointer to a apiDdosProtectionEventRuleListRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| cursor | string | Cursor value from the next_cursor field of a previous response, used to retrieve the next page. To request the first page, this should be empty. |
limit |
- Content-Type: Not defined
- Accept: application/json, application/problem+json
Back to top | Back to API list | Back to README
Get a rule by ID
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
ruleId := "ruleId_example" // string | Unique ID of the rule.
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.DdosProtectionAPI.DdosProtectionRuleGet(ctx, ruleId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DdosProtectionAPI.DdosProtectionRuleGet`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `DdosProtectionRuleGet`: DdosProtectionRule
fmt.Fprintf(os.Stdout, "Response from `DdosProtectionAPI.DdosProtectionRuleGet`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| ruleId | string | Unique ID of the rule. |
Other parameters are passed through a pointer to a apiDdosProtectionRuleGetRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
- Content-Type: Not defined
- Accept: application/json, application/problem+json
Back to top | Back to API list | Back to README
Update rule
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
ruleId := "ruleId_example" // string | Unique ID of the rule.
ddosProtectionRulePatch := *openapiclient.NewDdosProtectionRulePatch() // DdosProtectionRulePatch | (optional)
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.DdosProtectionAPI.DdosProtectionRulePatch(ctx, ruleId).DdosProtectionRulePatch(ddosProtectionRulePatch).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DdosProtectionAPI.DdosProtectionRulePatch`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `DdosProtectionRulePatch`: DdosProtectionRule
fmt.Fprintf(os.Stdout, "Response from `DdosProtectionAPI.DdosProtectionRulePatch`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| ruleId | string | Unique ID of the rule. |
Other parameters are passed through a pointer to a apiDdosProtectionRulePatchRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| ddosProtectionRulePatch | DdosProtectionRulePatch |
- Content-Type: application/json
- Accept: application/json, application/problem+json
Back to top | Back to API list | Back to README
Get traffic stats for a rule
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
eventId := "eventId_example" // string | Unique ID of the event.
ruleId := "ruleId_example" // string | Unique ID of the rule.
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.DdosProtectionAPI.DdosProtectionTrafficStatsRuleGet(ctx, eventId, ruleId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DdosProtectionAPI.DdosProtectionTrafficStatsRuleGet`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `DdosProtectionTrafficStatsRuleGet`: DdosProtectionTrafficStats
fmt.Fprintf(os.Stdout, "Response from `DdosProtectionAPI.DdosProtectionTrafficStatsRuleGet`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| eventId | string | Unique ID of the event. | |
| ruleId | string | Unique ID of the rule. |
Other parameters are passed through a pointer to a apiDdosProtectionTrafficStatsRuleGetRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
- Content-Type: Not defined
- Accept: application/json, application/problem+json