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

saas

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPollingTimeout = &PollingTimeoutError{}

Functions

func CheckAndDownloadArtifact

func CheckAndDownloadArtifact(statusPath, downloadPath, token string, builder *models.Artifact, pollInterval, maxPollTime time.Duration) (string, string, error)

对外导出:兼容外部包调用

func ReDownloadSaasArtifact

func ReDownloadSaasArtifact() error

重新下发SaaS构建任务

func RegisterLicense

func RegisterLicense() error

注册License

func SaasHeaders

func SaasHeaders(token string) map[string]string

统一SaaS请求头

func SecurityAuthAlert added in v0.1.2

func SecurityAuthAlert()

Types

type DownloadResult

type DownloadResult struct {
	Path   string
	Status string
	Err    error
}

type LicenseData added in v0.1.2

type LicenseData struct {
	Username   string `json:"username"`
	Email      string `json:"email,omitempty"`
	Token      string `json:"token,omitempty"`
	Type       string `json:"type"`
	ExpireAt   string `json:"expire_at,omitempty"`
	BuildCount int64  `json:"build_count,omitempty"`
	MaxBuilds  int64  `json:"max_builds,omitempty"`
}

func NewCommunityLicense added in v0.1.2

func NewCommunityLicense() *LicenseData

创建默认的社区版 License 数据

func (*LicenseData) ToLicenseInfo added in v0.1.2

func (l *LicenseData) ToLicenseInfo() *clientpb.LicenseInfo

转换为 protobuf LicenseInfo

type LicenseResponse added in v0.1.2

type LicenseResponse struct {
	Success bool        `json:"success"`
	License LicenseData `json:"license"`
}

LicenseResponse SaaS API 统一响应结构

type PollingTimeoutError

type PollingTimeoutError struct{}

func (*PollingTimeoutError) Error

func (e *PollingTimeoutError) Error() string

type SaasClient

type SaasClient struct {
	Token       string
	BaseURL     string
	LicenseType string
}

func GetSaasClient added in v0.1.2

func GetSaasClient() *SaasClient

func (*SaasClient) CheckAndDownloadArtifact

func (c *SaasClient) CheckAndDownloadArtifact(statusPath, downloadPath string, builder *models.Artifact, pollInterval, maxPollTime time.Duration) DownloadResult

轮询并下载产物

func (*SaasClient) CheckBuildStatus

func (c *SaasClient) CheckBuildStatus(statusPath string) (string, error)

查询构建状态

func (*SaasClient) DownloadArtifact

func (c *SaasClient) DownloadArtifact(downloadPath string, builder *models.Artifact) error

下载构建产物

func (*SaasClient) GetLicenseInfo added in v0.1.2

func (c *SaasClient) GetLicenseInfo() (*clientpb.LicenseInfo, string, error)

获取 License 信息

func (*SaasClient) GetLicenseType added in v0.1.2

func (c *SaasClient) GetLicenseType() string

获取 LicenseType

func (*SaasClient) RegisterLicense added in v0.1.2

func (c *SaasClient) RegisterLicense() (string, error)

注册 License

func (*SaasClient) SetLicenseType added in v0.1.2

func (c *SaasClient) SetLicenseType(typ string)

Jump to

Keyboard shortcuts

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