Dragonfly2

Форк
0
/
scheduler.go 
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

17
package types
18

19
const (
20
	// SchedulerFeatureSchedule is the schedule feature of scheduler.
21
	SchedulerFeatureSchedule = "schedule"
22

23
	// SchedulerFeaturePreheat is the preheat feature of scheduler.
24
	SchedulerFeaturePreheat = "preheat"
25
)
26

27
var (
28
	// DefaultSchedulerFeatures is the default features of scheduler.
29
	DefaultSchedulerFeatures = []string{SchedulerFeatureSchedule, SchedulerFeaturePreheat}
30
)
31

32
type SchedulerParams struct {
33
	ID uint `uri:"id" binding:"required"`
34
}
35

36
type CreateSchedulerRequest struct {
37
	Hostname           string   `json:"host_name" binding:"required"`
38
	IDC                string   `json:"idc" binding:"omitempty"`
39
	Location           string   `json:"location" binding:"omitempty"`
40
	IP                 string   `json:"ip" binding:"required"`
41
	Port               int32    `json:"port" binding:"required"`
42
	Features           []string `json:"features" binding:"omitempty"`
43
	SchedulerClusterID uint     `json:"scheduler_cluster_id" binding:"required"`
44
}
45

46
type UpdateSchedulerRequest struct {
47
	IDC                string   `json:"idc" binding:"omitempty"`
48
	Location           string   `json:"location" binding:"omitempty"`
49
	IP                 string   `json:"ip" binding:"omitempty"`
50
	Port               int32    `json:"port" binding:"omitempty"`
51
	SchedulerID        uint     `json:"scheduler_id" binding:"omitempty"`
52
	Features           []string `json:"features" binding:"omitempty"`
53
	SchedulerClusterID uint     `json:"scheduler_cluster_id" binding:"omitempty"`
54
}
55

56
type GetSchedulersQuery struct {
57
	Page               int    `form:"page" binding:"omitempty,gte=1"`
58
	PerPage            int    `form:"per_page" binding:"omitempty,gte=1,lte=10000000"`
59
	Hostname           string `form:"host_name" binding:"omitempty"`
60
	IDC                string `form:"idc" binding:"omitempty"`
61
	Location           string `form:"location" binding:"omitempty"`
62
	IP                 string `form:"ip" binding:"omitempty"`
63
	State              string `form:"state" binding:"omitempty,oneof=active inactive"`
64
	SchedulerClusterID uint   `form:"scheduler_cluster_id" binding:"omitempty"`
65
}
66

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.