Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feat/support-view
Browse files Browse the repository at this point in the history
  • Loading branch information
suzuki-shunsuke committed Dec 7, 2019
2 parents 502c3e4 + 6ebdde5 commit 0980a2d
Show file tree
Hide file tree
Showing 216 changed files with 4,627 additions and 3,520 deletions.
53 changes: 53 additions & 0 deletions .cmdx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
tasks:
- name: init
short: i
script: bash scripts/githook.sh
description: setup git hooks
usage: setup git hooks
- name: coverage
short: c
description: test a package (fzf is required)
usage: test a package (fzf is required)
script: "bash scripts/coverage.sh {{.path}}"
args:
- name: path
- name: test
short: t
description: test
usage: test
script: bash scripts/test.sh
- name: fmt
description: format the go code
usage: format the go code
script: bash scripts/fmt.sh
- name: vet
short: v
description: go vet
usage: go vet
script: go vet ./...
- name: lint
short: l
description: lint the go code
usage: lint the go code
script: golangci-lint run
- name: release
short: r
description: release the new version
usage: release the new version
script: "bash scripts/release.sh {{.version}}"
args:
- name: version
required: true
- name: durl
description: check dead links (durl is required)
usage: check dead links (durl is required)
script: bash scripts/durl.sh
- name: ci-local
description: run the Drone pipeline at localhost (drone-cli is required)
usage: run the Drone pipeline at localhost (drone-cli is required)
script: time drone exec --pipeline build --event pull_request
environment:
LOCAL: "true"
- name: install-local-terraform
script: bash scripts/install_local_terraform.sh
56 changes: 33 additions & 23 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ volumes:
temp: {}
steps:
- name: download go modules
image: &image_go golang:1.13.0
image: &image_go golang:1.13.5
commands:
- go mod download
volumes: &volumes
Expand All @@ -23,7 +23,7 @@ steps:
environment:
GOPATH: /go
- name: golangci-lint
image: golangci/golangci-lint:v1.17.1
image: golangci/golangci-lint:v1.21.0-alpine
commands:
- golangci-lint run
volumes: *volumes
Expand All @@ -41,38 +41,48 @@ steps:
GOPATH: /go
CODECOV_TOKEN:
from_secret: codecov_token
- name: build
image: &image_gox suzukishunsuke/gox:1.0.1__0.2.0
- name: remove changes
image: &image_git plugins/git
commands:
- gox -output="dist/${DRONE_TAG}/terraform-provider-graylog_${DRONE_TAG}_{{.OS}}_{{.Arch}}" -osarch="darwin/amd64 linux/amd64 windows/amd64" ./terraform/
- ls dist/${DRONE_TAG} | xargs -I {} gzip dist/${DRONE_TAG}/{}
volumes: *volumes
environment:
CGO_ENABLED: "0"
GOPATH: /go
# Sometimes it is failed to release by goreleaser due to changes of go.sum
- git checkout -- .

- name: fetch tags to release
image: *image_git
commands:
- git fetch --tags
when:
event:
- tag
- name: build test
image: *image_gox
- name: release
image: &goreleaser goreleaser/goreleaser:v0.123.3
commands:
- gox -output="dist/v0.1.0/terraform-provider-graylog_v0.1.0_{{.OS}}_{{.Arch}}" -osarch="darwin/amd64 linux/amd64 windows/amd64" ./terraform/
- ls dist/v0.1.0 | xargs -I {} gzip dist/v0.1.0/{}
volumes: *volumes
- goreleaser release
environment:
CGO_ENABLED: "0"
GOPATH: /go
GITHUB_TOKEN:
from_secret: github_token
volumes: *volumes
when:
event:
- tag

- name: create a dummy tag to test releasing
image: *image_git
commands:
- git tag v0.1.0-alpha
when:
event:
- push
- pull_request
- name: release
image: suzukishunsuke/ghr
- push
- name: release (skip-publish)
image: *goreleaser
commands:
- ghr -u suzuki-shunsuke -r go-graylog ${DRONE_TAG} dist/${DRONE_TAG}
- goreleaser release --skip-publish
environment:
GITHUB_TOKEN:
from_secret: github_token
GOPATH: /go
volumes: *volumes
when:
event:
- tag
- pull_request
- push
12 changes: 12 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
builds:
- binary: terraform-provider-graylog
main: ./terraform/main.go
env:
- CGO_ENABLED=0
goos:
- windows
- darwin
- linux
goarch:
- amd64
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

<a name="8.1.0"></a>
# [8.1.0](https://github.com/suzuki-shunsuke/go-graylog/compare/v8.0.0...v8.1.0) (2019-10-04)


### Features

* support data_source_dashboard ([2726f87](https://github.com/suzuki-shunsuke/go-graylog/commit/2726f87)), closes [issuecomment-538131946](https://github.com/suzuki-shunsuke/go-graylog/issues/109#issuecomment-538131946)



<a name="8.0.0"></a>
# [8.0.0](https://github.com/suzuki-shunsuke/go-graylog/compare/v7.1.0...v8.0.0) (2019-09-11)

Expand Down
49 changes: 3 additions & 46 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,11 @@

## Requirements

* [npm](https://www.npmjs.com/): to validate a commit message and generate the Change Log
* [Golang](https://golang.org/)
* [golangci-lint](https://github.com/golangci/golangci-lint)
* [cmdx](https://github.com/suzuki-shunsuke/cmdx)

```console
$ npm i
$ cmdx i # setup git hooks
$ cmdx -l # show task list
```

## Test

```console
$ npm t
```

## Commit Message Format

The commit message format of this project conforms to the [AngularJS Commit Message Format](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#commit-message-format).
By conforming its format, we can generate the [Change Log](CHANGELOG.md) and conform the [semantic versioning](https://semver.org/) automatically by [standard-version](https://www.npmjs.com/package/standard-version).
We validate the commit message with git's `commit-msg` hook using [commitlint](https://commitlint.js.org/#/) and [husky](https://www.npmjs.com/package/husky).

## Coding Guide

* https://github.com/golang/go/wiki/CodeReviewComments

```console
$ npm run lint
```

## docker-compose.yml

To run graylog using docker for development, we prepare the template of `docker-compose.yml`.

```console
$ cp docker-compose.yml.tmpl docker-compose.yml
$ docker-compose up -d
```

## env.sh

To set environment variables for development, we prepare the template of `setenv.sh` .

```console
$ cp env.sh.tmpl env.sh
```

## Develop terraform provider

* https://www.terraform.io/docs/plugins/provider.html
* https://www.terraform.io/guides/writing-custom-terraform-providers.html
* https://godoc.org/github.com/hashicorp/terraform/helper/schema
* https://godoc.org/github.com/hashicorp/terraform/helper/resource#TestCase
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ https://github.com/suzuki-shunsuke/graylog-mock-server (deprecated)

See [CONTRIBUTING.md](CONTRIBUTING.md) .

## See also

* https://docs.graylog.org/en/latest/pages/configuration/rest_api.html
* https://docs.graylog.org/en/latest/pages/users_and_roles/permission_system.html

## License

[MIT](LICENSE)
2 changes: 1 addition & 1 deletion client/alarm_callback.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package client
import (
"context"

"github.com/suzuki-shunsuke/go-graylog"
"github.com/suzuki-shunsuke/go-graylog/v8"
)

// GetAlarmCallbacksContext returns all alarm callbacks.
Expand Down
2 changes: 1 addition & 1 deletion client/alarm_callback_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"testing"

"github.com/suzuki-shunsuke/go-graylog/testutil"
"github.com/suzuki-shunsuke/go-graylog/v8/testutil"
)

func TestClient_GetAlarmCallbacks(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion client/alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/url"
"strconv"

"github.com/suzuki-shunsuke/go-graylog"
"github.com/suzuki-shunsuke/go-graylog/v8"
)

// GetAlert returns an alert.
Expand Down
2 changes: 1 addition & 1 deletion client/alert_condition.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package client
import (
"context"

"github.com/suzuki-shunsuke/go-graylog"
"github.com/suzuki-shunsuke/go-graylog/v8"
)

// GetAlertConditions returns all alert conditions.
Expand Down
2 changes: 1 addition & 1 deletion client/alert_condition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"testing"

"github.com/suzuki-shunsuke/go-graylog/testutil"
"github.com/suzuki-shunsuke/go-graylog/v8/testutil"
)

func TestClient_GetAlertConditions(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion client/alert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"testing"

"github.com/suzuki-shunsuke/go-graylog/testutil"
"github.com/suzuki-shunsuke/go-graylog/v8/testutil"
)

func TestClient_GetAlerts(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package client
import (
"net/http"

"github.com/suzuki-shunsuke/go-graylog/client/endpoint"
"github.com/suzuki-shunsuke/go-graylog/v8/client/endpoint"
)

// Client represents a Graylog API client.
Expand Down
2 changes: 1 addition & 1 deletion client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package client_test
import (
"testing"

"github.com/suzuki-shunsuke/go-graylog/client"
"github.com/suzuki-shunsuke/go-graylog/v8/client"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion client/collector_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/suzuki-shunsuke/go-set"

"github.com/suzuki-shunsuke/go-graylog"
"github.com/suzuki-shunsuke/go-graylog/v8"
)

// CreateCollectorConfiguration creates a collector configuration.
Expand Down
2 changes: 1 addition & 1 deletion client/collector_configuration_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"errors"

"github.com/suzuki-shunsuke/go-graylog"
"github.com/suzuki-shunsuke/go-graylog/v8"
)

// CreateCollectorConfigurationInput creates a collector configuration input.
Expand Down
2 changes: 1 addition & 1 deletion client/collector_configuration_output.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"errors"

"github.com/suzuki-shunsuke/go-graylog"
"github.com/suzuki-shunsuke/go-graylog/v8"
)

// CreateCollectorConfigurationOutput creates a collector configuration output.
Expand Down
2 changes: 1 addition & 1 deletion client/collector_configuration_snippet.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"errors"

"github.com/suzuki-shunsuke/go-graylog"
"github.com/suzuki-shunsuke/go-graylog/v8"
)

// CreateCollectorConfigurationSnippet creates a collector configuration snippet.
Expand Down
2 changes: 1 addition & 1 deletion client/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"errors"

"github.com/suzuki-shunsuke/go-graylog"
"github.com/suzuki-shunsuke/go-graylog/v8"
)

// CreateDashboard creates a new dashboard account.
Expand Down
8 changes: 4 additions & 4 deletions client/dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"github.com/stretchr/testify/require"
"github.com/suzuki-shunsuke/flute/flute"

"github.com/suzuki-shunsuke/go-graylog"
"github.com/suzuki-shunsuke/go-graylog/client"
"github.com/suzuki-shunsuke/go-graylog/testdata"
"github.com/suzuki-shunsuke/go-graylog/testutil"
"github.com/suzuki-shunsuke/go-graylog/v8"
"github.com/suzuki-shunsuke/go-graylog/v8/client"
"github.com/suzuki-shunsuke/go-graylog/v8/testdata"
"github.com/suzuki-shunsuke/go-graylog/v8/testutil"
)

func TestClient_CreateDashboard(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion client/dashboard_widget.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"errors"

"github.com/suzuki-shunsuke/go-graylog"
"github.com/suzuki-shunsuke/go-graylog/v8"
)

// CreateDashboardWidget creates a new dashboard widget.
Expand Down
4 changes: 2 additions & 2 deletions client/dashboard_widget_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/suzuki-shunsuke/go-jsoneq/jsoneq"
"github.com/suzuki-shunsuke/go-ptr"

"github.com/suzuki-shunsuke/go-graylog"
"github.com/suzuki-shunsuke/go-graylog/client"
"github.com/suzuki-shunsuke/go-graylog/v8"
"github.com/suzuki-shunsuke/go-graylog/v8/client"
)

func TestClient_CreateDashboardWidget(t *testing.T) {
Expand Down
Loading

0 comments on commit 0980a2d

Please sign in to comment.