Skip to content

Commit 2dcf896

Browse files
authored
Fix IP address create on Internet Gateway (#6799)
During testing we observed an issue with IGW pool linking on the CLI where the error 'gateway was not initialized' cropped up. As it turns out, this was down to a duplicated (and unnecessary) gateway parameter in both the query string and the request body. We had missed this on IP address create for individual IP address creation/linking. This PR quickly removes this parameter from `InternetGatewayIpAddressCreate`, and fixes some copy-paste description mismatches for the same APIs.
1 parent e974959 commit 2dcf896

File tree

5 files changed

+4
-12
lines changed

5 files changed

+4
-12
lines changed

nexus/external-api/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2313,7 +2313,7 @@ pub trait NexusExternalApi {
23132313
HttpError,
23142314
>;
23152315

2316-
/// Attach IP pool to internet gateway
2316+
/// Attach IP address to internet gateway
23172317
#[endpoint {
23182318
method = POST,
23192319
path = "/v1/internet-gateway-ip-addresses",
@@ -2325,7 +2325,7 @@ pub trait NexusExternalApi {
23252325
create_params: TypedBody<params::InternetGatewayIpAddressCreate>,
23262326
) -> Result<HttpResponseCreated<views::InternetGatewayIpAddress>, HttpError>;
23272327

2328-
/// Detach IP pool from internet gateway
2328+
/// Detach IP address from internet gateway
23292329
#[endpoint {
23302330
method = DELETE,
23312331
path = "/v1/internet-gateway-ip-addresses/{address}",

nexus/test-utils/src/resource_helpers.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,6 @@ pub async fn attach_ip_address_to_igw(
861861
project_name, vpc_name, igw_name,
862862
);
863863

864-
let gateway: Name = igw_name.parse().unwrap();
865864
NexusRequest::objects_post(
866865
&client,
867866
url.as_str(),
@@ -870,7 +869,6 @@ pub async fn attach_ip_address_to_igw(
870869
name: attachment_name.parse().unwrap(),
871870
description: String::from("attached pool descriptoion"),
872871
},
873-
gateway: NameOrId::Name(gateway),
874872
address,
875873
},
876874
)

nexus/tests/integration_tests/endpoints.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,6 @@ pub static DEMO_INTERNET_GATEWAY_IP_ADDRESS_CREATE: Lazy<
291291
name: DEMO_INTERNET_GATEWAY_NAME.clone(),
292292
description: String::from(""),
293293
},
294-
gateway: NameOrId::Id(uuid::Uuid::new_v4()),
295294
address: IpAddr::V4(Ipv4Addr::UNSPECIFIED),
296295
});
297296
pub static DEMO_INTERNET_GATEWAY_IP_POOLS_URL: Lazy<String> = Lazy::new(|| {

nexus/types/src/external_api/params.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1394,7 +1394,6 @@ pub struct InternetGatewayIpPoolCreate {
13941394
pub struct InternetGatewayIpAddressCreate {
13951395
#[serde(flatten)]
13961396
pub identity: IdentityMetadataCreateParams,
1397-
pub gateway: NameOrId,
13981397
pub address: IpAddr,
13991398
}
14001399

openapi/nexus.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2764,7 +2764,7 @@
27642764
"tags": [
27652765
"vpcs"
27662766
],
2767-
"summary": "Attach IP pool to internet gateway",
2767+
"summary": "Attach IP address to internet gateway",
27682768
"operationId": "internet_gateway_ip_address_create",
27692769
"parameters": [
27702770
{
@@ -2828,7 +2828,7 @@
28282828
"tags": [
28292829
"vpcs"
28302830
],
2831-
"summary": "Detach IP pool from internet gateway",
2831+
"summary": "Detach IP address from internet gateway",
28322832
"operationId": "internet_gateway_ip_address_delete",
28332833
"parameters": [
28342834
{
@@ -16619,17 +16619,13 @@
1661916619
"description": {
1662016620
"type": "string"
1662116621
},
16622-
"gateway": {
16623-
"$ref": "#/components/schemas/NameOrId"
16624-
},
1662516622
"name": {
1662616623
"$ref": "#/components/schemas/Name"
1662716624
}
1662816625
},
1662916626
"required": [
1663016627
"address",
1663116628
"description",
16632-
"gateway",
1663316629
"name"
1663416630
]
1663516631
},

0 commit comments

Comments
 (0)