VictorOps Rust Client
A Rust client library for the VictorOps (Splunk On-Call) REST API.
Features
- Complete VictorOps REST API coverage
- Async/await support with Tokio
- Type-safe API responses with Serde
- Comprehensive error handling
- Request/response details for debugging
- Configurable HTTP client with timeout support
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Quick Start
async
Examples
Run the team schedule example:
Run the incidents example:
API Coverage
Incidents
get_incident(id)- Get a specific incidentget_incidents()- Get all incidents
Users
create_user(user)- Create a new userget_user(username)- Get user by usernameget_user_by_email(email)- Get user by email addressget_all_users()- Get all users (v1)get_all_users_v2()- Get all users (v2)update_user(user)- Update user informationdelete_user(username, replacement)- Delete user with replacement
Teams
create_team(team)- Create a new teamget_team(team_id)- Get team by IDget_all_teams()- Get all teamsget_team_members(team_id)- Get team membersget_team_admins(team_id)- Get team administratorsupdate_team(team)- Update team informationdelete_team(team_id)- Delete teamadd_team_member(team_id, username)- Add member to teamremove_team_member(team_id, username, replacement)- Remove member from teamis_team_member(team_id, username)- Check if user is team member
On-Call Schedules
get_api_team_schedule()- Get team on-call scheduleget_user_on_call_schedule()- Get user on-call scheduletake_on_call_for_team()- Take on-call for teamtake_on_call_for_policy()- Take on-call for escalation policy
Escalation Policies
create_escalation_policy(policy)- Create escalation policyget_escalation_policy(id)- Get escalation policy by IDget_all_escalation_policies()- Get all escalation policiesdelete_escalation_policy(id)- Delete escalation policy
Routing Keys
create_routing_key(key)- Create routing keyget_routing_key(name)- Get routing key by nameget_all_routing_keys()- Get all routing keys
Contact Methods
create_contact(username, contact)- Create contact methodget_contact(username, ext_id, type)- Get contact methodget_all_contacts(username)- Get all contact methods for userget_contact_by_id(username, id, type)- Get contact method by IDdelete_contact(username, ext_id, type)- Delete contact method
Configuration
Basic Client
async
Client with Custom Timeout
use Duration;
async
Request Details
All API methods return a tuple containing the response data and request details:
async
Error Handling
The library provides comprehensive error handling through the Error enum:
use Error;
async
Error Types
Http- HTTP request failuresJson- JSON serialization/deserialization errorsUrlParse- URL parsing errorsInvalidHeaderValue- Invalid HTTP header valuesApi- API-specific errors with status codesAuthentication- Authentication failuresNotFound- Resource not foundInvalidInput- Invalid input parameters
Types
The library includes comprehensive type definitions for all VictorOps entities:
User- User account informationTeam- Team details and membershipIncident- Incident data and transitionsEscalationPolicy- Escalation policy configurationContact- Contact method informationRoutingKey- Routing key configuration- Schedule types for on-call management
All types support Serde serialization/deserialization and include optional fields as appropriate for the VictorOps API.
License
This project is licensed under the MIT License.