storagezone_get.go raw

   1  package bunny
   2  
   3  import (
   4  	"context"
   5  	"fmt"
   6  )
   7  
   8  // StorageZone represents the response of the List and Get Storage Zone API endpoint.
   9  //
  10  // Bunny.net API docs: https://docs.bunny.net/reference/storagezonepublic_index2 https://docs.bunny.net/reference/storagezonepublic_index
  11  type StorageZone struct {
  12  	ID *int64 `json:"Id,omitempty"`
  13  
  14  	UserID             *string     `json:"UserId,omitempty"`
  15  	Name               *string     `json:"Name,omitempty"`
  16  	Password           *string     `json:"Password,omitempty"`
  17  	DateModified       *string     `json:"DateModified,omitempty"`
  18  	Deleted            *bool       `json:"Deleted,omitempty"`
  19  	StorageUsed        *int64      `json:"StorageUsed,omitempty"`
  20  	FilesStored        *int64      `json:"FilesStored,omitempty"`
  21  	Region             *string     `json:"Region,omitempty"`
  22  	ReplicationRegions []string    `json:"ReplicationRegions,omitempty"`
  23  	PullZones          []*PullZone `json:"PullZones,omitempty"`
  24  	ReadOnlyPassword   *string     `json:"ReadOnlyPassword,omitempty"`
  25  }
  26  
  27  // Get retrieves the Storage Zone with the given id.
  28  //
  29  // Bunny.net API docs: https://docs.bunny.net/reference/storagezonepublic_index2
  30  func (s *StorageZoneService) Get(ctx context.Context, id int64) (*StorageZone, error) {
  31  	path := fmt.Sprintf("storagezone/%d", id)
  32  	return resourceGet[StorageZone](ctx, s.client, path, nil)
  33  }
  34