diff --git a/end-to-end-tests/src/bin/commtest.rs b/end-to-end-tests/src/bin/commtest.rs index a2e46391025..f883bd9e388 100644 --- a/end-to-end-tests/src/bin/commtest.rs +++ b/end-to-end-tests/src/bin/commtest.rs @@ -280,37 +280,37 @@ async fn rack_prepare( })?; let pool_name = "default"; - api_retry!( - if let Err(e) = oxide.ip_pool_view().pool("default").send().await { - if let Some(reqwest::StatusCode::NOT_FOUND) = e.status() { - print!("default ip pool does not exist, creating ..."); - oxide - .ip_pool_create() - .body(IpPoolCreate { - name: pool_name.parse().unwrap(), - description: "Default IP pool".to_string(), - }) - .send() - .await?; - oxide - .ip_pool_silo_link() - .pool(pool_name) - .body(IpPoolLinkSilo { - silo: NameOrId::Name("recovery".parse().unwrap()), - is_default: true, - }) - .send() - .await?; - println!("done"); - Ok(()) - } else { - Err(e) - } - } else { - println!("default ip pool already exists"); + api_retry!(if let Err(e) = + oxide.system_ip_pool_view().pool("default").send().await + { + if let Some(reqwest::StatusCode::NOT_FOUND) = e.status() { + print!("default ip pool does not exist, creating ..."); + oxide + .ip_pool_create() + .body(IpPoolCreate { + name: pool_name.parse().unwrap(), + description: "Default IP pool".to_string(), + }) + .send() + .await?; + oxide + .ip_pool_silo_link() + .pool(pool_name) + .body(IpPoolLinkSilo { + silo: NameOrId::Name("recovery".parse().unwrap()), + is_default: true, + }) + .send() + .await?; + println!("done"); Ok(()) + } else { + Err(e) } - )?; + } else { + println!("default ip pool already exists"); + Ok(()) + })?; let pool = api_retry!( oxide diff --git a/nexus/external-api/output/nexus_tags.txt b/nexus/external-api/output/nexus_tags.txt index 19a1876ec69..edd0928b704 100644 --- a/nexus/external-api/output/nexus_tags.txt +++ b/nexus/external-api/output/nexus_tags.txt @@ -134,10 +134,10 @@ system_policy_view GET /v1/system/policy API operations found with tag "projects" OPERATION ID METHOD URL PATH +ip_pool_list GET /v1/ip-pools +ip_pool_view GET /v1/ip-pools/{pool} project_create POST /v1/projects project_delete DELETE /v1/projects/{project} -project_ip_pool_list GET /v1/ip-pools -project_ip_pool_view GET /v1/ip-pools/{pool} project_list GET /v1/projects project_policy_update PUT /v1/projects/{project}/policy project_policy_view GET /v1/projects/{project}/policy @@ -215,7 +215,6 @@ API operations found with tag "system/ip-pools" OPERATION ID METHOD URL PATH ip_pool_create POST /v1/system/ip-pools ip_pool_delete DELETE /v1/system/ip-pools/{pool} -ip_pool_list GET /v1/system/ip-pools ip_pool_range_add POST /v1/system/ip-pools/{pool}/ranges/add ip_pool_range_list GET /v1/system/ip-pools/{pool}/ranges ip_pool_range_remove POST /v1/system/ip-pools/{pool}/ranges/remove @@ -229,7 +228,8 @@ ip_pool_silo_unlink DELETE /v1/system/ip-pools/{pool}/sil ip_pool_silo_update PUT /v1/system/ip-pools/{pool}/silos/{silo} ip_pool_update PUT /v1/system/ip-pools/{pool} ip_pool_utilization_view GET /v1/system/ip-pools/{pool}/utilization -ip_pool_view GET /v1/system/ip-pools/{pool} +system_ip_pool_list GET /v1/system/ip-pools +system_ip_pool_view GET /v1/system/ip-pools/{pool} API operations found with tag "system/metrics" OPERATION ID METHOD URL PATH diff --git a/nexus/external-api/src/lib.rs b/nexus/external-api/src/lib.rs index 38dc5894458..2ef323708d7 100644 --- a/nexus/external-api/src/lib.rs +++ b/nexus/external-api/src/lib.rs @@ -669,12 +669,14 @@ pub trait NexusExternalApi { // IP Pools /// List IP pools + /// + /// For the current silo. #[endpoint { method = GET, path = "/v1/ip-pools", tags = ["projects"], }] - async fn project_ip_pool_list( + async fn ip_pool_list( rqctx: RequestContext, query_params: Query, ) -> Result>, HttpError>; @@ -685,18 +687,20 @@ pub trait NexusExternalApi { path = "/v1/ip-pools/{pool}", tags = ["projects"], }] - async fn project_ip_pool_view( + async fn ip_pool_view( rqctx: RequestContext, path_params: Path, ) -> Result, HttpError>; /// List IP pools + /// + /// List all IP pools regardless of silo links. #[endpoint { method = GET, path = "/v1/system/ip-pools", tags = ["system/ip-pools"], }] - async fn ip_pool_list( + async fn system_ip_pool_list( rqctx: RequestContext, query_params: Query, ) -> Result>, HttpError>; @@ -718,7 +722,7 @@ pub trait NexusExternalApi { path = "/v1/system/ip-pools/{pool}", tags = ["system/ip-pools"], }] - async fn ip_pool_view( + async fn system_ip_pool_view( rqctx: RequestContext, path_params: Path, ) -> Result, HttpError>; diff --git a/nexus/src/external_api/http_entrypoints.rs b/nexus/src/external_api/http_entrypoints.rs index be75d2a3e90..37cbd20a7e7 100644 --- a/nexus/src/external_api/http_entrypoints.rs +++ b/nexus/src/external_api/http_entrypoints.rs @@ -1093,7 +1093,7 @@ impl NexusExternalApi for NexusExternalApiImpl { // IP Pools - async fn project_ip_pool_list( + async fn ip_pool_list( rqctx: RequestContext, query_params: Query, ) -> Result>, HttpError> { @@ -1128,7 +1128,7 @@ impl NexusExternalApi for NexusExternalApiImpl { .await } - async fn project_ip_pool_view( + async fn ip_pool_view( rqctx: RequestContext, path_params: Path, ) -> Result, HttpError> { @@ -1152,7 +1152,7 @@ impl NexusExternalApi for NexusExternalApiImpl { .await } - async fn ip_pool_list( + async fn system_ip_pool_list( rqctx: RequestContext, query_params: Query, ) -> Result>, HttpError> { @@ -1204,7 +1204,7 @@ impl NexusExternalApi for NexusExternalApiImpl { .await } - async fn ip_pool_view( + async fn system_ip_pool_view( rqctx: RequestContext, path_params: Path, ) -> Result, HttpError> { diff --git a/openapi/nexus.json b/openapi/nexus.json index 816f81a61d1..89955c1ee00 100644 --- a/openapi/nexus.json +++ b/openapi/nexus.json @@ -5286,7 +5286,8 @@ "projects" ], "summary": "List IP pools", - "operationId": "project_ip_pool_list", + "description": "For the current silo.", + "operationId": "ip_pool_list", "parameters": [ { "in": "query", @@ -5345,7 +5346,7 @@ "projects" ], "summary": "Fetch IP pool", - "operationId": "project_ip_pool_view", + "operationId": "ip_pool_view", "parameters": [ { "in": "path", @@ -8247,7 +8248,8 @@ "system/ip-pools" ], "summary": "List IP pools", - "operationId": "ip_pool_list", + "description": "List all IP pools regardless of silo.", + "operationId": "system_ip_pool_list", "parameters": [ { "in": "query", @@ -8341,7 +8343,7 @@ "system/ip-pools" ], "summary": "Fetch IP pool", - "operationId": "ip_pool_view", + "operationId": "system_ip_pool_view", "parameters": [ { "in": "path",