feat: add tencent cloud ssl-deploy deployer
This commit is contained in:
@@ -4,7 +4,7 @@ type DeployResourceType string
|
||||
|
||||
const (
|
||||
// 资源类型:通过 SSL 服务部署到云资源实例。
|
||||
DEPLOY_RESOURCE_USE_SSLDEPLOY = DeployResourceType("ssl-deploy")
|
||||
DEPLOY_RESOURCE_VIA_SSLDEPLOY = DeployResourceType("ssl-deploy")
|
||||
// 资源类型:部署到指定负载均衡器。
|
||||
DEPLOY_RESOURCE_LOADBALANCER = DeployResourceType("loadbalancer")
|
||||
// 资源类型:部署到指定监听器。
|
||||
|
||||
@@ -96,8 +96,8 @@ func (d *TencentCloudCLBDeployer) Deploy(ctx context.Context, certPem string, pr
|
||||
|
||||
// 根据部署资源类型决定部署方式
|
||||
switch d.config.ResourceType {
|
||||
case DEPLOY_RESOURCE_USE_SSLDEPLOY:
|
||||
if err := d.deployToInstanceUseSsl(ctx, upres.CertId); err != nil {
|
||||
case DEPLOY_RESOURCE_VIA_SSLDEPLOY:
|
||||
if err := d.deployViaSslService(ctx, upres.CertId); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ func (d *TencentCloudCLBDeployer) Deploy(ctx context.Context, certPem string, pr
|
||||
return &deployer.DeployResult{}, nil
|
||||
}
|
||||
|
||||
func (d *TencentCloudCLBDeployer) deployToInstanceUseSsl(ctx context.Context, cloudCertId string) error {
|
||||
func (d *TencentCloudCLBDeployer) deployViaSslService(ctx context.Context, cloudCertId string) error {
|
||||
if d.config.LoadbalancerId == "" {
|
||||
return errors.New("config `loadbalancerId` is required")
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ func TestDeploy(t *testing.T) {
|
||||
SecretId: fSecretId,
|
||||
SecretKey: fSecretKey,
|
||||
Region: fRegion,
|
||||
ResourceType: provider.DEPLOY_RESOURCE_USE_SSLDEPLOY,
|
||||
ResourceType: provider.DEPLOY_RESOURCE_VIA_SSLDEPLOY,
|
||||
LoadbalancerId: fLoadbalancerId,
|
||||
ListenerId: fListenerId,
|
||||
Domain: fDomain,
|
||||
|
||||
Reference in New Issue
Block a user