mirror of
https://shylinux.com/x/community
synced 2025-05-07 06:26:54 +08:00
55 lines
1.8 KiB
Go
55 lines
1.8 KiB
Go
package tencentcloud
|
|
|
|
import (
|
|
"shylinux.com/x/ice"
|
|
|
|
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:"worker"`
|
|
remove string `name:"remove" role:"worker"`
|
|
list string `name:"list auth_uid uid auto" role:"worker"`
|
|
}
|
|
|
|
func (s tencentcloud) List(m *ice.Message, arg ...string) {
|
|
s.ValueList(m, arg).Action().Display("")
|
|
}
|
|
|
|
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) ParseResponse(m *ice.Message, res interface{ ToJsonString() string }, err error, arg ...string) {
|
|
if !m.Warn(err) {
|
|
m.PushDetail(kit.Value(kit.UnMarshal(res.ToJsonString()), kit.Select("Response", arg, 0)))
|
|
}
|
|
}
|
|
func (s Tencentcloud) ParseResponseList(m *ice.Message, res interface{ ToJsonString() string }, err error, arg ...string) {
|
|
if !m.Warn(err) {
|
|
data := kit.UnMarshal(res.ToJsonString())
|
|
kit.For(kit.Value(data, kit.Select("Response.List", arg, 0)), func(value ice.Map) {
|
|
m.PushRecord(value, kit.Slice(arg, 1)...)
|
|
})
|
|
m.Echo(kit.Formats(data))
|
|
}
|
|
}
|