Skip to content
Snippets Groups Projects
Commit a6c09a39 authored by Alena Petraki's avatar Alena Petraki
Browse files

Операции используют расширенную реализацию ошибки `common.Error`

parent bec78dfb
No related branches found
No related tags found
No related merge requests found
Subproject commit 81c967842f55811b459e455572703631712d7d86
Subproject commit 595e1e03da0c9457c74a63748f74f0a636c6ed37
package grpc
import (
"fmt"
"git.perx.ru/perxis/perxis-go/pkg/errors"
"git.perx.ru/perxis/perxis-go/proto/common"
"github.com/hashicorp/go-multierror"
)
func ErrorFromProto(err error, pberr *common.Error) error {
if pberr == nil {
return nil
}
if err == nil {
err = errors.New(pberr.Message)
}
// Должен быть первым в цепочке
err = badRequestFromPb(err, pberr)
if pberr.ErrorCode != 0 {
err = errors.WithCode(err, pberr.ErrorCode)
}
if pberr.ErrorId != "" {
err = errors.SetID(err, pberr.ErrorId)
}
if pberr.Domain != "" {
err = errors.WithDomain(err, pberr.Domain)
}
if pberr.Details != "" {
err = errors.WithDetail(err, pberr.Details)
}
err = helpFromPb(err, pberr)
var errs []error
for _, e := range pberr.Errors {
errs = append(errs, ErrorFromProto(nil, e))
}
if len(errs) > 0 {
err = errors.WithErrors(err, errs...)
}
return err
}
func ProtoFromError(err error) *common.Error {
if err == nil {
return nil
}
err = errors.WithID(err)
pberr := &common.Error{
ErrorCode: errors.GetCode(err),
ErrorId: errors.GetID(err),
Reason: "", // TBD
Domain: errors.GetDomain(err),
Message: err.Error(),
Details: errors.GetDetail(err),
Metadata: nil, // TBD
BadRequest: getBadRequest(err),
DebugInfo: getDebugInfo(err),
Help: getHelp(err),
LocalizedMessages: nil, // TBD
Errors: nil,
}
for _, e := range errors.GetErrors(err) {
pberr.Errors = append(pberr.Errors, ProtoFromError(e))
}
return pberr
}
func getHelp(err error) *common.Error_Help {
if help := errors.GetHelp(err); help != nil {
pbhelp := &common.Error_Help{}
for _, hl := range help.Links {
pbhelp.Links = append(pbhelp.Links, &common.Error_Help_Link{Description: hl.Description, Url: hl.URL})
}
return pbhelp
}
return nil
}
func helpFromPb(err error, pberr *common.Error) error {
if pberr.Help == nil || len(pberr.Help.Links) == 0 {
return err
}
h := &errors.Help{}
for _, l := range pberr.Help.Links {
h.Links = append(h.Links, errors.HelpLink{Description: l.Description, URL: l.Url})
}
return errors.WithHelp(err, h)
}
func getBadRequest(err error) *common.Error_BadRequest {
br := &common.Error_BadRequest{}
var merr *multierror.Error
if errors.As(err, &merr) {
for _, e := range merr.Errors {
var errField errors.FieldError
if errors.As(e, &errField) {
br.Errors = append(br.Errors, &common.Error_BadRequest_FieldViolation{Field: errField.Field(), Description: errors.Unwrap(errField).Error()})
}
}
} else {
var errField errors.FieldError
if errors.As(err, &errField) {
br.Errors = append(br.Errors, &common.Error_BadRequest_FieldViolation{Field: errField.Field(), Description: errors.Unwrap(errField).Error()})
}
}
if len(br.Errors) > 0 {
return br
}
return nil
}
func getDebugInfo(err error) *common.Error_DebugInfo {
if trace, ok := errors.GetStackTrace(err); ok {
di := &common.Error_DebugInfo{}
for _, t := range trace {
di.StackTrace = append(di.StackTrace, fmt.Sprintf("%+v", t))
}
return di
}
return nil
}
func badRequestFromPb(err error, pberr *common.Error) error {
if pberr.BadRequest == nil || len(pberr.BadRequest.Errors) == 0 {
return err
}
var merr error
for _, e := range pberr.BadRequest.Errors {
merr = multierror.Append(merr, errors.WithField(errors.New(e.Description), e.Field))
}
return errors.WrapErr(err, merr)
}
......@@ -7,6 +7,8 @@ import (
"git.perx.ru/perxis/perxis-go/pkg/errors"
"git.perx.ru/perxis/perxis-go/proto/common"
"github.com/hashicorp/go-multierror"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func Test_getBadRequest(t *testing.T) {
......@@ -60,3 +62,84 @@ func Test_getHelp(t *testing.T) {
})
}
}
func TestProtoFromError(t *testing.T) {
err := errors.New("some error")
err = errors.SetID(err, "0")
err = errors.WithDetail(err, "Ошибка")
err = errors.WithDomain(err, "domain-1")
err = errors.WithHelp(err, &errors.Help{Links: []errors.HelpLink{{Description: "Docs", URL: "https://docs.com"}}})
err = errors.WithErrors(err,
errors.SetID(errors.WithDetail(errors.New("err-1"), "Ошибка-1"), "1"),
errors.SetID(errors.WithDetail(errors.New("err-2"), "Ошибка-2"), "2"),
errors.SetID(errors.WithDetail(errors.New("err-3"), "Ошибка-3"), "3"),
)
assert.Equal(t,
&common.Error{
ErrorCode: 0,
ErrorId: "0",
Reason: "",
Domain: "domain-1",
Message: "some error",
Details: "Ошибка",
Help: &common.Error_Help{
Links: []*common.Error_Help_Link{{
Description: "Docs",
Url: "https://docs.com",
}},
},
Errors: []*common.Error{
{ErrorId: "1", Message: "err-1", Details: "Ошибка-1"},
{ErrorId: "2", Message: "err-2", Details: "Ошибка-2"},
{ErrorId: "3", Message: "err-3", Details: "Ошибка-3"},
},
},
ProtoFromError(err),
)
}
func TestErrorFromProto(t *testing.T) {
pberr := &common.Error{
ErrorCode: 0,
ErrorId: "0",
Reason: "",
Domain: "domain-1",
Message: "some error",
Details: "Ошибка",
Help: &common.Error_Help{
Links: []*common.Error_Help_Link{{
Description: "Docs",
Url: "https://docs.com",
}},
},
Errors: []*common.Error{
{ErrorId: "1", Message: "err-1", Details: "Ошибка-1"},
{ErrorId: "2", Message: "err-2", Details: "Ошибка-2"},
{ErrorId: "3", Message: "err-3", Details: "Ошибка-3"},
},
}
err := ErrorFromProto(nil, pberr)
require.NotNil(t, err)
assert.Equal(t, "0", errors.GetID(err))
assert.Equal(t, "some error", err.Error())
assert.Equal(t, "Ошибка", errors.GetDetail(err))
assert.Equal(t, "domain-1", errors.GetDomain(err))
assert.Equal(t, &errors.Help{Links: []errors.HelpLink{{Description: "Docs", URL: "https://docs.com"}}}, errors.GetHelp(err))
errs := errors.GetErrors(err)
require.Len(t, errs, 3)
assert.Equal(t, "1", errors.GetID(errs[0]))
assert.Equal(t, "err-1", errs[0].Error())
assert.Equal(t, "Ошибка-1", errors.GetDetail(errs[0]))
assert.Equal(t, "2", errors.GetID(errs[1]))
assert.Equal(t, "err-2", errs[1].Error())
assert.Equal(t, "Ошибка-2", errors.GetDetail(errs[1]))
assert.Equal(t, "3", errors.GetID(errs[2]))
assert.Equal(t, "err-3", errs[2].Error())
assert.Equal(t, "Ошибка-3", errors.GetDetail(errs[2]))
}
package grpc
import (
"fmt"
"git.perx.ru/perxis/perxis-go/pkg/errors"
"git.perx.ru/perxis/perxis-go/proto/common"
"github.com/hashicorp/go-multierror"
"google.golang.org/grpc/status"
)
func getHelp(err error) *common.Error_Help {
if help := errors.GetHelp(err); help != nil {
pbhelp := &common.Error_Help{}
for _, hl := range help.Links {
pbhelp.Links = append(pbhelp.Links, &common.Error_Help_Link{Description: hl.Description, Url: hl.URL})
}
return pbhelp
}
return nil
}
func helpFromPb(err error, pberr *common.Error) error {
if pberr.Help == nil || len(pberr.Help.Links) == 0 {
return err
}
h := &errors.Help{}
for _, l := range pberr.Help.Links {
h.Links = append(h.Links, errors.HelpLink{Description: l.Description, URL: l.Url})
}
return errors.WithHelp(err, h)
}
func getBadRequest(err error) *common.Error_BadRequest {
br := &common.Error_BadRequest{}
var merr *multierror.Error
if errors.As(err, &merr) {
for _, e := range merr.Errors {
var errField errors.FieldError
if errors.As(e, &errField) {
br.Errors = append(br.Errors, &common.Error_BadRequest_FieldViolation{Field: errField.Field(), Description: errors.Unwrap(errField).Error()})
}
}
} else {
var errField errors.FieldError
if errors.As(err, &errField) {
br.Errors = append(br.Errors, &common.Error_BadRequest_FieldViolation{Field: errField.Field(), Description: errors.Unwrap(errField).Error()})
}
}
if len(br.Errors) > 0 {
return br
}
return nil
}
func getDebugInfo(err error) *common.Error_DebugInfo {
if trace, ok := errors.GetStackTrace(err); ok {
di := &common.Error_DebugInfo{}
for _, t := range trace {
di.StackTrace = append(di.StackTrace, fmt.Sprintf("%+v", t))
}
return di
}
return nil
}
func badRequestFromPb(err error, pberr *common.Error) error {
if pberr.BadRequest == nil || len(pberr.BadRequest.Errors) == 0 {
return err
}
var merr error
for _, e := range pberr.BadRequest.Errors {
merr = multierror.Append(merr, errors.WithField(errors.New(e.Description), e.Field))
}
return errors.WrapErr(err, merr)
}
func StatusFromError(err error) *status.Status {
if err == nil {
return nil
}
err = errors.WithID(err)
pberr := &common.Error{
ErrorCode: errors.GetCode(err),
ErrorId: errors.GetID(err),
Reason: "", // TBD
Domain: errors.GetDomain(err),
Help: getHelp(err),
Metadata: nil, // TBD
BadRequest: getBadRequest(err),
DebugInfo: getDebugInfo(err),
LocalizedMessages: nil, // TBD
}
pberr := ProtoFromError(err)
st := status.New(errors.GetStatusCode(err), err.Error())
st, _ = st.WithDetails(pberr)
return st
}
func convertProtoError(err error, pberr *common.Error) error {
if pberr == nil {
return nil
}
// Должен быть первым в цепочке
err = badRequestFromPb(err, pberr)
if pberr.ErrorCode != 0 {
err = errors.WithCode(err, pberr.ErrorCode)
}
if pberr.ErrorId != "" {
err = errors.SetID(err, pberr.ErrorId)
}
if pberr.Domain != "" {
err = errors.WithDomain(err, pberr.Domain)
}
err = helpFromPb(err, pberr)
return err
}
func ErrorFromStatus(st *status.Status) error {
details := st.Details()
err := errors.New(st.Message())
if len(details) > 0 {
if pberr, ok := details[0].(*common.Error); ok {
err = convertProtoError(err, pberr)
err = ErrorFromProto(err, pberr)
}
}
err = errors.WithStatusCode(err, st.Code())
......
......@@ -6,6 +6,7 @@ import (
"time"
"git.perx.ru/perxis/perxis-go/pkg/errors"
grpcerr "git.perx.ru/perxis/perxis-go/pkg/errors/grpc"
"git.perx.ru/perxis/perxis-go/pkg/id"
"git.perx.ru/perxis/perxis-go/proto/common"
"google.golang.org/grpc"
......@@ -146,15 +147,12 @@ func (o *Operation) SetCancelFunc(cancelFunc func()) {
// SetError устанавливает ошибку операции
func (o *Operation) SetError(err error) {
o.proto.Result = &common.Operation_Error{Error: err.Error()}
o.proto.Result = &common.Operation_Error{Error: grpcerr.ProtoFromError(err)}
}
// Error возвращает ошибку операции
func (o *Operation) Error() error {
if errStr := o.proto.GetError(); errStr != "" {
return errors.New(errStr)
}
return nil
return grpcerr.ErrorFromProto(nil, o.proto.GetError())
}
func (o *Operation) SetDone(done bool) {
......
This diff is collapsed.
This diff is collapsed.
......@@ -146,11 +146,11 @@ func (x *Operation) GetResponse() *anypb.Any {
return nil
}
func (x *Operation) GetError() string {
func (x *Operation) GetError() *Error {
if x, ok := x.GetResult().(*Operation_Error); ok {
return x.Error
}
return ""
return nil
}
type isOperation_Result interface {
......@@ -164,7 +164,7 @@ type Operation_Response struct {
type Operation_Error struct {
// Результат выполнения операции в случае ошибки
Error string `protobuf:"bytes,10,opt,name=error,proto3,oneof"`
Error *Error `protobuf:"bytes,10,opt,name=error,proto3,oneof"`
}
func (*Operation_Response) isOperation_Result() {}
......@@ -179,34 +179,36 @@ var file_common_operation_proto_rawDesc = []byte{
0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf0, 0x02, 0x0a,
0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65,
0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x39, 0x0a, 0x0a,
0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72,
0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74,
0x65, 0x64, 0x5f, 0x62, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, 0x65,
0x61, 0x74, 0x65, 0x64, 0x42, 0x79, 0x12, 0x3b, 0x0a, 0x0b, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69,
0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f,
0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69,
0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65,
0x64, 0x41, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x6f, 0x6e, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28,
0x08, 0x52, 0x04, 0x64, 0x6f, 0x6e, 0x65, 0x12, 0x30, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64,
0x61, 0x74, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52,
0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f,
0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e,
0x79, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a,
0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05,
0x65, 0x72, 0x72, 0x6f, 0x72, 0x42, 0x08, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42,
0x32, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x2e, 0x70, 0x65, 0x72, 0x78, 0x2e, 0x72, 0x75, 0x2f, 0x70,
0x65, 0x72, 0x78, 0x69, 0x73, 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2d, 0x67, 0x6f, 0x2f,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x3b, 0x63, 0x6f, 0x6d,
0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x12, 0x63, 0x6f,
0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x22, 0xff, 0x02, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e,
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20,
0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e,
0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x03,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x63,
0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x62, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x42, 0x79, 0x12, 0x3b, 0x0a, 0x0b, 0x6d, 0x6f,
0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x6d, 0x6f, 0x64,
0x69, 0x66, 0x69, 0x65, 0x64, 0x41, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x6f, 0x6e, 0x65, 0x18,
0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x64, 0x6f, 0x6e, 0x65, 0x12, 0x30, 0x0a, 0x08, 0x6d,
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e,
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
0x41, 0x6e, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x32, 0x0a,
0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2e, 0x41, 0x6e, 0x79, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x25, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x0d, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x48,
0x00, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x42, 0x08, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75,
0x6c, 0x74, 0x42, 0x32, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x2e, 0x70, 0x65, 0x72, 0x78, 0x2e, 0x72,
0x75, 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2d,
0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x3b,
0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
......@@ -226,17 +228,19 @@ var file_common_operation_proto_goTypes = []interface{}{
(*Operation)(nil), // 0: common.Operation
(*timestamppb.Timestamp)(nil), // 1: google.protobuf.Timestamp
(*anypb.Any)(nil), // 2: google.protobuf.Any
(*Error)(nil), // 3: common.Error
}
var file_common_operation_proto_depIdxs = []int32{
1, // 0: common.Operation.created_at:type_name -> google.protobuf.Timestamp
1, // 1: common.Operation.modified_at:type_name -> google.protobuf.Timestamp
2, // 2: common.Operation.metadata:type_name -> google.protobuf.Any
2, // 3: common.Operation.response:type_name -> google.protobuf.Any
4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
3, // 4: common.Operation.error:type_name -> common.Error
5, // [5:5] is the sub-list for method output_type
5, // [5:5] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
}
func init() { file_common_operation_proto_init() }
......@@ -244,6 +248,7 @@ func file_common_operation_proto_init() {
if File_common_operation_proto != nil {
return
}
file_common_error_proto_init()
if !protoimpl.UnsafeEnabled {
file_common_operation_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Operation); i {
......
......@@ -27,9 +27,9 @@ const (
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type OperationServiceClient interface {
// Возвращает статус операции и ее результат если она завершена
// Возвращает статус операции и ее результат, если она завершена
Get(ctx context.Context, in *GetOperationRequest, opts ...grpc.CallOption) (*Operation, error)
// Отменяет выполнение операции если это поддерживается сервисом
// Отменяет выполнение операции, если это поддерживается сервисом
Cancel(ctx context.Context, in *CancelOperationRequest, opts ...grpc.CallOption) (*Operation, error)
}
......@@ -63,9 +63,9 @@ func (c *operationServiceClient) Cancel(ctx context.Context, in *CancelOperation
// All implementations must embed UnimplementedOperationServiceServer
// for forward compatibility
type OperationServiceServer interface {
// Возвращает статус операции и ее результат если она завершена
// Возвращает статус операции и ее результат, если она завершена
Get(context.Context, *GetOperationRequest) (*Operation, error)
// Отменяет выполнение операции если это поддерживается сервисом
// Отменяет выполнение операции, если это поддерживается сервисом
Cancel(context.Context, *CancelOperationRequest) (*Operation, error)
mustEmbedUnimplementedOperationServiceServer()
}
......
This diff is collapsed.
......@@ -294,9 +294,9 @@ type CheckRequest struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Extensions []string `protobuf:"bytes,10000,rep,name=extensions,proto3" json:"extensions,omitempty"` // Список расширений для удаления
SpaceId string `protobuf:"bytes,10010,opt,name=space_id,json=spaceId,proto3" json:"space_id,omitempty"` // Пространство для удаления расширений
EnvId string `protobuf:"bytes,10020,opt,name=env_id,json=envId,proto3" json:"env_id,omitempty"` // Идентификатор окружения для установки (по умолчанию master)
Extensions []string `protobuf:"bytes,10000,rep,name=extensions,proto3" json:"extensions,omitempty"` // Список расширений для проверки
SpaceId string `protobuf:"bytes,10010,opt,name=space_id,json=spaceId,proto3" json:"space_id,omitempty"` // Пространство
EnvId string `protobuf:"bytes,10020,opt,name=env_id,json=envId,proto3" json:"env_id,omitempty"` // Идентификатор окружения (по умолчанию master)
}
func (x *CheckRequest) Reset() {
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment