fix: remove apiversion param from session

This commit is contained in:
QIU Jian
2022-08-25 09:43:50 +08:00
committed by Qiu Jian
parent c6f557fd68
commit 293afd2e69
165 changed files with 381 additions and 487 deletions
+2 -2
View File
@@ -237,7 +237,7 @@ func (t *eventTask) Dump() string {
}
func (t *eventTask) Run() {
s, err := AdminSessionGenerator(context.Background(), "", "")
s, err := AdminSessionGenerator(context.Background(), "")
if err != nil {
log.Errorf("unable to get admin session: %v", err)
return
@@ -361,7 +361,7 @@ func IntelliNotify(ctx context.Context, recipientId []string, isGroup bool, chan
}
func FetchNotifyAdminRecipients(ctx context.Context, region string, users []string, groups []string) {
s, err := AdminSessionGenerator(ctx, region, "v1")
s, err := AdminSessionGenerator(ctx, region)
if err != nil {
log.Errorf("unable to get admin session: %v", err)
}
@@ -72,7 +72,7 @@ func systemNotify(ctx context.Context, priority npk.TNotifyPriority, event strin
}
func notifyAll(ctx context.Context, recipientId []string, isGroup bool, priority npk.TNotifyPriority, event string, data jsonutils.JSONObject) error {
s, err := AdminSessionGenerator(ctx, consts.GetRegion(), "")
s, err := AdminSessionGenerator(ctx, consts.GetRegion())
if err != nil {
return err
}
@@ -184,7 +184,7 @@ func lang(ctx context.Context, contactType npk.TNotifyChannel, reIds []string, c
func genMsgViaLang(ctx context.Context, p sNotifyParams) ([]npk.SNotifyMessage, error) {
reIds := make([]string, 0)
s, err := AdminSessionGenerator(context.Background(), consts.GetRegion(), "")
s, err := AdminSessionGenerator(context.Background(), consts.GetRegion())
if err != nil {
return nil, err
}
@@ -359,7 +359,7 @@ func (t *notifyTask) Dump() string {
}
func (t *notifyTask) Run() {
s, err := AdminSessionGenerator(t.ctx, consts.GetRegion(), "")
s, err := AdminSessionGenerator(t.ctx, consts.GetRegion())
if err != nil {
log.Errorf("fail to get session: %v", err)
}
+5 -5
View File
@@ -46,15 +46,15 @@ var (
checkTemplates bool
)
type SAdminSessionGenerator func(ctx context.Context, region string, apiVersion string) (*mcclient.ClientSession, error)
type SAdminSessionGenerator func(ctx context.Context, region string) (*mcclient.ClientSession, error)
type SUserLangFetcher func(uids []string) (map[string]string, error)
func getAdminSesion(ctx context.Context, region string, apiVersion string) (*mcclient.ClientSession, error) {
return auth.GetAdminSession(ctx, region, apiVersion), nil
func getAdminSesion(ctx context.Context, region string) (*mcclient.ClientSession, error) {
return auth.GetAdminSession(ctx, region), nil
}
func getUserLang(uids []string) (map[string]string, error) {
s, err := AdminSessionGenerator(context.Background(), consts.GetRegion(), "")
s, err := AdminSessionGenerator(context.Background(), consts.GetRegion())
if err != nil {
return nil, err
}
@@ -79,7 +79,7 @@ func getUserLang(uids []string) (map[string]string, error) {
}
func getRobotLang(robots []string) (map[string]string, error) {
s, err := AdminSessionGenerator(context.Background(), consts.GetRegion(), "")
s, err := AdminSessionGenerator(context.Background(), consts.GetRegion())
if err != nil {
return nil, err
}