# Rust client for Falcon API - rusty-falcon
Use this API specification as a reference for the API endpoints you can use to interact with your Falcon environment. These endpoints support authentication via OAuth2 and interact with detections and network containment. For detailed usage guides and examples, see our [documentation inside the Falcon console](https://falcon.crowdstrike.com/support/documentation).
To use the APIs described below, combine the base URL with the path shown for each API endpoint. For commercial cloud customers, your base URL is `https://api.crowdstrike.com`.
Each API endpoint requires authorization via an OAuth2 token. Your first API request should retrieve an OAuth2 token using the `oauth2/token` endpoint, such as `https://api.crowdstrike.com/oauth2/token`. For subsequent requests, include the OAuth2 token in an HTTP authorization header. Tokens expire after 30 minutes, after which you should make a new token request to continue making API requests.
## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client.
- API version: rolling
- Package version: rolling
- Build package: `org.openapitools.codegen.languages.RustClientCodegen`
## Installation
After installing the Rust toolchain, clone this repository:
```sh
git clone https://github.com/crowdstrike/rusty-falcon
```
### TLS Backend
By default, rusty-falcon uses `rustls` as its TLS backend.
For most users, no additional setup is required. Just run `cargo build` and it will work.
### Using `native-tls` (OpenSSL) Instead
If you need `OpenSSL/native-tls` (for legacy server compatibility), add the `native-tls` feature:
```toml
[dependencies]
rusty_falcon = { version = "0.7", features = ["native-tls"] }
```
When using `native-tls`, you may need to install OpenSSL development files on your system.
### APT-based Linux distros (e.g. Debian and Ubuntu)
```sh
sudo apt-get install -y openssl-dev
```
### RPM-based Linux distro's (e.g. Fedora and RedHat)
Installing the OpenSSL development files should be all that is required:
```sh
sudo dnf install -y openssl-devel
```
### macOS
Installing the OpenSSL development files should be all that is required:
```sh
brew install openssl
```
If `cargo` can't find the OpenSSL library, provide a configuration file pointing to it:
1. Create `.cargo/config.toml`
2. Add the paths to the configuration file:
```toml
[env]
OPENSSL_INCLUDE_DIR="/usr/local/opt/openssl/include"
OPENSSL_LIB_DIR="/usr/local/opt/openssl/lib"
```
### Windows
Assuming that the source code is stored at `C:/Users/<ME>/src` and you're using
the MSVC toolchain with Rust (the most common scenario on Windows), all that's
needed is cloning the `vcpkg` repo, building and installing OpenSSL:
```pwsh
cd C:/Users/<ME>/src
git clone https://github.com/microsoft/vcpkg
cd vcpkg
.\bootstrap-vcpkg.bat
# Install the static library
.\vcpkg.exe install openssl:x64-windows-static
# Optional: install dynamic library version, too
.\vcpkg.exe install openssl:x64-windows
.\vcpkg.exe integrate install
```
Now, tell `cargo` where to find OpenSSL:
1. Create `.cargo/config.toml`
2. Add the paths to the configuration file:
```toml
[env]
OPENSSL_LIB_DIR="C:/Users/<ME>/src/vcpkg/packages/openssl_x64-windows/lib"
OPENSSL_INCLUDE_DIR="C:/Users/<ME>/src/vcpkg/packages/openssl_x64-windows/include"
```
After that `cargo check` should succeed.
## Local docs
To get access to the crate's generated documentation, use:
```bash
cargo doc --open
```
## Author