{"modulePath":"github.com/https-cert/deploy","version":"v0.6.4","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package client\n\n## Functions\n\n```go\nfunc DownloadFile(ctx context.Context, httpClient *http.Client, accessKey, downloadURL, filePath string) error\n```\nDownloadFile 公共的文件下载函数，可被所有客户端复用\n\n```go\nfunc TestProviderConnection(providerName string) (bool, error)\n```\nTestProviderConnection 测试提供商连接\n\n## Types\n\n```go\ntype BusinessExecutor struct {\n\t// contains filtered or unexported fields\n}\n```\nBusinessExecutor 业务执行器，封装可复用的业务逻辑\n\n```go\nfunc NewBusinessExecutor(downloadFile func(downloadURL, filePath string) error) *BusinessExecutor\n```\nNewBusinessExecutor 创建业务执行器\n\n```go\nfunc (be *BusinessExecutor) ExecuteBusiness(providerName string, executeBusinesType deployPB.ExecuteBusinesType, domain, downloadURL, remark, cert, key string) error\n```\nExecuteBusiness 执行业务（根据提供商和业务类型）\n\n```go\nfunc (be *BusinessExecutor) ExecuteWithContext(ctx context.Context, request BusinessRequest) (providers.DeploymentResult, error)\n```\nExecuteWithContext 执行一条支持 context 和结构化结果的业务请求。\n\n```go\ntype BusinessRequest struct {\n\tProviderName       string                      // ProviderName 云服务提供商配置名称。\n\tExecuteBusinesType deployPB.ExecuteBusinesType // ExecuteBusinesType 明确的执行业务类型。\n\tTargetRef          string                      // TargetRef 本地配置自动生成的稳定资源引用。\n\tDomain             string                      // Domain 证书申请或旧部署业务使用的域名。\n\tDownloadURL        string                      // DownloadURL 本地部署使用的证书下载地址。\n\tRemark             string                      // Remark 证书中心上传时使用的备注。\n\tCertificatePEM     string                      // CertificatePEM 资源部署使用的完整证书链。\n\tPrivateKeyPEM      string                      // PrivateKeyPEM 资源部署使用的私钥。\n}\n```\nBusinessRequest 描述一次由 WebSocket 下发的业务执行请求。\n\n```go\ntype ClientInterface interface {\n\tGetClientID() string\n\tGetAccessKey() string\n\tGetContext() context.Context\n\tGetHTTPClient() *http.Client\n\t// contains filtered or unexported methods\n}\n```\nClientInterface 客户端接口，用于复用业务逻辑\n\n```go\ntype ProviderInfo struct {\n\tName   string\n\tRemark string\n}\n```\nProviderInfo 提供商信息\n\n```go\nfunc GetProviderInfo() []ProviderInfo\n```\nGetProviderInfo 获取提供商信息列表\n\n```go\ntype UpdateHandler struct {\n\t// contains filtered or unexported fields\n}\n```\nUpdateHandler 版本更新处理器\n\n```go\nfunc NewUpdateHandler(ctx context.Context) *UpdateHandler\n```\nNewUpdateHandler 创建版本更新处理器\n\n```go\nfunc (uh *UpdateHandler) HandleUpdate()\n```\nHandleUpdate 处理版本更新\n\n```go\ntype WSClient struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewWSClient(ctx context.Context) (*WSClient, error)\n```\nNewWSClient 创建新的 WebSocket 客户端\n\n```go\nfunc (c *WSClient) Close() error\n```\nClose 关闭 WebSocket 连接\n\n```go\nfunc (c *WSClient) GetAccessKey() string\n```\nGetAccessKey returns the deploy authentication key.\n\n```go\nfunc (c *WSClient) GetClientID() string\n```\nGetClientID returns the unique client identifier.\n\n```go\nfunc (c *WSClient) GetServerURL() string\n```\nGetServerURL returns the deploy service URL.\n\n```go\nfunc (c *WSClient) SetHTTPServer(httpServer *server.HTTPServer)\n```\nSetHTTPServer configures the local HTTP-01 server dependency.\n\n```go\nfunc (c *WSClient) Start()\n```\nStart starts the WebSocket lifecycle loop once.\n\n```go\nfunc (c *WSClient) StartWSNotify()\n```\nStartWSNotify 启动 WebSocket 连接和重连循环\n\n```go\nfunc (c *WSClient) Wait(ctx context.Context) error\n```\nWait blocks until the WebSocket lifecycle loop exits or ctx is canceled.\n\n","path":"github.com/https-cert/deploy/internal/client","name":"client","synopsis":"","isRedistributable":true}
