Skip to content

Latest commit

 

History

History
425 lines (274 loc) · 13.7 KB

File metadata and controls

425 lines (274 loc) · 13.7 KB

DdosProtectionAPI

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

DdosProtectionEventGet

Get event by ID

Example

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)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
eventId string Unique ID of the event.

Other Parameters

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

Name Type Description Notes

Return type

DdosProtectionEvent

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

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

DdosProtectionEventList

Get events

Example

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)
}

Path Parameters

Other Parameters

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

Return type

InlineResponse20012

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

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

DdosProtectionEventRuleList

Get all rules for an event

Example

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)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
eventId string Unique ID of the event.

Other Parameters

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

Return type

InlineResponse20013

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

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

DdosProtectionRuleGet

Get a rule by ID

Example

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)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
ruleId string Unique ID of the rule.

Other Parameters

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

Name Type Description Notes

Return type

DdosProtectionRule

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

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

DdosProtectionRulePatch

Update rule

Example

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)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
ruleId string Unique ID of the rule.

Other Parameters

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

Name Type Description Notes
ddosProtectionRulePatch DdosProtectionRulePatch

Return type

DdosProtectionRule

Authorization

API Token

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, application/problem+json

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

DdosProtectionTrafficStatsRuleGet

Get traffic stats for a rule

Example

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)
}

Path Parameters

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

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

Name Type Description Notes

Return type

DdosProtectionTrafficStats

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

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