forked from StrafesNET/protobufs
Create Dedicated Validator Endpoints (#8)
### Replacing Maps Service `openapi-internal.yaml` With gRPC These are all the endpoints used by the validator. The plan is to delete `service_internal` and create `validator_controller` with equivalent gRPC functionality. This can then be extended in the future for public api & maptest integration by creating new grpc endpoints that the public api & game-rpc talk to. The gRPC extensions would be separate files (`mapfixes.proto`, `submissions.proto`, `maps.proto`) unlike `validator.proto` which has a bunch of dedicated endpoints that only the validator should use. ### Why? To reduce the number of exposed apis. Without this there would need to be 4 (!) exposed apis (validator openapi, web openapi, public api, gRPC for game-rpc), with it, only 2 (web api, gRPC). ### Why didn't you do this in the first place? I didn't know how. I think I have a handle on it now. Reviewed-on: StrafesNET/protobufs#8 Co-authored-by: Rhys Lloyd <krakow20@gmail.com> Co-committed-by: Rhys Lloyd <krakow20@gmail.com>
This commit is contained in:
183
validator.proto
Normal file
183
validator.proto
Normal file
@@ -0,0 +1,183 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = "git.itzana.me/strafesnet/go-grpc/validator";
|
||||
|
||||
package validator;
|
||||
|
||||
service ValidatorMapfixService {
|
||||
rpc Create(MapfixCreate) returns (NullResponse);
|
||||
rpc CreateAuditError(AuditErrorRequest) returns (NullResponse);
|
||||
rpc CreateAuditChecklist(AuditChecklistRequest) returns (NullResponse);
|
||||
rpc SetValidatedModel(ValidatedModelRequest) returns (NullResponse);
|
||||
rpc SetStatusSubmitted(SubmittedRequest) returns (NullResponse);
|
||||
rpc SetStatusRequestChanges(MapFixID) returns (NullResponse);
|
||||
rpc SetStatusValidated(MapFixID) returns (NullResponse);
|
||||
rpc SetStatusFailed(MapFixID) returns (NullResponse);
|
||||
rpc SetStatusUploaded(MapFixID) returns (NullResponse);
|
||||
}
|
||||
|
||||
service ValidatorSubmissionService {
|
||||
rpc Create(SubmissionCreate) returns (NullResponse);
|
||||
rpc CreateAuditError(AuditErrorRequest) returns (NullResponse);
|
||||
rpc CreateAuditChecklist(AuditChecklistRequest) returns (NullResponse);
|
||||
rpc SetValidatedModel(ValidatedModelRequest) returns (NullResponse);
|
||||
rpc SetStatusSubmitted(SubmittedRequest) returns (NullResponse);
|
||||
rpc SetStatusRequestChanges(SubmissionID) returns (NullResponse);
|
||||
rpc SetStatusValidated(SubmissionID) returns (NullResponse);
|
||||
rpc SetStatusFailed(SubmissionID) returns (NullResponse);
|
||||
rpc SetStatusUploaded(SubmissionID) returns (NullResponse);
|
||||
}
|
||||
|
||||
message MapFixID { uint64 ID = 1; }
|
||||
|
||||
message MapfixCreate {
|
||||
uint32 OperationID = 1;
|
||||
uint32 GameID = 2;
|
||||
uint64 AssetOwner = 3;
|
||||
uint64 AssetID = 4;
|
||||
uint64 AssetVersion = 5;
|
||||
uint64 TargetAssetID = 6;
|
||||
string DisplayName = 7;
|
||||
string Creator = 8;
|
||||
string Description = 9;
|
||||
}
|
||||
|
||||
message SubmissionID { uint64 ID = 1; }
|
||||
|
||||
message SubmissionCreate {
|
||||
uint32 OperationID = 1;
|
||||
uint32 GameID = 2;
|
||||
uint32 Status = 3;
|
||||
uint32 Roles = 4;
|
||||
uint64 AssetOwner = 5;
|
||||
uint64 AssetID = 6;
|
||||
uint64 AssetVersion = 7;
|
||||
string DisplayName = 8;
|
||||
string Creator = 9;
|
||||
}
|
||||
|
||||
message AuditErrorRequest {
|
||||
uint64 ID = 1;
|
||||
string ErrorMessage = 2;
|
||||
}
|
||||
message Check {
|
||||
string Name = 1;
|
||||
string Summary = 2;
|
||||
bool Passed = 3;
|
||||
}
|
||||
message AuditChecklistRequest {
|
||||
uint64 ID = 1;
|
||||
repeated Check CheckList = 2;
|
||||
}
|
||||
|
||||
message ValidatedModelRequest {
|
||||
uint64 ID = 1;
|
||||
uint64 ValidatedModelID = 2;
|
||||
uint64 ValidatedModelVersion = 3;
|
||||
}
|
||||
|
||||
message SubmittedRequest {
|
||||
uint64 ID = 1;
|
||||
uint64 ModelVersion = 2;
|
||||
string DisplayName = 3;
|
||||
string Creator = 4;
|
||||
uint32 GameID = 5;
|
||||
}
|
||||
|
||||
message NullResponse {}
|
||||
|
||||
// Operations
|
||||
service ValidatorOperationService {
|
||||
rpc Fail(OperationFailRequest) returns (NullResponse);
|
||||
}
|
||||
|
||||
message OperationFailRequest {
|
||||
uint32 OperationID = 1;
|
||||
string StatusMessage = 2;
|
||||
}
|
||||
|
||||
message Pagination {
|
||||
uint32 Size = 1;
|
||||
uint32 Number = 2;
|
||||
}
|
||||
|
||||
// Scripts
|
||||
service ValidatorScriptService {
|
||||
rpc Create(ScriptCreate) returns (ScriptID);
|
||||
rpc Get(ScriptID) returns (Script);
|
||||
rpc List(ScriptListRequest) returns (ScriptListResponse);
|
||||
}
|
||||
|
||||
message ScriptCreate {
|
||||
string Name = 1;
|
||||
string Source = 2;
|
||||
uint32 ResourceType = 3;
|
||||
optional uint64 ResourceID = 4;
|
||||
}
|
||||
|
||||
message ScriptFilter {
|
||||
optional string Name = 1;
|
||||
optional string Source = 2;
|
||||
optional uint32 ResourceType = 3;
|
||||
optional uint64 ResourceID = 4;
|
||||
}
|
||||
|
||||
message ScriptListRequest {
|
||||
ScriptFilter Filter = 1;
|
||||
Pagination Page = 2;
|
||||
}
|
||||
|
||||
message ScriptID { uint64 ID = 1; }
|
||||
|
||||
message Script {
|
||||
uint64 ID = 1;
|
||||
uint64 Hash = 2;
|
||||
string Name = 3;
|
||||
string Source = 4;
|
||||
uint32 ResourceType = 5;
|
||||
optional uint64 ResourceID = 6;
|
||||
}
|
||||
|
||||
message ScriptListResponse { repeated Script Scripts = 1; }
|
||||
|
||||
// ScriptPolicies
|
||||
service ValidatorScriptPolicyService {
|
||||
rpc Create(ScriptPolicyCreate) returns (ScriptPolicyID);
|
||||
rpc List(ScriptPolicyListRequest) returns (ScriptPolicyListResponse);
|
||||
}
|
||||
|
||||
enum Policy {
|
||||
None = 0;
|
||||
Allowed = 1;
|
||||
Blocked = 2;
|
||||
Delete = 3;
|
||||
Replace = 4;
|
||||
}
|
||||
|
||||
message ScriptPolicyCreate {
|
||||
uint64 FromScriptID = 1;
|
||||
uint64 ToScriptID = 2;
|
||||
Policy Policy = 3;
|
||||
}
|
||||
|
||||
message ScriptPolicyFilter {
|
||||
optional uint64 FromScriptHash = 1;
|
||||
optional uint64 ToScriptID = 2;
|
||||
optional Policy Policy = 3;
|
||||
}
|
||||
|
||||
message ScriptPolicyListRequest {
|
||||
ScriptPolicyFilter Filter = 1;
|
||||
Pagination Page = 2;
|
||||
}
|
||||
|
||||
message ScriptPolicyID { uint64 ID = 1; }
|
||||
|
||||
message ScriptPolicy {
|
||||
uint64 ID = 1;
|
||||
uint64 FromScriptHash = 2;
|
||||
uint64 ToScriptID = 3;
|
||||
Policy Policy = 4;
|
||||
}
|
||||
|
||||
message ScriptPolicyListResponse { repeated ScriptPolicy ScriptPolicies = 1; }
|
||||
Reference in New Issue
Block a user