Skip to content

Commit

Permalink
README updates for go and globally (#17)
Browse files Browse the repository at this point in the history
docs: README updates for go and globally. Fixes #14
  • Loading branch information
celaus authored Aug 22, 2024
1 parent f3a7ff9 commit 2f63041
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 12 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# The Coralogix Management SDK
[![](https://img.shields.io/crates/v/cx-sdk)](https://crates.io/crates/cx-sdk)
![](https://img.shields.io/crates/dv/cx-sdk)
[![Go Reference](https://pkg.go.dev/badge/github.com/coralogix/coralogix-management-sdk/go.svg)](https://pkg.go.dev/github.com/coralogix/coralogix-management-sdk/go)

# 🪵 The Coralogix Management SDK

🌟 [Master Docs](https://coralogix.github.io/coralogix-management-sdk) 🌟

# Building

Expand All @@ -13,15 +19,12 @@ Please refer to the individual languages on how to build the SDKs

The SDK can be configured using environment variables:

- `CORALOGIX_API_KEY`: The API key that is used for all interactions. Note that it has to have appropriate permissions. Read the [docs](https://coralogix.com/docs/api-keys/) for more information
- `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](https://coralogix.com/docs/api-keys/) 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](https://coralogix.com/docs/api-keys/) for more information.
- `CORALGOIX_REGION`: The region/cluster to connect to as a shorthand (EU2, AP1, etc. read more [here](https://coralogix.com/docs/coralogix-domain/)).

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

# Docs

Check out the corresponding Github pages!

# Protobuf

The `proto/` directory contains all protobuf files for generating your own SDK if necessary. They are also the basis for all SDKs in this repository.
Expand Down
14 changes: 14 additions & 0 deletions go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,17 @@ The Golang SDK for Coralogix uses (mostly) GRPC for interacting with the SaaS pl
- `make proto-clean` - clean the Go files created from protobuf
- `make proto-compile` - compile the Go files from protobuf
- `make test` - run examples/tests

# Troubleshooting

Here are some tips for getting everything to work:

```
panic: proto: extension number 5000 is already registered on message google.protobuf.MethodOptions
previously from: "github.com/coralogix/coralogix-management-sdk/go/internal/coralogixapis/apm/common/v2"
currently from: "github.com/coralogix/coralogix-management-sdk/go/internal/coralogixapis/logs2metrics/v2"
See https://protobuf.dev/reference/go/faq#namespace-conflict
```
protoc treats conflicting extensions as an error unless this flag is specified (then it's a warning):

`-ldflags "-X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=warn"`
2 changes: 1 addition & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repository = "https://github.com/coralogix/coralogix-management-sdk"
keywords = ["api-bindings", "coralogix", "log", "management", "sdk"]
categories = ["api-bindings", "development-tools::debugging", "config"]
authors = ["The YAK team at Coralogix"]
readme = "../README.md"
readme = "README.md"
homepage = "https://coralogix.com"

[workspace.dependencies]
Expand Down
59 changes: 56 additions & 3 deletions rust/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,64 @@
# Coralogix Management SDK for Rust
[![](https://img.shields.io/crates/v/cx-sdk)](https://crates.io/crates/cx-sdk)
![](https://img.shields.io/crates/dv/cx-sdk)

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). Refer to the examples directory for how to connect to the individual services.
# 🪵 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`
`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:

```rust
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 [](examples/) 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](https://coralogix.com/docs/api-keys/) 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](https://coralogix.com/docs/api-keys/) for more information.
- `CORALGOIX_REGION`: The region/cluster to connect to as a shorthand (EU2, AP1, etc. read more [here](https://coralogix.com/docs/coralogix-domain/)).

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
4 changes: 2 additions & 2 deletions rust/cx-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ repository = { workspace = true }
keywords = { workspace = true }
categories = { workspace = true }
authors = { workspace = true }
description = "Coralogix Management API Proxies"

description = "Coralogix Management API Proxies. Support package for cx-sdk"
readme = "../README.md"

[lib]
doctest = false
Expand Down
1 change: 1 addition & 0 deletions rust/cx-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ keywords = { workspace = true }
categories = { workspace = true }
authors = { workspace = true }
description = "Coralogix Management SDK"
readme = "../README.md"

[dependencies]
backoff = { workspace = true }
Expand Down

0 comments on commit 2f63041

Please sign in to comment.