3 unstable releases

0.2.1 Aug 26, 2024
0.2.0 Aug 19, 2024
0.1.0 Aug 15, 2024

#525 in Debugging


Used in cx-sdk

Apache-2.0

16KB
233 lines

🪵 Coralogix Management SDK for Rust

The Rust SDK is an abstraction over the protobuf files in the root of the repository. Generating the .rs files happens during the build and the output is stored in the target directory (locally).

Use cargo to build and test:

cargo build - builds the SDK

cd examples && cargo test - runs all examples

cd examples && cargo test -p archive-logs - runs the example archive-logs

Examples

This is a basic example for how to work with the SDK:

let client = ActionsClient::new(
    AuthContext::from_env(),
    CoralogixRegion::from_env().unwrap(),
)?;

let _ = client.create(Action {
    name: Some("google search action".to_string()),
    url: Some("https://www.google.com/search?q={{$p.selected_value}}".to_string()),
    is_private: Some(false),
    source_type: SourceType::Log.into(),
    application_names: vec!["app".to_string()],
    subsystem_names: vec!["sub".to_string()],
    id: None,
    is_hidden: Some(false),
    created_by: Some("someone@mycompany.com".into()),
}).await?

You can find more in the directory.

Configuration

Additional configuration options are supported by the SDK.

Environment Variables

The SDK can be configured using environment variables:

  • CORALOGIX_TEAM_API_KEY: The API key that is used for all team-level interactions. Note that it has to have appropriate permissions. Read the docs for more information.
  • CORALOGIX_USER_API_KEY: The API key that is used for all user-level interactions. Note that it has to have appropriate permissions. Read the docs for more information.
  • CORALGOIX_REGION: The region/cluster to connect to as a shorthand (EU2, AP1, etc. read more here).

Please note that for all examples these variables have to be set to a valid cluster and API key.

Additional Variables For Examples

These are just used within the examples:

  • TEAM_ID: This environment variable is required for running some examples and should contain your Coralogix team's id.
  • AWS_TEST_ROLE: This environment variable is also requried for certain tests and requires a valid AWS role that can access resources required for the test.

License

Apache-2.0

Dependencies

~14–25MB
~459K SLoC