Create multiple prefixes.
client.DDoSProtection.AdvancedTCPProtection.Prefixes.BulkNew(ctx, params) (*SinglePage[AdvancedTCPProtectionPrefixBulkNewResponse], error)
POST/accounts/{account_id}/magic/advanced_tcp_protection/configs/prefixes/bulk
Create multiple prefixes for an account.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
Example:
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Example:
Accepted Permissions (at least one required)
Create multiple prefixes.
package main
import (
"context"
"fmt"
"github.com/stainless-sdks/cloudflare-go"
"github.com/stainless-sdks/cloudflare-go/ddos_protection"
"github.com/stainless-sdks/cloudflare-go/option"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
page, err := client.DDoSProtection.AdvancedTCPProtection.Prefixes.BulkNew(context.TODO(), ddos_protection.AdvancedTCPProtectionPrefixBulkNewParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Body: []ddos_protection.AdvancedTCPProtectionPrefixBulkNewParamsBody{ddos_protection.AdvancedTCPProtectionPrefixBulkNewParamsBody{
Comment: cloudflare.F("comment"),
Excluded: cloudflare.F(true),
Prefix: cloudflare.F("192.0.2.0/24"),
}},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": [
{
"id": "id",
"comment": "comment",
"created_on": "2019-12-27T18:11:19.117Z",
"excluded": true,
"modified_on": "2019-12-27T18:11:19.117Z",
"prefix": "192.0.2.0/24"
}
],
"result_info": {
"count": 1,
"page": 1,
"per_page": 20,
"total_count": 2000,
"total_pages": 100
}
}Returns Examples
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": [
{
"id": "id",
"comment": "comment",
"created_on": "2019-12-27T18:11:19.117Z",
"excluded": true,
"modified_on": "2019-12-27T18:11:19.117Z",
"prefix": "192.0.2.0/24"
}
],
"result_info": {
"count": 1,
"page": 1,
"per_page": 20,
"total_count": 2000,
"total_pages": 100
}
}