{"modulePath":"github.com/https-cert/deploy","version":"v0.7.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package qiniu\n\nPackage qiniu implements certificate upload and exact-domain certificate deployment for Qiniu CDN products.\n\nThe certificate API and domain API use different hosts and authentication schemes. Keeping the request construction here makes it possible to sign the same bytes that are ultimately sent to the domain API.\n\n## Types\n\n```go\ntype APIError struct {\n\t// Operation identifies the failed Qiniu API operation.\n\tOperation string\n\t// StatusCode is the provider HTTP status code, or zero before a response exists.\n\tStatusCode int\n\t// ProviderRequestID is Qiniu's request identifier when the response included one.\n\tProviderRequestID string\n\t// Retryable reports whether retrying the operation may succeed without configuration changes.\n\tRetryable bool\n\t// Message is a sanitized provider or local failure description.\n\tMessage string\n\t// Cause retains the underlying transport or parsing error.\n\tCause error\n}\n```\nAPIError carries enough provider context for a later caller to decide whether to retry.\n\n```go\nfunc (e *APIError) Error() string\n```\nError implements the error interface.\n\n```go\nfunc (e *APIError) Unwrap() error\n```\nUnwrap exposes the underlying cause for errors.Is and errors.As.\n\n```go\ntype CertificateUploadResult struct {\n\t// CertificateID is Qiniu's certID and is required by the domain binding API.\n\tCertificateID string\n\t// ProviderRequestID is Qiniu's request identifier for the upload operation.\n\tProviderRequestID string\n}\n```\nCertificateUploadResult contains the certificate identity returned by Qiniu.\n\n```go\ntype HTTPClient interface {\n\t// Do sends one HTTP request and returns its response.\n\tDo(*http.Request) (*http.Response, error)\n}\n```\nHTTPClient is the subset of http.Client used by Provider. It allows unit tests to inject an httptest client without global state.\n\n```go\ntype Options struct {\n\t// HTTPClient sends signed API requests. A timeout-enabled default is used when nil.\n\tHTTPClient HTTPClient\n\t// APIBaseURL overrides the Qiniu domain API host. It is intended for tests.\n\tAPIBaseURL string\n\t// FusionBaseURL overrides the Qiniu certificate API host. It is intended for tests.\n\tFusionBaseURL string\n}\n```\nOptions configures a Provider instance.\n\n```go\ntype Product string\n```\nProduct identifies the Qiniu domain product that owns a custom domain.\n\n```go\nconst (\n\t// ProductCDN identifies a Qiniu CDN custom domain.\n\tProductCDN Product = \"cdn\"\n\t// ProductDCDN identifies a Qiniu DCDN custom domain.\n\tProductDCDN Product = \"dcdn\"\n)\n```\n\n```go\ntype Provider struct {\n\t// AccessKey is retained for compatibility with existing callers. Do not log it.\n\tAccessKey string\n\t// AccessSecret is retained for compatibility with existing callers. Do not log it.\n\tAccessSecret string\n\t// contains filtered or unexported fields\n}\n```\nProvider owns the Qiniu credentials and HTTP transport used for certificate operations.\n\n```go\nfunc New(accessKey, accessSecret string) *Provider\n```\nNew creates a Provider using Qiniu production API endpoints.\n\n```go\nfunc NewWithOptions(accessKey, accessSecret string, options *Options) *Provider\n```\nNewWithOptions creates a Provider with an injectable HTTP transport and API endpoints.\n\n```go\nfunc (p *Provider) BindCertificate(ctx context.Context, product Product, certID, domain string) (*TargetDeploymentResult, error)\n```\nBindCertificate validates one exact Qiniu domain, binds an existing certID, and reads it back.\n\n```go\nfunc (p *Provider) DeployCertificate(ctx context.Context, certificate providers.CertificateMaterial, deploymentType deployPB.DeploymentType, target providers.DeploymentResource) (providers.DeploymentResult, error)\n```\nDeployCertificate 为明确的七牛 CDN 或 DCDN 业务部署精确域名证书。\n\n```go\nfunc (p *Provider) DeployTargetCertificate(ctx context.Context, product Product, name, domain, cert, key string) (*TargetDeploymentResult, error)\n```\nDeployTargetCertificate validates one exact Qiniu domain, uploads a certificate, binds it, and reads it back.\n\n```go\nfunc (p *Provider) DiscoverResources(ctx context.Context, deploymentType deployPB.DeploymentType) providers.ResourceCatalogResult\n```\nDiscoverResources 实时发现七牛 CDN 或 DCDN 域名资源。\n\n```go\nfunc (p *Provider) ResolveResource(ctx context.Context, deploymentType deployPB.DeploymentType, targetRef string) (providers.DeploymentResource, error)\n```\nResolveResource 实时发现目录并按引用唯一解析七牛域名。\n\n```go\nfunc (p *Provider) TestConnection(ctx context.Context) (bool, error)\n```\nTestConnection tests QBox credentials against the Qiniu certificate API.\n\n```go\nfunc (p *Provider) TestConnectionWithContext(ctx context.Context) (bool, error)\n```\nTestConnectionWithContext tests QBox credentials while respecting caller cancellation.\n\n```go\nfunc (p *Provider) TestResource(ctx context.Context, deploymentType deployPB.DeploymentType, targetRef string) error\n```\nTestResource 只读确认七牛域名仍存在、产品一致且已启用 HTTPS。\n\n```go\nfunc (p *Provider) UploadCertificate(ctx context.Context, certificate providers.CertificateMaterial) error\n```\nUploadCertificate 将证书上传到七牛云证书中心，供 v2 无资源部署类型复用。 需要七牛云 certID 时使用 UploadCertificateWithContext。\n\n```go\nfunc (p *Provider) UploadCertificateWithContext(ctx context.Context, name, domain, cert, key string) (*CertificateUploadResult, error)\n```\nUploadCertificateWithContext uploads a PEM certificate with QBox authentication and retains certID.\n\n```go\ntype TargetDeploymentResult struct {\n\t// CertificateID is the Qiniu certID bound to the custom domain.\n\tCertificateID string\n\t// Domain is the exact custom domain that was verified and updated.\n\tDomain string\n\t// Product is the Qiniu product validated before the update.\n\tProduct Product\n\t// UploadRequestID identifies the certificate upload request when this method uploaded a certificate.\n\tUploadRequestID string\n\t// ProviderRequestID identifies the domain update request.\n\tProviderRequestID string\n}\n```\nTargetDeploymentResult describes one exact-domain certificate deployment at the Qiniu API layer.\n\n","path":"github.com/https-cert/deploy/internal/client/providers/qiniu","name":"qiniu","synopsis":"Package qiniu implements certificate upload and exact-domain certificate deployment for Qiniu CDN products.","isRedistributable":true}
