Dragonfly2
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
17package types18
19type CreateJobRequest struct {20BIO string `json:"bio" binding:"omitempty"`21Type string `json:"type" binding:"required"`22Args map[string]any `json:"args" binding:"omitempty"`23Result map[string]any `json:"result" binding:"omitempty"`24UserID uint `json:"user_id" binding:"omitempty"`25SeedPeerClusterIDs []uint `json:"seed_peer_cluster_ids" binding:"omitempty"`26SchedulerClusterIDs []uint `json:"scheduler_cluster_ids" binding:"omitempty"`27}
28
29type UpdateJobRequest struct {30BIO string `json:"bio" binding:"omitempty"`31UserID uint `json:"user_id" binding:"omitempty"`32}
33
34type JobParams struct {35ID uint `uri:"id" binding:"required"`36}
37
38type GetJobsQuery struct {39Type string `form:"type" binding:"omitempty"`40State string `form:"state" binding:"omitempty,oneof=PENDING RECEIVED STARTED RETRY SUCCESS FAILURE"`41UserID uint `form:"user_id" binding:"omitempty"`42Page int `form:"page" binding:"omitempty,gte=1"`43PerPage int `form:"per_page" binding:"omitempty,gte=1,lte=10000000"`44}
45
46type CreatePreheatJobRequest struct {47BIO string `json:"bio" binding:"omitempty"`48Type string `json:"type" binding:"required"`49Args PreheatArgs `json:"args" binding:"omitempty"`50Result map[string]any `json:"result" binding:"omitempty"`51UserID uint `json:"user_id" binding:"omitempty"`52SchedulerClusterIDs []uint `json:"scheduler_cluster_ids" binding:"omitempty"`53}
54
55type PreheatArgs struct {56// Type is the preheating type, support image and file.57Type string `json:"type" binding:"required,oneof=image file"`58
59// URL is the image url for preheating.60URL string `json:"url" binding:"required"`61
62// Tag is the tag for preheating.63Tag string `json:"tag" binding:"omitempty"`64
65// FilteredQueryParams is the filtered query params for preheating.66FilteredQueryParams string `json:"filteredQueryParams" binding:"omitempty"`67
68// Headers is the http headers for authentication.69Headers map[string]string `json:"headers" binding:"omitempty"`70
71// Username is the username for authentication.72Username string `json:"username" binding:"omitempty"`73
74// Password is the password for authentication.75Password string `json:"password" binding:"omitempty"`76
77// The image type preheating task can specify the image architecture type. eg: linux/amd64.78Platform string `json:"platform" binding:"omitempty"`79}
80