redis_cloud/handlers/
fixed.rs

1//! Fixed (Essentials) subscription operations handler
2
3use crate::{Result, client::CloudClient};
4use serde_json::Value;
5
6/// Handler for Cloud fixed/essentials subscription operations
7pub struct CloudFixedHandler {
8    client: CloudClient,
9}
10
11impl CloudFixedHandler {
12    pub fn new(client: CloudClient) -> Self {
13        CloudFixedHandler { client }
14    }
15
16    /// List all fixed subscriptions
17    pub async fn list(&self) -> Result<Value> {
18        self.client.get("/fixed/subscriptions").await
19    }
20
21    /// Get fixed subscription by ID
22    pub async fn get(&self, subscription_id: u32) -> Result<Value> {
23        self.client
24            .get(&format!("/fixed/subscriptions/{}", subscription_id))
25            .await
26    }
27
28    /// Get fixed subscription databases
29    pub async fn databases(&self, subscription_id: u32) -> Result<Value> {
30        self.client
31            .get(&format!(
32                "/fixed/subscriptions/{}/databases",
33                subscription_id
34            ))
35            .await
36    }
37
38    /// Get a specific database in a fixed subscription
39    pub async fn database(&self, subscription_id: u32, database_id: u32) -> Result<Value> {
40        self.client
41            .get(&format!(
42                "/fixed/subscriptions/{}/databases/{}",
43                subscription_id, database_id
44            ))
45            .await
46    }
47
48    /// List available fixed plans
49    pub async fn plans(&self) -> Result<Value> {
50        self.client.get("/fixed/plans").await
51    }
52
53    /// Get a specific fixed plan
54    pub async fn plan(&self, plan_id: u32) -> Result<Value> {
55        self.client.get(&format!("/fixed/plans/{}", plan_id)).await
56    }
57}