model

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: May 13, 2025 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package model provides the models for the Zeabur API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BannedReasonType

type BannedReasonType string

BannedReasonType is the type of reason a user is banned

const (
	BannedReasonVPN        BannedReasonType = "VPN"
	BannedReasonMiner      BannedReasonType = "MINER"
	BannedReasonAggregator BannedReasonType = "AGGREGATOR"
	BannedReasonMirror     BannedReasonType = "MIRROR"
	BannedReasonDMCA       BannedReasonType = "DMCA"
	BannedReasonIllegal    BannedReasonType = "ILLEGAL"
)

valid banned reasons

type Connection

type Connection[T any] struct {
	PageInfo *PageInfo  `json:"pageInfo" graphql:"pageInfo"`
	Edges    []*Edge[T] `json:"edges" graphql:"edges"`
}

type CreateServiceInput

type CreateServiceInput struct {
	ProjectID string          `json:"projectID" graphql:"projectID"`
	Name      string          `json:"name" graphql:"name"`
	Template  ServiceTemplate `graphql:"template"`
}

type Deployment

type Deployment struct {
	ID string `graphql:"_id"`

	ProjectID     string `json:"projectID" graphql:"projectID"`
	ServiceID     string `json:"serviceID" graphql:"serviceID"`
	EnvironmentID string `json:"environmentID" graphql:"environmentID"`
	GitProvider   string `json:"gitProvider" graphql:"gitProvider"`
	RepoOwner     string `json:"repoOwner" graphql:"repoOwner"`
	RepoName      string `json:"repoName" graphql:"repoName"`
	Ref           string `json:"ref" graphql:"ref"`
	CommitSHA     string `json:"commitSHA" graphql:"commitSHA"`
	CommitMessage string `json:"commitMessage" graphql:"commitMessage"`

	PlanType string `json:"planType" graphql:"planType"`

	CreatedAt   time.Time `json:"createdAt" graphql:"createdAt"`
	ScheduledAt time.Time `json:"scheduledAt" graphql:"scheduledAt"`
	StartedAt   time.Time `json:"startedAt" graphql:"startedAt"`
	FinishedAt  time.Time `json:"finishedAt" graphql:"finishedAt"`

	Status string `json:"status" graphql:"status"`
}

func (*Deployment) Header

func (d *Deployment) Header() []string

func (*Deployment) Rows

func (d *Deployment) Rows() [][]string

type Deployments

type Deployments []*Deployment

func (Deployments) Header

func (d Deployments) Header() []string

func (Deployments) Rows

func (d Deployments) Rows() [][]string

type Domain

type Domain struct {
	ID            string    `json:"id" graphql:"_id"`
	Domain        string    `json:"domain" graphql:"domain"`
	ServiceID     string    `json:"serviceID" graphql:"serviceID"`
	EnvironmentID string    `json:"environmentID" graphql:"environmentID"`
	ProjectID     string    `json:"projectID" graphql:"projectID"`
	PortName      string    `json:"portName" graphql:"portName"`
	RedirectTo    string    `json:"redirectTo" graphql:"redirectTo"`
	Status        string    `json:"status" graphql:"status"`
	IsGenerated   bool      `json:"isGenerated" graphql:"isGenerated"`
	CreatedAt     time.Time `json:"createdAt" graphql:"createdAt"`
}

type Domains

type Domains []*Domain

func (Domains) Header

func (d Domains) Header() []string

func (Domains) Rows

func (d Domains) Rows() [][]string

type Edge

type Edge[T any] struct {
	Node   *T     `json:"node" graphql:"node"`
	Cursor string `json:"cursor" graphql:"cursor"`
}

type Environment

type Environment struct {
	CreatedAt time.Time `graphql:"createdAt"`
	ID        string    `graphql:"_id"`
	Name      string    `graphql:"name"`
	ProjectID string    `graphql:"projectID"`
}

Environment is the simplest model of environment, which is used in most queries.

func (*Environment) Header

func (e *Environment) Header() []string

func (*Environment) Rows

func (e *Environment) Rows() [][]string

type Environments

type Environments []*Environment

func (Environments) Header

func (e Environments) Header() []string

func (Environments) Rows

func (e Environments) Rows() [][]string

type ExportedTemplate

type ExportedTemplate struct {
	ResourceYAML string   `graphql:"resourceYAML"`
	Warnings     []string `graphql:"warnings"`
}

ExportedTemplate is the exported template of the given project.

type GenericRegion

type GenericRegion interface {
	GetID() string
	IsAvailable() bool
	String() string
}

type GitRepo

type GitRepo struct {
	Name  string `graphql:"name"`
	Owner string `graphql:"owner"`
	URL   string `graphql:"url"`
	ID    int    `graphql:"id"`
}

type GitTrigger

type GitTrigger struct {
	BranchName string `json:"branchName" graphql:"branchName"`
	Provider   string `json:"provider" graphql:"provider"`
	RepoID     int    `json:"repoID" graphql:"repoID"`
}

GitTrigger represents a git trigger.

type Log

type Log struct {
	Timestamp time.Time `json:"timestamp" graphql:"timestamp"`
	Message   string    `json:"message" graphql:"message"`
}

func (*Log) Header

func (l *Log) Header() []string

func (*Log) Rows

func (l *Log) Rows() [][]string

type Logs

type Logs []*Log

func (Logs) Header

func (l Logs) Header() []string

func (Logs) Rows

func (l Logs) Rows() [][]string

type Map

type Map map[string]string

type MarketplaceItem

type MarketplaceItem struct {
	Code        string `graphql:"code"`
	Description string `graphql:"description"`
	IconURL     string `graphql:"iconURL"`
	Name        string `graphql:"name"`
	NetworkType string `graphql:"networkType"`
}

type MetricType

type MetricType string

MetricType is the type of metric.

const (
	MetricTypeCPU     MetricType = "CPU"
	MetricTypeMemory  MetricType = "MEMORY"
	MetricTypeNetwork MetricType = "NETWORK"
)

valid metric types

func (MetricType) GetGraphQLType

func (m MetricType) GetGraphQLType() string

func (MetricType) WithMeasureUnit

func (m MetricType) WithMeasureUnit(v float64) string

type PageInfo

type PageInfo struct {
	StartCursor     string `json:"startCursor" graphql:"startCursor"`
	EndCursor       string `json:"endCursor" graphql:"endCursor"`
	TotalCount      int    `json:"totalCount" graphql:"totalCount"`
	HasNextPage     bool   `json:"hasNextPage" graphql:"hasNextPage"`
	HasPreviousPage bool   `json:"hasPreviousPage" graphql:"hasPreviousPage"`
}

PageInfo is the pagination information

type PrebuiltItem

type PrebuiltItem struct {
	ID          string `graphql:"id"`
	Name        string `graphql:"name"`
	Description string `graphql:"description"`
}

type Project

type Project struct {
	ID          string `graphql:"_id"`
	Name        string `graphql:"name"`
	Description string `graphql:"description"`
	//Environments []Environment     `graphql:"environments"`
	CreatedAt time.Time `graphql:"createdAt"`
	//Owner         User      `graphql:"owner"`
	//Collaborators []User    `graphql:"collaborators"`
	IconURL string `graphql:"iconURL"`
	//Services []Service `graphql:"services"`
	Region Region `graphql:"region"`
}

Project is the simplest model of project, which is used in most queries.

func (*Project) Header

func (p *Project) Header() []string

func (*Project) Rows

func (p *Project) Rows() [][]string

type ProjectConnection

type ProjectConnection struct {
	PageInfo *PageInfo      `json:"pageInfo"`
	Edges    []*ProjectEdge `json:"edges"`
}

ProjectConnection is a connection to a list of items.

type ProjectEdge

type ProjectEdge struct {
	Node   *Project `json:"node"`
	Cursor string   `json:"cursor"`
}

ProjectEdge is an edge in a connection.

type ProjectUsage

type ProjectUsage struct {
	// the project this usage is for
	Project *Project `json:"project"`
	// the beginning of the time period
	From time.Time `json:"from"`
	// the end of the time period
	To time.Time `json:"to"`
	// the total number of cpu used (in vCPU-minutes)
	CPU float64 `json:"cpu"`
	// the total number of memory used (in MB-minutes)
	Memory int `json:"memory"`
}

ProjectUsage is a summary of the usage of a project in a given time period.

type Projects

type Projects []*Project

func (Projects) Header

func (p Projects) Header() []string

func (Projects) Rows

func (p Projects) Rows() [][]string

type Region

type Region struct {
	Available   bool           `graphql:"available"`
	Description string         `graphql:"description"`
	ID          string         `graphql:"id"`
	Name        string         `graphql:"name"`
	Coordinates []float64      `graphql:"coordinates"`
	Provider    RegionProvider `graphql:"provider"`
}

func (Region) GetID

func (r Region) GetID() string

func (Region) IsAvailable

func (r Region) IsAvailable() bool

func (Region) String

func (r Region) String() string

type RegionProvider

type RegionProvider string

type RepoConfig

type RepoConfig struct {
	IsPublicRepo bool   `json:"isPublicRepo"`
	RepoName     string `json:"repoName"`
	ServiceName  string `json:"serviceName"`
}

type RepoConfigs

type RepoConfigs []*RepoConfig

type Server

type Server struct {
	ID      string  `graphql:"_id"`
	Country *string `graphql:"country"`
	City    *string `graphql:"city"`
	IP      string  `graphql:"ip"`
	Name    string  `graphql:"name"`
}

func (Server) GetID

func (s Server) GetID() string

func (Server) IsAvailable

func (s Server) IsAvailable() bool

func (Server) String

func (s Server) String() string

type Service

type Service struct {
	ID   string `graphql:"_id"`
	Name string `graphql:"name"`
	// Template  ServiceTemplate    `graphql:"template"`
	Project *struct {
		ID string `graphql:"_id"`
	} `graphql:"project"`

	CreatedAt time.Time `graphql:"createdAt"`

	// MarketItemCode is the code of the item in the marketplace. Only used if Template is ServiceTemplateMarketplace.
	MarketItemCode *string `graphql:"marketItemCode"`

	CustomBuildCommand *string  `graphql:"customBuildCommand"`
	CustomStartCommand *string  `graphql:"customStartCommand"`
	OutputDir          *string  `graphql:"outputDir"`
	RootDirectory      string   `graphql:"rootDirectory"`
	Template           string   `graphql:"template"`
	WatchPaths         []string `graphql:"watchPaths"`
}

Service is the simplest model of service, which is used in most queries.

func (*Service) Header

func (s *Service) Header() []string

func (*Service) Rows

func (s *Service) Rows() [][]string

type ServiceDetail

type ServiceDetail struct {
	Service    `graphql:"... on Service"`
	GitTrigger *GitTrigger `graphql:"gitTrigger(environmentID: $environmentID)"`
	ConsoleURL string      `graphql:"consoleURL(environmentID: $environmentID)"`
	Status     string      `graphql:"status(environmentID: $environmentID)"`
	Domains    []Domain    `graphql:"domains(environmentID: $environmentID)"`
}

ServiceDetail has more information related to specific environment.

func (*ServiceDetail) Header

func (s *ServiceDetail) Header() []string

func (*ServiceDetail) Rows

func (s *ServiceDetail) Rows() [][]string

type ServiceDetails

type ServiceDetails []*ServiceDetail

func (ServiceDetails) Header

func (s ServiceDetails) Header() []string

func (ServiceDetails) Rows

func (s ServiceDetails) Rows() [][]string

type ServiceInTemplate

type ServiceInTemplate struct {
	BranchName         string                 `json:"branchName"`
	CustomBuildCommand string                 `json:"customBuildCommand"`
	CustomStartCommand string                 `json:"customStartCommand"`
	DomainKey          string                 `json:"domainKey"`
	GitNamespaceID     int                    `json:"gitNamespaceID"`
	GitRepoID          int                    `json:"gitRepoID"`
	MarketplaceItem    MarketplaceItem        `json:"marketplaceItem"`
	Name               string                 `json:"name"`
	OutputDir          string                 `json:"outputDir"`
	RootDirectory      string                 `json:"rootDirectory"`
	Template           ServiceTemplate        `json:"template"`
	Variables          map[string]interface{} `json:"variables"`
	WatchPaths         []string               `json:"watchPaths"`
}

type ServiceInstruction

type ServiceInstruction struct {
	Category string                               `graphql:"category"`
	Content  string                               `graphql:"content"`
	Title    string                               `graphql:"title"`
	Type     ServiceSpecConnectionInstructionType `graphql:"type"`
}

type ServiceInstructions

type ServiceInstructions struct {
	Instructions []ServiceInstruction `graphql:"instructions"`
}

type ServiceMetric

type ServiceMetric struct {
	Metrics []struct {
		Timestamp time.Time `json:"timestamp" graphql:"timestamp"`
		Value     float64   `json:"value" graphql:"value"`
	} `` /* 153-byte string literal not displayed */
}

ServiceMetric is a metric of a service.

type ServiceSpecConfigInput

type ServiceSpecConfigInput struct {
	Path     string `json:"path" graphql:"path"`
	Template string `json:"template" graphql:"template"`
}

type ServiceSpecConnectionInstructionType

type ServiceSpecConnectionInstructionType string
const (
	ServiceSpecConnectionInstructionTypePassword ServiceSpecConnectionInstructionType = "PASSWORD"
	ServiceSpecConnectionInstructionTypeURL      ServiceSpecConnectionInstructionType = "URL"
	ServiceSpecConnectionInstructionTypeText     ServiceSpecConnectionInstructionType = "TEXT"
)

type ServiceSpecEnvInput

type ServiceSpecEnvInput struct {
	Key      string `json:"key" graphql:"key"`
	Required bool   `json:"required" graphql:"required"`
	Default  string `json:"default" graphql:"default"`
	Expose   bool   `json:"expose" graphql:"expose"`
	Readonly bool   `json:"readonly" graphql:"readonly"`
}

type ServiceSpecInitRuleInput

type ServiceSpecInitRuleInput struct {
	ID      string   `json:"id" graphql:"id"`
	Image   string   `json:"image" graphql:"image"`
	Command []string `json:"command" graphql:"command"`

	Volumes []ServiceSpecInitVolumeMountInput `json:"volumes" graphql:"volumes"`
}

type ServiceSpecInitVolumeMountInput

type ServiceSpecInitVolumeMountInput struct {
	ID        string `json:"id" graphql:"id"`
	MountPath string `json:"mountPath" graphql:"mountPath"`
	SubPath   string `json:"subPath" graphql:"subPath"`
}

type ServiceSpecPortInput

type ServiceSpecPortInput struct {
	ID   string `json:"id" graphql:"id"`
	Port int    `json:"port" graphql:"port"`
	// Type is the type of the port, e.g. TCP, UDP, HTTP.
	Type string `json:"type" graphql:"type"`
}

type ServiceSpecSchemaInput

type ServiceSpecSchemaInput struct {
	ID          string   `json:"id" graphql:"id"`
	Name        string   `json:"name" graphql:"name"`
	Description string   `json:"description" graphql:"description"`
	Tags        []string `json:"tags" graphql:"tags"`
	Icon        string   `json:"icon" graphql:"icon"`
	Docs        string   `json:"docs" graphql:"docs"`

	Source       *ServiceSpecSourceInput       `json:"source" graphql:"source"`
	Ports        []ServiceSpecPortInput        `json:"ports" graphql:"ports"`
	Volumes      []ServiceSpecVolumeEntryInput `json:"volumes" graphql:"volumes"`
	Instructions []ServiceInstruction          `json:"instructions" graphql:"instructions"`
	Env          []ServiceSpecEnvInput         `json:"env" graphql:"env"`
	InitRules    []ServiceSpecInitRuleInput    `json:"initRules" graphql:"initRules"`
	Configs      []ServiceSpecConfigInput      `json:"configs" graphql:"configs"`
}

type ServiceSpecSourceInput

type ServiceSpecSourceInput struct {
	Image   string   `json:"image" graphql:"image"`
	Command []string `json:"command" graphql:"command"`
	Args    []string `json:"args" graphql:"args"`

	// Git only fields
	Source        string   `json:"source,omitempty" graphql:"source"`
	RepoID        int      `json:"repoID,omitempty" graphql:"repoID"`
	Branch        string   `json:"branch,omitempty" graphql:"branch"`
	SubModuleName string   `json:"subModuleName,omitempty" graphql:"subModuleName"`
	WatchPaths    []string `json:"watchPaths,omitempty" graphql:"watchPaths"`
}

type ServiceSpecVolumeEntryInput

type ServiceSpecVolumeEntryInput struct {
	ID string `json:"id" graphql:"id"`
	// Dir should be started with `/` (absolute).
	Dir string `json:"dir" graphql:"dir"`
}

type ServiceTemplate

type ServiceTemplate string
const (
	RegionProviderAWS ServiceTemplate = "AWS"
	RegionProviderGCP ServiceTemplate = "GCP"
)
const (
	ServiceTemplateGit         ServiceTemplate = "GIT"
	ServiceTemplateMarketplace ServiceTemplate = "MARKETPLACE"
)

type Services

type Services []*Service

func (Services) Header

func (s Services) Header() []string

func (Services) Rows

func (s Services) Rows() [][]string

type Tabler

type Tabler interface {
	Header() []string
	Rows() [][]string
}

Tabler represents the model that can be displayed as a table

type TempTCPPort

type TempTCPPort struct {
	ServiceID     string `json:"serviceID" graphql:"serviceID"`
	EnvironmentID string `json:"environmentID" graphql:"environmentID"`
	TargetPort    int    `json:"targetPort" graphql:"targetPort"`
	NodePort      int    `json:"nodePort" graphql:"nodePort"`
	RemainSeconds int    `json:"remainSeconds" graphql:"remainSeconds"`
}

TempTCPPort is a temporary TCP port.

type Template

type Template struct {
	CreatedAt     time.Time `graphql:"createdAt"`
	DeploymentCnt int       `graphql:"deploymentCnt"`
	Code          string    `graphql:"code"`
	Description   string    `graphql:"description"`
	Name          string    `graphql:"name"`
	PreviewURL    string    `graphql:"previewURL"`
	Readme        string    `graphql:"readme"`
	Tags          []string  `graphql:"tags"`
}

func (*Template) Header

func (t *Template) Header() []string

func (*Template) Rows

func (t *Template) Rows() [][]string

type TemplateConnection

type TemplateConnection struct {
	PageInfo *PageInfo       `json:"pageInfo"`
	Edges    []*TemplateEdge `json:"edges"`
}

type TemplateEdge

type TemplateEdge struct {
	Node   *Template `json:"node"`
	Cursor string    `json:"cursor"`
}

type Templates

type Templates []*Template

func (Templates) Header

func (t Templates) Header() []string

func (Templates) Rows

func (t Templates) Rows() [][]string

type User

type User struct {
	CreatedAt *time.Time `json:"createdAt" graphql:"createdAt"`
	BannedAt  *time.Time `json:"bannedAt" graphql:"bannedAt"`
	//BannedReason    *BannedReasonType  `json:"bannedReason" graphql:"bannedReason"`
	//EmailPreference map[string]bool    `json:"emailPreference" graphql:"emailPreference"`
	AgreedAt *time.Time `json:"agreedAt" graphql:"agreedAt"`
	// DiscordID is the user's Discord ID.
	DiscordID *string `json:"discordID" graphql:"discordID"`
	ID        string  `json:"_id" graphql:"_id"`
	Name      string  `json:"name" graphql:"name"`
	Email     string  `json:"email" graphql:"email"`
	Username  string  `json:"username" graphql:"username"`
	Language  string  `json:"language" graphql:"language"`
	AvatarURL string  `json:"avatarUrl" graphql:"avatarURL"`
	GitHubID  int64   `json:"githubID" graphql:"githubID"`
}

User is the simplest model of user, which is used in most queries.

func (*User) Header

func (u *User) Header() []string

func (*User) Rows

func (u *User) Rows() [][]string

type Variable

type Variable struct {
	Key       string `json:"key" graphql:"key"`
	Value     string `json:"value" graphql:"value"`
	ServiceID string `json:"serviceID" graphql:"serviceID"`
}

type Variables

type Variables []*Variable

func (Variables) Header

func (v Variables) Header() []string

func (Variables) Rows

func (v Variables) Rows() [][]string

func (Variables) ToMap

func (v Variables) ToMap() map[string]string

Jump to

Keyboard shortcuts

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