* refactor (controller): Use a grpc server for the grpc-gateway This starts a grpc server for the grpc-gateway. The new gateway server uses an in-memory listener which also supports "dialing", so the http proxy can connect to the in-memory listener. This change allows us to use all grpc server features and was in part motivated by a need for an interceptor of inbound requests. With that said, having a "proper" grpc server for the gateway will provide a lot more flexibility and capabilities moving forward. The request context will still be verified via middleware in the http proxy (see wrapHandlerWithCommonFuncs). This verified context will be serialized into a protobuf and sent along to the grpc-gateway via metadata where an interceptor will add the verified request info to the request's context (see requestCtxInterceptor). The interceptor will verify the serialized request info via a shared ticket with it's companion in-memory http proxy. FYI: the ticket is simply random base62 string (see db.NewPrivateId). This change also necessitated a minor change to services. We need to return an empty response instead of nil, nil when there are no errors and the response is empty. * refactor (handlers): Rename gRPC Gateway filter Originally, this was called an OutgoingInterceptor, which is an unfortunate name since it's not an interceptor. Now that we're refactoring the gateway stuff and have proper interceptors, renaming this should remove ambiguity * refactor: Rework how 204 with empty msg is handled Recent changes to grpc gateway has necessitated a change to how 204s are handled by the gateway * tests (bats): Check status codes for delete operations
323 lines
9.8 KiB
Go
323 lines
9.8 KiB
Go
// Code generated by protoc-gen-go. DO NOT EDIT.
|
|
// versions:
|
|
// protoc-gen-go v1.27.1
|
|
// protoc v3.17.3
|
|
// source: errors/v1/errors.proto
|
|
|
|
package errors
|
|
|
|
import (
|
|
api "github.com/hashicorp/boundary/internal/gen/controller/api"
|
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
|
reflect "reflect"
|
|
sync "sync"
|
|
)
|
|
|
|
const (
|
|
// Verify that this generated code is sufficiently up-to-date.
|
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
|
)
|
|
|
|
// Err is a protobuf representation of a domain error
|
|
type Err struct {
|
|
state protoimpl.MessageState
|
|
sizeCache protoimpl.SizeCache
|
|
unknownFields protoimpl.UnknownFields
|
|
|
|
// code is the error's code, which can be used to get the error's
|
|
// errorCodeInfo, which contains the error's Kind and Message
|
|
Code uint32 `protobuf:"varint,10,opt,name=code,proto3" json:"code,omitempty"`
|
|
// msg for the error
|
|
Msg string `protobuf:"bytes,20,opt,name=msg,proto3" json:"msg,omitempty"`
|
|
// op represents the operation raising/propagating an error and is optional.
|
|
Op string `protobuf:"bytes,30,opt,name=op,proto3" json:"op,omitempty"`
|
|
// wrapped represents an optionally wrapped error
|
|
//
|
|
// Types that are assignable to Wrapped:
|
|
// *Err_Err
|
|
// *Err_StdError
|
|
// *Err_None
|
|
Wrapped isErr_Wrapped `protobuf_oneof:"wrapped"`
|
|
}
|
|
|
|
func (x *Err) Reset() {
|
|
*x = Err{}
|
|
if protoimpl.UnsafeEnabled {
|
|
mi := &file_errors_v1_errors_proto_msgTypes[0]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
}
|
|
|
|
func (x *Err) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*Err) ProtoMessage() {}
|
|
|
|
func (x *Err) ProtoReflect() protoreflect.Message {
|
|
mi := &file_errors_v1_errors_proto_msgTypes[0]
|
|
if protoimpl.UnsafeEnabled && x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use Err.ProtoReflect.Descriptor instead.
|
|
func (*Err) Descriptor() ([]byte, []int) {
|
|
return file_errors_v1_errors_proto_rawDescGZIP(), []int{0}
|
|
}
|
|
|
|
func (x *Err) GetCode() uint32 {
|
|
if x != nil {
|
|
return x.Code
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *Err) GetMsg() string {
|
|
if x != nil {
|
|
return x.Msg
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Err) GetOp() string {
|
|
if x != nil {
|
|
return x.Op
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *Err) GetWrapped() isErr_Wrapped {
|
|
if m != nil {
|
|
return m.Wrapped
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *Err) GetErr() *Err {
|
|
if x, ok := x.GetWrapped().(*Err_Err); ok {
|
|
return x.Err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *Err) GetStdError() string {
|
|
if x, ok := x.GetWrapped().(*Err_StdError); ok {
|
|
return x.StdError
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Err) GetNone() bool {
|
|
if x, ok := x.GetWrapped().(*Err_None); ok {
|
|
return x.None
|
|
}
|
|
return false
|
|
}
|
|
|
|
type isErr_Wrapped interface {
|
|
isErr_Wrapped()
|
|
}
|
|
|
|
type Err_Err struct {
|
|
// err is a wrapped Err (aka a domain error)
|
|
Err *Err `protobuf:"bytes,40,opt,name=err,proto3,oneof"`
|
|
}
|
|
|
|
type Err_StdError struct {
|
|
// std_error is a wrapped std error
|
|
StdError string `protobuf:"bytes,50,opt,name=std_error,json=stdError,proto3,oneof"`
|
|
}
|
|
|
|
type Err_None struct {
|
|
// no error or err is wrapped
|
|
None bool `protobuf:"varint,60,opt,name=none,proto3,oneof"`
|
|
}
|
|
|
|
func (*Err_Err) isErr_Wrapped() {}
|
|
|
|
func (*Err_StdError) isErr_Wrapped() {}
|
|
|
|
func (*Err_None) isErr_Wrapped() {}
|
|
|
|
// ApiError is a protobuf representation of a controller ApiError
|
|
type ApiError struct {
|
|
state protoimpl.MessageState
|
|
sizeCache protoimpl.SizeCache
|
|
unknownFields protoimpl.UnknownFields
|
|
|
|
// api_error is the controller ApiError
|
|
ApiError *api.Error `protobuf:"bytes,10,opt,name=api_error,json=apiError,proto3" json:"api_error,omitempty"`
|
|
// status is the status code assocatiated with the api error
|
|
Status int32 `protobuf:"varint,20,opt,name=status,proto3" json:"status,omitempty"`
|
|
}
|
|
|
|
func (x *ApiError) Reset() {
|
|
*x = ApiError{}
|
|
if protoimpl.UnsafeEnabled {
|
|
mi := &file_errors_v1_errors_proto_msgTypes[1]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
}
|
|
|
|
func (x *ApiError) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*ApiError) ProtoMessage() {}
|
|
|
|
func (x *ApiError) ProtoReflect() protoreflect.Message {
|
|
mi := &file_errors_v1_errors_proto_msgTypes[1]
|
|
if protoimpl.UnsafeEnabled && x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use ApiError.ProtoReflect.Descriptor instead.
|
|
func (*ApiError) Descriptor() ([]byte, []int) {
|
|
return file_errors_v1_errors_proto_rawDescGZIP(), []int{1}
|
|
}
|
|
|
|
func (x *ApiError) GetApiError() *api.Error {
|
|
if x != nil {
|
|
return x.ApiError
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *ApiError) GetStatus() int32 {
|
|
if x != nil {
|
|
return x.Status
|
|
}
|
|
return 0
|
|
}
|
|
|
|
var File_errors_v1_errors_proto protoreflect.FileDescriptor
|
|
|
|
var file_errors_v1_errors_proto_rawDesc = []byte{
|
|
0x0a, 0x16, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x72, 0x72, 0x6f,
|
|
0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73,
|
|
0x2e, 0x76, 0x31, 0x1a, 0x1d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f,
|
|
0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f,
|
|
0x74, 0x6f, 0x22, 0x9f, 0x01, 0x0a, 0x03, 0x45, 0x72, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f,
|
|
0x64, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10,
|
|
0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67,
|
|
0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x70, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x6f, 0x70,
|
|
0x12, 0x22, 0x0a, 0x03, 0x65, 0x72, 0x72, 0x18, 0x28, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e,
|
|
0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x72, 0x72, 0x48, 0x00, 0x52,
|
|
0x03, 0x65, 0x72, 0x72, 0x12, 0x1d, 0x0a, 0x09, 0x73, 0x74, 0x64, 0x5f, 0x65, 0x72, 0x72, 0x6f,
|
|
0x72, 0x18, 0x32, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x73, 0x74, 0x64, 0x45, 0x72,
|
|
0x72, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x04, 0x6e, 0x6f, 0x6e, 0x65, 0x18, 0x3c, 0x20, 0x01, 0x28,
|
|
0x08, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x6f, 0x6e, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x77, 0x72, 0x61,
|
|
0x70, 0x70, 0x65, 0x64, 0x22, 0x59, 0x0a, 0x08, 0x41, 0x70, 0x69, 0x45, 0x72, 0x72, 0x6f, 0x72,
|
|
0x12, 0x35, 0x0a, 0x09, 0x61, 0x70, 0x69, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x0a, 0x20,
|
|
0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72,
|
|
0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x08, 0x61,
|
|
0x70, 0x69, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75,
|
|
0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42,
|
|
0x3a, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61,
|
|
0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79,
|
|
0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x72,
|
|
0x72, 0x6f, 0x72, 0x73, 0x3b, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
|
0x74, 0x6f, 0x33,
|
|
}
|
|
|
|
var (
|
|
file_errors_v1_errors_proto_rawDescOnce sync.Once
|
|
file_errors_v1_errors_proto_rawDescData = file_errors_v1_errors_proto_rawDesc
|
|
)
|
|
|
|
func file_errors_v1_errors_proto_rawDescGZIP() []byte {
|
|
file_errors_v1_errors_proto_rawDescOnce.Do(func() {
|
|
file_errors_v1_errors_proto_rawDescData = protoimpl.X.CompressGZIP(file_errors_v1_errors_proto_rawDescData)
|
|
})
|
|
return file_errors_v1_errors_proto_rawDescData
|
|
}
|
|
|
|
var file_errors_v1_errors_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
|
var file_errors_v1_errors_proto_goTypes = []interface{}{
|
|
(*Err)(nil), // 0: errors.v1.Err
|
|
(*ApiError)(nil), // 1: errors.v1.ApiError
|
|
(*api.Error)(nil), // 2: controller.api.v1.Error
|
|
}
|
|
var file_errors_v1_errors_proto_depIdxs = []int32{
|
|
0, // 0: errors.v1.Err.err:type_name -> errors.v1.Err
|
|
2, // 1: errors.v1.ApiError.api_error:type_name -> controller.api.v1.Error
|
|
2, // [2:2] is the sub-list for method output_type
|
|
2, // [2:2] is the sub-list for method input_type
|
|
2, // [2:2] is the sub-list for extension type_name
|
|
2, // [2:2] is the sub-list for extension extendee
|
|
0, // [0:2] is the sub-list for field type_name
|
|
}
|
|
|
|
func init() { file_errors_v1_errors_proto_init() }
|
|
func file_errors_v1_errors_proto_init() {
|
|
if File_errors_v1_errors_proto != nil {
|
|
return
|
|
}
|
|
if !protoimpl.UnsafeEnabled {
|
|
file_errors_v1_errors_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
|
switch v := v.(*Err); i {
|
|
case 0:
|
|
return &v.state
|
|
case 1:
|
|
return &v.sizeCache
|
|
case 2:
|
|
return &v.unknownFields
|
|
default:
|
|
return nil
|
|
}
|
|
}
|
|
file_errors_v1_errors_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
|
switch v := v.(*ApiError); i {
|
|
case 0:
|
|
return &v.state
|
|
case 1:
|
|
return &v.sizeCache
|
|
case 2:
|
|
return &v.unknownFields
|
|
default:
|
|
return nil
|
|
}
|
|
}
|
|
}
|
|
file_errors_v1_errors_proto_msgTypes[0].OneofWrappers = []interface{}{
|
|
(*Err_Err)(nil),
|
|
(*Err_StdError)(nil),
|
|
(*Err_None)(nil),
|
|
}
|
|
type x struct{}
|
|
out := protoimpl.TypeBuilder{
|
|
File: protoimpl.DescBuilder{
|
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
|
RawDescriptor: file_errors_v1_errors_proto_rawDesc,
|
|
NumEnums: 0,
|
|
NumMessages: 2,
|
|
NumExtensions: 0,
|
|
NumServices: 0,
|
|
},
|
|
GoTypes: file_errors_v1_errors_proto_goTypes,
|
|
DependencyIndexes: file_errors_v1_errors_proto_depIdxs,
|
|
MessageInfos: file_errors_v1_errors_proto_msgTypes,
|
|
}.Build()
|
|
File_errors_v1_errors_proto = out.File
|
|
file_errors_v1_errors_proto_rawDesc = nil
|
|
file_errors_v1_errors_proto_goTypes = nil
|
|
file_errors_v1_errors_proto_depIdxs = nil
|
|
}
|