Documentation
¶
Index ¶
- func Bool(b bool) param.Opt[bool]
- func BoolPtr(v bool) *bool
- func DefaultClientOptions() []option.RequestOption
- func File(rdr io.Reader, filename string, contentType string) file
- func Float(f float64) param.Opt[float64]
- func FloatPtr(v float64) *float64
- func Int(i int64) param.Opt[int64]
- func IntPtr(v int64) *int64
- func Opt[T comparable](v T) param.Opt[T]
- func Ptr[T any](v T) *T
- func String(s string) param.Opt[string]
- func StringPtr(v string) *string
- func Time(t time.Time) param.Opt[time.Time]
- func TimePtr(v time.Time) *time.Time
- type AccountGetResponse
- type AccountService
- type Check
- type CheckListParams
- type CheckListResponse
- type CheckNewParams
- type CheckService
- func (r *CheckService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)
- func (r *CheckService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Check, err error)
- func (r *CheckService) List(ctx context.Context, query CheckListParams, opts ...option.RequestOption) (res *CheckListResponse, err error)
- func (r *CheckService) New(ctx context.Context, body CheckNewParams, opts ...option.RequestOption) (res *Check, err error)
- func (r *CheckService) Update(ctx context.Context, id string, body CheckUpdateParams, ...) (res *Check, err error)
- type CheckUpdateParams
- type Client
- func (r *Client) Delete(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, ...) error
- func (r *Client) Get(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Patch(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Post(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Put(ctx context.Context, path string, params any, res any, ...) error
- type Error
- type HealthzCheckResponse
- type HealthzService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultClientOptions ¶
func DefaultClientOptions() []option.RequestOption
DefaultClientOptions read from the environment (SIMPLECHECKS_API_KEY, SIMPLECHECKS_BASE_URL). This should be used to initialize new clients.
func Opt ¶
func Opt[T comparable](v T) param.Opt[T]
Types ¶
type AccountGetResponse ¶
type AccountGetResponse struct {
// Cached run-credit balance, in run-credit units.
Balance int64 `json:"balance" api:"required"`
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
Name string `json:"name" api:"required"`
// True when execution is paused (e.g. balance exhausted).
Paused bool `json:"paused" api:"required"`
// Billing plan identifier.
Plan string `json:"plan" api:"required"`
// Renameable URL-friendly handle. Display only — never use as a system identifier.
Slug string `json:"slug" api:"required"`
// Stable account identifier (`acct_<typeid>`). Used in API responses and audit
// logs.
Typeid string `json:"typeid" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Balance respjson.Field
CreatedAt respjson.Field
Name respjson.Field
Paused respjson.Field
Plan respjson.Field
Slug respjson.Field
Typeid respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Account profile + cached billing balance. Returned by GET /v1/account.
func (AccountGetResponse) RawJSON ¶
func (r AccountGetResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountGetResponse) UnmarshalJSON ¶
func (r *AccountGetResponse) UnmarshalJSON(data []byte) error
type AccountService ¶
type AccountService struct {
// contains filtered or unexported fields
}
Account profile and balance.
AccountService contains methods and other services that help with interacting with the simplechecks API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAccountService method instead.
func NewAccountService ¶
func NewAccountService(opts ...option.RequestOption) (r AccountService)
NewAccountService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*AccountService) Get ¶
func (r *AccountService) Get(ctx context.Context, opts ...option.RequestOption) (res *AccountGetResponse, err error)
Returns the account row stitched together with the cached billing balance and the `paused` flag, so a single dashboard read fetches everything the customer's home page needs. Requires the `account:read` scope.
type Check ¶
type Check struct {
ID string `json:"id" api:"required"`
// Owning account's `acct_<typeid>`. Read-only.
AccountTypeid string `json:"account_typeid" api:"required"`
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
Enabled bool `json:"enabled" api:"required"`
// Garrison the check is bound to. Server-assigned.
GarrisonID string `json:"garrison_id" api:"required"`
Name string `json:"name" api:"required"`
// Cron expression; minute granularity.
Schedule string `json:"schedule" api:"required"`
TargetURL string `json:"target_url" api:"required" format:"uri"`
TimeoutMs int64 `json:"timeout_ms" api:"required"`
// Check type. Currently only `http` is publicly documented.
Type string `json:"type" api:"required"`
UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
// Optional artifact reference (e.g. uploaded Playwright bundle).
ArtifactURL string `json:"artifact_url"`
// Per-check-type configuration blob. Opaque on the wire.
Config map[string]any `json:"config"`
// Region/location on read responses is empty; populated on create requests only.
Location string `json:"location"`
// Cloud provider on read responses is empty; populated on create requests only.
Provider string `json:"provider"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
AccountTypeid respjson.Field
CreatedAt respjson.Field
Enabled respjson.Field
GarrisonID respjson.Field
Name respjson.Field
Schedule respjson.Field
TargetURL respjson.Field
TimeoutMs respjson.Field
Type respjson.Field
UpdatedAt respjson.Field
ArtifactURL respjson.Field
Config respjson.Field
Location respjson.Field
Provider respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (*Check) UnmarshalJSON ¶
type CheckListParams ¶
type CheckListParams struct {
// Max number of checks to return. Defaults to 100; the server caps further.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Number of checks to skip. Pass the `next_offset` from the previous page.
Offset param.Opt[int64] `query:"offset,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (CheckListParams) URLQuery ¶
func (r CheckListParams) URLQuery() (v url.Values, err error)
URLQuery serializes CheckListParams's query parameters as `url.Values`.
type CheckListResponse ¶
type CheckListResponse struct {
Checks []Check `json:"checks" api:"required"`
// Offset to pass on the next request to continue pagination. Zero (or absent) when
// there's no more data.
NextOffset int64 `json:"next_offset"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Checks respjson.Field
NextOffset respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (CheckListResponse) RawJSON ¶
func (r CheckListResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*CheckListResponse) UnmarshalJSON ¶
func (r *CheckListResponse) UnmarshalJSON(data []byte) error
type CheckNewParams ¶
type CheckNewParams struct {
Enabled bool `json:"enabled" api:"required"`
// Provider-specific region/location.
Location string `json:"location" api:"required"`
Name string `json:"name" api:"required"`
// Cloud provider (`mock`, `ec2`, `ovh`, `azure`, `gcp`, `hetzner`).
Provider string `json:"provider" api:"required"`
Schedule string `json:"schedule" api:"required"`
TargetURL string `json:"target_url" api:"required" format:"uri"`
Type string `json:"type" api:"required"`
ArtifactURL param.Opt[string] `json:"artifact_url,omitzero"`
TimeoutMs param.Opt[int64] `json:"timeout_ms,omitzero"`
Config map[string]any `json:"config,omitzero"`
// contains filtered or unexported fields
}
func (CheckNewParams) MarshalJSON ¶
func (r CheckNewParams) MarshalJSON() (data []byte, err error)
func (*CheckNewParams) UnmarshalJSON ¶
func (r *CheckNewParams) UnmarshalJSON(data []byte) error
type CheckService ¶
type CheckService struct {
// contains filtered or unexported fields
}
CRUD for synthetic-monitoring checks.
CheckService contains methods and other services that help with interacting with the simplechecks API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCheckService method instead.
func NewCheckService ¶
func NewCheckService(opts ...option.RequestOption) (r CheckService)
NewCheckService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*CheckService) Delete ¶
func (r *CheckService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)
Disables the check. Requires the `checks:write` scope.
func (*CheckService) Get ¶
func (r *CheckService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Check, err error)
Returns the check with the given id. 404 if no such check exists for the calling account. Requires the `checks:read` scope.
func (*CheckService) List ¶
func (r *CheckService) List(ctx context.Context, query CheckListParams, opts ...option.RequestOption) (res *CheckListResponse, err error)
Returns the caller's checks with simple offset pagination. `next_offset` is set when a full page was returned and zero when there's no more data. Requires the `checks:read` scope.
func (*CheckService) New ¶
func (r *CheckService) New(ctx context.Context, body CheckNewParams, opts ...option.RequestOption) (res *Check, err error)
Creates a check bound to the resolved garrison for the given `provider` + `location`. Requires the `checks:write` scope.
func (*CheckService) Update ¶
func (r *CheckService) Update(ctx context.Context, id string, body CheckUpdateParams, opts ...option.RequestOption) (res *Check, err error)
All fields in the body are optional; omitted fields are left unchanged. Requires the `checks:write` scope.
type CheckUpdateParams ¶
type CheckUpdateParams struct {
ArtifactURL param.Opt[string] `json:"artifact_url,omitzero"`
Enabled param.Opt[bool] `json:"enabled,omitzero"`
Name param.Opt[string] `json:"name,omitzero"`
Schedule param.Opt[string] `json:"schedule,omitzero"`
TargetURL param.Opt[string] `json:"target_url,omitzero" format:"uri"`
TimeoutMs param.Opt[int64] `json:"timeout_ms,omitzero"`
Type param.Opt[string] `json:"type,omitzero"`
Config map[string]any `json:"config,omitzero"`
// contains filtered or unexported fields
}
func (CheckUpdateParams) MarshalJSON ¶
func (r CheckUpdateParams) MarshalJSON() (data []byte, err error)
func (*CheckUpdateParams) UnmarshalJSON ¶
func (r *CheckUpdateParams) UnmarshalJSON(data []byte) error
type Client ¶
type Client struct {
// Liveness + readiness.
Healthz HealthzService
// Account profile and balance.
Account AccountService
// CRUD for synthetic-monitoring checks.
Checks CheckService
// contains filtered or unexported fields
}
Client creates a struct with services and top level methods that help with interacting with the simplechecks API. You should not instantiate this client directly, and instead use the NewClient method instead.
func NewClient ¶
func NewClient(opts ...option.RequestOption) (r Client)
NewClient generates a new client with the default option read from the environment (SIMPLECHECKS_API_KEY, SIMPLECHECKS_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.
func (*Client) Delete ¶
func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Execute ¶
func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error
Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.
If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.
The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.
If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.
Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.
The response body will be deserialized into the res variable, depending on its type:
- A pointer to a *http.Response is populated by the raw response.
- A pointer to a byte array will be populated with the contents of the request body.
- A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
- A nil value will not read the response body.
For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.
func (*Client) Get ¶
func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Patch ¶
func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
type HealthzCheckResponse ¶
type HealthzCheckResponse struct {
Status string `json:"status" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Status respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (HealthzCheckResponse) RawJSON ¶
func (r HealthzCheckResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*HealthzCheckResponse) UnmarshalJSON ¶
func (r *HealthzCheckResponse) UnmarshalJSON(data []byte) error
type HealthzService ¶
type HealthzService struct {
// contains filtered or unexported fields
}
Liveness + readiness.
HealthzService contains methods and other services that help with interacting with the simplechecks API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewHealthzService method instead.
func NewHealthzService ¶
func NewHealthzService(opts ...option.RequestOption) (r HealthzService)
NewHealthzService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*HealthzService) Check ¶
func (r *HealthzService) Check(ctx context.Context, opts ...option.RequestOption) (res *HealthzCheckResponse, err error)
Returns 200 when the process is up. webapp/api is stateless, so "the process is up" is the entire health story; Kubernetes uses this for both liveness and readiness probes. Public — no auth.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
|
Package json implements encoding and decoding of JSON as defined in RFC 7159. |
|
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
|
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package. |
|
packages
|
|
|
shared
|
|