:query server_id: The name of the server
-.. http:get:: /api/v1/servers/:server_id/ottraceconditions/:subnet
+.. http:get:: /api/v1/servers/:server_id/ottraceconditions/:ip/:prefixlen
Returns trace condition information.
:query server_id: The name of the server
- :query subnet: The subnet of the :json:object:`OpenTelemetryTraceCondition`. URL encode subnet, for example ``192.0.2.1/32`` becomes ``192.0.2.1%2F32``.
+ :query ip/prefixlen: The subnet of the :json:object:`OpenTelemetryTraceCondition`.
-.. http:delete:: /api/v1/servers/:server_id/ottraceconditions/:subnet
+.. http:delete:: /api/v1/servers/:server_id/ottraceconditions/:ip/:prefixlen
Deletes this zone, all attached metadata and rrsets.
:query server_id: The name of the server
- :query subnet: The subnet of the :json:object:`OpenTelemetryTraceCondition`. URL encode subnet, for example ``192.0.2.1/32`` becomes ``192.0.2.1%2F32``.
+ :query ip/prefixlen: The subnet of the :json:object:`OpenTelemetryTraceCondition`.
(&Method::GET, ["api", "v1", "servers", "localhost", "ottraceconditions"]) => {
*apifunc = Some(rustweb::apiServerOTConditionsGET);
}
- (&Method::GET, ["api", "v1", "servers", "localhost", "ottraceconditions", acl]) => {
- let decoded = form_urlencoded::parse(acl.as_bytes());
- // decoded should contain a single key without value
- if let Some(kv) = decoded.last() {
- request.parameters.push(rustweb::KeyValue {
- key: String::from("acl"),
- value: kv.0.to_string(),
- });
- }
+ (&Method::GET, ["api", "v1", "servers", "localhost", "ottraceconditions", ip, pflen]) => {
+ request.parameters.push(rustweb::KeyValue {
+ key: String::from("acl"),
+ value: String::from(*ip) + "/" + *pflen,
+ });
*apifunc = Some(rustweb::apiServerOTConditionDetailGET)
}
- (&Method::DELETE, ["api", "v1", "servers", "localhost", "ottraceconditions", acl]) => {
- let decoded = form_urlencoded::parse(acl.as_bytes());
- // decoded should contain a single key without value
- if let Some(kv) = decoded.last() {
- request.parameters.push(rustweb::KeyValue {
- key: String::from("acl"),
- value: kv.0.to_string(),
- });
- }
+ (&Method::DELETE, ["api", "v1", "servers", "localhost", "ottraceconditions", ip, pflen]) => {
+ request.parameters.push(rustweb::KeyValue {
+ key: String::from("acl"),
+ value: String::from(*ip) + "/" + *pflen,
+ });
*apifunc = Some(rustweb::apiServerOTConditionDetailDELETE)
}
(&Method::POST, ["api", "v1", "servers", "localhost", "ottraceconditions"]) => {
# nonexistent condition
r = self.session.get(
- self.url("/api/v1/servers/localhost/ottraceconditions/1.2.3.4%2F32"),
+ self.url("/api/v1/servers/localhost/ottraceconditions/1.2.3.4/32"),
headers={'content-type': 'application/json'})
self.assertEqual(r.status_code, 422)
self.assert_in_json_error('Could not find otcondition', r.json())
# malformed netmask
r = self.session.get(
- self.url("/api/v1/servers/localhost/ottraceconditions/1.2.3%2F32"),
+ self.url("/api/v1/servers/localhost/ottraceconditions/1.2.3/32"),
headers={'content-type': 'application/json'})
self.assertEqual(r.status_code, 422)
self.assert_in_json_error('Could not parse netmask', r.json())
# deleting non-existent netmask
r = self.session.delete(
- self.url("/api/v1/servers/localhost/ottraceconditions/1.2.3.4%2F32"),
+ self.url("/api/v1/servers/localhost/ottraceconditions/1.2.3.4/32"),
headers={'content-type': 'application/json'})
self.assertEqual(r.status_code, 422)
self.assert_in_json_error('Could not find otcondition', r.json())
self.assertEqual(r.status_code, 200)
self.assertEqual(len(r.json()), 2)
- # querying by more specific key
+ # querying by more specific key than /24
r = self.session.get(
- self.url("/api/v1/servers/localhost/ottraceconditions/1.2.3.4%2F31"),
+ self.url("/api/v1/servers/localhost/ottraceconditions/1.2.3.4/31"),
headers={'content-type': 'application/json'})
self.assertEqual(r.status_code, 422)
self.assert_in_json_error('Could not find otcondition', r.json())
# deleting specific netmask
r = self.session.delete(
- self.url("/api/v1/servers/localhost/ottraceconditions/1.2.3.4%2F32"),
+ self.url("/api/v1/servers/localhost/ottraceconditions/1.2.3.4/32"),
headers={'content-type': 'application/json'})
self.assertEqual(r.status_code, 204)
# and GET the newly created one in a separate call
r = self.session.get(
- self.url("/api/v1/servers/localhost/ottraceconditions/::1%2F0"),
+ self.url("/api/v1/servers/localhost/ottraceconditions/::/0"),
headers={'content-type': 'application/json'})
self.assertEqual(r.status_code, 200)
data = r.json()