Service
Properties use the last response without making a request.Static methods
Service.builder()
Example
Example
ServiceBuilder.
Parameters
slugstringService slug, e.g.
“my-app”.Returns
Builder for the new Service.
Service.get()
Parameters
slugstringService slug.
Returns
The Service’s current state.
Service.list()
Returns
One page of Services.
Service.listWith()
Example
Example
RangeError before any request.
Parameters
configure(list: ServiceListBuilder) => ServiceListBuilderSets the list options.
Returns
One page of Services.
Instance properties
svc.slug
string
The Service slug.
svc.url
string
The public URL as returned by the backend.
svc.status
ServiceStatus
Whether the Service routes requests, is disabled, or has no target, as of the read that returned this value. refresh() returns a current copy.
svc.target
ServiceTarget | null
The target, or null when the Service is detached.
svc.createdAt
Date
The creation time.
svc.updatedAt
Date
The last state-change time.
Instance methods
svc.update()
Example
Example
changed is “unknown”, get and check the Service.
Parameters
optionsServiceUpdateOptionsRequired target for the change.
Returns
The Service as committed.
svc.enable()
update() instead.
svc.disable()
svc.remove()
svc.refresh()
Returns
The Service’s current state.
ServiceBuilder
builder.target()
Parameters
sandboxstringTarget sandbox name.
portnumberSandbox port, 1 through 65535.
builder.create()
RangeError; a missing target throws InvalidConfigError. Both errors occur before any request. Repeating a create with the same slug and target returns the existing Service while it is enabled.
Returns
The Service as committed.
ServiceUpdateOptions
Options for one target update. The target is required. A port that is not an integer from 1 through 65535 throwsRangeError before any request.
target
ServiceTarget for its fields.
ServiceListBuilder
l.sandbox()
Parameters
namestringSandbox name.
l.limit()
Parameters
limitnumberPage size.
l.cursor()
nextCursor.
Parameters
cursorstringOpaque cursor.
ServicePage
servicesService[]Services in this page, in slug order.
nextCursorstring | undefinedCursor for the next page, or
undefined on the final page.ServiceStatus
"enabled" routes requests, "disabled" retains the target without routing, "detached" has no target, and "unknown" represents an unrecognized backend value.
ServiceTarget
sandboxstringCurrent name of the target sandbox.
portnumberSandbox port that receives requests.
ServiceError
A refused Service change or an unknown outcome. A missing Service throwsServiceNotFoundError, an unavailable slug throws ServiceAlreadyExistsError, and a missing target sandbox throws SandboxNotFoundError. Every MicrosandboxError from create, update, enable, disable, or remove exposes changed; it is "unknown" when the change may have been applied.
slugstringService slug.
reasonServiceErrorReasonReason for the failure.
retryAfterMsnumber | nullRetry delay returned with the refusal, in milliseconds, or
null.changed”unchanged” | “unknown""unknown” means the change may have been applied; get and check the Service.rawCodestring | nullRaw refusal code when
reason is “other”.rawStatusnumber | nullHTTP status when
reason is “other”.rawMessagestring | nullRaw refusal message when
reason is “other”.Reasons
”serviceQuotaExceeded”The organization’s Service limit was reached. Remove a Service or request a higher limit.
”sandboxServiceLimitExceeded”The target sandbox’s Service limit was reached. Remove or move a Service, or request a higher limit.
”serviceConflict”Another change to the Service committed first. Get it, then retry.
”serviceDetached”The Service is detached. Set a target.
”targetUnreachable”The target sandbox cannot be reached right now. Retry later, after
retryAfterMs when set.”sandboxNotRunning”The target sandbox is not running. Start it, then retry.
”serviceChangesPaused”Service changes are paused. Retry later, after
retryAfterMs when set.”outcomeUnknown”The change may have been applied. Get and check the Service before retrying.
”other”A reason this SDK does not recognize;
rawCode, rawStatus, and rawMessage preserve the refusal, and changed still reports the outcome.ChangeState
”unchanged”Nothing changed.
”unknown”The change may have been applied. Get and check the Service before retrying.