Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK and Test cases for Update API for Router #18

Merged
merged 8 commits into from
Oct 18, 2021
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