Public Access
201 lines
6.4 KiB
Protocol Buffer
201 lines
6.4 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package charybdis.entities;
|
|
|
|
import "google/protobuf/timestamp.proto";
|
|
import "google/protobuf/field_mask.proto";
|
|
import "core/service.proto";
|
|
import "core/system.proto";
|
|
import "core/component.proto";
|
|
import "core/api.proto";
|
|
import "core/user.proto";
|
|
import "core/group.proto";
|
|
import "core/domain.proto";
|
|
import "core/resource.proto";
|
|
import "core/finding.proto";
|
|
|
|
// Plugin imports will be inserted here by build.rs
|
|
import "plugins/defectdojo/proto/defectdojo.proto";
|
|
import "plugins/keycloak/proto/keycloak.proto";
|
|
import "plugins/dependencytrack/proto/dependencytrack.proto";
|
|
|
|
|
|
// GENERATED FILE - DO NOT EDIT MANUALLY
|
|
// This file is generated by build.rs based on plugins.toml configuration
|
|
// To add new entity types, configure plugins in plugins.toml and rebuild
|
|
|
|
// Main entity structure
|
|
// This represents any cataloged entity in Charybdis
|
|
message Entity {
|
|
// Unique identifier (UUID)
|
|
string id = 1;
|
|
|
|
// Entity kind (e.g., "Service", "System", "Component")
|
|
// This determines which metadata/spec variant is populated
|
|
string kind = 2;
|
|
|
|
// Polymorphic metadata - identifying information
|
|
// Each kind has its own metadata structure
|
|
oneof metadata {
|
|
charybdis.core.ServiceMetadata service_metadata = 10;
|
|
charybdis.core.SystemMetadata system_metadata = 11;
|
|
charybdis.core.ComponentMetadata component_metadata = 12;
|
|
charybdis.core.APIMetadata api_metadata = 13;
|
|
charybdis.core.UserMetadata user_metadata = 14;
|
|
charybdis.core.GroupMetadata group_metadata = 15;
|
|
charybdis.core.DomainMetadata domain_metadata = 16;
|
|
charybdis.core.ResourceMetadata resource_metadata = 17;
|
|
charybdis.core.FindingMetadata finding_metadata = 24;
|
|
|
|
// Plugin metadata types will be inserted here by build.rs
|
|
// Example:
|
|
// charybdis.plugins.defectdojo.DefectDojoProductMetadata defectdojo_product_metadata = 100;
|
|
// charybdis.plugins.dependencytrack.DependencyTrackProjectMetadata dependencytrack_project_metadata = 101;
|
|
charybdis.plugins.defectdojo.DefectdojoMetadata defectdojo_metadata = 100;
|
|
charybdis.plugins.keycloak.KeycloakMetadata keycloak_metadata = 102;
|
|
charybdis.plugins.dependencytrack.DependencytrackMetadata dependencytrack_metadata = 101;
|
|
|
|
}
|
|
|
|
// Polymorphic spec - configuration and behavior
|
|
// Each kind has its own spec structure
|
|
oneof spec {
|
|
charybdis.core.ServiceSpec service_spec = 4;
|
|
charybdis.core.SystemSpec system_spec = 5;
|
|
charybdis.core.ComponentSpec component_spec = 6;
|
|
charybdis.core.APISpec api_spec = 7;
|
|
charybdis.core.UserSpec user_spec = 8;
|
|
charybdis.core.GroupSpec group_spec = 9;
|
|
charybdis.core.DomainSpec domain_spec = 18;
|
|
charybdis.core.ResourceSpec resource_spec = 19;
|
|
charybdis.core.FindingSpec finding_spec = 25;
|
|
|
|
// Plugin spec types will be inserted here by build.rs
|
|
// Example:
|
|
// charybdis.plugins.defectdojo.DefectDojoProductSpec defectdojo_product_spec = 100;
|
|
// charybdis.plugins.dependencytrack.DependencyTrackProjectSpec dependencytrack_project_spec = 101;
|
|
charybdis.plugins.defectdojo.DefectdojoSpec defectdojo_spec = 200;
|
|
charybdis.plugins.keycloak.KeycloakSpec keycloak_spec = 202;
|
|
charybdis.plugins.dependencytrack.DependencytrackSpec dependencytrack_spec = 201;
|
|
|
|
}
|
|
|
|
// Annotations - arbitrary string key-value pairs
|
|
// This is where plugins store external tool IDs and references
|
|
// Examples:
|
|
// "defectdojo.com/product-id": "12345"
|
|
// "dependencytrack.com/project-uuid": "550e8400-e29b-41d4-a716-446655440000"
|
|
// "github.com/repo-slug": "myorg/myrepo"
|
|
map<string, string> annotations = 20;
|
|
|
|
// Timestamps (managed by the system)
|
|
google.protobuf.Timestamp created_at = 21;
|
|
google.protobuf.Timestamp updated_at = 22;
|
|
}
|
|
|
|
// Request to create a new entity
|
|
message CreateEntityRequest {
|
|
// Entity data (id, created_at, updated_at will be set by server)
|
|
Entity entity = 1;
|
|
}
|
|
|
|
// Response after creating an entity
|
|
message CreateEntityResponse {
|
|
// The created entity with server-assigned fields
|
|
Entity entity = 1;
|
|
}
|
|
|
|
// Request to get an entity by ID
|
|
message GetEntityRequest {
|
|
// The UUID of the entity to retrieve
|
|
string id = 1;
|
|
}
|
|
|
|
// Response containing a single entity
|
|
message GetEntityResponse {
|
|
Entity entity = 1;
|
|
}
|
|
|
|
// Request to update an existing entity
|
|
message UpdateEntityRequest {
|
|
// The UUID of the entity to update
|
|
string id = 1;
|
|
|
|
// Updated entity data (id, created_at will be ignored)
|
|
Entity entity = 2;
|
|
|
|
// Optional: Field mask for partial updates
|
|
// If not provided, performs a full update
|
|
// If provided, only updates the fields specified in the mask
|
|
// Example paths: "kind", "annotations", "metadata", "spec",
|
|
// "annotations.github.com/repo-slug",
|
|
// "component_metadata.name", "component_spec.lifecycle"
|
|
google.protobuf.FieldMask update_mask = 3;
|
|
}
|
|
|
|
// Response after updating an entity
|
|
message UpdateEntityResponse {
|
|
// The updated entity
|
|
Entity entity = 1;
|
|
}
|
|
|
|
// Request to delete an entity by ID
|
|
message DeleteEntityRequest {
|
|
// The UUID of the entity to delete
|
|
string id = 1;
|
|
}
|
|
|
|
// Response after deleting an entity
|
|
message DeleteEntityResponse {
|
|
// Whether the deletion was successful
|
|
bool success = 1;
|
|
}
|
|
|
|
// Request to list entities
|
|
message ListEntitiesRequest {
|
|
// Optional: Filter by kind
|
|
string kind = 1;
|
|
|
|
// Optional: Filter by annotation key-value pairs
|
|
map<string, string> annotations = 2;
|
|
|
|
// Page size (default: 100, max: 1000)
|
|
int32 page_size = 3;
|
|
|
|
// Cursor for next page (opaque token from previous response)
|
|
string page_token = 4;
|
|
|
|
// Optional: Filter by name
|
|
string name = 5;
|
|
}
|
|
|
|
// Response containing a list of entities
|
|
message ListEntitiesResponse {
|
|
// The list of entities matching the filter
|
|
repeated Entity entities = 1;
|
|
|
|
// Cursor for next page (empty if no more results)
|
|
string next_page_token = 2;
|
|
|
|
// Total count of matching entities
|
|
int32 total_count = 3;
|
|
}
|
|
|
|
// Service definition for managing entities
|
|
service EntityService {
|
|
// Creates a new entity
|
|
rpc CreateEntity (CreateEntityRequest) returns (CreateEntityResponse);
|
|
|
|
// Gets an entity by its ID
|
|
rpc GetEntity (GetEntityRequest) returns (GetEntityResponse);
|
|
|
|
// Updates an existing entity
|
|
rpc UpdateEntity (UpdateEntityRequest) returns (UpdateEntityResponse);
|
|
|
|
// Deletes an entity by its ID
|
|
rpc DeleteEntity (DeleteEntityRequest) returns (DeleteEntityResponse);
|
|
|
|
// Lists entities with optional filtering
|
|
rpc ListEntities (ListEntitiesRequest) returns (ListEntitiesResponse);
|
|
}
|