mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Storage: move http wrapper into its own subpackage (#57929)
This commit is contained in:
parent
6d2dced218
commit
6e3a6cce61
@ -19,7 +19,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/oauthtoken"
|
||||
"github.com/grafana/grafana/pkg/services/querylibrary"
|
||||
"github.com/grafana/grafana/pkg/services/searchV2"
|
||||
"github.com/grafana/grafana/pkg/services/store/object"
|
||||
"github.com/grafana/grafana/pkg/services/store/object/httpobjectstore"
|
||||
"github.com/grafana/grafana/pkg/services/userauth"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
@ -144,7 +144,7 @@ type HTTPServer struct {
|
||||
ThumbService thumbs.Service
|
||||
ExportService export.ExportService
|
||||
StorageService store.StorageService
|
||||
httpObjectStore object.HTTPObjectStore
|
||||
httpObjectStore httpobjectstore.HTTPObjectStore
|
||||
SearchV2HTTPService searchV2.SearchHTTPService
|
||||
QueryLibraryHTTPService querylibrary.HTTPService
|
||||
QueryLibraryService querylibrary.Service
|
||||
@ -233,7 +233,7 @@ func ProvideHTTPServer(opts ServerOptions, cfg *setting.Cfg, routeRegister routi
|
||||
pluginsUpdateChecker *updatechecker.PluginsService, searchUsersService searchusers.Service,
|
||||
dataSourcesService datasources.DataSourceService, queryDataService *query.Service,
|
||||
ldapGroups ldap.Groups, teamGuardian teamguardian.TeamGuardian, serviceaccountsService serviceaccounts.Service,
|
||||
authInfoService login.AuthInfoService, storageService store.StorageService, httpObjectStore object.HTTPObjectStore,
|
||||
authInfoService login.AuthInfoService, storageService store.StorageService, httpObjectStore httpobjectstore.HTTPObjectStore,
|
||||
notificationService *notifications.NotificationService, dashboardService dashboards.DashboardService,
|
||||
dashboardProvisioningService dashboards.DashboardProvisioningService, folderService folder.Service,
|
||||
datasourcePermissionsService permissions.DatasourcePermissionsService, alertNotificationService *alerting.AlertNotificationService,
|
||||
|
@ -126,8 +126,8 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/star/starimpl"
|
||||
"github.com/grafana/grafana/pkg/services/store"
|
||||
"github.com/grafana/grafana/pkg/services/store/kind"
|
||||
"github.com/grafana/grafana/pkg/services/store/object"
|
||||
objectdummyserver "github.com/grafana/grafana/pkg/services/store/object/dummy"
|
||||
"github.com/grafana/grafana/pkg/services/store/object/httpobjectstore"
|
||||
"github.com/grafana/grafana/pkg/services/store/resolver"
|
||||
"github.com/grafana/grafana/pkg/services/store/sanitizer"
|
||||
"github.com/grafana/grafana/pkg/services/tag"
|
||||
@ -363,7 +363,7 @@ var wireBasicSet = wire.NewSet(
|
||||
kind.ProvideService, // The registry known kinds
|
||||
objectdummyserver.ProvideDummyObjectServer,
|
||||
resolver.ProvideObjectReferenceResolver,
|
||||
object.ProvideHTTPObjectStore,
|
||||
httpobjectstore.ProvideHTTPObjectStore,
|
||||
teamimpl.ProvideService,
|
||||
tempuserimpl.ProvideService,
|
||||
loginattemptimpl.ProvideService,
|
||||
|
@ -1,236 +0,0 @@
|
||||
package object
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/middleware"
|
||||
"github.com/grafana/grafana/pkg/services/store/kind"
|
||||
"github.com/grafana/grafana/pkg/web"
|
||||
|
||||
"github.com/grafana/grafana/pkg/api/response"
|
||||
"github.com/grafana/grafana/pkg/api/routing"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
)
|
||||
|
||||
type HTTPObjectStore interface {
|
||||
// Register HTTP Access to the store
|
||||
RegisterHTTPRoutes(routing.RouteRegister)
|
||||
}
|
||||
|
||||
type httpObjectStore struct {
|
||||
store ObjectStoreServer
|
||||
log log.Logger
|
||||
kinds kind.KindRegistry
|
||||
}
|
||||
|
||||
func ProvideHTTPObjectStore(store ObjectStoreServer, kinds kind.KindRegistry) HTTPObjectStore {
|
||||
return &httpObjectStore{
|
||||
store: store,
|
||||
log: log.New("http-object-store"),
|
||||
kinds: kinds,
|
||||
}
|
||||
}
|
||||
|
||||
// All registered under "api/object"
|
||||
func (s *httpObjectStore) RegisterHTTPRoutes(route routing.RouteRegister) {
|
||||
// For now, require admin for everything
|
||||
reqGrafanaAdmin := middleware.ReqSignedIn //.ReqGrafanaAdmin
|
||||
|
||||
// Every * must parse to a GRN (uid+kind)
|
||||
route.Get("/store/*", reqGrafanaAdmin, routing.Wrap(s.doGetObject))
|
||||
route.Get("/raw/*", reqGrafanaAdmin, routing.Wrap(s.doGetRawObject))
|
||||
route.Post("/store/*", reqGrafanaAdmin, routing.Wrap(s.doWriteObject))
|
||||
route.Delete("/store/*", reqGrafanaAdmin, routing.Wrap(s.doDeleteObject))
|
||||
route.Get("/history/*", reqGrafanaAdmin, routing.Wrap(s.doGetHistory))
|
||||
route.Get("/list/*", reqGrafanaAdmin, routing.Wrap(s.doListFolder)) // Simplified version of search -- path is prefix
|
||||
route.Get("/search", reqGrafanaAdmin, routing.Wrap(s.doSearch))
|
||||
}
|
||||
|
||||
// This function will extract UID+Kind from the requested path "*" in our router
|
||||
// This is far from ideal! but is at least consistent for these endpoints.
|
||||
// This will quickly be revisited as we explore how to encode UID+Kind in a "GRN" format
|
||||
func parseRequestParams(req *http.Request) (uid string, kind string, params map[string]string) {
|
||||
params = web.Params(req)
|
||||
path := params["*"]
|
||||
idx := strings.LastIndex(path, ".")
|
||||
if idx > 0 {
|
||||
uid = path[:idx]
|
||||
kind = path[idx+1:]
|
||||
} else {
|
||||
uid = path
|
||||
kind = "?"
|
||||
}
|
||||
|
||||
// Read parameters that are encoded in the URL
|
||||
vals := req.URL.Query()
|
||||
for k, v := range vals {
|
||||
if len(v) > 0 {
|
||||
params[k] = v[0]
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (s *httpObjectStore) doGetObject(c *models.ReqContext) response.Response {
|
||||
uid, kind, params := parseRequestParams(c.Req)
|
||||
rsp, err := s.store.Read(c.Req.Context(), &ReadObjectRequest{
|
||||
GRN: &GRN{
|
||||
UID: uid,
|
||||
Kind: kind,
|
||||
},
|
||||
Version: params["version"], // ?version = XYZ
|
||||
WithBody: params["body"] != "false", // default to true
|
||||
WithSummary: params["summary"] == "true", // default to false
|
||||
})
|
||||
if err != nil {
|
||||
return response.Error(500, "error fetching object", err)
|
||||
}
|
||||
if rsp.Object == nil {
|
||||
return response.Error(404, "not found", nil)
|
||||
}
|
||||
|
||||
// Configure etag support
|
||||
currentEtag := rsp.Object.ETag
|
||||
previousEtag := c.Req.Header.Get("If-None-Match")
|
||||
if previousEtag == currentEtag {
|
||||
return response.CreateNormalResponse(
|
||||
http.Header{
|
||||
"ETag": []string{rsp.Object.ETag},
|
||||
},
|
||||
[]byte{}, // nothing
|
||||
http.StatusNotModified, // 304
|
||||
)
|
||||
}
|
||||
|
||||
c.Resp.Header().Set("ETag", currentEtag)
|
||||
return response.JSON(200, rsp)
|
||||
}
|
||||
|
||||
func (s *httpObjectStore) doGetRawObject(c *models.ReqContext) response.Response {
|
||||
uid, kind, params := parseRequestParams(c.Req)
|
||||
rsp, err := s.store.Read(c.Req.Context(), &ReadObjectRequest{
|
||||
GRN: &GRN{
|
||||
UID: uid,
|
||||
Kind: kind,
|
||||
},
|
||||
Version: params["version"], // ?version = XYZ
|
||||
WithBody: true,
|
||||
WithSummary: false,
|
||||
})
|
||||
if err != nil {
|
||||
return response.Error(500, "?", err)
|
||||
}
|
||||
info, err := s.kinds.GetInfo(kind)
|
||||
if err != nil {
|
||||
return response.Error(400, "Unsupported kind", err)
|
||||
}
|
||||
|
||||
if rsp.Object != nil && rsp.Object.Body != nil {
|
||||
// Configure etag support
|
||||
currentEtag := rsp.Object.ETag
|
||||
previousEtag := c.Req.Header.Get("If-None-Match")
|
||||
if previousEtag == currentEtag {
|
||||
return response.CreateNormalResponse(
|
||||
http.Header{
|
||||
"ETag": []string{rsp.Object.ETag},
|
||||
},
|
||||
[]byte{}, // nothing
|
||||
http.StatusNotModified, // 304
|
||||
)
|
||||
}
|
||||
mime := info.MimeType
|
||||
if mime == "" {
|
||||
mime = "application/json"
|
||||
}
|
||||
return response.CreateNormalResponse(
|
||||
http.Header{
|
||||
"Content-Type": []string{mime},
|
||||
"ETag": []string{currentEtag},
|
||||
},
|
||||
rsp.Object.Body,
|
||||
200,
|
||||
)
|
||||
}
|
||||
return response.JSON(400, rsp) // ???
|
||||
}
|
||||
|
||||
const MAX_UPLOAD_SIZE = 5 * 1024 * 1024 // 5MB
|
||||
|
||||
func (s *httpObjectStore) doWriteObject(c *models.ReqContext) response.Response {
|
||||
uid, kind, params := parseRequestParams(c.Req)
|
||||
|
||||
// Cap the max size
|
||||
c.Req.Body = http.MaxBytesReader(c.Resp, c.Req.Body, MAX_UPLOAD_SIZE)
|
||||
b, err := io.ReadAll(c.Req.Body)
|
||||
if err != nil {
|
||||
return response.Error(400, "error reading body", err)
|
||||
}
|
||||
|
||||
rsp, err := s.store.Write(c.Req.Context(), &WriteObjectRequest{
|
||||
GRN: &GRN{
|
||||
UID: uid,
|
||||
Kind: kind,
|
||||
},
|
||||
Body: b,
|
||||
Comment: params["comment"],
|
||||
PreviousVersion: params["previousVersion"],
|
||||
})
|
||||
if err != nil {
|
||||
return response.Error(500, "?", err)
|
||||
}
|
||||
return response.JSON(200, rsp)
|
||||
}
|
||||
|
||||
func (s *httpObjectStore) doDeleteObject(c *models.ReqContext) response.Response {
|
||||
uid, kind, params := parseRequestParams(c.Req)
|
||||
rsp, err := s.store.Delete(c.Req.Context(), &DeleteObjectRequest{
|
||||
GRN: &GRN{
|
||||
UID: uid,
|
||||
Kind: kind,
|
||||
},
|
||||
PreviousVersion: params["previousVersion"],
|
||||
})
|
||||
if err != nil {
|
||||
return response.Error(500, "?", err)
|
||||
}
|
||||
return response.JSON(200, rsp)
|
||||
}
|
||||
|
||||
func (s *httpObjectStore) doGetHistory(c *models.ReqContext) response.Response {
|
||||
uid, kind, params := parseRequestParams(c.Req)
|
||||
limit := int64(20) // params
|
||||
rsp, err := s.store.History(c.Req.Context(), &ObjectHistoryRequest{
|
||||
GRN: &GRN{
|
||||
UID: uid,
|
||||
Kind: kind,
|
||||
},
|
||||
Limit: limit,
|
||||
NextPageToken: params["nextPageToken"],
|
||||
})
|
||||
if err != nil {
|
||||
return response.Error(500, "?", err)
|
||||
}
|
||||
return response.JSON(200, rsp)
|
||||
}
|
||||
|
||||
func (s *httpObjectStore) doListFolder(c *models.ReqContext) response.Response {
|
||||
return response.JSON(501, "Not implemented yet")
|
||||
}
|
||||
|
||||
func (s *httpObjectStore) doSearch(c *models.ReqContext) response.Response {
|
||||
req := &ObjectSearchRequest{
|
||||
WithBody: true,
|
||||
WithLabels: true,
|
||||
WithFields: true,
|
||||
// TODO!!!
|
||||
}
|
||||
|
||||
rsp, err := s.store.Search(c.Req.Context(), req)
|
||||
if err != nil {
|
||||
return response.Error(500, "?", err)
|
||||
}
|
||||
return response.JSON(200, rsp)
|
||||
}
|
369
pkg/services/store/object/httpobjectstore/service.go
Normal file
369
pkg/services/store/object/httpobjectstore/service.go
Normal file
@ -0,0 +1,369 @@
|
||||
package httpobjectstore
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/middleware"
|
||||
"github.com/grafana/grafana/pkg/services/store/kind"
|
||||
"github.com/grafana/grafana/pkg/services/store/object"
|
||||
"github.com/grafana/grafana/pkg/services/store/router"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/grafana/grafana/pkg/web"
|
||||
|
||||
"github.com/grafana/grafana/pkg/api/response"
|
||||
"github.com/grafana/grafana/pkg/api/routing"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
)
|
||||
|
||||
type HTTPObjectStore interface {
|
||||
// Register HTTP Access to the store
|
||||
RegisterHTTPRoutes(routing.RouteRegister)
|
||||
}
|
||||
|
||||
type httpObjectStore struct {
|
||||
store object.ObjectStoreServer
|
||||
log log.Logger
|
||||
kinds kind.KindRegistry
|
||||
router router.ObjectStoreRouter
|
||||
}
|
||||
|
||||
func ProvideHTTPObjectStore(store object.ObjectStoreServer, kinds kind.KindRegistry) HTTPObjectStore {
|
||||
return &httpObjectStore{
|
||||
store: store,
|
||||
log: log.New("http-object-store"),
|
||||
kinds: kinds,
|
||||
router: router.NewObjectStoreRouter(kinds),
|
||||
}
|
||||
}
|
||||
|
||||
// All registered under "api/object"
|
||||
func (s *httpObjectStore) RegisterHTTPRoutes(route routing.RouteRegister) {
|
||||
// For now, require admin for everything
|
||||
reqGrafanaAdmin := middleware.ReqSignedIn //.ReqGrafanaAdmin
|
||||
|
||||
// Every * must parse to a GRN (uid+kind)
|
||||
route.Get("/store/*", reqGrafanaAdmin, routing.Wrap(s.doGetObject))
|
||||
route.Post("/store/*", reqGrafanaAdmin, routing.Wrap(s.doWriteObject))
|
||||
route.Delete("/store/*", reqGrafanaAdmin, routing.Wrap(s.doDeleteObject))
|
||||
route.Get("/raw/*", reqGrafanaAdmin, routing.Wrap(s.doGetRawObject))
|
||||
route.Get("/history/*", reqGrafanaAdmin, routing.Wrap(s.doGetHistory))
|
||||
route.Get("/list/*", reqGrafanaAdmin, routing.Wrap(s.doListFolder)) // Simplified version of search -- path is prefix
|
||||
route.Get("/search", reqGrafanaAdmin, routing.Wrap(s.doSearch))
|
||||
|
||||
// File upload
|
||||
route.Post("/upload/:scope", reqGrafanaAdmin, routing.Wrap(s.doUpload))
|
||||
}
|
||||
|
||||
// This function will extract UID+Kind from the requested path "*" in our router
|
||||
// This is far from ideal! but is at least consistent for these endpoints.
|
||||
// This will quickly be revisited as we explore how to encode UID+Kind in a "GRN" format
|
||||
func (s *httpObjectStore) getGRNFromRequest(c *models.ReqContext) (*object.GRN, map[string]string, error) {
|
||||
params := web.Params(c.Req)
|
||||
info, err := s.router.RouteFromKey(c.Req.Context(),
|
||||
fmt.Sprintf("%d/%s", c.OrgID, params["*"]))
|
||||
if err != nil {
|
||||
return nil, params, err
|
||||
}
|
||||
|
||||
// Read parameters that are encoded in the URL
|
||||
vals := c.Req.URL.Query()
|
||||
for k, v := range vals {
|
||||
if len(v) > 0 {
|
||||
params[k] = v[0]
|
||||
}
|
||||
}
|
||||
return info.GRN, params, nil
|
||||
}
|
||||
|
||||
func (s *httpObjectStore) doGetObject(c *models.ReqContext) response.Response {
|
||||
grn, params, err := s.getGRNFromRequest(c)
|
||||
if err != nil {
|
||||
return response.Error(400, err.Error(), err)
|
||||
}
|
||||
rsp, err := s.store.Read(c.Req.Context(), &object.ReadObjectRequest{
|
||||
GRN: grn,
|
||||
Version: params["version"], // ?version = XYZ
|
||||
WithBody: params["body"] != "false", // default to true
|
||||
WithSummary: params["summary"] == "true", // default to false
|
||||
})
|
||||
if err != nil {
|
||||
return response.Error(500, "error fetching object", err)
|
||||
}
|
||||
if rsp.Object == nil {
|
||||
return response.Error(404, "not found", nil)
|
||||
}
|
||||
|
||||
// Configure etag support
|
||||
currentEtag := rsp.Object.ETag
|
||||
previousEtag := c.Req.Header.Get("If-None-Match")
|
||||
if previousEtag == currentEtag {
|
||||
return response.CreateNormalResponse(
|
||||
http.Header{
|
||||
"ETag": []string{rsp.Object.ETag},
|
||||
},
|
||||
[]byte{}, // nothing
|
||||
http.StatusNotModified, // 304
|
||||
)
|
||||
}
|
||||
|
||||
c.Resp.Header().Set("ETag", currentEtag)
|
||||
return response.JSON(200, rsp)
|
||||
}
|
||||
|
||||
func (s *httpObjectStore) doGetRawObject(c *models.ReqContext) response.Response {
|
||||
grn, params, err := s.getGRNFromRequest(c)
|
||||
if err != nil {
|
||||
return response.Error(400, err.Error(), err)
|
||||
}
|
||||
rsp, err := s.store.Read(c.Req.Context(), &object.ReadObjectRequest{
|
||||
GRN: grn,
|
||||
Version: params["version"], // ?version = XYZ
|
||||
WithBody: true,
|
||||
WithSummary: false,
|
||||
})
|
||||
if err != nil {
|
||||
return response.Error(500, "?", err)
|
||||
}
|
||||
info, err := s.kinds.GetInfo(grn.Kind)
|
||||
if err != nil {
|
||||
return response.Error(400, "Unsupported kind", err)
|
||||
}
|
||||
|
||||
if rsp.Object != nil && rsp.Object.Body != nil {
|
||||
// Configure etag support
|
||||
currentEtag := rsp.Object.ETag
|
||||
previousEtag := c.Req.Header.Get("If-None-Match")
|
||||
if previousEtag == currentEtag {
|
||||
return response.CreateNormalResponse(
|
||||
http.Header{
|
||||
"ETag": []string{rsp.Object.ETag},
|
||||
},
|
||||
[]byte{}, // nothing
|
||||
http.StatusNotModified, // 304
|
||||
)
|
||||
}
|
||||
mime := info.MimeType
|
||||
if mime == "" {
|
||||
mime = "application/json"
|
||||
}
|
||||
return response.CreateNormalResponse(
|
||||
http.Header{
|
||||
"Content-Type": []string{mime},
|
||||
"ETag": []string{currentEtag},
|
||||
},
|
||||
rsp.Object.Body,
|
||||
200,
|
||||
)
|
||||
}
|
||||
return response.JSON(400, rsp) // ???
|
||||
}
|
||||
|
||||
const MAX_UPLOAD_SIZE = 5 * 1024 * 1024 // 5MB
|
||||
|
||||
func (s *httpObjectStore) doWriteObject(c *models.ReqContext) response.Response {
|
||||
grn, params, err := s.getGRNFromRequest(c)
|
||||
if err != nil {
|
||||
return response.Error(400, err.Error(), err)
|
||||
}
|
||||
|
||||
// Cap the max size
|
||||
c.Req.Body = http.MaxBytesReader(c.Resp, c.Req.Body, MAX_UPLOAD_SIZE)
|
||||
b, err := io.ReadAll(c.Req.Body)
|
||||
if err != nil {
|
||||
return response.Error(400, "error reading body", err)
|
||||
}
|
||||
|
||||
rsp, err := s.store.Write(c.Req.Context(), &object.WriteObjectRequest{
|
||||
GRN: grn,
|
||||
Body: b,
|
||||
Comment: params["comment"],
|
||||
PreviousVersion: params["previousVersion"],
|
||||
})
|
||||
if err != nil {
|
||||
return response.Error(500, "?", err)
|
||||
}
|
||||
return response.JSON(200, rsp)
|
||||
}
|
||||
|
||||
func (s *httpObjectStore) doDeleteObject(c *models.ReqContext) response.Response {
|
||||
grn, params, err := s.getGRNFromRequest(c)
|
||||
if err != nil {
|
||||
return response.Error(400, err.Error(), err)
|
||||
}
|
||||
rsp, err := s.store.Delete(c.Req.Context(), &object.DeleteObjectRequest{
|
||||
GRN: grn,
|
||||
PreviousVersion: params["previousVersion"],
|
||||
})
|
||||
if err != nil {
|
||||
return response.Error(500, "?", err)
|
||||
}
|
||||
return response.JSON(200, rsp)
|
||||
}
|
||||
|
||||
func (s *httpObjectStore) doGetHistory(c *models.ReqContext) response.Response {
|
||||
grn, params, err := s.getGRNFromRequest(c)
|
||||
if err != nil {
|
||||
return response.Error(400, err.Error(), err)
|
||||
}
|
||||
limit := int64(20) // params
|
||||
rsp, err := s.store.History(c.Req.Context(), &object.ObjectHistoryRequest{
|
||||
GRN: grn,
|
||||
Limit: limit,
|
||||
NextPageToken: params["nextPageToken"],
|
||||
})
|
||||
if err != nil {
|
||||
return response.Error(500, "?", err)
|
||||
}
|
||||
return response.JSON(200, rsp)
|
||||
}
|
||||
|
||||
func (s *httpObjectStore) doUpload(c *models.ReqContext) response.Response {
|
||||
c.Req.Body = http.MaxBytesReader(c.Resp, c.Req.Body, MAX_UPLOAD_SIZE)
|
||||
if err := c.Req.ParseMultipartForm(MAX_UPLOAD_SIZE); err != nil {
|
||||
msg := fmt.Sprintf("Please limit file uploaded under %s", util.ByteCountSI(MAX_UPLOAD_SIZE))
|
||||
return response.Error(400, msg, nil)
|
||||
}
|
||||
fileinfo := c.Req.MultipartForm.File
|
||||
if len(fileinfo) < 1 {
|
||||
return response.Error(400, "missing files", nil)
|
||||
}
|
||||
scope := web.Params(c.Req)[":scope"]
|
||||
if scope == "" {
|
||||
return response.Error(400, "invalid scope", nil)
|
||||
}
|
||||
|
||||
var rsp []*object.WriteObjectResponse
|
||||
|
||||
message := getMultipartFormValue(c.Req, "message")
|
||||
overwriteExistingFile := getMultipartFormValue(c.Req, "overwriteExistingFile") != "false" // must explicitly overwrite
|
||||
folder := getMultipartFormValue(c.Req, "folder")
|
||||
ctx := c.Req.Context()
|
||||
|
||||
for _, fileHeaders := range fileinfo {
|
||||
for _, fileHeader := range fileHeaders {
|
||||
idx := strings.LastIndex(fileHeader.Filename, ".")
|
||||
if idx <= 0 {
|
||||
return response.Error(400, "Expecting file extension: "+fileHeader.Filename, nil)
|
||||
}
|
||||
|
||||
ext := strings.ToLower(fileHeader.Filename[idx+1:])
|
||||
kind, err := s.kinds.GetFromExtension(ext)
|
||||
if err != nil || kind.ID == "" {
|
||||
return response.Error(400, "Unsupported kind: "+fileHeader.Filename, err)
|
||||
}
|
||||
uid := folder
|
||||
if uid != "" {
|
||||
uid = uid + "/" + fileHeader.Filename[:idx]
|
||||
} else {
|
||||
uid = fileHeader.Filename[:idx]
|
||||
}
|
||||
|
||||
file, err := fileHeader.Open()
|
||||
if err != nil {
|
||||
return response.Error(500, "Internal Server Error", err)
|
||||
}
|
||||
data, err := io.ReadAll(file)
|
||||
if err != nil {
|
||||
return response.Error(500, "Internal Server Error", err)
|
||||
}
|
||||
err = file.Close()
|
||||
if err != nil {
|
||||
return response.Error(500, "Internal Server Error", err)
|
||||
}
|
||||
|
||||
grn := &object.GRN{
|
||||
Scope: scope,
|
||||
UID: uid,
|
||||
Kind: kind.ID,
|
||||
}
|
||||
|
||||
if !overwriteExistingFile {
|
||||
result, err := s.store.Read(ctx, &object.ReadObjectRequest{
|
||||
GRN: grn,
|
||||
WithBody: false,
|
||||
WithSummary: false,
|
||||
})
|
||||
if err != nil {
|
||||
return response.Error(500, "Internal Server Error", err)
|
||||
}
|
||||
if result.Object != nil {
|
||||
return response.Error(400, "File name already in use", err)
|
||||
}
|
||||
}
|
||||
|
||||
result, err := s.store.Write(ctx, &object.WriteObjectRequest{
|
||||
GRN: grn,
|
||||
Body: data,
|
||||
Comment: message,
|
||||
// PreviousVersion: params["previousVersion"],
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return response.Error(500, err.Error(), err) // TODO, better errors
|
||||
}
|
||||
rsp = append(rsp, result)
|
||||
}
|
||||
}
|
||||
|
||||
return response.JSON(200, rsp)
|
||||
}
|
||||
|
||||
func (s *httpObjectStore) doListFolder(c *models.ReqContext) response.Response {
|
||||
return response.JSON(501, "Not implemented yet")
|
||||
}
|
||||
|
||||
func (s *httpObjectStore) doSearch(c *models.ReqContext) response.Response {
|
||||
vals := c.Req.URL.Query()
|
||||
|
||||
req := &object.ObjectSearchRequest{
|
||||
WithBody: asBoolean("body", vals, false),
|
||||
WithLabels: asBoolean("labels", vals, true),
|
||||
WithFields: asBoolean("fields", vals, true),
|
||||
Kind: vals["kind"],
|
||||
Query: vals.Get("query"),
|
||||
Folder: vals.Get("folder"),
|
||||
Sort: vals["sort"],
|
||||
}
|
||||
if vals.Has("limit") {
|
||||
limit, err := strconv.ParseInt(vals.Get("limit"), 10, 64)
|
||||
if err != nil {
|
||||
return response.Error(400, "bad limit", err)
|
||||
}
|
||||
req.Limit = limit
|
||||
}
|
||||
|
||||
rsp, err := s.store.Search(c.Req.Context(), req)
|
||||
if err != nil {
|
||||
return response.Error(500, "?", err)
|
||||
}
|
||||
return response.JSON(200, rsp)
|
||||
}
|
||||
|
||||
func asBoolean(key string, vals url.Values, defaultValue bool) bool {
|
||||
v, ok := vals[key]
|
||||
if !ok {
|
||||
return defaultValue
|
||||
}
|
||||
if len(v) == 0 {
|
||||
return true // single boolean parameter
|
||||
}
|
||||
b, err := strconv.ParseBool(v[0])
|
||||
if err != nil {
|
||||
return defaultValue
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func getMultipartFormValue(req *http.Request, key string) string {
|
||||
v, ok := req.MultipartForm.Value[key]
|
||||
if !ok || len(v) != 1 {
|
||||
return ""
|
||||
}
|
||||
return v[0]
|
||||
}
|
@ -287,6 +287,11 @@ func (codec *writeResponseCodec) Encode(ptr unsafe.Pointer, stream *jsoniter.Str
|
||||
stream.WriteObjectField("error")
|
||||
stream.WriteVal(obj.Error)
|
||||
}
|
||||
if obj.GRN != nil {
|
||||
stream.WriteMore()
|
||||
stream.WriteObjectField("GRN")
|
||||
stream.WriteVal(obj.GRN)
|
||||
}
|
||||
if obj.Object != nil {
|
||||
stream.WriteMore()
|
||||
stream.WriteObjectField("object")
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v3.21.8
|
||||
// protoc v3.21.9
|
||||
// source: object.proto
|
||||
|
||||
package object
|
||||
@ -813,12 +813,14 @@ type WriteObjectResponse struct {
|
||||
|
||||
// Error info -- if exists, the save did not happen
|
||||
Error *ObjectErrorInfo `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
|
||||
// Object identifier
|
||||
GRN *GRN `protobuf:"bytes,2,opt,name=GRN,proto3" json:"GRN,omitempty"`
|
||||
// Object details with the body removed
|
||||
Object *ObjectVersionInfo `protobuf:"bytes,2,opt,name=object,proto3" json:"object,omitempty"`
|
||||
Object *ObjectVersionInfo `protobuf:"bytes,3,opt,name=object,proto3" json:"object,omitempty"`
|
||||
// Object summary as JSON
|
||||
SummaryJson []byte `protobuf:"bytes,3,opt,name=summary_json,json=summaryJson,proto3" json:"summary_json,omitempty"`
|
||||
SummaryJson []byte `protobuf:"bytes,4,opt,name=summary_json,json=summaryJson,proto3" json:"summary_json,omitempty"`
|
||||
// Status code
|
||||
Status WriteObjectResponse_Status `protobuf:"varint,4,opt,name=status,proto3,enum=object.WriteObjectResponse_Status" json:"status,omitempty"`
|
||||
Status WriteObjectResponse_Status `protobuf:"varint,5,opt,name=status,proto3,enum=object.WriteObjectResponse_Status" json:"status,omitempty"`
|
||||
}
|
||||
|
||||
func (x *WriteObjectResponse) Reset() {
|
||||
@ -860,6 +862,13 @@ func (x *WriteObjectResponse) GetError() *ObjectErrorInfo {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *WriteObjectResponse) GetGRN() *GRN {
|
||||
if x != nil {
|
||||
return x.GRN
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *WriteObjectResponse) GetObject() *ObjectVersionInfo {
|
||||
if x != nil {
|
||||
return x.Object
|
||||
@ -1056,10 +1065,12 @@ type ObjectHistoryResponse struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Object identifier
|
||||
GRN *GRN `protobuf:"bytes,1,opt,name=GRN,proto3" json:"GRN,omitempty"`
|
||||
// Object metadata without the raw bytes
|
||||
Versions []*ObjectVersionInfo `protobuf:"bytes,1,rep,name=versions,proto3" json:"versions,omitempty"`
|
||||
Versions []*ObjectVersionInfo `protobuf:"bytes,2,rep,name=versions,proto3" json:"versions,omitempty"`
|
||||
// More results exist... pass this in the next request
|
||||
NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
|
||||
NextPageToken string `protobuf:"bytes,3,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ObjectHistoryResponse) Reset() {
|
||||
@ -1094,6 +1105,13 @@ func (*ObjectHistoryResponse) Descriptor() ([]byte, []int) {
|
||||
return file_object_proto_rawDescGZIP(), []int{14}
|
||||
}
|
||||
|
||||
func (x *ObjectHistoryResponse) GetGRN() *GRN {
|
||||
if x != nil {
|
||||
return x.GRN
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ObjectHistoryResponse) GetVersions() []*ObjectVersionInfo {
|
||||
if x != nil {
|
||||
return x.Versions
|
||||
@ -1506,133 +1524,137 @@ var file_object_proto_rawDesc = []byte{
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x29, 0x0a,
|
||||
0x10, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
|
||||
0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75,
|
||||
0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x94, 0x02, 0x0a, 0x13, 0x57, 0x72, 0x69,
|
||||
0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xb3, 0x02, 0x0a, 0x13, 0x57, 0x72, 0x69,
|
||||
0x74, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x12, 0x2d, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x17, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x45,
|
||||
0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12,
|
||||
0x31, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x19, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x56,
|
||||
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65,
|
||||
0x63, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x6a, 0x73,
|
||||
0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72,
|
||||
0x79, 0x4a, 0x73, 0x6f, 0x6e, 0x12, 0x3a, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18,
|
||||
0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x22, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x57,
|
||||
0x72, 0x69, 0x74, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75,
|
||||
0x73, 0x22, 0x3c, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x09, 0x0a, 0x05, 0x45,
|
||||
0x52, 0x52, 0x4f, 0x52, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45,
|
||||
0x44, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x44, 0x10, 0x02,
|
||||
0x12, 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, 0x44, 0x10, 0x03, 0x22,
|
||||
0x5f, 0x0a, 0x13, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x03, 0x47, 0x52, 0x4e, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x52, 0x4e,
|
||||
0x52, 0x03, 0x47, 0x52, 0x4e, 0x12, 0x29, 0x0a, 0x10, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75,
|
||||
0x73, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x0f, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
|
||||
0x22, 0x26, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x4f, 0x4b, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x4f, 0x4b, 0x22, 0x73, 0x0a, 0x14, 0x4f, 0x62, 0x6a, 0x65,
|
||||
0x63, 0x74, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x12, 0x1d, 0x0a, 0x03, 0x47, 0x52, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e,
|
||||
0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x52, 0x4e, 0x52, 0x03, 0x47, 0x52, 0x4e, 0x12,
|
||||
0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05,
|
||||
0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61,
|
||||
0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d,
|
||||
0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x76, 0x0a,
|
||||
0x1d, 0x0a, 0x03, 0x47, 0x52, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x6f,
|
||||
0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x52, 0x4e, 0x52, 0x03, 0x47, 0x52, 0x4e, 0x12, 0x31,
|
||||
0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19,
|
||||
0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x56, 0x65,
|
||||
0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63,
|
||||
0x74, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x6a, 0x73, 0x6f,
|
||||
0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79,
|
||||
0x4a, 0x73, 0x6f, 0x6e, 0x12, 0x3a, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05,
|
||||
0x20, 0x01, 0x28, 0x0e, 0x32, 0x22, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x57, 0x72,
|
||||
0x69, 0x74, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
|
||||
0x22, 0x3c, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52,
|
||||
0x52, 0x4f, 0x52, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x44,
|
||||
0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x44, 0x10, 0x02, 0x12,
|
||||
0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, 0x44, 0x10, 0x03, 0x22, 0x5f,
|
||||
0x0a, 0x13, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x03, 0x47, 0x52, 0x4e, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x52, 0x4e, 0x52,
|
||||
0x03, 0x47, 0x52, 0x4e, 0x12, 0x29, 0x0a, 0x10, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73,
|
||||
0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f,
|
||||
0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22,
|
||||
0x26, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x4f, 0x4b, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x08, 0x52, 0x02, 0x4f, 0x4b, 0x22, 0x73, 0x0a, 0x14, 0x4f, 0x62, 0x6a, 0x65, 0x63,
|
||||
0x74, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
|
||||
0x1d, 0x0a, 0x03, 0x47, 0x52, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x6f,
|
||||
0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x52, 0x4e, 0x52, 0x03, 0x47, 0x52, 0x4e, 0x12, 0x14,
|
||||
0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6c,
|
||||
0x69, 0x6d, 0x69, 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67,
|
||||
0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e,
|
||||
0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x95, 0x01, 0x0a,
|
||||
0x15, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x08, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
|
||||
0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63,
|
||||
0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49,
|
||||
0x6e, 0x66, 0x6f, 0x52, 0x08, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x26, 0x0a,
|
||||
0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65,
|
||||
0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x84, 0x03, 0x0a, 0x13, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74,
|
||||
0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a,
|
||||
0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65,
|
||||
0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71,
|
||||
0x75, 0x65, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72,
|
||||
0x79, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52,
|
||||
0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x18,
|
||||
0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x12, 0x3f, 0x0a,
|
||||
0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e,
|
||||
0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x61,
|
||||
0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c,
|
||||
0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x12,
|
||||
0x0a, 0x04, 0x73, 0x6f, 0x72, 0x74, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x73, 0x6f,
|
||||
0x72, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x18,
|
||||
0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x77, 0x69, 0x74, 0x68, 0x42, 0x6f, 0x64, 0x79, 0x12,
|
||||
0x1f, 0x0a, 0x0b, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x09,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x77, 0x69, 0x74, 0x68, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73,
|
||||
0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18,
|
||||
0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x77, 0x69, 0x74, 0x68, 0x46, 0x69, 0x65, 0x6c, 0x64,
|
||||
0x73, 0x1a, 0x39, 0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79,
|
||||
0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b,
|
||||
0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x8b, 0x03, 0x0a,
|
||||
0x12, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73,
|
||||
0x75, 0x6c, 0x74, 0x12, 0x1d, 0x0a, 0x03, 0x47, 0x52, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x0b, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x52, 0x4e, 0x52, 0x03, 0x47,
|
||||
0x52, 0x4e, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07,
|
||||
0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x75,
|
||||
0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
|
||||
0x64, 0x5f, 0x62, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61,
|
||||
0x74, 0x65, 0x64, 0x42, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x06, 0x20,
|
||||
0x01, 0x28, 0x0c, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
|
||||
0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a,
|
||||
0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12,
|
||||
0x3e, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32,
|
||||
0x26, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53,
|
||||
0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, 0x4c, 0x61, 0x62, 0x65,
|
||||
0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12,
|
||||
0x1f, 0x0a, 0x0b, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x18, 0x0a,
|
||||
0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x4a, 0x73, 0x6f, 0x6e,
|
||||
0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x18, 0x0b,
|
||||
0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4a, 0x73, 0x6f, 0x6e, 0x1a,
|
||||
0x39, 0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10,
|
||||
0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79,
|
||||
0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x74, 0x0a, 0x14, 0x4f, 0x62,
|
||||
0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x12, 0x34, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20,
|
||||
0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a,
|
||||
0x65, 0x63, 0x74, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52,
|
||||
0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74,
|
||||
0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e,
|
||||
0x32, 0xae, 0x03, 0x0a, 0x0b, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65,
|
||||
0x12, 0x3d, 0x0a, 0x04, 0x52, 0x65, 0x61, 0x64, 0x12, 0x19, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63,
|
||||
0x74, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x52, 0x65, 0x61,
|
||||
0x64, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||
0x4c, 0x0a, 0x09, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x61, 0x64, 0x12, 0x1e, 0x2e, 0x6f,
|
||||
0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x61, 0x64, 0x4f,
|
||||
0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6f,
|
||||
0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x61, 0x64, 0x4f,
|
||||
0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a,
|
||||
0x05, 0x57, 0x72, 0x69, 0x74, 0x65, 0x12, 0x1a, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e,
|
||||
0x57, 0x72, 0x69, 0x74, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x57, 0x72, 0x69, 0x74,
|
||||
0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||
0x43, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1b, 0x2e, 0x6f, 0x62, 0x6a, 0x65,
|
||||
0x63, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e,
|
||||
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x07, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12,
|
||||
0x1c, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x48,
|
||||
0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e,
|
||||
0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x48, 0x69, 0x73,
|
||||
0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x06,
|
||||
0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x1b, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e,
|
||||
0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x03, 0x47, 0x52, 0x4e, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x52, 0x4e,
|
||||
0x52, 0x03, 0x47, 0x52, 0x4e, 0x12, 0x35, 0x0a, 0x08, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
|
||||
0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74,
|
||||
0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x52, 0x08, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x26, 0x0a, 0x0f,
|
||||
0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54,
|
||||
0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x84, 0x03, 0x0a, 0x13, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53,
|
||||
0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x0f,
|
||||
0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54,
|
||||
0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x03, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75,
|
||||
0x65, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79,
|
||||
0x12, 0x12, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04,
|
||||
0x6b, 0x69, 0x6e, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x18, 0x05,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x12, 0x3f, 0x0a, 0x06,
|
||||
0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f,
|
||||
0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x61, 0x72,
|
||||
0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73,
|
||||
0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x12, 0x0a,
|
||||
0x04, 0x73, 0x6f, 0x72, 0x74, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x73, 0x6f, 0x72,
|
||||
0x74, 0x12, 0x1b, 0x0a, 0x09, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x08,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x77, 0x69, 0x74, 0x68, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x1f,
|
||||
0x0a, 0x0b, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x09, 0x20,
|
||||
0x01, 0x28, 0x08, 0x52, 0x0a, 0x77, 0x69, 0x74, 0x68, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12,
|
||||
0x1f, 0x0a, 0x0b, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x0a,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x77, 0x69, 0x74, 0x68, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73,
|
||||
0x1a, 0x39, 0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12,
|
||||
0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65,
|
||||
0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x8b, 0x03, 0x0a, 0x12,
|
||||
0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x75,
|
||||
0x6c, 0x74, 0x12, 0x1d, 0x0a, 0x03, 0x47, 0x52, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x0b, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x47, 0x52, 0x4e, 0x52, 0x03, 0x47, 0x52,
|
||||
0x4e, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x75,
|
||||
0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x75, 0x70,
|
||||
0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64,
|
||||
0x5f, 0x62, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74,
|
||||
0x65, 0x64, 0x42, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x06, 0x20, 0x01,
|
||||
0x28, 0x0c, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
|
||||
0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b,
|
||||
0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3e,
|
||||
0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26,
|
||||
0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65,
|
||||
0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c,
|
||||
0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x1f,
|
||||
0x0a, 0x0b, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x18, 0x0a, 0x20,
|
||||
0x01, 0x28, 0x0c, 0x52, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x4a, 0x73, 0x6f, 0x6e, 0x12,
|
||||
0x1d, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x18, 0x0b, 0x20,
|
||||
0x01, 0x28, 0x0c, 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4a, 0x73, 0x6f, 0x6e, 0x1a, 0x39,
|
||||
0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
|
||||
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
|
||||
0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
|
||||
0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x74, 0x0a, 0x14, 0x4f, 0x62, 0x6a,
|
||||
0x65, 0x63, 0x74, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x2f, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x65, 0x12, 0x34, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03,
|
||||
0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65,
|
||||
0x63, 0x74, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x07,
|
||||
0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f,
|
||||
0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x32,
|
||||
0xae, 0x03, 0x0a, 0x0b, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12,
|
||||
0x3d, 0x0a, 0x04, 0x52, 0x65, 0x61, 0x64, 0x12, 0x19, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74,
|
||||
0x2e, 0x52, 0x65, 0x61, 0x64, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x52, 0x65, 0x61, 0x64,
|
||||
0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c,
|
||||
0x0a, 0x09, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x61, 0x64, 0x12, 0x1e, 0x2e, 0x6f, 0x62,
|
||||
0x6a, 0x65, 0x63, 0x74, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x61, 0x64, 0x4f, 0x62,
|
||||
0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6f, 0x62,
|
||||
0x6a, 0x65, 0x63, 0x74, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x61, 0x64, 0x4f, 0x62,
|
||||
0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x05,
|
||||
0x57, 0x72, 0x69, 0x74, 0x65, 0x12, 0x1a, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x57,
|
||||
0x72, 0x69, 0x74, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x1b, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65,
|
||||
0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43,
|
||||
0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1b, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63,
|
||||
0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x44,
|
||||
0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x07, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1c,
|
||||
0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x48, 0x69,
|
||||
0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6f,
|
||||
0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x48, 0x69, 0x73, 0x74,
|
||||
0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x06, 0x53,
|
||||
0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x1b, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f,
|
||||
0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65,
|
||||
0x63, 0x74, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x2f, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -1681,32 +1703,34 @@ var file_object_proto_depIdxs = []int32{
|
||||
7, // 5: object.BatchReadObjectResponse.results:type_name -> object.ReadObjectResponse
|
||||
1, // 6: object.WriteObjectRequest.GRN:type_name -> object.GRN
|
||||
4, // 7: object.WriteObjectResponse.error:type_name -> object.ObjectErrorInfo
|
||||
5, // 8: object.WriteObjectResponse.object:type_name -> object.ObjectVersionInfo
|
||||
0, // 9: object.WriteObjectResponse.status:type_name -> object.WriteObjectResponse.Status
|
||||
1, // 10: object.DeleteObjectRequest.GRN:type_name -> object.GRN
|
||||
1, // 11: object.ObjectHistoryRequest.GRN:type_name -> object.GRN
|
||||
5, // 12: object.ObjectHistoryResponse.versions:type_name -> object.ObjectVersionInfo
|
||||
19, // 13: object.ObjectSearchRequest.labels:type_name -> object.ObjectSearchRequest.LabelsEntry
|
||||
1, // 14: object.ObjectSearchResult.GRN:type_name -> object.GRN
|
||||
20, // 15: object.ObjectSearchResult.labels:type_name -> object.ObjectSearchResult.LabelsEntry
|
||||
17, // 16: object.ObjectSearchResponse.results:type_name -> object.ObjectSearchResult
|
||||
6, // 17: object.ObjectStore.Read:input_type -> object.ReadObjectRequest
|
||||
8, // 18: object.ObjectStore.BatchRead:input_type -> object.BatchReadObjectRequest
|
||||
10, // 19: object.ObjectStore.Write:input_type -> object.WriteObjectRequest
|
||||
12, // 20: object.ObjectStore.Delete:input_type -> object.DeleteObjectRequest
|
||||
14, // 21: object.ObjectStore.History:input_type -> object.ObjectHistoryRequest
|
||||
16, // 22: object.ObjectStore.Search:input_type -> object.ObjectSearchRequest
|
||||
7, // 23: object.ObjectStore.Read:output_type -> object.ReadObjectResponse
|
||||
9, // 24: object.ObjectStore.BatchRead:output_type -> object.BatchReadObjectResponse
|
||||
11, // 25: object.ObjectStore.Write:output_type -> object.WriteObjectResponse
|
||||
13, // 26: object.ObjectStore.Delete:output_type -> object.DeleteObjectResponse
|
||||
15, // 27: object.ObjectStore.History:output_type -> object.ObjectHistoryResponse
|
||||
18, // 28: object.ObjectStore.Search:output_type -> object.ObjectSearchResponse
|
||||
23, // [23:29] is the sub-list for method output_type
|
||||
17, // [17:23] is the sub-list for method input_type
|
||||
17, // [17:17] is the sub-list for extension type_name
|
||||
17, // [17:17] is the sub-list for extension extendee
|
||||
0, // [0:17] is the sub-list for field type_name
|
||||
1, // 8: object.WriteObjectResponse.GRN:type_name -> object.GRN
|
||||
5, // 9: object.WriteObjectResponse.object:type_name -> object.ObjectVersionInfo
|
||||
0, // 10: object.WriteObjectResponse.status:type_name -> object.WriteObjectResponse.Status
|
||||
1, // 11: object.DeleteObjectRequest.GRN:type_name -> object.GRN
|
||||
1, // 12: object.ObjectHistoryRequest.GRN:type_name -> object.GRN
|
||||
1, // 13: object.ObjectHistoryResponse.GRN:type_name -> object.GRN
|
||||
5, // 14: object.ObjectHistoryResponse.versions:type_name -> object.ObjectVersionInfo
|
||||
19, // 15: object.ObjectSearchRequest.labels:type_name -> object.ObjectSearchRequest.LabelsEntry
|
||||
1, // 16: object.ObjectSearchResult.GRN:type_name -> object.GRN
|
||||
20, // 17: object.ObjectSearchResult.labels:type_name -> object.ObjectSearchResult.LabelsEntry
|
||||
17, // 18: object.ObjectSearchResponse.results:type_name -> object.ObjectSearchResult
|
||||
6, // 19: object.ObjectStore.Read:input_type -> object.ReadObjectRequest
|
||||
8, // 20: object.ObjectStore.BatchRead:input_type -> object.BatchReadObjectRequest
|
||||
10, // 21: object.ObjectStore.Write:input_type -> object.WriteObjectRequest
|
||||
12, // 22: object.ObjectStore.Delete:input_type -> object.DeleteObjectRequest
|
||||
14, // 23: object.ObjectStore.History:input_type -> object.ObjectHistoryRequest
|
||||
16, // 24: object.ObjectStore.Search:input_type -> object.ObjectSearchRequest
|
||||
7, // 25: object.ObjectStore.Read:output_type -> object.ReadObjectResponse
|
||||
9, // 26: object.ObjectStore.BatchRead:output_type -> object.BatchReadObjectResponse
|
||||
11, // 27: object.ObjectStore.Write:output_type -> object.WriteObjectResponse
|
||||
13, // 28: object.ObjectStore.Delete:output_type -> object.DeleteObjectResponse
|
||||
15, // 29: object.ObjectStore.History:output_type -> object.ObjectHistoryResponse
|
||||
18, // 30: object.ObjectStore.Search:output_type -> object.ObjectSearchResponse
|
||||
25, // [25:31] is the sub-list for method output_type
|
||||
19, // [19:25] is the sub-list for method input_type
|
||||
19, // [19:19] is the sub-list for extension type_name
|
||||
19, // [19:19] is the sub-list for extension extendee
|
||||
0, // [0:19] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_object_proto_init() }
|
||||
|
@ -160,14 +160,17 @@ message WriteObjectResponse {
|
||||
// Error info -- if exists, the save did not happen
|
||||
ObjectErrorInfo error = 1;
|
||||
|
||||
// Object identifier
|
||||
GRN GRN = 2;
|
||||
|
||||
// Object details with the body removed
|
||||
ObjectVersionInfo object = 2;
|
||||
ObjectVersionInfo object = 3;
|
||||
|
||||
// Object summary as JSON
|
||||
bytes summary_json = 3;
|
||||
bytes summary_json = 4;
|
||||
|
||||
// Status code
|
||||
Status status = 4;
|
||||
Status status = 5;
|
||||
|
||||
// Status enumeration
|
||||
enum Status {
|
||||
@ -210,11 +213,14 @@ message ObjectHistoryRequest {
|
||||
}
|
||||
|
||||
message ObjectHistoryResponse {
|
||||
// Object identifier
|
||||
GRN GRN = 1;
|
||||
|
||||
// Object metadata without the raw bytes
|
||||
repeated ObjectVersionInfo versions = 1;
|
||||
repeated ObjectVersionInfo versions = 2;
|
||||
|
||||
// More results exist... pass this in the next request
|
||||
string next_page_token = 2;
|
||||
string next_page_token = 3;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc v3.21.8
|
||||
// - protoc v3.21.9
|
||||
// source: object.proto
|
||||
|
||||
package object
|
||||
|
Loading…
Reference in New Issue
Block a user