Functions
CreateService()
Example
Example
ErrInvalidConfig before any request. Repeating a create with the same slug and target returns the existing Service while it is enabled. Get and check the Service if ctx ends after the request is sent.
Parameters
slugstringService slug, e.g.
“my-app”.targetServiceTargetThe running sandbox and port that receive requests. The port is 1 through 65535.
Returns
The Service as committed.
GetService()
Parameters
slugstringService slug.
Returns
The Service’s current state.
ListServices()
Returns
One page of Services.
ListServicesWith()
Example
Example
ErrInvalidConfig before any request.
Parameters
configure…ServiceListOptionList options.
Returns
One page of Services.
Service
Accessors use the last response without making a request.svc.Slug()
svc.URL()
svc.Status()
Refresh() returns a current copy.
svc.Target()
nil when the Service is detached.
svc.CreatedAt()
svc.UpdatedAt()
svc.Update()
Example
Example
ErrInvalidConfig before any request. Get and check the Service if ctx ends after the request is sent.
Parameters
targetServiceTargetRunning target; also enables or reattaches the Service.
Returns
The Service as committed.
svc.Enable()
Update() instead.
svc.Disable()
svc.Remove()
svc.Refresh()
Returns
The Service’s current state.
svc.Close()
ErrInvalidHandle; accessors still answer. Calling Close is optional: the handle is released once no copy is reachable. It is safe to call more than once.
ServiceListOption
WithServiceListSandbox()
WithServiceListLimit()
WithServiceListCursor()
NextCursor.
ServicePage
Services[]*ServiceServices in this page, in slug order.
NextCursor*stringCursor for the next page, or
nil on the final page.ServiceStatus
ServiceStatusEnabled”enabled”Routes requests to its target.
ServiceStatusDisabled”disabled”Retains its target without routing requests.
ServiceStatusDetached”detached”Has no target.
ServiceStatusUnknown”unknown”The backend returned an unrecognized status.
ServiceTarget
SandboxstringCurrent name of the target sandbox.
Portuint16Sandbox port, 1 through 65535.
ServiceError
A refused Service change or an unknown outcome. Useerrors.As to inspect it; IsKind(err, ErrService) also matches it. Check for a missing Service with IsKind(err, ErrServiceNotFound), an unavailable slug with IsKind(err, ErrServiceAlreadyExists), and a missing target sandbox with IsKind(err, ErrSandboxNotFound).
SlugstringService slug.
ReasonServiceErrorReasonReason for the failure.
RetryAftertime.DurationRetry delay returned with the refusal, or zero when none was returned.
ChangedChangeStateChangeUnknown means the change may have been applied; get and check the Service.RawCodestringRaw error code returned with a
ServiceReasonOther refusal; empty otherwise.RawStatusintHTTP status returned with a
ServiceReasonOther refusal; zero otherwise.RawMessagestringRaw message returned with a
ServiceReasonOther refusal; empty otherwise.Reasons
ServiceReasonQuotaExceededThe organization’s Service limit was reached. Remove a Service or request a higher limit.
ServiceReasonSandboxLimitExceededThe target sandbox’s Service limit was reached. Remove or move a Service, or request a higher limit.
ServiceReasonConflictAnother change to the Service committed first. Get it, then retry.
ServiceReasonDetachedThe Service is detached. Set a target.
ServiceReasonTargetUnreachableThe target sandbox cannot be reached right now. Retry later, after
RetryAfter when set.ServiceReasonTargetNotRunningThe target sandbox is not running. Start it, then retry.
ServiceReasonChangesPausedService changes are paused. Retry later, after
RetryAfter when set.ServiceReasonOutcomeUnknownThe change may have been applied. Get and check the Service before retrying.
ServiceReasonOtherA reason this SDK does not recognize;
RawCode, RawStatus, and RawMessage preserve the refusal.ChangeState
Every error fromCreateService, Update, Enable, Disable, or Remove carries Changed on the base *Error. Use var e *m.Error and errors.As(err, &e) to inspect it.
ChangeUnchanged”unchanged”Nothing changed.
ChangeUnknown”unknown”The change may have been applied. Get and check the Service before retrying.