pub struct Policy {
pub resource_type: String,
pub id: Option<String>,
pub code: String,
pub name: String,
pub enabled: u32,
pub team_id: String,
pub gateway_id: String,
pub rules: Option<PolicyRules>,
pub created_at: Option<String>,
pub updated_at: Option<String>,
}Expand description
Policy resource
Represents a policy that contains references to rules. In v1.7.0+, rules are defined as top-level resources and referenced by ID.
§Example (v1.7.0 format)
{
"type": "policy",
"id": "policy-123",
"code": "rate-limit",
"name": "Rate Limiting Policy",
"enabled": 1,
"team_id": "team-456",
"gateway_id": "gateway-789",
"rules": ["rate_limit_rule_1", "rate_limit_rule_2"],
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
}§Breaking Change (v1.6.0 → v1.7.0)
In v1.7.0, the rules field format changed from nested objects to an array of rule ID strings.
This aligns with the new flat/reusable policies and rules structure in harmony-dsl.
Fields§
§resource_type: String§id: Option<String>§code: String§name: String§enabled: u32§team_id: String§gateway_id: String§rules: Option<PolicyRules>Array of rule IDs referenced by this policy.
In v1.7.0+, rules are defined as top-level [rules.*] tables and referenced by ID.
Each ID in this array should correspond to a rule defined at the top level.
Rules are represented as a typed array of string IDs for better type safety.
created_at: Option<String>§updated_at: Option<String>Trait Implementations§
Source§impl<'de> Deserialize<'de> for Policy
impl<'de> Deserialize<'de> for Policy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Policy
impl RefUnwindSafe for Policy
impl Send for Policy
impl Sync for Policy
impl Unpin for Policy
impl UnwindSafe for Policy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more