storagezone_add.go raw

   1  package bunny
   2  
   3  import "context"
   4  
   5  // StorageZoneAddOptions are the request parameters for the Get Storage Zone API endpoint.
   6  //
   7  // Bunny.net API docs: https://docs.bunny.net/reference/storagezonepublic_add
   8  type StorageZoneAddOptions struct {
   9  	// The name of the storage zone
  10  	Name *string `json:"Name,omitempty"`
  11  	// The ID of the storage zone that the storage zone is linked to.
  12  	Region *string `json:"Region,omitempty"`
  13  
  14  	// The origin URL of the storage zone where the files are fetched from (Optional)
  15  	OriginURL *string `json:"OriginUrl,omitempty"`
  16  	// The code of the main storage zone region (Optional)
  17  	ReplicationRegions []string `json:"ReplicationRegions,omitempty"`
  18  }
  19  
  20  // Add creates a new Storage Zone.
  21  // opts and the non-optional parameters in the struct must be specified for a successful request.
  22  // On success the created StorageZone is returned.
  23  //
  24  // Bunny.net API docs: https://docs.bunny.net/reference/storagezonepublic_add
  25  func (s *StorageZoneService) Add(ctx context.Context, opts *StorageZoneAddOptions) (*StorageZone, error) {
  26  	return resourcePostWithResponse[StorageZone](ctx, s.client, "/storagezone", opts)
  27  }
  28