Skip to content

Commit

Permalink
rename route.go
Browse files Browse the repository at this point in the history
  • Loading branch information
hwchiu committed Jun 21, 2018
1 parent 97bc9f8 commit 62a6011
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
3 changes: 0 additions & 3 deletions src/server/handler_storage_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ func CreateStorageProvider(ctx *web.Context) {
as, req, resp := ctx.ServiceProvider, ctx.Request, ctx.Response

storageProvider := entity.StorageProvider{}

if err := req.ReadEntity(&storageProvider); err != nil {
logger.Error(err)
response.BadRequest(req.Request, resp.ResponseWriter, err)
Expand All @@ -25,7 +24,6 @@ func CreateStorageProvider(ctx *web.Context) {

session := as.Mongo.NewSession()
defer session.Close()

// Check whether this displayname has been used
query := bson.M{"displayName": storageProvider.DisplayName}
count, err := session.Count(entity.NetworkCollectionName, query)
Expand All @@ -34,7 +32,6 @@ func CreateStorageProvider(ctx *web.Context) {
response.InternalServerError(req.Request, resp.ResponseWriter, err)
return
}

if count > 0 {
response.Conflict(req.Request, resp, fmt.Errorf("displayName: %s already existed", storageProvider.DisplayName))
return
Expand Down
2 changes: 1 addition & 1 deletion src/server/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func newNetworkService(sp *serviceprovider.Container) *restful.WebService {

func newStorageProviderService(sp *serviceprovider.Container) *restful.WebService {
webService := new(restful.WebService)
webService.Path("/v1/provisioner").Consumes(restful.MIME_JSON, restful.MIME_JSON).Produces(restful.MIME_JSON, restful.MIME_JSON)
webService.Path("/v1/storageprovider").Consumes(restful.MIME_JSON, restful.MIME_JSON).Produces(restful.MIME_JSON, restful.MIME_JSON)
webService.Route(webService.POST("/").To(handler.RESTfulServiceHandler(sp, CreateStorageProvider)))
return webService
}

0 comments on commit 62a6011

Please sign in to comment.