Cover all REST handlers with httptest-based tests using real SQLite: zones (list, get, create, update, delete), records (list, get, create, update, delete with validation/conflict cases), requireAdmin middleware (admin, non-admin, missing context), and utility functions (writeJSON, writeError, extractBearerToken, tokenInfoFromContext). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
67 lines
1.4 KiB
Protocol Buffer
67 lines
1.4 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package mcns.v1;
|
|
|
|
option go_package = "git.wntrmute.dev/kyle/mcns/gen/mcns/v1;mcnsv1";
|
|
|
|
import "google/protobuf/timestamp.proto";
|
|
|
|
// ZoneService manages DNS zones and their SOA parameters.
|
|
service ZoneService {
|
|
rpc ListZones(ListZonesRequest) returns (ListZonesResponse);
|
|
rpc CreateZone(CreateZoneRequest) returns (Zone);
|
|
rpc GetZone(GetZoneRequest) returns (Zone);
|
|
rpc UpdateZone(UpdateZoneRequest) returns (Zone);
|
|
rpc DeleteZone(DeleteZoneRequest) returns (DeleteZoneResponse);
|
|
}
|
|
|
|
message Zone {
|
|
int64 id = 1;
|
|
string name = 2;
|
|
string primary_ns = 3;
|
|
string admin_email = 4;
|
|
int32 refresh = 5;
|
|
int32 retry = 6;
|
|
int32 expire = 7;
|
|
int32 minimum_ttl = 8;
|
|
int64 serial = 9;
|
|
google.protobuf.Timestamp created_at = 10;
|
|
google.protobuf.Timestamp updated_at = 11;
|
|
}
|
|
|
|
message ListZonesRequest {}
|
|
|
|
message ListZonesResponse {
|
|
repeated Zone zones = 1;
|
|
}
|
|
|
|
message CreateZoneRequest {
|
|
string name = 1;
|
|
string primary_ns = 2;
|
|
string admin_email = 3;
|
|
int32 refresh = 4;
|
|
int32 retry = 5;
|
|
int32 expire = 6;
|
|
int32 minimum_ttl = 7;
|
|
}
|
|
|
|
message GetZoneRequest {
|
|
string name = 1;
|
|
}
|
|
|
|
message UpdateZoneRequest {
|
|
string name = 1;
|
|
string primary_ns = 2;
|
|
string admin_email = 3;
|
|
int32 refresh = 4;
|
|
int32 retry = 5;
|
|
int32 expire = 6;
|
|
int32 minimum_ttl = 7;
|
|
}
|
|
|
|
message DeleteZoneRequest {
|
|
string name = 1;
|
|
}
|
|
|
|
message DeleteZoneResponse {}
|