Skip to content

Commit 4f753a6

Browse files
authored
Closes #1236 --------- Signed-off-by: Salim Afiune Maya <[email protected]>
1 parent 2557e79 commit 4f753a6

File tree

29 files changed

+629
-112
lines changed

29 files changed

+629
-112
lines changed

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,14 @@ fmt-check: ## Lists formatting issues
148148
imports-check: ## Lists imports issues
149149
@test -z $(shell goimports -l $(shell go list -f {{.Dir}} ./...) | grep -v proto)
150150

151+
.PHONY: run-api-example
152+
run-api-example: ## Run an API example like 'make run-api-example example=api/_examples/active-containers/main.go'
153+
LW_API_KEY=$(shell lacework configure show api_key) \
154+
LW_API_SECRET=$(shell lacework configure show api_secret) \
155+
LW_ACCOUNT=$(shell lacework configure show account) \
156+
LW_SUBACCOUNT=$(shell lacework configure show subaccount) \
157+
go run $(example)
158+
151159
.PHONY: build-cli-cross-platform
152160
build-cli-cross-platform: ## Compiles the Lacework CLI for all supported platforms
153161
gox -output="bin/$(PACKAGENAME)-{{.OS}}-{{.Arch}}" \

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
[![GitHub release](https://img.shields.io/github/release/lacework/go-sdk.svg)](https://github.com/lacework/go-sdk/releases/)
77
[![Go version](https://img.shields.io/github/go-mod/go-version/lacework/go-sdk)](https://github.com/lacework/go-sdk)
8+
[![Go Reference](https://pkg.go.dev/badge/github.com/lacework/go-sdk.svg)](https://pkg.go.dev/github.com/lacework/go-sdk)
89
[![Go report](https://goreportcard.com/badge/github.com/lacework/go-sdk)](https://goreportcard.com/report/github.com/lacework/go-sdk)
910
[![Codefresh build status]( https://g.codefresh.io/api/badges/pipeline/lacework/go-sdk%2Ftest-build?type=cf-1&key=eyJhbGciOiJIUzI1NiJ9.NWVmNTAxOGU4Y2FjOGQzYTkxYjg3ZDEx.RJ3DEzWmBXrJX7m38iExJ_ntGv4_Ip8VTa-an8gBwBo)]( https://g.codefresh.io/pipelines/edit/new/builds?id=601309a0b0dae020a9cf1275&pipeline=test-build&projects=go-sdk&projectId=60118409468eb5f1e534734f)
1011
[![GitHub releases](https://img.shields.io/github/downloads/lacework/go-sdk/total.svg)](https://GitHub.com/lacework/go-sdk/releases/)

api/README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Go API Client
1+
# API Client
22

3-
A Golang API client for interacting with the [Lacework API](https://support.lacework.com/hc/en-us/categories/360002496114-Lacework-API-).
3+
A Golang API client for interacting with [Lacework APIs](https://docs.lacework.net/api/about-the-lacework-api).
44

55
## Usage
66

@@ -24,8 +24,8 @@ To interact with Lacework's API you need to have:
2424
## Examples
2525

2626
Create a new Lacework client that will automatically generate a new access token
27-
from the provided set of API keys, then hit the `/external/integrations` endpoint
28-
to list all available integrations from your account:
27+
from the provided set of API keys, then hit the `/api/v2/AlertChannels` endpoint
28+
to list all available alert channels in your account:
2929
```go
3030
package main
3131

@@ -44,16 +44,17 @@ func main() {
4444
log.Fatal(err)
4545
}
4646

47-
integrations, err := lacework.Integrations.List()
47+
alertChannels, err := lacework.V2.AlertChannels.List()
4848
if err != nil {
4949
log.Fatal(err)
5050
}
5151

52+
for _, channel := range alertChannels.Data {
53+
fmt.Printf("Alert channel: %s\n", channel.Name)
54+
}
5255
// Output:
53-
// CUSTOMER_123456B DATADOG
54-
// CUSTOMER_123456A CONT_VULN_CFG
55-
// CUSTOMER_123456C PAGER_DUTY_API
56-
fmt.Println(integrations.String())
56+
//
57+
// Alert channel: DEFAULT EMAIL
5758
}
5859
```
5960

0 commit comments

Comments
 (0)