Documentation ¶
Overview ¶
Package bunny provides functionality to interact with the Bunny CDN HTTP API.
Example ¶
package main import ( "context" "fmt" "log" "os" bunny "github.com/ezitisitis/bunny-go" ) func main() { apiKey := os.Getenv("BUNNY_API_KEY") clt := bunny.NewClient(apiKey) pz, err := clt.PullZone.Get(context.Background(), 1234) if err != nil { log.Fatal(err) } fmt.Printf("pull zone name: %s\n", *pz.Name) }
Output:
Index ¶
- Constants
- type APIError
- type AddCustomHostnameOptions
- type AddOrUpdateDNSRecordOptions
- type AddOrUpdateEdgeRuleOptions
- type AuthenticationError
- type Client
- type DNSRecord
- type DNSZone
- type DNSZoneService
- func (s *DNSZoneService) Add(ctx context.Context, opts *DNSZone) (*DNSZone, error)
- func (s *DNSZoneService) AddDNSRecord(ctx context.Context, dnsZoneID int64, opts *AddOrUpdateDNSRecordOptions) (*DNSRecord, error)
- func (s *DNSZoneService) Delete(ctx context.Context, id int64) error
- func (s *DNSZoneService) DeleteDNSRecord(ctx context.Context, dnsZoneID int64, dnsRecordID int64) error
- func (s *DNSZoneService) Get(ctx context.Context, id int64) (*DNSZone, error)
- func (s *DNSZoneService) List(ctx context.Context, opts *PaginationOptions) (*DNSZones, error)
- func (s *DNSZoneService) Update(ctx context.Context, id int64, opts *DNSZoneUpdateOptions) (*DNSZone, error)
- func (s *DNSZoneService) UpdateDNSRecord(ctx context.Context, dnsZoneID int64, dnsRecordID int64, ...) error
- type DNSZoneUpdateOptions
- type DNSZones
- type EdgeRule
- type EdgeRuleTrigger
- type EnvironmentalVariable
- type HTTPError
- type Hostname
- type IPGeoLocationInfo
- type Logf
- type Option
- type PaginationOptions
- type PaginationReply
- type PullZone
- type PullZoneAddCustomCertificateOptions
- type PullZoneAddOptions
- type PullZoneService
- func (s *PullZoneService) Add(ctx context.Context, opts *PullZoneAddOptions) (*PullZone, error)
- func (s *PullZoneService) AddCustomCertificate(ctx context.Context, pullZoneID int64, ...) error
- func (s *PullZoneService) AddCustomHostname(ctx context.Context, pullZoneID int64, opts *AddCustomHostnameOptions) error
- func (s *PullZoneService) AddOrUpdateEdgeRule(ctx context.Context, pullZoneID int64, opts *AddOrUpdateEdgeRuleOptions) error
- func (s *PullZoneService) Delete(ctx context.Context, id int64) error
- func (s *PullZoneService) DeleteEdgeRule(ctx context.Context, pullZoneID int64, edgeRuleGUID string) error
- func (s *PullZoneService) Get(ctx context.Context, id int64) (*PullZone, error)
- func (s *PullZoneService) List(ctx context.Context, opts *PaginationOptions) (*PullZones, error)
- func (s *PullZoneService) LoadFreeCertificate(ctx context.Context, hostname string) error
- func (s *PullZoneService) RemoveCertificate(ctx context.Context, pullZoneID int64, opts *RemoveCertificateOptions) error
- func (s *PullZoneService) RemoveCustomHostname(ctx context.Context, pullZoneID int64, opts *RemoveCustomHostnameOptions) error
- func (s *PullZoneService) SetEdgeRuleEnabled(ctx context.Context, pullZoneID int64, edgeRuleGUID string, ...) error
- func (s *PullZoneService) SetForceSSL(ctx context.Context, pullzoneID int64, opts *SetForceSSLOptions) error
- func (s *PullZoneService) Update(ctx context.Context, id int64, opts *PullZoneUpdateOptions) (*PullZone, error)
- type PullZoneUpdateOptions
- type PullZones
- type RemoveCertificateOptions
- type RemoveCustomHostnameOptions
- type SetEdgeRuleEnabledOptions
- type SetForceSSLOptions
- type StorageZone
- type StorageZoneAddOptions
- type StorageZoneService
- func (s *StorageZoneService) Add(ctx context.Context, opts *StorageZoneAddOptions) (*StorageZone, error)
- func (s *StorageZoneService) Delete(ctx context.Context, id int64) error
- func (s *StorageZoneService) Get(ctx context.Context, id int64) (*StorageZone, error)
- func (s *StorageZoneService) List(ctx context.Context, opts *PaginationOptions) (*StorageZones, error)
- func (s *StorageZoneService) Update(ctx context.Context, id int64, opts *StorageZoneUpdateOptions) error
- type StorageZoneUpdateOptions
- type StorageZones
- type VideoLibraries
- type VideoLibrary
- type VideoLibraryAddOptions
- type VideoLibraryGetOpts
- type VideoLibraryListOpts
- type VideoLibraryService
- func (s *VideoLibraryService) Add(ctx context.Context, opts *VideoLibraryAddOptions) (*VideoLibrary, error)
- func (s *VideoLibraryService) Delete(ctx context.Context, id int64) error
- func (s *VideoLibraryService) Get(ctx context.Context, id int64, opts *VideoLibraryGetOpts) (*VideoLibrary, error)
- func (s *VideoLibraryService) List(ctx context.Context, opts *VideoLibraryListOpts) (*VideoLibraries, error)
- func (s *VideoLibraryService) Update(ctx context.Context, id int64, opts *VideoLibraryUpdateOptions) (*VideoLibrary, error)
- type VideoLibraryUpdateOptions
Examples ¶
Constants ¶
const ( // BaseURL is the base URL of the Bunny CDN HTTP API. BaseURL = "https://api.bunny.net" // AccessKeyHeaderKey is the name of the HTTP header that contains the Bunny API key. AccessKeyHeaderKey = "AccessKey" // DefaultUserAgent is the default value of the sent HTTP User-Agent header. DefaultUserAgent = "bunny-go" )
const ( DNSRecordTypeA int = 0 DNSRecordTypeAAAA int = 1 DNSRecordTypeCNAME int = 2 DNSRecordTypeTXT int = 3 DNSRecordTypeMX int = 4 DNSRecordTypeRDR int = 5 // Bunny.NET Redirect custom record DNSRecordTypePZ int = 7 // Bunny.NET Pull Zone custom record DNSRecordTypeSRV int = 8 DNSRecordTypeCAA int = 9 DNSRecordTypePTR int = 10 DNSRecordTypeSCR int = 11 // Bunny.NET Script custom record DNSRecordTypeNS int = 12 )
Constants for the Type field of a DNS Record
const ( EdgeRuleActionTypeForceSSL int = iota EdgeRuleActionTypeRedirect EdgeRuleActionTypeOriginURL EdgeRuleActionTypeOverrideCacheTime EdgeRuleActionTypeBlockRequest EdgeRuleActionTypeSetResponseHeader EdgeRuleActionTypeSetRequestHeader EdgeRuleActionTypeForceDownload EdgeRuleActionTypeDisableTokenAuthentication EdgeRuleActionTypeEnableTokenAuthentication EdgeRuleActionTypeOverrideCacheTimePublic EdgeRuleActionTypeIgnoreQueryString EdgeRuleActionTypeDisableOptimizer EdgeRuleActionTypeForceCompression EdgeRuleActionTypeSetStatusCode EdgeRuleActionTypeBypassPermaCache )
Constants for the ActionType fields of an EdgeRule.
const ( EdgeRuleTriggerTypeURL int = iota EdgeRuleTriggerTypeRequestHeader EdgeRuleTriggerTypeResponseHeader EdgeRuleTriggerTypeURLExtension EdgeRuleTriggerTypeCountryCode EdgeRuleTriggerTypeRemoteIP EdgeRuleTriggerTypeURLQueryString EdgeRuleTriggerTypeRandomChance EdgeRuleTriggerTypeStatusCode EdgeRuleTriggerTypeRequestMethod )
Constants for the Type field of an EdgeRuleTrigger.
const ( PullZoneTypeStandard int = 1 PullZoneTypeVolume int = 2 )
Constants for the Type fields of a Pull Zone.
const ( MatchingTypeAny int = iota MatchingTypeAll MatchingTypeNone )
Constants for the values of the PatternMatchingType of EdgeRuleTrigger and TriggerMatchingType of an EdgeRule.
const ( // DefaultPaginationPage is the default value that is used for // PaginationOptions.Page if it is unset. DefaultPaginationPage = 1 // DefaultPaginationPerPage is the default value that is used for // PaginationOptions.PerPage if it is unset. DefaultPaginationPerPage = 1000 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct { HTTPError ErrorKey string `json:"ErrorKey"` Field string `json:"Field"` Message string `json:"Message"` }
APIError represents an error that is returned by some Bunny API endpoints on failures.
type AddCustomHostnameOptions ¶
type AddCustomHostnameOptions struct { // Hostname the hostname to add. (Required) Hostname *string `json:"Hostname,omitempty"` }
AddCustomHostnameOptions represents the message that is sent to the Add Custom Hostname API Endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_addhostname
type AddOrUpdateDNSRecordOptions ¶
type AddOrUpdateDNSRecordOptions struct { ID *int64 `json:"Id,omitempty"` Type *int `json:"Type,omitempty"` TTL *int32 `json:"Ttl,omitempty"` Value *string `json:"Value,omitempty"` Name *string `json:"Name,omitempty"` Weight *int32 `json:"Weight,omitempty"` Priority *int32 `json:"Priority,omitempty"` Flags *int `json:"Flags,omitempty"` Tag *string `json:"Tag,omitempty"` Port *int32 `json:"Port,omitempty"` PullZoneID *int64 `json:"PullZoneId,omitempty"` ScriptID *int64 `json:"ScriptId,omitempty"` Accelerated *bool `json:"Accelerated,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"` EnvironmentalVariables []EnvironmentalVariable `json:"EnvironmentalVariables,omitempty"` }
AddOrUpdateDNSRecordOptions represents the message that is sent to the Add DNS Record API Endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/dnszonepublic_addrecord
type AddOrUpdateEdgeRuleOptions ¶
type AddOrUpdateEdgeRuleOptions struct { // GUID must only be set when updating an Edge Rule. When creating an // Edge Rule it must be unset. The API Endpoint will generate a GUID. GUID *string `json:"Guid,omitempty"` ActionType *int `json:"ActionType,omitempty"` ActionParameter1 *string `json:"ActionParameter1,omitempty"` ActionParameter2 *string `json:"ActionParameter2,omitempty"` Triggers []*EdgeRuleTrigger `json:"Triggers,omitempty"` TriggerMatchingType *int `json:"TriggerMatchingType,omitempty"` Description *string `json:"Description,omitempty"` Enabled *bool `json:"Enabled,omitempty"` }
AddOrUpdateEdgeRuleOptions is the message that is sent to the Add/Update Edge Rule API Endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_addedgerule
type AuthenticationError ¶
type AuthenticationError struct {
Message string
}
AuthenticationError represents an Unauthorized (401) HTTP error.
func (*AuthenticationError) Error ¶
func (e *AuthenticationError) Error() string
Error returns a textual representation of the error.
type Client ¶
type Client struct { PullZone *PullZoneService StorageZone *StorageZoneService DNSZone *DNSZoneService VideoLibrary *VideoLibraryService // contains filtered or unexported fields }
Client is a Bunny CDN HTTP API Client.
type DNSRecord ¶
type DNSRecord struct { ID *int64 `json:"Id,omitempty"` Type *int `json:"Type,omitempty"` TTL *int32 `json:"Ttl,omitempty"` Value *string `json:"Value,omitempty"` Name *string `json:"Name,omitempty"` Weight *int32 `json:"Weight,omitempty"` Priority *int32 `json:"Priority,omitempty"` Port *int32 `json:"Port,omitempty"` Flags *int `json:"Flags,omitempty"` Tag *string `json:"Tag,omitempty"` Accelerated *bool `json:"Accelerated,omitempty"` AcceleratedPullZoneID *int64 `json:"AcceleratedPullZoneId,omitempty"` LinkName *string `json:"LinkName,omitempty"` IPGeoLocationInfo *IPGeoLocationInfo `json:"IPGeoLocationInfo,omitempty"` MonitorStatus *int `json:"MonitorStatus,omitempty"` MonitorType *int `json:"MonitorType,omitempty"` GeolocationLatitude *float64 `json:"GeolocationLatitude,omitempty"` GeolocationLongitude *float64 `json:"GeolocationLongitude,omitempty"` EnvironmentalVariables []EnvironmentalVariable `json:"EnvironmentalVariables,omitempty"` LatencyZone *string `json:"LatencyZone,omitempty"` SmartRoutingType *int `json:"SmartRoutingType,omitempty"` Disabled *bool `json:"Disabled,omitempty"` }
DNSRecord represents individual DNS records for a DNS Zone.
Bunny.net API docs: https://docs.bunny.net/reference/dnszonepublic_index2 https://docs.bunny.net/reference/dnszonepublic_index
type DNSZone ¶
type DNSZone struct { ID *int64 `json:"Id,omitempty"` Domain *string `json:"Domain,omitempty"` Records []DNSRecord `json:"Records,omitempty"` DateModified *string `json:"DateModified,omitempty"` // Timestamp DateCreated *string `json:"DateCreated,omitempty"` // Timestamp NameserversDetected *bool `json:"NameserversDetected,omitempty"` CustomNameserversEnabled *bool `json:"CustomNameserversEnabled,omitempty"` Nameserver1 *string `json:"Nameserver1,omitempty"` Nameserver2 *string `json:"Nameserver2,omitempty"` SoaEmail *string `json:"SoaEmail,omitempty"` NameserversNextCheck *string `json:"NameserversNextCheck,omitempty"` // Timestamp LoggingEnabled *bool `json:"LoggingEnabled,omitempty"` LoggingIPAnonymizationEnabled *bool `json:"LoggingIPAnonymizationEnabled,omitempty"` LogAnonymizationType *int `json:"LogAnonymizationType,omitempty"` }
DNSZone represents the response of the the List and Get DNS Zone API endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/dnszonepublic_index2 https://docs.bunny.net/reference/dnszonepublic_index
Timestamps formatted in YYYY-MM-DDTHH:MM:SS style. Golang time layout: 2006-01-02T15:04:05
type DNSZoneService ¶
type DNSZoneService struct {
// contains filtered or unexported fields
}
DNSZoneService communicates with the /dnszone API endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/dnszonepublic_index
func (*DNSZoneService) Add ¶
Add creates a new DNS Zone. opts and the non-optional parameters in the struct must be specified for a successful request. On success the created DNSZone is returned.
Bunny.net API docs: https://docs.bunny.net/reference/dnszonepublic_add
func (*DNSZoneService) AddDNSRecord ¶
func (s *DNSZoneService) AddDNSRecord(ctx context.Context, dnsZoneID int64, opts *AddOrUpdateDNSRecordOptions) (*DNSRecord, error)
AddDNSRecord adds a DNS record to the DNS Zone.
Bunny.net API docs: https://docs.bunny.net/reference/dnszonepublic_addrecord
func (*DNSZoneService) Delete ¶
func (s *DNSZoneService) Delete(ctx context.Context, id int64) error
Delete removes the DNS Zone with the given id.
Bunny.net API docs: https://docs.bunny.net/reference/dnszonepublic_delete
func (*DNSZoneService) DeleteDNSRecord ¶
func (s *DNSZoneService) DeleteDNSRecord(ctx context.Context, dnsZoneID int64, dnsRecordID int64) error
DeleteDNSRecord removes a DNS Record of a DNS Zone.
Bunny.net API docs: https://docs.bunny.net/reference/dnszonepublic_deleterecord
func (*DNSZoneService) Get ¶
Get retrieves the DNS Zone with the given id.
Bunny.net API docs: https://docs.bunny.net/reference/dnszonepublic_index2
func (*DNSZoneService) List ¶
func (s *DNSZoneService) List( ctx context.Context, opts *PaginationOptions, ) (*DNSZones, error)
List retrieves the DNS Zones. If opts is nil, DefaultPaginationPerPage and DefaultPaginationPage will be used. if opts.Page or or opts.PerPage is < 1, the related DefaultPagination values are used.
Bunny.net API docs: https://docs.bunny.net/reference/dnszonepublic_index
func (*DNSZoneService) Update ¶
func (s *DNSZoneService) Update(ctx context.Context, id int64, opts *DNSZoneUpdateOptions) (*DNSZone, error)
Update changes the configuration the DNS Zone with the given ID. The updated DNS Zone is returned. Bunny.net API docs: https://docs.bunny.net/reference/dnszonepublic_update
func (*DNSZoneService) UpdateDNSRecord ¶
func (s *DNSZoneService) UpdateDNSRecord(ctx context.Context, dnsZoneID int64, dnsRecordID int64, opts *AddOrUpdateDNSRecordOptions) error
UpdateDNSRecord updates a DNS record in the DNS Zone.
Bunny.net API docs: https://docs.bunny.net/reference/dnszonepublic_updaterecord
type DNSZoneUpdateOptions ¶
type DNSZoneUpdateOptions 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"` LoggingIPAnonymizationEnabled *bool `json:"LoggingIPAnonymizationEnabled,omitempty"` LogAnonymizationType *int `json:"LogAnonymizationType,omitempty"` }
DNSZoneUpdateOptions represents the request parameters for the Update DNS Zone API endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/dnszonepublic_update
type DNSZones ¶
type DNSZones PaginationReply[DNSZone]
DNSZones represents the response of the List DNS Zone API endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/dnszonepublic_index
type EdgeRule ¶
type EdgeRule struct { GUID *string `json:"Guid,omitempty"` ActionType *int `json:"ActionType,omitempty"` ActionParameter1 *string `json:"ActionParameter1,omitempty"` ActionParameter2 *string `json:"ActionParameter2,omitempty"` Triggers []*EdgeRuleTrigger `json:"Triggers,omitempty"` TriggerMatchingType *int `json:"TriggerMatchingType,omitempty"` Description *string `json:"Description,omitempty"` Enabled *bool `json:"Enabled,omitempty"` }
EdgeRule represents an EdgeRule. It is returned from the Get and List Pull Zone and passed to the AddorUpdateEdgeRule API Endpoints.
type EdgeRuleTrigger ¶
type EdgeRuleTrigger struct { Type *int `json:"Type,omitempty"` PatternMatches []string `json:"PatternMatches,omitempty"` PatternMatchingType *int `json:"PatternMatchingType,omitempty"` Parameter1 *string `json:"Parameter1,omitempty"` }
EdgeRuleTrigger represents the values of the Trigger field of an EdgeRule.
type EnvironmentalVariable ¶
type EnvironmentalVariable struct { Name *string `json:"Name,omitempty"` Value *string `json:"Value,omitempty"` }
EnvironmentalVariable represents the environmental variables attached to a DNS record.
type HTTPError ¶
type HTTPError struct { // RequestURL is the address to which the request was sent that caused the error. RequestURL string // The HTTP response status code. StatusCode int // The raw http response body. It's nil if the response had no body or it could not be received. RespBody []byte // Errors contain errors that happened while receiving or processing the HTTP response. Errors []error }
HTTPError is returned by the Client when an unsuccessful HTTP response was returned or a response could not be processed. If the body of an unsuccessful HTTP response contains an APIError in the body, APIError is returned by the Client instead.
type Hostname ¶
type Hostname struct { ID *int64 `json:"Id,omitempty"` Value *string `json:"Value,omitempty"` ForceSSL *bool `json:"ForceSSL,omitempty"` IsSystemHostname *bool `json:"IsSystemHostname,omitempty"` HasCertificate *bool `json:"HasCertificate,omitempty"` }
Hostname represents a Hostname returned from the Get and List Pull Zone API Endpoints.
type IPGeoLocationInfo ¶
type IPGeoLocationInfo struct { CountryCode *string `json:"CountryCode,omitempty"` Country *string `json:"Country,omitempty"` ASN *int64 `json:"ASN,omitempty"` OrganizationName *string `json:"OrganizationName,omitempty"` City *string `json:"City,omitempty"` }
IPGeoLocationInfo represents the geolocation data attached to a DNS record.
type Option ¶
type Option func(*Client)
Option is a type for Client options.
func WithHTTPRequestLogger ¶
WithHTTPRequestLogger is an option to log all sent out HTTP-Request via a log function.
func WithHTTPResponseLogger ¶
WithHTTPResponseLogger is an option to log all received HTTP-Responses via a log function.
func WithLogger ¶
WithLogger is an option to set a log function to which informal and warning messages will be logged.
func WithUserAgent ¶
WithUserAgent is an option to specify the value of the User-Agent HTTP Header.
type PaginationOptions ¶
type PaginationOptions struct { // Page the page to return Page int32 `url:"page,omitempty"` // PerPage how many entries to return per page PerPage int32 `url:"per_page,omitempty"` }
PaginationOptions specifies optional parameters for List APIs.
type PaginationReply ¶
type PaginationReply[Item any] struct { Items []*Item `json:"Items,omitempty"` CurrentPage *int32 `json:"CurrentPage"` TotalItems *int32 `json:"TotalItems"` HasMoreItems *bool `json:"HasMoreItems"` }
PaginationReply represents the pagination information contained in a List API endpoint response.
Ex. Bunny.net API docs: - https://docs.bunny.net/reference/pullzonepublic_index - https://docs.bunny.net/reference/storagezonepublic_index
type PullZone ¶
type PullZone struct { ID *int64 `json:"Id,omitempty"` AccessControlOriginHeaderExtensions []string `json:"AccessControlOriginHeaderExtensions,omitempty"` AddCanonicalHeader *bool `json:"AddCanonicalHeader,omitempty"` AddHostHeader *bool `json:"AddHostHeader,omitempty"` AllowedReferrers []string `json:"AllowedReferrers,omitempty"` AWSSigningEnabled *bool `json:"AWSSigningEnabled,omitempty"` AWSSigningKey *string `json:"AWSSigningKey,omitempty"` AWSSigningRegionName *string `json:"AWSSigningRegionName,omitempty"` AWSSigningSecret *string `json:"AWSSigningSecret,omitempty"` BlockedCountries []string `json:"BlockedCountries,omitempty"` BlockedIPs []string `json:"BlockedIps,omitempty"` BlockedReferrers []string `json:"BlockedReferrers,omitempty"` BlockPostRequests *bool `json:"BlockPostRequests,omitempty"` BlockRootPathAccess *bool `json:"BlockRootPathAccess,omitempty"` BudgetRedirectedCountries []string `json:"BudgetRedirectedCountries,omitempty"` BurstSize *int32 `json:"BurstSize,omitempty"` // CacheControlBrowserMaxAgeOverride is called // CacheControlPublicMaxAgeOverride in the API. Both names refer to the // same setting. CacheControlBrowserMaxAgeOverride *int64 `json:"CacheControlPublicMaxAgeOverride,omitempty"` CacheControlMaxAgeOverride *int64 `json:"CacheControlMaxAgeOverride,omitempty"` CacheErrorResponses *bool `json:"CacheErrorResponses,omitempty"` CnameDomain *string `json:"CnameDomain,omitempty"` ConnectionLimitPerIPCount *int32 `json:"ConnectionLimitPerIPCount,omitempty"` CookieVaryParameters []string `json:"CookieVaryParameters,omitempty"` DisableCookies *bool `json:"DisableCookies,omitempty"` DNSRecordID *int64 `json:"DnsRecordId,omitempty"` DNSRecordValue *string `json:"DnsRecordValue,omitempty"` DNSZoneID *int64 `json:"DnsZoneId,omitempty"` EdgeRules []*EdgeRule `json:"EdgeRules,omitempty"` EnableAccessControlOriginHeader *bool `json:"EnableAccessControlOriginHeader,omitempty"` EnableAutoSSL *bool `json:"EnableAutoSSL,omitempty"` EnableAvifVary *bool `json:"EnableAvifVary,omitempty"` EnableCacheSlice *bool `json:"EnableCacheSlice,omitempty"` EnableCookieVary *bool `json:"EnableCookieVary,omitempty"` EnableCountryCodeVary *bool `json:"EnableCountryCodeVary,omitempty"` Enabled *bool `json:"Enabled,omitempty"` EnableGeoZoneAF *bool `json:"EnableGeoZoneAF,omitempty"` EnableGeoZoneAsia *bool `json:"EnableGeoZoneASIA,omitempty"` EnableGeoZoneEU *bool `json:"EnableGeoZoneEU,omitempty"` EnableGeoZoneSA *bool `json:"EnableGeoZoneSA,omitempty"` EnableGeoZoneUS *bool `json:"EnableGeoZoneUS,omitempty"` EnableHostnameVary *bool `json:"EnableHostnameVary,omitempty"` EnableLogging *bool `json:"EnableLogging,omitempty"` EnableMobileVary *bool `json:"EnableMobileVary,omitempty"` EnableOriginShield *bool `json:"EnableOriginShield,omitempty"` EnableSafeHop *bool `json:"EnableSafeHop,omitempty"` EnableSmartCache *bool `json:"EnableSmartCache,omitempty"` EnableTLS1 *bool `json:"EnableTLS1,omitempty"` EnableTLS11 *bool `json:"EnableTLS1_1,omitempty"` EnableWebPVary *bool `json:"EnableWebPVary,omitempty"` ErrorPageCustomCode *string `json:"ErrorPageCustomCode,omitempty"` ErrorPageEnableCustomCode *bool `json:"ErrorPageEnableCustomCode,omitempty"` ErrorPageEnableStatuspageWidget *bool `json:"ErrorPageEnableStatuspageWidget,omitempty"` ErrorPageStatuspageCode *string `json:"ErrorPageStatuspageCode,omitempty"` ErrorPageWhitelabel *bool `json:"ErrorPageWhitelabel,omitempty"` FollowRedirects *bool `json:"FollowRedirects,omitempty"` Hostnames []*Hostname `json:"Hostnames,omitempty"` IgnoreQueryStrings *bool `json:"IgnoreQueryStrings,omitempty"` LimitRateAfter *float64 `json:"LimitRateAfter,omitempty"` LimitRatePerSecond *float64 `json:"LimitRatePerSecond,omitempty"` LogAnonymizationType *int `json:"LogAnonymizationType,omitempty"` LogFormat *int32 `json:"LogFormat,omitempty"` LogForwardingEnabled *bool `json:"LogForwardingEnabled,omitempty"` LogForwardingFormat *int `json:"LogForwardingFormat,omitempty"` LogForwardingHostname *string `json:"LogForwardingHostname,omitempty"` LogForwardingPort *int32 `json:"LogForwardingPort,omitempty"` LogForwardingProtocol *int `json:"LogForwardingProtocol,omitempty"` LogForwardingToken *string `json:"LogForwardingToken,omitempty"` LoggingIPAnonymizationEnabled *bool `json:"LoggingIPAnonymizationEnabled,omitempty"` LoggingSaveToStorage *bool `json:"LoggingSaveToStorage,omitempty"` LoggingStorageZoneID *int64 `json:"LoggingStorageZoneId,omitempty"` MonthlyBandwidthLimit *int64 `json:"MonthlyBandwidthLimit,omitempty"` MonthlyBandwidthUsed *int64 `json:"MonthlyBandwidthUsed,omitempty"` MonthlyCharges *float64 `json:"MonthlyCharges,omitempty"` Name *string `json:"Name,omitempty"` OptimizerAutomaticOptimizationEnabled *bool `json:"OptimizerAutomaticOptimizationEnabled,omitempty"` OptimizerDesktopMaxWidth *int32 `json:"OptimizerDesktopMaxWidth,omitempty"` OptimizerEnabled *bool `json:"OptimizerEnabled,omitempty"` OptimizerEnableManipulationEngine *bool `json:"OptimizerEnableManipulationEngine,omitempty"` OptimizerEnableWebP *bool `json:"OptimizerEnableWebP,omitempty"` OptimizerForceClasses *bool `json:"OptimizerForceClasses,omitempty"` OptimizerImageQuality *int32 `json:"OptimizerImageQuality,omitempty"` OptimizerMinifyCSS *bool `json:"OptimizerMinifyCSS,omitempty"` OptimizerMinifyJavaScript *bool `json:"OptimizerMinifyJavaScript,omitempty"` OptimizerMobileImageQuality *int32 `json:"OptimizerMobileImageQuality,omitempty"` OptimizerMobileMaxWidth *int32 `json:"OptimizerMobileMaxWidth,omitempty"` OptimizerWatermarkEnabled *bool `json:"OptimizerWatermarkEnabled,omitempty"` OptimizerWatermarkMinImageSize *int32 `json:"OptimizerWatermarkMinImageSize,omitempty"` OptimizerWatermarkOffset *float64 `json:"OptimizerWatermarkOffset,omitempty"` OptimizerWatermarkPosition *int `json:"OptimizerWatermarkPosition,omitempty"` OptimizerWatermarkURL *string `json:"OptimizerWatermarkUrl,omitempty"` OriginConnectTimeout *int32 `json:"OriginConnectTimeout,omitempty"` OriginHostHeader *string `json:"OriginHostHeader,omitempty"` OriginResponseTimeout *int32 `json:"OriginResponseTimeout,omitempty"` OriginRetries *int32 `json:"OriginRetries,omitempty"` OriginRetry5xxResponses *bool `json:"OriginRetry5xxResponses,omitempty"` OriginRetryConnectionTimeout *bool `json:"OriginRetryConnectionTimeout,omitempty"` OriginRetryDelay *int32 `json:"OriginRetryDelay,omitempty"` OriginRetryResponseTimeout *bool `json:"OriginRetryResponseTimeout,omitempty"` OriginShieldEnableConcurrencyLimit *bool `json:"OriginShieldEnableConcurrencyLimit,omitempty"` OriginShieldMaxConcurrentRequests *int32 `json:"OriginShieldMaxConcurrentRequests,omitempty"` OriginShieldMaxQueuedRequests *int32 `json:"OriginShieldMaxQueuedRequests,omitempty"` OriginShieldQueueMaxWaitTime *int32 `json:"OriginShieldQueueMaxWaitTime,omitempty"` OriginShieldZoneCode *string `json:"OriginShieldZoneCode,omitempty"` OriginType *int32 `json:"OriginType,omitempty"` OriginURL *string `json:"OriginUrl,omitempty"` PermaCacheStorageZoneID *int64 `json:"PermaCacheStorageZoneId,omitempty"` PriceOverride *float64 `json:"PriceOverride,omitempty"` QueryStringVaryParameters []string `json:"QueryStringVaryParameters,omitempty"` RequestLimit *int32 `json:"RequestLimit,omitempty"` ShieldDDosProtectionEnabled *bool `json:"ShieldDDosProtectionEnabled,omitempty"` ShieldDDosProtectionType *int `json:"ShieldDDosProtectionType,omitempty"` StorageZoneID *int64 `json:"StorageZoneId,omitempty"` Type *int `json:"Type,omitempty"` UseBackgroundUpdate *bool `json:"UseBackgroundUpdate,omitempty"` UseStaleWhileOffline *bool `json:"UseStaleWhileOffline,omitempty"` UseStaleWhileUpdating *bool `json:"UseStaleWhileUpdating,omitempty"` VerifyOriginSSL *bool `json:"VerifyOriginSSL,omitempty"` VideoLibraryID *int64 `json:"VideoLibraryId,omitempty"` ZoneSecurityEnabled *bool `json:"ZoneSecurityEnabled,omitempty"` ZoneSecurityIncludeHashRemoteIP *bool `json:"ZoneSecurityIncludeHashRemoteIP,omitempty"` ZoneSecurityKey *string `json:"ZoneSecurityKey,omitempty"` }
PullZone represents the response of the the List and Get Pull Zone API endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_index2 https://docs.bunny.net/reference/pullzonepublic_index
type PullZoneAddCustomCertificateOptions ¶
type PullZoneAddCustomCertificateOptions struct { Hostname string `json:"Hostname"` Certificate []byte `json:"Certificate"` CertificateKey []byte `json:"CertificateKey"` }
PullZoneAddCustomCertificateOptions are the request parameters for the Add Custom Certificate API Endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_addcertificate
type PullZoneAddOptions ¶
type PullZoneAddOptions struct { // The name of the pull zone. Name string `json:"Name,omitempty"` // The origin URL of the pull zone where the files are fetched from. OriginURL string `json:"OriginUrl,omitempty"` // The ID of the storage zone that the pull zone is linked to. (Optional) StorageZoneID *int64 `json:"StorageZoneId,omitempty"` // The type of the pull zone. Standard = 0, Volume = 1. (Optional) Type int `json:"Type,omitempty"` }
PullZoneAddOptions are the request parameters for the Get Pull Zone API endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_add
type PullZoneService ¶
type PullZoneService struct {
// contains filtered or unexported fields
}
PullZoneService communicates with the /pullzone API endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/pull-zone
func (*PullZoneService) Add ¶
func (s *PullZoneService) Add(ctx context.Context, opts *PullZoneAddOptions) (*PullZone, error)
Add creates a new Pull Zone. opts and the non-optional parameters in the struct must be specified for a successful request. On success the created PullZone is returned.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_add
func (*PullZoneService) AddCustomCertificate ¶
func (s *PullZoneService) AddCustomCertificate(ctx context.Context, pullZoneID int64, opts *PullZoneAddCustomCertificateOptions) error
AddCustomCertificate represents the Add Custom Certificate API Endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_addcertificate
func (*PullZoneService) AddCustomHostname ¶
func (s *PullZoneService) AddCustomHostname(ctx context.Context, pullZoneID int64, opts *AddCustomHostnameOptions) error
AddCustomHostname adds a custom hostname to the Pull Zone.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_addhostname
func (*PullZoneService) AddOrUpdateEdgeRule ¶
func (s *PullZoneService) AddOrUpdateEdgeRule(ctx context.Context, pullZoneID int64, opts *AddOrUpdateEdgeRuleOptions) error
AddOrUpdateEdgeRule adds or updates an Edge Rule of a Pull Zone.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_addedgerule
func (*PullZoneService) Delete ¶
func (s *PullZoneService) Delete(ctx context.Context, id int64) error
Delete removes the Pull Zone with the given id.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_delete
func (*PullZoneService) DeleteEdgeRule ¶
func (s *PullZoneService) DeleteEdgeRule(ctx context.Context, pullZoneID int64, edgeRuleGUID string) error
DeleteEdgeRule removes an Edge Rule of a Pull Zone. The edgeRuleGUID field is called edgeRuleID in the API message and documentation. It is the same then the GUID field in the EdgeRule message.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_deleteedgerule
func (*PullZoneService) Get ¶
Get retrieves the Pull Zone with the given id.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_index2
func (*PullZoneService) List ¶
func (s *PullZoneService) List( ctx context.Context, opts *PaginationOptions, ) (*PullZones, error)
List retrieves the Pull Zones. If opts is nil, DefaultPaginationPerPage and DefaultPaginationPage will be used. if opts.Page or or opts.PerPage is < 1, the related DefaultPagination values are used.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_index
func (*PullZoneService) LoadFreeCertificate ¶
func (s *PullZoneService) LoadFreeCertificate(ctx context.Context, hostname string) error
LoadFreeCertificate represents the Load Free Certificate API Endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_loadfreecertificate
func (*PullZoneService) RemoveCertificate ¶
func (s *PullZoneService) RemoveCertificate(ctx context.Context, pullZoneID int64, opts *RemoveCertificateOptions) error
RemoveCertificate represents the Remove Certificate API Endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_removecertificate
func (*PullZoneService) RemoveCustomHostname ¶
func (s *PullZoneService) RemoveCustomHostname(ctx context.Context, pullZoneID int64, opts *RemoveCustomHostnameOptions) error
RemoveCustomHostname removes a custom hostname from the Pull Zone.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_removehostname
func (*PullZoneService) SetEdgeRuleEnabled ¶
func (s *PullZoneService) SetEdgeRuleEnabled(ctx context.Context, pullZoneID int64, edgeRuleGUID string, opts *SetEdgeRuleEnabledOptions) error
SetEdgeRuleEnabled enables or disables an Edge Rule of a Pull Zone. The edgeRuleGUID field is called edgeRuleID in the API message and documentation. It is the same then the GUID field in the EdgeRule message.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_addedgerule
func (*PullZoneService) SetForceSSL ¶
func (s *PullZoneService) SetForceSSL(ctx context.Context, pullzoneID int64, opts *SetForceSSLOptions) error
SetForceSSL enables or disables the force SSL option for a hostname of a Pull Zone.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_setforcessl
func (*PullZoneService) Update ¶
func (s *PullZoneService) Update(ctx context.Context, id int64, opts *PullZoneUpdateOptions) (*PullZone, error)
Update changes the configuration the Pull-Zone with the given ID. The updated Pull Zone is returned. Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_updatepullzone
type PullZoneUpdateOptions ¶
type PullZoneUpdateOptions struct { AWSSigningEnabled *bool `json:"AWSSigningEnabled,omitempty"` AWSSigningKey *string `json:"AWSSigningKey,omitempty"` AWSSigningRegionName *string `json:"AWSSigningRegionName,omitempty"` AWSSigningSecret *string `json:"AWSSigningSecret,omitempty"` AccessControlOriginHeaderExtensions []string `json:"AccessControlOriginHeaderExtensions,omitempty"` AddCanonicalHeader *bool `json:"AddCanonicalHeader,omitempty"` AddHostHeader *bool `json:"AddHostHeader,omitempty"` AllowedReferrers []string `json:"AllowedReferrers,omitempty"` BlockPostRequests *bool `json:"BlockPostRequests,omitempty"` BlockRootPathAccess *bool `json:"BlockRootPathAccess,omitempty"` BlockedCountries []string `json:"BlockedCountries,omitempty"` BlockedIPs []string `json:"BlockedIps,omitempty"` BudgetRedirectedCountries []string `json:"BudgetRedirectedCountries,omitempty"` CacheControlBrowserMaxAgeOverride *int64 `json:"CacheControlBrowserMaxAgeOverride,omitempty"` CacheControlMaxAgeOverride *int64 `json:"CacheControlMaxAgeOverride,omitempty"` CacheErrorResponses *bool `json:"CacheErrorResponses,omitempty"` ConnectionLimitPerIPCount *int32 `json:"ConnectionLimitPerIPCount,omitempty"` CookieVaryParameters []string `json:"CookieVaryParameters,omitempty"` DisableCookies *bool `json:"DisableCookies,omitempty"` EnableAccessControlOriginHeader *bool `json:"EnableAccessControlOriginHeader,omitempty"` EnableAvifVary *bool `json:"EnableAvifVary,omitempty"` EnableCacheSlice *bool `json:"EnableCacheSlice,omitempty"` EnableCookieVary *bool `json:"EnableCookieVary,omitempty"` EnableCountryCodeVary *bool `json:"EnableCountryCodeVary,omitempty"` EnableGeoZoneAF *bool `json:"EnableGeoZoneAF,omitempty"` EnableGeoZoneAsia *bool `json:"EnableGeoZoneASIA,omitempty"` EnableGeoZoneEU *bool `json:"EnableGeoZoneEU,omitempty"` EnableGeoZoneSA *bool `json:"EnableGeoZoneSA,omitempty"` EnableGeoZoneUS *bool `json:"EnableGeoZoneUS,omitempty"` EnableHostnameVary *bool `json:"EnableHostnameVary,omitempty"` EnableLogging *bool `json:"EnableLogging,omitempty"` EnableMobileVary *bool `json:"EnableMobileVary,omitempty"` EnableOriginShield *bool `json:"EnableOriginShield,omitempty"` EnableQueryStringOrdering *bool `json:"EnableQueryStringOrdering,omitempty"` EnableSafeHop *bool `json:"EnableSafeHop,omitempty"` EnableTLS1 *bool `json:"EnableTLS1,omitempty"` EnableTLS11 *bool `json:"EnableTLS1_1,omitempty"` EnableWebPVary *bool `json:"EnableWebPVary,omitempty"` ErrorPageCustomCode *string `json:"ErrorPageCustomCode,omitempty"` ErrorPageEnableCustomCode *bool `json:"ErrorPageEnableCustomCode,omitempty"` ErrorPageEnableStatuspageWidget *bool `json:"ErrorPageEnableStatuspageWidget,omitempty"` ErrorPageStatuspageCode *string `json:"ErrorPageStatuspageCode,omitempty"` ErrorPageWhitelabel *bool `json:"ErrorPageWhitelabel,omitempty"` FollowRedirects *bool `json:"FollowRedirects,omitempty"` IgnoreQueryStrings *bool `json:"IgnoreQueryStrings,omitempty"` LogForwardingEnabled *bool `json:"LogForwardingEnabled,omitempty"` LogForwardingHostname *string `json:"LogForwardingHostname,omitempty"` LogForwardingPort *int32 `json:"LogForwardingPort,omitempty"` LogForwardingToken *string `json:"LogForwardingToken,omitempty"` LoggingIPAnonymizationEnabled *bool `json:"LoggingIPAnonymizationEnabled,omitempty"` LoggingSaveToStorage *bool `json:"LoggingSaveToStorage,omitempty"` LoggingStorageZoneID *int64 `json:"LoggingStorageZoneId,omitempty"` MonthlyBandwidthLimit *int64 `json:"MonthlyBandwidthLimit,omitempty"` OptimizerAutomaticOptimizationEnabled *bool `json:"OptimizerAutomaticOptimizationEnabled,omitempty"` OptimizerDesktopMaxWidth *int32 `json:"OptimizerDesktopMaxWidth,omitempty"` OptimizerEnableManipulationEngine *bool `json:"OptimizerEnableManipulationEngine,omitempty"` OptimizerEnableWebP *bool `json:"OptimizerEnableWebP,omitempty"` OptimizerEnabled *bool `json:"OptimizerEnabled,omitempty"` OptimizerImageQuality *int32 `json:"OptimizerImageQuality,omitempty"` OptimizerMinifyCSS *bool `json:"OptimizerMinifyCSS,omitempty"` OptimizerMinifyJavaScript *bool `json:"OptimizerMinifyJavaScript,omitempty"` OptimizerMobileImageQuality *int32 `json:"OptimizerMobileImageQuality,omitempty"` OptimizerMobileMaxWidth *int32 `json:"OptimizerMobileMaxWidth,omitempty"` OptimizerWatermarkEnabled *bool `json:"OptimizerWatermarkEnabled,omitempty"` OptimizerWatermarkMinImageSize *int32 `json:"OptimizerWatermarkMinImageSize,omitempty"` OptimizerWatermarkOffset *float64 `json:"OptimizerWatermarkOffset,omitempty"` OptimizerWatermarkPosition *int `json:"OptimizerWatermarkPosition,omitempty"` OptimizerWatermarkURL *string `json:"OptimizerWatermarkUrl,omitempty"` OriginConnectTimeout *int32 `json:"OriginConnectTimeout,omitempty"` OriginResponseTimeout *int32 `json:"OriginResponseTimeout,omitempty"` OriginRetries *int32 `json:"OriginRetries,omitempty"` OriginRetry5xxResponses *bool `json:"OriginRetry5xxResponses,omitempty"` OriginRetryConnectionTimeout *bool `json:"OriginRetryConnectionTimeout,omitempty"` OriginRetryDelay *int32 `json:"OriginRetryDelay,omitempty"` OriginRetryResponseTimeout *bool `json:"OriginRetryResponseTimeout,omitempty"` OriginShieldEnableConcurrencyLimit *bool `json:"OriginShieldEnableConcurrencyLimit,omitempty"` OriginShieldMaxConcurrentRequests *int32 `json:"OriginShieldMaxConcurrentRequests,omitempty"` OriginShieldMaxQueuedRequests *int32 `json:"OriginShieldMaxQueuedRequests,omitempty"` OriginShieldQueueMaxWaitTime *int32 `json:"OriginShieldQueueMaxWaitTime,omitempty"` OriginShieldZoneCode *string `json:"OriginShieldZoneCode,omitempty"` OriginURL *string `json:"OriginUrl,omitempty"` PermaCacheStorageZoneID *int64 `json:"PermaCacheStorageZoneId,omitempty"` QueryStringVaryParameters []string `json:"QueryStringVaryParameters,omitempty"` RequestLimit *int32 `json:"RequestLimit,omitempty"` Type *int `json:"Type,omitempty"` UseStaleWhileOffline *bool `json:"UseStaleWhileOffline,omitempty"` UseStaleWhileUpdating *bool `json:"UseStaleWhileUpdating,omitempty"` VerifyOriginSSL *bool `json:"VerifyOriginSSL,omitempty"` WAFEnabled *bool `json:"WAFEnabled,omitempty"` WAFEnabledRules []int32 `json:"WAFEnabledRules,omitempty"` ZoneSecurityEnabled *bool `json:"ZoneSecurityEnabled,omitempty"` ZoneSecurityIncludeHashRemoteIP *bool `json:"ZoneSecurityIncludeHashRemoteIP,omitempty"` }
PullZoneUpdateOptions represents the request parameters for the Update Pull Zone API endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_updatepullzone
type PullZones ¶
type PullZones PaginationReply[PullZone]
PullZones represents the response of the List Pull Zone API endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_index
type RemoveCertificateOptions ¶
type RemoveCertificateOptions struct {
Hostname *string `json:"Hostname,omitempty"`
}
RemoveCertificateOptions represents the request parameters for the Remove Certificate API Endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_removecertificate
type RemoveCustomHostnameOptions ¶
type RemoveCustomHostnameOptions struct { // Hostname is the hostname that is removed. (Required) Hostname *string `json:"Hostname,omitempty"` }
RemoveCustomHostnameOptions represents the message that is sent to the Remove Custom Hostname API Endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_removehostname
type SetEdgeRuleEnabledOptions ¶
type SetEdgeRuleEnabledOptions struct { // ID must be set to the PullZone ID for that the EdgeRule should be enabled. ID *int64 `json:"Id,omitempty"` Value *bool `json:"Value,omitempty"` }
SetEdgeRuleEnabledOptions represents the message that is sent to Add/Update Edge Rule endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_addedgerule
type SetForceSSLOptions ¶
type SetForceSSLOptions struct { Hostname *string `json:"Hostname,omitempty"` ForceSSL *bool `json:"ForceSSL,omitempty"` }
SetForceSSLOptions represents the message is to the the Set Force SSL Endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_setforcessl
type StorageZone ¶
type StorageZone struct { ID *int64 `json:"Id,omitempty"` UserID *string `json:"UserId,omitempty"` Name *string `json:"Name,omitempty"` Password *string `json:"Password,omitempty"` DateModified *string `json:"DateModified,omitempty"` Deleted *bool `json:"Deleted,omitempty"` StorageUsed *int64 `json:"StorageUsed,omitempty"` FilesStored *int64 `json:"FilesStored,omitempty"` Region *string `json:"Region,omitempty"` ReplicationRegions []string `json:"ReplicationRegions,omitempty"` PullZones []*PullZone `json:"PullZones,omitempty"` ReadOnlyPassword *string `json:"ReadOnlyPassword,omitempty"` }
StorageZone represents the response of the the List and Get Storage Zone API endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/storagezonepublic_index2 https://docs.bunny.net/reference/storagezonepublic_index
type StorageZoneAddOptions ¶
type StorageZoneAddOptions struct { // The name of the storage zone Name *string `json:"Name,omitempty"` // The ID of the storage zone that the storage zone is linked to. Region *string `json:"Region,omitempty"` // The origin URL of the storage zone where the files are fetched from (Optional) OriginURL *string `json:"OriginUrl,omitempty"` // The code of the main storage zone region (Optional) ReplicationRegions []string `json:"ReplicationRegions,omitempty"` }
StorageZoneAddOptions are the request parameters for the Get Storage Zone API endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/storagezonepublic_add
type StorageZoneService ¶
type StorageZoneService struct {
// contains filtered or unexported fields
}
StorageZoneService communicates with the /storagezone API endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/storagezonepublic_index
func (*StorageZoneService) Add ¶
func (s *StorageZoneService) Add(ctx context.Context, opts *StorageZoneAddOptions) (*StorageZone, error)
Add creates a new Storage Zone. opts and the non-optional parameters in the struct must be specified for a successful request. On success the created StorageZone is returned.
Bunny.net API docs: https://docs.bunny.net/reference/storagezonepublic_add
func (*StorageZoneService) Delete ¶
func (s *StorageZoneService) Delete(ctx context.Context, id int64) error
Delete removes the Storage Zone with the given id.
Bunny.net API docs: https://docs.bunny.net/reference/storagezonepublic_delete
func (*StorageZoneService) Get ¶
func (s *StorageZoneService) Get(ctx context.Context, id int64) (*StorageZone, error)
Get retrieves the Storage Zone with the given id.
Bunny.net API docs: https://docs.bunny.net/reference/storagezonepublic_index2
func (*StorageZoneService) List ¶
func (s *StorageZoneService) List( ctx context.Context, opts *PaginationOptions, ) (*StorageZones, error)
List retrieves the Storage Zones. If opts is nil, DefaultPaginationPerPage and DefaultPaginationPage will be used. if opts.Page or or opts.PerPage is < 1, the related DefaultPagination values are used.
Bunny.net API docs: https://docs.bunny.net/reference/storagezonepublic_index
func (*StorageZoneService) Update ¶
func (s *StorageZoneService) Update(ctx context.Context, id int64, opts *StorageZoneUpdateOptions) error
Update changes the configuration the Storage-Zone with the given ID. Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_updatepullzone
type StorageZoneUpdateOptions ¶
type StorageZoneUpdateOptions struct { // NOTE: the naming in the Bunny API for this property is inconsistent. // In the update call its `ReplicationZones` but everywhere else its // referred to as `ReplicationRegions`. ReplicationRegions []string `json:"ReplicationZones,omitempty"` OriginURL *string `json:"OriginUrl,omitempty"` Custom404FilePath *string `json:"Custom404FilePath,omitempty"` Rewrite404To200 *bool `json:"Rewrite404To200,omitempty"` }
StorageZoneUpdateOptions represents the request parameters for the Update Storage Zone API endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_updatepullzone
type StorageZones ¶
type StorageZones PaginationReply[StorageZone]
StorageZones represents the response of the List Storage Zone API endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/storagezonepublic_index
type VideoLibraries ¶
type VideoLibraries PaginationReply[VideoLibrary]
VideoLibraries represents the response of the List Video Library API endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/videolibrarypublic_index
type VideoLibrary ¶
type VideoLibrary struct { ID *int64 `json:"Id,omitempty"` Name *string `json:"Name,omitempty"` VideoCount *int64 `json:"VideoCount,omitempty"` TrafficUsage *int64 `json:"TrafficUsage,omitempty"` StorageUsage *int64 `json:"StorageUsage,omitempty"` DateCreated *string `json:"DateCreated,omitempty"` ReplicationRegions []string `json:"ReplicationRegions,omitempty"` APIKey *string `json:"ApiKey,omitempty"` ReadOnlyAPIKey *string `json:"ReadOnlyApiKey,omitempty"` HasWatermark *bool `json:"HasWatermark,omitempty"` WatermarkPositionLeft *int32 `json:"WatermarkPositionLeft,omitempty"` WatermarkPositionTop *int32 `json:"WatermarkPositionTop,omitempty"` WatermarkWidth *int32 `json:"WatermarkWidth,omitempty"` PullZoneID *int64 `json:"PullZoneId,omitempty"` StorageZoneID *int64 `json:"StorageZoneId,omitempty"` WatermarkHeight *int32 `json:"WatermarkHeight,omitempty"` EnabledResolutions *string `json:"EnabledResolutions,omitempty"` ViAiPublisherID *string `json:"ViAiPublisherId,omitempty"` VastTagURL *string `json:"VastTagUrl,omitempty"` WebhookURL *string `json:"WebhookUrl,omitempty"` CaptionsFontSize *int32 `json:"CaptionsFontSize,omitempty"` CaptionsFontColor *string `json:"CaptionsFontColor,omitempty"` CaptionsBackground *string `json:"CaptionsBackground,omitempty"` UILanguage *string `json:"UILanguage,omitempty"` AllowEarlyPlay *bool `json:"AllowEarlyPlay,omitempty"` PlayerTokenAuthenticationEnabled *bool `json:"PlayerTokenAuthenticationEnabled,omitempty"` AllowedReferrers []string `json:"AllowedReferrers,omitempty"` BlockedReferrers []string `json:"BlockedReferrers,omitempty"` BlockNoneReferrer *bool `json:"BlockNoneReferrer,omitempty"` EnableMP4Fallback *bool `json:"EnableMP4Fallback,omitempty"` KeepOriginalFiles *bool `json:"KeepOriginalFiles,omitempty"` AllowDirectPlay *bool `json:"AllowDirectPlay,omitempty"` EnableDRM *bool `json:"EnableDRM,omitempty"` Bitrate240p *int32 `json:"Bitrate240p,omitempty"` Bitrate360p *int32 `json:"Bitrate360p,omitempty"` Bitrate480p *int32 `json:"Bitrate480p,omitempty"` Bitrate720p *int32 `json:"Bitrate720p,omitempty"` Bitrate1080p *int32 `json:"Bitrate1080p,omitempty"` Bitrate1440p *int32 `json:"Bitrate1440p,omitempty"` Bitrate2160p *int32 `json:"Bitrate2160p,omitempty"` APIAccessKey *string `json:"ApiAccessKey,omitempty"` ShowHeatmap *bool `json:"ShowHeatmap,omitempty"` EnableContentTagging *bool `json:"EnableContentTagging,omitempty"` PullZoneType *int32 `json:"PullZoneType,omitempty"` CustomHTML *string `json:"CustomHTML,omitempty"` Controls *string `json:"Controls,omitempty"` PlayerKeyColor *string `json:"PlayerKeyColor,omitempty"` FontFamily *string `json:"FontFamily,omitempty"` }
VideoLibrary represents the response of the the List and Get Video Library API endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/videolibrarypublic_index2 https://docs.bunny.net/reference/videolibrarypublic_index
type VideoLibraryAddOptions ¶
type VideoLibraryAddOptions struct { // The name of the Video Library. Name *string `json:"Name,omitempty"` // The geo-replication regions of the underlying storage zone (Optional) ReplicationRegions []string `json:"ReplicationRegions,omitempty"` }
VideoLibraryAddOptions are the request parameters for the Get Video Library API endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/videolibrarypublic_add
type VideoLibraryGetOpts ¶
type VideoLibraryGetOpts struct {
IncludeAccessKey bool `url:"includeAccessKey"`
}
VideoLibraryGetOpts represents optional query parameters available when Getting or Listing Video Libraries
type VideoLibraryListOpts ¶
type VideoLibraryListOpts struct { VideoLibraryGetOpts PaginationOptions }
VideoLibraryListOpts represents both PaginationOptions and the other optional query parameters of the List endpoint.
type VideoLibraryService ¶
type VideoLibraryService struct {
// contains filtered or unexported fields
}
VideoLibraryService communicates with the /videolibrary API endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/videolibrarypublic_index
func (*VideoLibraryService) Add ¶
func (s *VideoLibraryService) Add(ctx context.Context, opts *VideoLibraryAddOptions) (*VideoLibrary, error)
Add creates a new Video Library. opts and the non-optional parameters in the struct must be specified for a successful request. On success the created VideoLibrary is returned.
Bunny.net API docs: https://docs.bunny.net/reference/videolibrarypublic_add
func (*VideoLibraryService) Delete ¶
func (s *VideoLibraryService) Delete(ctx context.Context, id int64) error
Delete removes the Video Library with the given id.
Bunny.net API docs: https://docs.bunny.net/reference/videolibrarypublic_delete
func (*VideoLibraryService) Get ¶
func (s *VideoLibraryService) Get( ctx context.Context, id int64, opts *VideoLibraryGetOpts, ) (*VideoLibrary, error)
Get retrieves the Video Library with the given id.
Bunny.net API docs: https://docs.bunny.net/reference/videolibrarypublic_index2
func (*VideoLibraryService) List ¶
func (s *VideoLibraryService) List( ctx context.Context, opts *VideoLibraryListOpts, ) (*VideoLibraries, error)
List retrieves the Video Libraries. If opts is nil, DefaultPaginationPerPage and DefaultPaginationPage will be used. if opts.Page or or opts.PerPage is < 1, the related DefaultPagination values are used.
Bunny.net API docs: https://docs.bunny.net/reference/videolibrarypublic_index
func (*VideoLibraryService) Update ¶
func (s *VideoLibraryService) Update(ctx context.Context, id int64, opts *VideoLibraryUpdateOptions) (*VideoLibrary, error)
Update changes the configuration the Video Library with the given ID. Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_updatepullzone
type VideoLibraryUpdateOptions ¶
type VideoLibraryUpdateOptions struct { Name *string `json:"Name,omitempty"` CustomHTML *string `json:"CustomHTML,omitempty"` PlayerKeyColor *string `json:"PlayerKeyColor,omitempty"` EnableTokenAuthentication *bool `json:"EnableTokenAuthentication,omitempty"` EnableTokenIPVerification *bool `json:"EnableTokenIPVerification,omitempty"` ResetToken *bool `json:"ResetToken,omitempty"` WatermarkPositionLeft *int32 `json:"WatermarkPositionLeft,omitempty"` WatermarkPositionTop *int32 `json:"WatermarkPositionTop,omitempty"` WatermarkWidth *int32 `json:"WatermarkWidth,omitempty"` WatermarkHeight *int32 `json:"WatermarkHeight,omitempty"` EnabledResolutions *string `json:"EnabledResolutions,omitempty"` ViAiPublisherID *string `json:"ViAiPublisherId,omitempty"` VastTagURL *string `json:"VastTagUrl,omitempty"` WebhookURL *string `json:"WebhookUrl,omitempty"` CaptionsFontSize *int32 `json:"CaptionsFontSize,omitempty"` CaptionsFontColor *string `json:"CaptionsFontColor,omitempty"` CaptionsBackground *string `json:"CaptionsBackground,omitempty"` UILanguage *string `json:"UILanguage,omitempty"` AllowEarlyPlay *bool `json:"AllowEarlyPlay,omitempty"` PlayerTokenAuthenticationEnabled *bool `json:"PlayerTokenAuthenticationEnabled,omitempty"` BlockNoneReferrer *bool `json:"BlockNoneReferrer,omitempty"` EnableMP4Fallback *bool `json:"EnableMP4Fallback,omitempty"` KeepOriginalFiles *bool `json:"KeepOriginalFiles,omitempty"` AllowDirectPlay *bool `json:"AllowDirectPlay,omitempty"` EnableDRM *bool `json:"EnableDRM,omitempty"` Controls *string `json:"Controls,omitempty"` Bitrate240p *int32 `json:"Bitrate240p,omitempty"` Bitrate360p *int32 `json:"Bitrate360p,omitempty"` Bitrate480p *int32 `json:"Bitrate480p,omitempty"` Bitrate720p *int32 `json:"Bitrate720p,omitempty"` Bitrate1080p *int32 `json:"Bitrate1080p,omitempty"` Bitrate1440p *int32 `json:"Bitrate1440p,omitempty"` Bitrate2160p *int32 `json:"Bitrate2160p,omitempty"` ShowHeatmap *bool `json:"ShowHeatmap,omitempty"` EnableContentTagging *bool `json:"EnableContentTagging,omitempty"` FontFamily *string `json:"FontFamily,omitempty"` }
VideoLibraryUpdateOptions represents the request parameters for the Update Storage Zone API endpoint.
Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_updatepullzone
Source Files ¶
- client.go
- dnszone.go
- dnszone_add.go
- dnszone_add_dns_record.go
- dnszone_delete.go
- dnszone_delete_dns_record.go
- dnszone_get.go
- dnszone_list.go
- dnszone_update.go
- dnszone_update_dns_record.go
- edgerules.go
- errors.go
- opts.go
- pullzone.go
- pullzone_add.go
- pullzone_add_custom_certificate.go
- pullzone_add_custom_hostname.go
- pullzone_delete.go
- pullzone_edgerule_add_update.go
- pullzone_edgerule_delete.go
- pullzone_edgerule_set_enabled.go
- pullzone_get.go
- pullzone_list.go
- pullzone_load_free_certificate.go
- pullzone_remove_certificate.go
- pullzone_remove_custom_hostname.go
- pullzone_set_force_ssl.go
- pullzone_update.go
- resource_delete.go
- resource_get.go
- resource_list.go
- resource_post.go
- resource_put.go
- storagezone.go
- storagezone_add.go
- storagezone_delete.go
- storagezone_get.go
- storagezone_list.go
- storagezone_update.go
- videolibrary.go
- videolibrary_add.go
- videolibrary_delete.go
- videolibrary_get.go
- videolibrary_list.go
- videolibrary_update.go