Skip to main content

UptrakitClient

Struct UptrakitClient 

Source
pub struct UptrakitClient { /* private fields */ }
Expand description

Typed HTTP client for the Uptrakit web API.

Provides compile-time type safety for all API endpoints by using shared request/response types from uptrakit-web-api-types.

Implementations§

Source§

impl UptrakitClient

Source

pub async fn get_access_catalog(&self) -> Result<AccessCatalogResponse>

Fetch the access catalog (actions, role bundles, scope presets).

Source§

impl UptrakitClient

Source

pub async fn list_access_grants( &self, query: &ListAccessGrantsQuery, ) -> Result<Vec<AccessGrantResponse>>

List grants (active tenant + global rows), optionally one subject’s.

Source

pub async fn get_access_grant(&self, id: &Uuid) -> Result<AccessGrantResponse>

Get a single grant.

Source

pub async fn create_access_grant( &self, req: &CreateAccessGrantRequest, ) -> Result<AccessGrantResponse>

Create a grant.

Source

pub async fn update_access_grant( &self, id: &Uuid, req: &UpdateAccessGrantRequest, ) -> Result<AccessGrantResponse>

Update a grant’s patterns/selector/description.

Source

pub async fn delete_access_grant(&self, id: &Uuid) -> Result<()>

Delete a grant.

Source§

impl UptrakitClient

Source

pub async fn create_api_token( &self, req: &CreateApiTokenRequest, ) -> Result<CreateApiTokenResponse>

Create a new API token.

Source

pub async fn list_api_tokens(&self) -> Result<ApiTokenListResponse>

List all API tokens for the current user.

Source

pub async fn revoke_api_token(&self, id: &Uuid) -> Result<()>

Revoke an API token by ID.

Source§

impl UptrakitClient

Source

pub async fn list_audit_logs( &self, params: &AuditLogListParams, ) -> Result<PaginatedResponse<AuditLogResponse>>

List tenant-scoped audit log entries with optional filters and pagination.

Source

pub async fn list_system_audit_logs( &self, params: &AuditLogListParams, ) -> Result<PaginatedResponse<SystemAuditLogResponse>>

List system-level audit log entries with optional filters and pagination.

Source§

impl UptrakitClient

Source

pub async fn register(&self, req: &RegisterRequest) -> Result<AuthResponse>

Register a new user account.

This endpoint does not require authentication.

Source

pub async fn login(&self, req: &LoginRequest) -> Result<AuthResponse>

Log in with email and password.

This endpoint does not require authentication.

Source

pub async fn refresh(&self, req: &RefreshRequest) -> Result<RefreshResponse>

Refresh an access token using a refresh token.

This endpoint does not require authentication.

Source

pub async fn logout(&self, req: &LogoutRequest) -> Result<()>

Log out by revoking a refresh token.

Source

pub async fn auth_methods(&self) -> Result<AuthMethodsResponse>

List available authentication methods.

This endpoint does not require authentication.

Source

pub async fn device_auth_approve( &self, req: &DeviceAuthApproveRequest, ) -> Result<DeviceAuthApproveResponse>

Approve a pending device authorization request.

Source

pub async fn me(&self) -> Result<UserResponse>

Retrieve the current authenticated user’s profile.

Source

pub async fn oauth_device_authorization( &self, req: &DeviceAuthorizationRequest, ) -> Result<DeviceAuthorizationResponse>

Start an RFC 8628 device authorization flow.

Per RFC 8628 §3.1. Returns the device_code, user_code, verification URIs, expiry, and recommended polling interval. This endpoint does not require authentication.

Source

pub async fn oauth_token( &self, req: &OAuthTokenRequest, ) -> Result<OAuthTokenResponse>

Exchange a device_code for an access token.

Per RFC 6749 §3.2 / RFC 8628 §3.4. Form-urlencoded body. On HTTP 400 the caller receives Err(ClientError::OAuthError(OAuthErrorResponse)) with the typed OAuthErrorCode. This endpoint does not require authentication.

Source

pub async fn oauth_authorization_server_metadata( &self, ) -> Result<OAuthAuthorizationServerMetadata>

Fetch the RFC 8414 §3 authorization server metadata document.

Public; no authentication required.

Source

pub async fn device_auth_deny( &self, req: &DeviceAuthDenyRequest, ) -> Result<DeviceAuthDenyResponse>

Deny a pending device authorization request (UI-internal).

Source

pub async fn device_auth_lookup( &self, query: &DeviceAuthLookupQuery, ) -> Result<DeviceAuthLookupResponse>

Look up the client_name + expires_at for a pending flow.

Authenticated; requires CanViewServices. Query parameters are serialised by reqwest::RequestBuilder::query (which uses serde_urlencoded internally) so no manual URL building is required.

Source§

impl UptrakitClient

Source

pub async fn approve_software_item( &self, id: &Uuid, ) -> Result<SoftwareItemResponse>

Approve a pending discovered software item.

Sets discovery_state = approved and enabled = true.

Source

pub async fn discover_host( &self, host_id: &Uuid, ) -> Result<TriggerDiscoveryResponse>

Trigger autodiscovery on a specific host.

Source

pub async fn discover_plugin_config( &self, id: &Uuid, ) -> Result<TriggerDiscoveryResponse>

Trigger autodiscovery for a specific plugin config across all agents.

Source

pub async fn list_software_ignores( &self, params: &ListIgnoresParams, ) -> Result<PaginatedResponse<SoftwareIgnoreResponse>>

List software ignore rules for this tenant.

Source

pub async fn create_software_ignore( &self, req: &CreateSoftwareIgnoreRequest, ) -> Result<SoftwareIgnoreResponse>

Create a software ignore rule (idempotent).

Source

pub async fn delete_software_ignore(&self, id: &Uuid) -> Result<()>

Delete a software ignore rule by ID.

Source

pub async fn batch_software_ignores( &self, req: &BatchActionRequest, ) -> Result<BatchActionResponse>

Perform a batch action on multiple software ignore rules.

Supported actions: delete.

Source§

impl UptrakitClient

Source

pub async fn stream_batch_progress( &self, id: &Uuid, ) -> Result<impl Stream<Item = Result<BatchProgressEvent, StreamError>>>

Connect to the batch progress SSE stream and return a stream of typed events.

The returned stream yields BatchProgressEvent values until the batch completes (indicated by a BatchCompleted event) or the connection closes.

This method uses no request timeout since SSE connections are long-lived.

Source§

impl UptrakitClient

Source

pub async fn list_discovery_allowlist( &self, ) -> Result<Vec<TenantDiscoveryAllowlistEntry>>

List all tenant-wide discovery allowlist entries.

An empty list means no restrictions — all discovery plugin types will run.

Source

pub async fn add_discovery_allowlist_entry( &self, req: &CreateDiscoveryAllowlistEntryRequest, ) -> Result<TenantDiscoveryAllowlistEntry>

Add a plugin type to the tenant-wide discovery allowlist.

Idempotent: returns the existing entry if it already exists (HTTP 201).

Source

pub async fn remove_discovery_allowlist_entry(&self, id: &Uuid) -> Result<()>

Remove a tenant-wide discovery allowlist entry.

Source

pub async fn list_host_discovery_allowlist( &self, host_id: &Uuid, ) -> Result<Vec<HostDiscoveryAllowlistEntry>>

List host-specific discovery allowlist entries.

An empty list means the host inherits the tenant-wide allowlist.

Source

pub async fn add_host_discovery_allowlist_entry( &self, host_id: &Uuid, req: &CreateDiscoveryAllowlistEntryRequest, ) -> Result<HostDiscoveryAllowlistEntry>

Add a plugin type to a host’s discovery allowlist.

Idempotent: returns the existing entry if it already exists (HTTP 201).

Source

pub async fn remove_host_discovery_allowlist_entry( &self, host_id: &Uuid, entry_id: &Uuid, ) -> Result<()>

Remove a host-specific discovery allowlist entry.

Source§

impl UptrakitClient

Source

pub async fn create_enrollment_token( &self, req: &CreateEnrollmentTokenRequest, ) -> Result<EnrollmentTokenCreatedResponse>

Create a new enrollment token.

Source

pub async fn list_enrollment_tokens( &self, query: &ListEnrollmentTokensQuery, ) -> Result<PaginatedResponse<EnrollmentTokenResponse>>

List enrollment tokens with pagination.

Source

pub async fn list_all_enrollment_tokens( &self, query: &ListEnrollmentTokensQuery, ) -> Result<Vec<EnrollmentTokenResponse>>

Fetch all enrollment tokens across all pages.

Source

pub async fn get_enrollment_token( &self, id: &Uuid, ) -> Result<EnrollmentTokenResponse>

Get a single enrollment token by ID.

Source

pub async fn revoke_enrollment_token(&self, id: &Uuid) -> Result<()>

Revoke an enrollment token (soft-delete).

Source§

impl UptrakitClient

Source

pub async fn stream_events( &self, ) -> Result<impl Stream<Item = Result<AdminSseEvent, StreamError>>>

Connect to the admin events SSE stream and return a stream of typed events.

The returned stream yields AdminSseEvent values for the authenticated user’s tenant. The stream stays open indefinitely (server pushes events as state changes occur) and should be cancelled by the caller when no longer needed.

Uses an 86400s (24h) timeout, matching other long-lived SSE connections.

Source§

impl UptrakitClient

Source

pub async fn healthz(&self) -> Result<String>

Check server health.

This endpoint does not require authentication. Returns "ok" on success.

Source§

impl UptrakitClient

Source

pub async fn list_host_tags( &self, params: &ListHostTagsQuery, ) -> Result<PaginatedResponse<HostTagResponse>>

List host tags with pagination and optional search.

Source

pub async fn list_all_host_tags(&self) -> Result<Vec<HostTagResponse>>

Fetch all host tags across all pages.

Source

pub async fn get_host_tag(&self, id: &Uuid) -> Result<HostTagResponse>

Get a single host tag by ID.

Source

pub async fn create_host_tag( &self, req: &CreateHostTagRequest, ) -> Result<HostTagResponse>

Create a new host tag.

Source

pub async fn update_host_tag( &self, id: &Uuid, req: &UpdateHostTagRequest, ) -> Result<HostTagResponse>

Update an existing host tag.

Source

pub async fn delete_host_tag(&self, id: &Uuid) -> Result<()>

Delete a host tag (soft-delete).

Source

pub async fn batch_host_tags( &self, req: &BatchActionRequest, ) -> Result<BatchActionResponse>

Perform a batch action on multiple host tags.

Supported actions: delete.

Source

pub async fn set_host_tags( &self, host_id: &Uuid, req: &SetHostTagsRequest, ) -> Result<Vec<HostTagSummary>>

Set (replace-all) tags on a host.

Source§

impl UptrakitClient

Source

pub async fn list_hosts( &self, params: &PaginationParams, ) -> Result<PaginatedResponse<HostResponse>>

List hosts with pagination.

Source

pub async fn list_all_hosts(&self) -> Result<Vec<HostResponse>>

Fetch all hosts across all pages.

Automatically iterates through every page at MAX_PER_PAGE items per request and returns the concatenated list. Use list_hosts when manual pagination control is needed.

Source

pub async fn get_host(&self, id: &Uuid) -> Result<HostResponse>

Get a single host by ID.

Source

pub async fn update_host( &self, id: &Uuid, req: &UpdateHostRequest, ) -> Result<HostResponse>

Update a host (e.g. change its friendly name).

Source

pub async fn deactivate_host(&self, id: &Uuid) -> Result<()>

Deactivate (remove) a host.

Source

pub async fn batch_hosts( &self, req: &BatchActionRequest, ) -> Result<BatchActionResponse>

Perform a batch action on multiple hosts.

Supported actions: deactivate.

Source§

impl UptrakitClient

Source

pub async fn create_notification_channel( &self, req: &CreateNotificationChannelRequest, ) -> Result<NotificationChannelResponse>

Create a new notification channel.

Source

pub async fn list_notification_channels( &self, params: &PaginationParams, ) -> Result<PaginatedResponse<NotificationChannelResponse>>

List notification channels with pagination.

Source

pub async fn get_notification_channel( &self, id: &Uuid, ) -> Result<NotificationChannelResponse>

Get a single notification channel by ID.

Source

pub async fn update_notification_channel( &self, id: &Uuid, req: &UpdateNotificationChannelRequest, ) -> Result<NotificationChannelResponse>

Update an existing notification channel.

Source

pub async fn delete_notification_channel(&self, id: &Uuid) -> Result<()>

Delete a notification channel.

Source

pub async fn test_notification_channel( &self, id: &Uuid, ) -> Result<TestNotificationResponse>

Send a test notification through a channel.

Source

pub async fn create_notification_rule( &self, req: &CreateNotificationRuleRequest, ) -> Result<NotificationRuleResponse>

Create a new notification rule.

Source

pub async fn list_notification_rules( &self, params: &PaginationParams, ) -> Result<PaginatedResponse<NotificationRuleResponse>>

List notification rules with pagination.

Source

pub async fn get_notification_rule( &self, id: &Uuid, ) -> Result<NotificationRuleResponse>

Get a single notification rule by ID.

Source

pub async fn update_notification_rule( &self, id: &Uuid, req: &UpdateNotificationRuleRequest, ) -> Result<NotificationRuleResponse>

Update an existing notification rule.

Source

pub async fn delete_notification_rule(&self, id: &Uuid) -> Result<()>

Delete a notification rule.

Source

pub async fn list_notification_log( &self, params: &PaginationParams, ) -> Result<PaginatedResponse<NotificationLogResponse>>

List the notification log with pagination.

Source§

impl UptrakitClient

Source

pub async fn list_clients( &self, params: &PaginationParams, ) -> Result<PaginatedResponse<OAuthClientResponse>>

List registered OAuth clients (paginated, newest first).

Source

pub async fn manual_register_client( &self, req: &DcrRegistrationRequest, ) -> Result<DcrRegistrationResponse>

Manually register an OAuth client (operator, RFC 7591 shape).

The response carries a one-time registration_access_token — never log or Debug-format it.

Source

pub async fn revoke_client(&self, client_id: &str) -> Result<()>

Revoke an OAuth client (cascades to its consents and refresh tokens).

Source

pub async fn trust_client(&self, client_id: &str) -> Result<()>

Promote an OAuth client to trusted.

Source§

impl UptrakitClient

Source

pub async fn list_consents(&self) -> Result<Vec<OAuthConsentResponse>>

List the current user’s active OAuth consents (newest-granted first).

Revoke one of the current user’s OAuth consents.

Source§

impl UptrakitClient

Source

pub async fn oidc_authorize( &self, provider_id: &Uuid, ) -> Result<OidcAuthorizeResponse>

Get the OIDC authorization URL for a provider.

This endpoint does not require authentication.

Source

pub async fn oidc_exchange( &self, req: &OidcExchangeRequest, ) -> Result<AuthResponse>

Exchange an OIDC authorization code for tokens.

This endpoint does not require authentication.

Link an OIDC account to an existing user.

Source

pub async fn oidc_complete_registration( &self, req: &OidcCompleteRegistrationRequest, ) -> Result<AuthResponse>

Complete OIDC registration with a registration code and token.

This endpoint does not require authentication.

Source§

impl UptrakitClient

Source

pub async fn create_oidc_provider( &self, req: &CreateOidcProviderRequest, ) -> Result<OidcProviderResponse>

Create a new OIDC provider.

Source

pub async fn list_oidc_providers(&self) -> Result<Vec<OidcProviderResponse>>

List all OIDC providers.

Source

pub async fn get_oidc_provider(&self, id: &Uuid) -> Result<OidcProviderResponse>

Get a single OIDC provider by ID.

Source

pub async fn update_oidc_provider( &self, id: &Uuid, req: &UpdateOidcProviderRequest, ) -> Result<OidcProviderResponse>

Update an existing OIDC provider.

Source

pub async fn delete_oidc_provider(&self, id: &Uuid) -> Result<()>

Delete an OIDC provider.

Source

pub async fn activate_oidc_provider( &self, id: &Uuid, ) -> Result<OidcProviderResponse>

Activate an OIDC provider.

Source

pub async fn deactivate_oidc_provider( &self, id: &Uuid, ) -> Result<OidcProviderResponse>

Deactivate an OIDC provider.

Source§

impl UptrakitClient

Source

pub async fn ca_cert(&self) -> Result<String>

Download the CA certificate in PEM format.

This endpoint does not require authentication.

Source

pub async fn ca_crl(&self) -> Result<String>

Download the CA certificate revocation list in PEM format.

This endpoint does not require authentication.

Source§

impl UptrakitClient

Source

pub async fn list_plugin_types(&self) -> Result<Vec<PluginTypeInfo>>

List all known plugin types with their display names and capabilities.

Returns static registry metadata. Use this to populate plugin-type selectors rather than hard-coding plugin type strings.

Source

pub async fn create_plugin_config( &self, req: &CreatePluginConfigRequest, ) -> Result<PluginConfigResponse>

Create a new plugin configuration.

Source

pub async fn list_plugin_configs( &self, params: &PaginationParams, ) -> Result<PaginatedResponse<PluginConfigResponse>>

List plugin configurations with pagination.

Source

pub async fn list_all_plugin_configs(&self) -> Result<Vec<PluginConfigResponse>>

Fetch all plugin configurations across all pages.

Automatically iterates through every page at MAX_PER_PAGE items per request. Use list_plugin_configs for manual pagination control.

Source

pub async fn get_plugin_config( &self, id: &Uuid, ) -> Result<(PluginConfigResponse, String)>

Get a single plugin configuration by ID. Returns the response body and the raw ETag header value.

Source

pub async fn update_plugin_config( &self, id: &Uuid, req: &UpdatePluginConfigRequest, etag: &str, ) -> Result<(PluginConfigResponse, String)>

Update an existing plugin configuration. etag must be the value returned by a prior get_plugin_config call — the server requires If-Match for optimistic locking.

Source

pub async fn delete_plugin_config(&self, id: &Uuid) -> Result<()>

Delete a plugin configuration.

Source

pub async fn batch_plugin_configs( &self, req: &BatchActionRequest, ) -> Result<BatchActionResponse>

Perform a batch action on multiple plugin configurations.

Supported actions: delete.

Source

pub async fn test_plugin_config( &self, req: &TestPluginConfigRequest, ) -> Result<TestPluginConfigResponse>

Test a plugin configuration without saving it.

Validates the configuration and, depending on the plugin type, either performs a controller-side connectivity check or routes the request to an agent for host-side validation.

Source§

impl UptrakitClient

Source

pub async fn list_plugin_type_settings( &self, ) -> Result<Vec<PluginTypeSettingsResponse>>

List all plugin-type-level settings.

Returns settings for every plugin type that has been configured.

Source

pub async fn get_plugin_type_settings( &self, plugin_type: &str, ) -> Result<PluginTypeSettingsResponse>

Get plugin-type-level settings for a specific plugin type.

Source

pub async fn upsert_plugin_type_settings( &self, plugin_type: &str, req: &UpsertPluginTypeSettingsRequest, ) -> Result<PluginTypeSettingsResponse>

Create or update plugin-type-level settings for a specific plugin type.

Source

pub async fn delete_plugin_type_settings(&self, plugin_type: &str) -> Result<()>

Delete plugin-type-level settings for a specific plugin type.

Source§

impl UptrakitClient

Source

pub async fn list_roles(&self) -> Result<Vec<RoleResponse>>

List roles for the active tenant plus the global built-ins.

Source

pub async fn get_role(&self, id: &Uuid) -> Result<RoleResponse>

Get a single role by ID.

Source

pub async fn create_role(&self, req: &CreateRoleRequest) -> Result<RoleResponse>

Create a tenant-scoped custom role.

Source

pub async fn update_role( &self, id: &Uuid, req: &UpdateRoleRequest, ) -> Result<RoleResponse>

Rename/re-describe an own-tenant custom role.

Source

pub async fn delete_role(&self, id: &Uuid) -> Result<()>

Delete an own-tenant custom role.

Source§

impl UptrakitClient

Source

pub async fn list_scheduled_tasks(&self) -> Result<Vec<ScheduledTaskResponse>>

List all scheduled tasks.

Source

pub async fn get_scheduled_task( &self, id: &Uuid, ) -> Result<ScheduledTaskResponse>

Get a single scheduled task by ID.

Source

pub async fn update_scheduled_task( &self, id: &Uuid, req: &UpdateScheduledTaskRequest, ) -> Result<ScheduledTaskResponse>

Update a scheduled task (interval, jitter, enabled state, or config).

Source

pub async fn trigger_scheduled_task( &self, id: &Uuid, ) -> Result<TriggerScheduledTaskResponse>

Trigger immediate execution of a scheduled task.

Source§

impl UptrakitClient

Source

pub async fn list_services( &self, query: &ListServicesQuery, ) -> Result<PaginatedResponse<ServiceResponse>>

List services with optional filters and pagination.

Source

pub async fn list_all_services( &self, query: &ListServicesQuery, ) -> Result<Vec<ServiceResponse>>

Fetch all services matching the given filters across all pages.

Automatically iterates through every page at MAX_PER_PAGE items per request. The page and per_page fields of query are ignored; use list_services for manual pagination control.

Source

pub async fn get_service(&self, id: &Uuid) -> Result<ServiceResponse>

Get a single service by ID.

Source

pub async fn approve_service(&self, id: &Uuid) -> Result<ServiceResponse>

Approve a pending service.

Source

pub async fn reject_service(&self, id: &Uuid) -> Result<ServiceResponse>

Reject a pending service.

Source

pub async fn update_service( &self, id: &Uuid, req: &UpdateServiceRequest, ) -> Result<ServiceResponse>

Update a service’s configurable settings (e.g. ping interval).

Source

pub async fn remove_service(&self, id: &Uuid) -> Result<()>

Deactivate (remove) a service.

Source

pub async fn set_update_freeze( &self, id: &Uuid, req: &SetUpdateFreezeRequest, ) -> Result<MessageResponse>

Enable or disable the update freeze on a connected service.

Source

pub async fn batch_services( &self, req: &BatchActionRequest, ) -> Result<BatchActionResponse>

Perform a batch action on multiple services.

Supported actions: approve, reject, deactivate.

Source

pub async fn merge_service( &self, target_id: &Uuid, req: &MergeAgentRequest, ) -> Result<ServiceResponse>

Merge a pending source service into an approved target service.

Source§

impl UptrakitClient

Source

pub async fn get_global_combined_settings( &self, ) -> Result<GlobalSettingsCombinedResponse>

Get combined global settings (network, system services, MQTT limit, optional NATS).

Source

pub async fn get_combined_settings(&self) -> Result<CombinedSettingsResponse>

Get combined settings (access, certificates, enrollment tokens).

Source

pub async fn get_access_settings( &self, ) -> Result<(AccessSettingsResponse, String)>

Get access settings (registration + authentication combined). Returns the response body and the raw ETag header value.

Source

pub async fn update_access_settings( &self, req: &UpdateAccessSettingsRequest, etag: &str, ) -> Result<(AccessSettingsResponse, String)>

Update access settings. etag must be the value returned by a prior get_access_settings call — the server requires If-Match for optimistic locking.

Source

pub async fn get_agent_certificate_settings( &self, ) -> Result<AgentCertificateSettingsResponse>

Get agent certificate settings.

Source

pub async fn update_agent_certificate_settings( &self, req: &UpdateAgentCertificateSettingsRequest, ) -> Result<AgentCertificateSettingsResponse>

Update agent certificate settings.

Source

pub async fn get_network_settings(&self) -> Result<NetworkSettingsResponse>

Get network settings.

Source

pub async fn update_network_settings( &self, req: &UpdateNetworkSettingsRequest, ) -> Result<NetworkSettingsResponse>

Update network settings.

Source

pub async fn rotate_ca(&self) -> Result<RotateCaResponse>

Rotate the CA certificate.

Source

pub async fn renew_server_certificate(&self) -> Result<RenewServerCertResponse>

Renew the server TLS certificate.

Source

pub async fn reset_data( &self, req: &ResetDataRequest, ) -> Result<ResetDataResponse>

Reset all tenant-scoped data.

Source§

impl UptrakitClient

Source

pub async fn get_nats_settings(&self) -> Result<NatsSettingsResponse>

Get the global NATS server URL settings.

Source

pub async fn update_nats_settings( &self, req: &UpdateNatsSettingsRequest, ) -> Result<NatsSettingsResponse>

Update the global NATS server URL settings.

Changes take effect after the controller is restarted.

Source§

impl UptrakitClient

Source

pub async fn get_github_provider_settings( &self, ) -> Result<GitHubProviderSettingsResponse>

Get global GitHub provider settings.

Source

pub async fn update_github_provider_settings( &self, req: &UpdateGitHubProviderSettingsRequest, ) -> Result<GitHubProviderSettingsResponse>

Update global GitHub provider settings.

Source§

impl UptrakitClient

Source

pub async fn list_software_items( &self, params: &ListSoftwareItemsParams, ) -> Result<PaginatedResponse<SoftwareItemResponse>>

List software items with pagination and optional discovery state filter.

Source

pub async fn preview_software_item_merge( &self, req: &MergeSoftwareItemsPreviewRequest, ) -> Result<MergeSoftwareItemsPreviewResponse>

Preview a manual merge of software items.

Source

pub async fn execute_software_item_merge( &self, req: &MergeSoftwareItemsExecuteRequest, ) -> Result<MergeSoftwareItemsExecuteResponse>

Execute a manual merge of software items.

Source

pub async fn list_all_software_items(&self) -> Result<Vec<SoftwareItemResponse>>

Fetch all software items across all pages.

Automatically iterates through every page at MAX_PER_PAGE items per request. Use list_software_items for manual pagination control.

Source

pub async fn get_software_item( &self, id: &Uuid, ) -> Result<SoftwareItemDetailResponse>

Get a single software item by ID (detailed view with host info).

Source

pub async fn create_software_item( &self, req: &CreateSoftwareItemRequest, ) -> Result<SoftwareItemResponse>

Create a new software item (catalog entry — name and enabled flag only).

Source

pub async fn update_software_item( &self, id: &Uuid, req: &UpdateSoftwareItemRequest, ) -> Result<SoftwareItemResponse>

Update an existing software item (name and/or enabled flag).

Source

pub async fn delete_software_item(&self, id: &Uuid) -> Result<()>

Delete a software item.

Source

pub async fn assign_hosts( &self, id: &Uuid, req: &AssignHostsRequest, ) -> Result<SoftwareItemDetailResponse>

Assign hosts to a software item.

Each host assignment carries its own plugin_config_id, package_identifier, and optional config_override.

Source

pub async fn unassign_host(&self, item_id: &Uuid, host_id: &Uuid) -> Result<()>

Unassign a host from a software item.

Source

pub async fn unassign_host_with_ignore( &self, item_id: &Uuid, host_id: &Uuid, ) -> Result<()>

Unassign a host from a software item and create an autodiscovery ignore rule.

Equivalent to DELETE .../hosts/{host_id}?ignore=true. The ignore rule is created for the (plugin_config_id, package_identifier) pair stored on the host assignment, preventing re-discovery of that package on any host in the future.

Source

pub async fn update_host_assignment( &self, item_id: &Uuid, host_id: &Uuid, req: &UpdateHostAssignmentRequest, ) -> Result<SoftwareItemDetailResponse>

Update the plugin assignment for a specific host–software-item link.

Source

pub async fn delete_plugin_assignment( &self, item_id: &Uuid, host_id: &Uuid, role: &str, ordinal: i32, ) -> Result<SoftwareItemDetailResponse>

Remove a specific plugin assignment by role and ordinal.

Source

pub async fn check_versions( &self, item_id: &Uuid, ) -> Result<TriggerVersionCheckResponse>

Trigger a version check for a software item across all assigned hosts.

Source

pub async fn check_versions_host( &self, item_id: &Uuid, host_id: &Uuid, ) -> Result<TriggerVersionCheckResponse>

Trigger a version check for a software item on a specific host.

Source

pub async fn trigger_update( &self, item_id: &Uuid, host_id: &Uuid, req: &TriggerUpdateRequest, ) -> Result<TriggerUpdateResponse>

Trigger an update for a software item on a specific host.

Source

pub async fn batch_software_items( &self, req: &BatchActionRequest, ) -> Result<BatchActionResponse>

Perform a batch action on multiple software items.

Supported actions: approve, delete.

Source§

impl UptrakitClient

Source

pub async fn list_surfaces( &self, slot: Option<&str>, page: Option<&str>, ) -> Result<Vec<SurfaceResponse>>

List registered surfaces. Optional slot and page filters map to query params.

Source

pub async fn list_surface_providers( &self, surface_id: &str, ) -> Result<Vec<SurfaceProviderInfo>>

List targeted providers for a surface.

Source

pub async fn read_surface( &self, surface_id: &str, ) -> Result<SurfaceReadResponse>

Read a single surface with its interactions and data sources.

Source

pub async fn read_surface_interaction( &self, surface_id: &str, interaction_id: &str, query: &[(&str, String)], ) -> Result<Value>

Read a surface interaction via GET. query pairs are forwarded verbatim as query-string parameters (reserved keys included).

Source

pub async fn invoke_surface_interaction( &self, surface_id: &str, interaction_id: &str, request: &InvokeSurfaceInteractionRequest, ) -> Result<Value>

Invoke a surface interaction.

Source

pub async fn update_surface_interaction( &self, surface_id: &str, interaction_id: &str, request: &InvokeSurfaceInteractionRequest, ) -> Result<Value>

Update a surface interaction via PUT.

Source

pub async fn delete_surface_interaction( &self, surface_id: &str, interaction_id: &str, request: &InvokeSurfaceInteractionRequest, ) -> Result<Value>

Delete a surface interaction via DELETE.

Source

pub async fn read_surface_interaction_item( &self, surface_id: &str, interaction_id: &str, item_id: &str, query: &[(&str, String)], ) -> Result<Value>

Read a surface interaction targeting a specific item via GET .../{item_id}.

Source

pub async fn update_surface_interaction_item( &self, surface_id: &str, interaction_id: &str, item_id: &str, request: &InvokeSurfaceInteractionRequest, ) -> Result<Value>

Update a surface interaction targeting a specific item via PUT .../{item_id}.

Source

pub async fn delete_surface_interaction_item( &self, surface_id: &str, interaction_id: &str, item_id: &str, request: &InvokeSurfaceInteractionRequest, ) -> Result<Value>

Delete a surface interaction targeting a specific item via DELETE .../{item_id}.

Source§

impl UptrakitClient

Source

pub async fn get_system_alerts(&self) -> Result<SystemAlertsResponse>

Get active system alerts.

Source§

impl UptrakitClient

Source

pub async fn create_system_enrollment_token( &self, req: &CreateSystemEnrollmentTokenRequest, ) -> Result<SystemEnrollmentTokenCreatedResponse>

Create a new system enrollment token.

The plaintext token is only returned in this response — store it securely immediately after creation.

Source

pub async fn list_system_enrollment_tokens( &self, query: &ListSystemEnrollmentTokensQuery, ) -> Result<PaginatedResponse<SystemEnrollmentTokenResponse>>

List system enrollment tokens with pagination.

Source

pub async fn list_all_system_enrollment_tokens( &self, query: &ListSystemEnrollmentTokensQuery, ) -> Result<Vec<SystemEnrollmentTokenResponse>>

Fetch all system enrollment tokens across all pages.

Source

pub async fn get_system_enrollment_token( &self, id: &Uuid, ) -> Result<SystemEnrollmentTokenResponse>

Get a single system enrollment token by ID.

Source

pub async fn revoke_system_enrollment_token(&self, id: &Uuid) -> Result<()>

Revoke a system enrollment token (soft-delete).

Source§

impl UptrakitClient

Source

pub async fn list_system_services( &self, query: &ListSystemServicesQuery, ) -> Result<PaginatedResponse<SystemServiceResponse>>

List system services with optional filters and pagination.

Source

pub async fn list_all_system_services( &self, query: &ListSystemServicesQuery, ) -> Result<Vec<SystemServiceResponse>>

Fetch all system services matching the given filters across all pages.

Automatically iterates through every page at MAX_PER_PAGE items per request. The page and per_page fields of query are ignored; use list_system_services for manual pagination control.

Source

pub async fn get_system_service( &self, id: &Uuid, ) -> Result<SystemServiceResponse>

Get a single system service by ID.

Source

pub async fn approve_system_service( &self, id: &Uuid, ) -> Result<SystemServiceResponse>

Approve a pending system service.

Source

pub async fn reject_system_service( &self, id: &Uuid, ) -> Result<SystemServiceResponse>

Reject a pending system service.

Source

pub async fn update_system_service( &self, id: &Uuid, req: &UpdateSystemServiceRequest, ) -> Result<SystemServiceResponse>

Update a system service’s configurable settings (e.g. ping interval).

Source

pub async fn remove_system_service(&self, id: &Uuid) -> Result<()>

Deactivate (remove) a system service.

Source

pub async fn batch_system_services( &self, req: &BatchActionRequest, ) -> Result<BatchActionResponse>

Perform a batch action on multiple system services.

Supported actions: approve, reject, deactivate.

Source§

impl UptrakitClient

Source

pub async fn trigger_host_batch_update( &self, host_id: &Uuid, req: &HostBatchUpdateRequest, ) -> Result<BatchUpdateResponse>

Trigger a host-wide batch update for all outdated software items on a host.

Source

pub async fn trigger_item_batch_update( &self, item_id: &Uuid, req: &ItemBatchUpdateRequest, ) -> Result<BatchUpdateResponse>

Trigger an item-wide batch update to roll out a software item to hosts.

Source

pub async fn list_update_batches( &self, query: &UpdateBatchListQuery, ) -> Result<PaginatedResponse<UpdateBatchSummaryResponse>>

List update batches with optional filters and pagination.

Source

pub async fn list_all_update_batches( &self, query: &UpdateBatchListQuery, ) -> Result<Vec<UpdateBatchSummaryResponse>>

Fetch all update batches matching the given filters across all pages.

Source

pub async fn get_update_batch( &self, id: &Uuid, ) -> Result<UpdateBatchDetailResponse>

Get a single update batch with per-item update details.

Source

pub fn batch_progress_stream_path(id: &Uuid) -> String

Returns the relative path for the batch progress SSE stream.

The caller should combine this with the base URL and use an SSE/EventSource client to consume it.

Source§

impl UptrakitClient

Source

pub async fn list_update_history( &self, query: &UpdateHistoryQuery, ) -> Result<PaginatedResponse<UpdateHistoryResponse>>

List update history with optional filters and pagination.

Source

pub async fn list_all_update_history( &self, query: &UpdateHistoryQuery, ) -> Result<Vec<UpdateHistoryResponse>>

Fetch all update history entries matching the given filters across all pages.

Automatically iterates through every page at MAX_PER_PAGE items per request. The page and per_page fields of query are ignored; use list_update_history for manual pagination control.

Source

pub async fn get_update_history( &self, id: &Uuid, ) -> Result<UpdateHistoryResponse>

Get a single update history entry by ID.

Source§

impl UptrakitClient

Source

pub async fn stream_update_output( &self, id: &Uuid, ) -> Result<impl Stream<Item = Result<UpdateOutputEvent, StreamError>>>

Connect to the update output SSE stream and return a stream of typed events.

The returned stream yields UpdateOutputEvent values until the update completes (indicated by a Completed event) or the connection closes.

This method uses no request timeout since SSE connections are long-lived.

Source§

impl UptrakitClient

Source

pub async fn list_users(&self) -> Result<Vec<UserWithRolesResponse>>

List all users with their roles.

Source

pub async fn get_user(&self, id: &Uuid) -> Result<UserWithRolesResponse>

Get a single user by ID with roles.

Source

pub async fn update_user_roles( &self, id: &Uuid, req: &UpdateUserRolesRequest, ) -> Result<UserWithRolesResponse>

Replace a user’s roles.

Source

pub async fn update_user_active( &self, id: &Uuid, req: &UpdateUserActiveRequest, ) -> Result<UserWithRolesResponse>

Activate or deactivate a user.

Source§

impl UptrakitClient

Source

pub fn new( base_url: &str, token: Option<&str>, insecure: bool, ca_pem: Option<&str>, request_timeout: Option<Duration>, ) -> Result<Self>

Create a new client. Pass token: None for unauthenticated endpoints (e.g. the device authorization flow).

When ca_pem is Some, the provided PEM replaces system root certificates entirely (via tls_certs_only). This is the correct approach for private CA trust — add_root_certificate is deprecated because it appends to rather than replacing system roots.

insecure = true takes precedence over ca_pem and disables all TLS verification. ca_pem is ignored when insecure is true.

request_timeout overrides DEFAULT_REQUEST_TIMEOUT when Some.

Source

pub fn with_token( base_url: &str, token: &str, insecure: bool, ca_pem: Option<&str>, ) -> Result<Self>

Create a client with a required bearer token.

When ca_pem is Some, the provided PEM replaces system root certificates (see Self::new for details).

Source

pub fn with_retry(self, config: RetryConfig) -> Self

Enable automatic retry on transient failures (429 and 5xx).

Returns a new client with the given retry configuration. By default, the client fails fast with no retries. Retries use exponential backoff for 5xx errors and respect Retry-After headers for 429 errors.

Source

pub async fn raw_request( &self, method: &str, path: &str, body: Option<Value>, ) -> Result<RawResponse>

Execute a raw (untyped) API request. Used by the CLI api escape-hatch command.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<O> ObjectMarkerFor<Local> for O
where O: 'static,

Source§

impl<O> ObjectMarkerFor<SendSync> for O
where O: 'static + Send + Sync,

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more