Skip to content
This repository was archived by the owner on Sep 19, 2024. It is now read-only.

Commit f152e0d

Browse files
committed
add grpc api as a sub module
- contains user facing proto based types for policies and services
1 parent cc516f7 commit f152e0d

16 files changed

+1092
-0
lines changed

.licensei.toml

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ approved = [
1010
ignored = [
1111
"google.golang.org/protobuf", # bsd-3
1212
"gopkg.in/fsnotify.v1", # bsd-3
13+
14+
"buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go",
1315
]
1416

1517
[header]

api/Makefile

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
include ../common.mk
2+
3+
BUF_VERSION = 1.28.1
4+
5+
generate-protobuf: download-buf ## generate protobuf
6+
./bin/buf mod update
7+
./bin/buf generate
8+
9+
download-buf:
10+
./scripts/install-buf.sh $(BUF_VERSION)

api/buf.gen.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: v1
2+
plugins:
3+
- name: go
4+
out: .
5+
opt: paths=source_relative
6+
- name: go-grpc
7+
out: .
8+
opt: paths=source_relative

api/buf.lock

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Generated by buf. DO NOT EDIT.
2+
version: v1
3+
deps:
4+
- remote: buf.build
5+
owner: bufbuild
6+
repository: protovalidate
7+
commit: e097f827e65240ac9fd4b1158849a8fc
8+
digest: shake256:f19252436fd9ded945631e2ffaaed28247a92c9015ccf55ae99db9fb3d9600c4fdb00fd2d3bd7701026ec2fd4715c5129e6ae517c25a59ba690020cfe80bf8ad

api/buf.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: v1
2+
deps:
3+
- buf.build/bufbuild/protovalidate
4+
lint:
5+
use:
6+
- BASIC
7+
except:
8+
- FIELD_LOWER_SNAKE_CASE
9+
- PACKAGE_DIRECTORY_MATCH
10+
allow_comment_ignores: true

api/go.mod

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module github.com/cisco-open/nasp/api
2+
3+
go 1.21.4
4+
5+
require (
6+
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20231115204500-e097f827e652.2
7+
google.golang.org/protobuf v1.31.0
8+
)

api/go.sum

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20231115204500-e097f827e652.2 h1:iEPA5SBtdLJNwQis/SrcCuDWJh5E1V0mVO4Ih7/mRbg=
2+
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20231115204500-e097f827e652.2/go.mod h1:xafc+XIsTxTy76GJQ1TKgvJWsSugFBqMaN27WhUblew=
3+
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
4+
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
5+
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
6+
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
7+
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
8+
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
9+
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
10+
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=

api/scripts/install-buf.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
[ -z "${1:-}" ] && { echo "Usage: $0 <version>"; exit 1; }
5+
6+
version=$1
7+
target_name=buf-${version}
8+
link_path=bin/buf
9+
10+
[ -e ${link_path} ] && rm -r ${link_path}
11+
12+
mkdir -p bin
13+
ln -s "${target_name}" ${link_path}
14+
15+
if [ ! -e bin/"${target_name}" ]; then
16+
os=$(uname -s)
17+
arch=$(uname -m)
18+
19+
url="https://github.com/bufbuild/buf/releases/download/v${version}/buf-${os}-${arch}"
20+
21+
curl -f -s -L "${url}" -o bin/"${target_name}"
22+
chmod u+x bin/"${target_name}"
23+
fi

0 commit comments

Comments
 (0)