#![cfg(feature = "hetzner_servers")]
#![allow(clippy::too_many_arguments, clippy::type_complexity)]
#![allow(
clippy::missing_errors_doc,
clippy::doc_markdown,
clippy::useless_format
)]
#![allow(unused_imports)]
use foundation_macros::JsonHash;
use foundation_netio::shared::client::http_client::HttpClient;
use foundation_netio::{DynNetClient, PreparedRequestBuilder};
use serde::{Deserialize, Serialize};
use super::shared::ApiResponse;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct CreateServerRequest {
pub automount: Option<bool>,
pub firewalls: Option<Vec<CreateServerRequestFirewallsItem>>,
pub image: String,
pub labels: Option<serde_json::Value>,
pub location: Option<String>,
pub name: String,
pub networks: Option<Vec<i64>>,
pub placement_group: Option<i64>,
pub public_net: Option<CreateServerRequestPublicNet>,
pub server_type: String,
pub ssh_keys: Option<Vec<String>>,
pub start_after_create: Option<bool>,
pub user_data: Option<String>,
pub volumes: Option<Vec<i64>>,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct CreateServerRequestFirewallsItem {
pub firewall: i64,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct CreateServerRequestPublicNet {
pub enable_ipv4: Option<bool>,
pub enable_ipv6: Option<bool>,
pub ipv4: Option<i64>,
pub ipv6: Option<i64>,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct CreateServerResponse {
pub action: CreateServerResponseAction,
pub next_actions: Vec<CreateServerResponseNextActionsItem>,
pub root_password: Option<String>,
pub server: CreateServerResponseServer,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct CreateServerResponseAction {
pub command: String,
pub error: Option<CreateServerResponseActionError>,
pub finished: Option<String>,
pub id: i64,
pub progress: i64,
pub resources: Vec<CreateServerResponseActionResourcesItem>,
pub started: String,
pub status: String,
}
pub type CreateServerResponseActionError = super::shared::CodeMessageObject;
pub type CreateServerResponseActionResourcesItem = super::shared::IdTypeObject;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct CreateServerResponseNextActionsItem {
pub command: String,
pub error: Option<CreateServerResponseNextActionsItemError>,
pub finished: Option<String>,
pub id: i64,
pub progress: i64,
pub resources: Vec<CreateServerResponseNextActionsItemResourcesItem>,
pub started: String,
pub status: String,
}
pub type CreateServerResponseNextActionsItemError = super::shared::CodeMessageObject;
pub type CreateServerResponseNextActionsItemResourcesItem = super::shared::IdTypeObject;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct CreateServerResponseServer {
pub backup_window: Option<String>,
pub created: String,
pub id: i64,
pub image: Option<CreateServerResponseServerImage>,
pub included_traffic: Option<i64>,
pub ingoing_traffic: Option<i64>,
pub iso: Option<CreateServerResponseServerIso>,
pub labels: serde_json::Value,
pub load_balancers: Option<Vec<i64>>,
pub location: CreateServerResponseServerLocation,
pub locked: bool,
pub name: String,
pub outgoing_traffic: Option<i64>,
pub placement_group: Option<CreateServerResponseServerPlacementGroup>,
pub primary_disk_size: f64,
pub private_net: Vec<CreateServerResponseServerPrivateNetItem>,
pub protection: CreateServerResponseServerProtection,
pub public_net: CreateServerResponseServerPublicNet,
pub rescue_enabled: bool,
pub server_type: CreateServerResponseServerServerType,
pub status: String,
pub volumes: Option<Vec<i64>>,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct CreateServerResponseServerImage {
pub architecture: String,
pub bound_to: Option<i64>,
pub created: String,
pub created_from: Option<CreateServerResponseServerImageCreatedFrom>,
pub deleted: Option<String>,
pub deprecated: Option<String>,
pub description: String,
pub disk_size: f64,
pub id: i64,
pub image_size: Option<f64>,
pub labels: serde_json::Value,
pub name: Option<String>,
pub os_flavor: String,
pub os_version: Option<String>,
pub protection: CreateServerResponseServerImageProtection,
pub rapid_deploy: Option<bool>,
pub status: String,
#[serde(rename = "type")]
pub r#type: String,
}
pub type CreateServerResponseServerImageCreatedFrom = super::shared::IdNameObject;
pub type CreateServerResponseServerImageProtection = super::shared::DeleteObject;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct CreateServerResponseServerIso {
pub architecture: Option<String>,
pub deprecation: Option<CreateServerResponseServerIsoDeprecation>,
pub description: String,
pub id: i64,
pub name: Option<String>,
#[serde(rename = "type")]
pub r#type: Option<String>,
}
pub type CreateServerResponseServerIsoDeprecation = super::shared::AnnouncedUnavailableAfterObject;
pub type CreateServerResponseServerLocation =
super::shared::CreateServerResponseServerLocationShape;
pub type CreateServerResponseServerPlacementGroup =
super::shared::CreateServerResponseServerPlacementGroupShape;
pub type CreateServerResponseServerPrivateNetItem =
super::shared::CreateServerResponseServerPrivateNetItemShape;
pub type CreateServerResponseServerProtection = super::shared::DeleteRebuildObject;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct CreateServerResponseServerPublicNet {
pub firewalls: Option<Vec<CreateServerResponseServerPublicNetFirewallsItem>>,
pub floating_ips: Vec<i64>,
pub ipv4: Option<CreateServerResponseServerPublicNetIpv4>,
pub ipv6: Option<CreateServerResponseServerPublicNetIpv6>,
}
pub type CreateServerResponseServerPublicNetFirewallsItem = super::shared::IdStatusObject;
pub type CreateServerResponseServerPublicNetIpv4 =
super::shared::CreateServerResponseServerPublicNetIpv4Shape;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct CreateServerResponseServerPublicNetIpv6 {
pub blocked: bool,
pub dns_ptr: Option<Vec<CreateServerResponseServerPublicNetIpv6DnsPtrItem>>,
pub id: Option<i64>,
pub ip: String,
}
pub type CreateServerResponseServerPublicNetIpv6DnsPtrItem = super::shared::DnsPtrIpObject;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct CreateServerResponseServerServerType {
pub architecture: String,
pub category: Option<String>,
pub cores: f64,
pub cpu_type: String,
pub deprecated: bool,
pub deprecation: Option<CreateServerResponseServerServerTypeDeprecation>,
pub description: String,
pub disk: f64,
pub id: i64,
pub locations: Vec<CreateServerResponseServerServerTypeLocationsItem>,
pub memory: f64,
pub name: String,
pub prices: Vec<CreateServerResponseServerServerTypePricesItem>,
pub storage_type: String,
}
pub type CreateServerResponseServerServerTypeDeprecation =
super::shared::AnnouncedUnavailableAfterObject;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct CreateServerResponseServerServerTypeLocationsItem {
pub available: bool,
pub deprecation: Option<CreateServerResponseServerServerTypeLocationsItemDeprecation>,
pub id: i64,
pub name: String,
pub recommended: bool,
}
pub type CreateServerResponseServerServerTypeLocationsItemDeprecation =
super::shared::AnnouncedUnavailableAfterObject;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct CreateServerResponseServerServerTypePricesItem {
pub included_traffic: i64,
pub location: String,
pub price_hourly: CreateServerResponseServerServerTypePricesItemPriceHourly,
pub price_monthly: CreateServerResponseServerServerTypePricesItemPriceMonthly,
pub price_per_tb_traffic: CreateServerResponseServerServerTypePricesItemPricePerTbTraffic,
}
pub type CreateServerResponseServerServerTypePricesItemPriceHourly = super::shared::GrossNetObject;
pub type CreateServerResponseServerServerTypePricesItemPriceMonthly = super::shared::GrossNetObject;
pub type CreateServerResponseServerServerTypePricesItemPricePerTbTraffic =
super::shared::GrossNetObject;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct DeleteServerResponse {
pub action: Option<DeleteServerResponseAction>,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct DeleteServerResponseAction {
pub command: String,
pub error: Option<DeleteServerResponseActionError>,
pub finished: Option<String>,
pub id: i64,
pub progress: i64,
pub resources: Vec<DeleteServerResponseActionResourcesItem>,
pub started: String,
pub status: String,
}
pub type DeleteServerResponseActionError = super::shared::CodeMessageObject;
pub type DeleteServerResponseActionResourcesItem = super::shared::IdTypeObject;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct GetServerResponse {
pub server: Option<GetServerResponseServer>,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct GetServerResponseServer {
pub backup_window: Option<String>,
pub created: String,
pub id: i64,
pub image: Option<GetServerResponseServerImage>,
pub included_traffic: Option<i64>,
pub ingoing_traffic: Option<i64>,
pub iso: Option<GetServerResponseServerIso>,
pub labels: serde_json::Value,
pub load_balancers: Option<Vec<i64>>,
pub location: GetServerResponseServerLocation,
pub locked: bool,
pub name: String,
pub outgoing_traffic: Option<i64>,
pub placement_group: Option<GetServerResponseServerPlacementGroup>,
pub primary_disk_size: f64,
pub private_net: Vec<GetServerResponseServerPrivateNetItem>,
pub protection: GetServerResponseServerProtection,
pub public_net: GetServerResponseServerPublicNet,
pub rescue_enabled: bool,
pub server_type: GetServerResponseServerServerType,
pub status: String,
pub volumes: Option<Vec<i64>>,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct GetServerResponseServerImage {
pub architecture: String,
pub bound_to: Option<i64>,
pub created: String,
pub created_from: Option<GetServerResponseServerImageCreatedFrom>,
pub deleted: Option<String>,
pub deprecated: Option<String>,
pub description: String,
pub disk_size: f64,
pub id: i64,
pub image_size: Option<f64>,
pub labels: serde_json::Value,
pub name: Option<String>,
pub os_flavor: String,
pub os_version: Option<String>,
pub protection: GetServerResponseServerImageProtection,
pub rapid_deploy: Option<bool>,
pub status: String,
#[serde(rename = "type")]
pub r#type: String,
}
pub type GetServerResponseServerImageCreatedFrom = super::shared::IdNameObject;
pub type GetServerResponseServerImageProtection = super::shared::DeleteObject;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct GetServerResponseServerIso {
pub architecture: Option<String>,
pub deprecation: Option<GetServerResponseServerIsoDeprecation>,
pub description: String,
pub id: i64,
pub name: Option<String>,
#[serde(rename = "type")]
pub r#type: Option<String>,
}
pub type GetServerResponseServerIsoDeprecation = super::shared::AnnouncedUnavailableAfterObject;
pub type GetServerResponseServerLocation = super::shared::CreateServerResponseServerLocationShape;
pub type GetServerResponseServerPlacementGroup =
super::shared::CreateServerResponseServerPlacementGroupShape;
pub type GetServerResponseServerPrivateNetItem =
super::shared::CreateServerResponseServerPrivateNetItemShape;
pub type GetServerResponseServerProtection = super::shared::DeleteRebuildObject;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct GetServerResponseServerPublicNet {
pub firewalls: Option<Vec<GetServerResponseServerPublicNetFirewallsItem>>,
pub floating_ips: Vec<i64>,
pub ipv4: Option<GetServerResponseServerPublicNetIpv4>,
pub ipv6: Option<GetServerResponseServerPublicNetIpv6>,
}
pub type GetServerResponseServerPublicNetFirewallsItem = super::shared::IdStatusObject;
pub type GetServerResponseServerPublicNetIpv4 =
super::shared::CreateServerResponseServerPublicNetIpv4Shape;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct GetServerResponseServerPublicNetIpv6 {
pub blocked: bool,
pub dns_ptr: Option<Vec<GetServerResponseServerPublicNetIpv6DnsPtrItem>>,
pub id: Option<i64>,
pub ip: String,
}
pub type GetServerResponseServerPublicNetIpv6DnsPtrItem = super::shared::DnsPtrIpObject;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct GetServerResponseServerServerType {
pub architecture: String,
pub category: Option<String>,
pub cores: f64,
pub cpu_type: String,
pub deprecated: bool,
pub deprecation: Option<GetServerResponseServerServerTypeDeprecation>,
pub description: String,
pub disk: f64,
pub id: i64,
pub locations: Vec<GetServerResponseServerServerTypeLocationsItem>,
pub memory: f64,
pub name: String,
pub prices: Vec<GetServerResponseServerServerTypePricesItem>,
pub storage_type: String,
}
pub type GetServerResponseServerServerTypeDeprecation =
super::shared::AnnouncedUnavailableAfterObject;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct GetServerResponseServerServerTypeLocationsItem {
pub available: bool,
pub deprecation: Option<GetServerResponseServerServerTypeLocationsItemDeprecation>,
pub id: i64,
pub name: String,
pub recommended: bool,
}
pub type GetServerResponseServerServerTypeLocationsItemDeprecation =
super::shared::AnnouncedUnavailableAfterObject;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct GetServerResponseServerServerTypePricesItem {
pub included_traffic: i64,
pub location: String,
pub price_hourly: GetServerResponseServerServerTypePricesItemPriceHourly,
pub price_monthly: GetServerResponseServerServerTypePricesItemPriceMonthly,
pub price_per_tb_traffic: GetServerResponseServerServerTypePricesItemPricePerTbTraffic,
}
pub type GetServerResponseServerServerTypePricesItemPriceHourly = super::shared::GrossNetObject;
pub type GetServerResponseServerServerTypePricesItemPriceMonthly = super::shared::GrossNetObject;
pub type GetServerResponseServerServerTypePricesItemPricePerTbTraffic =
super::shared::GrossNetObject;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct ListServersResponse {
pub meta: ListServersResponseMeta,
pub servers: Vec<ListServersResponseServersItem>,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct ListServersResponseMeta {
pub pagination: ListServersResponseMetaPagination,
}
pub type ListServersResponseMetaPagination = super::shared::ListServersResponseMetaPaginationShape;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct ListServersResponseServersItem {
pub backup_window: Option<String>,
pub created: String,
pub id: i64,
pub image: Option<ListServersResponseServersItemImage>,
pub included_traffic: Option<i64>,
pub ingoing_traffic: Option<i64>,
pub iso: Option<ListServersResponseServersItemIso>,
pub labels: serde_json::Value,
pub load_balancers: Option<Vec<i64>>,
pub location: ListServersResponseServersItemLocation,
pub locked: bool,
pub name: String,
pub outgoing_traffic: Option<i64>,
pub placement_group: Option<ListServersResponseServersItemPlacementGroup>,
pub primary_disk_size: f64,
pub private_net: Vec<ListServersResponseServersItemPrivateNetItem>,
pub protection: ListServersResponseServersItemProtection,
pub public_net: ListServersResponseServersItemPublicNet,
pub rescue_enabled: bool,
pub server_type: ListServersResponseServersItemServerType,
pub status: String,
pub volumes: Option<Vec<i64>>,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct ListServersResponseServersItemImage {
pub architecture: String,
pub bound_to: Option<i64>,
pub created: String,
pub created_from: Option<ListServersResponseServersItemImageCreatedFrom>,
pub deleted: Option<String>,
pub deprecated: Option<String>,
pub description: String,
pub disk_size: f64,
pub id: i64,
pub image_size: Option<f64>,
pub labels: serde_json::Value,
pub name: Option<String>,
pub os_flavor: String,
pub os_version: Option<String>,
pub protection: ListServersResponseServersItemImageProtection,
pub rapid_deploy: Option<bool>,
pub status: String,
#[serde(rename = "type")]
pub r#type: String,
}
pub type ListServersResponseServersItemImageCreatedFrom = super::shared::IdNameObject;
pub type ListServersResponseServersItemImageProtection = super::shared::DeleteObject;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct ListServersResponseServersItemIso {
pub architecture: Option<String>,
pub deprecation: Option<ListServersResponseServersItemIsoDeprecation>,
pub description: String,
pub id: i64,
pub name: Option<String>,
#[serde(rename = "type")]
pub r#type: Option<String>,
}
pub type ListServersResponseServersItemIsoDeprecation =
super::shared::AnnouncedUnavailableAfterObject;
pub type ListServersResponseServersItemLocation =
super::shared::CreateServerResponseServerLocationShape;
pub type ListServersResponseServersItemPlacementGroup =
super::shared::CreateServerResponseServerPlacementGroupShape;
pub type ListServersResponseServersItemPrivateNetItem =
super::shared::CreateServerResponseServerPrivateNetItemShape;
pub type ListServersResponseServersItemProtection = super::shared::DeleteRebuildObject;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct ListServersResponseServersItemPublicNet {
pub firewalls: Option<Vec<ListServersResponseServersItemPublicNetFirewallsItem>>,
pub floating_ips: Vec<i64>,
pub ipv4: Option<ListServersResponseServersItemPublicNetIpv4>,
pub ipv6: Option<ListServersResponseServersItemPublicNetIpv6>,
}
pub type ListServersResponseServersItemPublicNetFirewallsItem = super::shared::IdStatusObject;
pub type ListServersResponseServersItemPublicNetIpv4 =
super::shared::CreateServerResponseServerPublicNetIpv4Shape;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct ListServersResponseServersItemPublicNetIpv6 {
pub blocked: bool,
pub dns_ptr: Option<Vec<ListServersResponseServersItemPublicNetIpv6DnsPtrItem>>,
pub id: Option<i64>,
pub ip: String,
}
pub type ListServersResponseServersItemPublicNetIpv6DnsPtrItem = super::shared::DnsPtrIpObject;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct ListServersResponseServersItemServerType {
pub architecture: String,
pub category: Option<String>,
pub cores: f64,
pub cpu_type: String,
pub deprecated: bool,
pub deprecation: Option<ListServersResponseServersItemServerTypeDeprecation>,
pub description: String,
pub disk: f64,
pub id: i64,
pub locations: Vec<ListServersResponseServersItemServerTypeLocationsItem>,
pub memory: f64,
pub name: String,
pub prices: Vec<ListServersResponseServersItemServerTypePricesItem>,
pub storage_type: String,
}
pub type ListServersResponseServersItemServerTypeDeprecation =
super::shared::AnnouncedUnavailableAfterObject;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct ListServersResponseServersItemServerTypeLocationsItem {
pub available: bool,
pub deprecation: Option<ListServersResponseServersItemServerTypeLocationsItemDeprecation>,
pub id: i64,
pub name: String,
pub recommended: bool,
}
pub type ListServersResponseServersItemServerTypeLocationsItemDeprecation =
super::shared::AnnouncedUnavailableAfterObject;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct ListServersResponseServersItemServerTypePricesItem {
pub included_traffic: i64,
pub location: String,
pub price_hourly: ListServersResponseServersItemServerTypePricesItemPriceHourly,
pub price_monthly: ListServersResponseServersItemServerTypePricesItemPriceMonthly,
pub price_per_tb_traffic: ListServersResponseServersItemServerTypePricesItemPricePerTbTraffic,
}
pub type ListServersResponseServersItemServerTypePricesItemPriceHourly =
super::shared::GrossNetObject;
pub type ListServersResponseServersItemServerTypePricesItemPriceMonthly =
super::shared::GrossNetObject;
pub type ListServersResponseServersItemServerTypePricesItemPricePerTbTraffic =
super::shared::GrossNetObject;
#[derive(Debug, Clone, Default, Serialize, JsonHash)]
pub struct ListServersArgs {
pub name: Option<String>,
pub label_selector: Option<String>,
pub sort: Vec<String>,
pub status: Vec<String>,
pub page: Option<String>,
pub per_page: Option<String>,
}
#[derive(Debug, Clone, Default, Serialize, JsonHash)]
pub struct CreateServerArgs {
pub body: CreateServerRequest,
}
pub type GetServerArgs = super::shared::IdArgs;
pub type DeleteServerArgs = super::shared::IdArgs;
pub async fn list_servers_request<F>(
client: impl Into<super::shared::ApiClient>,
args: &ListServersArgs,
base_url: &str,
builder_mod: Option<F>,
) -> Result<ApiResponse<ListServersResponse>, super::shared::ApiError>
where
F: FnOnce(&mut PreparedRequestBuilder),
{
let path = format!("/servers",);
let endpoint_url = format!("{}{}", base_url, path);
let mut builder = PreparedRequestBuilder::get(&endpoint_url)
.map_err(|e| super::shared::ApiError::RequestBuildFailed(e.to_string()))?;
builder = builder.query("name", args.name.as_deref());
builder = builder.query("label_selector", args.label_selector.as_deref());
for value in &args.sort {
builder = builder.query("sort", Some(value.as_str()));
}
for value in &args.status {
builder = builder.query("status", Some(value.as_str()));
}
builder = builder.query("page", args.page.as_deref());
builder = builder.query("per_page", args.per_page.as_deref());
if let Some(f) = builder_mod {
f(&mut builder);
}
super::shared::send_json(client.into(), builder.build()).await
}
pub async fn create_server_request<F>(
client: impl Into<super::shared::ApiClient>,
args: &CreateServerArgs,
base_url: &str,
builder_mod: Option<F>,
) -> Result<ApiResponse<CreateServerResponse>, super::shared::ApiError>
where
F: FnOnce(&mut PreparedRequestBuilder),
{
let path = format!("/servers",);
let endpoint_url = format!("{}{}", base_url, path);
let mut builder = PreparedRequestBuilder::post(&endpoint_url)
.map_err(|e| super::shared::ApiError::RequestBuildFailed(e.to_string()))?;
builder = builder
.body_json(&args.body)
.map_err(|e| super::shared::ApiError::RequestBuildFailed(e.to_string()))?;
if let Some(f) = builder_mod {
f(&mut builder);
}
super::shared::send_json(client.into(), builder.build()).await
}
pub async fn get_server_request<F>(
client: impl Into<super::shared::ApiClient>,
args: &GetServerArgs,
base_url: &str,
builder_mod: Option<F>,
) -> Result<ApiResponse<GetServerResponse>, super::shared::ApiError>
where
F: FnOnce(&mut PreparedRequestBuilder),
{
let path = format!("/servers/{}", args.id,);
let endpoint_url = format!("{}{}", base_url, path);
let mut builder = PreparedRequestBuilder::get(&endpoint_url)
.map_err(|e| super::shared::ApiError::RequestBuildFailed(e.to_string()))?;
if let Some(f) = builder_mod {
f(&mut builder);
}
super::shared::send_json(client.into(), builder.build()).await
}
pub async fn delete_server_request<F>(
client: impl Into<super::shared::ApiClient>,
args: &DeleteServerArgs,
base_url: &str,
builder_mod: Option<F>,
) -> Result<ApiResponse<DeleteServerResponse>, super::shared::ApiError>
where
F: FnOnce(&mut PreparedRequestBuilder),
{
let path = format!("/servers/{}", args.id,);
let endpoint_url = format!("{}{}", base_url, path);
let mut builder = PreparedRequestBuilder::delete(&endpoint_url)
.map_err(|e| super::shared::ApiError::RequestBuildFailed(e.to_string()))?;
if let Some(f) = builder_mod {
f(&mut builder);
}
super::shared::send_json(client.into(), builder.build()).await
}