{"modulePath":"github.com/https-cert/deploy","version":"v0.7.2","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 DownloadFileWithRuntime(ctx context.Context, runtime *config.Runtime, httpClient *http.Client, accessKey, downloadURL, filePath string) error\n```\nDownloadFileWithRuntime 下载证书归档并按运行时环境校验 URL。\n\n```go\nfunc TestProviderConnection(ctx context.Context, runtime *config.Runtime, providerName string) (bool, error)\n```\nTestProviderConnection 测试 config.yaml 中的云服务 provider，供 CLI doctor 复用。\n\n## Types\n\n```go\ntype DeploymentExecutionRequest struct {\n\t// ExecutionKind 明确指定本次执行是本地部署、云上传或云动态资源部署。\n\tExecutionKind  deploymentExecutionKind\n\tProvider       deployPB.Provider       // Provider 是 v2 部署平台。\n\tDeploymentType deployPB.DeploymentType // DeploymentType 是 v2 部署类型。\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```\nDeploymentExecutionRequest 描述一次由 v2 WebSocket 下发的部署请求。\n\n```go\ntype DeploymentExecutor struct {\n\t// contains filtered or unexported fields\n}\n```\nDeploymentExecutor 封装 v2 provider/type 对应的本地和云端部署逻辑。\n\n```go\nfunc NewDeploymentExecutor(downloadFile func(context.Context, string, string) error, runtime *config.Runtime) *DeploymentExecutor\n```\nNewDeploymentExecutor 使用显式运行时快照创建 v2 部署执行器。\n\n```go\nfunc (be *DeploymentExecutor) Execute(ctx context.Context, request DeploymentExecutionRequest) (providers.DeploymentResult, error)\n```\nExecute 执行一条支持 context 和结构化结果的 v2 部署请求。\n\n```go\ntype DeploymentHandler interface {\n\t// Key 返回 handler 的稳定 provider/type 键。\n\tKey() DeploymentHandlerKey\n\t// Capability 返回不包含实时资源的能力声明。\n\tCapability() *deployPB.DeploymentCapability\n\t// DiscoverResources 返回实时目录，非空 targetRef 用于兼容解析已保存的精确目标。\n\tDiscoverResources(ctx context.Context, targetRef string) providers.ResourceCatalogResult\n\t// Test 测试当前选择器是否可用。\n\tTest(ctx context.Context, targetRef string) error\n\t// Deploy 执行一次证书部署。\n\tDeploy(ctx context.Context, request DeploymentHandlerRequest) (providers.DeploymentResult, error)\n}\n```\nDeploymentHandler 定义一个 provider/type 组合的 v2 部署能力。\n\n```go\ntype DeploymentHandlerKey struct {\n\tProvider       deployPB.Provider       // Provider 是 v2 部署平台。\n\tDeploymentType deployPB.DeploymentType // DeploymentType 是 v2 部署类型。\n}\n```\nDeploymentHandlerKey 唯一标识一个 v2 部署 handler。\n\n```go\ntype DeploymentHandlerRegistry struct {\n\t// contains filtered or unexported fields\n}\n```\nDeploymentHandlerRegistry 集中维护所有 v2 provider/type handler。\n\n```go\nfunc NewDeploymentHandlerRegistry(client *WSClient) (*DeploymentHandlerRegistry, error)\n```\nNewDeploymentHandlerRegistry 注册所有原生 v2 handler。\n\n```go\nfunc (r *DeploymentHandlerRegistry) Capabilities() []*deployPB.DeploymentCapability\n```\nCapabilities 返回所有已注册 handler 的能力声明副本。\n\n```go\nfunc (r *DeploymentHandlerRegistry) Lookup(provider deployPB.Provider, deploymentType deployPB.DeploymentType) (DeploymentHandler, bool)\n```\nLookup 按 provider/type 返回唯一 handler。\n\n```go\ntype DeploymentHandlerRequest struct {\n\tRequestID      string // RequestID 是服务端生成的请求关联标识。\n\tTargetRef      string // TargetRef 是客户端生成的不透明资源引用。\n\tDomain         string // Domain 是证书的规范化主域名。\n\tDownloadURL    string // DownloadURL 是本地部署器下载证书压缩包的地址。\n\tCertificatePEM string // CertificatePEM 是云端部署使用的完整证书链。\n\tPrivateKeyPEM  string // PrivateKeyPEM 是云端部署使用的 PEM 私钥。\n}\n```\nDeploymentHandlerRequest 描述一次 v2 证书部署所需的完整输入。\n\n```go\ntype UpdateHandler struct {\n\t// contains filtered or unexported fields\n}\n```\nUpdateHandler 版本更新处理器\n\n```go\nfunc NewUpdateHandler(ctx context.Context, runtime *config.Runtime) *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```\nWSClient 组装连接、业务并发与 v2 部署服务，对外保持稳定生命周期 API。\n\n```go\nfunc NewWSClient(ctx context.Context, runtime *config.Runtime) (*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 启动 WebSocket 生命周期循环，重复调用不会创建额外连接。\n\n```go\nfunc (c *WSClient) Wait(ctx context.Context) error\n```\nWait 等待 WebSocket 生命周期退出或调用方 context 取消。\n\n","path":"github.com/https-cert/deploy/internal/client","name":"client","synopsis":"","isRedistributable":true}
