Skip to main content

kapi_core/
key.rs

1/// Uniquely identifies a resource kind within the API server.
2///
3/// `ResourceKey` combines the three components of a kapi resource identifier:
4/// `group`, `version`, and `kind`. It is used as a lookup key for schema
5/// validation, event bus routing, and store operations.
6///
7/// # Example
8///
9/// ```
10/// use kapi_core::ResourceKey;
11///
12/// let key = ResourceKey {
13///     group: "example.io".to_string(),
14///     version: "v1".to_string(),
15///     kind: "Widget".to_string(),
16/// };
17/// ```
18#[derive(Debug, Clone, Hash, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
19pub struct ResourceKey {
20    /// The API group (e.g. `"example.io"`). Use empty string for core resources.
21    pub group: String,
22    /// The API version within the group (e.g. `"v1"`, `"v2beta1"`).
23    pub version: String,
24    /// The resource kind (e.g. `"Widget"`, `"Schema"`, `"Namespace"`).
25    pub kind: String,
26}