diff --git a/sdks/scheduler/app_models.go b/sdks/scheduler/app_models.go new file mode 100644 index 0000000..77d5c97 --- /dev/null +++ b/sdks/scheduler/app_models.go @@ -0,0 +1,41 @@ +package schsdk + +import ( + "gitlink.org.cn/cloudream/common/pkgs/types" + "gitlink.org.cn/cloudream/common/utils/serder" +) + +type AppInfo interface { + GetAppID() string +} + +var AppInfoTypeUnion = types.NewTypeUnion[AppInfo]( + (*FederatedLearningAppInfo)(nil), + (*OtherAppInfo)(nil), +) + +var _ = serder.UseTypeUnionInternallyTagged(&JobInfoTypeUnion, "type") + +type AppInfoBase struct { + ID string `json:"id"` +} + +func (i *AppInfoBase) GetAppID() string { + return i.ID +} + +type FederatedLearningAppInfo struct { + serder.Metadata `union:"federatedLearning"` + AppInfoBase + Type string `json:"type"` + Name string `json:"name"` + Description string `json:"description"` +} + +type OtherAppInfo struct { + serder.Metadata `union:"other"` + AppInfoBase + Type string `json:"type"` + Name string `json:"name"` + Description string `json:"description"` +}