pub struct Remote { /* private fields */ }
Implementations§
source§impl Remote
impl Remote
sourcepub fn new<N: BnStrCompatible, A: BnStrCompatible>(
name: N,
address: A,
) -> Ref<Self>
pub fn new<N: BnStrCompatible, A: BnStrCompatible>( name: N, address: A, ) -> Ref<Self>
Create a Remote and add it to the list of known remotes (saved to Settings)
sourcepub fn get_for_local_database(
database: &Database,
) -> Result<Option<Ref<Remote>>, ()>
pub fn get_for_local_database( database: &Database, ) -> Result<Option<Ref<Remote>>, ()>
Get the Remote for a Database
sourcepub fn get_for_binary_view(bv: &BinaryView) -> Result<Option<Ref<Remote>>, ()>
pub fn get_for_binary_view(bv: &BinaryView) -> Result<Option<Ref<Remote>>, ()>
Get the Remote for a Binary View
sourcepub fn has_loaded_metadata(&self) -> bool
pub fn has_loaded_metadata(&self) -> bool
Checks if the remote has pulled metadata like its id, etc.
sourcepub fn unique_id(&self) -> Result<BnString, ()>
pub fn unique_id(&self) -> Result<BnString, ()>
Gets the unique id. If metadata has not been pulled, it will be pulled upon calling this.
sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Checks if the remote is connected.
sourcepub fn server_version(&self) -> Result<i32, ()>
pub fn server_version(&self) -> Result<i32, ()>
Gets the server version. If metadata has not been pulled, it will be pulled upon calling this.
sourcepub fn server_build_id(&self) -> Result<BnString, ()>
pub fn server_build_id(&self) -> Result<BnString, ()>
Gets the server build id. If metadata has not been pulled, it will be pulled upon calling this.
sourcepub fn auth_backends(&self) -> Result<(Array<BnString>, Array<BnString>), ()>
pub fn auth_backends(&self) -> Result<(Array<BnString>, Array<BnString>), ()>
Gets the list of supported authentication backends on the server. If metadata has not been pulled, it will be pulled upon calling this.
sourcepub fn is_enterprise(&self) -> Result<bool, ()>
pub fn is_enterprise(&self) -> Result<bool, ()>
Checks if the remote is the same as the Enterprise License server.
sourcepub fn load_metadata(&self) -> Result<(), ()>
pub fn load_metadata(&self) -> Result<(), ()>
Loads metadata from the remote, including unique id and versions.
sourcepub fn request_authentication_token<U: BnStrCompatible, P: BnStrCompatible>(
&self,
username: U,
password: P,
) -> Option<BnString>
pub fn request_authentication_token<U: BnStrCompatible, P: BnStrCompatible>( &self, username: U, password: P, ) -> Option<BnString>
Requests an authentication token using a username and password.
sourcepub fn connect(&self) -> Result<(), ()>
pub fn connect(&self) -> Result<(), ()>
Connects to the Remote, loading metadata and optionally acquiring a token.
Use Remote::connect_with_opts if you cannot otherwise automatically connect using enterprise.
WARNING: This is currently not thread safe, if you try and connect/disconnect to a remote on
multiple threads you will be subject to race conditions. To avoid this wrap the Remote
in
a synchronization primitive, and pass that to your threads. Or don’t try and connect on multiple threads.
pub fn connect_with_opts(&self, options: ConnectionOptions) -> Result<(), ()>
sourcepub fn disconnect(&self) -> Result<(), ()>
pub fn disconnect(&self) -> Result<(), ()>
Disconnects from the remote.
WARNING: This is currently not thread safe, if you try and connect/disconnect to a remote on
multiple threads you will be subject to race conditions. To avoid this wrap the Remote
in
a synchronization primitive, and pass that to your threads. Or don’t try and connect on multiple threads.
sourcepub fn has_pulled_projects(&self) -> bool
pub fn has_pulled_projects(&self) -> bool
Checks if the project has pulled the projects yet.
sourcepub fn has_pulled_groups(&self) -> bool
pub fn has_pulled_groups(&self) -> bool
Checks if the project has pulled the groups yet.
sourcepub fn has_pulled_users(&self) -> bool
pub fn has_pulled_users(&self) -> bool
Checks if the project has pulled the users yet.
sourcepub fn projects(&self) -> Result<Array<RemoteProject>, ()>
pub fn projects(&self) -> Result<Array<RemoteProject>, ()>
Gets the list of projects in this project.
NOTE: If projects have not been pulled, they will be pulled upon calling this.
sourcepub fn get_project_by_id<S: BnStrCompatible>(
&self,
id: S,
) -> Result<Option<Ref<RemoteProject>>, ()>
pub fn get_project_by_id<S: BnStrCompatible>( &self, id: S, ) -> Result<Option<Ref<RemoteProject>>, ()>
Gets a specific project in the Remote by its id.
NOTE: If projects have not been pulled, they will be pulled upon calling this.
sourcepub fn get_project_by_name<S: BnStrCompatible>(
&self,
name: S,
) -> Result<Option<Ref<RemoteProject>>, ()>
pub fn get_project_by_name<S: BnStrCompatible>( &self, name: S, ) -> Result<Option<Ref<RemoteProject>>, ()>
Gets a specific project in the Remote by its name.
NOTE: If projects have not been pulled, they will be pulled upon calling this.
sourcepub fn pull_projects(&self) -> Result<(), ()>
pub fn pull_projects(&self) -> Result<(), ()>
Pulls the list of projects from the Remote.
sourcepub fn pull_projects_with_progress<F: ProgressCallback>(
&self,
progress: F,
) -> Result<(), ()>
pub fn pull_projects_with_progress<F: ProgressCallback>( &self, progress: F, ) -> Result<(), ()>
Pulls the list of projects from the Remote.
§Arguments
progress
- Function to call for progress updates
sourcepub fn create_project<N: BnStrCompatible, D: BnStrCompatible>(
&self,
name: N,
description: D,
) -> Result<Ref<RemoteProject>, ()>
pub fn create_project<N: BnStrCompatible, D: BnStrCompatible>( &self, name: N, description: D, ) -> Result<Ref<RemoteProject>, ()>
Creates a new project on the remote (and pull it).
§Arguments
name
- Project namedescription
- Project description
sourcepub fn import_local_project(
&self,
project: &Project,
) -> Option<Ref<RemoteProject>>
pub fn import_local_project( &self, project: &Project, ) -> Option<Ref<RemoteProject>>
Create a new project on the remote from a local project.
sourcepub fn import_local_project_with_progress<P: ProgressCallback>(
&self,
project: &Project,
progress: P,
) -> Option<Ref<RemoteProject>>
pub fn import_local_project_with_progress<P: ProgressCallback>( &self, project: &Project, progress: P, ) -> Option<Ref<RemoteProject>>
Create a new project on the remote from a local project.
sourcepub fn push_project<I, K, V>(
&self,
project: &RemoteProject,
extra_fields: I,
) -> Result<(), ()>
pub fn push_project<I, K, V>( &self, project: &RemoteProject, extra_fields: I, ) -> Result<(), ()>
Pushes an updated Project object to the Remote.
§Arguments
project
- Project object which has been updatedextra_fields
- Extra HTTP fields to send with the update
sourcepub fn delete_project(&self, project: &RemoteProject) -> Result<(), ()>
pub fn delete_project(&self, project: &RemoteProject) -> Result<(), ()>
Deletes a project from the remote.
sourcepub fn groups(&self) -> Result<Array<RemoteGroup>, ()>
pub fn groups(&self) -> Result<Array<RemoteGroup>, ()>
Gets the list of groups in this project.
If groups have not been pulled, they will be pulled upon calling this. This function is only available to accounts with admin status on the Remote.
sourcepub fn get_group_by_id(
&self,
id: GroupId,
) -> Result<Option<Ref<RemoteGroup>>, ()>
pub fn get_group_by_id( &self, id: GroupId, ) -> Result<Option<Ref<RemoteGroup>>, ()>
Gets a specific group in the Remote by its id.
If groups have not been pulled, they will be pulled upon calling this. This function is only available to accounts with admin status on the Remote.
sourcepub fn get_group_by_name<S: BnStrCompatible>(
&self,
name: S,
) -> Result<Option<Ref<RemoteGroup>>, ()>
pub fn get_group_by_name<S: BnStrCompatible>( &self, name: S, ) -> Result<Option<Ref<RemoteGroup>>, ()>
Gets a specific group in the Remote by its name.
If groups have not been pulled, they will be pulled upon calling this. This function is only available to accounts with admin status on the Remote.
sourcepub fn search_groups<S: BnStrCompatible>(
&self,
prefix: S,
) -> Result<(Array<GroupId>, Array<BnString>), ()>
pub fn search_groups<S: BnStrCompatible>( &self, prefix: S, ) -> Result<(Array<GroupId>, Array<BnString>), ()>
Searches for groups in the Remote with a given prefix.
§Arguments
prefix
- Prefix of name for groups
sourcepub fn pull_groups(&self) -> Result<(), ()>
pub fn pull_groups(&self) -> Result<(), ()>
Pulls the list of groups from the Remote. This function is only available to accounts with admin status on the Remote.
sourcepub fn pull_groups_with_progress<F: ProgressCallback>(
&self,
progress: F,
) -> Result<(), ()>
pub fn pull_groups_with_progress<F: ProgressCallback>( &self, progress: F, ) -> Result<(), ()>
Pulls the list of groups from the Remote. This function is only available to accounts with admin status on the Remote.
§Arguments
progress
- Function to call for progress updates
sourcepub fn create_group<N, I>(
&self,
name: N,
usernames: I,
) -> Result<Ref<RemoteGroup>, ()>
pub fn create_group<N, I>( &self, name: N, usernames: I, ) -> Result<Ref<RemoteGroup>, ()>
Creates a new group on the remote (and pull it). This function is only available to accounts with admin status on the Remote.
§Arguments
name
- Group nameusernames
- List of usernames of users in the group
sourcepub fn push_group<I, K, V>(
&self,
group: &RemoteGroup,
extra_fields: I,
) -> Result<(), ()>
pub fn push_group<I, K, V>( &self, group: &RemoteGroup, extra_fields: I, ) -> Result<(), ()>
Pushes an updated Group object to the Remote. This function is only available to accounts with admin status on the Remote.
§Arguments
group
- Group object which has been updatedextra_fields
- Extra HTTP fields to send with the update
sourcepub fn delete_group(&self, group: &RemoteGroup) -> Result<(), ()>
pub fn delete_group(&self, group: &RemoteGroup) -> Result<(), ()>
Deletes the specified group from the remote.
NOTE: This function is only available to accounts with admin status on the Remote
§Arguments
group
- Reference to the group to delete.
sourcepub fn users(&self) -> Result<Array<RemoteUser>, ()>
pub fn users(&self) -> Result<Array<RemoteUser>, ()>
Retrieves the list of users in the project.
NOTE: If users have not been pulled, they will be pulled upon calling this.
NOTE: This function is only available to accounts with admin status on the Remote
sourcepub fn get_user_by_id<S: BnStrCompatible>(
&self,
id: S,
) -> Result<Option<Ref<RemoteUser>>, ()>
pub fn get_user_by_id<S: BnStrCompatible>( &self, id: S, ) -> Result<Option<Ref<RemoteUser>>, ()>
Retrieves a specific user in the project by their ID.
NOTE: If users have not been pulled, they will be pulled upon calling this.
NOTE: This function is only available to accounts with admin status on the Remote
§Arguments
id
- The identifier of the user to retrieve.
sourcepub fn get_user_by_username<S: BnStrCompatible>(
&self,
username: S,
) -> Result<Option<Ref<RemoteUser>>, ()>
pub fn get_user_by_username<S: BnStrCompatible>( &self, username: S, ) -> Result<Option<Ref<RemoteUser>>, ()>
Retrieves a specific user in the project by their username.
NOTE: If users have not been pulled, they will be pulled upon calling this.
NOTE: This function is only available to accounts with admin status on the Remote
§Arguments
username
- The username of the user to retrieve.
sourcepub fn current_user(&self) -> Result<Option<Ref<RemoteUser>>, ()>
pub fn current_user(&self) -> Result<Option<Ref<RemoteUser>>, ()>
Retrieves the user object for the currently connected user.
NOTE: If users have not been pulled, they will be pulled upon calling this.
NOTE: This function is only available to accounts with admin status on the Remote
sourcepub fn search_users<S: BnStrCompatible>(
&self,
prefix: S,
) -> Result<(Array<BnString>, Array<BnString>), ()>
pub fn search_users<S: BnStrCompatible>( &self, prefix: S, ) -> Result<(Array<BnString>, Array<BnString>), ()>
Searches for users in the project with a given prefix.
§Arguments
prefix
- The prefix to search for in usernames.
sourcepub fn pull_users(&self) -> Result<(), ()>
pub fn pull_users(&self) -> Result<(), ()>
Pulls the list of users from the remote.
NOTE: This function is only available to accounts with admin status on the Remote. Non-admin accounts attempting to call this function will pull an empty list of users.
sourcepub fn pull_users_with_progress<P: ProgressCallback>(
&self,
progress: P,
) -> Result<(), ()>
pub fn pull_users_with_progress<P: ProgressCallback>( &self, progress: P, ) -> Result<(), ()>
Pulls the list of users from the remote.
NOTE: This function is only available to accounts with admin status on the Remote. Non-admin accounts attempting to call this function will pull an empty list of users.
§Arguments
progress
- Closure called to report progress. Takes current and total progress counts.
sourcepub fn create_user<U: BnStrCompatible, E: BnStrCompatible, P: BnStrCompatible>(
&self,
username: U,
email: E,
is_active: bool,
password: P,
group_ids: &[u64],
user_permission_ids: &[u64],
) -> Result<Ref<RemoteUser>, ()>
pub fn create_user<U: BnStrCompatible, E: BnStrCompatible, P: BnStrCompatible>( &self, username: U, email: E, is_active: bool, password: P, group_ids: &[u64], user_permission_ids: &[u64], ) -> Result<Ref<RemoteUser>, ()>
Creates a new user on the remote and returns a reference to the created user.
NOTE: This function is only available to accounts with admin status on the Remote
§Arguments
- Various details about the new user to be created.
sourcepub fn push_user<I, K, V>(
&self,
user: &RemoteUser,
extra_fields: I,
) -> Result<(), ()>
pub fn push_user<I, K, V>( &self, user: &RemoteUser, extra_fields: I, ) -> Result<(), ()>
Pushes updates to the specified user on the remote.
NOTE: This function is only available to accounts with admin status on the Remote
§Arguments
user
- Reference to theRemoteUser
object to push.extra_fields
- Optional extra fields to send with the update.