MacModels
type MacModels struct {
// contains filtered or unexported fields
}MacModels reads the Mac model registry and advisory capacity and prices. Obtain this concurrency-safe service from Client.MacModels.
MacModels.Catalog
func (s *MacModels) Catalog(ctx context.Context, opts *MacCatalogOptions) (*MacCatalog, error)Catalog returns advisory free Macs and prices per model and region. Nil options include all regions. Availability can change before a purchase; a nil Price means pricing is unavailable. Invalid UTF-8 returns ErrBadRequest.
Example:
client, err := daytona.New()
if err != nil {
log.Print(err)
return
}
defer func() {
if closeErr := client.Close(); closeErr != nil {
log.Print(closeErr)
}
}()
catalog, err := client.MacModels().Catalog(context.Background(), nil)
if err != nil {
log.Print(err)
return
}
for _, region := range catalog.Regions {
for _, entry := range region.Models {
fmt.Println(region.ID, entry.Model.ID, entry.Available)
if entry.Price != nil {
fmt.Println(entry.Price.PeriodCents, entry.Price.Currency, entry.Price.Period)
}
}
}MacModels.List
func (s *MacModels) List(ctx context.Context) ([]MacModel, error)List returns every registered Mac model, ordered by ID. This registry is not paginated. Malformed response fields return ErrBadRequest.
Example:
client, err := daytona.New()
if err != nil {
log.Print(err)
return
}
defer func() {
if closeErr := client.Close(); closeErr != nil {
log.Print(closeErr)
}
}()
models, err := client.MacModels().List(context.Background())
if err != nil {
log.Print(err)
return
}
for _, model := range models {
fmt.Println(model.ID, model.Cores, model.MemoryMiB)
}MacCatalog
type MacCatalog struct {
// Regions contains matching regions.
Regions []MacCatalogRegion
}MacCatalog describes Mac availability and prices by region.
MacCatalogModel
type MacCatalogModel struct {
// Model describes the physical Mac and sandbox defaults.
Model MacModel
// Available is advisory; another purchase can consume this capacity.
Available int64
// Price is nil when pricing is unavailable.
Price *MacPrice
}MacCatalogModel combines a registered model, availability and optional price.
MacCatalogOptions
type MacCatalogOptions struct {
// Region filters the catalog; empty includes every region.
Region string
}MacCatalogOptions selects the optional catalog region filter.
MacCatalogRegion
type MacCatalogRegion struct {
// ID is the region identifier.
ID string
// DefaultModel is the region's default model slug.
DefaultModel string
// Models contains model availability and prices.
Models []MacCatalogModel
}MacCatalogRegion describes the models offered in one region.
MacModel
type MacModel struct {
// ID is the model slug accepted by Reservations.Create.
ID string
// Name is the display name.
Name string
// Cores counts physical CPU cores.
Cores int64
// MemoryMiB is physical memory in MiB.
MemoryMiB int64
// DiskMiB is physical SSD capacity in MiB.
DiskMiB int64
// SandboxDiskMiB is disk room available to sandboxes in MiB.
SandboxDiskMiB int64
// MaxSandboxes is the maximum concurrent sandbox count.
MaxSandboxes int64
// DefaultSize is nil when no default sandbox size is available.
DefaultSize *MacResources
}MacModel is a registered Mac model and its default sandbox size.
MacPrice
type MacPrice struct {
// CentsPerHour is the hourly price in currency cents.
CentsPerHour float64
// PeriodCents is the price of one complete period in currency cents.
PeriodCents int64
// Period is the billing-period duration.
Period time.Duration
// Currency is the price's currency code.
Currency string
}MacPrice is the price of reserving one Mac for one billing period.
MacResources
type MacResources struct {
// Cores counts physical CPU cores.
Cores int64
// MemoryMiB is memory in MiB.
MemoryMiB int64
// DiskMiB is sandbox disk capacity or usage in MiB.
DiskMiB int64
}MacResources describes physical capacity or usage in CPU cores and MiB.