1 package bunny
2 3 import (
4 "context"
5 "fmt"
6 )
7 8 // StorageZoneUpdateOptions represents the request parameters for the Update Storage
9 // Zone API endpoint.
10 //
11 // Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_updatepullzone
12 type StorageZoneUpdateOptions struct {
13 // NOTE: the naming in the Bunny API for this property is inconsistent.
14 // In the update call its `ReplicationZones` but everywhere else its
15 // referred to as `ReplicationRegions`.
16 ReplicationRegions []string `json:"ReplicationZones,omitempty"`
17 OriginURL *string `json:"OriginUrl,omitempty"`
18 Custom404FilePath *string `json:"Custom404FilePath,omitempty"`
19 Rewrite404To200 *bool `json:"Rewrite404To200,omitempty"`
20 }
21 22 // Update changes the configuration the Storage-Zone with the given ID.
23 // Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_updatepullzone
24 func (s *StorageZoneService) Update(ctx context.Context, id int64, opts *StorageZoneUpdateOptions) error {
25 path := fmt.Sprintf("storagezone/%d", id)
26 return resourcePost(ctx, s.client, path, opts)
27 }
28