Documentation
¶
Index ¶
- type APIResponse
- type AnalyticsBucket
- type AnalyticsTimeBucket
- type AnalyticsTotalBucket
- type AppDomain
- type AppDomainType
- type Application
- type ApplicationLanguage
- type ApplicationLogs
- type ApplicationSignal
- type ApplicationStatus
- type ApplicationStatusListItem
- type ApplicationStatusNetwork
- type ApplicationStatusNetworkRaw
- type ApplicationStatusRaw
- type ApplicationUploaded
- type ByteArray
- type DNSRecord
- type Database
- type DatabaseCertificate
- type DatabaseCreateOptions
- type DatabaseCreated
- type DatabasePasswordReset
- type DatabaseResetType
- type DatabaseStatus
- type DatabaseStatusListItem
- type DatabaseStatusRaw
- type DatabaseType
- type DatabaseUpdateOptions
- type Deployment
- type DeploymentCurrent
- type DeploymentFiles
- type DeploymentGithubApp
- type DeploymentState
- type EnvVars
- type FileContent
- type FileInfo
- type FileType
- type FileWritten
- type GithubAppLink
- type GithubAppRepository
- type GithubWebhook
- type LoadBalancer
- type LoadBalancerApp
- type LoadBalancers
- type MetricPoint
- type NetworkAnalytics
- type NetworkErrors
- type NetworkErrorsByMethod
- type NetworkErrorsByStatus
- type NetworkErrorsSummary
- type NetworkErrorsSummaryClass
- type NetworkErrorsTimeseries
- type NetworkErrorsTopPath
- type NetworkLatency
- type NetworkLog
- type NetworkLogClient
- type NetworkLogRequest
- type NetworkLogResponse
- type NetworkPerformance
- type NetworkPerformanceColo
- type NetworkPerformanceCountry
- type NetworkPerformanceSlowPath
- type NetworkPerformanceSummary
- type NetworkPerformanceTimeseries
- type RealtimeEvent
- type ServiceStatus
- type Snapshot
- type SnapshotCreated
- type SnapshotScope
- type User
- type UserApplication
- type UserDatabase
- type UserPlan
- type UserPlanMemory
- type Workspace
- type WorkspaceApp
- type WorkspaceCreated
- type WorkspaceInviteCode
- type WorkspaceMember
- type WorkspaceMemberGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIResponse ¶
type AnalyticsBucket ¶
type AnalyticsBucket struct {
Type string `json:"type"`
Date time.Time `json:"date"`
Visits int `json:"visits"`
Requests int `json:"requests"`
Bytes int64 `json:"bytes"`
}
AnalyticsBucket is a per-dimension 15-minute bucket — Type identifies the dimension value (country name, HTTP method, browser, ASN tag, ...).
type AnalyticsTimeBucket ¶
type AnalyticsTimeBucket struct {
Date time.Time `json:"date"`
Visits int `json:"visits"`
Requests int `json:"requests"`
Bytes int64 `json:"bytes"`
}
AnalyticsTimeBucket is one point of the "visits" 15-minute time series.
type AnalyticsTotalBucket ¶
type AnalyticsTotalBucket struct {
Type string `json:"type"`
Visits int `json:"visits"`
Requests int `json:"requests"`
Bytes int64 `json:"bytes"`
}
AnalyticsTotalBucket is a whole-window bucket (no time dimension) used by the ips, status_codes, bots and content_types breakdowns.
type AppDomain ¶
type AppDomain struct {
AppID string `json:"app_id"`
Hostname string `json:"hostname"`
Type AppDomainType `json:"type"`
}
AppDomain is one hostname configured on one of the account's applications, returned by GET /apps/domains. Custom domains are listed first.
type AppDomainType ¶
type AppDomainType string
AppDomainType of a hostname listed by GET /apps/domains.
const ( AppDomainTypeSubdomain AppDomainType = "subdomain" AppDomainTypeCustom AppDomainType = "custom" )
type Application ¶
type Application struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"desc,omitempty"`
Owner string `json:"owner"`
Cluster string `json:"cluster"`
RAM int `json:"ram"`
Language string `json:"language"`
Domain *string `json:"domain"`
Custom *string `json:"custom"`
CreatedAt time.Time `json:"created_at"`
}
Application is the full descriptor returned by GET /apps/{id}.
type ApplicationLanguage ¶
ApplicationLanguage is the runtime detected for an uploaded application.
type ApplicationLogs ¶
type ApplicationLogs struct {
Logs string `json:"logs"`
}
type ApplicationSignal ¶
type ApplicationSignal string
const ( ApplicationSignalStart ApplicationSignal = "START" ApplicationSignalStop ApplicationSignal = "STOP" ApplicationSignalRestart ApplicationSignal = "RESTART" )
type ApplicationStatus ¶
type ApplicationStatus struct {
CPU string `json:"cpu"`
RAM string `json:"ram"`
Status string `json:"status"`
Running bool `json:"running"`
Storage string `json:"storage"`
Network ApplicationStatusNetwork `json:"network"`
// Uptime is the Unix timestamp (ms) at which the resource last started.
// nil when not running.
Uptime *int64 `json:"uptime"`
}
ApplicationStatus is the runtime stats of GET /apps/{id}/status (and GET /databases/{id}/status). Usage fields come formatted as strings ("0.50%", "120/512MB"); see ApplicationStatusRaw for ?rawData=true.
type ApplicationStatusListItem ¶
type ApplicationStatusListItem struct {
ID string `json:"id"`
Running bool `json:"running"`
CPU string `json:"cpu,omitempty"`
RAM string `json:"ram,omitempty"`
}
ApplicationStatusListItem is one entry of GET /apps/status. CPU and RAM are present only when the application is running.
type ApplicationStatusRaw ¶
type ApplicationStatusRaw struct {
CPU float64 `json:"cpu"`
RAM float64 `json:"ram"`
Status string `json:"status"`
Running bool `json:"running"`
Storage int64 `json:"storage"`
Network ApplicationStatusNetworkRaw `json:"network"`
Uptime *int64 `json:"uptime"`
}
ApplicationStatusRaw is the ?rawData=true variant of ApplicationStatus: numbers instead of formatted strings, [in, out] byte pairs for network.
type ApplicationUploaded ¶
type ApplicationUploaded struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Subdomain string `json:"subdomain,omitempty"`
RAM int `json:"ram"`
CPU int `json:"cpu"`
Language ApplicationLanguage `json:"language"`
}
ApplicationUploaded is the response of POST /apps. Description and Subdomain are present only when set in squarecloud.config.
type ByteArray ¶
type ByteArray []byte
ByteArray decodes a JSON array of numbers (Node Buffer data) into raw bytes.
func (*ByteArray) UnmarshalJSON ¶
type DNSRecord ¶
type DNSRecord struct {
Type string `json:"type"`
Name string `json:"name"`
Value string `json:"value"`
Status string `json:"status"`
}
DNSRecord is one record the user must set at their DNS provider, returned by GET /apps/{id}/network/dns. Value for "cname" records is always "cname.squareweb.app". Status is passed through from the edge provider (e.g. "pending", "pending_validation", "active").
type Database ¶
type Database struct {
ID string `json:"id"`
Name string `json:"name"`
Owner string `json:"owner"`
Cluster string `json:"cluster"`
RAM int `json:"ram"`
Type DatabaseType `json:"type"`
Port int `json:"port"`
CreatedAt time.Time `json:"created_at"`
}
Database is the full descriptor returned by GET /databases/{id}.
type DatabaseCertificate ¶
type DatabaseCertificate struct {
// Certificate is a base64-encoded PEM certificate.
Certificate string `json:"certificate"`
}
DatabaseCertificate is the response of GET /databases/{id}/credentials/certificate.
type DatabaseCreateOptions ¶
type DatabaseCreateOptions struct {
// Name is the display name, 1-32 chars.
Name string `json:"name"`
// Memory in MB.
Memory int `json:"memory"`
Type DatabaseType `json:"type"`
// Version key supported for the chosen Type (see the Square Cloud docs).
Version string `json:"version"`
}
DatabaseCreateOptions is the body of POST /databases.
type DatabaseCreated ¶
type DatabaseCreated struct {
ID string `json:"id"`
Name string `json:"name"`
Memory int `json:"memory"`
CPU int `json:"cpu"`
Type DatabaseType `json:"type"`
// Password is the one-time database password. Shown only at creation.
Password string `json:"password"`
// Certificate is a base64-encoded PEM TLS certificate, when applicable.
Certificate string `json:"certificate,omitempty"`
// ConnectionURL is a ready-to-use connection string with the password embedded.
ConnectionURL string `json:"connection_url"`
Cluster string `json:"cluster"`
}
DatabaseCreated is the response of POST /databases. Password (and Certificate when applicable) are returned only at creation and cannot be recovered later.
type DatabasePasswordReset ¶
type DatabasePasswordReset struct {
// Password is shown only once.
Password string `json:"password"`
}
DatabasePasswordReset is the response body of a password reset. Certificate resets return a status-only payload.
type DatabaseResetType ¶
type DatabaseResetType string
DatabaseResetType selects which credential to rotate via POST /databases/{id}/credentials/reset.
const ( DatabaseResetPassword DatabaseResetType = "password" DatabaseResetCertificate DatabaseResetType = "certificate" )
type DatabaseStatus ¶
type DatabaseStatus = ApplicationStatus
DatabaseStatus shares the runtime stats shape with ApplicationStatus.
type DatabaseStatusListItem ¶
type DatabaseStatusListItem = ApplicationStatusListItem
DatabaseStatusListItem is one entry of GET /databases/status.
type DatabaseStatusRaw ¶
type DatabaseStatusRaw = ApplicationStatusRaw
DatabaseStatusRaw shares the ?rawData=true shape with ApplicationStatusRaw.
type DatabaseType ¶
type DatabaseType string
DatabaseType is the database engine slug.
const ( DatabaseTypeMongo DatabaseType = "mongo" DatabaseTypeMySQL DatabaseType = "mysql" DatabaseTypeRedis DatabaseType = "redis" DatabaseTypePostgres DatabaseType = "postgres" )
type DatabaseUpdateOptions ¶
type DatabaseUpdateOptions struct {
Name string `json:"name,omitempty"`
RAM int `json:"ram,omitempty"`
}
DatabaseUpdateOptions is the body of PATCH /databases/{id}. At least one field must be set.
type Deployment ¶
type Deployment struct {
ID string `json:"id"`
Date time.Time `json:"date"`
State DeploymentState `json:"state"`
Branch string `json:"branch,omitempty"`
Files *DeploymentFiles `json:"files,omitempty"`
}
Deployment is one event in the timeline of a deploy returned by GET /apps/{id}/deployments. ID is the commit SHA-1 (40 hex chars), shared by every event of the same deploy. Branch is set on "clone" events and Files on "commit" events.
type DeploymentCurrent ¶
type DeploymentCurrent struct {
App *DeploymentGithubApp `json:"app,omitempty"`
Webhook string `json:"webhook,omitempty"`
}
DeploymentCurrent is the current Git deploy configuration returned by GET /apps/{id}/deployments/current. A nil App means no GitHub App linkage.
type DeploymentFiles ¶
type DeploymentFiles struct {
Added []string `json:"added"`
Removed []string `json:"removed"`
Modified []string `json:"modified"`
}
DeploymentFiles is the changed-file list emitted alongside the "commit" step of a deploy timeline.
type DeploymentGithubApp ¶
type DeploymentState ¶
type DeploymentState string
DeploymentState is the lifecycle step of a single deploy event.
const ( DeploymentStatePending DeploymentState = "pending" DeploymentStateClone DeploymentState = "clone" DeploymentStateCommit DeploymentState = "commit" DeploymentStateRestarting DeploymentState = "restarting" DeploymentStateSuccess DeploymentState = "success" DeploymentStateError DeploymentState = "error" )
type EnvVars ¶
EnvVars is the application environment variables as a key → value map. Up to 256 entries per application; keys max 1024 chars, values max 4096.
type FileContent ¶
FileContent is the response of GET /apps/{id}/files/content. The API returns a Node-style Buffer object ({"type":"Buffer","data":[...]}).
type FileInfo ¶
type FileInfo struct {
Type FileType `json:"type"`
Name string `json:"name"`
// Size in bytes. 0 for directories.
Size int `json:"size"`
// LastModified is a Unix timestamp in milliseconds.
LastModified int64 `json:"lastModified"`
}
FileInfo is one entry of GET /apps/{id}/files.
type FileWritten ¶
type FileWritten struct {
Written bool `json:"written"`
}
FileWritten is the response of PUT /apps/{id}/files.
type GithubAppLink ¶
type GithubAppLink struct {
Repository GithubAppRepository `json:"repository"`
}
GithubAppLink is the response of POST /apps/{id}/deploy/github-app.
type GithubAppRepository ¶
type GithubWebhook ¶
type GithubWebhook struct {
Webhook string `json:"webhook"`
}
GithubWebhook is the response of POST /apps/{id}/deploy/webhook when enrolling a token. Absent when removing (access_token "@").
type LoadBalancer ¶
type LoadBalancer struct {
Hostname string `json:"hostname"`
Apps []LoadBalancerApp `json:"apps"`
}
LoadBalancer is one custom domain and the applications serving it. Two or more apps means an active load balancer with automatic failover.
type LoadBalancerApp ¶
type LoadBalancers ¶
type LoadBalancers struct {
Limit int `json:"limit"`
Balancers []LoadBalancer `json:"balancers"`
}
LoadBalancers is the response of GET /apps/load-balancers — the caller's applications grouped by attached custom domain. Limit is the per-domain app cap for the caller's plan (2 Standard / 5 Pro / 10 Enterprise).
type MetricPoint ¶
type MetricPoint struct {
Date time.Time `json:"date"`
CPU float64 `json:"cpu"`
RAM float64 `json:"ram"`
Net []float64 `json:"net"`
}
MetricPoint is a single point of the 24h metrics window returned by GET /apps/{id}/metrics and GET /databases/{id}/metrics — up to 288 points (24h sampled every 5 minutes).
type NetworkAnalytics ¶
type NetworkAnalytics struct {
Visits []AnalyticsTimeBucket `json:"visits"`
Countries []AnalyticsBucket `json:"countries"`
Devices []AnalyticsBucket `json:"devices"`
OS []AnalyticsBucket `json:"os"`
Browsers []AnalyticsBucket `json:"browsers"`
Protocols []AnalyticsBucket `json:"protocols"`
Methods []AnalyticsBucket `json:"methods"`
Paths []AnalyticsBucket `json:"paths"`
Referers []AnalyticsBucket `json:"referers"`
Providers []AnalyticsBucket `json:"providers"`
IPs []AnalyticsTotalBucket `json:"ips"`
StatusCodes []AnalyticsTotalBucket `json:"status_codes"`
Bots []AnalyticsTotalBucket `json:"bots"`
ContentTypes []AnalyticsTotalBucket `json:"content_types"`
}
NetworkAnalytics is the aggregated edge analytics of GET /apps/{id}/network/analytics. The endpoint may return an empty object when the requested window precedes the application's creation date — all slices will be nil in that case.
type NetworkErrors ¶
type NetworkErrors struct {
Summary NetworkErrorsSummary `json:"summary"`
ByStatus []NetworkErrorsByStatus `json:"by_status"`
Timeseries []NetworkErrorsTimeseries `json:"timeseries"`
TopPaths []NetworkErrorsTopPath `json:"top_paths"`
ByMethod []NetworkErrorsByMethod `json:"by_method"`
}
NetworkErrors is the edge error breakdown of GET /apps/{id}/network/errors.
type NetworkErrorsByMethod ¶
type NetworkErrorsByStatus ¶
type NetworkErrorsSummary ¶
type NetworkErrorsSummary struct {
Total int `json:"total"`
ByClass NetworkErrorsSummaryClass `json:"by_class"`
}
type NetworkErrorsTimeseries ¶
type NetworkErrorsTopPath ¶
type NetworkLatency ¶
type NetworkLatency struct {
P50 float64 `json:"p50"`
P95 float64 `json:"p95"`
P99 float64 `json:"p99"`
}
NetworkLatency is the latency percentile triple used by the performance endpoint (milliseconds).
type NetworkLog ¶
type NetworkLog struct {
Timestamp time.Time `json:"timestamp"`
Client NetworkLogClient `json:"client"`
Request NetworkLogRequest `json:"request"`
Response NetworkLogResponse `json:"response"`
}
NetworkLog is a single edge log entry of GET /apps/{id}/network/logs. Available on Pro+ plans.
type NetworkLogClient ¶
type NetworkLogRequest ¶
type NetworkLogResponse ¶
type NetworkPerformance ¶
type NetworkPerformance struct {
Summary NetworkPerformanceSummary `json:"summary"`
Timeseries []NetworkPerformanceTimeseries `json:"timeseries"`
Countries []NetworkPerformanceCountry `json:"countries"`
Colos []NetworkPerformanceColo `json:"colos"`
SlowestPaths []NetworkPerformanceSlowPath `json:"slowest_paths"`
}
NetworkPerformance is the latency report of GET /apps/{id}/network/performance. Available on Pro+ plans.
type NetworkPerformanceColo ¶
type NetworkPerformanceSummary ¶
type NetworkPerformanceSummary struct {
Edge NetworkLatency `json:"edge"`
Origin NetworkLatency `json:"origin"`
Requests int `json:"requests"`
}
type NetworkPerformanceTimeseries ¶
type NetworkPerformanceTimeseries struct {
Date time.Time `json:"date"`
Requests int `json:"requests"`
Edge NetworkLatency `json:"edge"`
Origin NetworkLatency `json:"origin"`
}
type RealtimeEvent ¶
RealtimeEvent is one server-sent event of GET /apps/{id}/realtime. System-level events use Event names like REALTIME_CONNECTING, REALTIME_TIMEOUT, REALTIME_DISCONNECTED, REALTIME_RECONNECT and REALTIME_ERROR; regular frames arrive as "message" with an opaque Data payload (typically JSON).
Connection limits: at most 5 simultaneous connections per user; each connection has a 10-minute TTL — clients must reconnect when it expires.
type ServiceStatus ¶
ServiceStatus is the response of GET /service/status. Note this endpoint returns {status, message} directly, without the usual response envelope.
type Snapshot ¶
type Snapshot struct {
Name string `json:"name"`
Size int `json:"size"`
Modified time.Time `json:"modified"`
Key string `json:"key"`
}
Snapshot is one entry of the snapshot listings (user-, app- and database-scoped).
type SnapshotCreated ¶
SnapshotCreated is the response of POST /apps/{id}/snapshots and POST /databases/{id}/snapshots.
type SnapshotScope ¶
type SnapshotScope string
SnapshotScope selects the domain of GET /users/snapshots.
const ( SnapshotScopeApplications SnapshotScope = "applications" SnapshotScopeDatabases SnapshotScope = "databases" )
type User ¶
type User struct {
ID string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
Locale string `json:"locale"`
Plan UserPlan `json:"plan"`
CreatedAt time.Time `json:"created_at"`
}
User is the authenticated account returned by GET /users/me.
type UserApplication ¶
type UserApplication struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"desc,omitempty"`
RAM int `json:"ram"`
Lang string `json:"lang"`
Cluster string `json:"cluster"`
Domain *string `json:"domain"`
Custom *string `json:"custom"`
CreatedAt time.Time `json:"created_at"`
}
UserApplication is the compact application descriptor returned under response.applications of GET /users/me.
type UserDatabase ¶
type UserDatabase struct {
ID string `json:"id"`
Name string `json:"name"`
RAM int `json:"ram"`
Type string `json:"type"`
Cluster string `json:"cluster"`
CreatedAt time.Time `json:"created_at"`
}
UserDatabase is the compact database descriptor returned under response.databases of GET /users/me.
type UserPlan ¶
type UserPlan struct {
Name string `json:"name"`
Memory UserPlanMemory `json:"memory"`
Duration *int64 `json:"duration"`
}
type UserPlanMemory ¶
type Workspace ¶
type Workspace struct {
// ID is a UUID v4 without hyphens (32 hex chars).
ID string `json:"id"`
Name string `json:"name"`
Owner string `json:"owner"`
Members []WorkspaceMember `json:"members"`
Applications []WorkspaceApp `json:"applications"`
CreatedAt time.Time `json:"createdAt"`
}
Workspace is the full descriptor returned by GET /workspaces/{id} and the listing of GET /workspaces.
type WorkspaceApp ¶
type WorkspaceApp struct {
ID string `json:"id"`
Name string `json:"name"`
Description *string `json:"desc"`
RAM int `json:"ram"`
Lang string `json:"lang"`
Domain *string `json:"domain"`
Custom *string `json:"custom"`
}
WorkspaceApp is an application descriptor as embedded in a workspace listing. Description is always present but may be nil when unset.
type WorkspaceCreated ¶
WorkspaceCreated is the response of POST /workspaces.
type WorkspaceInviteCode ¶
type WorkspaceInviteCode struct {
Code string `json:"code"`
}
WorkspaceInviteCode is the response of GET /workspaces/members/code. The code is single-use and valid for 5 minutes.
type WorkspaceMember ¶
type WorkspaceMember struct {
ID string `json:"id"`
Name string `json:"name"`
Group WorkspaceMemberGroup `json:"group"`
JoinedAt time.Time `json:"joinedAt"`
}
type WorkspaceMemberGroup ¶
type WorkspaceMemberGroup string
WorkspaceMemberGroup is a workspace member permission tier. "owner" and "admin" have full management; "maintain" adds operational access; "manager" covers monitoring and lifecycle control; "view" is read-only.
const ( WorkspaceGroupOwner WorkspaceMemberGroup = "owner" WorkspaceGroupAdmin WorkspaceMemberGroup = "admin" WorkspaceGroupMaintain WorkspaceMemberGroup = "maintain" WorkspaceGroupManager WorkspaceMemberGroup = "manager" WorkspaceGroupView WorkspaceMemberGroup = "view" )