Skip to content

Commit

Permalink
Merge pull request #18 from HewlettPackard/update_router_sdk
Browse files Browse the repository at this point in the history
SDK and Test cases for Update API for Router
  • Loading branch information
gandharvas authored Oct 18, 2021
2 parents b4d76ad + 9b56824 commit c285fec
Show file tree
Hide file tree
Showing 3 changed files with 537 additions and 37 deletions.
24 changes: 22 additions & 2 deletions pkg/client/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ func (r *RouterAPIService) GetAllRouter(
func (r *RouterAPIService) GetSpecificRouter(
ctx context.Context,
routerID int,
) (models.GetSpecificRouterResp, error) {
routerResp := models.GetSpecificRouterResp{}
) (models.GetNetworkRouter, error) {
routerResp := models.GetNetworkRouter{}
serverAPI := &api{
method: "GET",
path: fmt.Sprintf("%s/%s/%s/%s/%d", r.Cfg.Host, consts.VmaasCmpAPIBasePath,
Expand Down Expand Up @@ -73,6 +73,26 @@ func (r *RouterAPIService) CreateRouter(
return routerResp, err
}

func (r *RouterAPIService) UpdateRouter(
ctx context.Context,
routerID int,
request models.CreateRouterRequest,
) (models.SuccessOrErrorMessage, error) {
routerResp := models.SuccessOrErrorMessage{}
serverAPI := &api{
method: "PUT",
path: fmt.Sprintf("%s/%s/%s/%s/%d", r.Cfg.Host, consts.VmaasCmpAPIBasePath,
consts.NetworksPath, consts.NetworkRouterPath, routerID),
client: r.Client,
jsonParser: func(body []byte) error {
return json.Unmarshal(body, &routerResp)
},
}
err := serverAPI.do(ctx, request, nil)

return routerResp, err
}

func (r *RouterAPIService) DeleteRouter(
ctx context.Context,
routerID int,
Expand Down
Loading

0 comments on commit c285fec

Please sign in to comment.