Skip to content

Instantly share code, notes, and snippets.

@vtolstov
Created April 28, 2019 15:23
Show Gist options
  • Save vtolstov/560e450d9fe67c02c5ea60799427d93f to your computer and use it in GitHub Desktop.
Save vtolstov/560e450d9fe67c02c5ea60799427d93f to your computer and use it in GitHub Desktop.
syntax = "proto3";
package unistack;
option go_package = "unistackpb";
import "list.proto";
import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
import "protoc-gen-swagger/options/annotations.proto";
import "tagger/tagger.proto";
import "github.com/danielvladco/go-proto-gql/pb/gql.proto";
//import "google/protobuf/field_mask.proto";
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
info: {version: "0";};
schemes: HTTPS;
consumes: "application/json";
produces: "application/json";
};
service ZoneService {
rpc List(ZoneListReq) returns (ZoneListRsp) {
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = { operation_id: "ZoneList"; };
option (google.api.http) = { get: "/api/unistack/v0/zones"; };
option (gql.rpc_type) = QUERY;
};
rpc Lookup(ZoneLookupReq) returns (ZoneLookupRsp) {
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = { operation_id: "ZoneLookup"; };
option (google.api.http) = { get: "/api/unistack/v0/zones/{uuid}"; };
};
rpc Delete(ZoneDeleteReq) returns (google.protobuf.Empty) {
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = { operation_id: "ZoneDelete"; };
option (google.api.http) = { delete: "/api/unistack/v0/zones/{uuid}" };
};
rpc Update(ZoneUpdateReq) returns (ZoneUpdateRsp) {
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = { operation_id: "ZoneUpdate"; };
option (google.api.http) = { put: "/api/unistack/v0/zones/{uuid}"; body:"*"; };
};
rpc Create(ZoneCreateReq) returns (ZoneCreateRsp) {
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = { operation_id: "ZoneCreate"; };
option (google.api.http) = { post: "/api/unistack/v0/zones"; body: "*" };
};
};
message ZoneCreateReq {
string name = 1 [(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) = {required: ['name']}];
string desc = 2;
bool private = 3;
ZoneStatus status = 4;
map<string,string> metadata = 5;
};
message ZoneCreateRsp {
Zone zone = 1;
};
message ZoneLookupReq {
// string uuid = 1 [(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) = {required: ['uuid']}, (tagger.tags) = "mapstructure:\"id\""];
string uuid = 1 [(tagger.tags) = "mapstructure:\"id\""];
string account = 2;
enum Fields {
option allow_alias = true;
field_all = 0;
field_uuid = 1;
field_id = 1;
field_name = 2;
field_desc = 3;
field_private = 4;
field_status = 5;
field_metadata = 6;
field_created_at = 7;
field_updated_at = 8;
field_deleted_at = 9;
};
repeated Fields fields = 3;
MetaReq meta = 4;
};
message ZoneLookupRsp {
Zone zone = 1;
};
message ZoneDeleteReq {
string uuid = 1 [(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) = {required: ['uuid']}];
};
message ZoneUpdateReq {
string uuid = 1 [(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) = {required: ['uuid']}];
string name = 2;
string desc = 3;
string account = 4;
bool private = 5;
ZoneStatus status = 6;
map<string,string> metadata = 7;
};
message ZoneUpdateRsp {
Zone zone = 1;
};
message ZoneListReq {
enum Fields {
option allow_alias = true;
field_all = 0;
field_uuid = 1;
field_id = 1;
field_name = 2;
field_desc = 3;
field_private = 4;
field_status = 5;
field_metadata = 6;
field_created_at = 7;
field_updated_at = 8;
field_deleted_at = 9;
};
repeated Fields fields = 1;
MetaReq meta = 2;
string account = 3;
//string account = 3 [(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) = {required: ['account']}];
};
message ZoneListRsp {
repeated Zone zones = 1;
MetaRsp meta = 2;
};
enum ZoneStatus {
unknown = 0;
enabled = 1;
disabled = 2;
blocked = 3;
deleted = 4;
};
message Zone {
string uuid = 1;
string account = 2;
string name = 3;
string desc = 4;
bool private = 5;
string status = 6;
map<string,string> metadata = 10;
int64 created_at = 98;
int64 updated_at = 99;
int64 deleted_at = 100;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment