Skip to content
Merged
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
109 changes: 109 additions & 0 deletions odpf/stencil/v1/stencil.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
syntax = "proto3";
package odpf.stencil.v1;

import "google/api/annotations.proto";
import "google/api/field_behavior.proto";
import "google/protobuf/descriptor.proto";
import "protoc-gen-openapiv2/options/annotations.proto";


option go_package = "github.com/odpf/proton/stencil/v1;stencilv1";

// These annotations are used when generating the OpenAPI file.
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
info: {
version: "0.1.4";
};
schemes: HTTP;
};

service StencilService {
rpc UploadDescriptor (UploadDescriptorRequest) returns (UploadDescriptorResponse) {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
consumes: "multipart/form-data";
produces: "application/json";
};
}
rpc DownloadDescriptor (DownloadDescriptorRequest) returns (DownloadDescriptorResponse) {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
produces: "application/octet-stream";
};
}
rpc ListSnapshots(ListSnapshotsRequest) returns (ListSnapshotsResponse) {
option (google.api.http) = {
get: "/v1/snapshots"
};
}
// PromoteSnapshot promotes particular snapshot version as latest
rpc PromoteSnapshot(PromoteSnapshotRequest) returns (PromoteSnapshotResponse) {
option (google.api.http) = {
patch: "/v1/snapshots/{id}/promote"
};
}
}

enum Rule {
UNKNOWN = 0;
FILE_NO_BREAKING_CHANGE = 1;
MESSAGE_NO_DELETE = 2;
FIELD_NO_BREAKING_CHANGE = 3;
ENUM_NO_BREAKING_CHANGE = 4;
}

message Snapshot {
int64 id = 1;
string namespace = 2 [(google.api.field_behavior) = REQUIRED];
string name = 3;
string version = 4;
bool latest = 5;
}

message DownloadDescriptorRequest {
string namespace = 1 [(google.api.field_behavior) = REQUIRED];
string name = 2 [(google.api.field_behavior) = REQUIRED];
string version = 3 [(google.api.field_behavior) = REQUIRED];
repeated string fullnames = 4;
}

message DownloadDescriptorResponse {
bytes data = 1;
}

message UploadDescriptorRequest {
string namespace = 1 [(google.api.field_behavior) = REQUIRED];
string name = 2 [(google.api.field_behavior) = REQUIRED];
string version = 3 [(google.api.field_behavior) = REQUIRED];
bytes data = 4 [(google.api.field_behavior) = REQUIRED];
bool latest = 5;
bool dryrun = 6;
Checks checks = 7;
}

message Checks {
repeated Rule except = 2;
}

message UploadDescriptorResponse {
bool success = 1;
bool dryrun = 2;
string errors = 3;
}

message ListSnapshotsResponse {
repeated Snapshot snapshots = 1;
}

message ListSnapshotsRequest {
string namespace = 1;
string name = 2;
string version = 3;
bool latest = 4;
}

message PromoteSnapshotRequest {
int64 id = 1;
}

message PromoteSnapshotResponse {
Snapshot snapshot = 1;
}