Skip to content
View as Markdown
class ReservationService()

Dedicated-Mac reservations, which macOS sandboxes run on.

def __init__(impl: AsyncReservationService, bridge: SyncBridge) -> None
def create(*,
region: str,
model: Optional[str] = None,
layout: Optional[Literal['split', 'whole']] = None,
idempotency_key: Optional[str] = None,
auto_renew: Optional[bool] = None) -> MacReservation

Reserve a Mac of model in region.

def create_bulk(*,
region: str,
count: int,
min_count: Optional[int] = None,
model: Optional[str] = None,
layout: Optional[Literal['split', 'whole']] = None,
auto_renew: Optional[bool] = None,
idempotency_key: Optional[str] = None) -> MacReservationBatch

Reserve count Macs of one model in region in one request.

def get(reservation_id: str) -> MacReservation
def iter(*,
cursor: Optional[str] = None,
limit: Optional[int] = None) -> Iterator[MacReservation]

Every reservation of the organization, draining page by page.

def list(*,
cursor: Optional[str] = None,
limit: Optional[int] = None) -> ListResult[MacReservation]

One page of the organization’s reservations.

def renew(reservation_id: str,
*,
idempotency_key: Optional[str] = None) -> MacReservation

Renew the reservation for its next period, which the server charges.

def update(reservation_id: str, *, auto_renew: bool) -> MacReservation

Turn the reservation’s auto-renewal on or off.

class AsyncReservationService()

Dedicated-Mac reservations, which macOS sandboxes run on.

A macOS sandbox runs on a Mac the organization has reserved: reserve one here, or let a macOS create buy one (reservation="new", or the organization’s auto-reserve). A reservation lasts 24-hour periods, each charged when it starts. Reserving, renewing and turning auto-renew on need the organization’s macos_sandboxes feature flag (otherwise 403 FEATURE_NOT_ENABLED, raised as FeatureNotEnabledError); listing, reading and turning auto-renew off do not.

def __init__(transport: AsyncTransport) -> None
async def create(*,
region: str,
model: Optional[str] = None,
layout: Optional[Literal['split', 'whole']] = None,
idempotency_key: Optional[str] = None,
auto_renew: Optional[bool] = None) -> MacReservation

Reserve a Mac of model in region.

model: Mac model slug from GET /mac-models. Omitted uses the region’s default model. An unavailable model is never upgraded.

layout: split runs up to two sandboxes on the Mac, whole runs one. Omitted uses the model’s default layout.

The request always carries an Idempotency-Key: idempotency_key when given, otherwise a random UUID the SDK generates for this call. Pass your own key if you may retry, so a retry after a lost response returns the same reservation instead of reserving a second Mac. auto_renew defaults server-side to the organization’s auto-reserve setting. Raises ConflictError with code == "NO_MAC_AVAILABLE" when no Mac of that model is free in the region.

async def create_bulk(*,
region: str,
count: int,
min_count: Optional[int] = None,
model: Optional[str] = None,
layout: Optional[Literal['split', 'whole']] = None,
auto_renew: Optional[bool] = None,
idempotency_key: Optional[str] = None) -> MacReservationBatch

Reserve count Macs of one model in region in one request.

min_count (default count) is the fewest to accept: with fewer Macs free, the request reserves as many as are free, or none, failing with ConflictError code == “NO_MAC_AVAILABLE” when fewer than min_count are free. The request always carries an Idempotency-Key: idempotency_key when given, otherwise a random key the SDK generates for this call. Pass your own key if you may retry, so a retry after a lost response returns the same reservations instead of reserving more Macs.

async def list(*,
cursor: Optional[str] = None,
limit: Optional[int] = None) -> ListResult[MacReservation]

One page of the organization’s reservations.

async def iter(*,
cursor: Optional[str] = None,
limit: Optional[int] = None) -> AsyncIterator[MacReservation]

Every reservation of the organization, draining page by page.

async def get(reservation_id: str) -> MacReservation
async def renew(reservation_id: str,
*,
idempotency_key: Optional[str] = None) -> MacReservation

Renew the reservation for its next period, which the server charges.

The request always carries an Idempotency-Key: idempotency_key when given, otherwise a random key the SDK generates for this call. Pass your own key if you may retry, so a retry after a lost response does not pay for a second period.

async def update(reservation_id: str, *, auto_renew: bool) -> MacReservation

Turn the reservation’s auto-renewal on or off.

Turning it on needs the organization’s macos_sandboxes feature flag; turning it off works without it, so an organization can stop a reservation renewing. Raises ConflictError when the reservation is no longer live.

@dataclass(frozen=True, slots=True)
class MacReservation()

Attributes:

  • id str
  • org_id str
  • project_id str
  • region str
  • status MacReservationStatus
  • raw_status str
  • sandboxes_per_mac int
  • period_n int
  • period_seconds int
  • created_at datetime
  • slots_used int
  • renewal_pending bool
  • auto_renew bool
  • origin MacReservationOrigin
  • raw_origin str
  • resources_used MacResources
  • layout MacLayout
  • raw_layout str
  • activated_at Optional[datetime] = None
  • capacity Optional[MacResources] = None
  • model Optional[str] = None
  • end_reason Optional[MacReservationEndReason] = None
  • raw_end_reason Optional[str] = None
  • ended_at Optional[datetime] = None
  • pending_mac_started_at Optional[datetime] = None
  • period_end Optional[datetime] = None
  • period_started_at Optional[datetime] = None
  • reissued_at Optional[datetime] = None
  • renewal_error Optional[str] = None
@dataclass(frozen=True, slots=True)
class MacReservationBatch()

POST /reservations/bulk: requested (the request’s count), reserved, and one reservation per reserved Mac.

Attributes:

  • requested int
  • reserved int
  • reservations List[MacReservation]
MacReservationStatus = Literal['pending_charge', 'pending_mac', 'active', 'ending', 'released', 'failed', 'unknown']
MacReservationEndReason = Literal['expired', 'released', 'charge_failed', 'not_accepted', 'reissued', 'operator', 'unknown']
MacReservationOrigin = Literal['explicit', 'auto', 'unknown']