cx-api

Crates.iocx-api
lib.rscx-api
version0.2.1
sourcesrc
created_at2024-08-15 07:44:57.749449
updated_at2024-08-26 14:04:36.088688
descriptionCoralogix Management API Proxies. Support package for cx-sdk
homepage
repositoryhttps://github.com/coralogix/coralogix-management-sdk
max_upload_size
id1338414
size15,844
Coralogix Automation Golem (coralogix-automation-golem)

documentation

README

🪵 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

Commit count: 0

cargo fmt