use crate::volcengine::error::error;
use crate::volcengine::request::request::RequestVolcengine;
use crate::volcengine::request::{request, response};
use std::collections::HashMap;
use volcengine_sdk_protobuf::protobuf::vpc_vpc;
impl request::ApiRequest for vpc_vpc::DescribeVpcsReq {
fn to_hashmap(&self) -> HashMap<String, String> {
request::Request::format_request_to_hashmap(self)
}
fn to_body(&self) -> Vec<u8> {
Vec::new()
}
}
impl response::ApiResponse for vpc_vpc::DescribeVpcsResp {
async fn to_struct(&mut self, http_response: reqwest::Response) -> Result<(), error::Error> {
let txt_response = http_response
.text()
.await
.map_err(|e| error::Error::ErrParseResponse(e))?;
let sanitized_response = txt_response
.replace("\"SecondaryCidrBlocks\":null", "\"SecondaryCidrBlocks\":[]") .replace("\"DnsServers\":null", "\"DnsServers\":[]");
let parsed_response: volcengine_sdk_protobuf::protobuf::vpc_vpc::DescribeVpcsResp =
serde_json::from_str(&sanitized_response).map_err(|e| error::Error::ErrParseJson(e))?;
*self = parsed_response;
Ok(())
}
}