Service
Accessors use the last response without making a request.Service::builder()
Example
Example
ServiceBuilder.
Parameters
slugimpl Into<String>Service slug, e.g.
“my-app”.Returns
Builder for the new Service.
Service::get()
Parameters
slug&strService slug.
Returns
The Service’s current state.
Service::list()
Returns
One page of Services.
Service::list_with()
Example
Example
MicrosandboxError::InvalidConfig before any request.
Parameters
configureimpl FnOnce(ServiceListBuilder) -> ServiceListBuilderSets the list options.
Returns
One page of Services.
svc.slug()
svc.url()
svc.status()
refresh() returns a current copy. An unrecognized backend value is ServiceStatus::Unknown.
svc.target()
None when the Service is detached.
Returns
The current target, or
None when detached.svc.created_at()
svc.updated_at()
svc.update()
Example
Example
OutcomeUnknown, get and check the Service.
Parameters
configureimpl FnOnce(ServiceUpdate) -> ServiceUpdateSets the fields to 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
sandboximpl Into<String>Target sandbox name.
portu16Sandbox port, 1 through 65535.
builder.create()
MicrosandboxError::InvalidConfig 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.
ServiceUpdate
Fields for one target update. No fields or port zero fails withMicrosandboxError::InvalidConfig before any request.
u.target()
Parameters
sandboximpl Into<String>Target sandbox name.
portu16Sandbox port, 1 through 65535.
ServiceListBuilder
l.sandbox()
Parameters
nameimpl Into<String>Sandbox name.
l.limit()
Parameters
limitu32Page size.
l.cursor()
next_cursor.
Parameters
cursorimpl Into<String>Opaque cursor.
ServicePage
servicesVec<Service>Services in this page, in slug order.
next_cursorOption<String>Cursor for the next page, or
None on the final page.ServiceStatus
This enum may gain variants, so amatch needs a wildcard arm.
EnabledRoutes requests to its target.
DisabledRetains its target without routing requests.
DetachedHas no target.
UnknownThe backend returned an unrecognized status.
ServiceTarget
sandboxStringCurrent name of the target sandbox.
portu16Sandbox port that receives requests.
ServiceError
A refused Service change or an unknown outcome, returned asMicrosandboxError::Service { slug, error }. changed() on either error returns a ChangeState. A missing Service returns MicrosandboxError::ServiceNotFound, an unavailable slug returns MicrosandboxError::ServiceAlreadyExists, and a missing target sandbox returns MicrosandboxError::SandboxNotFound.
QuotaExceededThe organization’s Service limit was reached. Remove a Service or request a higher limit.
SandboxLimitExceededThe target sandbox’s Service limit was reached. Remove or move a Service, or request a higher limit.
ConflictAnother change to the Service committed first. Get it, then retry.
DetachedThe Service is detached. Set a target.
TargetUnreachableretry_after: Option<Duration>The target sandbox cannot be reached right now. Retry later, after
retry_after when set.TargetNotRunningThe target sandbox is not running. Start it, then retry.
ChangesPausedretry_after: Option<Duration>Service changes are paused. Retry later, after
retry_after when set.OutcomeUnknownThe change may have been applied. Get and check the Service before retrying.
Othercode: String, status: u16, message: StringThe change was refused with a reason this SDK does not recognize. The raw code, HTTP status, and message remain available.
ChangeState
Returned bychanged() on MicrosandboxError and on ServiceError. Call changed() on every error from Service create, update, enable, disable, or remove, not only MicrosandboxError::Service. Invalid input, refusals, missing Services or sandboxes, unavailable slugs, unsupported backends, and connections that failed before the request was sent report Unchanged; other errors report Unknown.
UnchangedNothing changed.
UnknownThe change may have been applied. Get and check the Service before retrying.