Skip to content

Commit

Permalink
Merge pull request #4 from komminarlabs/tk/generate
Browse files Browse the repository at this point in the history
chore: use tools package for code generation
  • Loading branch information
thulasirajkomminar authored Sep 30, 2024
2 parents 5e42e8f + 81e1490 commit 743bd65
Show file tree
Hide file tree
Showing 7 changed files with 206 additions and 18 deletions.
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
# InfluxDB v3 Cloud Dedicated Management API Client Library
# InfluxDB v3 Cloud Dedicated Management API Go Client Library

The InfluxDB v3 Management API client library lets you manage an InfluxDB Cloud Dedicated instance and integrate functions such as creating and managing databases, permissions, and tokens into your workflow or application.
The InfluxDB v3 Management API Go client library lets you manage an InfluxDB Cloud Dedicated instance and integrate functions such as creating and managing databases, permissions, and tokens into your workflow or application.

## Generated types and API client

This library is generated using [oapi-codegen](https://github.com/oapi-codegen/oapi-codegen) from this [OpenAPI spec](https://github.com/influxdata/docs-v2/blob/master/api-docs/cloud-dedicated/management/openapi.yml)

### Generate

#### Generate types
`oapi-codegen -generate types -o types.gen.go -package influxdb3 openapi.yml`

#### Generate client
`oapi-codegen -generate client -o client.gen.go -package influxdb3 openapi.yml`

```go
go generate ./...
```

## Usage

Expand Down
2 changes: 1 addition & 1 deletion client.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions generate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package influxdb3

//go:generate go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen -generate types -o types.gen.go -package influxdb3 openapi.yml
//go:generate go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen -generate client -o client.gen.go -package influxdb3 openapi.yml
21 changes: 20 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,28 @@ module github.com/komminarlabs/influxdb3

go 1.22.2

require github.com/oapi-codegen/runtime v1.1.1
require (
github.com/oapi-codegen/oapi-codegen/v2 v2.4.1
github.com/oapi-codegen/runtime v1.1.1
)

require (
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 // indirect
github.com/getkin/kin-openapi v0.127.0 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/google/uuid v1.5.0 // indirect
github.com/invopop/yaml v0.3.1 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/perimeterx/marshmallow v1.1.5 // indirect
github.com/speakeasy-api/openapi-overlay v0.9.0 // indirect
github.com/vmware-labs/yaml-jsonpath v0.3.2 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
164 changes: 162 additions & 2 deletions go.sum

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions tools/tools.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build tools
// +build tools

package tools

import (
_ "github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen"
)
12 changes: 6 additions & 6 deletions types.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 743bd65

Please sign in to comment.