client

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseURLPlatform = "https://api.bunny.net"
	BaseURLStream   = "https://video.bunnycdn.com"
	BaseURLStorage  = "https://storage.bunnycdn.com"
)

Base URL constants for bunny.net API servers.

Variables

This section is empty.

Functions

func AccessListActionName

func AccessListActionName(action int) string

AccessListActionName returns a human-readable name for an access list action.

func BillingRecordTypeName

func BillingRecordTypeName(t int) string

BillingRecordTypeName returns a human-readable name for a billing record type.

func CertificateKeyTypeName

func CertificateKeyTypeName(t int) string

CertificateKeyTypeName returns a human-readable name for the certificate key type.

func DnsRecordTypeFromName

func DnsRecordTypeFromName(name string) (int, error)

DnsRecordTypeFromName converts a record type name (case-insensitive) to its integer value.

func DnsRecordTypeName

func DnsRecordTypeName(t int) string

DnsRecordTypeName returns a human-readable name for a DNS record type.

func FormatBytes

func FormatBytes(b int64) string

FormatBytes formats bytes into a human-readable string.

func FormatError

func FormatError(err error) string

FormatError formats an error into a user-friendly message for stderr display.

func FormatPopList

func FormatPopList(pops []string) string

FormatPopList formats a PopList slice for display.

func FormatRoles

func FormatRoles(roles []string) string

FormatRoles formats a slice of role strings for display.

func LogAnonymizationTypeName

func LogAnonymizationTypeName(t int) string

LogAnonymizationTypeName returns a human-readable name for the log anonymization type.

func PullZoneTypeName

func PullZoneTypeName(t int) string

PullZoneTypeName returns a human-readable name for the pull zone type.

func RateLimitActionTypeName

func RateLimitActionTypeName(action int) string

RateLimitActionTypeName returns a human-readable name for a rate limit action type.

func ReleaseStatusName

func ReleaseStatusName(s int) string

ReleaseStatusName returns a human-readable name for a release status.

func ScriptTypeFromName

func ScriptTypeFromName(name string) (int, error)

ScriptTypeFromName converts a script type name (case-insensitive) to its integer value.

func ScriptTypeName

func ScriptTypeName(t int) string

ScriptTypeName returns a human-readable name for a script type.

func ShieldExecutionModeName

func ShieldExecutionModeName(mode int) string

ShieldExecutionModeName returns a human-readable name for an execution mode.

func ShieldPlanName

func ShieldPlanName(planType int) string

ShieldPlanName returns a human-readable name for a Shield plan type.

func StorageZoneTierName

func StorageZoneTierName(tier int) string

StorageZoneTierName returns a human-readable name for the storage zone tier.

func VideoStatusName

func VideoStatusName(status int) string

VideoStatusName returns a human-readable name for a video status code.

func WafActionTypeName

func WafActionTypeName(action int) string

WafActionTypeName returns a human-readable name for a WAF action type.

Types

type APIError

type APIError struct {
	HTTPStatusCode int    `json:"-"`
	ErrorKey       string `json:"ErrorKey"`
	Field          string `json:"Field"`
	Message        string `json:"Message"`
}

APIError represents a bunny.net API error response.

func (*APIError) Error

func (e *APIError) Error() string

type AccessListConfigUpdate

type AccessListConfigUpdate struct {
	IsEnabled *bool `json:"isEnabled,omitempty"`
	Action    *int  `json:"action,omitempty"`
}

AccessListConfigUpdate holds the fields for updating an access list configuration.

type AccessListConfiguration

type AccessListConfiguration struct {
	Id               int64  `json:"id"`
	ShieldZoneId     int64  `json:"shieldZoneId"`
	UserId           string `json:"userId"`
	AccessListId     int64  `json:"accessListId"`
	UserAccessListId int64  `json:"userAccessListId"`
	IsEnabled        bool   `json:"isEnabled"`
	Action           int    `json:"action"`
}

AccessListConfiguration holds the configuration/binding for an access list on a shield zone.

type AccessListDetails

type AccessListDetails struct {
	ListId          int64  `json:"listId"`
	ConfigurationId int64  `json:"configurationId"`
	Name            string `json:"name"`
	Description     string `json:"description"`
	IsEnabled       bool   `json:"isEnabled"`
	Type            int    `json:"type"`
	Category        int    `json:"category"`
	Action          int    `json:"action"`
	RequiredPlan    int    `json:"requiredPlan"`
	EntryCount      int64  `json:"entryCount"`
	UpdateFrequency string `json:"updateFrequency"`
	LastUpdated     string `json:"lastUpdated"`
}

AccessListDetails holds details about a managed or custom access list.

type AccessListMetrics

type AccessListMetrics struct {
	TotalActions       int64 `json:"totalActions"`
	BlockedRequests    int64 `json:"blockedRequests"`
	LoggedRequests     int64 `json:"loggedRequests"`
	ChallengedRequests int64 `json:"challengedRequests"`
}

AccessListMetrics holds access list metrics.

type AccessListsResponse

type AccessListsResponse struct {
	ManagedLists     []AccessListDetails `json:"managedLists"`
	CustomLists      []AccessListDetails `json:"customLists"`
	CustomEntryCount int                 `json:"customEntryCount"`
	CustomEntryLimit int                 `json:"customEntryLimit"`
	CustomListCount  int                 `json:"customListCount"`
	CustomListLimit  int                 `json:"customListLimit"`
}

AccessListsResponse holds the combined managed and custom access lists.

type ApiKey

type ApiKey struct {
	Id    int64    `json:"Id"`
	Key   string   `json:"Key"`
	Roles []string `json:"Roles"`
}

ApiKey represents a bunny.net API key.

type AuditLogEntry

type AuditLogEntry struct {
	Timestamp     string `json:"Timestamp"`
	Product       string `json:"Product"`
	ResourceType  string `json:"ResourceType"`
	ResourceId    string `json:"ResourceId"`
	ResourceOwner string `json:"ResourceOwner"`
	Action        string `json:"Action"`
	ActorId       string `json:"ActorId"`
	ActorType     string `json:"ActorType"`
	Diff          string `json:"Diff"`
}

AuditLogEntry represents a single audit log entry.

type AuditLogOptions

type AuditLogOptions struct {
	Product           []string
	ResourceType      []string
	ResourceId        []string
	ActorId           []string
	Order             string
	ContinuationToken string
	Limit             int
}

AuditLogOptions configures the audit log query.

type AuditLogResponse

type AuditLogResponse struct {
	Logs              []*AuditLogEntry `json:"Logs"`
	HasMoreData       bool             `json:"HasMoreData"`
	ContinuationToken string           `json:"ContinuationToken"`
}

AuditLogResponse holds the response from the audit log endpoint.

type BillingDetails

type BillingDetails struct {
	Balance                           float64          `json:"Balance"`
	ThisMonthCharges                  float64          `json:"ThisMonthCharges"`
	LastRechargeBalance               float64          `json:"LastRechargeBalance"`
	BillingRecords                    []*BillingRecord `json:"BillingRecords"`
	MonthlyChargesEUTraffic           float64          `json:"MonthlyChargesEUTraffic"`
	MonthlyChargesUSTraffic           float64          `json:"MonthlyChargesUSTraffic"`
	MonthlyChargesASIATraffic         float64          `json:"MonthlyChargesASIATraffic"`
	MonthlyChargesAFTraffic           float64          `json:"MonthlyChargesAFTraffic"`
	MonthlyChargesSATraffic           float64          `json:"MonthlyChargesSATraffic"`
	MonthlyChargesStorage             float64          `json:"MonthlyChargesStorage"`
	MonthlyChargesDNS                 float64          `json:"MonthlyChargesDNS"`
	MonthlyChargesOptimizer           float64          `json:"MonthlyChargesOptimizer"`
	MonthlyChargesTranscribe          float64          `json:"MonthlyChargesTranscribe"`
	MonthlyChargesPremiumEncoding     float64          `json:"MonthlyChargesPremiumEncoding"`
	MonthlyChargesExtraPullZones      float64          `json:"MonthlyChargesExtraPullZones"`
	MonthlyChargesExtraStorageZones   float64          `json:"MonthlyChargesExtraStorageZones"`
	MonthlyChargesExtraDnsZones       float64          `json:"MonthlyChargesExtraDnsZones"`
	MonthlyChargesExtraVideoLibraries float64          `json:"MonthlyChargesExtraVideoLibraries"`
	MonthlyChargesScripting           float64          `json:"MonthlyChargesScripting"`
	MonthlyChargesScriptingRequests   float64          `json:"MonthlyChargesScriptingRequests"`
	MonthlyChargesScriptingCpu        float64          `json:"MonthlyChargesScriptingCpu"`
	MonthlyChargesDrm                 float64          `json:"MonthlyChargesDrm"`
	MonthlyChargesMagicContainers     float64          `json:"MonthlyChargesMagicContainers"`
	MonthlyChargesShield              float64          `json:"MonthlyChargesShield"`
	MonthlyChargesTaxes               float64          `json:"MonthlyChargesTaxes"`
	MonthlyChargesWebSockets          float64          `json:"MonthlyChargesWebSockets"`
	MonthlyChargesDB                  float64          `json:"MonthlyChargesDB"`
}

BillingDetails represents the full billing response from bunny.net.

type BillingRecord

type BillingRecord struct {
	Id                          int64   `json:"Id"`
	PaymentId                   string  `json:"PaymentId"`
	Amount                      float64 `json:"Amount"`
	Payer                       string  `json:"Payer"`
	Timestamp                   string  `json:"Timestamp"`
	Type                        int     `json:"Type"`
	InvoiceAvailable            bool    `json:"InvoiceAvailable"`
	DocumentDownloadUrl         string  `json:"DocumentDownloadUrl"`
	DetailedDocumentDownloadUrl string  `json:"DetailedDocumentDownloadUrl"`
}

BillingRecord represents a single billing record/transaction.

type BillingSummaryItem

type BillingSummaryItem struct {
	PullZoneId           int64   `json:"PullZoneId"`
	MonthlyUsage         float64 `json:"MonthlyUsage"`
	MonthlyBandwidthUsed int64   `json:"MonthlyBandwidthUsed"`
}

BillingSummaryItem represents per-pullzone billing usage.

type BotDetectionConfig

type BotDetectionConfig struct {
	ShieldZoneId       int64                         `json:"shieldZoneId"`
	ExecutionMode      int                           `json:"executionMode"`
	RequestIntegrity   BotDetectionSensitivityConfig `json:"requestIntegrity"`
	IpAddress          BotDetectionSensitivityConfig `json:"ipAddress"`
	BrowserFingerprint BrowserFingerprintConfig      `json:"browserFingerprint"`
}

BotDetectionConfig represents bot detection configuration state for a shield zone. Maps to BotDetectionConfigurationState in the API spec.

type BotDetectionMetrics

type BotDetectionMetrics struct {
	LoggedRequests     int64 `json:"loggedRequests"`
	ChallengedRequests int64 `json:"challengedRequests"`
}

BotDetectionMetrics holds bot detection metrics.

type BotDetectionSensitivityConfig

type BotDetectionSensitivityConfig struct {
	Sensitivity int `json:"sensitivity"`
}

BotDetectionSensitivityConfig holds a sensitivity level.

type BotDetectionUpdate

type BotDetectionUpdate struct {
	ShieldZoneId       int64                          `json:"shieldZoneId"`
	ExecutionMode      *int                           `json:"executionMode,omitempty"`
	RequestIntegrity   *BotDetectionSensitivityConfig `json:"requestIntegrity,omitempty"`
	IpAddress          *BotDetectionSensitivityConfig `json:"ipAddress,omitempty"`
	BrowserFingerprint *BrowserFingerprintConfig      `json:"browserFingerprint,omitempty"`
}

BotDetectionUpdate holds the fields for updating bot detection configuration.

type BrowserFingerprintConfig

type BrowserFingerprintConfig struct {
	Sensitivity    int  `json:"sensitivity"`
	Aggression     int  `json:"aggression"`
	ComplexEnabled bool `json:"complexEnabled"`
}

BrowserFingerprintConfig holds browser fingerprint configuration.

type Caption

type Caption struct {
	Srclang string `json:"srclang"`
	Label   string `json:"label"`
}

Caption represents a caption track on a video.

type CaptionAdd

type CaptionAdd struct {
	Srclang      string `json:"srclang"`
	Label        string `json:"label"`
	CaptionsFile string `json:"captionsFile"`
}

CaptionAdd holds the fields for adding a caption to a video.

type Chapter

type Chapter struct {
	Title string `json:"title"`
	Start int    `json:"start"`
	End   int    `json:"end"`
}

Chapter represents a chapter marker in a video.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a thin HTTP client for the bunny.net API.

func NewClient

func NewClient(cfg ClientConfig) (*Client, error)

NewClient creates a configured Client. API key precedence: --api-key flag > BUNNY_API_KEY env var > config file api_key.

func (*Client) AddCaption

func (c *Client) AddCaption(ctx context.Context, libraryId int64, videoId, srclang string, body *CaptionAdd) error

AddCaption adds a caption track to a video.

func (*Client) AddDnsRecord

func (c *Client) AddDnsRecord(ctx context.Context, zoneId int64, body *DnsRecordCreate) (*DnsRecord, error)

AddDnsRecord adds a DNS record to a zone. Note: bunny.net uses PUT for adding records.

func (*Client) AddEdgeScriptSecret

func (c *Client) AddEdgeScriptSecret(ctx context.Context, scriptId int64, body *EdgeScriptSecretCreate) (*EdgeScriptSecret, error)

AddEdgeScriptSecret adds a secret to an edge script.

func (*Client) AddEdgeScriptVariable

func (c *Client) AddEdgeScriptVariable(ctx context.Context, scriptId int64, body *EdgeScriptVariableCreate) (*EdgeScriptVariable, error)

AddEdgeScriptVariable adds a variable to an edge script.

func (*Client) AddOrUpdateEdgeRule

func (c *Client) AddOrUpdateEdgeRule(ctx context.Context, pullZoneId int64, rule *EdgeRule) error

AddOrUpdateEdgeRule creates or updates an edge rule on a pull zone.

func (*Client) AddPullZoneHostname

func (c *Client) AddPullZoneHostname(ctx context.Context, id int64, hostname string) error

AddPullZoneHostname adds a custom hostname to a pull zone.

func (*Client) CreateCollection

func (c *Client) CreateCollection(ctx context.Context, libraryId int64, body *CollectionCreate) (*Collection, error)

CreateCollection creates a new collection in a library.

func (*Client) CreateCustomAccessList

func (c *Client) CreateCustomAccessList(ctx context.Context, shieldZoneId int64, body *CustomAccessListCreate) (*CustomAccessList, error)

CreateCustomAccessList creates a new custom access list.

func (*Client) CreateCustomWafRule

func (c *Client) CreateCustomWafRule(ctx context.Context, body *CustomWafRuleCreate) (*CustomWafRule, error)

CreateCustomWafRule creates a new custom WAF rule.

func (*Client) CreateDnsZone

func (c *Client) CreateDnsZone(ctx context.Context, body *DnsZoneCreate) (*DnsZone, error)

CreateDnsZone creates a new DNS zone.

func (*Client) CreateEdgeScript

func (c *Client) CreateEdgeScript(ctx context.Context, body *EdgeScriptCreate) (*EdgeScript, error)

CreateEdgeScript creates a new edge script.

func (*Client) CreatePullZone

func (c *Client) CreatePullZone(ctx context.Context, body *PullZoneCreate) (*PullZone, error)

CreatePullZone creates a new pull zone.

func (*Client) CreateRateLimit

func (c *Client) CreateRateLimit(ctx context.Context, body *RateLimitRuleCreate) (*RateLimitRule, error)

CreateRateLimit creates a new rate limit rule.

func (*Client) CreateShieldZone

func (c *Client) CreateShieldZone(ctx context.Context, body *ShieldZoneCreate) (*ShieldZoneResponse, error)

CreateShieldZone creates a new shield zone.

func (*Client) CreateStorageZone

func (c *Client) CreateStorageZone(ctx context.Context, body *StorageZoneCreate) (*StorageZone, error)

CreateStorageZone creates a new storage zone.

func (*Client) CreateVideo

func (c *Client) CreateVideo(ctx context.Context, libraryId int64, body *VideoCreate) (*Video, error)

CreateVideo creates a new video record in a library.

func (*Client) CreateVideoLibrary

func (c *Client) CreateVideoLibrary(ctx context.Context, body *VideoLibraryCreate) (*VideoLibrary, error)

CreateVideoLibrary creates a new video library.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, path string) error

Delete is a convenience wrapper for Do with DELETE method.

func (*Client) DeleteCaption

func (c *Client) DeleteCaption(ctx context.Context, libraryId int64, videoId, srclang string) error

DeleteCaption removes a caption track from a video.

func (*Client) DeleteCollection

func (c *Client) DeleteCollection(ctx context.Context, libraryId int64, collectionId string) error

DeleteCollection deletes a collection.

func (*Client) DeleteCustomAccessList

func (c *Client) DeleteCustomAccessList(ctx context.Context, shieldZoneId, id int64) error

DeleteCustomAccessList deletes a custom access list.

func (*Client) DeleteCustomWafRule

func (c *Client) DeleteCustomWafRule(ctx context.Context, id int64) error

DeleteCustomWafRule deletes a custom WAF rule.

func (*Client) DeleteDnsRecord

func (c *Client) DeleteDnsRecord(ctx context.Context, zoneId, recordId int64) error

DeleteDnsRecord deletes a DNS record from a zone.

func (*Client) DeleteDnsZone

func (c *Client) DeleteDnsZone(ctx context.Context, id int64) error

DeleteDnsZone deletes a DNS zone by ID.

func (*Client) DeleteEdgeRule

func (c *Client) DeleteEdgeRule(ctx context.Context, pullZoneId int64, edgeRuleId string) error

DeleteEdgeRule deletes an edge rule from a pull zone.

func (*Client) DeleteEdgeScript

func (c *Client) DeleteEdgeScript(ctx context.Context, id int64, deleteLinkedPullZones bool) error

DeleteEdgeScript deletes an edge script by ID.

func (*Client) DeleteEdgeScriptSecret

func (c *Client) DeleteEdgeScriptSecret(ctx context.Context, scriptId, secretId int64) error

DeleteEdgeScriptSecret deletes a secret from an edge script.

func (*Client) DeleteEdgeScriptVariable

func (c *Client) DeleteEdgeScriptVariable(ctx context.Context, scriptId, variableId int64) error

DeleteEdgeScriptVariable deletes a variable from an edge script.

func (*Client) DeletePullZone

func (c *Client) DeletePullZone(ctx context.Context, id int64) error

DeletePullZone deletes a pull zone by ID.

func (*Client) DeleteRateLimit

func (c *Client) DeleteRateLimit(ctx context.Context, id int64) error

DeleteRateLimit deletes a rate limit rule.

func (*Client) DeleteStorageZone

func (c *Client) DeleteStorageZone(ctx context.Context, id int64, deleteLinkedPullZones bool) error

DeleteStorageZone deletes a storage zone by ID.

func (*Client) DeleteVideo

func (c *Client) DeleteVideo(ctx context.Context, libraryId int64, videoId string) error

DeleteVideo deletes a video.

func (*Client) DeleteVideoLibrary

func (c *Client) DeleteVideoLibrary(ctx context.Context, id int64) error

DeleteVideoLibrary deletes a video library by ID.

func (*Client) DisableDnsSec

func (c *Client) DisableDnsSec(ctx context.Context, zoneId int64) (*DnsSecInfo, error)

DisableDnsSec disables DNSSEC for a DNS zone.

func (*Client) Do

func (c *Client) Do(ctx context.Context, method, path string, body, result any) error

Do executes an HTTP request, injecting the AccessKey header. If body is non-nil, it is marshaled to JSON. If result is non-nil, the response body is unmarshaled into it.

func (*Client) DoRaw

func (c *Client) DoRaw(ctx context.Context, method, path, contentType string, body io.Reader) ([]byte, error)

DoRaw executes an HTTP request with an optional raw body and returns raw response bytes. Unlike Do, it does not JSON-marshal the request or JSON-unmarshal the response. Used for binary operations like DNS zone import/export.

func (*Client) DownloadInvoice

func (c *Client) DownloadInvoice(ctx context.Context, billingRecordId int64) ([]byte, error)

DownloadInvoice downloads a billing invoice PDF by record ID.

func (*Client) EnableDnsSec

func (c *Client) EnableDnsSec(ctx context.Context, zoneId int64) (*DnsSecInfo, error)

EnableDnsSec enables DNSSEC for a DNS zone and returns the DS record info.

func (*Client) ExportDnsZone

func (c *Client) ExportDnsZone(ctx context.Context, zoneId int64) ([]byte, error)

ExportDnsZone exports a DNS zone as a zone file.

func (*Client) FetchVideo

func (c *Client) FetchVideo(ctx context.Context, libraryId int64, body *VideoFetch, collectionId string, thumbnailTime int) (*StatusModel, error)

FetchVideo creates and imports a video from a remote URL.

func (*Client) FindStorageZoneByName

func (c *Client) FindStorageZoneByName(ctx context.Context, name string) (*StorageZone, error)

FindStorageZoneByName searches for a storage zone by exact name match.

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string, result any) error

Get is a convenience wrapper for Do with GET method.

func (*Client) GetActiveEdgeScriptRelease

func (c *Client) GetActiveEdgeScriptRelease(ctx context.Context, scriptId int64) (*EdgeScriptRelease, error)

GetActiveEdgeScriptRelease returns the currently active release for an edge script.

func (*Client) GetAuditLog

func (c *Client) GetAuditLog(ctx context.Context, date string, opts AuditLogOptions) (*AuditLogResponse, error)

GetAuditLog returns audit log entries for the given date.

func (*Client) GetBillingDetails

func (c *Client) GetBillingDetails(ctx context.Context) (*BillingDetails, error)

GetBillingDetails returns the full billing details for the account.

func (*Client) GetBillingSummary

func (c *Client) GetBillingSummary(ctx context.Context) ([]*BillingSummaryItem, error)

GetBillingSummary returns per-pullzone billing summary.

func (*Client) GetBotDetection

func (c *Client) GetBotDetection(ctx context.Context, shieldZoneId int64) (*BotDetectionConfig, error)

GetBotDetection returns the bot detection configuration for a shield zone.

func (*Client) GetCollection

func (c *Client) GetCollection(ctx context.Context, libraryId int64, collectionId string) (*Collection, error)

GetCollection returns a single collection by library ID and collection GUID.

func (*Client) GetCustomAccessList

func (c *Client) GetCustomAccessList(ctx context.Context, shieldZoneId, id int64) (*CustomAccessList, error)

GetCustomAccessList returns a single custom access list.

func (*Client) GetCustomWafRule

func (c *Client) GetCustomWafRule(ctx context.Context, id int64) (*CustomWafRule, error)

GetCustomWafRule returns a single custom WAF rule by ID.

func (*Client) GetDnsZone

func (c *Client) GetDnsZone(ctx context.Context, id int64) (*DnsZone, error)

GetDnsZone returns a single DNS zone by ID.

func (*Client) GetEdgeScript

func (c *Client) GetEdgeScript(ctx context.Context, id int64) (*EdgeScript, error)

GetEdgeScript returns a single edge script by ID.

func (*Client) GetEdgeScriptCode

func (c *Client) GetEdgeScriptCode(ctx context.Context, id int64) (*EdgeScriptCode, error)

GetEdgeScriptCode returns the code content of an edge script.

func (*Client) GetEdgeScriptStatistics

func (c *Client) GetEdgeScriptStatistics(ctx context.Context, id int64, dateFrom, dateTo string, loadLatest, hourly bool) (*EdgeScriptStatistics, error)

GetEdgeScriptStatistics returns statistics for an edge script.

func (*Client) GetEdgeScriptVariable

func (c *Client) GetEdgeScriptVariable(ctx context.Context, scriptId, variableId int64) (*EdgeScriptVariable, error)

GetEdgeScriptVariable returns a single variable by script and variable ID.

func (*Client) GetPullZone

func (c *Client) GetPullZone(ctx context.Context, id int64) (*PullZone, error)

GetPullZone returns a single pull zone by ID.

func (*Client) GetRateLimit

func (c *Client) GetRateLimit(ctx context.Context, id int64) (*RateLimitRule, error)

GetRateLimit returns a single rate limit rule by ID.

func (*Client) GetShieldBotDetectionMetrics

func (c *Client) GetShieldBotDetectionMetrics(ctx context.Context, shieldZoneId int64) (*ShieldZoneBotDetectionMetrics, error)

GetShieldBotDetectionMetrics returns bot detection metrics for a shield zone.

func (*Client) GetShieldEventLogs

func (c *Client) GetShieldEventLogs(ctx context.Context, shieldZoneId int64, date, continuationToken string) (*EventLogResponse, error)

GetShieldEventLogs returns event logs for a shield zone on a specific date.

func (*Client) GetShieldMetricsDetailed

func (c *Client) GetShieldMetricsDetailed(ctx context.Context, shieldZoneId int64, startDate, endDate string, resolution int) (*ShieldOverviewMetricsData, error)

GetShieldMetricsDetailed returns detailed overview metrics for a shield zone.

func (*Client) GetShieldMetricsOverview

func (c *Client) GetShieldMetricsOverview(ctx context.Context, shieldZoneId int64) (*ShieldZoneMetrics, error)

GetShieldMetricsOverview returns overview metrics for a shield zone.

func (*Client) GetShieldRateLimitMetric

func (c *Client) GetShieldRateLimitMetric(ctx context.Context, id int64) (*RatelimitMetrics, error)

GetShieldRateLimitMetric returns metrics for a single rate limit rule.

func (*Client) GetShieldRateLimitMetrics

func (c *Client) GetShieldRateLimitMetrics(ctx context.Context, shieldZoneId int64) ([]*ShieldZoneRateLimitMetrics, error)

GetShieldRateLimitMetrics returns rate limit metrics for a shield zone.

func (*Client) GetShieldUploadScanningMetrics

func (c *Client) GetShieldUploadScanningMetrics(ctx context.Context, shieldZoneId int64) (*ShieldZoneUploadScanningMetrics, error)

GetShieldUploadScanningMetrics returns upload scanning metrics for a shield zone.

func (*Client) GetShieldWafRuleMetrics

func (c *Client) GetShieldWafRuleMetrics(ctx context.Context, shieldZoneId int64, ruleId int) (*WafRuleMetrics, error)

GetShieldWafRuleMetrics returns metrics for a specific WAF rule on a shield zone.

func (*Client) GetShieldZone

func (c *Client) GetShieldZone(ctx context.Context, id int64) (*ShieldZone, error)

GetShieldZone returns a single shield zone by ID.

func (*Client) GetShieldZoneByPullZone

func (c *Client) GetShieldZoneByPullZone(ctx context.Context, pullZoneId int64) (*ShieldZone, error)

GetShieldZoneByPullZone returns a shield zone by its associated pull zone ID.

func (*Client) GetStatistics

func (c *Client) GetStatistics(ctx context.Context, opts StatisticsOptions) (*Statistics, error)

GetStatistics returns global CDN statistics.

func (*Client) GetStorageZone

func (c *Client) GetStorageZone(ctx context.Context, id int64) (*StorageZone, error)

GetStorageZone returns a single storage zone by ID.

func (*Client) GetUploadScanning

func (c *Client) GetUploadScanning(ctx context.Context, shieldZoneId int64) (*UploadScanningConfig, error)

GetUploadScanning returns the upload scanning configuration for a shield zone.

func (*Client) GetVideo

func (c *Client) GetVideo(ctx context.Context, libraryId int64, videoId string) (*Video, error)

GetVideo returns a single video by library ID and video GUID.

func (*Client) GetVideoHeatmap

func (c *Client) GetVideoHeatmap(ctx context.Context, libraryId int64, videoId string) (*VideoHeatmap, error)

GetVideoHeatmap returns the heatmap data for a video.

func (*Client) GetVideoLibrary

func (c *Client) GetVideoLibrary(ctx context.Context, id int64) (*VideoLibrary, error)

GetVideoLibrary returns a single video library by ID.

func (*Client) GetVideoStatistics

func (c *Client) GetVideoStatistics(ctx context.Context, libraryId int64, dateFrom, dateTo string, hourly bool, videoGuid string) (*VideoStatistics, error)

GetVideoStatistics returns statistics for a video library.

func (*Client) GetWafEngineConfig

func (c *Client) GetWafEngineConfig(ctx context.Context) ([]WafConfigVariable, error)

GetWafEngineConfig returns the WAF engine configuration variables.

func (*Client) ImportDnsZone

func (c *Client) ImportDnsZone(ctx context.Context, zoneId int64, data io.Reader) (*DnsZoneImportResult, error)

ImportDnsZone imports DNS records from a zone file.

func (*Client) ListAccessLists

func (c *Client) ListAccessLists(ctx context.Context, shieldZoneId int64) (*AccessListsResponse, error)

ListAccessLists returns the access lists for a shield zone.

func (*Client) ListApiKeys

func (c *Client) ListApiKeys(ctx context.Context, page, perPage int) (pagination.PageResponse[*ApiKey], error)

ListApiKeys returns a paginated list of API keys.

func (*Client) ListCollections

func (c *Client) ListCollections(ctx context.Context, libraryId int64, page, itemsPerPage int, search, orderBy string) (pagination.PageResponse[*Collection], error)

ListCollections returns a paginated list of collections in a library.

func (*Client) ListCountries

func (c *Client) ListCountries(ctx context.Context) ([]*Country, error)

ListCountries returns all countries.

func (*Client) ListCustomWafRules

func (c *Client) ListCustomWafRules(ctx context.Context, shieldZoneId int64, page, perPage int) (pagination.PageResponse[*CustomWafRule], error)

ListCustomWafRules returns a paginated list of custom WAF rules for a shield zone.

func (*Client) ListDnsZones

func (c *Client) ListDnsZones(ctx context.Context, page, perPage int, search string) (pagination.PageResponse[*DnsZone], error)

ListDnsZones returns a paginated list of DNS zones.

func (*Client) ListEdgeScriptReleases

func (c *Client) ListEdgeScriptReleases(ctx context.Context, scriptId int64, page, perPage int) (pagination.PageResponse[*EdgeScriptRelease], error)

ListEdgeScriptReleases returns a paginated list of releases for an edge script.

func (*Client) ListEdgeScriptSecrets

func (c *Client) ListEdgeScriptSecrets(ctx context.Context, scriptId int64) ([]*EdgeScriptSecret, error)

ListEdgeScriptSecrets returns all secrets for an edge script.

func (*Client) ListEdgeScripts

func (c *Client) ListEdgeScripts(ctx context.Context, page, perPage int, search string, scriptTypes []int) (pagination.PageResponse[*EdgeScript], error)

ListEdgeScripts returns a paginated list of edge scripts.

func (*Client) ListPullZones

func (c *Client) ListPullZones(ctx context.Context, page, perPage int, search string) (pagination.PageResponse[*PullZone], error)

ListPullZones returns a paginated list of pull zones. The bunny.net API returns a paginated object when page > 0, but returns a plain array when page == 0. We handle both formats for compatibility with mock servers (e.g., Prism) that may return a plain array.

func (*Client) ListRateLimits

func (c *Client) ListRateLimits(ctx context.Context, shieldZoneId int64, page, perPage int) (pagination.PageResponse[*RateLimitRule], error)

ListRateLimits returns a paginated list of rate limit rules for a shield zone.

func (*Client) ListRegions

func (c *Client) ListRegions(ctx context.Context) ([]*Region, error)

ListRegions returns all CDN regions.

func (*Client) ListShieldZones

func (c *Client) ListShieldZones(ctx context.Context, page, perPage int) (pagination.PageResponse[*ShieldZone], error)

ListShieldZones returns a paginated list of shield zones.

func (*Client) ListStorageZones

func (c *Client) ListStorageZones(ctx context.Context, page, perPage int, search string, includeDeleted bool) (pagination.PageResponse[*StorageZone], error)

ListStorageZones returns a paginated list of storage zones. The bunny.net API returns a paginated object when page > 0, but returns a plain array when page == 0. We handle both formats for compatibility with mock servers (e.g., Prism) that may return a plain array.

func (*Client) ListTriggeredWafRules

func (c *Client) ListTriggeredWafRules(ctx context.Context, shieldZoneId int64) ([]*TriggeredRule, error)

ListTriggeredWafRules returns the triggered WAF rules for a shield zone.

func (*Client) ListVideoLibraries

func (c *Client) ListVideoLibraries(ctx context.Context, page, perPage int, search string) (pagination.PageResponse[*VideoLibrary], error)

ListVideoLibraries returns a paginated list of video libraries.

func (*Client) ListVideoLibraryLanguages

func (c *Client) ListVideoLibraryLanguages(ctx context.Context) ([]VideoLibraryLanguage, error)

ListVideoLibraryLanguages returns the list of supported transcription languages.

func (*Client) ListVideos

func (c *Client) ListVideos(ctx context.Context, libraryId int64, page, itemsPerPage int, search, collection, orderBy string) (pagination.PageResponse[*Video], error)

ListVideos returns a paginated list of videos in a library.

func (*Client) ListWafProfiles

func (c *Client) ListWafProfiles(ctx context.Context) ([]*WafProfile, error)

ListWafProfiles returns the available WAF profiles.

func (*Client) ListWafRules

func (c *Client) ListWafRules(ctx context.Context, shieldZoneId int64) ([]*WafRuleMainGroup, error)

ListWafRules returns the managed WAF rules for a shield zone.

func (*Client) Patch

func (c *Client) Patch(ctx context.Context, path string, body, result any) error

Patch is a convenience wrapper for Do with PATCH method.

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, body, result any) error

Post is a convenience wrapper for Do with POST method.

func (*Client) PublishEdgeScript

func (c *Client) PublishEdgeScript(ctx context.Context, scriptId int64, body *EdgeScriptPublish) error

PublishEdgeScript publishes the current code of an edge script as a new release.

func (*Client) PublishEdgeScriptRelease

func (c *Client) PublishEdgeScriptRelease(ctx context.Context, scriptId int64, uuid string) error

PublishEdgeScriptRelease publishes a specific release by UUID.

func (*Client) PurgePullZoneCache

func (c *Client) PurgePullZoneCache(ctx context.Context, id int64, cacheTag string) error

PurgePullZoneCache purges the cache for a pull zone. If cacheTag is empty, purges all.

func (*Client) Put

func (c *Client) Put(ctx context.Context, path string, body, result any) error

Put is a convenience wrapper for Do with PUT method.

func (*Client) ReencodeVideo

func (c *Client) ReencodeVideo(ctx context.Context, libraryId int64, videoId string) (*Video, error)

ReencodeVideo re-encodes a video from the original file.

func (*Client) RemovePullZoneHostname

func (c *Client) RemovePullZoneHostname(ctx context.Context, id int64, hostname string) error

RemovePullZoneHostname removes a custom hostname from a pull zone.

func (*Client) ResetStorageZonePassword

func (c *Client) ResetStorageZonePassword(ctx context.Context, id int64) error

ResetStorageZonePassword resets the password for a storage zone.

func (*Client) ResetStorageZoneReadOnlyPassword

func (c *Client) ResetStorageZoneReadOnlyPassword(ctx context.Context, id int64) error

ResetStorageZoneReadOnlyPassword resets the read-only password for a storage zone.

func (*Client) ResetVideoLibraryApiKey

func (c *Client) ResetVideoLibraryApiKey(ctx context.Context, id int64) error

ResetVideoLibraryApiKey resets the API key for a video library.

func (*Client) RotateEdgeScriptDeploymentKey

func (c *Client) RotateEdgeScriptDeploymentKey(ctx context.Context, id int64) error

RotateEdgeScriptDeploymentKey rotates the deployment key for an edge script.

func (*Client) SetEdgeRuleEnabled

func (c *Client) SetEdgeRuleEnabled(ctx context.Context, pullZoneId int64, edgeRuleId string, enabled bool) error

SetEdgeRuleEnabled enables or disables an edge rule.

func (*Client) SetEdgeScriptCode

func (c *Client) SetEdgeScriptCode(ctx context.Context, id int64, code string) error

SetEdgeScriptCode sets the code content of an edge script.

func (*Client) TranscribeVideo

func (c *Client) TranscribeVideo(ctx context.Context, libraryId int64, videoId string, settings *TranscribeSettings) error

TranscribeVideo triggers transcription for a video.

func (*Client) UpdateAccessListConfig

func (c *Client) UpdateAccessListConfig(ctx context.Context, shieldZoneId, configId int64, body *AccessListConfigUpdate) error

UpdateAccessListConfig updates an access list configuration.

func (*Client) UpdateBotDetection

func (c *Client) UpdateBotDetection(ctx context.Context, shieldZoneId int64, body *BotDetectionUpdate) error

UpdateBotDetection updates the bot detection configuration for a shield zone.

func (*Client) UpdateCollection

func (c *Client) UpdateCollection(ctx context.Context, libraryId int64, collectionId string, body *CollectionUpdate) error

UpdateCollection updates a collection. Note: bunny.net uses POST for updates.

func (*Client) UpdateCustomAccessList

func (c *Client) UpdateCustomAccessList(ctx context.Context, shieldZoneId, id int64, body *CustomAccessListUpdate) (*CustomAccessList, error)

UpdateCustomAccessList updates a custom access list.

func (*Client) UpdateCustomWafRule

func (c *Client) UpdateCustomWafRule(ctx context.Context, id int64, body *CustomWafRuleUpdate) (*CustomWafRule, error)

UpdateCustomWafRule updates a custom WAF rule.

func (*Client) UpdateDnsRecord

func (c *Client) UpdateDnsRecord(ctx context.Context, zoneId, recordId int64, body *DnsRecordUpdate) error

UpdateDnsRecord updates a DNS record. Returns no body (204).

func (*Client) UpdateDnsZone

func (c *Client) UpdateDnsZone(ctx context.Context, id int64, body *DnsZoneUpdate) (*DnsZone, error)

UpdateDnsZone updates an existing DNS zone. Note: bunny.net uses POST for updates.

func (*Client) UpdateEdgeScript

func (c *Client) UpdateEdgeScript(ctx context.Context, id int64, body *EdgeScriptUpdate) (*EdgeScript, error)

UpdateEdgeScript updates an existing edge script. Note: bunny.net uses POST for updates.

func (*Client) UpdateEdgeScriptSecret

func (c *Client) UpdateEdgeScriptSecret(ctx context.Context, scriptId, secretId int64, body *EdgeScriptSecretUpdate) error

UpdateEdgeScriptSecret updates a secret on an edge script.

func (*Client) UpdateEdgeScriptVariable

func (c *Client) UpdateEdgeScriptVariable(ctx context.Context, scriptId, variableId int64, body *EdgeScriptVariableUpdate) error

UpdateEdgeScriptVariable updates a variable on an edge script.

func (*Client) UpdatePullZone

func (c *Client) UpdatePullZone(ctx context.Context, id int64, body *PullZoneUpdate) (*PullZone, error)

UpdatePullZone updates an existing pull zone. Note: bunny.net uses POST for updates.

func (*Client) UpdateRateLimit

func (c *Client) UpdateRateLimit(ctx context.Context, id int64, body *RateLimitRuleUpdate) (*RateLimitRule, error)

UpdateRateLimit updates a rate limit rule.

func (*Client) UpdateShieldZone

func (c *Client) UpdateShieldZone(ctx context.Context, id int64, body *ShieldZoneUpdate) (*ShieldZoneResponse, error)

UpdateShieldZone updates an existing shield zone.

func (*Client) UpdateStorageZone

func (c *Client) UpdateStorageZone(ctx context.Context, id int64, body *StorageZoneUpdate) error

UpdateStorageZone updates an existing storage zone. Note: bunny.net uses POST for updates and returns 204 (no body).

func (*Client) UpdateTriggeredWafRule

func (c *Client) UpdateTriggeredWafRule(ctx context.Context, shieldZoneId int64, body *TriggeredRuleUpdate) error

UpdateTriggeredWafRule updates the review action for a triggered WAF rule.

func (*Client) UpdateUploadScanning

func (c *Client) UpdateUploadScanning(ctx context.Context, shieldZoneId int64, body *UploadScanningUpdate) error

UpdateUploadScanning updates the upload scanning configuration for a shield zone.

func (*Client) UpdateVideo

func (c *Client) UpdateVideo(ctx context.Context, libraryId int64, videoId string, body *VideoUpdate) error

UpdateVideo updates an existing video. Note: bunny.net uses POST for updates.

func (*Client) UpdateVideoLibrary

func (c *Client) UpdateVideoLibrary(ctx context.Context, id int64, body *VideoLibraryUpdate) (*VideoLibrary, error)

UpdateVideoLibrary updates an existing video library. Note: bunny.net uses POST for updates.

func (*Client) UploadVideo

func (c *Client) UploadVideo(ctx context.Context, libraryId int64, videoId string, body io.Reader, size int64) error

UploadVideo uploads a binary video file to an existing video record.

type ClientConfig

type ClientConfig struct {
	// APIKey is the bunny.net API key used for authentication.
	APIKey string
	// BaseURL overrides the default API base URL. Defaults to BaseURLPlatform.
	BaseURL string
	// IsJSON reports whether the current output format is JSON-based.
	// It is used to decide retry/logging behavior.
	IsJSON func() bool
}

ClientConfig holds the configuration needed to create a bunny.net API client.

type Collection

type Collection struct {
	VideoLibraryId   int64    `json:"videoLibraryId"`
	Guid             string   `json:"guid"`
	Name             string   `json:"name"`
	VideoCount       int64    `json:"videoCount"`
	TotalSize        int64    `json:"totalSize"`
	PreviewVideoIds  string   `json:"previewVideoIds"`
	PreviewImageUrls []string `json:"previewImageUrls"`
}

Collection represents a collection in a bunny.net stream library.

type CollectionCreate

type CollectionCreate struct {
	Name string `json:"name"`
}

CollectionCreate holds the fields for creating a collection.

type CollectionUpdate

type CollectionUpdate struct {
	Name string `json:"name"`
}

CollectionUpdate holds the fields for updating a collection.

type Country

type Country struct {
	Name      string   `json:"Name"`
	IsoCode   string   `json:"IsoCode"`
	IsEU      bool     `json:"IsEU"`
	TaxRate   float64  `json:"TaxRate"`
	TaxPrefix string   `json:"TaxPrefix"`
	FlagUrl   string   `json:"FlagUrl"`
	PopList   []string `json:"PopList"`
}

Country represents a country in the bunny.net system.

type CustomAccessList

type CustomAccessList struct {
	Id           int64  `json:"id"`
	Name         string `json:"name"`
	Description  string `json:"description"`
	Type         int    `json:"type"`
	Content      string `json:"content"`
	Checksum     string `json:"checksum"`
	EntryCount   int64  `json:"entryCount"`
	LastModified string `json:"lastModified"`
}

CustomAccessList represents a user-created access list.

type CustomAccessListCreate

type CustomAccessListCreate struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Type        int    `json:"type"`
	Content     string `json:"content"`
	Checksum    string `json:"checksum,omitempty"`
}

CustomAccessListCreate holds the fields for creating a custom access list.

type CustomAccessListUpdate

type CustomAccessListUpdate struct {
	Name     *string `json:"name,omitempty"`
	Content  *string `json:"content,omitempty"`
	Checksum *string `json:"checksum,omitempty"`
}

CustomAccessListUpdate holds the fields for updating a custom access list.

type CustomWafRule

type CustomWafRule struct {
	Id                int64          `json:"id"`
	ShieldZoneId      int64          `json:"shieldZoneId"`
	UserId            string         `json:"userId"`
	RuleName          string         `json:"ruleName"`
	RuleDescription   string         `json:"ruleDescription"`
	RuleJson          string         `json:"ruleJson"`
	RuleConfiguration *WafRuleConfig `json:"ruleConfiguration"`
}

CustomWafRule represents a user-created WAF rule.

type CustomWafRuleCreate

type CustomWafRuleCreate struct {
	ShieldZoneId      int64          `json:"shieldZoneId"`
	RuleName          string         `json:"ruleName"`
	RuleDescription   string         `json:"ruleDescription,omitempty"`
	RuleConfiguration *WafRuleConfig `json:"ruleConfiguration"`
}

CustomWafRuleCreate holds the fields for creating a custom WAF rule.

type CustomWafRuleUpdate

type CustomWafRuleUpdate struct {
	RuleName          *string        `json:"ruleName,omitempty"`
	RuleDescription   *string        `json:"ruleDescription,omitempty"`
	RuleConfiguration *WafRuleConfig `json:"ruleConfiguration,omitempty"`
}

CustomWafRuleUpdate holds the fields for updating a custom WAF rule.

type DDoSMetrics

type DDoSMetrics struct {
	LoggedRequests     int64 `json:"loggedRequests"`
	VerifiedRequests   int64 `json:"verifiedRequests"`
	BlockedRequests    int64 `json:"blockedRequests"`
	ChallengedRequests int64 `json:"challengedRequests"`
}

DDoSMetrics holds DDoS-specific metrics.

type DnsRecord

type DnsRecord struct {
	Id                    int64   `json:"Id"`
	Type                  int     `json:"Type"`
	Ttl                   int     `json:"Ttl"`
	Value                 string  `json:"Value"`
	Name                  string  `json:"Name"`
	Weight                int     `json:"Weight"`
	Priority              int     `json:"Priority"`
	Port                  int     `json:"Port"`
	Flags                 int     `json:"Flags"`
	Tag                   string  `json:"Tag"`
	Accelerated           bool    `json:"Accelerated"`
	AcceleratedPullZoneId int64   `json:"AcceleratedPullZoneId"`
	LinkName              string  `json:"LinkName"`
	MonitorStatus         int     `json:"MonitorStatus"`
	MonitorType           int     `json:"MonitorType"`
	GeolocationLatitude   float64 `json:"GeolocationLatitude"`
	GeolocationLongitude  float64 `json:"GeolocationLongitude"`
	LatencyZone           string  `json:"LatencyZone"`
	SmartRoutingType      int     `json:"SmartRoutingType"`
	Disabled              bool    `json:"Disabled"`
	Comment               string  `json:"Comment"`
}

DnsRecord represents a DNS record within a zone.

type DnsRecordCreate

type DnsRecordCreate struct {
	Type                 int     `json:"Type"`
	Ttl                  int     `json:"Ttl"`
	Value                string  `json:"Value"`
	Name                 string  `json:"Name,omitempty"`
	Weight               int     `json:"Weight,omitempty"`
	Priority             int     `json:"Priority,omitempty"`
	Port                 int     `json:"Port,omitempty"`
	Flags                int     `json:"Flags,omitempty"`
	Tag                  string  `json:"Tag,omitempty"`
	Accelerated          bool    `json:"Accelerated,omitempty"`
	PullZoneId           int64   `json:"PullZoneId,omitempty"`
	ScriptId             int64   `json:"ScriptId,omitempty"`
	MonitorType          int     `json:"MonitorType,omitempty"`
	GeolocationLatitude  float64 `json:"GeolocationLatitude,omitempty"`
	GeolocationLongitude float64 `json:"GeolocationLongitude,omitempty"`
	LatencyZone          string  `json:"LatencyZone,omitempty"`
	SmartRoutingType     int     `json:"SmartRoutingType,omitempty"`
	Disabled             bool    `json:"Disabled,omitempty"`
	Comment              string  `json:"Comment,omitempty"`
}

DnsRecordCreate holds the fields for adding a DNS record.

type DnsRecordUpdate

type DnsRecordUpdate struct {
	Type                 *int     `json:"Type,omitempty"`
	Ttl                  *int     `json:"Ttl,omitempty"`
	Value                *string  `json:"Value,omitempty"`
	Name                 *string  `json:"Name,omitempty"`
	Weight               *int     `json:"Weight,omitempty"`
	Priority             *int     `json:"Priority,omitempty"`
	Port                 *int     `json:"Port,omitempty"`
	Flags                *int     `json:"Flags,omitempty"`
	Tag                  *string  `json:"Tag,omitempty"`
	Accelerated          *bool    `json:"Accelerated,omitempty"`
	PullZoneId           *int64   `json:"PullZoneId,omitempty"`
	ScriptId             *int64   `json:"ScriptId,omitempty"`
	MonitorType          *int     `json:"MonitorType,omitempty"`
	GeolocationLatitude  *float64 `json:"GeolocationLatitude,omitempty"`
	GeolocationLongitude *float64 `json:"GeolocationLongitude,omitempty"`
	LatencyZone          *string  `json:"LatencyZone,omitempty"`
	SmartRoutingType     *int     `json:"SmartRoutingType,omitempty"`
	Disabled             *bool    `json:"Disabled,omitempty"`
	Comment              *string  `json:"Comment,omitempty"`
}

DnsRecordUpdate holds the fields for updating a DNS record. Pointer types allow distinguishing between "not set" and "set to zero value".

type DnsSecInfo

type DnsSecInfo struct {
	Enabled      bool   `json:"Enabled"`
	DsRecord     string `json:"DsRecord"`
	Digest       string `json:"Digest"`
	DigestType   string `json:"DigestType"`
	Algorithm    int    `json:"Algorithm"`
	PublicKey    string `json:"PublicKey"`
	KeyTag       int    `json:"KeyTag"`
	Flags        int    `json:"Flags"`
	DsConfigured bool   `json:"DsConfigured"`
}

DnsSecInfo holds the DNSSEC DS record information returned when enabling/disabling DNSSEC.

type DnsZone

type DnsZone struct {
	Id                            int64       `json:"Id"`
	Domain                        string      `json:"Domain"`
	Records                       []DnsRecord `json:"Records"`
	DateModified                  string      `json:"DateModified"`
	DateCreated                   string      `json:"DateCreated"`
	NameserversDetected           bool        `json:"NameserversDetected"`
	CustomNameserversEnabled      bool        `json:"CustomNameserversEnabled"`
	Nameserver1                   string      `json:"Nameserver1"`
	Nameserver2                   string      `json:"Nameserver2"`
	SoaEmail                      string      `json:"SoaEmail"`
	NameserversNextCheck          string      `json:"NameserversNextCheck"`
	LoggingEnabled                bool        `json:"LoggingEnabled"`
	LoggingIPAnonymizationEnabled bool        `json:"LoggingIPAnonymizationEnabled"`
	LogAnonymizationType          int         `json:"LogAnonymizationType"`
	DnsSecEnabled                 bool        `json:"DnsSecEnabled"`
	CertificateKeyType            int         `json:"CertificateKeyType"`
}

DnsZone represents a bunny.net DNS zone.

type DnsZoneCreate

type DnsZoneCreate struct {
	Domain string `json:"Domain"`
}

DnsZoneCreate holds the fields for creating a DNS zone.

type DnsZoneImportResult

type DnsZoneImportResult struct {
	RecordsSuccessful int `json:"RecordsSuccessful"`
	RecordsFailed     int `json:"RecordsFailed"`
	RecordsSkipped    int `json:"RecordsSkipped"`
}

DnsZoneImportResult holds the result of a DNS zone file import.

type DnsZoneUpdate

type DnsZoneUpdate struct {
	CustomNameserversEnabled      *bool   `json:"CustomNameserversEnabled,omitempty"`
	Nameserver1                   *string `json:"Nameserver1,omitempty"`
	Nameserver2                   *string `json:"Nameserver2,omitempty"`
	SoaEmail                      *string `json:"SoaEmail,omitempty"`
	LoggingEnabled                *bool   `json:"LoggingEnabled,omitempty"`
	LogAnonymizationType          *int    `json:"LogAnonymizationType,omitempty"`
	LoggingIPAnonymizationEnabled *bool   `json:"LoggingIPAnonymizationEnabled,omitempty"`
	CertificateKeyType            *int    `json:"CertificateKeyType,omitempty"`
}

DnsZoneUpdate holds the fields for updating a DNS zone. Pointer types allow distinguishing between "not set" and "set to zero value".

type EdgeRule

type EdgeRule struct {
	Guid                string            `json:"Guid"`
	ActionType          int               `json:"ActionType"`
	ActionParameter1    string            `json:"ActionParameter1"`
	ActionParameter2    string            `json:"ActionParameter2"`
	Triggers            []EdgeRuleTrigger `json:"Triggers"`
	TriggerMatchingType int               `json:"TriggerMatchingType"`
	Description         string            `json:"Description"`
	Enabled             bool              `json:"Enabled"`
}

EdgeRule represents an edge rule on a pull zone.

type EdgeRuleTrigger

type EdgeRuleTrigger struct {
	Type                int      `json:"Type"`
	PatternMatches      []string `json:"PatternMatches"`
	PatternMatchingType int      `json:"PatternMatchingType"`
	Parameter1          string   `json:"Parameter1"`
}

EdgeRuleTrigger represents a trigger condition for an edge rule.

type EdgeScript

type EdgeScript struct {
	Id                  int64                `json:"Id"`
	Name                string               `json:"Name"`
	LastModified        string               `json:"LastModified"`
	ScriptType          int                  `json:"ScriptType"` // 0=DNS, 1=CDN, 2=Middleware
	CurrentReleaseId    int64                `json:"CurrentReleaseId"`
	EdgeScriptVariables []EdgeScriptVariable `json:"EdgeScriptVariables"`
	Deleted             bool                 `json:"Deleted"`
	LinkedPullZones     []LinkedPullZone     `json:"LinkedPullZones"`
	DefaultHostname     string               `json:"DefaultHostname"`
	SystemHostname      string               `json:"SystemHostname"`
	DeploymentKey       string               `json:"DeploymentKey"`
	MonthlyCost         float64              `json:"MonthlyCost"`
	MonthlyRequestCount int64                `json:"MonthlyRequestCount"`
	MonthlyCpuTime      int64                `json:"MonthlyCpuTime"`
}

EdgeScript represents a bunny.net edge script (compute).

type EdgeScriptCode

type EdgeScriptCode struct {
	Code         string `json:"Code"`
	LastModified string `json:"LastModified"`
}

EdgeScriptCode represents the code content of an edge script.

type EdgeScriptCreate

type EdgeScriptCreate struct {
	Name                 string `json:"Name"`
	ScriptType           int    `json:"ScriptType"`
	Code                 string `json:"Code,omitempty"`
	CreateLinkedPullZone bool   `json:"CreateLinkedPullZone,omitempty"`
	LinkedPullZoneName   string `json:"LinkedPullZoneName,omitempty"`
}

EdgeScriptCreate holds the fields for creating an edge script.

type EdgeScriptPublish

type EdgeScriptPublish struct {
	Note string `json:"Note,omitempty"`
}

EdgeScriptPublish holds the body for publishing an edge script release.

type EdgeScriptRelease

type EdgeScriptRelease struct {
	Id            int64  `json:"Id"`
	Deleted       bool   `json:"Deleted"`
	Code          string `json:"Code"`
	Uuid          string `json:"Uuid"`
	Note          string `json:"Note"`
	Author        string `json:"Author"`
	AuthorEmail   string `json:"AuthorEmail"`
	CommitSha     string `json:"CommitSha"`
	Status        int    `json:"Status"` // 0=Archived, 1=Live
	DateReleased  string `json:"DateReleased"`
	DatePublished string `json:"DatePublished"`
}

EdgeScriptRelease represents a release of an edge script.

type EdgeScriptSecret

type EdgeScriptSecret struct {
	Id           int64  `json:"Id"`
	Name         string `json:"Name"`
	LastModified string `json:"LastModified"`
}

EdgeScriptSecret represents a secret attached to an edge script.

type EdgeScriptSecretCreate

type EdgeScriptSecretCreate struct {
	Name   string `json:"Name"`
	Secret string `json:"Secret"`
}

EdgeScriptSecretCreate holds the fields for adding a secret.

type EdgeScriptSecretUpdate

type EdgeScriptSecretUpdate struct {
	Secret string `json:"Secret"`
}

EdgeScriptSecretUpdate holds the fields for updating a secret.

type EdgeScriptStatistics

type EdgeScriptStatistics struct {
	TotalRequestsServed        int64              `json:"TotalRequestsServed"`
	TotalCpuUsed               float64            `json:"TotalCpuUsed"`
	TotalMonthlyCost           float64            `json:"TotalMonthlyCost"`
	AverageCpuTimePerExecution float64            `json:"AverageCpuTimePerExecution"`
	RequestsServedChart        map[string]int64   `json:"RequestsServedChart"`
	AverageCpuTimeChart        map[string]float64 `json:"AverageCpuTimeChart"`
	TotalCpuTimeChart          map[string]int64   `json:"TotalCpuTimeChart"`
}

EdgeScriptStatistics holds statistics for an edge script.

type EdgeScriptUpdate

type EdgeScriptUpdate struct {
	Name       *string `json:"Name,omitempty"`
	ScriptType *int    `json:"ScriptType,omitempty"`
}

EdgeScriptUpdate holds the fields for updating an edge script.

type EdgeScriptVariable

type EdgeScriptVariable struct {
	Id           int64  `json:"Id"`
	Name         string `json:"Name"`
	Required     bool   `json:"Required"`
	DefaultValue string `json:"DefaultValue"`
}

EdgeScriptVariable represents a variable attached to an edge script.

type EdgeScriptVariableCreate

type EdgeScriptVariableCreate struct {
	Name         string `json:"Name"`
	Required     bool   `json:"Required,omitempty"`
	DefaultValue string `json:"DefaultValue,omitempty"`
}

EdgeScriptVariableCreate holds the fields for adding a variable.

type EdgeScriptVariableUpdate

type EdgeScriptVariableUpdate struct {
	DefaultValue *string `json:"DefaultValue,omitempty"`
	Required     *bool   `json:"Required,omitempty"`
}

EdgeScriptVariableUpdate holds the fields for updating a variable.

type EventLog

type EventLog struct {
	LogId     string            `json:"logId"`
	Timestamp int64             `json:"timestamp"`
	Log       string            `json:"log"`
	Labels    map[string]string `json:"labels"`
}

EventLog represents a single Shield event log entry.

type EventLogResponse

type EventLogResponse struct {
	Logs              []EventLog `json:"logs"`
	HasMoreData       bool       `json:"hasMoreData"`
	ContinuationToken string     `json:"continuationToken"`
}

EventLogResponse holds the response from the event logs endpoint.

type Hostname

type Hostname struct {
	Id               int64  `json:"Id"`
	Value            string `json:"Value"`
	ForceSSL         bool   `json:"ForceSSL"`
	IsSystemHostname bool   `json:"IsSystemHostname"`
	HasCertificate   bool   `json:"HasCertificate"`
}

Hostname represents a hostname attached to a pull zone.

type LinkedPullZone

type LinkedPullZone struct {
	Id              int64  `json:"Id"`
	PullZoneName    string `json:"PullZoneName"`
	DefaultHostname string `json:"DefaultHostname"`
}

LinkedPullZone is an abbreviated pull zone reference embedded in an edge script.

type MetaTag

type MetaTag struct {
	Property string `json:"property"`
	Value    string `json:"value"`
}

MetaTag represents a meta tag on a video.

type Moment

type Moment struct {
	Label     string `json:"label"`
	Timestamp int    `json:"timestamp"`
}

Moment represents a moment marker in a video.

type OverviewMetric

type OverviewMetric struct {
	Metrics map[string]map[string]int64 `json:"metrics"`
	Totals  map[string]int64            `json:"totals"`
}

OverviewMetric holds time-series metric data.

type PullZone

type PullZone struct {
	Id                    int64      `json:"Id"`
	Name                  string     `json:"Name"`
	OriginUrl             string     `json:"OriginUrl"`
	Enabled               bool       `json:"Enabled"`
	Suspended             bool       `json:"Suspended"`
	CnameDomain           string     `json:"CnameDomain"`
	StorageZoneId         int64      `json:"StorageZoneId"`
	MonthlyBandwidthUsed  int64      `json:"MonthlyBandwidthUsed"`
	MonthlyCharges        float64    `json:"MonthlyCharges"`
	Type                  int        `json:"Type"` // 0=Premium, 1=Volume
	Hostnames             []Hostname `json:"Hostnames"`
	EdgeRules             []EdgeRule `json:"EdgeRules"`
	IgnoreQueryStrings    bool       `json:"IgnoreQueryStrings"`
	EnableGeoZoneUS       bool       `json:"EnableGeoZoneUS"`
	EnableGeoZoneEU       bool       `json:"EnableGeoZoneEU"`
	EnableGeoZoneASIA     bool       `json:"EnableGeoZoneASIA"`
	EnableGeoZoneSA       bool       `json:"EnableGeoZoneSA"`
	EnableGeoZoneAF       bool       `json:"EnableGeoZoneAF"`
	ZoneSecurityEnabled   bool       `json:"ZoneSecurityEnabled"`
	OriginHostHeader      string     `json:"OriginHostHeader"`
	AddHostHeader         bool       `json:"AddHostHeader"`
	VerifyOriginSSL       bool       `json:"VerifyOriginSSL"`
	EnableLogging         bool       `json:"EnableLogging"`
	MonthlyBandwidthLimit int64      `json:"MonthlyBandwidthLimit"`
	EnableOriginShield    bool       `json:"EnableOriginShield"`
	FollowRedirects       bool       `json:"FollowRedirects"`
	DisableCookies        bool       `json:"DisableCookies"`
}

PullZone represents a bunny.net pull zone.

type PullZoneCreate

type PullZoneCreate struct {
	Name      string `json:"Name"`
	OriginUrl string `json:"OriginUrl,omitempty"`
	Type      int    `json:"Type,omitempty"`
}

PullZoneCreate holds the fields for creating a pull zone.

type PullZoneUpdate

type PullZoneUpdate struct {
	OriginUrl             *string `json:"OriginUrl,omitempty"`
	OriginHostHeader      *string `json:"OriginHostHeader,omitempty"`
	AddHostHeader         *bool   `json:"AddHostHeader,omitempty"`
	VerifyOriginSSL       *bool   `json:"VerifyOriginSSL,omitempty"`
	EnableGeoZoneUS       *bool   `json:"EnableGeoZoneUS,omitempty"`
	EnableGeoZoneEU       *bool   `json:"EnableGeoZoneEU,omitempty"`
	EnableGeoZoneASIA     *bool   `json:"EnableGeoZoneASIA,omitempty"`
	EnableGeoZoneSA       *bool   `json:"EnableGeoZoneSA,omitempty"`
	EnableGeoZoneAF       *bool   `json:"EnableGeoZoneAF,omitempty"`
	IgnoreQueryStrings    *bool   `json:"IgnoreQueryStrings,omitempty"`
	ZoneSecurityEnabled   *bool   `json:"ZoneSecurityEnabled,omitempty"`
	EnableLogging         *bool   `json:"EnableLogging,omitempty"`
	MonthlyBandwidthLimit *int64  `json:"MonthlyBandwidthLimit,omitempty"`
	EnableOriginShield    *bool   `json:"EnableOriginShield,omitempty"`
	FollowRedirects       *bool   `json:"FollowRedirects,omitempty"`
	DisableCookies        *bool   `json:"DisableCookies,omitempty"`
}

PullZoneUpdate holds the fields for updating a pull zone. Pointer types allow distinguishing between "not set" and "set to zero value".

type RateLimitConfig

type RateLimitConfig struct {
	ActionType            int                       `json:"actionType"`
	VariableTypes         map[string]string         `json:"variableTypes"`
	OperatorType          int                       `json:"operatorType"`
	SeverityType          int                       `json:"severityType"`
	TransformationTypes   []int                     `json:"transformationTypes"`
	Value                 string                    `json:"value"`
	RequestCount          int                       `json:"requestCount"`
	CounterKeyType        int                       `json:"counterKeyType"`
	Timeframe             int                       `json:"timeframe"`
	BlockTime             int                       `json:"blockTime"`
	ChainedRuleConditions []WafChainedRuleCondition `json:"chainedRuleConditions"`
}

RateLimitConfig holds the configuration for a rate limit rule.

type RateLimitRule

type RateLimitRule struct {
	Id                int64            `json:"id"`
	ShieldZoneId      int64            `json:"shieldZoneId"`
	UserId            string           `json:"userId"`
	RuleName          string           `json:"ruleName"`
	RuleDescription   string           `json:"ruleDescription"`
	RuleJson          string           `json:"ruleJson"`
	RuleConfiguration *RateLimitConfig `json:"ruleConfiguration"`
}

RateLimitRule represents a rate limiting rule.

type RateLimitRuleCreate

type RateLimitRuleCreate struct {
	ShieldZoneId      int64            `json:"shieldZoneId"`
	RuleName          string           `json:"ruleName"`
	RuleDescription   string           `json:"ruleDescription,omitempty"`
	RuleConfiguration *RateLimitConfig `json:"ruleConfiguration"`
}

RateLimitRuleCreate holds the fields for creating a rate limit rule.

type RateLimitRuleUpdate

type RateLimitRuleUpdate struct {
	RuleName          *string          `json:"ruleName,omitempty"`
	RuleDescription   *string          `json:"ruleDescription,omitempty"`
	RuleConfiguration *RateLimitConfig `json:"ruleConfiguration,omitempty"`
}

RateLimitRuleUpdate holds the fields for updating a rate limit rule.

type RatelimitMetrics

type RatelimitMetrics struct {
	TotalBreaches      int64 `json:"totalBreaches"`
	LoggedBreaches     int64 `json:"loggedBreaches"`
	ChallengedBreaches int64 `json:"challengedBreaches"`
	BlockedBreaches    int64 `json:"blockedBreaches"`
}

RatelimitMetrics holds rate limit metrics.

type Region

type Region struct {
	Id                  int64   `json:"Id"`
	Name                string  `json:"Name"`
	PricePerGigabyte    float64 `json:"PricePerGigabyte"`
	RegionCode          string  `json:"RegionCode"`
	ContinentCode       string  `json:"ContinentCode"`
	CountryCode         string  `json:"CountryCode"`
	Latitude            float64 `json:"Latitude"`
	Longitude           float64 `json:"Longitude"`
	AllowLatencyRouting bool    `json:"AllowLatencyRouting"`
}

Region represents a bunny.net CDN region/point of presence.

type ShieldOverview

type ShieldOverview struct {
	DDoSMitigated          int64 `json:"dDoSMitigated"`
	WafTriggeredRules      int64 `json:"wafTriggeredRules"`
	RatelimitBreaches      int64 `json:"ratelimitBreaches"`
	BotDetectionChallenged int64 `json:"botDetectionChallenged"`
	AccessListActions      int64 `json:"accessListActions"`
	UploadScanningBlocks   int64 `json:"uploadScanningBlocks"`
}

ShieldOverview holds high-level shield metric totals.

type ShieldOverviewMetricsData

type ShieldOverviewMetricsData struct {
	Waf                            *OverviewMetric `json:"waf"`
	DDoS                           *OverviewMetric `json:"ddos"`
	RateLimit                      *OverviewMetric `json:"rateLimit"`
	AccessLists                    *OverviewMetric `json:"accessLists"`
	BotDetection                   *OverviewMetric `json:"botDetection"`
	UploadScanning                 *OverviewMetric `json:"uploadScanning"`
	TotalCleanRequestsLimit        int64           `json:"totalCleanRequestsLimit"`
	TotalBillableRequestsThisMonth int64           `json:"totalBillableRequestsThisMonth"`
	Resolution                     int             `json:"resolution"`
}

ShieldOverviewMetricsData holds detailed overview metrics with time-series data.

type ShieldZone

type ShieldZone struct {
	ShieldZoneId                         int64                     `json:"shieldZoneId"`
	PullZoneId                           int64                     `json:"pullZoneId"`
	UserId                               string                    `json:"userId"`
	PlanType                             int                       `json:"planType"`
	DeletedDateTime                      string                    `json:"deletedDateTime"`
	LearningMode                         bool                      `json:"learningMode"`
	LearningModeUntil                    string                    `json:"learningModeUntil"`
	WafEnabled                           bool                      `json:"wafEnabled"`
	WafExecutionMode                     int                       `json:"wafExecutionMode"`
	WafDisabledRuleGroups                json.RawMessage           `json:"wafDisabledRuleGroups"`
	WafDisabledRules                     json.RawMessage           `json:"wafDisabledRules"`
	WafLogOnlyRules                      json.RawMessage           `json:"wafLogOnlyRules"`
	WafRequestHeaderLoggingEnabled       bool                      `json:"wafRequestHeaderLoggingEnabled"`
	WafRequestIgnoredHeaders             json.RawMessage           `json:"wafRequestIgnoredHeaders"`
	WafRealtimeThreatIntelligenceEnabled bool                      `json:"wafRealtimeThreatIntelligenceEnabled"`
	WafRequestBodyLimitAction            int                       `json:"wafRequestBodyLimitAction"`
	WafResponseBodyLimitAction           int                       `json:"wafResponseBodyLimitAction"`
	WafProfileId                         int                       `json:"wafProfileId"`
	DDoSEnabled                          bool                      `json:"dDoSEnabled"`
	DDoSShieldSensitivity                int                       `json:"dDoSShieldSensitivity"`
	DDoSExecutionMode                    int                       `json:"dDoSExecutionMode"`
	DDoSBlockingMode                     int                       `json:"dDoSBlockingMode"`
	DDoSChallengeWindow                  int                       `json:"dDoSChallengeWindow"`
	DDoSRequestVariationSensitivity      int                       `json:"dDoSRequestVariationSensitivity"`
	TotalWAFCustomRules                  int                       `json:"totalWAFCustomRules"`
	TotalRateLimitRules                  int                       `json:"totalRateLimitRules"`
	LastModified                         string                    `json:"lastModified"`
	CreatedDateTime                      string                    `json:"createdDateTime"`
	WhitelabelResponsePages              bool                      `json:"whitelabelResponsePages"`
	BotDetectionConfiguration            *BotDetectionConfig       `json:"botDetectionConfiguration"`
	UploadScanningConfiguration          *UploadScanningConfig     `json:"uploadScanningConfiguration"`
	AccessListConfigurations             []AccessListConfiguration `json:"accessListConfigurations"`
}

ShieldZone represents a bunny.net Shield zone configuration.

type ShieldZoneBotDetectionMetrics

type ShieldZoneBotDetectionMetrics struct {
	TotalLoggedRequests     int64 `json:"totalLoggedRequests"`
	TotalChallengedRequests int64 `json:"totalChallengedRequests"`
}

ShieldZoneBotDetectionMetrics holds bot detection metrics for a shield zone.

type ShieldZoneCreate

type ShieldZoneCreate struct {
	PullZoneId int64 `json:"pullZoneId"`
}

ShieldZoneCreate holds the fields for creating a shield zone.

type ShieldZoneMetrics

type ShieldZoneMetrics struct {
	Overview                *ShieldOverview      `json:"overview"`
	Waf                     *WafMetrics          `json:"waf"`
	DDoS                    *DDoSMetrics         `json:"dDoS"`
	Ratelimit               *RatelimitMetrics    `json:"ratelimit"`
	BotDetection            *BotDetectionMetrics `json:"botDetection"`
	AccessList              *AccessListMetrics   `json:"accessList"`
	TotalCleanRequestsLimit int64                `json:"totalCleanRequestsLimit"`
	TotalBillableRequests   int64                `json:"totalBillableRequests"`
}

ShieldZoneMetrics holds overview metrics for a shield zone.

type ShieldZoneRateLimitMetrics

type ShieldZoneRateLimitMetrics struct {
	RatelimitId int64             `json:"ratelimitId"`
	Overview    *RatelimitMetrics `json:"overview"`
}

ShieldZoneRateLimitMetrics holds metrics for a single rate limit rule.

type ShieldZoneResponse

type ShieldZoneResponse struct {
	ShieldZoneId                         int64  `json:"shieldZoneId"`
	PullZoneId                           int64  `json:"pullZoneId"`
	LearningMode                         bool   `json:"learningMode"`
	LearningModeUntil                    string `json:"learningModeUntil"`
	WafEnabled                           bool   `json:"wafEnabled"`
	WafExecutionMode                     int    `json:"wafExecutionMode"`
	WafDisabledRules                     string `json:"wafDisabledRules"`
	WafLogOnlyRules                      string `json:"wafLogOnlyRules"`
	WafRequestHeaderLoggingEnabled       bool   `json:"wafRequestHeaderLoggingEnabled"`
	WafRealtimeThreatIntelligenceEnabled bool   `json:"wafRealtimeThreatIntelligenceEnabled"`
	WafProfileId                         int    `json:"wafProfileId"`
	WafRequestBodyLimitAction            int    `json:"wafRequestBodyLimitAction"`
	WafResponseBodyLimitAction           int    `json:"wafResponseBodyLimitAction"`
	PlanType                             int    `json:"planType"`
	DDoSShieldSensitivity                int    `json:"dDoSShieldSensitivity"`
	DDoSExecutionMode                    int    `json:"dDoSExecutionMode"`
	DDoSChallengeWindow                  int    `json:"dDoSChallengeWindow"`
	WhitelabelResponsePages              bool   `json:"whitelabelResponsePages"`
	RateLimitRulesLimit                  int    `json:"rateLimitRulesLimit"`
	CustomWafRulesLimit                  int    `json:"customWafRulesLimit"`
}

ShieldZoneResponse is the response returned by create/update operations (fewer fields than full ShieldZone).

type ShieldZoneUpdate

type ShieldZoneUpdate struct {
	LearningMode                         *bool   `json:"learningMode,omitempty"`
	LearningModeUntil                    *string `json:"learningModeUntil,omitempty"`
	WafEnabled                           *bool   `json:"wafEnabled,omitempty"`
	WafExecutionMode                     *int    `json:"wafExecutionMode,omitempty"`
	WafDisabledRules                     *string `json:"wafDisabledRules,omitempty"`
	WafLogOnlyRules                      *string `json:"wafLogOnlyRules,omitempty"`
	WafRequestHeaderLoggingEnabled       *bool   `json:"wafRequestHeaderLoggingEnabled,omitempty"`
	WafRequestIgnoredHeaders             *string `json:"wafRequestIgnoredHeaders,omitempty"`
	WafRealtimeThreatIntelligenceEnabled *bool   `json:"wafRealtimeThreatIntelligenceEnabled,omitempty"`
	WafProfileId                         *int    `json:"wafProfileId,omitempty"`
	WafRequestBodyLimitAction            *int    `json:"wafRequestBodyLimitAction,omitempty"`
	WafResponseBodyLimitAction           *int    `json:"wafResponseBodyLimitAction,omitempty"`
	DDoSShieldSensitivity                *int    `json:"dDoSShieldSensitivity,omitempty"`
	DDoSExecutionMode                    *int    `json:"dDoSExecutionMode,omitempty"`
	DDoSChallengeWindow                  *int    `json:"dDoSChallengeWindow,omitempty"`
	WhitelabelResponsePages              *bool   `json:"whitelabelResponsePages,omitempty"`
}

ShieldZoneUpdate holds the fields for updating a shield zone.

type ShieldZoneUploadScanningMetrics

type ShieldZoneUploadScanningMetrics struct {
	TotalLoggedRequests  int64 `json:"totalLoggedRequests"`
	TotalBlockedRequests int64 `json:"totalBlockedRequests"`
	TotalFilesScanned    int64 `json:"totalFilesScanned"`
}

ShieldZoneUploadScanningMetrics holds upload scanning metrics for a shield zone.

type Statistics

type Statistics struct {
	TotalBandwidthUsed                     int64              `json:"TotalBandwidthUsed"`
	TotalOriginTraffic                     int64              `json:"TotalOriginTraffic"`
	AverageOriginResponseTime              int32              `json:"AverageOriginResponseTime"`
	TotalRequestsServed                    int64              `json:"TotalRequestsServed"`
	CacheHitRate                           float64            `json:"CacheHitRate"`
	BandwidthUsedChart                     map[string]float64 `json:"BandwidthUsedChart"`
	BandwidthCachedChart                   map[string]float64 `json:"BandwidthCachedChart"`
	CacheHitRateChart                      map[string]float64 `json:"CacheHitRateChart"`
	RequestsServedChart                    map[string]float64 `json:"RequestsServedChart"`
	OriginResponseTimeChart                map[string]float64 `json:"OriginResponseTimeChart"`
	OriginTrafficChart                     map[string]float64 `json:"OriginTrafficChart"`
	OriginShieldBandwidthUsedChart         map[string]float64 `json:"OriginShieldBandwidthUsedChart"`
	OriginShieldInternalBandwidthUsedChart map[string]float64 `json:"OriginShieldInternalBandwidthUsedChart"`
	PullRequestsPulledChart                map[string]float64 `json:"PullRequestsPulledChart"`
	UserBalanceHistoryChart                map[string]float64 `json:"UserBalanceHistoryChart"`
	GeoTrafficDistribution                 map[string]int64   `json:"GeoTrafficDistribution"`
	Error3xxChart                          map[string]float64 `json:"Error3xxChart"`
	Error4xxChart                          map[string]float64 `json:"Error4xxChart"`
	Error5xxChart                          map[string]float64 `json:"Error5xxChart"`
}

Statistics represents the bunny.net global statistics response.

type StatisticsOptions

type StatisticsOptions struct {
	DateFrom                          string
	DateTo                            string
	PullZone                          int64
	ServerZoneId                      int64
	LoadErrors                        bool
	Hourly                            bool
	LoadOriginResponseTimes           bool
	LoadOriginTraffic                 bool
	LoadRequestsServed                bool
	LoadBandwidthUsed                 bool
	LoadOriginShieldBandwidth         bool
	LoadGeographicTrafficDistribution bool
	LoadUserBalanceHistory            bool
}

StatisticsOptions configures the statistics query.

type StatusModel

type StatusModel struct {
	Success    bool   `json:"success"`
	Message    string `json:"message"`
	StatusCode int    `json:"statusCode"`
}

StatusModel represents a generic status response from the Stream API.

type StorageClient

type StorageClient struct {
	// contains filtered or unexported fields
}

StorageClient is an HTTP client for the bunny.net Edge Storage API. Unlike the main Client, this handles binary file operations and uses per-zone password authentication.

func NewStorageClient

func NewStorageClient(cfg StorageClientConfig) (*StorageClient, error)

NewStorageClient creates a configured StorageClient for Edge Storage operations.

func (*StorageClient) DeleteFile

func (c *StorageClient) DeleteFile(ctx context.Context, zoneName, path string) error

DeleteFile deletes a file or directory from Edge Storage. If the target is a directory, all contents are deleted recursively.

func (*StorageClient) DownloadFile

func (c *StorageClient) DownloadFile(ctx context.Context, zoneName, path string) (io.ReadCloser, int64, error)

DownloadFile downloads a file from Edge Storage. The caller is responsible for closing the returned ReadCloser.

func (*StorageClient) ListFiles

func (c *StorageClient) ListFiles(ctx context.Context, zoneName, path string) ([]StorageObject, error)

ListFiles returns the contents of a directory in Edge Storage.

func (*StorageClient) UploadFile

func (c *StorageClient) UploadFile(ctx context.Context, zoneName, path string, body io.Reader, size int64, checksum string) error

UploadFile uploads a file to Edge Storage. If checksum is non-empty, it is sent as an uppercase hex SHA256 Checksum header.

type StorageClientConfig

type StorageClientConfig struct {
	// Password is the per-zone storage zone password used for authentication.
	Password string
	// Hostname is the storage API hostname (e.g., "storage.bunnycdn.com").
	Hostname string
	// IsJSON reports whether the current output format is JSON-based.
	IsJSON func() bool
}

StorageClientConfig holds the configuration needed to create an Edge Storage client.

type StorageObject

type StorageObject struct {
	Guid            string `json:"Guid"`
	StorageZoneName string `json:"StorageZoneName"`
	Path            string `json:"Path"`
	ObjectName      string `json:"ObjectName"`
	Length          int64  `json:"Length"`
	LastChanged     string `json:"LastChanged"`
	IsDirectory     bool   `json:"IsDirectory"`
	ServerId        int    `json:"ServerId"`
	DateCreated     string `json:"DateCreated"`
	StorageZoneId   int64  `json:"StorageZoneId"`
}

StorageObject represents a file or directory in Edge Storage.

type StorageZone

type StorageZone struct {
	Id                          int64      `json:"Id"`
	Name                        string     `json:"Name"`
	Password                    string     `json:"Password"`
	ReadOnlyPassword            string     `json:"ReadOnlyPassword"`
	DateModified                string     `json:"DateModified"`
	Deleted                     bool       `json:"Deleted"`
	StorageUsed                 int64      `json:"StorageUsed"`
	FilesStored                 int64      `json:"FilesStored"`
	Region                      string     `json:"Region"`
	ReplicationRegions          []string   `json:"ReplicationRegions"`
	StorageHostname             string     `json:"StorageHostname"`
	ZoneTier                    int        `json:"ZoneTier"`
	ReplicationChangeInProgress bool       `json:"ReplicationChangeInProgress"`
	Custom404FilePath           string     `json:"Custom404FilePath"`
	Rewrite404To200             bool       `json:"Rewrite404To200"`
	PullZones                   []PullZone `json:"PullZones"`
}

StorageZone represents a bunny.net storage zone.

type StorageZoneCreate

type StorageZoneCreate struct {
	Name               string   `json:"Name"`
	Region             string   `json:"Region"`
	ReplicationRegions []string `json:"ReplicationRegions,omitempty"`
	ZoneTier           int      `json:"ZoneTier,omitempty"`
}

StorageZoneCreate holds the fields for creating a storage zone.

type StorageZoneUpdate

type StorageZoneUpdate struct {
	ReplicationZones  []string `json:"ReplicationZones,omitempty"`
	OriginUrl         *string  `json:"OriginUrl,omitempty"`
	Custom404FilePath *string  `json:"Custom404FilePath,omitempty"`
	Rewrite404To200   *bool    `json:"Rewrite404To200,omitempty"`
}

StorageZoneUpdate holds the fields for updating a storage zone. Pointer types allow distinguishing between "not set" and "set to zero value".

type TranscribeSettings

type TranscribeSettings struct {
	TargetLanguages     []string `json:"targetLanguages,omitempty"`
	SourceLanguage      string   `json:"sourceLanguage,omitempty"`
	GenerateTitle       bool     `json:"generateTitle,omitempty"`
	GenerateDescription bool     `json:"generateDescription,omitempty"`
	GenerateChapters    bool     `json:"generateChapters,omitempty"`
	GenerateMoments     bool     `json:"generateMoments,omitempty"`
}

TranscribeSettings holds settings for video transcription.

type TriggeredRule

type TriggeredRule struct {
	RuleId                 string `json:"ruleId"`
	RuleDescription        string `json:"ruleDescription"`
	TotalTriggeredRequests int64  `json:"totalTriggeredRequests"`
}

TriggeredRule represents a WAF rule that has been triggered.

type TriggeredRuleUpdate

type TriggeredRuleUpdate struct {
	RuleId string `json:"ruleId"`
	Action int    `json:"action"`
}

TriggeredRuleUpdate holds the fields for updating a triggered rule's review action.

type UploadScanningConfig

type UploadScanningConfig struct {
	ShieldZoneId          int64 `json:"shieldZoneId"`
	IsEnabled             bool  `json:"isEnabled"`
	AntivirusScanningMode int   `json:"antivirusScanningMode"`
	CsamScanningMode      int   `json:"csamScanningMode"`
}

UploadScanningConfig represents upload scanning configuration for a shield zone.

type UploadScanningUpdate

type UploadScanningUpdate struct {
	ShieldZoneId          int64 `json:"shieldZoneId"`
	IsEnabled             *bool `json:"isEnabled,omitempty"`
	CsamScanningMode      *int  `json:"csamScanningMode,omitempty"`
	AntivirusScanningMode *int  `json:"antivirusScanningMode,omitempty"`
}

UploadScanningUpdate holds the fields for updating upload scanning configuration.

type Video

type Video struct {
	VideoLibraryId       int64     `json:"videoLibraryId"`
	Guid                 string    `json:"guid"`
	Title                string    `json:"title"`
	Description          string    `json:"description"`
	DateUploaded         string    `json:"dateUploaded"`
	Views                int64     `json:"views"`
	IsPublic             bool      `json:"isPublic"`
	Length               int       `json:"length"`
	Status               int       `json:"status"`
	Framerate            float64   `json:"framerate"`
	Width                int       `json:"width"`
	Height               int       `json:"height"`
	AvailableResolutions string    `json:"availableResolutions"`
	OutputCodecs         string    `json:"outputCodecs"`
	ThumbnailCount       int       `json:"thumbnailCount"`
	EncodeProgress       int       `json:"encodeProgress"`
	StorageSize          int64     `json:"storageSize"`
	HasMP4Fallback       bool      `json:"hasMP4Fallback"`
	CollectionId         string    `json:"collectionId"`
	ThumbnailFileName    string    `json:"thumbnailFileName"`
	AverageWatchTime     int64     `json:"averageWatchTime"`
	TotalWatchTime       int64     `json:"totalWatchTime"`
	Category             string    `json:"category"`
	Captions             []Caption `json:"captions"`
	Chapters             []Chapter `json:"chapters"`
	Moments              []Moment  `json:"moments"`
	MetaTags             []MetaTag `json:"metaTags"`
}

Video represents a video in a bunny.net stream library.

type VideoCreate

type VideoCreate struct {
	Title         string `json:"title"`
	CollectionId  string `json:"collectionId,omitempty"`
	ThumbnailTime int    `json:"thumbnailTime,omitempty"`
}

VideoCreate holds the fields for creating a video record.

type VideoFetch

type VideoFetch struct {
	Url     string            `json:"url"`
	Headers map[string]string `json:"headers,omitempty"`
	Title   string            `json:"title,omitempty"`
}

VideoFetch holds the fields for fetching a video from a URL.

type VideoHeatmap

type VideoHeatmap struct {
	Heatmap map[string]int `json:"heatmap"`
}

VideoHeatmap holds heatmap data for a video.

type VideoLibrary

type VideoLibrary struct {
	Id                 int64    `json:"Id"`
	Name               string   `json:"Name"`
	VideoCount         int64    `json:"VideoCount"`
	TrafficUsage       int64    `json:"TrafficUsage"`
	StorageUsage       int64    `json:"StorageUsage"`
	DateCreated        string   `json:"DateCreated"`
	DateModified       string   `json:"DateModified"`
	ApiKey             string   `json:"ApiKey"`
	ReadOnlyApiKey     string   `json:"ReadOnlyApiKey"`
	PullZoneId         int64    `json:"PullZoneId"`
	StorageZoneId      int64    `json:"StorageZoneId"`
	EnabledResolutions string   `json:"EnabledResolutions"`
	EnableMP4Fallback  bool     `json:"EnableMP4Fallback"`
	KeepOriginalFiles  bool     `json:"KeepOriginalFiles"`
	EnableDRM          bool     `json:"EnableDRM"`
	AllowDirectPlay    bool     `json:"AllowDirectPlay"`
	EnableTranscribing bool     `json:"EnableContentTagging"`
	ReplicationRegions []string `json:"ReplicationRegions"`
	WebhookUrl         string   `json:"WebhookUrl"`
	HasWatermark       bool     `json:"HasWatermark"`
}

VideoLibrary represents a bunny.net video library.

type VideoLibraryCreate

type VideoLibraryCreate struct {
	Name               string   `json:"Name"`
	ReplicationRegions []string `json:"ReplicationRegions,omitempty"`
}

VideoLibraryCreate holds the fields for creating a video library.

type VideoLibraryLanguage

type VideoLibraryLanguage struct {
	ShortCode       string `json:"ShortCode"`
	Name            string `json:"Name"`
	SupportLevel    int    `json:"SupportLevel"`
	TranslateFromEn bool   `json:"TranslateFromEn"`
}

VideoLibraryLanguage represents a supported transcription language.

type VideoLibraryUpdate

type VideoLibraryUpdate struct {
	Name               *string  `json:"Name,omitempty"`
	EnabledResolutions *string  `json:"EnabledResolutions,omitempty"`
	EnableMP4Fallback  *bool    `json:"EnableMP4Fallback,omitempty"`
	KeepOriginalFiles  *bool    `json:"KeepOriginalFiles,omitempty"`
	AllowDirectPlay    *bool    `json:"AllowDirectPlay,omitempty"`
	EnableDRM          *bool    `json:"EnableDRM,omitempty"`
	WebhookUrl         *string  `json:"WebhookUrl,omitempty"`
	ReplicationRegions []string `json:"ReplicationRegions,omitempty"`
}

VideoLibraryUpdate holds the fields for updating a video library. Pointer types allow distinguishing between "not set" and "set to zero value".

type VideoStatistics

type VideoStatistics struct {
	ViewsChart        map[string]int64 `json:"viewsChart"`
	WatchTimeChart    map[string]int64 `json:"watchTimeChart"`
	CountryViewCounts map[string]int64 `json:"countryViewCounts"`
	CountryWatchTime  map[string]int64 `json:"countryWatchTime"`
	EngagementScore   int              `json:"engagementScore"`
}

VideoStatistics holds statistics for a video library.

type VideoUpdate

type VideoUpdate struct {
	Title        *string    `json:"title,omitempty"`
	CollectionId *string    `json:"collectionId,omitempty"`
	Chapters     *[]Chapter `json:"chapters,omitempty"`
	Moments      *[]Moment  `json:"moments,omitempty"`
	MetaTags     *[]MetaTag `json:"metaTags,omitempty"`
}

VideoUpdate holds the fields for updating a video.

type WafChainedRuleCondition

type WafChainedRuleCondition struct {
	VariableTypes map[string]string `json:"variableTypes"`
	OperatorType  int               `json:"operatorType"`
	Value         string            `json:"value"`
}

WafChainedRuleCondition represents a chained condition in a WAF rule.

type WafConfigVariable

type WafConfigVariable struct {
	Name         string `json:"name"`
	ValueEncoded string `json:"valueEncoded"`
}

WafConfigVariable represents a WAF engine configuration variable.

type WafEngineConfig

type WafEngineConfig struct {
	Variables []WafConfigVariable `json:"data"`
}

WafEngineConfig holds WAF engine configuration data.

type WafMetrics

type WafMetrics struct {
	TotalTriggeredRules int64 `json:"totalTriggeredRules"`
	BlockedRequests     int64 `json:"blockedRequests"`
	LoggedRequests      int64 `json:"loggedRequests"`
	ChallengedRequests  int64 `json:"challengedRequests"`
}

WafMetrics holds WAF-specific metrics.

type WafProfile

type WafProfile struct {
	Id              int    `json:"id"`
	Name            string `json:"name"`
	IsPremium       bool   `json:"isPremium"`
	ProfileCategory string `json:"profileCategory"`
	ImageUrl        string `json:"imageUrl"`
	Description     string `json:"description"`
	Features        string `json:"features"`
}

WafProfile represents a WAF profile.

type WafRule

type WafRule struct {
	RuleId      int    `json:"ruleId"`
	Description string `json:"description"`
}

WafRule represents an individual managed WAF rule.

type WafRuleConfig

type WafRuleConfig struct {
	ActionType            int                       `json:"actionType"`
	VariableTypes         map[string]string         `json:"variableTypes"`
	OperatorType          int                       `json:"operatorType"`
	SeverityType          int                       `json:"severityType"`
	TransformationTypes   []int                     `json:"transformationTypes"`
	Value                 string                    `json:"value"`
	ChainedRuleConditions []WafChainedRuleCondition `json:"chainedRuleConditions"`
}

WafRuleConfig holds the configuration for a custom WAF rule.

type WafRuleGroup

type WafRuleGroup struct {
	Id          int       `json:"id"`
	Name        string    `json:"name"`
	Code        string    `json:"code"`
	FileName    string    `json:"fileName"`
	MainGroup   string    `json:"mainGroup"`
	Ruleset     string    `json:"ruleset"`
	Description string    `json:"description"`
	Rules       []WafRule `json:"rules"`
}

WafRuleGroup represents a WAF rule group within a main group.

type WafRuleMainGroup

type WafRuleMainGroup struct {
	Name       string         `json:"name"`
	Ruleset    string         `json:"ruleset"`
	RuleGroups []WafRuleGroup `json:"ruleGroups"`
}

WafRuleMainGroup represents a top-level WAF rule group.

type WafRuleMetrics

type WafRuleMetrics struct {
	TotalTriggers      int64 `json:"totalTriggers"`
	BlockedRequests    int64 `json:"blockedRequests"`
	LoggedRequests     int64 `json:"loggedRequests"`
	ChallengedRequests int64 `json:"challengedRequests"`
}

WafRuleMetrics holds metrics for a single WAF rule.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL