diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5136c19 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Localbin +bin/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..20d57b0 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,11 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 # Use the ref you want to point at + hooks: + - id: trailing-whitespace + exclude: README.md + - id: check-added-large-files + - id: check-case-conflict + - id: check-merge-conflict + - id: end-of-file-fixer + exclude: README.md diff --git a/.woodpecker/documentation.yaml b/.woodpecker/documentation.yaml deleted file mode 100644 index 1e5d7c7..0000000 --- a/.woodpecker/documentation.yaml +++ /dev/null @@ -1,33 +0,0 @@ ---- -when: - event: - - push - branch: main - -steps: - lint: - name: Generate docs - image: pseudomuto/protoc-gen-doc - secrets: - - softplayer_bot_ssh_key - - git_known_hosts - commands: - - mkdir -p ~/.ssh - - apk update && apk add git openssh - - echo $SOFTPLAYER_BOT_SSH_KEY | base64 -d > ~/.ssh/id_ed25519 - - echo $GIT_KNOWN_HOSTS > ~/.ssh/known_hosts - - cat ~/.ssh/id_ed25519 - - chmod 0600 ~/.ssh/id_ed25519 - - protoc --proto_path=./proto --doc_out=. --doc_opt=markdown,README.md $(find ./proto -type f -iname "*.proto") - # To make sure there is always a change, even when protos are not updated - - echo "Generated on $(date)" >> README.md - - eval `ssh-agent` - - ssh-add ~/.ssh/id_ed25519 - - git config --global user.email "allanger@badhouseplants.net" - - git config --global user.name "Softplayer Bot" - - git clone git@gitea.badhouseplants.net:softplayer/softplayer-proto.git /tmp/repo - - git -C /tmp/repo checkout generated-documentation - - mv README.md /tmp/repo/README.md - - git -C /tmp/repo add . - - git -C /tmp/repo commit -m "Update documentation from $CI_COMMIT_SHA" - - git -C /tmp/repo push diff --git a/Containerfile b/Containerfile deleted file mode 100644 index bd8c0f0..0000000 --- a/Containerfile +++ /dev/null @@ -1,11 +0,0 @@ -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" ] - diff --git a/Makefile b/Makefile deleted file mode 100644 index b15f3fa..0000000 --- a/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# --------------------------------------------------------------------- -# -- 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") diff --git a/README.md b/README.md index 5c9c0e3..285fe4a 100644 --- a/README.md +++ b/README.md @@ -3,340 +3,26 @@ ## Table of Contents -- [environments/environments_v1.proto](#environments_environments_v1-proto) - - [CreateOptions](#environments-CreateOptions) - - [DeleteOptions](#environments-DeleteOptions) - - [EnvironmentFull](#environments-EnvironmentFull) - - [EnvironmentId](#environments-EnvironmentId) - - [EnvironmentMetadata](#environments-EnvironmentMetadata) - - [EnvironmentSpec](#environments-EnvironmentSpec) - - [GetOptions](#environments-GetOptions) - - [ListOptions](#environments-ListOptions) - - [OwnerId](#environments-OwnerId) - - [Token](#environments-Token) - - [UpdateOptions](#environments-UpdateOptions) - - - [Kubernetes](#environments-Kubernetes) - - [Location](#environments-Location) - - [Provider](#environments-Provider) - - [ServerType](#environments-ServerType) - - - [Environments](#environments-Environments) - -- [accounts/accounts_v1.proto](#accounts_accounts_v1-proto) +- [accounts_v1.proto](#accounts_v1-proto) - [AccountData](#accounts-AccountData) - [AccountFull](#accounts-AccountFull) - [AccountFullWithToken](#accounts-AccountFullWithToken) - [AccountId](#accounts-AccountId) - [AccountPassword](#accounts-AccountPassword) - [AccountWithPassword](#accounts-AccountWithPassword) + - [AccountWithPasswordAndCode](#accounts-AccountWithPasswordAndCode) + - [EmailVerified](#accounts-EmailVerified) - [Accounts](#accounts-Accounts) -- [applications/applications_v1.proto](#applications_applications_v1-proto) - - [ApplicationFull](#applications-ApplicationFull) - - [ApplicationId](#applications-ApplicationId) - - [ApplicationMetadata](#applications-ApplicationMetadata) - - [ApplicationSpec](#applications-ApplicationSpec) - - [ApplicationSpec.ConfigEntry](#applications-ApplicationSpec-ConfigEntry) - - [CreateOptions](#applications-CreateOptions) - - [DeleteOptions](#applications-DeleteOptions) - - [GetOptions](#applications-GetOptions) - - [ListOptions](#applications-ListOptions) - - [OwnerId](#applications-OwnerId) - - [Token](#applications-Token) - - [UpdateOptions](#applications-UpdateOptions) - - - [Applications](#applications-Applications) - -- [email/email_v1.proto](#email_email_v1-proto) - - [ConfirmValidation](#email-ConfirmValidation) - - [RequestValidation](#email-RequestValidation) - - - [EmailValidation](#email-EmailValidation) - - [Scalar Value Types](#scalar-value-types) - +

Top

-## environments/environments_v1.proto -This file has messages for describing environments - - - - -### CreateOptions - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| metadata | [EnvironmentMetadata](#environments-EnvironmentMetadata) | | | -| spec | [EnvironmentSpec](#environments-EnvironmentSpec) | | | -| owner_id | [OwnerId](#environments-OwnerId) | | | -| token | [Token](#environments-Token) | | | - - - - - - - - -### DeleteOptions - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| id | [EnvironmentId](#environments-EnvironmentId) | | | -| metadata | [EnvironmentMetadata](#environments-EnvironmentMetadata) | | | -| owner_id | [OwnerId](#environments-OwnerId) | | | -| token | [Token](#environments-Token) | | | - - - - - - - - -### EnvironmentFull - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| metadata | [EnvironmentMetadata](#environments-EnvironmentMetadata) | | | -| spec | [EnvironmentSpec](#environments-EnvironmentSpec) | | | -| id | [EnvironmentId](#environments-EnvironmentId) | | | - - - - - - - - -### EnvironmentId - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| uuid | [string](#string) | | | - - - - - - - - -### EnvironmentMetadata - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| name | [string](#string) | | A name of the environment | -| description | [string](#string) | | | - - - - - - - - -### EnvironmentSpec - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| provider | [Provider](#environments-Provider) | | Provide | -| kubernetes | [Kubernetes](#environments-Kubernetes) | | | -| server_type | [ServerType](#environments-ServerType) | | | -| server_location | [Location](#environments-Location) | | | -| disk_size | [int32](#int32) | | | - - - - - - - - -### GetOptions - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| id | [EnvironmentId](#environments-EnvironmentId) | | | -| metadata | [EnvironmentMetadata](#environments-EnvironmentMetadata) | | | -| owner_id | [OwnerId](#environments-OwnerId) | | | -| token | [Token](#environments-Token) | | | - - - - - - - - -### ListOptions - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| metadata | [EnvironmentMetadata](#environments-EnvironmentMetadata) | | | -| search_string | [string](#string) | | | -| owner_id | [OwnerId](#environments-OwnerId) | | | -| token | [Token](#environments-Token) | | | - - - - - - - - -### OwnerId - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| uuid | [string](#string) | | UUID of a user that is creating an environemnt | - - - - - - - - -### Token - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| token | [string](#string) | | Token that should be used to create an environment | - - - - - - - - -### UpdateOptions - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| id | [EnvironmentId](#environments-EnvironmentId) | | | -| metadata | [EnvironmentMetadata](#environments-EnvironmentMetadata) | | | -| spec | [EnvironmentSpec](#environments-EnvironmentSpec) | | | -| owner_id | [OwnerId](#environments-OwnerId) | | | -| token | [Token](#environments-Token) | | | - - - - - - - - - - -### Kubernetes - - -| Name | Number | Description | -| ---- | ------ | ----------- | -| KUBERNETES_UNSPECIFIED | 0 | | -| KUBERNETES_K3S | 1 | | - - - - - -### Location - - -| Name | Number | Description | -| ---- | ------ | ----------- | -| LOCATION_UNSPECIFIED | 0 | | -| LOCATION_HETZNER_NUREMBERG | 1 | | -| LOCATION_HETZNER_FALKENSTEIN | 2 | | -| LOCATION_HETZNER_HELSINKI | 3 | | -| LOCATION_HETZNER_HILLSBORO | 4 | | -| LOCATION_HETZNER_ASHBURN | 5 | | - - - - - -### Provider -Helpers and other messages - -| Name | Number | Description | -| ---- | ------ | ----------- | -| PROVIDER_UNSPECIFIED | 0 | | -| PROVIDER_HETZNER | 1 | | - - - - - -### ServerType - - -| Name | Number | Description | -| ---- | ------ | ----------- | -| SERVER_TYPE_UNSPECIFIED | 0 | | -| SERVER_TYPE_STARTER | 1 | | -| SERVER_TYPE_REGULAR | 2 | | -| SERVER_TYPE_PLUS | 3 | | -| SERVER_TYPE_PRO | 4 | | -| SERVER_TYPE_CUSTOM | 5 | | - - - - - - - - - -### Environments -Service for handling environments - -| Method Name | Request Type | Response Type | Description | -| ----------- | ------------ | ------------- | ------------| -| Create | [CreateOptions](#environments-CreateOptions) | [EnvironmentFull](#environments-EnvironmentFull) | | -| Update | [UpdateOptions](#environments-UpdateOptions) | [EnvironmentFull](#environments-EnvironmentFull) | | -| Delete | [DeleteOptions](#environments-DeleteOptions) | [.google.protobuf.Empty](#google-protobuf-Empty) | | -| Get | [GetOptions](#environments-GetOptions) | [EnvironmentFull](#environments-EnvironmentFull) | | -| List | [ListOptions](#environments-ListOptions) | [EnvironmentFull](#environments-EnvironmentFull) stream | | - - - - - - -

Top

- -## accounts/accounts_v1.proto +## accounts_v1.proto This file has messages for describing environments @@ -434,6 +120,38 @@ Represents a environment UUID only + + + +### AccountWithPasswordAndCode + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| data | [AccountData](#accounts-AccountData) | | | +| password | [AccountPassword](#accounts-AccountPassword) | | | +| code | [string](#string) | | | + + + + + + + + +### EmailVerified + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| verified | [bool](#bool) | | | + + + + + @@ -451,297 +169,8 @@ Service for handling environments | SignUp | [AccountWithPassword](#accounts-AccountWithPassword) | [AccountFullWithToken](#accounts-AccountFullWithToken) | | | SignIn | [AccountWithPassword](#accounts-AccountWithPassword) | [AccountFullWithToken](#accounts-AccountFullWithToken) | | | ResetPassword | [AccountData](#accounts-AccountData) | [.google.protobuf.Empty](#google-protobuf-Empty) | | - - - - - - -

Top

- -## applications/applications_v1.proto -This file has messages for describing applications - - - - -### ApplicationFull - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| metadata | [ApplicationMetadata](#applications-ApplicationMetadata) | | | -| spec | [ApplicationSpec](#applications-ApplicationSpec) | | | -| id | [ApplicationId](#applications-ApplicationId) | | | - - - - - - - - -### ApplicationId - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| uuid | [string](#string) | | | - - - - - - - - -### ApplicationMetadata - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| name | [string](#string) | | | -| description | [string](#string) | | | - - - - - - - - -### ApplicationSpec - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| application | [string](#string) | | | -| version | [string](#string) | | | -| environemnt_id | [string](#string) | | | -| config | [ApplicationSpec.ConfigEntry](#applications-ApplicationSpec-ConfigEntry) | repeated | | -| raw_config | [string](#string) | | | - - - - - - - - -### ApplicationSpec.ConfigEntry - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| key | [string](#string) | | | -| value | [string](#string) | | | - - - - - - - - -### CreateOptions - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| metadata | [ApplicationMetadata](#applications-ApplicationMetadata) | | | -| spec | [ApplicationSpec](#applications-ApplicationSpec) | | | -| owner_id | [OwnerId](#applications-OwnerId) | | | -| token | [Token](#applications-Token) | | | - - - - - - - - -### DeleteOptions - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| id | [ApplicationId](#applications-ApplicationId) | | | -| metadata | [ApplicationMetadata](#applications-ApplicationMetadata) | | | -| owner_id | [OwnerId](#applications-OwnerId) | | | -| token | [Token](#applications-Token) | | | - - - - - - - - -### GetOptions - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| id | [ApplicationId](#applications-ApplicationId) | | | -| metadata | [ApplicationMetadata](#applications-ApplicationMetadata) | | | -| owner_id | [OwnerId](#applications-OwnerId) | | | -| token | [Token](#applications-Token) | | | - - - - - - - - -### ListOptions - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| metadata | [ApplicationMetadata](#applications-ApplicationMetadata) | | | -| owner_id | [OwnerId](#applications-OwnerId) | | | -| token | [Token](#applications-Token) | | | - - - - - - - - -### OwnerId - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| uuid | [string](#string) | | UUID of a user that is creating an environemnt | - - - - - - - - -### Token - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| token | [string](#string) | | Token that should be used to create an environment | - - - - - - - - -### UpdateOptions - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| id | [ApplicationId](#applications-ApplicationId) | | | -| metadata | [ApplicationMetadata](#applications-ApplicationMetadata) | | | -| spec | [ApplicationSpec](#applications-ApplicationSpec) | | | -| owner_id | [OwnerId](#applications-OwnerId) | | | -| token | [Token](#applications-Token) | | | - - - - - - - - - - - - - - -### Applications -Service for handling applications - -| Method Name | Request Type | Response Type | Description | -| ----------- | ------------ | ------------- | ------------| -| Create | [CreateOptions](#applications-CreateOptions) | [ApplicationFull](#applications-ApplicationFull) | | -| Update | [UpdateOptions](#applications-UpdateOptions) | [ApplicationFull](#applications-ApplicationFull) | | -| Delete | [DeleteOptions](#applications-DeleteOptions) | [.google.protobuf.Empty](#google-protobuf-Empty) | | -| Get | [GetOptions](#applications-GetOptions) | [ApplicationFull](#applications-ApplicationFull) | | -| List | [ListOptions](#applications-ListOptions) | [ApplicationFull](#applications-ApplicationFull) stream | | - - - - - - -

Top

- -## email/email_v1.proto -This file has messages for describing environments - - - - -### ConfirmValidation - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| user_id | [string](#string) | | | -| code | [int32](#int32) | | | - - - - - - - - -### RequestValidation - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| user_id | [string](#string) | | | - - - - - - - - - - - - - - -### EmailValidation -A service that should handle email validation - -| Method Name | Request Type | Response Type | Description | -| ----------- | ------------ | ------------- | ------------| -| SendRequest | [RequestValidation](#email-RequestValidation) | [.google.protobuf.Empty](#google-protobuf-Empty) | | -| ValidateEmail | [ConfirmValidation](#email-ConfirmValidation) | [.google.protobuf.Empty](#google-protobuf-Empty) | | +| NewPassword | [AccountWithPasswordAndCode](#accounts-AccountWithPasswordAndCode) | [.google.protobuf.Empty](#google-protobuf-Empty) | | +| IsEmailVerified | [AccountData](#accounts-AccountData) | [EmailVerified](#accounts-EmailVerified) | | diff --git a/Taskfile.yml b/Taskfile.yml new file mode 100644 index 0000000..7f255a8 --- /dev/null +++ b/Taskfile.yml @@ -0,0 +1,81 @@ +# yaml-language-server: $schema=https://taskfile.dev/schema.json + +version: "3" + +vars: + LOCALBIN: + sh: echo "$(pwd)/bin" + CONTAINER_TOOL: '{{.CONTAINER_TOOL | default "podman"}}' + # Tools + PROTODOC: "{{.LOCALBIN}}/protodoc" + PROTOLINT: "{{.LOCALBIN}}/protolint" +tasks: + container-lint: + desc: Run linter in a container + cmd: |- + "{{.CONTAINER_TOOL}}" run --rm \ + -v $PWD:/workspace:z \ + --workdir /workspace \ + docker.io/yoheimuta/protolint:latest lint \ + $(find . -type f -iname "*.proto") + + container-docs: + desc: Generate docs in a container + cmd: |- + "{{.CONTAINER_TOOL}}" run --rm \ + -v $PWD/proto:/protos \ + -v $PWD:/out:z \ + docker.io/pseudomuto/protoc-gen-doc:latest --doc_opt=markdown,README.md + + # Install required tools + localbin: + desc: Create local bin directory + silent: true + cmds: + - mkdir -p "{{.LOCALBIN}}" + + protodoc: + desc: Install protodoc + silent: true + deps: + - localbin + cmds: + - task: go-install-tool + vars: + TARGET: "{{.PROTODOC}}" + PACKAGE: go.etcd.io/protodoc + VERSION: "latest" + + protolint: + desc: Install protolint + silent: true + deps: + - localbin + cmds: + - task: go-install-tool + vars: + TARGET: "{{.PROTOLINT}}" + PACKAGE: github.com/yoheimuta/protolint/cmd/protolint + VERSION: "latest" + + go-install-tool: + internal: true + silent: true + cmd: |- + set -e + TARGET="{{.TARGET}}" + PACKAGE="{{.PACKAGE}}@{{.VERSION}}" + VERSIONED="${TARGET}-{{.VERSION}}" + + if [ -f "$VERSIONED" ] && [ "$(readlink -- "$TARGET" 2>/dev/null)" = "$VERSIONED" ]; then + echo "$PACKAGE already installed" + exit 0 + fi + + echo "Downloading $PACKAGE" + rm -f "$TARGET" + + GOBIN="{{.LOCALBIN}}" go install "$PACKAGE" + + mv "{{.LOCALBIN}}/$(basename "$TARGET")" "$VERSIONED" + ln -sf "$(realpath "$VERSIONED")" "$TARGET" diff --git a/proto/accounts/accounts_v1.proto b/proto/accounts_v1.proto similarity index 98% rename from proto/accounts/accounts_v1.proto rename to proto/accounts_v1.proto index 6c8fe28..ea5459c 100644 --- a/proto/accounts/accounts_v1.proto +++ b/proto/accounts_v1.proto @@ -47,7 +47,7 @@ message AccountWithPasswordAndCode { } -message AccountFull { +message AccountFull { AccountId id = 1; AccountData data = 2; } @@ -57,4 +57,3 @@ message AccountFullWithToken { AccountData data = 2; string token = 3; } - diff --git a/proto/applications/applications_v1.proto b/proto/applications/applications_v1.proto deleted file mode 100644 index 0972545..0000000 --- a/proto/applications/applications_v1.proto +++ /dev/null @@ -1,93 +0,0 @@ -/// This file has messages for describing applications -syntax = "proto3"; -package applications; -import "google/protobuf/empty.proto"; -option go_package = "gitea.badhouseplants.net/softplayer/softplayer-go-proto/pkg/applications"; - -/** - * Service for handling applications - */ -service Applications { - rpc Create(CreateOptions) returns (ApplicationFull) {} - rpc Update(UpdateOptions) returns (ApplicationFull) {} - rpc Delete(DeleteOptions) returns (google.protobuf.Empty) {} - rpc Get(GetOptions) returns (ApplicationFull) {} - rpc List(ListOptions) returns (stream ApplicationFull) {} -} - -/** - User related messages - */ - -message OwnerId { - string uuid = 1; // UUID of a user that is creating an environemnt -} - -message Token { - string token = 1; // Token that should be used to create an environment -} - -/** - Services options - */ - -message CreateOptions { - ApplicationMetadata metadata = 1; - ApplicationSpec spec = 2; - OwnerId owner_id = 3; - Token token = 4; -} - -message UpdateOptions { - ApplicationId id = 1; - ApplicationMetadata metadata = 2; - ApplicationSpec spec = 3; - OwnerId owner_id = 4; - Token token = 5; -} - -message DeleteOptions { - ApplicationId id = 1; - ApplicationMetadata metadata = 2; - OwnerId owner_id = 3; - Token token = 4; -} - -message GetOptions { - ApplicationId id = 1; - ApplicationMetadata metadata = 2; - OwnerId owner_id = 3; - Token token = 4; -} - -message ListOptions { - ApplicationMetadata metadata = 1; - OwnerId owner_id = 2; - Token token = 3; -} -/** - Environment related messages - */ - -message ApplicationId { - string uuid = 1; -} - -message ApplicationMetadata { - string name = 1; - string description = 2; -} - -message ApplicationSpec { - string application = 1; - string version = 2; - string environemnt_id = 3; - map config = 4; - string raw_config = 5; -} - -message ApplicationFull { - ApplicationMetadata metadata = 1; - ApplicationSpec spec = 2; - ApplicationId id = 3; -} diff --git a/proto/email/email_v1.proto b/proto/email/email_v1.proto deleted file mode 100644 index e1e4a85..0000000 --- a/proto/email/email_v1.proto +++ /dev/null @@ -1,23 +0,0 @@ -/// This file has messages for describing environments -syntax = "proto3"; -package email; -import "google/protobuf/empty.proto"; -option go_package = "gitea.badhouseplants.net/softplayer/softplayer-go-proto/pkg/email"; - -/* - * A service that should handle email validation - */ -service EmailValidation { - rpc SendRequest (RequestValidation) returns (google.protobuf.Empty) {} - rpc ValidateEmail (ConfirmValidation) returns (google.protobuf.Empty) {} -} - -message RequestValidation { - string user_id = 1; -} - -message ConfirmValidation { - string user_id = 1; - int32 code = 2; -} - diff --git a/proto/environments/environments_v1.proto b/proto/environments/environments_v1.proto deleted file mode 100644 index f6148a9..0000000 --- a/proto/environments/environments_v1.proto +++ /dev/null @@ -1,125 +0,0 @@ -/// This file has messages for describing environments -syntax = "proto3"; -package environments; -import "google/protobuf/empty.proto"; -option go_package = "gitea.badhouseplants.net/softplayer/softplayer-go-proto/pkg/environments"; - -/** - * Service for handling environments - */ -service Environments { - rpc Create(CreateOptions) returns (EnvironmentFull) {} - rpc Update(UpdateOptions) returns (EnvironmentFull) {} - rpc Delete(DeleteOptions) returns (google.protobuf.Empty) {} - rpc Get(GetOptions) returns (EnvironmentFull) {} - rpc List(ListOptions) returns (stream EnvironmentFull) {} -} - -/** - User related messages - */ - -message OwnerId { - string uuid = 1; // UUID of a user that is creating an environemnt -} - -message Token { - string token = 1; // Token that should be used to create an environment -} - -/** - Services options - */ - -message CreateOptions { - EnvironmentMetadata metadata = 1; - EnvironmentSpec spec = 2; - OwnerId owner_id = 3; - Token token = 4; -} - -message UpdateOptions { - EnvironmentId id = 1; - EnvironmentMetadata metadata = 2; - EnvironmentSpec spec = 3; - OwnerId owner_id = 4; - Token token = 5; -} - -message DeleteOptions { - EnvironmentId id = 1; - EnvironmentMetadata metadata = 2; - OwnerId owner_id = 3; - Token token = 4; -} - -message GetOptions { - EnvironmentId id = 1; - EnvironmentMetadata metadata = 2; - OwnerId owner_id = 3; - Token token = 4; -} - -message ListOptions { - EnvironmentMetadata metadata = 1; - string search_string = 2; - OwnerId owner_id = 3; - Token token = 4; -} -/** - Environment related messages - */ - -message EnvironmentId { - string uuid = 1; -} -message EnvironmentMetadata { - string name = 1; // A name of the environment - string description = 2; -} - -message EnvironmentSpec { - Provider provider = 1; // Provide - Kubernetes kubernetes = 2; - ServerType server_type = 3; - Location server_location = 4; - int32 disk_size = 5; -} - -message EnvironmentFull { - EnvironmentMetadata metadata = 1; - EnvironmentSpec spec = 2; - EnvironmentId id = 3; -} - - -/** - Helpers and other messages - */ -enum Provider { - PROVIDER_UNSPECIFIED = 0; - PROVIDER_HETZNER = 1; -} - -enum ServerType { - SERVER_TYPE_UNSPECIFIED = 0; - SERVER_TYPE_STARTER = 1; - SERVER_TYPE_REGULAR = 2; - SERVER_TYPE_PLUS = 3; - SERVER_TYPE_PRO = 4; - SERVER_TYPE_CUSTOM = 5; -} - -enum Location { - LOCATION_UNSPECIFIED = 0; - LOCATION_HETZNER_NUREMBERG = 1; - LOCATION_HETZNER_FALKENSTEIN = 2; - LOCATION_HETZNER_HELSINKI = 3; - LOCATION_HETZNER_HILLSBORO = 4; - LOCATION_HETZNER_ASHBURN = 5; -} - -enum Kubernetes { - KUBERNETES_UNSPECIFIED = 0; - KUBERNETES_K3S = 1; -}