Skip to content

Commit

Permalink
chore: Change the go-sdk path to v2
Browse files Browse the repository at this point in the history
Signed-off-by: Lei Jin <[email protected]>
  • Loading branch information
leijin-lw committed Oct 30, 2024
1 parent de9bf63 commit 35d9cc7
Show file tree
Hide file tree
Showing 576 changed files with 8,808 additions and 723 deletions.
6 changes: 3 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
Before submitting a pull request, please make sure the following is done:
1. Fork [the repository](https://github.com/lacework/go-sdk) and create your branch from `main`
1. Fork [the repository](https://github.com/lacework/go-sdk/v2) and create your branch from `main`
2. Run `make prepare` in the repository root
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`make test`)
5. Format your code (`make fmt`)
6. Make sure your code lints (`make lint`)
7. If you are updating the Lacework CLI, make sure it compiles (`make build-cli-cross-platform`)
8. Follow the commit message standard (`type(scope): subject`) documented in [DEVELOPER_GUIDELINES.md](https://github.com/lacework/go-sdk/blob/main/DEVELOPER_GUIDELINES.md#commit-message-standard)
8. Follow the commit message standard (`type(scope): subject`) documented in [DEVELOPER_GUIDELINES.md](https://github.com/lacework/go-sdk/v2/blob/main/DEVELOPER_GUIDELINES.md#commit-message-standard)
9. If you haven't already, configure signed commits by [telling git about your signing key](https://docs.github.com/en/github/authenticating-to-github/managing-commit-signature-verification/telling-git-about-your-signing-key) and [signing commits](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits)
Learn more about contributing: https://github.com/lacework/go-sdk/blob/main/CONTRIBUTING.md
Learn more about contributing: https://github.com/lacework/go-sdk/v2/blob/main/CONTRIBUTING.md
-->

## Summary
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "@oncall-growth-eng! There has been a failure that needs your attention. :rotating_light:\n*GitHub Workflow Failure*\ngo-sdk/nightly-build\n*Workflow Run*\n https://github.com/lacework/go-sdk/actions/runs/${{ github.run_id }}"
"text": "@oncall-growth-eng! There has been a failure that needs your attention. :rotating_light:\n*GitHub Workflow Failure*\ngo-sdk/nightly-build\n*Workflow Run*\n https://github.com/lacework/go-sdk/v2/actions/runs/${{ github.run_id }}"
}
}
]
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "@oncall-growth-eng! There has been a failure that needs your attention. :rotating_light:\n*GitHub Workflow Failure*\ngo-sdk/nightly-build\n*Workflow Run*\n https://github.com/lacework/go-sdk/actions/runs/${{ github.run_id }}"
"text": "@oncall-growth-eng! There has been a failure that needs your attention. :rotating_light:\n*GitHub Workflow Failure*\ngo-sdk/nightly-build\n*Workflow Run*\n https://github.com/lacework/go-sdk/v2/actions/runs/${{ github.run_id }}"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "@oncall-growth-eng! There has been a failure that needs your attention. :rotating_light:\n*GitHub Workflow Failure*\ngo-sdk/prepare-release\n*Workflow Run*\n https://github.com/lacework/go-sdk/actions/runs/${{ github.run_id }}"
"text": "@oncall-growth-eng! There has been a failure that needs your attention. :rotating_light:\n*GitHub Workflow Failure*\ngo-sdk/prepare-release\n*Workflow Run*\n https://github.com/lacework/go-sdk/v2/actions/runs/${{ github.run_id }}"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
with:
payload: |
{
"text": "<@U0279A42HV0> sign_cli ${{ github.ref_name }} https://github.com/lacework/go-sdk/actions/runs/${{ github.run_id }}"
"text": "<@U0279A42HV0> sign_cli ${{ github.ref_name }} https://github.com/lacework/go-sdk/v2/actions/runs/${{ github.run_id }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_GROWTH_ENG_ALERTS }}
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "@oncall-growth-eng! There has been a failure that needs your attention. :rotating_light:\n*GitHub Workflow Failure*\ngo-sdk/release\n*Workflow Run*\n https://github.com/lacework/go-sdk/actions/runs/${{ github.run_id }}"
"text": "@oncall-growth-eng! There has been a failure that needs your attention. :rotating_light:\n*GitHub Workflow Failure*\ngo-sdk/release\n*Workflow Run*\n https://github.com/lacework/go-sdk/v2/actions/runs/${{ github.run_id }}"
}
}
]
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "@oncall-growth-eng! There has been a failure that needs your attention. :rotating_light:\n*GitHub Workflow Failure*\ngo-sdk/test-build\n*Workflow Run*\n https://github.com/lacework/go-sdk/actions/runs/${{ github.run_id }}"
"text": "@oncall-growth-eng! There has been a failure that needs your attention. :rotating_light:\n*GitHub Workflow Failure*\ngo-sdk/test-build\n*Workflow Run*\n https://github.com/lacework/go-sdk/v2/actions/runs/${{ github.run_id }}"
}
}
]
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "@oncall-growth-eng! There has been a failure that needs your attention. :rotating_light:\n*GitHub Workflow Failure*\ngo-sdk/test-build\n*Workflow Run*\n https://github.com/lacework/go-sdk/actions/runs/${{ github.run_id }}"
"text": "@oncall-growth-eng! There has been a failure that needs your attention. :rotating_light:\n*GitHub Workflow Failure*\ngo-sdk/test-build\n*Workflow Run*\n https://github.com/lacework/go-sdk/v2/actions/runs/${{ github.run_id }}"
}
}
]
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "@oncall-growth-eng! There has been a failure that needs your attention. :rotating_light:\n*GitHub Workflow Failure*\ngo-sdk/test-build\n*Workflow Run*\n https://github.com/lacework/go-sdk/actions/runs/${{ github.run_id }}"
"text": "@oncall-growth-eng! There has been a failure that needs your attention. :rotating_light:\n*GitHub Workflow Failure*\ngo-sdk/test-build\n*Workflow Run*\n https://github.com/lacework/go-sdk/v2/actions/runs/${{ github.run_id }}"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-cli-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Lacework CLI documentation update*\nNew documentation for the Lacework CLI has been generated and it is waiting for approval. :hand::skin-tone-4: @docs :party-dinosaur: :go__lw:\n*GitHub Workflow*\nhttps://github.com/lacework/go-sdk/actions/runs/${{ github.run_id }}\n*Git SHA*\n${{ steps.update.outputs.git-sha }}"
"text": "*Lacework CLI documentation update*\nNew documentation for the Lacework CLI has been generated and it is waiting for approval. :hand::skin-tone-4: @docs :party-dinosaur: :go__lw:\n*GitHub Workflow*\nhttps://github.com/lacework/go-sdk/v2/actions/runs/${{ github.run_id }}\n*Git SHA*\n${{ steps.update.outputs.git-sha }}"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-homebrew-formula.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "@oncall-growth-eng! There has been a failure that needs your attention. :rotating_light:\n*GitHub Workflow Failure*\ngo-sdk/update-homebrew-formula\n*Workflow Run*\n https://github.com/lacework/go-sdk/actions/runs/${{ github.run_id }}"
"text": "@oncall-growth-eng! There has been a failure that needs your attention. :rotating_light:\n*GitHub Workflow Failure*\ngo-sdk/update-homebrew-formula\n*Workflow Run*\n https://github.com/lacework/go-sdk/v2/actions/runs/${{ github.run_id }}"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/verify-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "@oncall-growth-eng! There has been a failure that needs your attention. :rotating_light:\n*GitHub Workflow Failure*\ngo-sdk/verify-release\n*Workflow Run*\n https://github.com/lacework/go-sdk/actions/runs/${{ github.run_id }}"
"text": "@oncall-growth-eng! There has been a failure that needs your attention. :rotating_light:\n*GitHub Workflow Failure*\ngo-sdk/verify-release\n*Workflow Run*\n https://github.com/lacework/go-sdk/v2/actions/runs/${{ github.run_id }}"
}
}
]
Expand Down
26 changes: 13 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ PACKAGENAME?=lacework-cli
CLINAME?=lacework
# Honeycomb variables
HONEYDATASET?=lacework-cli-dev
GO_LDFLAGS="-X github.com/lacework/go-sdk/cli/cmd.Version=$(shell cat VERSION) \
-X github.com/lacework/go-sdk/cli/cmd.GitSHA=$(shell git rev-parse HEAD) \
-X github.com/lacework/go-sdk/cli/cmd.HoneyDataset=$(HONEYDATASET) \
-X github.com/lacework/go-sdk/cli/cmd.BuildTime=$(shell date +%Y%m%d%H%M%S)"
GO_LDFLAGS="-X github.com/lacework/go-sdk/v2/v2/cli/cmd.Version=$(shell cat VERSION) \
-X github.com/lacework/go-sdk/v2/v2/cli/cmd.GitSHA=$(shell git rev-parse HEAD) \
-X github.com/lacework/go-sdk/v2/cli/cmd.HoneyDataset=$(HONEYDATASET) \
-X github.com/lacework/go-sdk/v2/cli/cmd.BuildTime=$(shell date +%Y%m%d%H%M%S)"
GOFLAGS=-mod=vendor
CGO_ENABLED?=0
export GOFLAGS GO_LDFLAGS CGO_ENABLED
Expand Down Expand Up @@ -81,21 +81,21 @@ integration-context-tests: install-tools ## Run integration tests with build tag

.PHONY: integration-generation-only
integration-generation-only: ## Run integration tests
PATH="$(PWD)/bin:${PATH}" go test -v github.com/lacework/go-sdk/integration -timeout 30m -run "^TestGeneration" -tags="generation"
PATH="$(PWD)/bin:${PATH}" go test -v github.com/lacework/go-sdk/v2/integration -timeout 30m -run "^TestGeneration" -tags="generation"

.PHONY: integration-only
integration-only: install-tools ## Run integration tests
PATH="$(PWD)/bin:${PATH}" gotestsum -f testname --rerun-fails=3 --packages="github.com/lacework/go-sdk/integration" \
-- -v github.com/lacework/go-sdk/integration -timeout 30m -tags="$(INTEGRATION_TEST_TAGS)" -run=$(regex)
PATH="$(PWD)/bin:${PATH}" gotestsum -f testname --rerun-fails=3 --packages="github.com/lacework/go-sdk/v2/integration" \
-- -v github.com/lacework/go-sdk/v2/integration -timeout 30m -tags="$(INTEGRATION_TEST_TAGS)" -run=$(regex)

.PHONY: integration-only-subset
integration-only-subset: install-tools ## Run a subset of integration tests
$(eval START := $(shell echo 1+$(index)*5 | bc))
$(eval END := $(shell echo 5+$(index)*5 | bc))
$(eval LENGTH := ${words $(INTEGRATION_TEST_TAGS)})
if [ ${START} -le ${LENGTH} ]; then \
PATH="$(PWD)/bin:${PATH}" gotestsum -f testname --rerun-fails=3 --packages="github.com/lacework/go-sdk/integration" \
-- -v github.com/lacework/go-sdk/integration -timeout 30m \
PATH="$(PWD)/bin:${PATH}" gotestsum -f testname --rerun-fails=3 --packages="github.com/lacework/go-sdk/v2/integration" \
-- -v github.com/lacework/go-sdk/v2/integration -timeout 30m \
-tags="${wordlist $(START), $(END), $(INTEGRATION_TEST_TAGS)}" -run=$(regex) \
exit 1; \
fi
Expand All @@ -105,14 +105,14 @@ integration-lql: build-cli-cross-platform integration-lql-only ## Build and run

.PHONY: integration-lql-only
integration-lql-only: ## Run lql integration tests
PATH=$(PWD)/bin:${PATH} gotestsum -- -v github.com/lacework/go-sdk/integration -timeout 30m -tags="query"
PATH=$(PWD)/bin:${PATH} gotestsum -- -v github.com/lacework/go-sdk/v2/integration -timeout 30m -tags="query"

.PHONY: integration-policy
integration-policy: build-cli-cross-platform integration-policy-only ## Build and run lql policy tests

.PHONY: integration-policy-only
integration-policy-only: ## Run lql policy tests
PATH=$(PWD)/bin:${PATH} gotestsum -- -v github.com/lacework/go-sdk/integration -timeout 30m -tags="policy"
PATH=$(PWD)/bin:${PATH} gotestsum -- -v github.com/lacework/go-sdk/v2/integration -timeout 30m -tags="policy"

.PHONY: coverage
coverage: test ## Output coverage profile information for each function
Expand Down Expand Up @@ -175,7 +175,7 @@ run-api-example: ## Run an API example like 'make run-api-example example=api/_e

.PHONY: build
build: ## Compiles binary for the running workstation
go build -o bin/lacework -ldflags=$(GO_LDFLAGS) github.com/lacework/go-sdk/cli
go build -o bin/lacework -ldflags=$(GO_LDFLAGS) github.com/lacework/go-sdk/v2/cli

.PHONY: build-cli-cross-platform
build-cli-cross-platform: ## Compiles the Lacework CLI for all supported platforms
Expand All @@ -184,7 +184,7 @@ build-cli-cross-platform: ## Compiles the Lacework CLI for all supported platfor
-arch="amd64 386" \
-osarch="darwin/amd64 darwin/arm64 linux/arm linux/arm64" \
-ldflags=$(GO_LDFLAGS) \
github.com/lacework/go-sdk/cli
github.com/lacework/go-sdk/v2/cli

.PHONY: generate-databox
generate-databox: ## *CI ONLY* Generates in memory representation of template files
Expand Down
6 changes: 3 additions & 3 deletions api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ A Golang API client for interacting with [Lacework APIs](https://docs.lacework.n

Download the library into your `$GOPATH`:

$ go get github.com/lacework/go-sdk/api
$ go get github.com/lacework/go-sdk/v2/api

Import the library into your tool:

```go
import "github.com/lacework/go-sdk/api"
import "github.com/lacework/go-sdk/v2/api"
```

## Requirements
Expand All @@ -33,7 +33,7 @@ import (
"fmt"
"log"

"github.com/lacework/go-sdk/api"
"github.com/lacework/go-sdk/v2/api"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions api/_examples/active-containers/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"os"
"time"

"github.com/lacework/go-sdk/api"
"github.com/lacework/go-sdk/internal/array"
"github.com/lacework/go-sdk/v2/api"
"github.com/lacework/go-sdk/v2/internal/array"
"github.com/pkg/errors"
)

Expand Down
2 changes: 1 addition & 1 deletion api/_examples/agent-access-token/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/lacework/go-sdk/api"
"github.com/lacework/go-sdk/v2/api"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion api/_examples/alert-channels-v2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/lacework/go-sdk/api"
"github.com/lacework/go-sdk/v2/api"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion api/_examples/alert-profiles/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/lacework/go-sdk/api"
"github.com/lacework/go-sdk/v2/api"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion api/_examples/alert-rules/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/lacework/go-sdk/api"
"github.com/lacework/go-sdk/v2/api"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion api/_examples/aws-cloudwatch-alert-channel/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/lacework/go-sdk/api"
"github.com/lacework/go-sdk/v2/api"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion api/_examples/aws-s3-alert-channel/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/lacework/go-sdk/api"
"github.com/lacework/go-sdk/v2/api"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion api/_examples/cisco-webex-alert-channel/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/lacework/go-sdk/api"
"github.com/lacework/go-sdk/v2/api"
)

func main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/lacework/go-sdk/api"
"github.com/lacework/go-sdk/v2/api"
)

func main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/lacework/go-sdk/api"
"github.com/lacework/go-sdk/v2/api"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion api/_examples/cloud-accounts/aws-cfg/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/lacework/go-sdk/api"
"github.com/lacework/go-sdk/v2/api"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion api/_examples/cloud-accounts/aws-ct-sqs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/lacework/go-sdk/api"
"github.com/lacework/go-sdk/v2/api"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion api/_examples/cloud-accounts/aws-eks-audit/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/lacework/go-sdk/api"
"github.com/lacework/go-sdk/v2/api"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion api/_examples/cloud-accounts/azure-ad-al/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/lacework/go-sdk/api"
"github.com/lacework/go-sdk/v2/api"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion api/_examples/cloud-accounts/gcp-al-pub-sub/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/lacework/go-sdk/api"
"github.com/lacework/go-sdk/v2/api"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion api/_examples/cloud-accounts/gcp-gke-audit/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/lacework/go-sdk/api"
"github.com/lacework/go-sdk/v2/api"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion api/_examples/cloud-accounts/oci-cfg/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/lacework/go-sdk/api"
"github.com/lacework/go-sdk/v2/api"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion api/_examples/components/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/lacework/go-sdk/api"
"github.com/lacework/go-sdk/v2/api"
)

func main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/lacework/go-sdk/api"
"github.com/lacework/go-sdk/v2/api"
)

func main() {
Expand Down
Loading

0 comments on commit 35d9cc7

Please sign in to comment.