feat: add ucloud ussl uploader
This commit is contained in:
161
internal/pkg/vendors/ucloud-sdk/ussl/apis.go
vendored
Normal file
161
internal/pkg/vendors/ucloud-sdk/ussl/apis.go
vendored
Normal file
@@ -0,0 +1,161 @@
|
||||
package ussl
|
||||
|
||||
import (
|
||||
"github.com/ucloud/ucloud-sdk-go/ucloud/request"
|
||||
"github.com/ucloud/ucloud-sdk-go/ucloud/response"
|
||||
)
|
||||
|
||||
type UploadNormalCertificateRequest struct {
|
||||
request.CommonBase
|
||||
|
||||
CertificateName *string `required:"true"`
|
||||
SslPublicKey *string `required:"true"`
|
||||
SslPrivateKey *string `required:"true"`
|
||||
SslMD5 *string `required:"true"`
|
||||
SslCaKey *string `required:"false"`
|
||||
}
|
||||
|
||||
type UploadNormalCertificateResponse struct {
|
||||
response.CommonBase
|
||||
|
||||
CertificateID int
|
||||
LongResourceID string
|
||||
}
|
||||
|
||||
func (c *USSLClient) NewUploadNormalCertificateRequest() *UploadNormalCertificateRequest {
|
||||
req := &UploadNormalCertificateRequest{}
|
||||
|
||||
c.Client.SetupRequest(req)
|
||||
|
||||
req.SetRetryable(false)
|
||||
return req
|
||||
}
|
||||
|
||||
func (c *USSLClient) UploadNormalCertificate(req *UploadNormalCertificateRequest) (*UploadNormalCertificateResponse, error) {
|
||||
var err error
|
||||
var res UploadNormalCertificateResponse
|
||||
|
||||
reqCopier := *req
|
||||
|
||||
err = c.Client.InvokeAction("UploadNormalCertificate", &reqCopier, &res)
|
||||
if err != nil {
|
||||
return &res, err
|
||||
}
|
||||
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
type GetCertificateListRequest struct {
|
||||
request.CommonBase
|
||||
|
||||
Mode *string `required:"true"`
|
||||
StateCode *string `required:"false"`
|
||||
Brand *string `required:"false"`
|
||||
CaOrganization *string `required:"false"`
|
||||
Domain *string `required:"false"`
|
||||
Sort *string `required:"false"`
|
||||
Page *int `required:"false"`
|
||||
PageSize *int `required:"false"`
|
||||
}
|
||||
|
||||
type GetCertificateListResponse struct {
|
||||
response.CommonBase
|
||||
|
||||
CertificateList []*CertificateListItem
|
||||
TotalCount int
|
||||
}
|
||||
|
||||
func (c *USSLClient) NewGetCertificateListRequest() *GetCertificateListRequest {
|
||||
req := &GetCertificateListRequest{}
|
||||
|
||||
c.Client.SetupRequest(req)
|
||||
|
||||
req.SetRetryable(false)
|
||||
return req
|
||||
}
|
||||
|
||||
func (c *USSLClient) GetCertificateList(req *GetCertificateListRequest) (*GetCertificateListResponse, error) {
|
||||
var err error
|
||||
var res GetCertificateListResponse
|
||||
|
||||
reqCopier := *req
|
||||
|
||||
err = c.Client.InvokeAction("GetCertificateList", &reqCopier, &res)
|
||||
if err != nil {
|
||||
return &res, err
|
||||
}
|
||||
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
type GetCertificateDetailInfoRequest struct {
|
||||
request.CommonBase
|
||||
|
||||
CertificateID *int `required:"true"`
|
||||
}
|
||||
|
||||
type GetCertificateDetailInfoResponse struct {
|
||||
response.CommonBase
|
||||
|
||||
CertificateInfo *CertificateInfo
|
||||
}
|
||||
|
||||
func (c *USSLClient) NewGetCertificateDetailInfoRequest() *GetCertificateDetailInfoRequest {
|
||||
req := &GetCertificateDetailInfoRequest{}
|
||||
|
||||
c.Client.SetupRequest(req)
|
||||
|
||||
req.SetRetryable(false)
|
||||
return req
|
||||
}
|
||||
|
||||
func (c *USSLClient) GetCertificateDetailInfo(req *GetCertificateDetailInfoRequest) (*GetCertificateDetailInfoResponse, error) {
|
||||
var err error
|
||||
var res GetCertificateDetailInfoResponse
|
||||
|
||||
reqCopier := *req
|
||||
|
||||
err = c.Client.InvokeAction("GetCertificateDetailInfo", &reqCopier, &res)
|
||||
if err != nil {
|
||||
return &res, err
|
||||
}
|
||||
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
type DownloadCertificateRequest struct {
|
||||
request.CommonBase
|
||||
|
||||
CertificateID *int `required:"true"`
|
||||
}
|
||||
|
||||
type DownloadCertificateResponse struct {
|
||||
response.CommonBase
|
||||
|
||||
CertificateUrl string
|
||||
CertCA *CertificateDownloadInfo
|
||||
Certificate *CertificateDownloadInfo
|
||||
}
|
||||
|
||||
func (c *USSLClient) NewDownloadCertificateRequest() *DownloadCertificateRequest {
|
||||
req := &DownloadCertificateRequest{}
|
||||
|
||||
c.Client.SetupRequest(req)
|
||||
|
||||
req.SetRetryable(false)
|
||||
return req
|
||||
}
|
||||
|
||||
func (c *USSLClient) DownloadCertificate(req *DownloadCertificateRequest) (*DownloadCertificateResponse, error) {
|
||||
var err error
|
||||
var res DownloadCertificateResponse
|
||||
|
||||
reqCopier := *req
|
||||
|
||||
err = c.Client.InvokeAction("DownloadCertificate", &reqCopier, &res)
|
||||
if err != nil {
|
||||
return &res, err
|
||||
}
|
||||
|
||||
return &res, nil
|
||||
}
|
||||
18
internal/pkg/vendors/ucloud-sdk/ussl/client.go
vendored
Normal file
18
internal/pkg/vendors/ucloud-sdk/ussl/client.go
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
package ussl
|
||||
|
||||
import (
|
||||
"github.com/ucloud/ucloud-sdk-go/ucloud"
|
||||
"github.com/ucloud/ucloud-sdk-go/ucloud/auth"
|
||||
)
|
||||
|
||||
type USSLClient struct {
|
||||
*ucloud.Client
|
||||
}
|
||||
|
||||
func NewClient(config *ucloud.Config, credential *auth.Credential) *USSLClient {
|
||||
meta := ucloud.ClientMeta{Product: "USSL"}
|
||||
client := ucloud.NewClientWithMeta(config, credential, meta)
|
||||
return &USSLClient{
|
||||
client,
|
||||
}
|
||||
}
|
||||
61
internal/pkg/vendors/ucloud-sdk/ussl/models.go
vendored
Normal file
61
internal/pkg/vendors/ucloud-sdk/ussl/models.go
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
package ussl
|
||||
|
||||
type CertificateListItem struct {
|
||||
CertificateID int
|
||||
CertificateSN string
|
||||
CertificateCat string
|
||||
Mode string
|
||||
Domains string
|
||||
Brand string
|
||||
ValidityPeriod int
|
||||
Type string
|
||||
NotBefore int
|
||||
NotAfter int
|
||||
AlarmState int
|
||||
State string
|
||||
StateCode string
|
||||
Name string
|
||||
MaxDomainsCount int
|
||||
DomainsCount int
|
||||
CaChannel string
|
||||
CSRAlgorithms []CSRAlgorithmInfo
|
||||
TopOrganizationID int
|
||||
OrganizationID int
|
||||
IsFree int
|
||||
YearOfValidity int
|
||||
Channel int
|
||||
CreateTime int
|
||||
CertificateUrl string
|
||||
}
|
||||
|
||||
type CSRAlgorithmInfo struct {
|
||||
Algorithm string
|
||||
AlgorithmOption []string
|
||||
}
|
||||
|
||||
type CertificateInfo struct {
|
||||
Type string
|
||||
CertificateID int
|
||||
CertificateType string
|
||||
CaOrganization string
|
||||
Algorithm string
|
||||
ValidityPeriod int
|
||||
State string
|
||||
StateCode string
|
||||
Name string
|
||||
Brand string
|
||||
Domains string
|
||||
DomainsCount int
|
||||
Mode string
|
||||
CSROnline int
|
||||
CSR string
|
||||
CSRKeyParameter string
|
||||
CSREncryptAlgo string
|
||||
IssuedDate int
|
||||
ExpiredDate int
|
||||
}
|
||||
|
||||
type CertificateDownloadInfo struct {
|
||||
FileData string
|
||||
FileName string
|
||||
}
|
||||
Reference in New Issue
Block a user