Skip to content

Commit

Permalink
IP free and child network free should be DELETE methods. (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit91 authored Apr 20, 2022
1 parent 135d28a commit eee5304
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 2 deletions.
12 changes: 12 additions & 0 deletions cmd/metal-api/internal/service/ip-service.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,18 @@ func (ir ipResource) webService() *restful.WebService {
DefaultReturns("Error", httperrors.HTTPErrorResponse{}))

ws.Route(ws.POST("/free/{id}").
To(editor(ir.freeIP)).
Operation("freeIPDeprecated").
Doc("frees an ip").
Param(ws.PathParameter("id", "identifier of the ip").DataType("string")).
Consumes(restful.MIME_JSON, "*/*").
Metadata(restfulspec.KeyOpenAPITags, tags).
Writes(v1.IPResponse{}).
Returns(http.StatusOK, "OK", v1.IPResponse{}).
DefaultReturns("Error", httperrors.HTTPErrorResponse{}).
Deprecate())

ws.Route(ws.DELETE("/free/{id}").
To(editor(ir.freeIP)).
Operation("freeIP").
Doc("frees an ip").
Expand Down
12 changes: 12 additions & 0 deletions cmd/metal-api/internal/service/network-service.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,18 @@ func (r networkResource) webService() *restful.WebService {
DefaultReturns("Error", httperrors.HTTPErrorResponse{}))

ws.Route(ws.POST("/free/{id}").
To(editor(r.freeNetwork)).
Operation("freeNetworkDeprecated").
Doc("free a network").
Metadata(restfulspec.KeyOpenAPITags, tags).
Consumes(restful.MIME_JSON, "*/*").
Param(ws.PathParameter("id", "identifier of the network").DataType("string")).
Returns(http.StatusOK, "OK", v1.NetworkResponse{}).
Returns(http.StatusConflict, "Conflict", httperrors.HTTPErrorResponse{}).
DefaultReturns("Error", httperrors.HTTPErrorResponse{}).
Deprecate())

ws.Route(ws.DELETE("/free/{id}").
To(editor(r.freeNetwork)).
Operation("freeNetwork").
Doc("free a network").
Expand Down
86 changes: 84 additions & 2 deletions spec/metal-api.json
Original file line number Diff line number Diff line change
Expand Up @@ -5579,7 +5579,7 @@
}
},
"/v1/ip/free/{id}": {
"post": {
"delete": {
"consumes": [
"application/json"
],
Expand Down Expand Up @@ -5614,6 +5614,44 @@
"tags": [
"ip"
]
},
"post": {
"consumes": [
"*/*",
"application/json"
],
"deprecated": true,
"operationId": "freeIPDeprecated",
"parameters": [
{
"description": "identifier of the ip",
"in": "path",
"name": "id",
"required": true,
"type": "string"
}
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/v1.IPResponse"
}
},
"default": {
"description": "Error",
"schema": {
"$ref": "#/definitions/httperrors.HTTPErrorResponse"
}
}
},
"summary": "frees an ip",
"tags": [
"ip"
]
}
},
"/v1/ip/{id}": {
Expand Down Expand Up @@ -7078,7 +7116,7 @@
}
},
"/v1/network/free/{id}": {
"post": {
"delete": {
"consumes": [
"application/json"
],
Expand Down Expand Up @@ -7119,6 +7157,50 @@
"tags": [
"network"
]
},
"post": {
"consumes": [
"*/*",
"application/json"
],
"deprecated": true,
"operationId": "freeNetworkDeprecated",
"parameters": [
{
"description": "identifier of the network",
"in": "path",
"name": "id",
"required": true,
"type": "string"
}
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/v1.NetworkResponse"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/httperrors.HTTPErrorResponse"
}
},
"default": {
"description": "Error",
"schema": {
"$ref": "#/definitions/httperrors.HTTPErrorResponse"
}
}
},
"summary": "free a network",
"tags": [
"network"
]
}
},
"/v1/network/{id}": {
Expand Down

0 comments on commit eee5304

Please sign in to comment.