Summary
VpcPeeringHandler::create_vpc_peering (and the legacy ConnectivityHandler::create_vpc_peering) sends a request body whose JSON keys do not match the Redis Cloud spec. The API will reject or silently ignore fields.
Expected behavior
Per spec, POST /subscriptions/{subscriptionId}/peerings accepts a oneOf of AWS- or GCP-shaped bodies with the following keys:
- AWS:
region, awsAccountId, vpcId, vpcCidr, vpcCidrs
- GCP:
vpcProjectUid, vpcNetworkName
(Plus the provider discriminator.)
Actual behavior
src/connectivity/vpc_peering.rs:10-46 defines a single all-Optional struct that collapses both providers and uses the wrong field names:
```rust
pub struct VpcPeeringCreateRequest {
pub provider: String,
pub aws_region: Option, // → awsRegion (spec wants 'region')
pub aws_account_id: Option, // OK after camelCase
pub vpc_id: Option, // OK
pub vpc_cidr: Option, // OK
pub vpc_cidrs: Option<Vec>, // OK
pub gcp_project_id: Option, // → gcpProjectId (spec wants 'vpcProjectUid')
pub network_name: Option, // → networkName (spec wants 'vpcNetworkName')
}
```
With #[serde(rename_all = "camelCase")], the wire keys become the wrong names listed above.
Impact
VPC peering creation through the typed handler is broken on both AWS and GCP:
- AWS:
awsRegion is unknown to the API; region is missing → 400 from server.
- GCP:
gcpProjectId and networkName are unknown; vpcProjectUid and vpcNetworkName are missing → 400.
Also, the collapsed struct lets callers send mixed AWS+GCP fields the spec rejects.
Relevant code
src/connectivity/vpc_peering.rs:10-46
- Spec:
tests/fixtures/cloud_openapi.json — peerings POST → oneOf body schemas
Suggested fix
Either:
- Add
#[serde(rename = ...)] per field for the wire names that need it (region, vpcProjectUid, vpcNetworkName).
- Split into
AwsVpcPeeringCreateRequest / GcpVpcPeeringCreateRequest matching the spec's oneOf. Provide enum VpcPeeringCreateRequest { Aws(...), Gcp(...) } with #[serde(untagged)] or provider-discriminated.
Option 2 is preferred — closes the cross-provider field-mixing hole and makes intent explicit at the call site.
Acceptance criteria
References
Summary
VpcPeeringHandler::create_vpc_peering(and the legacyConnectivityHandler::create_vpc_peering) sends a request body whose JSON keys do not match the Redis Cloud spec. The API will reject or silently ignore fields.Expected behavior
Per spec,
POST /subscriptions/{subscriptionId}/peeringsaccepts aoneOfof AWS- or GCP-shaped bodies with the following keys:region,awsAccountId,vpcId,vpcCidr,vpcCidrsvpcProjectUid,vpcNetworkName(Plus the
providerdiscriminator.)Actual behavior
src/connectivity/vpc_peering.rs:10-46defines a single all-Optional struct that collapses both providers and uses the wrong field names:```rust
pub struct VpcPeeringCreateRequest {
pub provider: String,
pub aws_region: Option, // → awsRegion (spec wants 'region')
pub aws_account_id: Option, // OK after camelCase
pub vpc_id: Option, // OK
pub vpc_cidr: Option, // OK
pub vpc_cidrs: Option<Vec>, // OK
pub gcp_project_id: Option, // → gcpProjectId (spec wants 'vpcProjectUid')
pub network_name: Option, // → networkName (spec wants 'vpcNetworkName')
}
```
With
#[serde(rename_all = "camelCase")], the wire keys become the wrong names listed above.Impact
VPC peering creation through the typed handler is broken on both AWS and GCP:
awsRegionis unknown to the API;regionis missing → 400 from server.gcpProjectIdandnetworkNameare unknown;vpcProjectUidandvpcNetworkNameare missing → 400.Also, the collapsed struct lets callers send mixed AWS+GCP fields the spec rejects.
Relevant code
src/connectivity/vpc_peering.rs:10-46tests/fixtures/cloud_openapi.json—peeringsPOST →oneOfbody schemasSuggested fix
Either:
#[serde(rename = ...)]per field for the wire names that need it (region,vpcProjectUid,vpcNetworkName).AwsVpcPeeringCreateRequest/GcpVpcPeeringCreateRequestmatching the spec'soneOf. Provideenum VpcPeeringCreateRequest { Aws(...), Gcp(...) }with#[serde(untagged)]orprovider-discriminated.Option 2 is preferred — closes the cross-provider field-mixing hole and makes intent explicit at the call site.
Acceptance criteria
region,awsAccountId,vpcId,vpcCidr/vpcCidrs,provider: "aws"vpcProjectUid,vpcNetworkName,provider: "gcp"References