2025-05-28 22:43:18 +08:00

33 lines
960 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package uploader
import (
"context"
"log/slog"
)
// 表示定义证书上传器的抽象类型接口。
// 云服务商通常会提供 SSL 证书管理服务,可供用户集中管理证书。
// 注意与 `Deployer` 区分,“上传”通常为“部署”的前置操作。
type Uploader interface {
WithLogger(logger *slog.Logger) Uploader
// 上传证书。
//
// 入参:
// - ctx上下文。
// - certPEM证书 PEM 内容。
// - privkeyPEM私钥 PEM 内容。
//
// 出参:
// - res上传结果。
// - err: 错误。
Upload(ctx context.Context, certPEM string, privkeyPEM string) (_res *UploadResult, _err error)
}
// 表示证书上传结果的数据结构,包含上传后的证书 ID、名称和其他数据。
type UploadResult struct {
CertId string `json:"certId"`
CertName string `json:"certName,omitzero"`
ExtendedData map[string]any `json:"extendedData,omitempty"`
}