fixed some stuff
This commit is contained in:
parent
85e6b3b16f
commit
c68de6705a
@ -118,13 +118,22 @@ func convertLabelsToMap(v any) (map[string]string, error) {
|
|||||||
return x, nil
|
return x, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CreateServerRequest struct {
|
||||||
|
ImageId string `json:"image_id"`
|
||||||
|
}
|
||||||
|
|
||||||
func (con Connection) CreateServer(ctx *gin.Context) {
|
func (con Connection) CreateServer(ctx *gin.Context) {
|
||||||
claims, exists := ctx.Get("claims")
|
claims, exists := ctx.Get("claims")
|
||||||
if !exists {
|
if !exists {
|
||||||
ctx.AbortWithStatus(500)
|
ctx.AbortWithStatus(500)
|
||||||
}
|
}
|
||||||
imageId := ctx.Param("image_id")
|
var request CreateServerRequest
|
||||||
imageList, err := con.apiClient.ImageList(context.Background(), image.ListOptions{All: true, Filters: filters.NewArgs(filters.Arg("reference", imageId))})
|
err := json.NewDecoder(ctx.Request.Body).Decode(&request)
|
||||||
|
if err != nil {
|
||||||
|
ctx.AbortWithError(400, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
imageList, err := con.apiClient.ImageList(context.Background(), image.ListOptions{All: true, Filters: filters.NewArgs(filters.Arg("reference", request.ImageId))})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.AbortWithError(400, err)
|
ctx.AbortWithError(400, err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user