genpolicy: add default implementations for K8sResource trait

This commit adds default implementations for following methods of
K8sResource trait:
- generate_policy
- serialize

Fixes: #8960
Signed-off-by: Archana Choudhary <archana1@microsoft.com>
This commit is contained in:
Archana Choudhary 2024-04-21 12:28:43 +00:00
parent 6edc3b6b0a
commit 4a010cf71b

View File

@ -49,8 +49,13 @@ pub trait K8sResource {
silent_unsupported_fields: bool,
);
fn generate_policy(&self, agent_policy: &policy::AgentPolicy) -> String;
fn serialize(&mut self, policy: &str) -> String;
fn generate_policy(&self, _agent_policy: &policy::AgentPolicy) -> String {
panic!("Unsupported");
}
fn serialize(&mut self, _policy: &str) -> String {
panic!("Unsupported");
}
fn get_sandbox_name(&self) -> Option<String> {
panic!("Unsupported");