ReservationService
class ReservationService()Dedicated-Mac reservations, which macOS sandboxes run on.
ReservationService.__init__
def __init__(impl: AsyncReservationService, bridge: SyncBridge) -> NoneReservationService.create
def create(*,
region: str,
model: Optional[str] = None,
idempotency_key: Optional[str] = None,
auto_renew: Optional[bool] = None) -> MacReservationReserve a Mac of model in region.
ReservationService.create_bulk
def create_bulk(*,
region: str,
count: int,
min_count: Optional[int] = None,
model: Optional[str] = None,
auto_renew: Optional[bool] = None,
idempotency_key: Optional[str] = None) -> MacReservationBatchReserve count Macs of one model in region in one request.
ReservationService.get
def get(reservation_id: str) -> MacReservationReservationService.iter
def iter(*,
cursor: Optional[str] = None,
limit: Optional[int] = None) -> Iterator[MacReservation]Every reservation of the organization, draining page by page.
ReservationService.list
def list(*,
cursor: Optional[str] = None,
limit: Optional[int] = None) -> ListResult[MacReservation]One page of the organization's reservations.
ReservationService.renew
def renew(reservation_id: str,
*,
idempotency_key: Optional[str] = None) -> MacReservationRenew the reservation for its next period, which the server charges.
ReservationService.update
def update(reservation_id: str, *, auto_renew: bool) -> MacReservationTurn the reservation's auto-renewal on or off.
AsyncReservationService
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.
AsyncReservationService.__init__
def __init__(transport: AsyncTransport) -> NoneAsyncReservationService.create
async def create(*,
region: str,
model: Optional[str] = None,
idempotency_key: Optional[str] = None,
auto_renew: Optional[bool] = None) -> MacReservationReserve 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.
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.
AsyncReservationService.create_bulk
async def create_bulk(*,
region: str,
count: int,
min_count: Optional[int] = None,
model: Optional[str] = None,
auto_renew: Optional[bool] = None,
idempotency_key: Optional[str] = None) -> MacReservationBatchReserve 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.
AsyncReservationService.list
async def list(*,
cursor: Optional[str] = None,
limit: Optional[int] = None) -> ListResult[MacReservation]One page of the organization's reservations.
AsyncReservationService.iter
async def iter(*,
cursor: Optional[str] = None,
limit: Optional[int] = None) -> AsyncIterator[MacReservation]Every reservation of the organization, draining page by page.
AsyncReservationService.get
async def get(reservation_id: str) -> MacReservationAsyncReservationService.renew
async def renew(reservation_id: str,
*,
idempotency_key: Optional[str] = None) -> MacReservationRenew 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.
AsyncReservationService.update
async def update(reservation_id: str, *, auto_renew: bool) -> MacReservationTurn 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.
MacReservation
@dataclass(frozen=True, slots=True)
class MacReservation()Attributes:
idstrorg_idstrproject_idstrregionstrstatusMacReservationStatusraw_statusstrsandboxes_per_macintperiod_nintperiod_secondsintcreated_atdatetimeslots_usedintrenewal_pendingboolauto_renewbooloriginMacReservationOriginraw_originstrresources_usedMacResourcesactivated_atOptional[datetime] = NonecapacityOptional[MacResources] = NonemodelOptional[str] = Noneend_reasonOptional[MacReservationEndReason] = Noneraw_end_reasonOptional[str] = Noneended_atOptional[datetime] = Nonepending_mac_started_atOptional[datetime] = Noneperiod_endOptional[datetime] = Noneperiod_started_atOptional[datetime] = Nonereissued_atOptional[datetime] = Nonerenewal_errorOptional[str] = None
MacReservationBatch
@dataclass(frozen=True, slots=True)
class MacReservationBatch()POST /reservations/bulk: requested (the request's count), reserved, and one reservation per reserved Mac.
Attributes:
requestedintreservedintreservationsList[MacReservation]
MacReservationStatus
MacReservationStatus = Literal['pending_charge', 'pending_mac', 'active', 'ending', 'released', 'failed', 'unknown']MacReservationEndReason
MacReservationEndReason = Literal['expired', 'released', 'charge_failed', 'not_accepted', 'reissued', 'operator', 'unknown']MacReservationOrigin
MacReservationOrigin = Literal['explicit', 'auto', 'unknown']