-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from packetbroker/feature/v1alpha1
Add v1alpha1 generated protos
- Loading branch information
Showing
13 changed files
with
22,068 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Copyright 2019 The Things Industries B.V. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
SHELL = bash | ||
GO = go | ||
PROTOC = protoc | ||
|
||
PROTO_PATH ?= ../.. | ||
VERSIONS ?= v1alpha1 | ||
GOPATH ?= $(shell $(GO) env GOPATH) | ||
|
||
.PHONY: all | ||
all: $(VERSIONS) | ||
|
||
.PHONY: deps | ||
deps: | ||
$(GO) get github.com/gogo/protobuf/protoc-gen-gogofaster | ||
$(GO) get google.golang.org/grpc | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf $(VERSIONS) | ||
|
||
v%: | ||
$(PROTOC) -I=$(GOPATH)/src -I=$(GOPATH)/src/github.com/gogo/protobuf/protobuf --gogofaster_out=plugins=grpc,\ | ||
Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types,\ | ||
Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,\ | ||
Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,\ | ||
Mgoogle/protobuf/struct.proto=github.com/gogo/protobuf/types,\ | ||
Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,\ | ||
Mgoogle/protobuf/wrappers.proto=github.com/gogo/protobuf/types:../../ \ | ||
--proto_path=$(PROTO_PATH) \ | ||
$(PROTO_PATH)/packetbroker/api/$@/*.proto \ | ||
&& pushd $@ \ | ||
&& go mod init go.packetbroker.org/api/$@ \ | ||
&& go get ./... \ | ||
&& popd | ||
|
||
# vim: ft=make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Packet Broker API for Go | ||
|
||
`go-api` is the Packet Broker API for Go. | ||
|
||
## Installing | ||
|
||
Use `go get` to retrieve the Go API. | ||
|
||
```bash | ||
$ go get go.packetbroker.org/api | ||
``` | ||
|
||
## Regenerating | ||
|
||
The generated protos are checked in to this repository. You only need to regenerate the protos to incorporate changes coming from upstream. | ||
|
||
To generate protos, [install the Protocol Compiler](https://github.com/protocolbuffers/protobuf#protocol-compiler-installation). | ||
|
||
Before generating protos, get the dependencies: | ||
|
||
```bash | ||
$ make deps | ||
``` | ||
|
||
Clean existing generated protos: | ||
|
||
```bash | ||
$ make clean | ||
``` | ||
|
||
To generate protos, clone the [Packet Broker API repository](https://github.com/packetbroker/api). | ||
|
||
If you clone the API repository in `../../packetbroker/api` relative to the path of this repository: | ||
|
||
```bash | ||
$ make | ||
``` | ||
|
||
If you clone the API repository somewhere else, pass the import path where the `packetbroker/api` folder resides like this: | ||
|
||
```bash | ||
$ PROTO_PATH=<path> make | ||
``` | ||
|
||
## License | ||
|
||
The Go API is distributed under [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0). See `LICENSE` for more information. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module go.packetbroker.org/api/v1alpha1 | ||
|
||
go 1.13 | ||
|
||
require ( | ||
github.com/gogo/protobuf v1.3.1 | ||
google.golang.org/grpc v1.25.1 | ||
) |
Oops, something went wrong.