Dragonfly2
65 строк · 2.6 Кб
1/*
2* Copyright 2020 The Dragonfly Authors
3*
4* Licensed under the Apache License, Version 2.0 (the "License");
5* you may not use this file except in compliance with the License.
6* You may obtain a copy of the License at
7*
8* http://www.apache.org/licenses/LICENSE-2.0
9*
10* Unless required by applicable law or agreed to in writing, software
11* distributed under the License is distributed on an "AS IS" BASIS,
12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13* See the License for the specific language governing permissions and
14* limitations under the License.
15*/
16
17package types
18
19const (
20// SchedulerFeatureSchedule is the schedule feature of scheduler.
21SchedulerFeatureSchedule = "schedule"
22
23// SchedulerFeaturePreheat is the preheat feature of scheduler.
24SchedulerFeaturePreheat = "preheat"
25)
26
27var (
28// DefaultSchedulerFeatures is the default features of scheduler.
29DefaultSchedulerFeatures = []string{SchedulerFeatureSchedule, SchedulerFeaturePreheat}
30)
31
32type SchedulerParams struct {
33ID uint `uri:"id" binding:"required"`
34}
35
36type CreateSchedulerRequest struct {
37Hostname string `json:"host_name" binding:"required"`
38IDC string `json:"idc" binding:"omitempty"`
39Location string `json:"location" binding:"omitempty"`
40IP string `json:"ip" binding:"required"`
41Port int32 `json:"port" binding:"required"`
42Features []string `json:"features" binding:"omitempty"`
43SchedulerClusterID uint `json:"scheduler_cluster_id" binding:"required"`
44}
45
46type UpdateSchedulerRequest struct {
47IDC string `json:"idc" binding:"omitempty"`
48Location string `json:"location" binding:"omitempty"`
49IP string `json:"ip" binding:"omitempty"`
50Port int32 `json:"port" binding:"omitempty"`
51SchedulerID uint `json:"scheduler_id" binding:"omitempty"`
52Features []string `json:"features" binding:"omitempty"`
53SchedulerClusterID uint `json:"scheduler_cluster_id" binding:"omitempty"`
54}
55
56type GetSchedulersQuery struct {
57Page int `form:"page" binding:"omitempty,gte=1"`
58PerPage int `form:"per_page" binding:"omitempty,gte=1,lte=10000000"`
59Hostname string `form:"host_name" binding:"omitempty"`
60IDC string `form:"idc" binding:"omitempty"`
61Location string `form:"location" binding:"omitempty"`
62IP string `form:"ip" binding:"omitempty"`
63State string `form:"state" binding:"omitempty,oneof=active inactive"`
64SchedulerClusterID uint `form:"scheduler_cluster_id" binding:"omitempty"`
65}
66