Struct outline_api::OutlineVPN
source · pub struct OutlineVPN<'a> { /* private fields */ }
Expand description
Represents a client for interacting with the Outline VPN Server API.
The OutlineVPN
struct provides methods to perform various operations on the Outline VPN server
such as retrieving server information, changing settings, creating access keys, and more.
Fields
api_url
: A reference to a string representing the URL (includingsecret
) of the Outline VPN server API.session
: A reqwest HTTP client used to make API requests.request_timeout_in_sec
: The time to set the timeout for API requests.
Implementations§
source§impl OutlineVPN<'_>
impl OutlineVPN<'_>
sourcepub fn get_server_info(&self) -> Result<Value, String>
pub fn get_server_info(&self) -> Result<Value, String>
Get server information.
Responses:
200
– Server information.
sourcepub fn change_hostname_for_access_keys(
&self,
hostname: &str
) -> Result<(), String>
pub fn change_hostname_for_access_keys( &self, hostname: &str ) -> Result<(), String>
Change hostname for access keys.
Responses:
204
– The hostname was successfully changed.400
– An invalid hostname or IP address was provided.500
– An internal error occurred. This could be thrown if there were network errors while validating the hostname.
sourcepub fn change_default_port_for_newly_created_access(
&self,
port: &str
) -> Result<(), String>
pub fn change_default_port_for_newly_created_access( &self, port: &str ) -> Result<(), String>
Change default port for newly created access keys.
Responses:
204
– The default port was successfully changed.400
– The requested port wasn’t an integer from 1 through 65535, or the request had no port parameter.409
– The requested port was already in use by another service.
sourcepub fn set_data_transfer_limit_for_all_access_keys(
&self,
byte: &u64
) -> Result<(), String>
pub fn set_data_transfer_limit_for_all_access_keys( &self, byte: &u64 ) -> Result<(), String>
Set data transfer limit (in bytes) for all access keys.
Responses:
204
– Access key data limit set successfully.400
– Invalid data limit.
sourcepub fn remove_data_limit_for_all_access_keys(&self) -> Result<(), String>
pub fn remove_data_limit_for_all_access_keys(&self) -> Result<(), String>
Remove data transfer limit for all access keys.
Responses:
204
– Access key limit deleted successfully.
sourcepub fn rename_server(&self, name: &str) -> Result<(), String>
pub fn rename_server(&self, name: &str) -> Result<(), String>
Rename server.
Responses:
204
– Server renamed successfully.400
– Invalid name.
sourcepub fn create_access_key(&self) -> Result<Value, String>
pub fn create_access_key(&self) -> Result<Value, String>
Create new access key.
Responses:
201
– The newly created access key.
sourcepub fn list_access_keys(&self) -> Result<Value, String>
pub fn list_access_keys(&self) -> Result<Value, String>
Display complete list of the access keys.
Responses:
200
– List of access keys.
sourcepub fn delete_access_key_by_id(&self, id: &u16) -> Result<(), String>
pub fn delete_access_key_by_id(&self, id: &u16) -> Result<(), String>
Delete access key by ID.
Responses:
204
– Access key deleted successfully.404
– Access key inexistent.
sourcepub fn change_name_for_access_key(
&self,
id: &u16,
username: &str
) -> Result<(), String>
pub fn change_name_for_access_key( &self, id: &u16, username: &str ) -> Result<(), String>
Change name for access key (by ID).
Responses:
204
– Access key renamed successfully.404
– Access key inexistent.
sourcepub fn set_data_transfer_limit_by_id(
&self,
id: &u16,
byte: &u64
) -> Result<(), String>
pub fn set_data_transfer_limit_by_id( &self, id: &u16, byte: &u64 ) -> Result<(), String>
Set data transfer limit by ID.
Responses:
204
– Access key limit set successfully.400
– Invalid data limit.404
– Access key inexistent.
sourcepub fn del_data_transfer_limit_by_id(&self, id: &u16) -> Result<(), String>
pub fn del_data_transfer_limit_by_id(&self, id: &u16) -> Result<(), String>
Remove data transfer limit by ID.
Responses:
204
– Access key limit deleted successfully.404
– Access key inexistent.
sourcepub fn get_each_access_key_data_transferred(&self) -> Result<Value, String>
pub fn get_each_access_key_data_transferred(&self) -> Result<Value, String>
Get data transfer stats for each access key in bytes.
Responses:
200
– The data transferred by each access key.
Get ‘Share anonymous metrics’ status.
Responses:
200
– The metrics enabled setting.