2024-12-02 09:39:15 +08:00

51 lines
1.6 KiB
Go

package tencentcloud
import (
"encoding/base64"
"shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/nfs"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/renzhengshouquan"
"shylinux.com/x/community/src/renzhengshouquan/external/tencentcloud/model"
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
)
type tencentcloud struct {
renzhengshouquan.Table
order string `data:"15"`
fields string `data:"secret_id,secret_key,user_uid"`
create string `name:"create secret_id* secret_key*" role:"leader"`
remove string `name:"remove" role:"leader"`
}
func (s tencentcloud) List(m *ice.Message, arg ...string) {
s.ValueList(m, arg).Display("")
kit.If(m.Length() > 0, func() { m.Action() })
}
func init() { ice.TeamCtxCmd(tencentcloud{}) }
type Tencentcloud struct{ tencentcloud }
func init() { ice.TeamCtxCmd(Tencentcloud{}) }
func (s Tencentcloud) NewCredential(m *ice.Message, arg ...string) *common.Credential {
msg := m.Cmd(s, s.GetAuthUID(m))
return common.NewCredential(msg.Append(model.SECRET_ID), msg.Append(model.SECRET_KEY))
}
func (s Tencentcloud) NewProfile(m *ice.Message, arg ...string) *profile.ClientProfile {
return profile.NewClientProfile()
}
func (s Tencentcloud) ImageData(m *ice.Message, arg ...string) string {
return base64.StdEncoding.EncodeToString([]byte(m.Cmdx(nfs.CAT, arg[0])))
}
func (s Tencentcloud) ParseResponse(m *ice.Message, res interface{ ToJsonString() string }, err error, arg ...string) {
if !m.Warn(err) {
m.PushDetail(kit.Value(kit.UnMarshal(res.ToJsonString()), "Response"))
}
}