From 0b00fb744f912f35e87aa400b3796ab8c3d1e283 Mon Sep 17 00:00:00 2001 From: UCloud Date: Tue, 31 Aug 2021 19:53:37 +0800 Subject: [PATCH] auto codegen for UCDN --- services/ucdn/apis.go | 159 ++++++++++++++++++++++++++++++++++++++++ services/ucdn/models.go | 99 ++++++++++++++++--------- 2 files changed, 225 insertions(+), 33 deletions(-) diff --git a/services/ucdn/apis.go b/services/ucdn/apis.go index 3f732d6e..c206625a 100644 --- a/services/ucdn/apis.go +++ b/services/ucdn/apis.go @@ -9,6 +9,62 @@ import ( // UCDN API Schema +// AddCertificateRequest is request schema for AddCertificate action +type AddCertificateRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"false"` + + // Ca证书,默认为空 + CaCert *string `required:"false"` + + // 证书名称 + CertName *string `required:"true"` + + // 用户私钥 + PrivateKey *string `required:"true"` + + // 用户证书 + UserCert *string `required:"true"` +} + +// AddCertificateResponse is response schema for AddCertificate action +type AddCertificateResponse struct { + response.CommonBase +} + +// NewAddCertificateRequest will create request of AddCertificate action. +func (c *UCDNClient) NewAddCertificateRequest() *AddCertificateRequest { + req := &AddCertificateRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +/* +API: AddCertificate + +添加证书 +*/ +func (c *UCDNClient) AddCertificate(req *AddCertificateRequest) (*AddCertificateResponse, error) { + var err error + var res AddCertificateResponse + + reqCopier := *req + + err = c.Client.InvokeAction("AddCertificate", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + // BatchDescribeNewUcdnDomainRequest is request schema for BatchDescribeNewUcdnDomain action type BatchDescribeNewUcdnDomainRequest struct { request.CommonBase @@ -139,6 +195,53 @@ func (c *UCDNClient) BatchRefreshNewUcdnDomainCache(req *BatchRefreshNewUcdnDoma return &res, nil } +// DeleteCertificateRequest is request schema for DeleteCertificate action +type DeleteCertificateRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"false"` + + // 证书名称 + CertName *string `required:"true"` +} + +// DeleteCertificateResponse is response schema for DeleteCertificate action +type DeleteCertificateResponse struct { + response.CommonBase +} + +// NewDeleteCertificateRequest will create request of DeleteCertificate action. +func (c *UCDNClient) NewDeleteCertificateRequest() *DeleteCertificateRequest { + req := &DeleteCertificateRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: DeleteCertificate + +删除证书 +*/ +func (c *UCDNClient) DeleteCertificate(req *DeleteCertificateRequest) (*DeleteCertificateResponse, error) { + var err error + var res DeleteCertificateResponse + + reqCopier := *req + + err = c.Client.InvokeAction("DeleteCertificate", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + // DescribeNewUcdnPrefetchCacheTaskRequest is request schema for DescribeNewUcdnPrefetchCacheTask action type DescribeNewUcdnPrefetchCacheTaskRequest struct { request.CommonBase @@ -275,6 +378,62 @@ func (c *UCDNClient) DescribeNewUcdnRefreshCacheTask(req *DescribeNewUcdnRefresh return &res, nil } +// GetCertificateV2Request is request schema for GetCertificateV2 action +type GetCertificateV2Request struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"false"` + + // 长度,默认为全部,非负整数 + Limit *int `required:"false"` + + // 偏移,默认为0,非负整数 + Offset *int `required:"false"` +} + +// GetCertificateV2Response is response schema for GetCertificateV2 action +type GetCertificateV2Response struct { + response.CommonBase + + // 证书信息列表 + CertList []CertList + + // 证书数量 + TotalCount int +} + +// NewGetCertificateV2Request will create request of GetCertificateV2 action. +func (c *UCDNClient) NewGetCertificateV2Request() *GetCertificateV2Request { + req := &GetCertificateV2Request{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: GetCertificateV2 + +获取证书列表(新) +*/ +func (c *UCDNClient) GetCertificateV2(req *GetCertificateV2Request) (*GetCertificateV2Response, error) { + var err error + var res GetCertificateV2Response + + reqCopier := *req + + err = c.Client.InvokeAction("GetCertificateV2", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + // GetNewUcdnDomainBandwidthRequest is request schema for GetNewUcdnDomainBandwidth action type GetNewUcdnDomainBandwidthRequest struct { request.CommonBase diff --git a/services/ucdn/models.go b/services/ucdn/models.go index 955ac4d7..d0c15c44 100644 --- a/services/ucdn/models.go +++ b/services/ucdn/models.go @@ -161,6 +161,39 @@ type TaskInfo struct { UrlLists []UrlProgressInfo } +/* +CertList - 证书信息 +*/ +type CertList struct { + + // 证书开始时间 + BeginTime int + + // ca证内容 + CaCert string + + // 证书名 + CertName string + + // 通用名 + CommonName string + + // dns名称 + DnsName string + + // 已配置域名个数 + DomainCount int + + // 已配置的域名列表 + Domains []string + + // 证书获取时间 + EndTime int + + // 证书内容 + UserCert string +} + /* BandwidthInfo - BandwidthInfo */ @@ -422,21 +455,6 @@ type BandwidthTrafficInfo struct { Traffic float64 } -/* -CacheKeyInfo - 忽略参数缓存配置 -*/ -type CacheKeyInfo struct { - - // 是否忽略 - Ignore bool - - // 路径模式,支持正则 - PathPattern string - - // 自定义变量,以$符号开头,多个变量用加号(+)连接,$querystring表示所有变量 - QueryString string -} - /* ReferConf - refer配置 */ @@ -452,6 +470,21 @@ type ReferConf struct { ReferType int } +/* +CacheKeyInfo - 忽略参数缓存配置 +*/ +type CacheKeyInfo struct { + + // 是否忽略 + Ignore bool + + // 路径模式,支持正则 + PathPattern string + + // 自定义变量,以$符号开头,多个变量用加号(+)连接,$querystring表示所有变量 + QueryString string +} + /* AdvancedConf - 域名高级配置 */ @@ -467,24 +500,6 @@ type AdvancedConf struct { HttpOriginHeader []string } -/* -CacheAllConfig - 缓存相关的配置 -*/ -type CacheAllConfig struct { - - // 缓存Host,不同的域名可以配置为同一个CacheHost来实现缓存共享,默认为加速域名 - CacheHost string - - // 忽略参数缓存配置列表,参见CacheKeyInfo - CacheKeyList []CacheKeyInfo - - // 缓存配置列表,参见CacheConf - CacheList []CacheConf - - // 状态码缓存配置列表,参见CacheConf - HttpCodeCacheList []CacheConf -} - /* AccessControlConf - 访问控制配置参数 */ @@ -533,6 +548,24 @@ type OriginConf struct { OriginProtocol string } +/* +CacheAllConfig - 缓存相关的配置 +*/ +type CacheAllConfig struct { + + // 缓存Host,不同的域名可以配置为同一个CacheHost来实现缓存共享,默认为加速域名 + CacheHost string + + // 忽略参数缓存配置列表,参见CacheKeyInfo + CacheKeyList []CacheKeyInfo + + // 缓存配置列表,参见CacheConf + CacheList []CacheConf + + // 状态码缓存配置列表,参见CacheConf + HttpCodeCacheList []CacheConf +} + /* DomainConfigInfo - 更新域名配置 */