Skip to content

Commit

Permalink
Update put operation to create router versions to a post operation
Browse files Browse the repository at this point in the history
  • Loading branch information
deadlycoconuts committed Mar 21, 2022
1 parent 3696661 commit 44375ba
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion api/api/openapi.bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ paths:
summary: List router config versions
tags:
- Router
put:
post:
parameters:
- description: project id of the project of the router
in: path
Expand Down
2 changes: 1 addition & 1 deletion api/api/specs/routers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ paths:
description: "Invalid project_id or router_id"
404:
description: "No router versions found"
put:
post:
tags: *tags
summary: "Create router version without deploying it"
parameters:
Expand Down
2 changes: 1 addition & 1 deletion api/turing/api/router_versions_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (c RouterVersionsController) Routes() []Route {
handler: c.ListRouterVersions,
},
{
method: http.MethodPut,
method: http.MethodPost,
path: "/projects/{project_id}/routers/{router_id}/versions",
body: request.CreateOrUpdateRouterRequest{},
handler: c.CreateRouterVersion,
Expand Down
2 changes: 1 addition & 1 deletion sdk/tests/router/router_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def test_create_version(turing_api, active_project, generic_router_config, gener
)

responses.add(
method="PUT",
method="POST",
url=f"/v1/projects/{active_project.id}/routers/{base_router.id}/versions",
body=json.dumps(generic_router_version, default=tests.json_serializer),
status=200,
Expand Down
12 changes: 6 additions & 6 deletions sdk/turing/generated/api/router_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,7 @@ def __projects_project_id_routers_router_id_versions_get(
callable=__projects_project_id_routers_router_id_versions_get
)

def __projects_project_id_routers_router_id_versions_put(
def __projects_project_id_routers_router_id_versions_post(
self,
project_id,
router_id,
Expand All @@ -1190,7 +1190,7 @@ def __projects_project_id_routers_router_id_versions_put(
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.projects_project_id_routers_router_id_versions_put(project_id, router_id, router_config, async_req=True)
>>> thread = api.projects_project_id_routers_router_id_versions_post(project_id, router_id, router_config, async_req=True)
>>> result = thread.get()
Args:
Expand Down Expand Up @@ -1251,13 +1251,13 @@ def __projects_project_id_routers_router_id_versions_put(
router_config
return self.call_with_http_info(**kwargs)

self.projects_project_id_routers_router_id_versions_put = _Endpoint(
self.projects_project_id_routers_router_id_versions_post = _Endpoint(
settings={
'response_type': (RouterVersion,),
'auth': [],
'endpoint_path': '/projects/{project_id}/routers/{router_id}/versions',
'operation_id': 'projects_project_id_routers_router_id_versions_put',
'http_method': 'PUT',
'operation_id': 'projects_project_id_routers_router_id_versions_post',
'http_method': 'POST',
'servers': None,
},
params_map={
Expand Down Expand Up @@ -1312,7 +1312,7 @@ def __projects_project_id_routers_router_id_versions_put(
]
},
api_client=api_client,
callable=__projects_project_id_routers_router_id_versions_put
callable=__projects_project_id_routers_router_id_versions_post
)

def __projects_project_id_routers_router_id_versions_version_delete(
Expand Down
2 changes: 1 addition & 1 deletion sdk/turing/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def list_router_versions(self, router_id: int) -> List[RouterVersion]:

@require_active_project
def create_router_version(self, router_id: int, router_config: RouterConfig) -> RouterVersion:
return RouterApi(self._api_client).projects_project_id_routers_router_id_versions_put(
return RouterApi(self._api_client).projects_project_id_routers_router_id_versions_post(
project_id=self.active_project.id,
router_id=router_id,
router_config=router_config
Expand Down
10 changes: 7 additions & 3 deletions ui/src/router/edit/EditRouterView.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const EditRouterView = ({ projectId, currentRouter, ...props }) => {
const [createRouterVersionResponse, createRouterVersionForm] = useTuringApi(
`/projects/${projectId}/routers/${currentRouter.id}/versions`,
{
method: "PUT",
method: "POST",
headers: { "Content-Type": "application/json" },
},
{},
Expand All @@ -54,7 +54,7 @@ const EditRouterView = ({ projectId, currentRouter, ...props }) => {
) {
addToast({
id: "submit-success-create-router-version",
title: "Router configuration is created!",
title: `Router version ${createRouterVersionResponse.data.version} is saved (but not deployed)!`,
color: "success",
iconType: "check",
});
Expand All @@ -79,7 +79,11 @@ const EditRouterView = ({ projectId, currentRouter, ...props }) => {

return (
<ConfirmationModal
title="Update Turing Router"
title={
withDeployment
? "Deploy Turing Router Version"
: "Save Turing Router Version"
}
content={
withDeployment ? (
<UpdateSummary router={routerConfig} />
Expand Down

0 comments on commit 44375ba

Please sign in to comment.