5422 lines
208 KiB
Rust
5422 lines
208 KiB
Rust
/*
|
|
* SCP (Server Control Panel) REST API
|
|
*
|
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
*
|
|
* The version of the OpenAPI document: 2025.1218.164029
|
|
*
|
|
* Generated by: https://openapi-generator.tech
|
|
*/
|
|
|
|
use super::{configuration, ContentType, Error};
|
|
use crate::{apis::ResponseContent, models};
|
|
use reqwest;
|
|
use serde::{de::Error as _, Deserialize, Serialize};
|
|
|
|
/// struct for typed errors of method [`api_ping_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiPingGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_maintenance_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1MaintenanceGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_openapi_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1OpenapiGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_rdns_ipv4_ip_delete`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1RdnsIpv4IpDeleteError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_rdns_ipv4_ip_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1RdnsIpv4IpGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_rdns_ipv4_post`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1RdnsIpv4PostError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_rdns_ipv6_ip_delete`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1RdnsIpv6IpDeleteError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_rdns_ipv6_ip_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1RdnsIpv6IpGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_rdns_ipv6_post`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1RdnsIpv6PostError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_disks_disk_name_format_post`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdDisksDiskNameFormatPostError {
|
|
Status400(models::ResponseError),
|
|
Status404(models::ResponseError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_disks_disk_name_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdDisksDiskNameGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_disks_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdDisksGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_disks_patch`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdDisksPatchError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_disks_supported_drivers_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdDisksSupportedDriversGetError {
|
|
Status404(models::ResponseError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdGetError {
|
|
Status404(models::NotFoundError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_guest_agent_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdGuestAgentGetError {
|
|
Status404(models::NotFoundError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_image_post`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdImagePostError {
|
|
Status422(models::ValidationError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_imageflavours_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdImageflavoursGetError {
|
|
Status404(models::NotFoundError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_interfaces_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdInterfacesGetError {
|
|
Status404(models::NotFoundError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_interfaces_mac_delete`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdInterfacesMacDeleteError {
|
|
Status422(models::ValidationError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_interfaces_mac_firewall_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdInterfacesMacFirewallGetError {
|
|
Status404(models::ValidationError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_interfaces_mac_firewall_put`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdInterfacesMacFirewallPutError {
|
|
Status404(models::ValidationError),
|
|
Status422(models::ValidationError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_interfaces_mac_firewall_reapply_post`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdInterfacesMacFirewallReapplyPostError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_interfaces_mac_firewall_restore_copied_policies_post`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdInterfacesMacFirewallRestoreCopiedPoliciesPostError {
|
|
Status404(models::ValidationError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_interfaces_mac_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdInterfacesMacGetError {
|
|
Status404(models::NotFoundError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_interfaces_mac_put`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdInterfacesMacPutError {
|
|
Status404(models::NotFoundError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_interfaces_post`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdInterfacesPostError {
|
|
Status400(models::ValidationError),
|
|
Status422(models::ValidationError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_iso_delete`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdIsoDeleteError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_iso_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdIsoGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_iso_post`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdIsoPostError {
|
|
Status422(models::ValidationError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_isoimages_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdIsoimagesGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_logs_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdLogsGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_metrics_cpu_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdMetricsCpuGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_metrics_disk_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdMetricsDiskGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_metrics_network_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdMetricsNetworkGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_metrics_network_packet_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdMetricsNetworkPacketGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_patch`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdPatchError {
|
|
Status503(models::ResponseError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_rescuesystem_delete`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdRescuesystemDeleteError {
|
|
Status400(models::ResponseError),
|
|
Status404(models::NotFoundError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_rescuesystem_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdRescuesystemGetError {
|
|
Status404(models::NotFoundError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_rescuesystem_post`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdRescuesystemPostError {
|
|
Status400(models::ResponseError),
|
|
Status404(models::NotFoundError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_snapshots_dryrun_post`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdSnapshotsDryrunPostError {
|
|
Status400(Vec<models::ResponseError>),
|
|
Status404(models::NotFoundError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_snapshots_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdSnapshotsGetError {
|
|
Status404(models::NotFoundError),
|
|
Status503(models::ResponseError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_snapshots_name_delete`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdSnapshotsNameDeleteError {
|
|
Status404(models::NotFoundError),
|
|
Status503(models::ResponseError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_snapshots_name_export_post`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdSnapshotsNameExportPostError {
|
|
Status400(models::ResponseError),
|
|
Status404(models::NotFoundError),
|
|
Status503(models::ResponseError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_snapshots_name_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdSnapshotsNameGetError {
|
|
Status404(models::NotFoundError),
|
|
Status503(models::ResponseError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_snapshots_name_revert_post`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdSnapshotsNameRevertPostError {
|
|
Status404(models::NotFoundError),
|
|
Status503(models::ResponseError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_snapshots_post`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdSnapshotsPostError {
|
|
Status400(models::ResponseError),
|
|
Status404(models::NotFoundError),
|
|
Status503(models::ResponseError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_storageoptimization_post`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdStorageoptimizationPostError {
|
|
Status503(models::ResponseError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_servers_server_id_user_image_post`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1ServersServerIdUserImagePostError {
|
|
Status422(models::ValidationError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_tasks_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1TasksGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_tasks_uuid_cancel_put`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1TasksUuidCancelPutError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_tasks_uuid_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1TasksUuidGetError {
|
|
Status404(models::NotFoundError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_failoverips_v4_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdFailoveripsV4GetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_failoverips_v4_id_patch`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdFailoveripsV4IdPatchError {
|
|
Status400(models::ResponseError),
|
|
Status404(models::ResponseError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_failoverips_v6_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdFailoveripsV6GetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_failoverips_v6_id_patch`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdFailoveripsV6IdPatchError {
|
|
Status400(models::ResponseError),
|
|
Status404(models::ResponseError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_firewall_policies_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdFirewallPoliciesGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_firewall_policies_id_delete`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdFirewallPoliciesIdDeleteError {
|
|
Status404(models::ValidationError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_firewall_policies_id_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdFirewallPoliciesIdGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_firewall_policies_id_put`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdFirewallPoliciesIdPutError {
|
|
Status400(models::ResponseError),
|
|
Status422(models::ValidationError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_firewall_policies_post`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdFirewallPoliciesPostError {
|
|
Status400(models::ResponseError),
|
|
Status422(models::ValidationError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdGetError {
|
|
Status404(models::NotFoundError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_images_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdImagesGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_images_key_delete`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdImagesKeyDeleteError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_images_key_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdImagesKeyGetError {
|
|
Status404(models::ResponseError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_images_key_post`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdImagesKeyPostError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_images_key_upload_id_parts_part_number_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdImagesKeyUploadIdPartsPartNumberGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_images_key_upload_id_put`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdImagesKeyUploadIdPutError {
|
|
Status404(models::S3NoSuchUploadError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_isos_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdIsosGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_isos_key_delete`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdIsosKeyDeleteError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_isos_key_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdIsosKeyGetError {
|
|
Status404(models::ResponseError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_isos_key_post`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdIsosKeyPostError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_isos_key_upload_id_parts_part_number_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdIsosKeyUploadIdPartsPartNumberGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_isos_key_upload_id_put`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdIsosKeyUploadIdPutError {
|
|
Status404(models::S3NoSuchUploadError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_logs_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdLogsGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_put`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdPutError {
|
|
Status404(models::NotFoundError),
|
|
Status422(models::ValidationError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_ssh_keys_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdSshKeysGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_ssh_keys_id_delete`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdSshKeysIdDeleteError {
|
|
Status403(models::ResponseError),
|
|
Status404(models::ValidationError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_ssh_keys_post`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdSshKeysPostError {
|
|
Status422(models::ValidationError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_vlans_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdVlansGetError {
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_vlans_vlan_id_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdVlansVlanIdGetError {
|
|
Status404(models::NotFoundError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_users_user_id_vlans_vlan_id_put`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1UsersUserIdVlansVlanIdPutError {
|
|
Status400(models::ResponseError),
|
|
Status404(models::NotFoundError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
/// struct for typed errors of method [`api_v1_vlans_vlan_id_get`]
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ApiV1VlansVlanIdGetError {
|
|
Status404(models::NotFoundError),
|
|
UnknownValue(serde_json::Value),
|
|
}
|
|
|
|
pub async fn api_ping_get(
|
|
configuration: &configuration::Configuration,
|
|
) -> Result<(), Error<ApiPingGetError>> {
|
|
let uri_str = format!("{}/api/ping", configuration.base_path);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
Ok(())
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiPingGetError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_maintenance_get(
|
|
configuration: &configuration::Configuration,
|
|
) -> Result<Vec<models::Maintenance>, Error<ApiV1MaintenanceGetError>> {
|
|
let uri_str = format!("{}/api/v1/maintenance", configuration.base_path);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Maintenance>`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Maintenance>`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1MaintenanceGetError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_openapi_get(
|
|
configuration: &configuration::Configuration,
|
|
) -> Result<serde_json::Value, Error<ApiV1OpenapiGetError>> {
|
|
let uri_str = format!("{}/api/v1/openapi", configuration.base_path);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1OpenapiGetError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_rdns_ipv4_ip_delete(
|
|
configuration: &configuration::Configuration,
|
|
ip: &str,
|
|
) -> Result<(), Error<ApiV1RdnsIpv4IpDeleteError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_ip = ip;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/rdns/ipv4/{ip}",
|
|
configuration.base_path,
|
|
ip = crate::apis::urlencode(p_path_ip)
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::DELETE, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
Ok(())
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1RdnsIpv4IpDeleteError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_rdns_ipv4_ip_get(
|
|
configuration: &configuration::Configuration,
|
|
ip: &str,
|
|
) -> Result<models::RdnsIpv4, Error<ApiV1RdnsIpv4IpGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_ip = ip;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/rdns/ipv4/{ip}",
|
|
configuration.base_path,
|
|
ip = crate::apis::urlencode(p_path_ip)
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RdnsIpv4`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RdnsIpv4`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1RdnsIpv4IpGetError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_rdns_ipv4_post(
|
|
configuration: &configuration::Configuration,
|
|
set_rdns_ipv4: Option<models::SetRdnsIpv4>,
|
|
) -> Result<(), Error<ApiV1RdnsIpv4PostError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_body_set_rdns_ipv4 = set_rdns_ipv4;
|
|
|
|
let uri_str = format!("{}/api/v1/rdns/ipv4", configuration.base_path);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::POST, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
req_builder = req_builder.json(&p_body_set_rdns_ipv4);
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
Ok(())
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1RdnsIpv4PostError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_rdns_ipv6_ip_delete(
|
|
configuration: &configuration::Configuration,
|
|
ip: &str,
|
|
) -> Result<(), Error<ApiV1RdnsIpv6IpDeleteError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_ip = ip;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/rdns/ipv6/{ip}",
|
|
configuration.base_path,
|
|
ip = crate::apis::urlencode(p_path_ip)
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::DELETE, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
Ok(())
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1RdnsIpv6IpDeleteError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_rdns_ipv6_ip_get(
|
|
configuration: &configuration::Configuration,
|
|
ip: &str,
|
|
) -> Result<models::RdnsIpv6, Error<ApiV1RdnsIpv6IpGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_ip = ip;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/rdns/ipv6/{ip}",
|
|
configuration.base_path,
|
|
ip = crate::apis::urlencode(p_path_ip)
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RdnsIpv6`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RdnsIpv6`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1RdnsIpv6IpGetError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_rdns_ipv6_post(
|
|
configuration: &configuration::Configuration,
|
|
set_rdns_ipv6: Option<models::SetRdnsIpv6>,
|
|
) -> Result<(), Error<ApiV1RdnsIpv6PostError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_body_set_rdns_ipv6 = set_rdns_ipv6;
|
|
|
|
let uri_str = format!("{}/api/v1/rdns/ipv6", configuration.base_path);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::POST, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
req_builder = req_builder.json(&p_body_set_rdns_ipv6);
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
Ok(())
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1RdnsIpv6PostError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_get(
|
|
configuration: &configuration::Configuration,
|
|
ip: Option<&str>,
|
|
limit: Option<i32>,
|
|
name: Option<&str>,
|
|
offset: Option<i32>,
|
|
q: Option<&str>,
|
|
) -> Result<Vec<models::ServerListMinimal>, Error<ApiV1ServersGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_query_ip = ip;
|
|
let p_query_limit = limit;
|
|
let p_query_name = name;
|
|
let p_query_offset = offset;
|
|
let p_query_q = q;
|
|
|
|
let uri_str = format!("{}/api/v1/servers", configuration.base_path);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref param_value) = p_query_ip {
|
|
req_builder = req_builder.query(&[("ip", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref param_value) = p_query_limit {
|
|
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref param_value) = p_query_name {
|
|
req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref param_value) = p_query_offset {
|
|
req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref param_value) = p_query_q {
|
|
req_builder = req_builder.query(&[("q", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ServerListMinimal>`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::ServerListMinimal>`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersGetError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_disks_disk_name_format_post(
|
|
configuration: &configuration::Configuration,
|
|
disk_name: &str,
|
|
server_id: i32,
|
|
) -> Result<models::TaskInfo, Error<ApiV1ServersServerIdDisksDiskNameFormatPostError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_disk_name = disk_name;
|
|
let p_path_server_id = server_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/disks/{diskName}:format",
|
|
configuration.base_path,
|
|
diskName = crate::apis::urlencode(p_path_disk_name),
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::POST, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskInfo`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskInfo`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdDisksDiskNameFormatPostError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_disks_disk_name_get(
|
|
configuration: &configuration::Configuration,
|
|
disk_name: &str,
|
|
server_id: i32,
|
|
) -> Result<models::Disk, Error<ApiV1ServersServerIdDisksDiskNameGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_disk_name = disk_name;
|
|
let p_path_server_id = server_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/disks/{diskName}",
|
|
configuration.base_path,
|
|
diskName = crate::apis::urlencode(p_path_disk_name),
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Disk`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Disk`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdDisksDiskNameGetError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_disks_get(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
) -> Result<Vec<models::Disk>, Error<ApiV1ServersServerIdDisksGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/disks",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Disk>`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Disk>`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdDisksGetError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_disks_patch(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
edit_disks_driver: models::EditDisksDriver,
|
|
) -> Result<models::TaskInfo, Error<ApiV1ServersServerIdDisksPatchError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_body_edit_disks_driver = edit_disks_driver;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/disks",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::PATCH, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
req_builder = req_builder.json(&p_body_edit_disks_driver);
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskInfo`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskInfo`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdDisksPatchError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_disks_supported_drivers_get(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
) -> Result<Vec<models::StorageDriver>, Error<ApiV1ServersServerIdDisksSupportedDriversGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/disks/supported-drivers",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::StorageDriver>`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::StorageDriver>`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdDisksSupportedDriversGetError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_get(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
load_server_live_info: Option<bool>,
|
|
) -> Result<models::Server, Error<ApiV1ServersServerIdGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_query_load_server_live_info = load_server_live_info;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref param_value) = p_query_load_server_live_info {
|
|
req_builder = req_builder.query(&[("loadServerLiveInfo", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Server`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Server`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdGetError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_guest_agent_get(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
) -> Result<models::GuestAgentData, Error<ApiV1ServersServerIdGuestAgentGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/guest-agent",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GuestAgentData`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GuestAgentData`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdGuestAgentGetError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_image_post(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
server_image_setup: Option<models::ServerImageSetup>,
|
|
) -> Result<models::TaskInfo, Error<ApiV1ServersServerIdImagePostError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_body_server_image_setup = server_image_setup;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/image",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::POST, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
req_builder = req_builder.json(&p_body_server_image_setup);
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskInfo`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskInfo`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdImagePostError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_imageflavours_get(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
) -> Result<Vec<models::ImageFlavour>, Error<ApiV1ServersServerIdImageflavoursGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/imageflavours",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ImageFlavour>`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::ImageFlavour>`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdImageflavoursGetError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_interfaces_get(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
load_rdns: Option<bool>,
|
|
) -> Result<Vec<models::Interface>, Error<ApiV1ServersServerIdInterfacesGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_query_load_rdns = load_rdns;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/interfaces",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref param_value) = p_query_load_rdns {
|
|
req_builder = req_builder.query(&[("loadRdns", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Interface>`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Interface>`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdInterfacesGetError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_interfaces_mac_delete(
|
|
configuration: &configuration::Configuration,
|
|
mac: &str,
|
|
server_id: i32,
|
|
) -> Result<models::TaskInfo, Error<ApiV1ServersServerIdInterfacesMacDeleteError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_mac = mac;
|
|
let p_path_server_id = server_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/interfaces/{mac}",
|
|
configuration.base_path,
|
|
mac = crate::apis::urlencode(p_path_mac),
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::DELETE, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskInfo`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskInfo`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdInterfacesMacDeleteError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_interfaces_mac_firewall_get(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
mac: &str,
|
|
consistency_check: Option<bool>,
|
|
) -> Result<models::ServerFirewall, Error<ApiV1ServersServerIdInterfacesMacFirewallGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_path_mac = mac;
|
|
let p_query_consistency_check = consistency_check;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/interfaces/{mac}/firewall",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id,
|
|
mac = crate::apis::urlencode(p_path_mac)
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref param_value) = p_query_consistency_check {
|
|
req_builder = req_builder.query(&[("consistencyCheck", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ServerFirewall`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ServerFirewall`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdInterfacesMacFirewallGetError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_interfaces_mac_firewall_put(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
mac: &str,
|
|
server_firewall_save: Option<models::ServerFirewallSave>,
|
|
) -> Result<models::TaskInfo, Error<ApiV1ServersServerIdInterfacesMacFirewallPutError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_path_mac = mac;
|
|
let p_body_server_firewall_save = server_firewall_save;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/interfaces/{mac}/firewall",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id,
|
|
mac = crate::apis::urlencode(p_path_mac)
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
req_builder = req_builder.json(&p_body_server_firewall_save);
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskInfo`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskInfo`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdInterfacesMacFirewallPutError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_interfaces_mac_firewall_reapply_post(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
mac: &str,
|
|
) -> Result<models::TaskInfo, Error<ApiV1ServersServerIdInterfacesMacFirewallReapplyPostError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_path_mac = mac;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/interfaces/{mac}/firewall:reapply",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id,
|
|
mac = crate::apis::urlencode(p_path_mac)
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::POST, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskInfo`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskInfo`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdInterfacesMacFirewallReapplyPostError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_interfaces_mac_firewall_restore_copied_policies_post(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
mac: &str,
|
|
) -> Result<
|
|
models::TaskInfo,
|
|
Error<ApiV1ServersServerIdInterfacesMacFirewallRestoreCopiedPoliciesPostError>,
|
|
> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_path_mac = mac;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/interfaces/{mac}/firewall:restore-copied-policies",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id,
|
|
mac = crate::apis::urlencode(p_path_mac)
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::POST, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskInfo`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskInfo`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<
|
|
ApiV1ServersServerIdInterfacesMacFirewallRestoreCopiedPoliciesPostError,
|
|
> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_interfaces_mac_get(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
mac: &str,
|
|
load_rdns: Option<bool>,
|
|
) -> Result<models::Interface, Error<ApiV1ServersServerIdInterfacesMacGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_path_mac = mac;
|
|
let p_query_load_rdns = load_rdns;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/interfaces/{mac}",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id,
|
|
mac = crate::apis::urlencode(p_path_mac)
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref param_value) = p_query_load_rdns {
|
|
req_builder = req_builder.query(&[("loadRdns", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Interface`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Interface`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdInterfacesMacGetError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_interfaces_mac_put(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
mac: &str,
|
|
server_interface_update: Option<models::ServerInterfaceUpdate>,
|
|
) -> Result<models::TaskInfo, Error<ApiV1ServersServerIdInterfacesMacPutError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_path_mac = mac;
|
|
let p_body_server_interface_update = server_interface_update;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/interfaces/{mac}",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id,
|
|
mac = crate::apis::urlencode(p_path_mac)
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
req_builder = req_builder.json(&p_body_server_interface_update);
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskInfo`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskInfo`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdInterfacesMacPutError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_interfaces_post(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
server_create_nic_vlan: models::ServerCreateNicVlan,
|
|
) -> Result<models::TaskInfo, Error<ApiV1ServersServerIdInterfacesPostError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_body_server_create_nic_vlan = server_create_nic_vlan;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/interfaces",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::POST, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
req_builder = req_builder.json(&p_body_server_create_nic_vlan);
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskInfo`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskInfo`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdInterfacesPostError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_iso_delete(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
) -> Result<(), Error<ApiV1ServersServerIdIsoDeleteError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/iso",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::DELETE, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
Ok(())
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdIsoDeleteError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_iso_get(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
) -> Result<models::Iso, Error<ApiV1ServersServerIdIsoGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/iso",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Iso`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Iso`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdIsoGetError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_iso_post(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
server_attach_iso: Option<models::ServerAttachIso>,
|
|
) -> Result<models::TaskInfo, Error<ApiV1ServersServerIdIsoPostError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_body_server_attach_iso = server_attach_iso;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/iso",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::POST, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
req_builder = req_builder.json(&p_body_server_attach_iso);
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskInfo`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskInfo`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdIsoPostError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_isoimages_get(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
) -> Result<Vec<models::IsoImage>, Error<ApiV1ServersServerIdIsoimagesGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/isoimages",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::IsoImage>`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::IsoImage>`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdIsoimagesGetError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_logs_get(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
limit: Option<i32>,
|
|
offset: Option<i32>,
|
|
) -> Result<Vec<models::Log>, Error<ApiV1ServersServerIdLogsGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_query_limit = limit;
|
|
let p_query_offset = offset;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/logs",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref param_value) = p_query_limit {
|
|
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref param_value) = p_query_offset {
|
|
req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Log>`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Log>`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdLogsGetError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_metrics_cpu_get(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
hours: Option<i32>,
|
|
) -> Result<serde_json::Value, Error<ApiV1ServersServerIdMetricsCpuGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_query_hours = hours;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/metrics/cpu",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref param_value) = p_query_hours {
|
|
req_builder = req_builder.query(&[("hours", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdMetricsCpuGetError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_metrics_disk_get(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
hours: Option<i32>,
|
|
) -> Result<serde_json::Value, Error<ApiV1ServersServerIdMetricsDiskGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_query_hours = hours;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/metrics/disk",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref param_value) = p_query_hours {
|
|
req_builder = req_builder.query(&[("hours", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdMetricsDiskGetError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_metrics_network_get(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
hours: Option<i32>,
|
|
) -> Result<serde_json::Value, Error<ApiV1ServersServerIdMetricsNetworkGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_query_hours = hours;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/metrics/network",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref param_value) = p_query_hours {
|
|
req_builder = req_builder.query(&[("hours", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdMetricsNetworkGetError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_metrics_network_packet_get(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
hours: Option<i32>,
|
|
) -> Result<serde_json::Value, Error<ApiV1ServersServerIdMetricsNetworkPacketGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_query_hours = hours;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/metrics/network/packet",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref param_value) = p_query_hours {
|
|
req_builder = req_builder.query(&[("hours", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdMetricsNetworkPacketGetError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
/// Only one attribute at a time.
|
|
pub async fn api_v1_servers_server_id_patch(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
api_v1_servers_server_id_patch_request: models::ApiV1ServersServerIdPatchRequest,
|
|
state_option: Option<&str>,
|
|
) -> Result<(), Error<ApiV1ServersServerIdPatchError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_body_api_v1_servers_server_id_patch_request = api_v1_servers_server_id_patch_request;
|
|
let p_query_state_option = state_option;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::PATCH, &uri_str);
|
|
|
|
if let Some(ref param_value) = p_query_state_option {
|
|
req_builder = req_builder.query(&[("stateOption", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
req_builder = req_builder
|
|
.body(serde_json::to_string(&p_body_api_v1_servers_server_id_patch_request).unwrap());
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
req_builder = req_builder.header(reqwest::header::ACCEPT, "application/json");
|
|
req_builder = req_builder.header(
|
|
reqwest::header::CONTENT_TYPE,
|
|
"application/merge-patch+json",
|
|
);
|
|
|
|
let req = req_builder.build()?;
|
|
dbg!(req.body().unwrap());
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
Ok(())
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdPatchError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_rescuesystem_delete(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
) -> Result<models::TaskInfo, Error<ApiV1ServersServerIdRescuesystemDeleteError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/rescuesystem",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::DELETE, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskInfo`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskInfo`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdRescuesystemDeleteError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_rescuesystem_get(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
) -> Result<models::RescueSystemStatus, Error<ApiV1ServersServerIdRescuesystemGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/rescuesystem",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RescueSystemStatus`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RescueSystemStatus`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdRescuesystemGetError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_rescuesystem_post(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
) -> Result<models::TaskInfo, Error<ApiV1ServersServerIdRescuesystemPostError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/rescuesystem",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::POST, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskInfo`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskInfo`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdRescuesystemPostError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_snapshots_dryrun_post(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
server_snapshot_create_check: Option<models::ServerSnapshotCreateCheck>,
|
|
) -> Result<Vec<models::ResponseError>, Error<ApiV1ServersServerIdSnapshotsDryrunPostError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_body_server_snapshot_create_check = server_snapshot_create_check;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/snapshots:dryrun",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::POST, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
req_builder = req_builder.json(&p_body_server_snapshot_create_check);
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ResponseError>`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::ResponseError>`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdSnapshotsDryrunPostError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_snapshots_get(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
) -> Result<Vec<models::SnapshotMinimal>, Error<ApiV1ServersServerIdSnapshotsGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/snapshots",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::SnapshotMinimal>`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::SnapshotMinimal>`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdSnapshotsGetError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_snapshots_name_delete(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
name: &str,
|
|
) -> Result<models::TaskInfo, Error<ApiV1ServersServerIdSnapshotsNameDeleteError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_path_name = name;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/snapshots/{name}",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id,
|
|
name = crate::apis::urlencode(p_path_name)
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::DELETE, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskInfo`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskInfo`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdSnapshotsNameDeleteError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_snapshots_name_export_post(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
name: &str,
|
|
) -> Result<models::TaskInfo, Error<ApiV1ServersServerIdSnapshotsNameExportPostError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_path_name = name;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/snapshots/{name}/export",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id,
|
|
name = crate::apis::urlencode(p_path_name)
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::POST, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskInfo`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskInfo`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdSnapshotsNameExportPostError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_snapshots_name_get(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
name: &str,
|
|
) -> Result<models::Snapshot, Error<ApiV1ServersServerIdSnapshotsNameGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_path_name = name;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/snapshots/{name}",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id,
|
|
name = crate::apis::urlencode(p_path_name)
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Snapshot`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Snapshot`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdSnapshotsNameGetError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_snapshots_name_revert_post(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
name: &str,
|
|
) -> Result<models::TaskInfo, Error<ApiV1ServersServerIdSnapshotsNameRevertPostError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_path_name = name;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/snapshots/{name}/revert",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id,
|
|
name = crate::apis::urlencode(p_path_name)
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::POST, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskInfo`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskInfo`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdSnapshotsNameRevertPostError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_snapshots_post(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
server_snapshot_create: Option<models::ServerSnapshotCreate>,
|
|
) -> Result<models::TaskInfo, Error<ApiV1ServersServerIdSnapshotsPostError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_body_server_snapshot_create = server_snapshot_create;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/snapshots",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::POST, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
req_builder = req_builder.json(&p_body_server_snapshot_create);
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskInfo`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskInfo`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdSnapshotsPostError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_storageoptimization_post(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
disks: Option<Vec<String>>,
|
|
start_after_optimization: Option<bool>,
|
|
) -> Result<models::TaskInfo, Error<ApiV1ServersServerIdStorageoptimizationPostError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_query_disks = disks;
|
|
let p_query_start_after_optimization = start_after_optimization;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/storageoptimization",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::POST, &uri_str);
|
|
|
|
if let Some(ref param_value) = p_query_disks {
|
|
req_builder = match "multi" {
|
|
"multi" => req_builder.query(
|
|
¶m_value
|
|
.into_iter()
|
|
.map(|p| ("disks".to_owned(), p.to_string()))
|
|
.collect::<Vec<(std::string::String, std::string::String)>>(),
|
|
),
|
|
_ => req_builder.query(&[(
|
|
"disks",
|
|
¶m_value
|
|
.into_iter()
|
|
.map(|p| p.to_string())
|
|
.collect::<Vec<String>>()
|
|
.join(",")
|
|
.to_string(),
|
|
)]),
|
|
};
|
|
}
|
|
if let Some(ref param_value) = p_query_start_after_optimization {
|
|
req_builder = req_builder.query(&[("startAfterOptimization", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskInfo`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskInfo`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdStorageoptimizationPostError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_servers_server_id_user_image_post(
|
|
configuration: &configuration::Configuration,
|
|
server_id: i32,
|
|
server_user_image_setup: Option<models::ServerUserImageSetup>,
|
|
) -> Result<models::TaskInfo, Error<ApiV1ServersServerIdUserImagePostError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_server_id = server_id;
|
|
let p_body_server_user_image_setup = server_user_image_setup;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/servers/{serverId}/user-image",
|
|
configuration.base_path,
|
|
serverId = p_path_server_id
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::POST, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
req_builder = req_builder.json(&p_body_server_user_image_setup);
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskInfo`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskInfo`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1ServersServerIdUserImagePostError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_tasks_get(
|
|
configuration: &configuration::Configuration,
|
|
limit: Option<i32>,
|
|
offset: Option<i32>,
|
|
q: Option<&str>,
|
|
server_id: Option<i32>,
|
|
state: Option<models::TaskState>,
|
|
) -> Result<Vec<models::TaskInfoMinimal>, Error<ApiV1TasksGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_query_limit = limit;
|
|
let p_query_offset = offset;
|
|
let p_query_q = q;
|
|
let p_query_server_id = server_id;
|
|
let p_query_state = state;
|
|
|
|
let uri_str = format!("{}/api/v1/tasks", configuration.base_path);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref param_value) = p_query_limit {
|
|
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref param_value) = p_query_offset {
|
|
req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref param_value) = p_query_q {
|
|
req_builder = req_builder.query(&[("q", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref param_value) = p_query_server_id {
|
|
req_builder = req_builder.query(&[("serverId", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref param_value) = p_query_state {
|
|
req_builder = req_builder.query(&[("state", &serde_json::to_string(param_value)?)]);
|
|
}
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::TaskInfoMinimal>`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::TaskInfoMinimal>`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1TasksGetError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_tasks_uuid_cancel_put(
|
|
configuration: &configuration::Configuration,
|
|
uuid: &str,
|
|
) -> Result<models::TaskInfo, Error<ApiV1TasksUuidCancelPutError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_uuid = uuid;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/tasks/{uuid}:cancel",
|
|
configuration.base_path,
|
|
uuid = crate::apis::urlencode(p_path_uuid)
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskInfo`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskInfo`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1TasksUuidCancelPutError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_tasks_uuid_get(
|
|
configuration: &configuration::Configuration,
|
|
uuid: &str,
|
|
) -> Result<models::TaskInfo, Error<ApiV1TasksUuidGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_uuid = uuid;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/tasks/{uuid}",
|
|
configuration.base_path,
|
|
uuid = crate::apis::urlencode(p_path_uuid)
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskInfo`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskInfo`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1TasksUuidGetError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_failoverips_v4_get(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
ip: Option<&str>,
|
|
server_id: Option<i32>,
|
|
) -> Result<Vec<models::FailoverIpv4>, Error<ApiV1UsersUserIdFailoveripsV4GetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_query_ip = ip;
|
|
let p_query_server_id = server_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/failoverips/v4",
|
|
configuration.base_path,
|
|
userId = p_path_user_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref param_value) = p_query_ip {
|
|
req_builder = req_builder.query(&[("ip", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref param_value) = p_query_server_id {
|
|
req_builder = req_builder.query(&[("serverId", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::FailoverIpv4>`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::FailoverIpv4>`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdFailoveripsV4GetError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_failoverips_v4_id_patch(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
id: i32,
|
|
route_failover_ip: Option<models::RouteFailoverIp>,
|
|
) -> Result<models::TaskInfo, Error<ApiV1UsersUserIdFailoveripsV4IdPatchError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_path_id = id;
|
|
let p_body_route_failover_ip = route_failover_ip;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/failoverips/v4/{id}",
|
|
configuration.base_path,
|
|
userId = p_path_user_id,
|
|
id = p_path_id
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::PATCH, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
req_builder = req_builder.json(&p_body_route_failover_ip);
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskInfo`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskInfo`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdFailoveripsV4IdPatchError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_failoverips_v6_get(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
ip: Option<&str>,
|
|
server_id: Option<i32>,
|
|
) -> Result<Vec<models::FailoverIpv6>, Error<ApiV1UsersUserIdFailoveripsV6GetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_query_ip = ip;
|
|
let p_query_server_id = server_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/failoverips/v6",
|
|
configuration.base_path,
|
|
userId = p_path_user_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref param_value) = p_query_ip {
|
|
req_builder = req_builder.query(&[("ip", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref param_value) = p_query_server_id {
|
|
req_builder = req_builder.query(&[("serverId", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::FailoverIpv6>`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::FailoverIpv6>`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdFailoveripsV6GetError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_failoverips_v6_id_patch(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
id: i32,
|
|
route_failover_ip: Option<models::RouteFailoverIp>,
|
|
) -> Result<models::TaskInfo, Error<ApiV1UsersUserIdFailoveripsV6IdPatchError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_path_id = id;
|
|
let p_body_route_failover_ip = route_failover_ip;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/failoverips/v6/{id}",
|
|
configuration.base_path,
|
|
userId = p_path_user_id,
|
|
id = p_path_id
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::PATCH, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
req_builder = req_builder.json(&p_body_route_failover_ip);
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TaskInfo`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TaskInfo`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdFailoveripsV6IdPatchError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_firewall_policies_get(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
limit: Option<i32>,
|
|
offset: Option<i32>,
|
|
q: Option<&str>,
|
|
) -> Result<Vec<models::FirewallPolicy>, Error<ApiV1UsersUserIdFirewallPoliciesGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_query_limit = limit;
|
|
let p_query_offset = offset;
|
|
let p_query_q = q;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/firewall-policies",
|
|
configuration.base_path,
|
|
userId = p_path_user_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref param_value) = p_query_limit {
|
|
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref param_value) = p_query_offset {
|
|
req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref param_value) = p_query_q {
|
|
req_builder = req_builder.query(&[("q", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::FirewallPolicy>`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::FirewallPolicy>`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdFirewallPoliciesGetError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_firewall_policies_id_delete(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
id: i32,
|
|
) -> Result<(), Error<ApiV1UsersUserIdFirewallPoliciesIdDeleteError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_path_id = id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/firewall-policies/{id}",
|
|
configuration.base_path,
|
|
userId = p_path_user_id,
|
|
id = p_path_id
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::DELETE, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
Ok(())
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdFirewallPoliciesIdDeleteError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_firewall_policies_id_get(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
id: i32,
|
|
with_count_of_affected_servers: Option<bool>,
|
|
) -> Result<models::FirewallPolicy, Error<ApiV1UsersUserIdFirewallPoliciesIdGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_path_id = id;
|
|
let p_query_with_count_of_affected_servers = with_count_of_affected_servers;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/firewall-policies/{id}",
|
|
configuration.base_path,
|
|
userId = p_path_user_id,
|
|
id = p_path_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref param_value) = p_query_with_count_of_affected_servers {
|
|
req_builder =
|
|
req_builder.query(&[("withCountOfAffectedServers", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FirewallPolicy`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::FirewallPolicy`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdFirewallPoliciesIdGetError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_firewall_policies_id_put(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
id: i32,
|
|
firewall_policy_save: Option<models::FirewallPolicySave>,
|
|
) -> Result<models::FirewallPolicyUpdateResult, Error<ApiV1UsersUserIdFirewallPoliciesIdPutError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_path_id = id;
|
|
let p_body_firewall_policy_save = firewall_policy_save;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/firewall-policies/{id}",
|
|
configuration.base_path,
|
|
userId = p_path_user_id,
|
|
id = p_path_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
req_builder = req_builder.json(&p_body_firewall_policy_save);
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FirewallPolicyUpdateResult`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::FirewallPolicyUpdateResult`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdFirewallPoliciesIdPutError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_firewall_policies_post(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
firewall_policy_save: Option<models::FirewallPolicySave>,
|
|
) -> Result<models::FirewallPolicy, Error<ApiV1UsersUserIdFirewallPoliciesPostError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_body_firewall_policy_save = firewall_policy_save;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/firewall-policies",
|
|
configuration.base_path,
|
|
userId = p_path_user_id
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::POST, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
req_builder = req_builder.json(&p_body_firewall_policy_save);
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::FirewallPolicy`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::FirewallPolicy`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdFirewallPoliciesPostError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_get(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
) -> Result<models::User, Error<ApiV1UsersUserIdGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}",
|
|
configuration.base_path,
|
|
userId = p_path_user_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::User`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::User`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdGetError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_images_get(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
) -> Result<Vec<models::S3Object>, Error<ApiV1UsersUserIdImagesGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/images",
|
|
configuration.base_path,
|
|
userId = p_path_user_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::S3Object>`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::S3Object>`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdImagesGetError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_images_key_delete(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
key: &str,
|
|
) -> Result<(), Error<ApiV1UsersUserIdImagesKeyDeleteError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_path_key = key;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/images/{key}",
|
|
configuration.base_path,
|
|
userId = p_path_user_id,
|
|
key = crate::apis::urlencode(p_path_key)
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::DELETE, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
Ok(())
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdImagesKeyDeleteError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_images_key_get(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
key: &str,
|
|
) -> Result<models::S3DownloadInfos, Error<ApiV1UsersUserIdImagesKeyGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_path_key = key;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/images/{key}",
|
|
configuration.base_path,
|
|
userId = p_path_user_id,
|
|
key = crate::apis::urlencode(p_path_key)
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::S3DownloadInfos`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::S3DownloadInfos`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdImagesKeyGetError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
/// If \"multipart=true\", returns \"uploadId\" that is used to fetch upload URLs for each part with \"GET /api/v1/users/{userId}/images/{key}/{uploadId}/parts/{partNumber}\". Use this URL to upload individual parts and get an \"ETag\" for each part. To finish, call \"PUT /api/v1/users/{userId}/images/{key}/{uploadId}\" with the list of all uploaded parts, containing \"ETag\" and \"partNumber\" for each part. Part numbers start at 1. If \"multipart=false\", returns \"presignedUrl\" that is used to upload the image at once.
|
|
pub async fn api_v1_users_user_id_images_key_post(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
key: &str,
|
|
multipart: Option<bool>,
|
|
) -> Result<models::S3Upload, Error<ApiV1UsersUserIdImagesKeyPostError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_path_key = key;
|
|
let p_query_multipart = multipart;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/images/{key}",
|
|
configuration.base_path,
|
|
userId = p_path_user_id,
|
|
key = crate::apis::urlencode(p_path_key)
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::POST, &uri_str);
|
|
|
|
if let Some(ref param_value) = p_query_multipart {
|
|
req_builder = req_builder.query(&[("multipart", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::S3Upload`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::S3Upload`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdImagesKeyPostError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
/// Call this endpoint for every part. Use the returned URL to upload the part and get an \"ETag\" from the HTTP headers in return. Once all parts are uploaded, call \"PUT /api/v1/users/{userId}/images/{key}/{uploadId}\" with the list of all uploaded parts, containing \"ETag\" and \"partNumber\" for each part.
|
|
pub async fn api_v1_users_user_id_images_key_upload_id_parts_part_number_get(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
key: &str,
|
|
part_number: i32,
|
|
upload_id: &str,
|
|
) -> Result<models::S3SignPartUrl, Error<ApiV1UsersUserIdImagesKeyUploadIdPartsPartNumberGetError>>
|
|
{
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_path_key = key;
|
|
let p_path_part_number = part_number;
|
|
let p_path_upload_id = upload_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/images/{key}/{uploadId}/parts/{partNumber}",
|
|
configuration.base_path,
|
|
userId = p_path_user_id,
|
|
key = crate::apis::urlencode(p_path_key),
|
|
partNumber = p_path_part_number,
|
|
uploadId = crate::apis::urlencode(p_path_upload_id)
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::S3SignPartUrl`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::S3SignPartUrl`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdImagesKeyUploadIdPartsPartNumberGetError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
/// Call this endpoint after uploading all parts. The body must include a list of parts \"ETag\" and \"partNumber\" in order. This finishes the upload and makes the image available with the provided \"key\".
|
|
pub async fn api_v1_users_user_id_images_key_upload_id_put(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
key: &str,
|
|
upload_id: &str,
|
|
s3_completed_part: Option<Vec<models::S3CompletedPart>>,
|
|
) -> Result<(), Error<ApiV1UsersUserIdImagesKeyUploadIdPutError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_path_key = key;
|
|
let p_path_upload_id = upload_id;
|
|
let p_body_s3_completed_part = s3_completed_part;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/images/{key}/{uploadId}",
|
|
configuration.base_path,
|
|
userId = p_path_user_id,
|
|
key = crate::apis::urlencode(p_path_key),
|
|
uploadId = crate::apis::urlencode(p_path_upload_id)
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
req_builder = req_builder.json(&p_body_s3_completed_part);
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
Ok(())
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdImagesKeyUploadIdPutError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_isos_get(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
) -> Result<Vec<models::S3Object>, Error<ApiV1UsersUserIdIsosGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/isos",
|
|
configuration.base_path,
|
|
userId = p_path_user_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::S3Object>`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::S3Object>`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdIsosGetError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_isos_key_delete(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
key: &str,
|
|
) -> Result<(), Error<ApiV1UsersUserIdIsosKeyDeleteError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_path_key = key;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/isos/{key}",
|
|
configuration.base_path,
|
|
userId = p_path_user_id,
|
|
key = crate::apis::urlencode(p_path_key)
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::DELETE, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
Ok(())
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdIsosKeyDeleteError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_isos_key_get(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
key: &str,
|
|
) -> Result<models::S3DownloadInfos, Error<ApiV1UsersUserIdIsosKeyGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_path_key = key;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/isos/{key}",
|
|
configuration.base_path,
|
|
userId = p_path_user_id,
|
|
key = crate::apis::urlencode(p_path_key)
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::S3DownloadInfos`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::S3DownloadInfos`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdIsosKeyGetError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
/// If \"multipart=true\", returns \"uploadId\" that is used to fetch upload URLs for each part with \"GET /api/v1/users/{userId}/isos/{key}/{uploadId}/parts/{partNumber}\". Use this URL to upload individual parts and get an \"ETag\" for each part. To finish, call \"PUT /api/v1/users/{userId}/isos/{key}/{uploadId}\" with the list of all uploaded parts, containing \"ETag\" and \"partNumber\" for each part. Part numbers start at 1. If \"multipart=false\", returns \"presignedUrl\" that is used to upload the ISO at once.
|
|
pub async fn api_v1_users_user_id_isos_key_post(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
key: &str,
|
|
multipart: Option<bool>,
|
|
) -> Result<models::S3Upload, Error<ApiV1UsersUserIdIsosKeyPostError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_path_key = key;
|
|
let p_query_multipart = multipart;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/isos/{key}",
|
|
configuration.base_path,
|
|
userId = p_path_user_id,
|
|
key = crate::apis::urlencode(p_path_key)
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::POST, &uri_str);
|
|
|
|
if let Some(ref param_value) = p_query_multipart {
|
|
req_builder = req_builder.query(&[("multipart", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::S3Upload`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::S3Upload`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdIsosKeyPostError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
/// Call this endpoint for every part. Use the returned URL to upload the part and get an \"ETag\" from the HTTP headers in return. Once all parts are uploaded, call \"PUT /api/v1/users/{userId}/isos/{key}/{uploadId}\" with the list of all uploaded parts, containing \"ETag\" and \"partNumber\" for each part.
|
|
pub async fn api_v1_users_user_id_isos_key_upload_id_parts_part_number_get(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
key: &str,
|
|
part_number: i32,
|
|
upload_id: &str,
|
|
) -> Result<models::S3SignPartUrl, Error<ApiV1UsersUserIdIsosKeyUploadIdPartsPartNumberGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_path_key = key;
|
|
let p_path_part_number = part_number;
|
|
let p_path_upload_id = upload_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/isos/{key}/{uploadId}/parts/{partNumber}",
|
|
configuration.base_path,
|
|
userId = p_path_user_id,
|
|
key = crate::apis::urlencode(p_path_key),
|
|
partNumber = p_path_part_number,
|
|
uploadId = crate::apis::urlencode(p_path_upload_id)
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::S3SignPartUrl`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::S3SignPartUrl`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdIsosKeyUploadIdPartsPartNumberGetError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
/// Call this endpoint after uploading all parts. The body must include a list of parts \"ETag\" and \"partNumber\" in order. This finishes the upload and makes the ISO available with the provided \"key\".
|
|
pub async fn api_v1_users_user_id_isos_key_upload_id_put(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
key: &str,
|
|
upload_id: &str,
|
|
s3_completed_part: Option<Vec<models::S3CompletedPart>>,
|
|
) -> Result<(), Error<ApiV1UsersUserIdIsosKeyUploadIdPutError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_path_key = key;
|
|
let p_path_upload_id = upload_id;
|
|
let p_body_s3_completed_part = s3_completed_part;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/isos/{key}/{uploadId}",
|
|
configuration.base_path,
|
|
userId = p_path_user_id,
|
|
key = crate::apis::urlencode(p_path_key),
|
|
uploadId = crate::apis::urlencode(p_path_upload_id)
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
req_builder = req_builder.json(&p_body_s3_completed_part);
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
Ok(())
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdIsosKeyUploadIdPutError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_logs_get(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
limit: Option<i32>,
|
|
offset: Option<i32>,
|
|
) -> Result<Vec<models::Log>, Error<ApiV1UsersUserIdLogsGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_query_limit = limit;
|
|
let p_query_offset = offset;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/logs",
|
|
configuration.base_path,
|
|
userId = p_path_user_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref param_value) = p_query_limit {
|
|
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref param_value) = p_query_offset {
|
|
req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Log>`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Log>`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdLogsGetError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_put(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
user_save: Option<models::UserSave>,
|
|
) -> Result<models::UserSave, Error<ApiV1UsersUserIdPutError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_body_user_save = user_save;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}",
|
|
configuration.base_path,
|
|
userId = p_path_user_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
req_builder = req_builder.json(&p_body_user_save);
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UserSave`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UserSave`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdPutError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_ssh_keys_get(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
) -> Result<Vec<models::SshKey>, Error<ApiV1UsersUserIdSshKeysGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/ssh-keys",
|
|
configuration.base_path,
|
|
userId = p_path_user_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::SshKey>`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::SshKey>`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdSshKeysGetError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_ssh_keys_id_delete(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
id: i32,
|
|
) -> Result<(), Error<ApiV1UsersUserIdSshKeysIdDeleteError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_path_id = id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/ssh-keys/{id}",
|
|
configuration.base_path,
|
|
userId = p_path_user_id,
|
|
id = p_path_id
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::DELETE, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
Ok(())
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdSshKeysIdDeleteError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_ssh_keys_post(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
ssh_key: Option<models::SshKey>,
|
|
) -> Result<models::SshKey, Error<ApiV1UsersUserIdSshKeysPostError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_body_ssh_key = ssh_key;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/ssh-keys",
|
|
configuration.base_path,
|
|
userId = p_path_user_id
|
|
);
|
|
let mut req_builder = configuration
|
|
.client
|
|
.request(reqwest::Method::POST, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
req_builder = req_builder.json(&p_body_ssh_key);
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SshKey`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SshKey`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdSshKeysPostError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_vlans_get(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
server_id: Option<i32>,
|
|
) -> Result<Vec<models::VLan>, Error<ApiV1UsersUserIdVlansGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_query_server_id = server_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/vlans",
|
|
configuration.base_path,
|
|
userId = p_path_user_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref param_value) = p_query_server_id {
|
|
req_builder = req_builder.query(&[("serverId", ¶m_value.to_string())]);
|
|
}
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::VLan>`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::VLan>`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdVlansGetError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_vlans_vlan_id_get(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
vlan_id: i32,
|
|
) -> Result<models::VLan, Error<ApiV1UsersUserIdVlansVlanIdGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_path_vlan_id = vlan_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/vlans/{vlanId}",
|
|
configuration.base_path,
|
|
userId = p_path_user_id,
|
|
vlanId = p_path_vlan_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::VLan`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::VLan`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdVlansVlanIdGetError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_users_user_id_vlans_vlan_id_put(
|
|
configuration: &configuration::Configuration,
|
|
user_id: i32,
|
|
vlan_id: i32,
|
|
v_lan_save: Option<models::VLanSave>,
|
|
) -> Result<(), Error<ApiV1UsersUserIdVlansVlanIdPutError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_user_id = user_id;
|
|
let p_path_vlan_id = vlan_id;
|
|
let p_body_v_lan_save = v_lan_save;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/users/{userId}/vlans/{vlanId}",
|
|
configuration.base_path,
|
|
userId = p_path_user_id,
|
|
vlanId = p_path_vlan_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
req_builder = req_builder.json(&p_body_v_lan_save);
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
Ok(())
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1UsersUserIdVlansVlanIdPutError> =
|
|
serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|
|
|
|
///
|
|
pub async fn api_v1_vlans_vlan_id_get(
|
|
configuration: &configuration::Configuration,
|
|
vlan_id: i32,
|
|
) -> Result<models::VLan, Error<ApiV1VlansVlanIdGetError>> {
|
|
// add a prefix to parameters to efficiently prevent name collisions
|
|
let p_path_vlan_id = vlan_id;
|
|
|
|
let uri_str = format!(
|
|
"{}/api/v1/vlans/{vlanId}",
|
|
configuration.base_path,
|
|
vlanId = p_path_vlan_id
|
|
);
|
|
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
|
|
|
if let Some(ref user_agent) = configuration.user_agent {
|
|
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
|
}
|
|
|
|
if let Some(ref token) = configuration.bearer_access_token {
|
|
req_builder =
|
|
req_builder.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", token));
|
|
}
|
|
|
|
let req = req_builder.build()?;
|
|
let resp = configuration.client.execute(req).await?;
|
|
|
|
let status = resp.status();
|
|
let content_type = resp
|
|
.headers()
|
|
.get("content-type")
|
|
.and_then(|v| v.to_str().ok())
|
|
.unwrap_or("application/octet-stream");
|
|
let content_type = super::ContentType::from(content_type);
|
|
|
|
if !status.is_client_error() && !status.is_server_error() {
|
|
let content = resp.text().await?;
|
|
match content_type {
|
|
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
|
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::VLan`"))),
|
|
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::VLan`")))),
|
|
}
|
|
} else {
|
|
let content = resp.text().await?;
|
|
let entity: Option<ApiV1VlansVlanIdGetError> = serde_json::from_str(&content).ok();
|
|
Err(Error::ResponseError(ResponseContent {
|
|
status,
|
|
content,
|
|
entity,
|
|
}))
|
|
}
|
|
}
|