Init commit

This commit is contained in:
Nikolai Rodionov 2024-03-17 19:23:28 +01:00
commit d106158785
Signed by: allanger
GPG Key ID: 0AA46A90E25592AD
5 changed files with 193 additions and 0 deletions

6
.protolint.yaml Normal file
View File

@ -0,0 +1,6 @@
# Lint directives.
lint:
rules_option:
max_line_length:
max_chars: 120
tab_chars: 2

11
Containerfile Normal file
View File

@ -0,0 +1,11 @@
FROM alpine:3.16.2
RUN apk add --no-cache git make musl-dev go protobuf protobuf-dev
ENV GOROOT /usr/lib/go
ENV GOPATH /go
ENV PATH /go/bin:$PATH
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26
RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1
CMD [ "protoc -v" ]

36
Makefile Normal file
View File

@ -0,0 +1,36 @@
# ---------------------------------------------------------------------
# -- Which container tool to use
# ---------------------------------------------------------------------
CONTAINER_TOOL ?= docker
protoc-docs-gen:
protoc \
--proto_path=./proto \
--doc_out=. \
--doc_opt=markdown,readme.md \
$$(find ./proto -type f -iname "*.proto")
docker-docs-gen:
$(CONTAINER_TOOL) run --rm \
-v $$(pwd):/out \
-v $$(pwd)/proto:/proto \
pseudomuto/protoc-gen-doc --doc_opt=markdown,README.md --proto_path=proto \
$$(find proto -type f -iname "*.proto")
docker-lint:
$(CONTAINER_TOOL) run --rm \
-v $$(pwd):/workspace \
--workdir /workspace \
yoheimuta/protolint lint \
$$(find . -type f -iname "*.proto")
docker-protobuf:
$(CONTAINER_TOOL) build -t gogen . && \
$(CONTAINER_TOOL) run --rm \
-v $$(pwd)/proto:/proto \
-v $$(pwd)/pkg:/pkg \
gogen \
protoc --go_out=/pkg/ --go_opt=paths=source_relative \
--go-grpc_out=/pkg/ --go-grpc_opt=paths=source_relative \
--proto_path=proto/proto \
$$(find proto -type f -iname "*.proto")

108
README.md Normal file
View File

@ -0,0 +1,108 @@
# Protocol Documentation
<a name="top"></a>
## Table of Contents
- [proto/environments_v1.proto](#proto_environments_v1-proto)
- [EnvironmentData](#environments-EnvironmentData)
- [EnvironmentFull](#environments-EnvironmentFull)
- [EnvironmentId](#environments-EnvironmentId)
- [Environments](#environments-Environments)
- [Scalar Value Types](#scalar-value-types)
<a name="proto_environments_v1-proto"></a>
<p align="right"><a href="#top">Top</a></p>
## proto/environments_v1.proto
This file has messages for describing environments
<a name="environments-EnvironmentData"></a>
### EnvironmentData
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| name | [string](#string) | | Environment name |
<a name="environments-EnvironmentFull"></a>
### EnvironmentFull
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| id | [EnvironmentId](#environments-EnvironmentId) | | |
| data | [EnvironmentData](#environments-EnvironmentData) | | |
<a name="environments-EnvironmentId"></a>
### EnvironmentId
Represents a environment UUID only
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| id | [string](#string) | | Contour ID: UUID |
<a name="environments-Environments"></a>
### Environments
Service for handling environments
| Method Name | Request Type | Response Type | Description |
| ----------- | ------------ | ------------- | ------------|
| Create | [EnvironmentData](#environments-EnvironmentData) | [EnvironmentData](#environments-EnvironmentData) | Should be used to create a new environment / Depending on the implementations, it should / create a working k8s cluster / Hetzner: |
## Scalar Value Types
| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby |
| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- |
| <a name="double" /> double | | double | double | float | float64 | double | float | Float |
| <a name="float" /> float | | float | float | float | float32 | float | float | Float |
| <a name="int32" /> int32 | Uses variable-length encoding. Inefficient for encoding negative numbers if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
| <a name="int64" /> int64 | Uses variable-length encoding. Inefficient for encoding negative numbers if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum |
| <a name="uint32" /> uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) |
| <a name="uint64" /> uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) |
| <a name="sint32" /> sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
| <a name="sint64" /> sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum |
| <a name="fixed32" /> fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) |
| <a name="fixed64" /> fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum |
| <a name="sfixed32" /> sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
| <a name="sfixed64" /> sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum |
| <a name="bool" /> bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass |
| <a name="string" /> string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) |
| <a name="bytes" /> bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) |

View File

@ -0,0 +1,32 @@
/// This file has messages for describing environments
syntax = "proto3";
package environments;
import "google/protobuf/empty.proto";
option go_package = "git.badhouseplants.net/badhouseplants/softplayer-go-proto/pkg/environments";
/**
* Service for handling environments
*/
service Environments {
rpc Create(EnvironmentData) returns (EnvironmentFull) {}
rpc Update(EnvironmentFull) returns (EnvironmentFull) {}
rpc Delete(EnvironmentFull) returns (google.protobuf.Empty) {}
rpc Get(EnvironmentId) returns (EnvironmentFull) {}
rpc List(google.protobuf.Empty) returns (stream EnvironmentFull) {}
}
/**
* Represents a environment UUID only
*/
message EnvironmentId {
string id = 1; // Contour ID: UUID
}
message EnvironmentData {
string name = 1; // Environment name
}
message EnvironmentFull {
EnvironmentId id = 1;
EnvironmentData data = 2;
}