Skip to content

Commit

Permalink
chores
Browse files Browse the repository at this point in the history
  • Loading branch information
rcgoodfellow committed Aug 30, 2024
1 parent 9f110e2 commit f209542
Show file tree
Hide file tree
Showing 10 changed files with 446 additions and 259 deletions.
3 changes: 2 additions & 1 deletion nexus/db-model/src/schema_versions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::collections::BTreeMap;
///
/// This must be updated when you change the database schema. Refer to
/// schema/crdb/README.adoc in the root of this repository for details.
pub const SCHEMA_VERSION: SemverVersion = SemverVersion::new(93, 0, 0);
pub const SCHEMA_VERSION: SemverVersion = SemverVersion::new(94, 0, 0);

/// List of all past database schema versions, in *reverse* order
///
Expand All @@ -29,6 +29,7 @@ static KNOWN_VERSIONS: Lazy<Vec<KnownVersion>> = Lazy::new(|| {
// | leaving the first copy as an example for the next person.
// v
// KnownVersion::new(next_int, "unique-dirname-with-the-sql-files"),
KnownVersion::new(94, "internet-gateway"),
KnownVersion::new(93, "dataset-kinds-zone-and-debug"),
KnownVersion::new(92, "lldp-link-config-nullable"),
KnownVersion::new(91, "add-management-gateway-producer-kind"),
Expand Down
8 changes: 4 additions & 4 deletions nexus/external-api/output/nexus_tags.txt
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,11 @@ API operations found with tag "vpcs"
OPERATION ID METHOD URL PATH
internet_gateway_create POST /v1/internet-gateways
internet_gateway_delete DELETE /v1/internet-gateways/{gateway}
internet_gateway_ip_address_create POST /v1/vpc-internet-gateway-ip-addrs
internet_gateway_ip_address_delete DELETE /v1/vpc-internet-gateway-ip-addrs/{address}
internet_gateway_ip_address_create POST /v1/internet-gateway-ip-addrs
internet_gateway_ip_address_delete DELETE /v1/internet-gateway-ip-addrs/{address}
internet_gateway_ip_address_list GET /v1/internet-gateway-ip-addrs
internet_gateway_ip_pool_create POST /v1/vpc-internet-gateway-ip-pools
internet_gateway_ip_pool_delete DELETE /v1/vpc-internet-gateway-ip-pools/{pool}
internet_gateway_ip_pool_create POST /v1/internet-gateway-ip-pools
internet_gateway_ip_pool_delete DELETE /v1/internet-gateway-ip-pools/{pool}
internet_gateway_ip_pool_list GET /v1/internet-gateway-ip-pools
internet_gateway_list GET /v1/internet-gateways
internet_gateway_view GET /v1/internet-gateways/{gateway}
Expand Down
8 changes: 4 additions & 4 deletions nexus/external-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2259,7 +2259,7 @@ pub trait NexusExternalApi {
/// Attach ip pool to internet gateway
#[endpoint {
method = POST,
path = "/v1/vpc-internet-gateway-ip-pools",
path = "/v1/internet-gateway-ip-pools",
tags = ["vpcs"],
}]
async fn internet_gateway_ip_pool_create(
Expand All @@ -2271,7 +2271,7 @@ pub trait NexusExternalApi {
/// Detach ip pool from internet gateway
#[endpoint {
method = DELETE,
path = "/v1/vpc-internet-gateway-ip-pools/{pool}",
path = "/v1/internet-gateway-ip-pools/{pool}",
tags = ["vpcs"],
}]
async fn internet_gateway_ip_pool_delete(
Expand Down Expand Up @@ -2299,7 +2299,7 @@ pub trait NexusExternalApi {
/// Attach ip pool to internet gateway
#[endpoint {
method = POST,
path = "/v1/vpc-internet-gateway-ip-addrs",
path = "/v1/internet-gateway-ip-addrs",
tags = ["vpcs"],
}]
async fn internet_gateway_ip_address_create(
Expand All @@ -2311,7 +2311,7 @@ pub trait NexusExternalApi {
/// Detach ip pool from internet gateway
#[endpoint {
method = DELETE,
path = "/v1/vpc-internet-gateway-ip-addrs/{address}",
path = "/v1/internet-gateway-ip-addrs/{address}",
tags = ["vpcs"],
}]
async fn internet_gateway_ip_address_delete(
Expand Down
143 changes: 143 additions & 0 deletions nexus/tests/integration_tests/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,83 @@ pub static DEMO_ROUTER_ROUTE_CREATE: Lazy<params::RouterRouteCreate> =
destination: RouteDestination::Subnet("loopback".parse().unwrap()),
});

// Internet Gateway used for testing
pub static DEMO_INTERNET_GATEWAY_NAME: Lazy<Name> =
Lazy::new(|| "demo-internet-gateway".parse().unwrap());
pub static DEMO_INTERNET_GATEWAYS_URL: Lazy<String> = Lazy::new(|| {
format!(
"/v1/internet-gateways?project={}&vpc={}",
*DEMO_PROJECT_NAME, *DEMO_VPC_NAME
)
});
pub static DEMO_INTERNET_GATEWAY_URL: Lazy<String> = Lazy::new(|| {
format!(
"/v1/internet-gateways/{}?project={}&vpc={}",
*DEMO_INTERNET_GATEWAY_NAME, *DEMO_PROJECT_NAME, *DEMO_VPC_NAME
)
});
pub static DEMO_INTERNET_GATEWAY_CREATE: Lazy<params::InternetGatewayCreate> =
Lazy::new(|| params::InternetGatewayCreate {
identity: IdentityMetadataCreateParams {
name: DEMO_INTERNET_GATEWAY_NAME.clone(),
description: String::from(""),
},
});
pub static DEMO_INTERNET_GATEWAY_IP_POOL_CREATE: Lazy<
params::InternetGatewayIpPoolCreate,
> = Lazy::new(|| params::InternetGatewayIpPoolCreate {
identity: IdentityMetadataCreateParams {
name: DEMO_INTERNET_GATEWAY_NAME.clone(),
description: String::from(""),
},
ip_pool_id: uuid::Uuid::new_v4(),
gateway_id: uuid::Uuid::new_v4(),
});
pub static DEMO_INTERNET_GATEWAY_IP_ADDRESS_CREATE: Lazy<
params::InternetGatewayIpAddressCreate,
> = Lazy::new(|| params::InternetGatewayIpAddressCreate {
identity: IdentityMetadataCreateParams {
name: DEMO_INTERNET_GATEWAY_NAME.clone(),
description: String::from(""),
},
gateway_id: uuid::Uuid::new_v4(),
address: IpAddr::V4(Ipv4Addr::UNSPECIFIED),
});
pub static DEMO_INTERNET_GATEWAY_IP_POOLS_URL: Lazy<String> = Lazy::new(|| {
format!(
"/v1/internet-gateway-ip-pools?project={}&vpc={}&gateway={}",
*DEMO_PROJECT_NAME, *DEMO_VPC_NAME, *DEMO_INTERNET_GATEWAY_NAME,
)
});
pub static DEMO_INTERNET_GATEWAY_IP_ADDRS_URL: Lazy<String> = Lazy::new(|| {
format!(
"/v1/internet-gateway-ip-addrs?project={}&vpc={}&gateway={}",
*DEMO_PROJECT_NAME, *DEMO_VPC_NAME, *DEMO_INTERNET_GATEWAY_NAME,
)
});
pub static DEMO_INTERNET_GATEWAY_IP_POOL_NAME: Lazy<Name> =
Lazy::new(|| "demo-igw-pool".parse().unwrap());
pub static DEMO_INTERNET_GATEWAY_IP_ADDRESS_NAME: Lazy<Name> =
Lazy::new(|| "demo-igw-address".parse().unwrap());
pub static DEMO_INTERNET_GATEWAY_IP_POOL_URL: Lazy<String> = Lazy::new(|| {
format!(
"/v1/internet-gateway-ip-pools/{}?project={}&vpc={}&gateway={}",
*DEMO_INTERNET_GATEWAY_IP_POOL_NAME,
*DEMO_PROJECT_NAME,
*DEMO_VPC_NAME,
*DEMO_INTERNET_GATEWAY_NAME,
)
});
pub static DEMO_INTERNET_GATEWAY_IP_ADDR_URL: Lazy<String> = Lazy::new(|| {
format!(
"/v1/internet-gateway-ip-addrs/{}?project={}&vpc={}&gateway={}",
*DEMO_INTERNET_GATEWAY_IP_ADDRESS_NAME,
*DEMO_PROJECT_NAME,
*DEMO_VPC_NAME,
*DEMO_INTERNET_GATEWAY_NAME,
)
});

// Disk used for testing
pub static DEMO_DISK_NAME: Lazy<Name> =
Lazy::new(|| "demo-disk".parse().unwrap());
Expand Down Expand Up @@ -1602,6 +1679,72 @@ pub static VERIFY_ENDPOINTS: Lazy<Vec<VerifyEndpoint>> = Lazy::new(|| {
],
},

/* Internet Gateways */

VerifyEndpoint {
url: &DEMO_INTERNET_GATEWAYS_URL,
visibility: Visibility::Protected,
unprivileged_access: UnprivilegedAccess::None,
allowed_methods: vec![
AllowedMethod::GetNonexistent,
AllowedMethod::Post(
serde_json::to_value(&*DEMO_INTERNET_GATEWAY_CREATE).unwrap()
),
],
},

VerifyEndpoint {
url: &DEMO_INTERNET_GATEWAY_URL,
visibility: Visibility::Protected,
unprivileged_access: UnprivilegedAccess::None,
allowed_methods: vec![
AllowedMethod::GetNonexistent,
AllowedMethod::Delete,
],
},

VerifyEndpoint {
url: &DEMO_INTERNET_GATEWAY_IP_POOLS_URL,
visibility: Visibility::Protected,
unprivileged_access: UnprivilegedAccess::None,
allowed_methods: vec![
AllowedMethod::GetNonexistent,
AllowedMethod::Post(
serde_json::to_value(&*DEMO_INTERNET_GATEWAY_IP_POOL_CREATE).unwrap()
),
],
},

VerifyEndpoint {
url: &DEMO_INTERNET_GATEWAY_IP_POOL_URL,
visibility: Visibility::Protected,
unprivileged_access: UnprivilegedAccess::None,
allowed_methods: vec![
AllowedMethod::Delete,
],
},

VerifyEndpoint {
url: &DEMO_INTERNET_GATEWAY_IP_ADDRS_URL,
visibility: Visibility::Protected,
unprivileged_access: UnprivilegedAccess::None,
allowed_methods: vec![
AllowedMethod::GetNonexistent,
AllowedMethod::Post(
serde_json::to_value(&*DEMO_INTERNET_GATEWAY_IP_ADDRESS_CREATE).unwrap()
),
],
},

VerifyEndpoint {
url: &DEMO_INTERNET_GATEWAY_IP_ADDR_URL,
visibility: Visibility::Protected,
unprivileged_access: UnprivilegedAccess::None,
allowed_methods: vec![
AllowedMethod::Delete,
],
},

/* Disks */

VerifyEndpoint {
Expand Down
Loading

0 comments on commit f209542

Please sign in to comment.