Help us shape the future of Go! Take the 2026 Go Developer Survey

client

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package client isolates provider models from zerops-go v1.0.24.

Index

Constants

View Source
const (
	ProcessStatusFinished      = "FINISHED"
	ProcessStatusFailed        = "FAILED"
	ProcessStatusCanceled      = "CANCELED"
	ProcessStatusPending       = "PENDING"
	ProcessStatusRunning       = "RUNNING"
	ServiceStatusActive        = "ACTIVE"
	ServiceStatusStopped       = "STOPPED"
	ServiceStatusReadyToDeploy = "READY_TO_DEPLOY"
	ProjectStatusActive        = "ACTIVE"
	AppVersionStatusActive     = "ACTIVE"
)
View Source
const ProductionEndpoint = "https://api.app-prg1.zerops.io"

Variables

This section is empty.

Functions

func CollectPages

func CollectPages[T any](ctx context.Context, fetch func(context.Context, PageQuery) (Page[T], error)) ([]T, error)

CollectPages advances by actual item count, not the requested page size.

func CreatedProject

func CreatedProject(req *http.Request, response []byte) (id, name string, err error)

CreatedProject shares create/import response parsing with shell tooling. req must contain the original creation body, not a consumed network stream.

func EqualPrometheusConfigs

func EqualPrometheusConfigs(a, b []PrometheusConfig) bool

func IsNotFound

func IsNotFound(err error, codes ...string) bool

func RecordIPv4

func RecordIPv4(path, id, address, source string) error

RecordIPv4 can fill in the address after the acquisition recorded an empty one.

func RecordProject

func RecordProject(path, id, name, source string) error

func VPNEncodedKey

func VPNEncodedKey(key string) string

VPNEncodedKey encodes the textual standard-base64 key, retaining URL-base64 padding.

func ValidateTargetEndpoint

func ValidateTargetEndpoint(target Target, endpoint string) error

func ValidateUploadURL

func ValidateUploadURL(target Target, value string) error

Types

type API

type API interface {
	CreateProject(ctx context.Context, id string, v ProjectCreate) (Project, error)
	GetProject(ctx context.Context, id string) (Project, error)
	ListProjects(ctx context.Context, id string, q ProjectQuery) (Page[Project], error)
	UpdateProject(ctx context.Context, id string, v ProjectUpdate) (Project, error)
	UpgradeProject(ctx context.Context, id string, mode string) (*Process, error)
	SetSharedIPv4(ctx context.Context, id string, enabled bool) (Project, error)
	DeleteProject(ctx context.Context, id string) (Process, error)
	ListProjectEnv(ctx context.Context, id string) ([]Env, error)
	GetProjectEnv(ctx context.Context, id string) (Env, error)
	CreateProjectEnv(ctx context.Context, id string, v EnvWrite) (Process, error)
	UpdateProjectEnv(ctx context.Context, id string, v EnvWrite) (Process, error)
	DeleteProjectEnv(ctx context.Context, id string) (Process, error)
	RevealProjectEnv(ctx context.Context, id string) (string, error)
	GetUserData(ctx context.Context, id string) (Env, error)
	CreateUserData(ctx context.Context, id string, v EnvWrite) (Process, error)
	UpdateUserData(ctx context.Context, id string, v EnvWrite) (Process, error)
	DeleteUserData(ctx context.Context, id string) (Process, error)
	RevealUserData(ctx context.Context, id string) (string, error)
	CreateService(ctx context.Context, id string, v ServiceCreate) (ServiceProcess, error)
	GetService(ctx context.Context, id string) (Service, error)
	GetServiceByName(ctx context.Context, id string, name string) (Service, error)
	ListServices(ctx context.Context, id string, q ServiceQuery) (Page[Service], error)
	SetAutoscaling(ctx context.Context, id string, v AutoscalingWrite) (*Process, error)
	StartService(ctx context.Context, id string) (Process, error)
	StopService(ctx context.Context, id string) (Process, error)
	DeleteService(ctx context.Context, id string) (Process, error)
	ListServiceEnv(ctx context.Context, id string) ([]Env, error)
	ListUserData(ctx context.Context, id string, q UserDataQuery) (Page[Env], error)
	CreateObjectStorage(ctx context.Context, id string, v StorageCreate) (ServiceProcess, error)
	GetObjectStorage(ctx context.Context, id string) (StorageInfo, error)
	UpdateObjectStorage(ctx context.Context, id string, v StorageWrite) (Process, error)
	ListHTTPRoutes(ctx context.Context, id string, q PageQuery) (Page[HTTPRoute], error)
	GetHTTPRoute(ctx context.Context, id string) (HTTPRoute, error)
	CreateHTTPRoute(ctx context.Context, id string, v HTTPRouteWrite) (HTTPRoute, error)
	UpdateHTTPRoute(ctx context.Context, id string, v HTTPRouteWrite) (HTTPRoute, error)
	DeleteHTTPRoute(ctx context.Context, id string) error
	RestoreHTTPRoute(ctx context.Context, id string) (HTTPRoute, error)
	SyncHTTPRoutes(ctx context.Context, id string) (Process, error)
	ListPortRoutes(ctx context.Context, id string, q PageQuery) (Page[PortRoute], error)
	GetPortRoute(ctx context.Context, id string) (PortRoute, error)
	CreatePortRoute(ctx context.Context, id string, v PortRouteWrite) (PortRoute, error)
	UpdatePortRoute(ctx context.Context, id string, v PortRouteWrite) (PortRoute, error)
	DeletePortRoute(ctx context.Context, id string) error
	RestorePortRoute(ctx context.Context, id string) (PortRoute, error)
	SyncPortRoutes(ctx context.Context, id string) (Process, error)
	GetProcess(ctx context.Context, id string) (Process, error)
	ListServiceProcesses(ctx context.Context, id string, q PageQuery) (Page[Process], error)
	ListProjectProcesses(ctx context.Context, id string, q PageQuery) (Page[Process], error)
	CreateAppVersion(ctx context.Context, id string, name string) (UploadVersion, error)
	GetAppVersion(ctx context.Context, id string) (AppVersion, error)
	ListAppVersions(ctx context.Context, id string, q PageQuery) (Page[AppVersion], error)
	ExportProject(ctx context.Context, id string, reveal bool) (string, error)
	Settings(ctx context.Context, id string) (Settings, error)
	Regions(ctx context.Context) ([]Region, error)
	ListOrganizations(context.Context) ([]Organization, error)
	SetSubdomainAccess(context.Context, string, bool) (Process, error)
	TriggerGitPipeline(context.Context, string, GitPipelineRequest) (PipelineProcess, error)
	DeployAppVersion(context.Context, string, DeployRequest, bool) (Process, error)
	UploadArchive(context.Context, string, io.Reader, int64) error
	GetProjectByName(context.Context, string, string, []string) (Project, error)
	RequestDedicatedIPv4(context.Context, string) (Process, error)
	SetRemoteLogging(context.Context, string, RemoteLoggingWrite) (Process, error)
	GetL7BalancerConfig(context.Context, string) (L7BalancerConfig, error)
	SetL7BalancerConfig(context.Context, string, map[string]*string) (Process, error)
	CreateVPNPeer(context.Context, string, string) (VPNPeer, error)
	GetVPNPeer(context.Context, string, string) (VPNPeer, error)
	DeleteVPNPeer(context.Context, string, string) error
	SetHTTPLocations(context.Context, string, []HTTPLocation) (HTTPRoute, error)
	TriggerHTTPDomainsDNSCheck(context.Context, string) error
	SetGitIntegration(context.Context, string, GitIntegrationStatus) (*Process, error)
	GetGitIntegration(context.Context, string) (GitIntegrationStatus, error)
	ImportProject(context.Context, string, string) (ProjectImport, error)
	GetBackupConfig(context.Context, string) (BackupConfig, error)
	SetBackupConfig(context.Context, string, BackupConfigWrite) (*Process, error)
	RestartService(context.Context, string) (Process, error)
	SetStorageCDN(context.Context, string, bool) (Process, error)
	SetPrometheusConfig(context.Context, string, []PrometheusConfig) (*Process, error)
	CreateIntegrationToken(context.Context, string, IntegrationTokenWrite) (IntegrationTokenRaw, error)
	GetIntegrationToken(context.Context, string, string) (IntegrationToken, error)
	UpdateIntegrationToken(context.Context, string, string, IntegrationTokenWrite) (IntegrationToken, error)
	DeleteIntegrationToken(context.Context, string, string) error
	RegenerateIntegrationToken(context.Context, string, string) (IntegrationTokenRaw, error)
}

type APIError

type APIError struct {
	HTTPStatus    int
	Code, Message string
	Meta          any
}

func AsAPIError

func AsAPIError(err error) (*APIError, bool)

func (*APIError) Error

func (e *APIError) Error() string

Error deliberately excludes untrusted server messages and metadata.

type AppVersion

type AppVersion struct {
	ID                string         `json:"id"`
	ServiceStackID    string         `json:"serviceStackId"`
	Name              string         `json:"name"`
	Status            string         `json:"status"`
	Source            string         `json:"source"`
	GitBranch         string         `json:"gitBranch"`
	Created           time.Time      `json:"created"`
	Sequence          int            `json:"sequence"`
	Build             map[string]any `json:"build"`
	PublicGitSource   map[string]any `json:"publicGitSource"`
	GithubIntegration map[string]any `json:"githubIntegration"`
	GitlabIntegration map[string]any `json:"gitlabIntegration"`
}

type Autoscaling

type Autoscaling struct {
	Vertical   *VerticalAutoscaling   `json:"verticalAutoscaling"`
	Horizontal *HorizontalAutoscaling `json:"horizontalAutoscaling"`
}

type AutoscalingWrite

type AutoscalingWrite struct {
	CustomAutoscaling           *Autoscaling   `json:"customAutoscaling"`
	AutoscalingProfileID        *string        `json:"autoscalingProfileId"`
	AutoscalingProfileOverrides map[string]any `json:"autoscalingProfileOverrides"`
}

type BackupConfig

type BackupConfig struct {
	BackupConfigWrite
	DefaultRetentionPolicy *BackupRetentionPolicy `json:"defaultRetentionPolicy"`
}

func (*BackupConfig) UnmarshalJSON

func (v *BackupConfig) UnmarshalJSON(data []byte) error

type BackupConfigWrite

type BackupConfigWrite struct {
	BackupPeriod    *string                `json:"backupPeriod"`
	RetentionPolicy *BackupRetentionPolicy `json:"retentionPolicy"`
}

type BackupRetentionPolicy

type BackupRetentionPolicy struct {
	MaxTotalFiles int64    `json:"maxTotalFiles"`
	MaxTotalGiB   int64    `json:"maxTotalGiB"`
	ProtectedTags []string `json:"protectedTags"`
	MinDaily      int64    `json:"minDaily"`
	MaxDaily      int64    `json:"maxDaily"`
	MinWeekly     int64    `json:"minWeekly"`
	MaxWeekly     int64    `json:"maxWeekly"`
	MinMonthly    int64    `json:"minMonthly"`
	MaxMonthly    int64    `json:"maxMonthly"`
}

func (*BackupRetentionPolicy) UnmarshalJSON

func (v *BackupRetentionPolicy) UnmarshalJSON(data []byte) error

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(cfg Config) (*Client, error)

func (*Client) AllProjectProcesses

func (c *Client) AllProjectProcesses(ctx context.Context, id string) ([]Process, error)

func (*Client) AllServiceProcesses

func (c *Client) AllServiceProcesses(ctx context.Context, id string) ([]Process, error)

func (*Client) CreateAppVersion

func (c *Client) CreateAppVersion(ctx context.Context, id string, name string) (UploadVersion, error)

func (*Client) CreateHTTPRoute

func (c *Client) CreateHTTPRoute(ctx context.Context, id string, v HTTPRouteWrite) (HTTPRoute, error)

func (*Client) CreateIntegrationToken

func (c *Client) CreateIntegrationToken(ctx context.Context, org string, v IntegrationTokenWrite) (IntegrationTokenRaw, error)

func (*Client) CreateObjectStorage

func (c *Client) CreateObjectStorage(ctx context.Context, id string, v StorageCreate) (ServiceProcess, error)

func (*Client) CreatePortRoute

func (c *Client) CreatePortRoute(ctx context.Context, id string, v PortRouteWrite) (PortRoute, error)

func (*Client) CreateProject

func (c *Client) CreateProject(ctx context.Context, id string, v ProjectCreate) (Project, error)

func (*Client) CreateProjectEnv

func (c *Client) CreateProjectEnv(ctx context.Context, id string, v EnvWrite) (Process, error)

func (*Client) CreateService

func (c *Client) CreateService(ctx context.Context, id string, v ServiceCreate) (ServiceProcess, error)

func (*Client) CreateUserData

func (c *Client) CreateUserData(ctx context.Context, id string, v EnvWrite) (Process, error)

func (*Client) CreateVPNPeer

func (c *Client) CreateVPNPeer(ctx context.Context, id, key string) (VPNPeer, error)

func (*Client) DeleteHTTPRoute

func (c *Client) DeleteHTTPRoute(ctx context.Context, id string) error

func (*Client) DeleteIntegrationToken

func (c *Client) DeleteIntegrationToken(ctx context.Context, org, id string) error

func (*Client) DeletePortRoute

func (c *Client) DeletePortRoute(ctx context.Context, id string) error

func (*Client) DeleteProject

func (c *Client) DeleteProject(ctx context.Context, id string) (Process, error)

func (*Client) DeleteProjectEnv

func (c *Client) DeleteProjectEnv(ctx context.Context, id string) (Process, error)

func (*Client) DeleteService

func (c *Client) DeleteService(ctx context.Context, id string) (Process, error)

func (*Client) DeleteUserData

func (c *Client) DeleteUserData(ctx context.Context, id string) (Process, error)

func (*Client) DeleteVPNPeer

func (c *Client) DeleteVPNPeer(ctx context.Context, id, key string) error

func (*Client) DeployAppVersion

func (c *Client) DeployAppVersion(ctx context.Context, id string, v DeployRequest, build bool) (Process, error)

func (*Client) ExportProject

func (c *Client) ExportProject(ctx context.Context, id string, reveal bool) (string, error)

func (*Client) GetAppVersion

func (c *Client) GetAppVersion(ctx context.Context, id string) (AppVersion, error)

func (*Client) GetBackupConfig

func (c *Client) GetBackupConfig(ctx context.Context, id string) (BackupConfig, error)

func (*Client) GetGitIntegration

func (c *Client) GetGitIntegration(ctx context.Context, id string) (GitIntegrationStatus, error)

func (*Client) GetHTTPRoute

func (c *Client) GetHTTPRoute(ctx context.Context, id string) (HTTPRoute, error)

func (*Client) GetIntegrationToken

func (c *Client) GetIntegrationToken(ctx context.Context, org, id string) (IntegrationToken, error)

func (*Client) GetL7BalancerConfig

func (c *Client) GetL7BalancerConfig(ctx context.Context, id string) (L7BalancerConfig, error)

func (*Client) GetObjectStorage

func (c *Client) GetObjectStorage(ctx context.Context, id string) (StorageInfo, error)

func (*Client) GetPortRoute

func (c *Client) GetPortRoute(ctx context.Context, id string) (PortRoute, error)

func (*Client) GetProcess

func (c *Client) GetProcess(ctx context.Context, id string) (Process, error)

func (*Client) GetProject

func (c *Client) GetProject(ctx context.Context, id string) (Project, error)

func (*Client) GetProjectByName

func (c *Client) GetProjectByName(ctx context.Context, org, name string, statuses []string) (Project, error)

func (*Client) GetProjectEnv

func (c *Client) GetProjectEnv(ctx context.Context, id string) (Env, error)

func (*Client) GetService

func (c *Client) GetService(ctx context.Context, id string) (Service, error)

func (*Client) GetServiceByName

func (c *Client) GetServiceByName(ctx context.Context, id string, name string) (Service, error)

func (*Client) GetUserData

func (c *Client) GetUserData(ctx context.Context, id string) (Env, error)

func (*Client) GetVPNPeer

func (c *Client) GetVPNPeer(ctx context.Context, id, key string) (VPNPeer, error)

func (*Client) ImportProject

func (c *Client) ImportProject(ctx context.Context, organizationID, yaml string) (ProjectImport, error)

func (*Client) ListAppVersions

func (c *Client) ListAppVersions(ctx context.Context, id string, q PageQuery) (Page[AppVersion], error)

func (*Client) ListHTTPRoutes

func (c *Client) ListHTTPRoutes(ctx context.Context, id string, q PageQuery) (Page[HTTPRoute], error)

func (*Client) ListOrganizations

func (c *Client) ListOrganizations(ctx context.Context) ([]Organization, error)

func (*Client) ListPortRoutes

func (c *Client) ListPortRoutes(ctx context.Context, id string, q PageQuery) (Page[PortRoute], error)

func (*Client) ListProjectEnv

func (c *Client) ListProjectEnv(ctx context.Context, id string) ([]Env, error)

func (*Client) ListProjectProcesses

func (c *Client) ListProjectProcesses(ctx context.Context, id string, q PageQuery) (Page[Process], error)

func (*Client) ListProjects

func (c *Client) ListProjects(ctx context.Context, id string, q ProjectQuery) (Page[Project], error)

func (*Client) ListServiceEnv

func (c *Client) ListServiceEnv(ctx context.Context, id string) ([]Env, error)

func (*Client) ListServiceProcesses

func (c *Client) ListServiceProcesses(ctx context.Context, id string, q PageQuery) (Page[Process], error)

func (*Client) ListServices

func (c *Client) ListServices(ctx context.Context, id string, q ServiceQuery) (Page[Service], error)

func (*Client) ListUserData

func (c *Client) ListUserData(ctx context.Context, id string, q UserDataQuery) (Page[Env], error)

func (*Client) RegenerateIntegrationToken

func (c *Client) RegenerateIntegrationToken(ctx context.Context, org, id string) (IntegrationTokenRaw, error)

func (*Client) Regions

func (c *Client) Regions(ctx context.Context) ([]Region, error)

func (*Client) RequestDedicatedIPv4

func (c *Client) RequestDedicatedIPv4(ctx context.Context, id string) (Process, error)

RequestDedicatedIPv4 requests a billed allocation; there is no release endpoint.

func (*Client) RestartService

func (c *Client) RestartService(ctx context.Context, id string) (Process, error)

func (*Client) RestoreHTTPRoute

func (c *Client) RestoreHTTPRoute(ctx context.Context, id string) (HTTPRoute, error)

func (*Client) RestorePortRoute

func (c *Client) RestorePortRoute(ctx context.Context, id string) (PortRoute, error)

func (*Client) RevealProjectEnv

func (c *Client) RevealProjectEnv(ctx context.Context, id string) (string, error)

func (*Client) RevealUserData

func (c *Client) RevealUserData(ctx context.Context, id string) (string, error)

func (*Client) SetAutoscaling

func (c *Client) SetAutoscaling(ctx context.Context, id string, v AutoscalingWrite) (*Process, error)

func (*Client) SetBackupConfig

func (c *Client) SetBackupConfig(ctx context.Context, id string, v BackupConfigWrite) (*Process, error)

func (*Client) SetGitIntegration

func (c *Client) SetGitIntegration(ctx context.Context, id string, v GitIntegrationStatus) (*Process, error)

SetGitIntegration replaces the connector, or resets it when both blocks are nil. Builds are deliberately never triggered by configuration reconciliation.

func (*Client) SetHTTPLocations

func (c *Client) SetHTTPLocations(ctx context.Context, id string, locations []HTTPLocation) (HTTPRoute, error)

SetHTTPLocations replaces the complete ordered location list, including null config children.

func (*Client) SetL7BalancerConfig

func (c *Client) SetL7BalancerConfig(ctx context.Context, id string, values map[string]*string) (Process, error)

func (*Client) SetPrometheusConfig

func (c *Client) SetPrometheusConfig(ctx context.Context, id string, configs []PrometheusConfig) (*Process, error)

func (*Client) SetRemoteLogging

func (c *Client) SetRemoteLogging(ctx context.Context, id string, v RemoteLoggingWrite) (Process, error)

func (*Client) SetSharedIPv4

func (c *Client) SetSharedIPv4(ctx context.Context, id string, enabled bool) (Project, error)

func (*Client) SetStorageCDN

func (c *Client) SetStorageCDN(ctx context.Context, id string, enabled bool) (Process, error)

func (*Client) SetSubdomainAccess

func (c *Client) SetSubdomainAccess(ctx context.Context, id string, enabled bool) (Process, error)

func (*Client) Settings

func (c *Client) Settings(ctx context.Context, id string) (Settings, error)

func (*Client) StartService

func (c *Client) StartService(ctx context.Context, id string) (Process, error)

func (*Client) StopService

func (c *Client) StopService(ctx context.Context, id string) (Process, error)

func (*Client) SyncHTTPRoutes

func (c *Client) SyncHTTPRoutes(ctx context.Context, id string) (Process, error)

func (*Client) SyncPortRoutes

func (c *Client) SyncPortRoutes(ctx context.Context, id string) (Process, error)

func (*Client) TriggerGitPipeline

func (c *Client) TriggerGitPipeline(ctx context.Context, id string, v GitPipelineRequest) (PipelineProcess, error)

TriggerGitPipeline unwraps process.appVersion rather than treating the nullable process wrapper as a direct process response.

func (*Client) TriggerHTTPDomainsDNSCheck

func (c *Client) TriggerHTTPDomainsDNSCheck(ctx context.Context, id string) error

TriggerHTTPDomainsDNSCheck requests one check; readiness remains a read-only observation.

func (*Client) UpdateHTTPRoute

func (c *Client) UpdateHTTPRoute(ctx context.Context, id string, v HTTPRouteWrite) (HTTPRoute, error)

func (*Client) UpdateIntegrationToken

func (c *Client) UpdateIntegrationToken(ctx context.Context, org, id string, v IntegrationTokenWrite) (IntegrationToken, error)

func (*Client) UpdateObjectStorage

func (c *Client) UpdateObjectStorage(ctx context.Context, id string, v StorageWrite) (Process, error)

func (*Client) UpdatePortRoute

func (c *Client) UpdatePortRoute(ctx context.Context, id string, v PortRouteWrite) (PortRoute, error)

func (*Client) UpdateProject

func (c *Client) UpdateProject(ctx context.Context, id string, v ProjectUpdate) (Project, error)

func (*Client) UpdateProjectEnv

func (c *Client) UpdateProjectEnv(ctx context.Context, id string, v EnvWrite) (Process, error)

func (*Client) UpdateUserData

func (c *Client) UpdateUserData(ctx context.Context, id string, v EnvWrite) (Process, error)

func (*Client) UpgradeProject

func (c *Client) UpgradeProject(ctx context.Context, id string, mode string) (*Process, error)

func (*Client) UploadArchive

func (c *Client) UploadArchive(ctx context.Context, signedURL string, archive io.Reader, size int64) error

UploadArchive is raw HTTP: SDK JSON methods buffer bodies and cannot provide the streaming signed-URL PUT contract. Never add the API bearer token here.

type Config

type Config struct {
	Endpoint, Token, UserAgent string
	Transport                  http.RoundTripper
}

type DeployRequest

type DeployRequest struct {
	ZeropsYaml string `json:"zeropsYaml"`
	Setup      string `json:"zeropsYamlSetup"`
}

type DevTransport

type DevTransport struct {
	Domain string
	Base   http.RoundTripper
}

DevTransport guards every request, including redirects and signed uploads. Base defaults to http.DefaultTransport. Errors never expose signed URLs.

func (DevTransport) RoundTrip

func (g DevTransport) RoundTrip(req *http.Request) (*http.Response, error)

type Env

type Env struct {
	ID             string    `json:"id"`
	ProjectID      string    `json:"projectId"`
	ServiceStackID string    `json:"serviceStackId"`
	Key            string    `json:"key"`
	Content        string    `json:"content"`
	Sensitive      bool      `json:"sensitive"`
	Type           string    `json:"type"`
	Editable       bool      `json:"editable"`
	Internal       bool      `json:"internal"`
	Created        time.Time `json:"created"`
}

type EnvWrite

type EnvWrite struct {
	Key       string `json:"key"`
	Content   string `json:"content"`
	Sensitive bool   `json:"sensitive"`
}

type GitIntegration

type GitIntegration struct {
	RepositoryFullName    string  `json:"repositoryFullName"`
	EventType             string  `json:"eventType"`
	BranchName            *string `json:"branchName"`
	TagRegex              *string `json:"tagRegex"`
	IsActive              bool    `json:"isActive"`
	ZeropsYamlSetup       *string `json:"zeropsYamlSetup"`
	UserID                string  `json:"userId"`
	AuthorizationRequired bool    `json:"authorizationRequired"`
	WebhookID             *int64  `json:"webhookId"`
}

GitIntegration contains repository metadata only; OAuth credentials are server-owned.

type GitIntegrationStatus

type GitIntegrationStatus struct {
	GithubIntegration *GitIntegration `json:"githubIntegration,omitempty"`
	GitlabIntegration *GitIntegration `json:"gitlabIntegration,omitempty"`
}

type GitPipelineRequest

type GitPipelineRequest = PipelineRequest

type HTTPDomain

type HTTPDomain struct {
	DomainName           string  `json:"domainName"`
	SSLStatus            string  `json:"sslStatus"`
	DNSCheckStatus       string  `json:"dnsCheckStatus"`
	CDNStatus            string  `json:"cdnStatus"`
	SSLInstallationError *string `json:"sslCertificateInstallationError"`
}

type HTTPLocation

type HTTPLocation struct {
	Path           string         `json:"path"`
	Port           int            `json:"port"`
	ServiceStackID string         `json:"serviceStackId"`
	Config         map[string]any `json:"config"`
}

type HTTPRoute

type HTTPRoute struct {
	ID           string         `json:"id"`
	ProjectID    string         `json:"projectId"`
	SSLEnabled   bool           `json:"sslEnabled"`
	CDNEnabled   bool           `json:"cdnEnabled"`
	Domains      []HTTPDomain   `json:"domains"`
	Locations    []HTTPLocation `json:"locations"`
	IsSynced     bool           `json:"isSynced"`
	IsEditable   bool           `json:"isEditable"`
	DeleteOnSync bool           `json:"deleteOnSync"`
}

type HTTPRouteWrite

type HTTPRouteWrite struct {
	SSLEnabled bool           `json:"sslEnabled"`
	CDNEnabled *bool          `json:"cdnEnabled"`
	Domains    []string       `json:"domains"`
	Locations  []HTTPLocation `json:"locations"`
}

type HorizontalAutoscaling

type HorizontalAutoscaling struct {
	MinContainerCount *int `json:"minContainerCount"`
	MaxContainerCount *int `json:"maxContainerCount"`
}

type IntegrationToken

type IntegrationToken struct {
	ID string `json:"id"`
	IntegrationTokenWrite
}

IntegrationToken is readable metadata; the bearer is never returned by GET.

type IntegrationTokenProject

type IntegrationTokenProject struct {
	ProjectID string `json:"projectId"`
	RoleCode  string `json:"roleCode"`
}

IntegrationTokenProject scopes an organization's integration token.

type IntegrationTokenRaw

type IntegrationTokenRaw struct {
	IntegrationToken
	Token string `json:"token"`
}

IntegrationTokenRaw is only returned by create and explicit regeneration.

type IntegrationTokenWrite

type IntegrationTokenWrite struct {
	Name              string                    `json:"name"`
	RoleCode          string                    `json:"roleCode"`
	Projects          []IntegrationTokenProject `json:"projects"`
	CanCreateProjects bool                      `json:"canCreateProjects"`
	CanViewFinances   bool                      `json:"canViewFinances"`
	CanEditFinances   bool                      `json:"canEditFinances"`
	Sudo              bool                      `json:"sudo"`
}

type L7BalancerConfig

type L7BalancerConfig struct {
	Values []L7BalancerValue `json:"values"`
}

type L7BalancerValue

type L7BalancerValue struct {
	Name    string  `json:"name"`
	Current *string `json:"current"`
	Default string  `json:"default"`
}

type L7BalancerWrite

type L7BalancerWrite struct {
	Name  string  `json:"name"`
	Value *string `json:"value"`
}

func SortedL7Values

func SortedL7Values(values map[string]*string) []L7BalancerWrite

SortedL7Values makes full replacement requests deterministic, including null resets.

type Ledger

type Ledger struct {
	Projects     map[string]string
	Tokens       map[string]string
	IPv4Projects map[string]string
	IPv4         bool
	// contains filtered or unexported fields
}

func ReadLedger

func ReadLedger(path string) (Ledger, error)

type Location

type Location struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	PingURL string `json:"pingUrl"`
}

type Organization

type Organization struct{ ID, Name, MembershipID, RoleCode string }

type Page

type Page[T any] struct {
	Items                []T
	Total, Offset, Limit int
}

type PageQuery

type PageQuery struct {
	Offset int `json:"offset"`
	Limit  int `json:"limit"`
}

type PipelineProcess

type PipelineProcess struct {
	Process      *Process    `json:"process"`
	AppVersion   *AppVersion `json:"appVersion"`
	AppVersionID string      `json:"appVersionId"`
}

type PipelineRequest

type PipelineRequest struct {
	BuildFromGit string `json:"buildFromGit"`
	Setup        string `json:"zeropsSetup"`
	ZeropsYaml   string `json:"zeropsYaml"`
}

type Port

type Port struct {
	Port        int    `json:"port"`
	Protocol    string `json:"protocol"`
	Scheme      string `json:"scheme"`
	Description string `json:"description"`
	HTTPRouting *bool  `json:"httpRouting"`
	PortRouting *bool  `json:"portRouting"`
}

type PortRoute

type PortRoute struct {
	PortRouteWrite
	ID             string `json:"id"`
	ProjectID      string `json:"projectId"`
	ServiceStackID string `json:"serviceStackId"`
	IsSynced       bool   `json:"isSynced"`
	DeleteOnSync   bool   `json:"deleteOnSync"`
}

type PortRouteWrite

type PortRouteWrite struct {
	PublicIPType      string   `json:"publicIpType"`
	PublicPort        int      `json:"publicPort"`
	InternalPort      int      `json:"internalPort"`
	InternalProtocol  string   `json:"internalProtocol"`
	FirewallPolicy    string   `json:"firewallPolicy"`
	FirewallIPRanges  []string `json:"firewallIpRanges"`
	FirewallAllowMyIP bool     `json:"firewallAllowMyIp"`
}

type Process

type Process struct {
	ID             string        `json:"id"`
	ActionName     string        `json:"actionName"`
	Status         string        `json:"status"`
	ProjectID      string        `json:"projectId"`
	ServiceStackID string        `json:"serviceStackId"`
	Created        *time.Time    `json:"created"`
	Started        *time.Time    `json:"started"`
	Finished       *time.Time    `json:"finished"`
	Error          *ProcessError `json:"error"`
	AppVersionID   string        `json:"appVersionId"`
	AppVersion     *AppVersion   `json:"appVersion"`
}

type ProcessError

type ProcessError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Meta    any    `json:"meta"`
}

type ProdTransport

type ProdTransport struct {
	Base                      http.RoundTripper
	OrgID, LedgerPath, Source string
	// contains filtered or unexported fields
}

ProdTransport is fail-closed even before bootstrap pins OrgID. Use the constructor to resolve the organization rather than trusting environment IDs.

func NewProdTransport

func NewProdTransport(ctx context.Context, cfg Config, requestedOrg, ledgerPath, source string) (*ProdTransport, error)

func (*ProdTransport) Check

func (g *ProdTransport) Check(ctx context.Context, req *http.Request) error

Check is also used by the shell helper; RoundTrip remains the enforcement point so shell execution cannot bypass response recording or the IPv4 lock.

func (*ProdTransport) RecordIPv4Release

func (g *ProdTransport) RecordIPv4Release(ctx context.Context, id string) error

RecordIPv4Release verifies release while holding the same ledger lock used for acquisition. Historical IPv4Projects entries remain available to sweepers.

func (*ProdTransport) RoundTrip

func (g *ProdTransport) RoundTrip(req *http.Request) (*http.Response, error)

type Project

type Project struct {
	ID                      string    `json:"id"`
	ClientID                string    `json:"clientId"`
	Name                    string    `json:"name"`
	Status                  string    `json:"status"`
	Mode                    string    `json:"mode"`
	Description             *string   `json:"description"`
	TagList                 []string  `json:"tagList"`
	PublicIPv4Shared        bool      `json:"publicIpV4Shared"`
	PublicIPv4              *string   `json:"publicIpV4"`
	PublicIPv6              *string   `json:"publicIpV6"`
	PublicZone              string    `json:"publicZone"`
	ZeropsSubdomainHost     string    `json:"zeropsSubdomainHost"`
	LogForwardingType       *string   `json:"logForwardingType"`
	Created                 time.Time `json:"created"`
	PrimaryInstanceLocation Location  `json:"primaryInstanceLocation"`
}

type ProjectCreate

type ProjectCreate struct {
	Name             string            `json:"name"`
	Description      *string           `json:"description"`
	Mode             *string           `json:"mode"`
	TagList          []string          `json:"tagList"`
	UserRoles        []ProjectUserRole `json:"userRoles"`
	EnvVariables     []EnvWrite        `json:"envVariables"`
	EnvSecrets       []EnvWrite        `json:"envSecrets"`
	PublicIPv4Shared bool              `json:"publicIpV4Shared"`
	EnvIsolation     *string           `json:"envIsolation"`
	SSHIsolation     *string           `json:"sshIsolation"`
	MaxCreditLimit   *float64          `json:"maxCreditLimit"`
	Location         *string           `json:"location"`
}

type ProjectImport

type ProjectImport struct {
	ProjectID     string                 `json:"projectId"`
	ProjectName   string                 `json:"projectName"`
	ServiceStacks []ProjectImportService `json:"serviceStacks"`
}

ProjectImport is a newly created project and the work returned for its stacks.

type ProjectImportService

type ProjectImportService struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	Processes []Process `json:"processes"`
}

type ProjectQuery

type ProjectQuery struct {
	PageQuery
	NameContains string   `json:"nameContains,omitempty"`
	Statuses     []string `json:"statuses,omitempty"`
}

type ProjectUpdate

type ProjectUpdate struct {
	Name             string   `json:"name"`
	Description      *string  `json:"description"`
	TagList          []string `json:"tagList"`
	PublicIPv4Shared bool     `json:"publicIpV4Shared"`
	MaxCreditLimit   *float64 `json:"maxCreditLimit"`
}

type ProjectUserRole

type ProjectUserRole struct {
	UserID   string `json:"userId"`
	RoleCode string `json:"roleCode"`
}

type PrometheusConfig

type PrometheusConfig struct {
	Targets []string          `json:"targets"`
	Labels  map[string]string `json:"labels"`
}

PrometheusConfig is one ordered custom service-discovery group.

type PrometheusReader

type PrometheusReader interface {
	GetProject(context.Context, string) (Project, error)
	ListServices(context.Context, string, ServiceQuery) (Page[Service], error)
	ListUserData(context.Context, string, UserDataQuery) (Page[Env], error)
}

PrometheusReader uses public service and user-data collections, including SYSTEM rows.

type PrometheusState

type PrometheusState struct {
	CoreServiceID string
	Configs       []PrometheusConfig
}

func ReadPrometheusConfig

func ReadPrometheusConfig(ctx context.Context, api PrometheusReader, id string) (PrometheusState, error)

ReadPrometheusConfig refuses ambiguous multi-instance projects: the public project response does not identify the primary instance, so choosing one would be unsafe.

type Region

type Region struct {
	Name      string `json:"name"`
	Address   string `json:"address"`
	IsDefault bool   `json:"isDefault"`
}

type RemoteLoggingWrite

type RemoteLoggingWrite struct {
	SyslogConfig string  `json:"syslogConfig"`
	Certificate  string  `json:"certificate"`
	Type         *string `json:"type"`
}

RemoteLoggingWrite replaces both the unreadable configuration and forwarding metadata.

type ScalingMinFreeResource

type ScalingMinFreeResource struct {
	CPUCoreCount   *float64 `json:"cpuCoreCount"`
	CPUCorePercent *float64 `json:"cpuCorePercent"`
	MemoryGBytes   *float64 `json:"memoryGBytes"`
	MemoryPercent  *float64 `json:"memoryPercent"`
}

type ScalingResource

type ScalingResource struct {
	CPUCoreCount *int     `json:"cpuCoreCount"`
	MemoryGBytes *float64 `json:"memoryGBytes"`
	DiskGBytes   *float64 `json:"diskGBytes"`
}

type Service

type Service struct {
	ID                   string          `json:"id"`
	ProjectID            string          `json:"projectId"`
	Name                 string          `json:"name"`
	Status               string          `json:"status"`
	Base                 string          `json:"base"`
	ServiceStackTypeID   string          `json:"serviceStackTypeId"`
	SubdomainAccess      bool            `json:"subdomainAccess"`
	CDNEnabled           *bool           `json:"cdnEnabled"`
	IsSystem             bool            `json:"isSystem"`
	Created              time.Time       `json:"created"`
	CustomAutoscaling    *Autoscaling    `json:"customAutoscaling"`
	CurrentAutoscaling   *Autoscaling    `json:"currentAutoscaling"`
	AutoscalingProfileID *string         `json:"autoscalingProfileId"`
	Ports                []Port          `json:"ports"`
	ActiveAppVersion     *AppVersion     `json:"activeAppVersion"`
	ActiveAppVersionID   string          `json:"-"`
	ServiceTypeCategory  string          `json:"-"`
	ServiceStackTypeInfo ServiceTypeInfo `json:"serviceStackTypeInfo"`
	UserData             []Env           `json:"userData"`
}

type ServiceCreate

type ServiceCreate struct {
	Name                        string         `json:"name"`
	ServiceStackVersionName     string         `json:"serviceStackVersionName"`
	StartWithoutCode            *bool          `json:"startWithoutCode"`
	CustomAutoscaling           *Autoscaling   `json:"customAutoscaling"`
	AutoscalingProfileID        *string        `json:"autoscalingProfileId"`
	AutoscalingProfileOverrides map[string]any `json:"autoscalingProfileOverrides"`
	UserData                    []EnvWrite     `json:"userData"`
	EnvVarsFile                 *string        `json:"envVarsFile"`
	EnvSecretsFile              *string        `json:"envSecretsFile"`
	BuildFromGit                *string        `json:"buildFromGit"`
	ZeropsSetup                 *string        `json:"zeropsSetup"`
	ZeropsYaml                  *string        `json:"zeropsYaml"`
	EnableSubdomainAccess       *bool          `json:"enableSubdomainAccess"`
	EnvIsolation                *string        `json:"envIsolation"`
	SSHIsolation                *string        `json:"sshIsolation"`
	CDNEnabled                  *bool          `json:"cdnEnabled"`
	Location                    *string        `json:"location"`
}

type ServiceProcess

type ServiceProcess struct {
	Service
	Process *Process `json:"process"`
}

type ServiceQuery

type ServiceQuery struct {
	PageQuery
	NameContains string   `json:"nameContains,omitempty"`
	Statuses     []string `json:"statuses,omitempty"`
}

type ServiceType

type ServiceType struct {
	ID               string               `json:"id"`
	Name             string               `json:"name"`
	Category         string               `json:"category"`
	IsRuntime        bool                 `json:"isRuntime"`
	IsManaged        bool                 `json:"isManaged"`
	Modes            []string             `json:"modeList"`
	OperatingSystems []string             `json:"osList"`
	Versions         []ServiceTypeVersion `json:"serviceStackTypeVersionList"`
}

type ServiceTypeConfig

type ServiceTypeConfig struct {
	DefaultAutoscaling  *Autoscaling         `json:"defaultAutoscaling"`
	VerticalAutoscaling *VerticalAutoscaling `json:"verticalAutoscaling"`
}

type ServiceTypeInfo

type ServiceTypeInfo struct {
	Category    string `json:"serviceStackTypeCategory"`
	Name        string `json:"serviceStackTypeName"`
	VersionName string `json:"serviceStackTypeVersionName"`
}

type ServiceTypeVersion

type ServiceTypeVersion struct {
	ID                 string            `json:"id"`
	Name               string            `json:"name"`
	Status             string            `json:"status"`
	VersionNumber      string            `json:"versionNumber"`
	ExactVersionNumber *string           `json:"exactVersionNumber"`
	Config             ServiceTypeConfig `json:"config"`
}

type Settings

type Settings struct {
	Locations    []Location    `json:"locationList"`
	ServiceTypes []ServiceType `json:"serviceStackList"`
}

type StorageCreate

type StorageCreate struct {
	Name       string  `json:"name"`
	DiskGBytes int     `json:"diskGBytes"`
	Policy     *string `json:"policy"`
	RawPolicy  *string `json:"rawPolicy"`
	CDNEnabled *bool   `json:"cdnEnabled"`
}

type StorageInfo

type StorageInfo struct {
	DiskGBytesUsed float64 `json:"diskGBytesUsed"`
	Objects        int64   `json:"objects"`
	RawPolicy      string  `json:"rawPolicy"`
}

type StorageWrite

type StorageWrite struct {
	DiskGBytes int     `json:"diskGBytes"`
	Policy     *string `json:"policy"`
	RawPolicy  *string `json:"rawPolicy"`
	CDNEnabled *bool   `json:"cdnEnabled"`
}

type Target

type Target string
const (
	TargetDev  Target = "dev"
	TargetProd Target = "prod"
)

func ParseTarget

func ParseTarget(value string) (Target, error)

type TransportError

type TransportError struct {
	// contains filtered or unexported fields
}

func (*TransportError) Error

func (e *TransportError) Error() string

func (*TransportError) Unwrap

func (e *TransportError) Unwrap() error

type UploadVersion

type UploadVersion struct {
	AppVersion
	UploadURL string `json:"uploadUrl"`
}

type UserDataQuery

type UserDataQuery struct {
	PageQuery
	KeyContains string `json:"keyContains,omitempty"`
}

type VPNPeer

type VPNPeer struct {
	PublicKey    string         `json:"publicKey"`
	IPv4         VPNPeerAddress `json:"ipv4"`
	IPv6         VPNPeerAddress `json:"ipv6"`
	Setup        string         `json:"setup"`
	SetupLinux   string         `json:"setupLinux"`
	SetupMacOS   string         `json:"setupMacOS"`
	SetupWindows string         `json:"setupWindows"`
}

type VPNPeerAddress

type VPNPeerAddress struct {
	AssignedIPAddress string `json:"assignedIpAddress"`
}

type VerticalAutoscaling

type VerticalAutoscaling struct {
	MaxResource       *ScalingResource        `json:"maxResource"`
	MinResource       *ScalingResource        `json:"minResource"`
	MinFreeResource   *ScalingMinFreeResource `json:"minFreeResource"`
	CPUMode           *string                 `json:"cpuMode"`
	StartCPUCoreCount *int                    `json:"startCpuCoreCount"`
	SwapEnabled       *bool                   `json:"swapEnabled"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL