pullzone_add.go raw

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