mirror of
https://github.com/certimate-go/certimate.git
synced 2026-09-24 23:10:13 +08:00
feat(provider): add third domain type support on deployment to volcengine vod
This commit is contained in:
@@ -80,7 +80,7 @@ require (
|
||||
github.com/ucloud/ucloud-sdk-go v0.22.77
|
||||
github.com/volcengine/ve-tos-golang-sdk/v2 v2.9.5
|
||||
github.com/volcengine/volc-sdk-golang v1.0.250
|
||||
github.com/volcengine/volcengine-go-sdk v1.2.34
|
||||
github.com/volcengine/volcengine-go-sdk v1.2.35
|
||||
github.com/wneessen/go-mail v0.7.3
|
||||
github.com/xhit/go-str2duration/v2 v2.1.0
|
||||
github.com/yunify/qingcloud-sdk-go v2.0.0-alpha.38+incompatible
|
||||
@@ -95,7 +95,6 @@ require (
|
||||
golang.org/x/sync v0.20.0
|
||||
golang.org/x/sys v0.45.0
|
||||
google.golang.org/api v0.283.0
|
||||
google.golang.org/protobuf v1.36.11
|
||||
k8s.io/api v0.35.3
|
||||
k8s.io/apimachinery v0.35.3
|
||||
k8s.io/client-go v0.35.3
|
||||
@@ -283,6 +282,7 @@ require (
|
||||
golang.org/x/tools v0.44.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260523011958-0a33c5d7ca68 // indirect
|
||||
google.golang.org/grpc v1.81.1 // indirect
|
||||
google.golang.org/protobuf v1.36.11 // indirect
|
||||
gopkg.in/ini.v1 v1.67.2 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
modernc.org/libc v1.72.3 // indirect
|
||||
|
||||
@@ -940,8 +940,8 @@ github.com/volcengine/ve-tos-golang-sdk/v2 v2.9.5/go.mod h1:IrjK84IJJTuOZOTMv/P1
|
||||
github.com/volcengine/volc-sdk-golang v1.0.23/go.mod h1:AfG/PZRUkHJ9inETvbjNifTDgut25Wbkm2QoYBTbvyU=
|
||||
github.com/volcengine/volc-sdk-golang v1.0.250 h1:2/RLIahTgZ57OkNgDV0FpAkvk/4QFMGIuVFTnU26GDs=
|
||||
github.com/volcengine/volc-sdk-golang v1.0.250/go.mod h1:zHJlaqiMbIB+0mcrsZPTwOb3FB7S/0MCfqlnO8R7hlM=
|
||||
github.com/volcengine/volcengine-go-sdk v1.2.34 h1:oty2YY90UvH05RDbDn6348Y6oS7A5Tr6kIteAjVqFlY=
|
||||
github.com/volcengine/volcengine-go-sdk v1.2.34/go.mod h1:oxoVo+A17kvkwPkIeIHPVLjSw7EQAm+l/Vau1YGHN+A=
|
||||
github.com/volcengine/volcengine-go-sdk v1.2.35 h1:QJH2P+LrysoiVv5LuOMMMTPlTX5jEimdIY3bvF7uCn8=
|
||||
github.com/volcengine/volcengine-go-sdk v1.2.35/go.mod h1:oxoVo+A17kvkwPkIeIHPVLjSw7EQAm+l/Vau1YGHN+A=
|
||||
github.com/vultr/govultr/v3 v3.31.2 h1:2l3/KDvfemG+4azw4LLquJoh9mFOAVEdBXtPPzix3ac=
|
||||
github.com/vultr/govultr/v3 v3.31.2/go.mod h1:2zyUw9yADQaGwKnwDesmIOlBNLrm7edsCfWHFJpWKf8=
|
||||
github.com/wneessen/go-mail v0.7.3 h1:g3DravXC5SMlVdboFrQA8Jx95A8sOzoBeS5F+vzNRK0=
|
||||
|
||||
@@ -14,4 +14,6 @@ const (
|
||||
DOMAIN_TYPE_PLAY = "play"
|
||||
// 域名类型:封面加速域名。
|
||||
DOMAIN_TYPE_IMAGE = "image"
|
||||
// 域名类型:自定义源站加速域名。
|
||||
DOMAIN_TYPE_THIRD = "third"
|
||||
)
|
||||
|
||||
@@ -8,11 +8,10 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/samber/lo"
|
||||
vevodbiz "github.com/volcengine/volc-sdk-golang/service/vod/models/business"
|
||||
vevodreq "github.com/volcengine/volc-sdk-golang/service/vod/models/request"
|
||||
ve "github.com/volcengine/volcengine-go-sdk/volcengine"
|
||||
vesession "github.com/volcengine/volcengine-go-sdk/volcengine/session"
|
||||
|
||||
vevod "github.com/certimate-go/certimate/pkg/sdk3rd-trimmed/github.com/volcengine/volc-sdk-golang/service/vod"
|
||||
vevod "github.com/certimate-go/certimate/pkg/sdk3rd-trimmed/github.com/volcengine/volcengine-go-sdk/service/vod20260101"
|
||||
|
||||
"github.com/certimate-go/certimate/pkg/core"
|
||||
cmgrimpl "github.com/certimate-go/certimate/pkg/core/certmgr/providers/volcengine-certcenter"
|
||||
@@ -45,7 +44,7 @@ type DeployerConfig struct {
|
||||
type Deployer struct {
|
||||
config *DeployerConfig
|
||||
logger *slog.Logger
|
||||
sdkClient *vevod.Vod
|
||||
sdkClient *vevod.VOD20260101
|
||||
sdkCertmgr core.Certmgr
|
||||
}
|
||||
|
||||
@@ -56,9 +55,10 @@ func NewDeployer(config *DeployerConfig) (*Deployer, error) {
|
||||
return nil, fmt.Errorf("the configuration of the deployer provider is nil")
|
||||
}
|
||||
|
||||
client := vevod.NewInstance()
|
||||
client.SetAccessKey(config.AccessKeyId)
|
||||
client.SetSecretKey(config.SecretAccessKey)
|
||||
client, err := createSDKClient(config.AccessKeyId, config.SecretAccessKey)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not create client: %w", err)
|
||||
}
|
||||
|
||||
pcertmgr, err := cmgrimpl.NewCertmgr(&cmgrimpl.CertmgrConfig{
|
||||
AccessKeyId: config.AccessKeyId,
|
||||
@@ -179,10 +179,10 @@ func (d *Deployer) Deploy(ctx context.Context, certPEM, privkeyPEM string) (*Dep
|
||||
func (d *Deployer) getAllDomains(ctx context.Context) ([]string, error) {
|
||||
domains := make([]string, 0)
|
||||
|
||||
// 获取空间域名列表
|
||||
// REF: https://www.volcengine.com/docs/4/106062
|
||||
listDomainDetailOffset := 0
|
||||
listDomainDetailLimit := 1000
|
||||
// 获取域名列表
|
||||
// REF: https://www.volcengine.com/docs/4/2389927
|
||||
listVodDomainPageNum := 1
|
||||
listVodDomainPageSize := 100
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
@@ -190,47 +190,29 @@ func (d *Deployer) getAllDomains(ctx context.Context) ([]string, error) {
|
||||
default:
|
||||
}
|
||||
|
||||
listDomainReq := &vevodreq.VodListDomainRequest{
|
||||
SpaceName: d.config.SpaceName,
|
||||
DomainType: d.config.DomainType,
|
||||
SourceStationType: 1,
|
||||
Offset: int32(listDomainDetailOffset),
|
||||
Limit: int32(listDomainDetailLimit),
|
||||
listVodDomainReq := &vevod.ListVodDomainsInput{
|
||||
SpaceName: ve.String(d.config.SpaceName),
|
||||
DomainType: ve.String(convertDomainType2CloudDomainType(d.config.DomainType)),
|
||||
ListCdnDomainsParam: &vevod.ListCdnDomainsParamForListVodDomainsInput{
|
||||
PageNum: ve.Int64(int64(listVodDomainPageNum)),
|
||||
PageSize: ve.Int64(int64(listVodDomainPageSize)),
|
||||
},
|
||||
}
|
||||
listDomainResp, _, err := d.sdkClient.ListDomain(listDomainReq)
|
||||
d.logger.Debug("sdk request 'vod.ListDomain'", slog.Any("request", listDomainReq), slog.Any("response", listDomainResp))
|
||||
listVodDomainResp, err := d.sdkClient.ListVodDomainsWithContext(ctx, listVodDomainReq)
|
||||
d.logger.Debug("sdk request 'vod.ListVodDomain'", slog.Any("request", listVodDomainReq), slog.Any("response", listVodDomainResp))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to execute sdk request 'vod.ListDomain': %w", err)
|
||||
return nil, fmt.Errorf("failed to execute sdk request 'vod.ListVodDomain': %w", err)
|
||||
}
|
||||
|
||||
if listDomainResp.Result == nil {
|
||||
for _, domainItem := range listVodDomainResp.Domains {
|
||||
domains = append(domains, ve.StringValue(domainItem.Domain))
|
||||
}
|
||||
|
||||
if len(listVodDomainResp.Domains) < listVodDomainPageSize {
|
||||
break
|
||||
}
|
||||
|
||||
var domainInstances []*vevodbiz.VodDomainInstanceInfo
|
||||
switch d.config.DomainType {
|
||||
case DOMAIN_TYPE_PLAY:
|
||||
domainInstances = listDomainResp.GetResult().GetPlayInstanceInfo().GetByteInstances()
|
||||
case DOMAIN_TYPE_IMAGE:
|
||||
domainInstances = listDomainResp.GetResult().GetImageInstanceInfo().GetByteInstances()
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported domain type: '%s'", d.config.DomainType)
|
||||
}
|
||||
|
||||
for _, domainInstance := range domainInstances {
|
||||
if domainInstance.Domains == nil {
|
||||
continue
|
||||
}
|
||||
for _, domainItem := range domainInstance.Domains {
|
||||
domains = append(domains, domainItem.Domain)
|
||||
}
|
||||
}
|
||||
|
||||
if listDomainResp.Result.Total <= int64(listDomainDetailOffset+listDomainDetailLimit) {
|
||||
break
|
||||
}
|
||||
|
||||
listDomainDetailOffset += listDomainDetailLimit
|
||||
listVodDomainPageNum++
|
||||
}
|
||||
|
||||
return domains, nil
|
||||
@@ -238,25 +220,51 @@ func (d *Deployer) getAllDomains(ctx context.Context) ([]string, error) {
|
||||
|
||||
func (d *Deployer) updateDomainCertificate(ctx context.Context, domain string, cloudCertId string) error {
|
||||
// 更新域名配置
|
||||
// REF: https://www.volcengine.com/docs/4/1317310
|
||||
updateDomainConfigReq := &vevodreq.VodUpdateDomainConfigRequest{
|
||||
SpaceName: d.config.SpaceName,
|
||||
DomainType: d.config.DomainType,
|
||||
Domain: domain,
|
||||
Config: &vevodbiz.VodDomainConfig{
|
||||
HTTPS: &vevodbiz.HTTPS{
|
||||
// REF: https://www.volcengine.com/docs/4/2389907
|
||||
updateVodDomainConfigReq := &vevod.UpdateVodDomainConfigInput{
|
||||
SpaceName: ve.String(d.config.SpaceName),
|
||||
DomainType: ve.String(convertDomainType2CloudDomainType(d.config.DomainType)),
|
||||
UpdateCdnConfigParam: &vevod.UpdateCdnConfigParamForUpdateVodDomainConfigInput{
|
||||
Domain: ve.String(domain),
|
||||
HTTPS: &vevod.HTTPSForUpdateVodDomainConfigInput{
|
||||
Switch: ve.Bool(true),
|
||||
CertInfo: &vevodbiz.CertInfo{
|
||||
CertInfo: &vevod.CertInfoForUpdateVodDomainConfigInput{
|
||||
CertId: ve.String(cloudCertId),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
updateDomainConfigResp, _, err := d.sdkClient.UpdateDomainConfig(updateDomainConfigReq)
|
||||
d.logger.Debug("sdk request 'vod.UpdateDomainConfig'", slog.Any("request", updateDomainConfigReq), slog.Any("response", updateDomainConfigResp))
|
||||
updateVodDomainConfigResp, err := d.sdkClient.UpdateVodDomainConfigWithContext(ctx, updateVodDomainConfigReq)
|
||||
d.logger.Debug("sdk request 'vod.UpdateVodDomainConfig'", slog.Any("request", updateVodDomainConfigReq), slog.Any("response", updateVodDomainConfigResp))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func createSDKClient(accessKeyId, secretAccessKey string) (*vevod.VOD20260101, error) {
|
||||
config := ve.NewConfig().
|
||||
WithAkSk(accessKeyId, secretAccessKey)
|
||||
|
||||
session, err := vesession.NewSession(config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
client := vevod.New(session)
|
||||
return client, nil
|
||||
}
|
||||
|
||||
func convertDomainType2CloudDomainType(domainType string) string {
|
||||
switch domainType {
|
||||
case DOMAIN_TYPE_PLAY:
|
||||
return "vod_play"
|
||||
case DOMAIN_TYPE_IMAGE:
|
||||
return "vod_image"
|
||||
case DOMAIN_TYPE_THIRD:
|
||||
return "third"
|
||||
default:
|
||||
return domainType
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
package vod
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/volcengine/volc-sdk-golang/base"
|
||||
"github.com/volcengine/volc-sdk-golang/service/vod"
|
||||
)
|
||||
|
||||
type Vod struct {
|
||||
*base.Client
|
||||
DomainCache map[string]map[string]int
|
||||
Lock sync.RWMutex
|
||||
disableLog bool
|
||||
}
|
||||
|
||||
type config struct {
|
||||
disableLog bool
|
||||
}
|
||||
|
||||
type Option func(c *config)
|
||||
|
||||
func NewInstance(opts ...Option) *Vod {
|
||||
cfg := &config{}
|
||||
for _, opt := range opts {
|
||||
opt(cfg)
|
||||
}
|
||||
instance := &Vod{
|
||||
DomainCache: make(map[string]map[string]int),
|
||||
Client: base.NewClient(ServiceInfoMap[base.RegionCnNorth1], ApiInfoList),
|
||||
disableLog: cfg.disableLog,
|
||||
}
|
||||
return instance
|
||||
}
|
||||
|
||||
func NewInstanceWithRegion(region string, opts ...Option) *Vod {
|
||||
cfg := &config{}
|
||||
for _, opt := range opts {
|
||||
opt(cfg)
|
||||
}
|
||||
var serviceInfo *base.ServiceInfo
|
||||
var ok bool
|
||||
if serviceInfo, ok = ServiceInfoMap[region]; !ok {
|
||||
serviceInfo = &base.ServiceInfo{
|
||||
Timeout: 60 * time.Second,
|
||||
Scheme: "https",
|
||||
Host: fmt.Sprintf("vod.%s.volcengineapi.com", region),
|
||||
Header: http.Header{
|
||||
"Accept": []string{"application/json"},
|
||||
},
|
||||
Credentials: base.Credentials{Region: region, Service: "vod"},
|
||||
}
|
||||
}
|
||||
|
||||
instance := &Vod{
|
||||
DomainCache: make(map[string]map[string]int),
|
||||
Client: base.NewClient(serviceInfo, ApiInfoList),
|
||||
disableLog: cfg.disableLog,
|
||||
}
|
||||
return instance
|
||||
}
|
||||
|
||||
var (
|
||||
ServiceInfoMap = vod.ServiceInfoMap
|
||||
|
||||
ApiInfoList = map[string]*base.ApiInfo{
|
||||
"ListDomain": vod.ApiInfoList["ListDomain"],
|
||||
"UpdateDomainConfig": vod.ApiInfoList["UpdateDomainConfig"],
|
||||
}
|
||||
)
|
||||
-189
@@ -1,189 +0,0 @@
|
||||
package vod
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
"github.com/volcengine/volc-sdk-golang/service/vod/models/request"
|
||||
"github.com/volcengine/volc-sdk-golang/service/vod/models/response"
|
||||
"google.golang.org/protobuf/encoding/protojson"
|
||||
)
|
||||
|
||||
func (p *Vod) ListDomain(req *request.VodListDomainRequest) (*response.VodListDomainResponse, int, error) {
|
||||
query := url.Values{}
|
||||
form := url.Values{}
|
||||
marshaler := protojson.MarshalOptions{
|
||||
Multiline: false,
|
||||
AllowPartial: false,
|
||||
UseProtoNames: true,
|
||||
UseEnumNumbers: false,
|
||||
EmitUnpopulated: false,
|
||||
}
|
||||
jsonData := marshaler.Format(req)
|
||||
reqMap := map[string]interface{}{}
|
||||
err := json.Unmarshal([]byte(jsonData), &reqMap)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
for k, v := range reqMap {
|
||||
var sv string
|
||||
switch ov := v.(type) {
|
||||
case string:
|
||||
sv = ov
|
||||
case int:
|
||||
sv = strconv.FormatInt(int64(ov), 10)
|
||||
case uint:
|
||||
sv = strconv.FormatUint(uint64(ov), 10)
|
||||
case int8:
|
||||
sv = strconv.FormatInt(int64(ov), 10)
|
||||
case uint8:
|
||||
sv = strconv.FormatUint(uint64(ov), 10)
|
||||
case int16:
|
||||
sv = strconv.FormatInt(int64(ov), 10)
|
||||
case uint16:
|
||||
sv = strconv.FormatUint(uint64(ov), 10)
|
||||
case int32:
|
||||
sv = strconv.FormatInt(int64(ov), 10)
|
||||
case uint32:
|
||||
sv = strconv.FormatUint(uint64(ov), 10)
|
||||
case int64:
|
||||
sv = strconv.FormatInt(ov, 10)
|
||||
case uint64:
|
||||
sv = strconv.FormatUint(ov, 10)
|
||||
case bool:
|
||||
sv = strconv.FormatBool(ov)
|
||||
case float32:
|
||||
sv = strconv.FormatFloat(float64(ov), 'f', -1, 32)
|
||||
case float64:
|
||||
sv = strconv.FormatFloat(ov, 'f', -1, 64)
|
||||
case []byte:
|
||||
sv = string(ov)
|
||||
default:
|
||||
v2, e2 := json.Marshal(ov)
|
||||
if e2 != nil {
|
||||
return nil, 0, e2
|
||||
}
|
||||
sv = string(v2)
|
||||
}
|
||||
query.Set(k, sv)
|
||||
form.Add(k, sv)
|
||||
}
|
||||
|
||||
respBody, status, err := p.Query("ListDomain", query)
|
||||
|
||||
output := &response.VodListDomainResponse{}
|
||||
unmarshaler := protojson.UnmarshalOptions{
|
||||
DiscardUnknown: true,
|
||||
}
|
||||
errUnmarshal := unmarshaler.Unmarshal(respBody, output)
|
||||
if err != nil || status != http.StatusOK {
|
||||
// if exist http err,check whether the respBody's type is defined struct,
|
||||
// if it is ,
|
||||
// return struct,
|
||||
// otherwise return nil body
|
||||
// if httpCode is not 200,check whether the respBody's type is defined struct,
|
||||
// if it is ,
|
||||
// use errorCode as err and return struct,
|
||||
// otherwise use respBody string as error and return
|
||||
if errUnmarshal != nil || len(output.GetResponseMetadata().GetError().GetCode()) == 0 {
|
||||
if err == nil {
|
||||
err = errors.New(string(respBody))
|
||||
}
|
||||
return nil, status, err
|
||||
} else {
|
||||
return output, status, errors.New(output.GetResponseMetadata().GetError().GetCode())
|
||||
}
|
||||
}
|
||||
return output, status, nil
|
||||
}
|
||||
|
||||
func (p *Vod) UpdateDomainConfig(req *request.VodUpdateDomainConfigRequest) (*response.VodUpdateDomainConfigResponse, int, error) {
|
||||
query := url.Values{}
|
||||
form := url.Values{}
|
||||
marshaler := protojson.MarshalOptions{
|
||||
Multiline: false,
|
||||
AllowPartial: false,
|
||||
UseProtoNames: true,
|
||||
UseEnumNumbers: false,
|
||||
EmitUnpopulated: false,
|
||||
}
|
||||
jsonData := marshaler.Format(req)
|
||||
reqMap := map[string]interface{}{}
|
||||
err := json.Unmarshal([]byte(jsonData), &reqMap)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
for k, v := range reqMap {
|
||||
var sv string
|
||||
switch ov := v.(type) {
|
||||
case string:
|
||||
sv = ov
|
||||
case int:
|
||||
sv = strconv.FormatInt(int64(ov), 10)
|
||||
case uint:
|
||||
sv = strconv.FormatUint(uint64(ov), 10)
|
||||
case int8:
|
||||
sv = strconv.FormatInt(int64(ov), 10)
|
||||
case uint8:
|
||||
sv = strconv.FormatUint(uint64(ov), 10)
|
||||
case int16:
|
||||
sv = strconv.FormatInt(int64(ov), 10)
|
||||
case uint16:
|
||||
sv = strconv.FormatUint(uint64(ov), 10)
|
||||
case int32:
|
||||
sv = strconv.FormatInt(int64(ov), 10)
|
||||
case uint32:
|
||||
sv = strconv.FormatUint(uint64(ov), 10)
|
||||
case int64:
|
||||
sv = strconv.FormatInt(ov, 10)
|
||||
case uint64:
|
||||
sv = strconv.FormatUint(ov, 10)
|
||||
case bool:
|
||||
sv = strconv.FormatBool(ov)
|
||||
case float32:
|
||||
sv = strconv.FormatFloat(float64(ov), 'f', -1, 32)
|
||||
case float64:
|
||||
sv = strconv.FormatFloat(ov, 'f', -1, 64)
|
||||
case []byte:
|
||||
sv = string(ov)
|
||||
default:
|
||||
v2, e2 := json.Marshal(ov)
|
||||
if e2 != nil {
|
||||
return nil, 0, e2
|
||||
}
|
||||
sv = string(v2)
|
||||
}
|
||||
query.Set(k, sv)
|
||||
form.Add(k, sv)
|
||||
}
|
||||
|
||||
respBody, status, err := p.Json("UpdateDomainConfig", url.Values{}, jsonData)
|
||||
|
||||
output := &response.VodUpdateDomainConfigResponse{}
|
||||
unmarshaler := protojson.UnmarshalOptions{
|
||||
DiscardUnknown: true,
|
||||
}
|
||||
errUnmarshal := unmarshaler.Unmarshal(respBody, output)
|
||||
if err != nil || status != http.StatusOK {
|
||||
// if exist http err,check whether the respBody's type is defined struct,
|
||||
// if it is ,
|
||||
// return struct,
|
||||
// otherwise return nil body
|
||||
// if httpCode is not 200,check whether the respBody's type is defined struct,
|
||||
// if it is ,
|
||||
// use errorCode as err and return struct,
|
||||
// otherwise use respBody string as error and return
|
||||
if errUnmarshal != nil || len(output.GetResponseMetadata().GetError().GetCode()) == 0 {
|
||||
if err == nil {
|
||||
err = errors.New(string(respBody))
|
||||
}
|
||||
return nil, status, err
|
||||
} else {
|
||||
return output, status, errors.New(output.GetResponseMetadata().GetError().GetCode())
|
||||
}
|
||||
}
|
||||
return output, status, nil
|
||||
}
|
||||
+9
-3
@@ -15,8 +15,14 @@ type CERTIFICATESERVICE struct {
|
||||
*client.Client
|
||||
}
|
||||
|
||||
const (
|
||||
ServiceName = certificateservice.ServiceName
|
||||
EndpointsID = certificateservice.EndpointsID
|
||||
ServiceID = certificateservice.ServiceID
|
||||
)
|
||||
|
||||
func New(p client.ConfigProvider, cfgs ...*volcengine.Config) *CERTIFICATESERVICE {
|
||||
c := p.ClientConfig(certificateservice.EndpointsID, cfgs...)
|
||||
c := p.ClientConfig(EndpointsID, cfgs...)
|
||||
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
|
||||
}
|
||||
|
||||
@@ -25,8 +31,8 @@ func newClient(cfg volcengine.Config, handlers request.Handlers, endpoint, signi
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: certificateservice.ServiceName,
|
||||
ServiceID: certificateservice.ServiceID,
|
||||
ServiceName: ServiceName,
|
||||
ServiceID: ServiceID,
|
||||
SigningName: signingName,
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package vod20260101
|
||||
|
||||
import (
|
||||
"github.com/volcengine/volcengine-go-sdk/service/vod20260101"
|
||||
"github.com/volcengine/volcengine-go-sdk/volcengine"
|
||||
"github.com/volcengine/volcengine-go-sdk/volcengine/request"
|
||||
)
|
||||
|
||||
const opListVodDomains = "ListVodDomains"
|
||||
|
||||
func (c *VOD20260101) ListVodDomainsRequest(input *ListVodDomainsInput) (req *request.Request, output *ListVodDomainsOutput) {
|
||||
op := &request.Operation{
|
||||
Name: opListVodDomains,
|
||||
HTTPMethod: "POST",
|
||||
HTTPPath: "/",
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &ListVodDomainsInput{}
|
||||
}
|
||||
|
||||
output = &ListVodDomainsOutput{}
|
||||
req = c.newRequest(op, input, output)
|
||||
|
||||
req.HTTPRequest.Header.Set("Content-Type", "application/json; charset=utf-8")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (c *VOD20260101) ListVodDomainsWithContext(ctx volcengine.Context, input *ListVodDomainsInput, opts ...request.Option) (*ListVodDomainsOutput, error) {
|
||||
req, out := c.ListVodDomainsRequest(input)
|
||||
req.SetContext(ctx)
|
||||
req.ApplyOptions(opts...)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
type ListVodDomainsInput = vod20260101.ListVodDomainsInput
|
||||
|
||||
type ListVodDomainsOutput = vod20260101.VodInfoForListVodDomainsOutput
|
||||
|
||||
type ListCdnDomainsParamForListVodDomainsInput = vod20260101.ListCdnDomainsParamForListVodDomainsInput
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package vod20260101
|
||||
|
||||
import (
|
||||
"github.com/volcengine/volcengine-go-sdk/service/vod20260101"
|
||||
"github.com/volcengine/volcengine-go-sdk/volcengine"
|
||||
"github.com/volcengine/volcengine-go-sdk/volcengine/request"
|
||||
)
|
||||
|
||||
const opUpdateVodDomainConfig = "UpdateVodDomainConfig"
|
||||
|
||||
func (c *VOD20260101) UpdateVodDomainConfigRequest(input *UpdateVodDomainConfigInput) (req *request.Request, output *UpdateVodDomainConfigOutput) {
|
||||
op := &request.Operation{
|
||||
Name: opUpdateVodDomainConfig,
|
||||
HTTPMethod: "POST",
|
||||
HTTPPath: "/",
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &UpdateVodDomainConfigInput{}
|
||||
}
|
||||
|
||||
output = &UpdateVodDomainConfigOutput{}
|
||||
req = c.newRequest(op, input, output)
|
||||
|
||||
req.HTTPRequest.Header.Set("Content-Type", "application/json; charset=utf-8")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (c *VOD20260101) UpdateVodDomainConfigWithContext(ctx volcengine.Context, input *UpdateVodDomainConfigInput, opts ...request.Option) (*UpdateVodDomainConfigOutput, error) {
|
||||
req, out := c.UpdateVodDomainConfigRequest(input)
|
||||
req.SetContext(ctx)
|
||||
req.ApplyOptions(opts...)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
type UpdateVodDomainConfigInput = vod20260101.UpdateVodDomainConfigInput
|
||||
|
||||
type UpdateVodDomainConfigOutput = vod20260101.UpdateVodDomainConfigOutput
|
||||
|
||||
type UpdateCdnConfigParamForUpdateVodDomainConfigInput = vod20260101.UpdateCdnConfigParamForUpdateVodDomainConfigInput
|
||||
|
||||
type HTTPSForUpdateVodDomainConfigInput = vod20260101.HTTPSForUpdateVodDomainConfigInput
|
||||
|
||||
type CertInfoForUpdateVodDomainConfigInput = vod20260101.CertInfoForUpdateVodDomainConfigInput
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package vod20260101
|
||||
|
||||
import (
|
||||
"github.com/volcengine/volcengine-go-sdk/service/vod20260101"
|
||||
"github.com/volcengine/volcengine-go-sdk/volcengine"
|
||||
"github.com/volcengine/volcengine-go-sdk/volcengine/client"
|
||||
"github.com/volcengine/volcengine-go-sdk/volcengine/client/metadata"
|
||||
"github.com/volcengine/volcengine-go-sdk/volcengine/corehandlers"
|
||||
"github.com/volcengine/volcengine-go-sdk/volcengine/request"
|
||||
"github.com/volcengine/volcengine-go-sdk/volcengine/signer/volc"
|
||||
"github.com/volcengine/volcengine-go-sdk/volcengine/volcenginequery"
|
||||
)
|
||||
|
||||
type VOD20260101 struct {
|
||||
*client.Client
|
||||
}
|
||||
|
||||
const (
|
||||
ServiceName = vod20260101.ServiceName
|
||||
EndpointsID = vod20260101.EndpointsID
|
||||
ServiceID = vod20260101.ServiceID
|
||||
)
|
||||
|
||||
func New(p client.ConfigProvider, cfgs ...*volcengine.Config) *VOD20260101 {
|
||||
c := p.ClientConfig(EndpointsID, cfgs...)
|
||||
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
|
||||
}
|
||||
|
||||
func newClient(cfg volcengine.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *VOD20260101 {
|
||||
svc := &VOD20260101{
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: ServiceName,
|
||||
ServiceID: ServiceID,
|
||||
SigningName: signingName,
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
APIVersion: "2026-01-01",
|
||||
},
|
||||
handlers,
|
||||
),
|
||||
}
|
||||
|
||||
svc.Handlers.Build.PushBackNamed(corehandlers.SDKVersionUserAgentHandler)
|
||||
svc.Handlers.Build.PushBackNamed(corehandlers.AddHostExecEnvUserAgentHandler)
|
||||
svc.Handlers.Sign.PushBackNamed(volc.SignRequestHandler)
|
||||
svc.Handlers.Build.PushBackNamed(volcenginequery.BuildHandler)
|
||||
svc.Handlers.Unmarshal.PushBackNamed(volcenginequery.UnmarshalHandler)
|
||||
svc.Handlers.UnmarshalMeta.PushBackNamed(volcenginequery.UnmarshalMetaHandler)
|
||||
svc.Handlers.UnmarshalError.PushBackNamed(volcenginequery.UnmarshalErrorHandler)
|
||||
|
||||
return svc
|
||||
}
|
||||
|
||||
func (c *VOD20260101) newRequest(op *request.Operation, params, data interface{}) *request.Request {
|
||||
req := c.NewRequest(op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
+3
-2
@@ -14,6 +14,7 @@ const DOMAIN_MATCH_PATTERN_CERTSAN = "certsan" as const;
|
||||
|
||||
const DOMAIN_TYPE_PLAY = "play" as const;
|
||||
const DOMAIN_TYPE_IMAGE = "image" as const;
|
||||
const DOMAIN_TYPE_THIRD = "third" as const;
|
||||
|
||||
const BizDeployNodeConfigFieldsProviderVolcEngineVOD = () => {
|
||||
const { i18n, t } = useTranslation();
|
||||
@@ -50,7 +51,7 @@ const BizDeployNodeConfigFieldsProviderVolcEngineVOD = () => {
|
||||
rules={[formRule]}
|
||||
>
|
||||
<Select
|
||||
options={[DOMAIN_TYPE_PLAY, DOMAIN_TYPE_IMAGE].map((s) => ({
|
||||
options={[DOMAIN_TYPE_PLAY, DOMAIN_TYPE_IMAGE, DOMAIN_TYPE_THIRD].map((s) => ({
|
||||
label: t(`workflow_node.deploy.form.volcengine_vod_domain_type.option.${s}.label`),
|
||||
value: s,
|
||||
}))}
|
||||
@@ -102,7 +103,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n?: ReturnType<typeof getI18n> })
|
||||
.object({
|
||||
spaceName: z.string().nonempty().nullish(),
|
||||
domainMatchPattern: z.string().nonempty().default(DOMAIN_MATCH_PATTERN_EXACT),
|
||||
domainType: z.enum([DOMAIN_TYPE_PLAY, DOMAIN_TYPE_IMAGE]),
|
||||
domainType: z.enum([DOMAIN_TYPE_PLAY, DOMAIN_TYPE_IMAGE, DOMAIN_TYPE_THIRD]),
|
||||
domain: z.string().nullish(),
|
||||
})
|
||||
.superRefine((values, ctx) => {
|
||||
|
||||
@@ -2745,6 +2745,9 @@
|
||||
},
|
||||
"image": {
|
||||
"label": "Image"
|
||||
},
|
||||
"third": {
|
||||
"label": "Third"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2744,6 +2744,9 @@
|
||||
},
|
||||
"image": {
|
||||
"label": "封面加速域名"
|
||||
},
|
||||
"third": {
|
||||
"label": "自定义源站加速域名"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user