pub struct Restore {
pub passwd: String,
pub b64_data: String,
pub restore_type: RestoreType,
}
Expand description
Upload and restore an Odoo dump to a new database
Note that this request may take some time to complete, and it’s likely worth only firing this from an async-type client
Note also that the uploaded “file” must:
- Be a zip file
- Contain a folder named
filestore
, whose direct descendents are the databases filestore content (e.g.filestore/a0
,filestore/a1
, etc) - Contain a file name
dump.sql
, which is apg_dump
“plain” format dump (e.g. a text file of SQL statements)
Typically Odoo backups also include a manifest.json
, but this file isn’t checked
by the Restore endpoint.
§Example
use odoo_api::service::db::RestoreType;
use std::fs;
// load the file data
let data = fs::read("/my/database/backup.zip")?;
// convert raw bytes to base64
// e.g., with the `base64` crate: https://crates.io/crates/base64
let data_b64 = base64::encode(&data)?;
// convert base64's `Vec<u8>` to a `&str`
let data_b64 = std::str::from_utf8(&data_b64)?;
// read `id` and `login` from users id=1,2,3
client.db_restore(
"master-password",
data_b64,
RestoreType::Copy
).send()?;
Reference: odoo/service/db.py
See also: odoo/service/db.py
Fields§
§passwd: String
The Odoo master password
b64_data: String
The backup data, as a base64-encoded string
restore_type: RestoreType
The restore type (see RestoreType
)
Trait Implementations§
Source§impl JsonRpcParams for Restore
impl JsonRpcParams for Restore
type Container<T> = OdooApiContainer<Restore>
type Response = RestoreResponse
fn build(self, id: JsonRpcId) -> JsonRpcRequest<Self>
Source§impl OdooApiMethod for Restore
impl OdooApiMethod for Restore
Source§fn describe(&self) -> (&'static str, &'static str)
fn describe(&self) -> (&'static str, &'static str)
Describe the JSON-RPC service and method for this type
Source§fn endpoint(&self) -> &'static str
fn endpoint(&self) -> &'static str
Describe method endpoint (e.g., “/web/session/authenticate”)
Source§fn _build(self, id: JsonRpcId) -> JsonRpcRequest<Self>
fn _build(self, id: JsonRpcId) -> JsonRpcRequest<Self>
Build
self
into a full JsonRpcRequest
Auto Trait Implementations§
impl Freeze for Restore
impl RefUnwindSafe for Restore
impl Send for Restore
impl Sync for Restore
impl Unpin for Restore
impl UnwindSafe for Restore
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