bunny-go is an unofficial Go package to interact with the Bunny.net HTTP API.
It aims to be a low-level API that represents the Bunny API as close as possible.
The package only deviates from the API when it is necessary to prevent confusions.
The following API Endpoints are supported:
- bunny.net API
- Billing
- Pull Zone
- Add
- Update
- Delete
- Get
- List
- Delete Edge Rule
- Add/Update Edge Rule
- Set Edge Rule Enabled
- Get Statistics
- Purge Cache
- Load Free Certificate
- Add Custom Certificate
- Remove Certificate
- Add Custom Hostname
- Remove Custom Hostname
- Set Force SSL
- Reset Token Key
- Add Allowed Referer
- Remove Allowed Referer
- Add Blocked Referer
- Remove Blocked Referer
- Add Blocked IP
- Remove Blocked IP
- Purge
- Statistics
- Storage Zone
- List Storage Zones
- Add Storage Zone
- Get Storage Zone
- Update Storage Zone
- Delete Storage Zone
- Reset Password
- Reset Read-Only Password
- User
- DNS Zone
- List DNS Zones
- Add DNS Zone
- Get DNS Zone
- Update DNS Zones
- Delete DNS Zone
- Export DNS Zone
- Get DNS Query Statistics
- Add DNS Record
- Update DNS Record
- Delete DNS Record
- Recheck DNS Configuration
- Dismiss DNS Configuration Notice
- Import DNS Records
- Stream Video Library
- List Video Libraries
- Add Video Library
- Get Video Library
- Update Video Library
- Delete Video Library
- Reset Password
- Reset Password
- Add Watermark
- Delete Watermark
- Add Allowed Referer
- Remove Allowed Referer
- Add Blocked Referer
- Remove Blocked Referer
- Edge Storage API
- URL parameters are always passed by value as method parameter.
- Data that is sent in the HTTP body is passed as struct pointer to API methods.
- Pointers instead of values are used to represent fields in body message
structs.
The bunny.net API does not define which values are assumed if a field is omitted in a request. Using pointers allows to distinguish between empty fields and Golang's default values for types. This prevents discrepancy between the interpretation of missing fields of the bunny.net API and bunny-go. Without using pointers it is for example not possible to distinguish between a missing integer field in a JSON message and an integer that has a0
value. - Message field names should be as close as possible to the JSON message field names. Exception are permitted if the field in the JSON messages are inconsistent and different names are used in the API for the same setting. If names are inconsistent, the variant that is closer to the naming in the Bunny.Net Admin Panel should be chosen. The exception must be documented in the godoc.
To run the integration test a Bunny.Net API Key is required.
The integration tests will create, modify and delete resources on your Bunny.Net
account. Therefore it is strongly recommended to use a Bunny.Net account
that is not used in production environments.
Bunny.Net might charge your account for certain API operations.
The integrationtest should remove all resources that they create. It can happen
that cleaning up the resources fails and the account will contain test
leftovers.
export BUNNY_API_KEY=MY-API-KEY
make integrationtests
The package is under initial development and should be considered as unstable.