Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[storage][front-end] Add google.api.http #186

Merged
merged 3 commits into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions storage/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright (c) 2022 Dell Inc, or its subsidiaries.

all:
rm -rf ./v1/{autogen.md,gen}
rm -rf ./v1/{autogen.md,gen,google}
mkdir -p ./v1/gen/{go,cpp,python}

docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}":/defs -v "${PWD}/../common/v1":/common namely/protoc-all:1.47_2 -i /common --lint -d v1 -l go -o ./v1/gen/go/ --go-source-relative
Expand All @@ -14,10 +14,13 @@ all:
# common included files to the proto directory
cp ../common/v1/uuid.proto "${PWD}"/v1
cp ../common/v1/object_key.proto "${PWD}"/v1
curl -kL https://github.com/googleapis/googleapis/archive/master.tar.gz | tar --strip=1 -zxvf - googleapis-master/google/api
mv google "${PWD}"/v1/

docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}"/v1/:/out -v "${PWD}"/v1:/protos pseudomuto/protoc-gen-doc --doc_opt=markdown,autogen.md
docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}"/v1/:/out -w /out --entrypoint=sh ghcr.io/docker-multiarch/google-api-linter:1.36.0 -c "api-linter /out/*.proto --output-format summary"

# remove common included files from the proto directory
rm "${PWD}"/v1/uuid.proto
rm "${PWD}"/v1/object_key.proto
rm "${PWD}"/v1/object_key.proto
rm -rf "${PWD}"/v1/google
2 changes: 1 addition & 1 deletion storage/v1/autogen.md
Original file line number Diff line number Diff line change
Expand Up @@ -1438,7 +1438,7 @@ Intentionally empty.

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| subsystem_id | [int64](#int64) | | |
| virtioblk_id | [int64](#int64) | | |



Expand Down
97 changes: 82 additions & 15 deletions storage/v1/frontend_nvme_pcie.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,102 @@ import "common.proto";
import "uuid.proto";
import "object_key.proto";
import "google/protobuf/empty.proto";
import "google/api/annotations.proto";

// Front End (host-facing) APIs.

// NVMe/PCIe emulation

service NVMeSubsystemService {
rpc NVMeSubsystemCreate (NVMeSubsystemCreateRequest) returns (NVMeSubsystem) {}
rpc NVMeSubsystemDelete (NVMeSubsystemDeleteRequest) returns (google.protobuf.Empty) {}
rpc NVMeSubsystemUpdate (NVMeSubsystemUpdateRequest) returns (NVMeSubsystem) {}
rpc NVMeSubsystemList (NVMeSubsystemListRequest) returns (NVMeSubsystemListResponse) {}
rpc NVMeSubsystemGet (NVMeSubsystemGetRequest) returns (NVMeSubsystem) {}
rpc NVMeSubsystemCreate (NVMeSubsystemCreateRequest) returns (NVMeSubsystem) {
option (google.api.http) = {
post: "/v1/subsystems"
body: "subsystem"
glimchb marked this conversation as resolved.
Show resolved Hide resolved
};
}
rpc NVMeSubsystemDelete (NVMeSubsystemDeleteRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1/subsystems/{subsystem}"
};
}
rpc NVMeSubsystemUpdate (NVMeSubsystemUpdateRequest) returns (NVMeSubsystem) {
option (google.api.http) = {
patch: "/v1/subsystems"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it shoud have been:
patch: "/v1/subsystems/{subsystem}"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, good catch!

body: "subsystem"
};
}
rpc NVMeSubsystemList (NVMeSubsystemListRequest) returns (NVMeSubsystemListResponse) {
option (google.api.http) = {
get: "/v1/subsystems"
};
}
rpc NVMeSubsystemGet (NVMeSubsystemGetRequest) returns (NVMeSubsystem) {
option (google.api.http) = {
get: "/v1/subsystems/{subsystem}"
};
}
rpc NVMeSubsystemStats (NVMeSubsystemStatsRequest) returns (NVMeSubsystemStatsResponse) {}
}

service NVMeControllerService {
rpc NVMeControllerCreate (NVMeControllerCreateRequest) returns (NVMeController) {}
rpc NVMeControllerDelete (NVMeControllerDeleteRequest) returns (google.protobuf.Empty) {}
rpc NVMeControllerUpdate (NVMeControllerUpdateRequest) returns (NVMeController) {}
rpc NVMeControllerList (NVMeControllerListRequest) returns (NVMeControllerListResponse) {}
rpc NVMeControllerGet (NVMeControllerGetRequest) returns (NVMeController) {}
rpc NVMeControllerCreate (NVMeControllerCreateRequest) returns (NVMeController) {
option (google.api.http) = {
post: "/v1/controllers"
body: "controller"
};
}
rpc NVMeControllerDelete (NVMeControllerDeleteRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1/controllers/{controller}"
};
}
rpc NVMeControllerUpdate (NVMeControllerUpdateRequest) returns (NVMeController) {
option (google.api.http) = {
patch: "/v1/controllers"
body: "controller"
};
}
rpc NVMeControllerList (NVMeControllerListRequest) returns (NVMeControllerListResponse) {
option (google.api.http) = {
get: "/v1/controllers"
};
}
rpc NVMeControllerGet (NVMeControllerGetRequest) returns (NVMeController) {
option (google.api.http) = {
get: "/v1/controllers/{controller}"
};
}
rpc NVMeControllerStats (NVMeControllerStatsRequest) returns (NVMeControllerStatsResponse) {}
}

service NVMeNamespaceService {
rpc NVMeNamespaceCreate (NVMeNamespaceCreateRequest) returns (NVMeNamespace) {}
rpc NVMeNamespaceDelete (NVMeNamespaceDeleteRequest) returns (google.protobuf.Empty) {}
rpc NVMeNamespaceUpdate (NVMeNamespaceUpdateRequest) returns (NVMeNamespace) {}
rpc NVMeNamespaceList (NVMeNamespaceListRequest) returns (NVMeNamespaceListResponse) {}
rpc NVMeNamespaceGet (NVMeNamespaceGetRequest) returns (NVMeNamespace) {}
rpc NVMeNamespaceCreate (NVMeNamespaceCreateRequest) returns (NVMeNamespace) {
option (google.api.http) = {
post: "/v1/namespaces"
body: "namespace"
};
}
rpc NVMeNamespaceDelete (NVMeNamespaceDeleteRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1/namespaces/{namespace}"
};
}
rpc NVMeNamespaceUpdate (NVMeNamespaceUpdateRequest) returns (NVMeNamespace) {
option (google.api.http) = {
patch: "/v1/namespaces"
body: "namespace"
};
}
rpc NVMeNamespaceList (NVMeNamespaceListRequest) returns (NVMeNamespaceListResponse) {
option (google.api.http) = {
get: "/v1/namespaces"
};
}
rpc NVMeNamespaceGet (NVMeNamespaceGetRequest) returns (NVMeNamespace) {
option (google.api.http) = {
get: "/v1/namespaces/{namespace}"
};
}
rpc NVMeNamespaceStats (NVMeNamespaceStatsRequest) returns (NVMeNamespaceStatsResponse) {}
}

Expand Down
35 changes: 29 additions & 6 deletions storage/v1/frontend_virtio_blk.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,40 @@ package opi_api.storage.v1;
option go_package = "github.com/opiproject/opi-api/storage/v1/gen/go";
import "common.proto";
import "google/protobuf/empty.proto";
import "google/api/annotations.proto";

// Front End (host-facing) APIs.

// Virtio-blk emulation

service VirtioBlkService {
rpc VirtioBlkCreate (VirtioBlkCreateRequest) returns (VirtioBlk) {}
rpc VirtioBlkDelete (VirtioBlkDeleteRequest) returns (google.protobuf.Empty) {}
rpc VirtioBlkUpdate (VirtioBlkUpdateRequest) returns (VirtioBlk) {}
rpc VirtioBlkList (VirtioBlkListRequest) returns (VirtioBlkListResponse) {}
rpc VirtioBlkGet (VirtioBlkGetRequest) returns (VirtioBlk) {}
rpc VirtioBlkCreate (VirtioBlkCreateRequest) returns (VirtioBlk) {
option (google.api.http) = {
post: "/v1/virtioblks"
body: "virtioblk"
};
}
rpc VirtioBlkDelete (VirtioBlkDeleteRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1/virtioblks/{virtioblk}"
};
}
rpc VirtioBlkUpdate (VirtioBlkUpdateRequest) returns (VirtioBlk) {
option (google.api.http) = {
patch: "/v1/virtioblks"
glimchb marked this conversation as resolved.
Show resolved Hide resolved
body: "virtioblk"
};
}
rpc VirtioBlkList (VirtioBlkListRequest) returns (VirtioBlkListResponse) {
option (google.api.http) = {
get: "/v1/virtioblks"
};
}
rpc VirtioBlkGet (VirtioBlkGetRequest) returns (VirtioBlk) {
option (google.api.http) = {
get: "/v1/virtioblks/{virtioblk}"
};
}
rpc VirtioBlkStats (VirtioBlkStatsRequest) returns (VirtioBlkStatsResponse) {}
}

Expand All @@ -42,7 +65,7 @@ message VirtioBlkUpdateRequest {
}

message VirtioBlkListRequest {
int64 subsystem_id = 1;
int64 virtioblk_id = 1;
}

message VirtioBlkListResponse {
Expand Down
65 changes: 55 additions & 10 deletions storage/v1/frontend_virtio_scsi.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,71 @@ package opi_api.storage.v1;
option go_package = "github.com/opiproject/opi-api/storage/v1/gen/go";
import "common.proto";
import "google/protobuf/empty.proto";
import "google/api/annotations.proto";

// Front End (host-facing) APIs.

// Virtio-scsi emulation

service VirtioScsiControllerService {
rpc VirtioScsiControllerCreate (VirtioScsiControllerCreateRequest) returns (VirtioScsiController) {}
rpc VirtioScsiControllerDelete (VirtioScsiControllerDeleteRequest) returns (google.protobuf.Empty) {}
rpc VirtioScsiControllerUpdate (VirtioScsiControllerUpdateRequest) returns (VirtioScsiController) {}
rpc VirtioScsiControllerList (VirtioScsiControllerListRequest) returns (VirtioScsiControllerListResponse) {}
rpc VirtioScsiControllerGet (VirtioScsiControllerGetRequest) returns (VirtioScsiController) {}
rpc VirtioScsiControllerCreate (VirtioScsiControllerCreateRequest) returns (VirtioScsiController) {
option (google.api.http) = {
post: "/v1/virtioscsictrls"
body: "virtioscsictrl"
};
}
rpc VirtioScsiControllerDelete (VirtioScsiControllerDeleteRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1/virtioscsictrls/{virtioscsictrl}"
};
}
rpc VirtioScsiControllerUpdate (VirtioScsiControllerUpdateRequest) returns (VirtioScsiController) {
option (google.api.http) = {
patch: "/v1/virtioscsictrls"
body: "virtioscsictrl"
};
}
rpc VirtioScsiControllerList (VirtioScsiControllerListRequest) returns (VirtioScsiControllerListResponse) {
option (google.api.http) = {
get: "/v1/virtioscsictrls"
};
}
rpc VirtioScsiControllerGet (VirtioScsiControllerGetRequest) returns (VirtioScsiController) {
option (google.api.http) = {
get: "/v1/virtioscsictrls/{virtioscsictrl}"
};
}
rpc VirtioScsiControllerStats (VirtioScsiControllerStatsRequest) returns (VirtioScsiControllerStatsResponse) {}
}

service VirtioScsiLunService {
rpc VirtioScsiLunCreate (VirtioScsiLunCreateRequest) returns (VirtioScsiLun) {}
rpc VirtioScsiLunDelete (VirtioScsiLunDeleteRequest) returns (google.protobuf.Empty) {}
rpc VirtioScsiLunUpdate (VirtioScsiLunUpdateRequest) returns (VirtioScsiLun) {}
rpc VirtioScsiLunList (VirtioScsiLunListRequest) returns (VirtioScsiLunListResponse) {}
rpc VirtioScsiLunGet (VirtioScsiLunGetRequest) returns (VirtioScsiLun) {}
rpc VirtioScsiLunCreate (VirtioScsiLunCreateRequest) returns (VirtioScsiLun) {
option (google.api.http) = {
post: "/v1/virtioscsiluns"
body: "virtioscsilun"
};
}
rpc VirtioScsiLunDelete (VirtioScsiLunDeleteRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1/virtioscsiluns/{virtioscsilun}"
};
}
rpc VirtioScsiLunUpdate (VirtioScsiLunUpdateRequest) returns (VirtioScsiLun) {
option (google.api.http) = {
patch: "/v1/virtioscsiluns"
body: "virtioscsilun"
};
}
rpc VirtioScsiLunList (VirtioScsiLunListRequest) returns (VirtioScsiLunListResponse) {
option (google.api.http) = {
get: "/v1/virtioscsiluns"
};
}
rpc VirtioScsiLunGet (VirtioScsiLunGetRequest) returns (VirtioScsiLun) {
option (google.api.http) = {
get: "/v1/virtioscsiluns/{virtioscsilun}"
};
}
rpc VirtioScsiLunStats (VirtioScsiLunStatsRequest) returns (VirtioScsiLunStatsResponse) {}
}

Expand Down
Loading