Sign Up

ReservationsService

Dedicated-Mac reservations. 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_FLAG_DISABLED, thrown as AuthorizationError); listing, reading and turning auto-renew off do not.

Constructors

Constructor

new ReservationsService(http: AxiosInstance): ReservationsService;

Parameters:

  • http AxiosInstance

Returns:

  • ReservationsService

Methods

create()

create(options: CreateReservationOptions): Promise<MacReservation>;

Reserve a Mac in region. The request always carries an Idempotency-Key: idempotencyKey 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 reservation instead of reserving a second Mac. Fails with ConflictError code === 'NO_MAC_AVAILABLE' when the region has no free Mac.

Parameters:

  • options CreateReservationOptions

Returns:

  • Promise<MacReservation>

get()

get(id: string): Promise<MacReservation>;

Parameters:

  • id string

Returns:

  • Promise<MacReservation>

list()

list(): Promise<MacReservation[]>;

Every reservation of the organization, in one response.

Returns:

  • Promise<MacReservation[]>

renew()

renew(id: string): Promise<MacReservation>;

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

Parameters:

  • id string

Returns:

  • Promise<MacReservation>

update()

update(id: string, options: UpdateReservationOptions): Promise<MacReservation>;

Turn the lease'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 lease renewing. Fails with ConflictError when the lease is no longer live.

Parameters:

  • id string
  • options UpdateReservationOptions

Returns:

  • Promise<MacReservation>

CreateReservationOptions

Properties:

  • region string - Region slug to reserve a Mac in.
  • vmsPerMac? number - macOS sandboxes the Mac may run at once; the server defaults it to 2, the maximum.
  • idempotencyKey? string - A retry with the same key returns the first request's reservation instead of reserving (and charging for) a second Mac. Omitted: a random key per call, so pass your own if you may retry.
  • autoRenew? boolean - Whether the lease renews itself each period. The server defaults it to the organization's auto-reserve setting at purchase time.

MacReservation

type MacReservation = Schema<"MacReservation">

UpdateReservationOptions

Properties:

  • autoRenew boolean - Whether the lease renews itself each period.