CloudDatabaseHandler

Struct CloudDatabaseHandler 

Source
pub struct CloudDatabaseHandler { /* private fields */ }
Expand description

Handler for Cloud database operations

Provides methods for managing Redis Cloud databases including creation, updates, backups, imports, metrics collection, and scaling operations.

All database operations require both a subscription ID and database ID, as databases are scoped within subscriptions in Redis Cloud.

Implementations§

Source§

impl CloudDatabaseHandler

Source

pub fn new(client: CloudClient) -> Self

Create a new database handler instance

§Arguments
  • client - The configured CloudClient instance
Source

pub async fn get( &self, subscription_id: u32, database_id: u32, ) -> Result<CloudDatabase>

Retrieve a specific database by ID

Returns detailed information about a database including its configuration, status, endpoints, and current metrics.

§Arguments
  • subscription_id - The ID of the subscription containing the database
  • database_id - The unique database identifier
§Examples
let db_handler = CloudDatabaseHandler::new(client);
let database = db_handler.get(123, 456).await?;
println!("Database name: {}", database.name);
println!("Memory limit: {} GB", database.memory_limit_in_gb);
Source

pub async fn create( &self, subscription_id: u32, request: CreateDatabaseRequest, ) -> Result<Value>

Create a new database in a subscription

Creates a new Redis database with the specified configuration. The database will be deployed across the subscription’s defined regions and cloud providers.

§Arguments
  • subscription_id - The ID of the subscription to create the database in
  • request - Database configuration including name, memory, replication settings
§Examples
let db_handler = CloudDatabaseHandler::new(client);
let config = json!({
    "name": "production-cache",
    "memory_limit_in_gb": 5.0,
    "replication": true,
    "data_persistence": "aof-every-1-sec",
    "password": "secure-password"
});
// Note: create() takes a typed request struct, not JSON
// let result = db_handler.create(123, create_request).await?;
Source

pub async fn update( &self, subscription_id: u32, database_id: u32, request: UpdateDatabaseRequest, ) -> Result<CloudDatabase>

Update an existing database configuration

Modifies database settings such as memory limits, replication, persistence, and other configuration options. Some changes may require a database restart.

§Arguments
  • subscription_id - The ID of the subscription containing the database
  • database_id - The unique database identifier
  • request - Updated configuration settings
§Examples
let db_handler = CloudDatabaseHandler::new(client);
let updates = json!({
    "memory_limit_in_gb": 10.0,
    "replication": false
});
// Note: update() takes a typed request struct, not JSON
// let updated_db = db_handler.update(123, 456, update_request).await?;
Source

pub async fn delete( &self, subscription_id: u32, database_id: u32, ) -> Result<Value>

Delete a database permanently

Warning: This operation is irreversible and will permanently delete all data in the database. Consider creating a backup before deletion.

§Arguments
  • subscription_id - The ID of the subscription containing the database
  • database_id - The unique database identifier
§Examples
let db_handler = CloudDatabaseHandler::new(client);
let result = db_handler.delete(123, 456).await?;
println!("Database deleted successfully");
Source

pub async fn resize( &self, subscription_id: u32, database_id: u32, memory_limit_in_gb: f64, ) -> Result<CloudDatabase>

Resize database

Source

pub async fn list_all(&self) -> Result<Vec<CloudDatabase>>

List all databases across all subscriptions

Source

pub async fn list(&self, subscription_id: u32) -> Result<Value>

List databases for subscription as Value

Source

pub async fn get_raw( &self, subscription_id: u32, database_id: u32, ) -> Result<Value>

Get database as Value

Source

pub async fn create_raw( &self, subscription_id: u32, request: Value, ) -> Result<Value>

Create database with Value

Source

pub async fn update_raw( &self, subscription_id: u32, database_id: u32, request: Value, ) -> Result<Value>

Update database with Value

Source

pub async fn backup( &self, subscription_id: u32, database_id: u32, ) -> Result<Value>

Backup database

Source

pub async fn import( &self, subscription_id: u32, database_id: u32, request: Value, ) -> Result<Value>

Import data

Source

pub async fn get_metrics( &self, subscription_id: u32, database_id: u32, metrics: &str, period: &str, ) -> Result<Value>

Get metrics

Source

pub async fn backup_status( &self, subscription_id: u32, database_id: u32, ) -> Result<Value>

Get database backup status

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,