mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 18:25:56 +01:00
Merge pull request #13393 from chlins/fix/p2p-preheat-instance-and-policy-post-no-location
fix(preheat): add location when create instance and policy
This commit is contained in:
commit
2bab4a10db
@ -957,9 +957,7 @@ paths:
|
||||
$ref: '#/definitions/Instance'
|
||||
responses:
|
||||
'201':
|
||||
description: Response to insatnce created
|
||||
schema:
|
||||
$ref: '#/definitions/InstanceCreatedResp'
|
||||
$ref: '#/responses/201'
|
||||
'400':
|
||||
$ref: '#/responses/400'
|
||||
'401':
|
||||
@ -1008,9 +1006,7 @@ paths:
|
||||
- $ref: '#/parameters/instanceName'
|
||||
responses:
|
||||
'200':
|
||||
description: Instance ID deleted
|
||||
schema:
|
||||
$ref: '#/definitions/InstanceDeletedResp'
|
||||
$ref: '#/responses/200'
|
||||
'401':
|
||||
$ref: '#/responses/401'
|
||||
'403':
|
||||
@ -1036,9 +1032,7 @@ paths:
|
||||
$ref: '#/definitions/Instance'
|
||||
responses:
|
||||
'200':
|
||||
description: Success
|
||||
schema:
|
||||
$ref: '#/definitions/InstanceUpdateResp'
|
||||
$ref: '#/responses/200'
|
||||
'400':
|
||||
$ref: '#/responses/400'
|
||||
'401':
|
||||
@ -2018,24 +2012,6 @@ definitions:
|
||||
type: integer
|
||||
format: int64
|
||||
description: The timestamp of instance setting up
|
||||
InstanceUpdateResp:
|
||||
type: object
|
||||
properties:
|
||||
updated:
|
||||
type: integer
|
||||
description: ID of instance updated
|
||||
InstanceDeletedResp:
|
||||
type: object
|
||||
properties:
|
||||
removed:
|
||||
type: integer
|
||||
description: ID of instance removed
|
||||
InstanceCreatedResp:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: ID of instance created
|
||||
PreheatPolicy:
|
||||
type: object
|
||||
properties:
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
@ -68,7 +69,9 @@ func (api *preheatAPI) CreateInstance(ctx context.Context, params operation.Crea
|
||||
if err != nil {
|
||||
return api.SendError(ctx, err)
|
||||
}
|
||||
return operation.NewCreateInstanceCreated()
|
||||
|
||||
location := fmt.Sprintf("%s/%s", strings.TrimSuffix(params.HTTPRequest.URL.Path, "/"), instance.Name)
|
||||
return operation.NewCreateInstanceCreated().WithLocation(location)
|
||||
}
|
||||
|
||||
func (api *preheatAPI) DeleteInstance(ctx context.Context, params operation.DeleteInstanceParams) middleware.Responder {
|
||||
@ -238,7 +241,9 @@ func (api *preheatAPI) CreatePolicy(ctx context.Context, params operation.Create
|
||||
if err != nil {
|
||||
return api.SendError(ctx, err)
|
||||
}
|
||||
return operation.NewCreatePolicyCreated()
|
||||
|
||||
location := fmt.Sprintf("%s/%s", strings.TrimSuffix(params.HTTPRequest.URL.Path, "/"), policy.Name)
|
||||
return operation.NewCreatePolicyCreated().WithLocation(location)
|
||||
}
|
||||
|
||||
// UpdatePolicy is Update preheat policy
|
||||
|
Loading…
Reference in New Issue
Block a user