|
- syntax = "proto3";
-
- package adminserver.api.v1;
-
- option go_package = "server/admin-server/api/v1;v1";
-
-
-
- import "google/api/annotations.proto";
- import "validate/validate.proto";
-
- service ImageService {
- // 查询预置镜像列表
- rpc ListPreImage (ListPreImageRequest) returns (ListPreImageReply) {
- option (google.api.http) = {
- get: "/v1/imagemanage/preimage"
- };
- };
- // 查询用户镜像列表
- rpc ListUserImage (ListUserImageRequest) returns (ListUserImageReply){
- option (google.api.http) = {
- get: "/v1/imagemanage/userimage"
- };
- };
- // 新增预置镜像
- rpc AddPreImage (AddPreImageRequest) returns (AddPreImageReply) {
- option (google.api.http) = {
- post: "/v1/imagemanage/preimage"
- body: "*"
- };
- };
- // 上传预置镜像
- rpc UploadPreImage (UploadPreImageRequest) returns (UploadPreImageReply) {
- option (google.api.http) = {
- post: "/v1/imagemanage/preimage/{imageId}/upload"
- body: "*"
- };
- };
- // 删除预置镜像
- rpc DeletePreImage (DeletePreImageRequest) returns (DeletePreImageReply) {
- option (google.api.http) = {
- delete: "/v1/imagemanage/preimage/{imageId}"
- };
- };
- // 更新预置镜像
- rpc UpdateImage (UpdatePreImageRequest) returns (UpdatePreImageReply) {
- option (google.api.http) = {
- put: "/v1/imagemanage/preimage/{imageId}"
- body: "*"
- };
- };
- // 预置镜像上传确认
- rpc ConfirmUploadPreImage (ConfirmUploadPreImageRequest) returns (ConfirmUploadPreImageReply) {
- option (google.api.http) = {
- put: "/v1/imagemanage/preimage/{imageId}/uploadconfirm"
- body: "*"
- };
- };
- }
-
- message ImageDetail {
- string id = 1;
- string imageName = 2;
- int32 imageType = 3;
- string imageDesc = 4;
- string imageAddr = 5;
- int32 sourceType = 6;
- string spaceId = 7;
- string userId = 8;
- int64 createdAt = 10;
- int64 updatedAt = 11;
- int32 imageStatus = 12;
- string username = 13;
- string imageVersion = 14;
- string spaceName = 15;
- }
-
- message ListPreImageRequest {
- uint32 pageIndex = 1[(validate.rules).uint32 = {gte:1}];
- uint32 pageSize = 2[(validate.rules).uint32 = {gte:1,lte:100}];
- string sortBy = 3[(validate.rules).string = {in: ["", "asc", "desc"]}];
- string orderBy = 4[(validate.rules).string = {max_len: 20}];
- string imageAddrLike = 5;
- string imageNameLike = 6[(validate.rules).string = {max_len: 50}];
- string userId = 7[(validate.rules).string = {max_len: 36}];
- string spaceId = 8[(validate.rules).string = {max_len: 36}];
- int32 imageType = 9[(validate.rules).int32 = {in: [1,2],ignore_empty: true}];
- int32 sourceType = 10[(validate.rules).int32 = {in: [1,2],ignore_empty: true}];
- int32 imageStatus = 11[(validate.rules).int32 = {in: [1,2,3,4],ignore_empty: true}];
- string imageVersion = 12[(validate.rules).string = {max_len: 50}];
- string searchKey = 13[(validate.rules).string = {max_len: 50}];
- }
-
- message ListPreImageReply {
- int64 totalSize = 1;
- repeated ImageDetail images = 2;
- }
-
- message ListUserImageRequest {
- uint32 pageIndex = 1[(validate.rules).uint32 = {gte:1}];
- uint32 pageSize = 2[(validate.rules).uint32 = {gte:1,lte:100}];
- string sortBy = 3[(validate.rules).string = {in: ["", "asc", "desc"]}];
- string orderBy = 4[(validate.rules).string = {max_len: 20}];
- string imageAddrLike = 5;
- string imageNameLike = 6[(validate.rules).string = {max_len: 50}];
- string userId = 7[(validate.rules).string = {max_len: 36}];
- string spaceId = 8[(validate.rules).string = {max_len: 36}];
- int32 imageType = 9[(validate.rules).int32 = {in: [1,2],ignore_empty: true}];
- int32 sourceType = 10[(validate.rules).int32 = {in: [1,2],ignore_empty: true}];
- int32 imageStatus = 11[(validate.rules).int32 = {in: [1,2,3,4],ignore_empty: true}];
- string imageVersion = 12[(validate.rules).string = {max_len: 50}];
- string searchKey = 13[(validate.rules).string = {max_len: 50}];
- string userNameLike = 14[(validate.rules).string = {max_len: 50}];
- string spaceNameLike = 15[(validate.rules).string = {max_len: 50}];
- }
-
- message ListUserImageReply {
- int64 totalSize = 1;
- repeated ImageDetail images = 2;
- }
-
- message AddPreImageRequest {
- string imageName = 1[(validate.rules).string = {pattern: "^[a-zA-Z][\\w|-]*$", min_len:1, max_len:30}];
- string imageVersion = 2[(validate.rules).string = {pattern: "^[a-zA-Z][\\w|\\-|\\.]*$", min_len: 1, max_len: 50}];
- int32 imageType = 3[(validate.rules).int32 = {in: [1,2]}];
- string imageDesc = 4;
- string imageAddr = 5[(validate.rules).string = {max_len: 254}];
- int32 sourceType = 6[(validate.rules).int32 = {in: [1,2]}];
- }
-
- message AddPreImageReply {
- string imageId = 1;
- int64 createdAt = 2;
- }
-
- message UploadPreImageRequest {
- string imageId = 1[(validate.rules).string = {min_len: 1, max_len: 36}];
- string fileName = 2[(validate.rules).string = {min_len: 1, max_len: 50}];
- string domain = 3[(validate.rules).string = {min_len: 1,pattern:"(https?)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]"}];
- }
-
- message UploadPreImageReply {
- string uploadUrl = 1;
- map<string, string> headers = 2;
- }
-
- message DeletePreImageRequest {
- string imageId = 1[(validate.rules).string = {min_len: 1, max_len: 36}];
- }
- message DeletePreImageReply {
- int64 deletedAt = 1;
- }
-
- message UpdatePreImageRequest {
- string imageId = 1[(validate.rules).string = {min_len: 1, max_len: 36}];
- string imageName = 2[(validate.rules).string = {pattern: "^[a-zA-Z][\\w|-]*$", min_len:1}];
- string imageVersion = 3[(validate.rules).string = {pattern: "^[a-zA-Z][\\w|\\-|\\.]*$", max_len: 50}];
- int32 imageType = 4[(validate.rules).int32 = {in: [1,2],ignore_empty: true}];
- string imageDesc = 5;
- string imageAddr = 6[(validate.rules).string = {max_len: 254}];
- // ImageSourceType sourceType = 6;
- // string spaceId = 7;
- // string userId = 8;
- // ImageIsPrefab isPrefab = 9;
- }
-
- message UpdatePreImageReply {
- int64 updatedAt = 1;
- }
-
- message ConfirmUploadPreImageRequest {
- string imageId = 1[(validate.rules).string = {min_len: 1, max_len: 36}];
- }
-
- message ConfirmUploadPreImageReply {
- int64 updatedAt = 1;
- }
|