Dragonfly2

Форк
0
79 строк · 3.1 Кб
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
type CreateJobRequest struct {
20
	BIO                 string         `json:"bio" binding:"omitempty"`
21
	Type                string         `json:"type" binding:"required"`
22
	Args                map[string]any `json:"args" binding:"omitempty"`
23
	Result              map[string]any `json:"result" binding:"omitempty"`
24
	UserID              uint           `json:"user_id" binding:"omitempty"`
25
	SeedPeerClusterIDs  []uint         `json:"seed_peer_cluster_ids" binding:"omitempty"`
26
	SchedulerClusterIDs []uint         `json:"scheduler_cluster_ids" binding:"omitempty"`
27
}
28

29
type UpdateJobRequest struct {
30
	BIO    string `json:"bio" binding:"omitempty"`
31
	UserID uint   `json:"user_id" binding:"omitempty"`
32
}
33

34
type JobParams struct {
35
	ID uint `uri:"id" binding:"required"`
36
}
37

38
type GetJobsQuery struct {
39
	Type    string `form:"type" binding:"omitempty"`
40
	State   string `form:"state" binding:"omitempty,oneof=PENDING RECEIVED STARTED RETRY SUCCESS FAILURE"`
41
	UserID  uint   `form:"user_id" binding:"omitempty"`
42
	Page    int    `form:"page" binding:"omitempty,gte=1"`
43
	PerPage int    `form:"per_page" binding:"omitempty,gte=1,lte=10000000"`
44
}
45

46
type CreatePreheatJobRequest struct {
47
	BIO                 string         `json:"bio" binding:"omitempty"`
48
	Type                string         `json:"type" binding:"required"`
49
	Args                PreheatArgs    `json:"args" binding:"omitempty"`
50
	Result              map[string]any `json:"result" binding:"omitempty"`
51
	UserID              uint           `json:"user_id" binding:"omitempty"`
52
	SchedulerClusterIDs []uint         `json:"scheduler_cluster_ids" binding:"omitempty"`
53
}
54

55
type PreheatArgs struct {
56
	// Type is the preheating type, support image and file.
57
	Type string `json:"type" binding:"required,oneof=image file"`
58

59
	// URL is the image url for preheating.
60
	URL string `json:"url" binding:"required"`
61

62
	// Tag is the tag for preheating.
63
	Tag string `json:"tag" binding:"omitempty"`
64

65
	// FilteredQueryParams is the filtered query params for preheating.
66
	FilteredQueryParams string `json:"filteredQueryParams" binding:"omitempty"`
67

68
	// Headers is the http headers for authentication.
69
	Headers map[string]string `json:"headers" binding:"omitempty"`
70

71
	// Username is the username for authentication.
72
	Username string `json:"username" binding:"omitempty"`
73

74
	// Password is the password for authentication.
75
	Password string `json:"password" binding:"omitempty"`
76

77
	// The image type preheating task can specify the image architecture type. eg: linux/amd64.
78
	Platform string `json:"platform" binding:"omitempty"`
79
}
80

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

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

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

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