auth.pb.go 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158
  1. // Code generated by protoc-gen-gogo. DO NOT EDIT.
  2. // source: auth.proto
  3. package authpb
  4. import (
  5. fmt "fmt"
  6. io "io"
  7. math "math"
  8. math_bits "math/bits"
  9. _ "github.com/gogo/protobuf/gogoproto"
  10. proto "github.com/golang/protobuf/proto"
  11. )
  12. // Reference imports to suppress errors if they are not otherwise used.
  13. var _ = proto.Marshal
  14. var _ = fmt.Errorf
  15. var _ = math.Inf
  16. // This is a compile-time assertion to ensure that this generated file
  17. // is compatible with the proto package it is being compiled against.
  18. // A compilation error at this line likely means your copy of the
  19. // proto package needs to be updated.
  20. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
  21. type Permission_Type int32
  22. const (
  23. READ Permission_Type = 0
  24. WRITE Permission_Type = 1
  25. READWRITE Permission_Type = 2
  26. )
  27. var Permission_Type_name = map[int32]string{
  28. 0: "READ",
  29. 1: "WRITE",
  30. 2: "READWRITE",
  31. }
  32. var Permission_Type_value = map[string]int32{
  33. "READ": 0,
  34. "WRITE": 1,
  35. "READWRITE": 2,
  36. }
  37. func (x Permission_Type) String() string {
  38. return proto.EnumName(Permission_Type_name, int32(x))
  39. }
  40. func (Permission_Type) EnumDescriptor() ([]byte, []int) {
  41. return fileDescriptor_8bbd6f3875b0e874, []int{2, 0}
  42. }
  43. type UserAddOptions struct {
  44. NoPassword bool `protobuf:"varint,1,opt,name=no_password,json=noPassword,proto3" json:"no_password,omitempty"`
  45. XXX_NoUnkeyedLiteral struct{} `json:"-"`
  46. XXX_unrecognized []byte `json:"-"`
  47. XXX_sizecache int32 `json:"-"`
  48. }
  49. func (m *UserAddOptions) Reset() { *m = UserAddOptions{} }
  50. func (m *UserAddOptions) String() string { return proto.CompactTextString(m) }
  51. func (*UserAddOptions) ProtoMessage() {}
  52. func (*UserAddOptions) Descriptor() ([]byte, []int) {
  53. return fileDescriptor_8bbd6f3875b0e874, []int{0}
  54. }
  55. func (m *UserAddOptions) XXX_Unmarshal(b []byte) error {
  56. return m.Unmarshal(b)
  57. }
  58. func (m *UserAddOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
  59. if deterministic {
  60. return xxx_messageInfo_UserAddOptions.Marshal(b, m, deterministic)
  61. } else {
  62. b = b[:cap(b)]
  63. n, err := m.MarshalToSizedBuffer(b)
  64. if err != nil {
  65. return nil, err
  66. }
  67. return b[:n], nil
  68. }
  69. }
  70. func (m *UserAddOptions) XXX_Merge(src proto.Message) {
  71. xxx_messageInfo_UserAddOptions.Merge(m, src)
  72. }
  73. func (m *UserAddOptions) XXX_Size() int {
  74. return m.Size()
  75. }
  76. func (m *UserAddOptions) XXX_DiscardUnknown() {
  77. xxx_messageInfo_UserAddOptions.DiscardUnknown(m)
  78. }
  79. var xxx_messageInfo_UserAddOptions proto.InternalMessageInfo
  80. // User is a single entry in the bucket authUsers
  81. type User struct {
  82. Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
  83. Password []byte `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
  84. Roles []string `protobuf:"bytes,3,rep,name=roles,proto3" json:"roles,omitempty"`
  85. Options *UserAddOptions `protobuf:"bytes,4,opt,name=options,proto3" json:"options,omitempty"`
  86. XXX_NoUnkeyedLiteral struct{} `json:"-"`
  87. XXX_unrecognized []byte `json:"-"`
  88. XXX_sizecache int32 `json:"-"`
  89. }
  90. func (m *User) Reset() { *m = User{} }
  91. func (m *User) String() string { return proto.CompactTextString(m) }
  92. func (*User) ProtoMessage() {}
  93. func (*User) Descriptor() ([]byte, []int) {
  94. return fileDescriptor_8bbd6f3875b0e874, []int{1}
  95. }
  96. func (m *User) XXX_Unmarshal(b []byte) error {
  97. return m.Unmarshal(b)
  98. }
  99. func (m *User) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
  100. if deterministic {
  101. return xxx_messageInfo_User.Marshal(b, m, deterministic)
  102. } else {
  103. b = b[:cap(b)]
  104. n, err := m.MarshalToSizedBuffer(b)
  105. if err != nil {
  106. return nil, err
  107. }
  108. return b[:n], nil
  109. }
  110. }
  111. func (m *User) XXX_Merge(src proto.Message) {
  112. xxx_messageInfo_User.Merge(m, src)
  113. }
  114. func (m *User) XXX_Size() int {
  115. return m.Size()
  116. }
  117. func (m *User) XXX_DiscardUnknown() {
  118. xxx_messageInfo_User.DiscardUnknown(m)
  119. }
  120. var xxx_messageInfo_User proto.InternalMessageInfo
  121. // Permission is a single entity
  122. type Permission struct {
  123. PermType Permission_Type `protobuf:"varint,1,opt,name=permType,proto3,enum=authpb.Permission_Type" json:"permType,omitempty"`
  124. Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
  125. RangeEnd []byte `protobuf:"bytes,3,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"`
  126. XXX_NoUnkeyedLiteral struct{} `json:"-"`
  127. XXX_unrecognized []byte `json:"-"`
  128. XXX_sizecache int32 `json:"-"`
  129. }
  130. func (m *Permission) Reset() { *m = Permission{} }
  131. func (m *Permission) String() string { return proto.CompactTextString(m) }
  132. func (*Permission) ProtoMessage() {}
  133. func (*Permission) Descriptor() ([]byte, []int) {
  134. return fileDescriptor_8bbd6f3875b0e874, []int{2}
  135. }
  136. func (m *Permission) XXX_Unmarshal(b []byte) error {
  137. return m.Unmarshal(b)
  138. }
  139. func (m *Permission) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
  140. if deterministic {
  141. return xxx_messageInfo_Permission.Marshal(b, m, deterministic)
  142. } else {
  143. b = b[:cap(b)]
  144. n, err := m.MarshalToSizedBuffer(b)
  145. if err != nil {
  146. return nil, err
  147. }
  148. return b[:n], nil
  149. }
  150. }
  151. func (m *Permission) XXX_Merge(src proto.Message) {
  152. xxx_messageInfo_Permission.Merge(m, src)
  153. }
  154. func (m *Permission) XXX_Size() int {
  155. return m.Size()
  156. }
  157. func (m *Permission) XXX_DiscardUnknown() {
  158. xxx_messageInfo_Permission.DiscardUnknown(m)
  159. }
  160. var xxx_messageInfo_Permission proto.InternalMessageInfo
  161. // Role is a single entry in the bucket authRoles
  162. type Role struct {
  163. Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
  164. KeyPermission []*Permission `protobuf:"bytes,2,rep,name=keyPermission,proto3" json:"keyPermission,omitempty"`
  165. XXX_NoUnkeyedLiteral struct{} `json:"-"`
  166. XXX_unrecognized []byte `json:"-"`
  167. XXX_sizecache int32 `json:"-"`
  168. }
  169. func (m *Role) Reset() { *m = Role{} }
  170. func (m *Role) String() string { return proto.CompactTextString(m) }
  171. func (*Role) ProtoMessage() {}
  172. func (*Role) Descriptor() ([]byte, []int) {
  173. return fileDescriptor_8bbd6f3875b0e874, []int{3}
  174. }
  175. func (m *Role) XXX_Unmarshal(b []byte) error {
  176. return m.Unmarshal(b)
  177. }
  178. func (m *Role) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
  179. if deterministic {
  180. return xxx_messageInfo_Role.Marshal(b, m, deterministic)
  181. } else {
  182. b = b[:cap(b)]
  183. n, err := m.MarshalToSizedBuffer(b)
  184. if err != nil {
  185. return nil, err
  186. }
  187. return b[:n], nil
  188. }
  189. }
  190. func (m *Role) XXX_Merge(src proto.Message) {
  191. xxx_messageInfo_Role.Merge(m, src)
  192. }
  193. func (m *Role) XXX_Size() int {
  194. return m.Size()
  195. }
  196. func (m *Role) XXX_DiscardUnknown() {
  197. xxx_messageInfo_Role.DiscardUnknown(m)
  198. }
  199. var xxx_messageInfo_Role proto.InternalMessageInfo
  200. func init() {
  201. proto.RegisterEnum("authpb.Permission_Type", Permission_Type_name, Permission_Type_value)
  202. proto.RegisterType((*UserAddOptions)(nil), "authpb.UserAddOptions")
  203. proto.RegisterType((*User)(nil), "authpb.User")
  204. proto.RegisterType((*Permission)(nil), "authpb.Permission")
  205. proto.RegisterType((*Role)(nil), "authpb.Role")
  206. }
  207. func init() { proto.RegisterFile("auth.proto", fileDescriptor_8bbd6f3875b0e874) }
  208. var fileDescriptor_8bbd6f3875b0e874 = []byte{
  209. // 338 bytes of a gzipped FileDescriptorProto
  210. 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xcf, 0x4e, 0xea, 0x40,
  211. 0x14, 0xc6, 0x3b, 0xb4, 0x70, 0xdb, 0xc3, 0x85, 0x90, 0x13, 0x72, 0x6f, 0x83, 0x49, 0x6d, 0xba,
  212. 0x6a, 0x5c, 0x54, 0x85, 0x8d, 0x5b, 0x8c, 0x2c, 0x5c, 0x49, 0x26, 0x18, 0x97, 0xa4, 0xa4, 0x13,
  213. 0x24, 0xc0, 0x4c, 0x33, 0x83, 0x31, 0x6c, 0x7c, 0x0e, 0x17, 0x3e, 0x10, 0x4b, 0x1e, 0x41, 0xf0,
  214. 0x45, 0x4c, 0x67, 0xf8, 0x13, 0xa2, 0xbb, 0xef, 0x7c, 0xe7, 0xfb, 0x66, 0x7e, 0x99, 0x01, 0x48,
  215. 0x5f, 0x16, 0xcf, 0x49, 0x2e, 0xc5, 0x42, 0x60, 0xa5, 0xd0, 0xf9, 0xa8, 0xd5, 0x1c, 0x8b, 0xb1,
  216. 0xd0, 0xd6, 0x65, 0xa1, 0xcc, 0x36, 0xba, 0x86, 0xfa, 0xa3, 0x62, 0xb2, 0x9b, 0x65, 0x0f, 0xf9,
  217. 0x62, 0x22, 0xb8, 0xc2, 0x73, 0xa8, 0x72, 0x31, 0xcc, 0x53, 0xa5, 0x5e, 0x85, 0xcc, 0x7c, 0x12,
  218. 0x92, 0xd8, 0xa5, 0xc0, 0x45, 0x7f, 0xe7, 0x44, 0x6f, 0xe0, 0x14, 0x15, 0x44, 0x70, 0x78, 0x3a,
  219. 0x67, 0x3a, 0xf1, 0x97, 0x6a, 0x8d, 0x2d, 0x70, 0x0f, 0xcd, 0x92, 0xf6, 0x0f, 0x33, 0x36, 0xa1,
  220. 0x2c, 0xc5, 0x8c, 0x29, 0xdf, 0x0e, 0xed, 0xd8, 0xa3, 0x66, 0xc0, 0x2b, 0xf8, 0x23, 0xcc, 0xcd,
  221. 0xbe, 0x13, 0x92, 0xb8, 0xda, 0xfe, 0x97, 0x18, 0xe0, 0xe4, 0x94, 0x8b, 0xee, 0x63, 0xd1, 0x07,
  222. 0x01, 0xe8, 0x33, 0x39, 0x9f, 0x28, 0x35, 0x11, 0x1c, 0x3b, 0xe0, 0xe6, 0x4c, 0xce, 0x07, 0xcb,
  223. 0xdc, 0xa0, 0xd4, 0xdb, 0xff, 0xf7, 0x27, 0x1c, 0x53, 0x49, 0xb1, 0xa6, 0x87, 0x20, 0x36, 0xc0,
  224. 0x9e, 0xb2, 0xe5, 0x0e, 0xb1, 0x90, 0x78, 0x06, 0x9e, 0x4c, 0xf9, 0x98, 0x0d, 0x19, 0xcf, 0x7c,
  225. 0xdb, 0xa0, 0x6b, 0xa3, 0xc7, 0xb3, 0xe8, 0x02, 0x1c, 0x5d, 0x73, 0xc1, 0xa1, 0xbd, 0xee, 0x5d,
  226. 0xc3, 0x42, 0x0f, 0xca, 0x4f, 0xf4, 0x7e, 0xd0, 0x6b, 0x10, 0xac, 0x81, 0x57, 0x98, 0x66, 0x2c,
  227. 0x45, 0x03, 0x70, 0xa8, 0x98, 0xb1, 0x5f, 0x9f, 0xe7, 0x06, 0x6a, 0x53, 0xb6, 0x3c, 0x62, 0xf9,
  228. 0xa5, 0xd0, 0x8e, 0xab, 0x6d, 0xfc, 0x09, 0x4c, 0x4f, 0x83, 0xb7, 0xfe, 0x6a, 0x13, 0x58, 0xeb,
  229. 0x4d, 0x60, 0xad, 0xb6, 0x01, 0x59, 0x6f, 0x03, 0xf2, 0xb9, 0x0d, 0xc8, 0xfb, 0x57, 0x60, 0x8d,
  230. 0x2a, 0xfa, 0x23, 0x3b, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x61, 0x66, 0xc6, 0x9d, 0xf4, 0x01,
  231. 0x00, 0x00,
  232. }
  233. func (m *UserAddOptions) Marshal() (dAtA []byte, err error) {
  234. size := m.Size()
  235. dAtA = make([]byte, size)
  236. n, err := m.MarshalToSizedBuffer(dAtA[:size])
  237. if err != nil {
  238. return nil, err
  239. }
  240. return dAtA[:n], nil
  241. }
  242. func (m *UserAddOptions) MarshalTo(dAtA []byte) (int, error) {
  243. size := m.Size()
  244. return m.MarshalToSizedBuffer(dAtA[:size])
  245. }
  246. func (m *UserAddOptions) MarshalToSizedBuffer(dAtA []byte) (int, error) {
  247. i := len(dAtA)
  248. _ = i
  249. var l int
  250. _ = l
  251. if m.XXX_unrecognized != nil {
  252. i -= len(m.XXX_unrecognized)
  253. copy(dAtA[i:], m.XXX_unrecognized)
  254. }
  255. if m.NoPassword {
  256. i--
  257. if m.NoPassword {
  258. dAtA[i] = 1
  259. } else {
  260. dAtA[i] = 0
  261. }
  262. i--
  263. dAtA[i] = 0x8
  264. }
  265. return len(dAtA) - i, nil
  266. }
  267. func (m *User) Marshal() (dAtA []byte, err error) {
  268. size := m.Size()
  269. dAtA = make([]byte, size)
  270. n, err := m.MarshalToSizedBuffer(dAtA[:size])
  271. if err != nil {
  272. return nil, err
  273. }
  274. return dAtA[:n], nil
  275. }
  276. func (m *User) MarshalTo(dAtA []byte) (int, error) {
  277. size := m.Size()
  278. return m.MarshalToSizedBuffer(dAtA[:size])
  279. }
  280. func (m *User) MarshalToSizedBuffer(dAtA []byte) (int, error) {
  281. i := len(dAtA)
  282. _ = i
  283. var l int
  284. _ = l
  285. if m.XXX_unrecognized != nil {
  286. i -= len(m.XXX_unrecognized)
  287. copy(dAtA[i:], m.XXX_unrecognized)
  288. }
  289. if m.Options != nil {
  290. {
  291. size, err := m.Options.MarshalToSizedBuffer(dAtA[:i])
  292. if err != nil {
  293. return 0, err
  294. }
  295. i -= size
  296. i = encodeVarintAuth(dAtA, i, uint64(size))
  297. }
  298. i--
  299. dAtA[i] = 0x22
  300. }
  301. if len(m.Roles) > 0 {
  302. for iNdEx := len(m.Roles) - 1; iNdEx >= 0; iNdEx-- {
  303. i -= len(m.Roles[iNdEx])
  304. copy(dAtA[i:], m.Roles[iNdEx])
  305. i = encodeVarintAuth(dAtA, i, uint64(len(m.Roles[iNdEx])))
  306. i--
  307. dAtA[i] = 0x1a
  308. }
  309. }
  310. if len(m.Password) > 0 {
  311. i -= len(m.Password)
  312. copy(dAtA[i:], m.Password)
  313. i = encodeVarintAuth(dAtA, i, uint64(len(m.Password)))
  314. i--
  315. dAtA[i] = 0x12
  316. }
  317. if len(m.Name) > 0 {
  318. i -= len(m.Name)
  319. copy(dAtA[i:], m.Name)
  320. i = encodeVarintAuth(dAtA, i, uint64(len(m.Name)))
  321. i--
  322. dAtA[i] = 0xa
  323. }
  324. return len(dAtA) - i, nil
  325. }
  326. func (m *Permission) Marshal() (dAtA []byte, err error) {
  327. size := m.Size()
  328. dAtA = make([]byte, size)
  329. n, err := m.MarshalToSizedBuffer(dAtA[:size])
  330. if err != nil {
  331. return nil, err
  332. }
  333. return dAtA[:n], nil
  334. }
  335. func (m *Permission) MarshalTo(dAtA []byte) (int, error) {
  336. size := m.Size()
  337. return m.MarshalToSizedBuffer(dAtA[:size])
  338. }
  339. func (m *Permission) MarshalToSizedBuffer(dAtA []byte) (int, error) {
  340. i := len(dAtA)
  341. _ = i
  342. var l int
  343. _ = l
  344. if m.XXX_unrecognized != nil {
  345. i -= len(m.XXX_unrecognized)
  346. copy(dAtA[i:], m.XXX_unrecognized)
  347. }
  348. if len(m.RangeEnd) > 0 {
  349. i -= len(m.RangeEnd)
  350. copy(dAtA[i:], m.RangeEnd)
  351. i = encodeVarintAuth(dAtA, i, uint64(len(m.RangeEnd)))
  352. i--
  353. dAtA[i] = 0x1a
  354. }
  355. if len(m.Key) > 0 {
  356. i -= len(m.Key)
  357. copy(dAtA[i:], m.Key)
  358. i = encodeVarintAuth(dAtA, i, uint64(len(m.Key)))
  359. i--
  360. dAtA[i] = 0x12
  361. }
  362. if m.PermType != 0 {
  363. i = encodeVarintAuth(dAtA, i, uint64(m.PermType))
  364. i--
  365. dAtA[i] = 0x8
  366. }
  367. return len(dAtA) - i, nil
  368. }
  369. func (m *Role) Marshal() (dAtA []byte, err error) {
  370. size := m.Size()
  371. dAtA = make([]byte, size)
  372. n, err := m.MarshalToSizedBuffer(dAtA[:size])
  373. if err != nil {
  374. return nil, err
  375. }
  376. return dAtA[:n], nil
  377. }
  378. func (m *Role) MarshalTo(dAtA []byte) (int, error) {
  379. size := m.Size()
  380. return m.MarshalToSizedBuffer(dAtA[:size])
  381. }
  382. func (m *Role) MarshalToSizedBuffer(dAtA []byte) (int, error) {
  383. i := len(dAtA)
  384. _ = i
  385. var l int
  386. _ = l
  387. if m.XXX_unrecognized != nil {
  388. i -= len(m.XXX_unrecognized)
  389. copy(dAtA[i:], m.XXX_unrecognized)
  390. }
  391. if len(m.KeyPermission) > 0 {
  392. for iNdEx := len(m.KeyPermission) - 1; iNdEx >= 0; iNdEx-- {
  393. {
  394. size, err := m.KeyPermission[iNdEx].MarshalToSizedBuffer(dAtA[:i])
  395. if err != nil {
  396. return 0, err
  397. }
  398. i -= size
  399. i = encodeVarintAuth(dAtA, i, uint64(size))
  400. }
  401. i--
  402. dAtA[i] = 0x12
  403. }
  404. }
  405. if len(m.Name) > 0 {
  406. i -= len(m.Name)
  407. copy(dAtA[i:], m.Name)
  408. i = encodeVarintAuth(dAtA, i, uint64(len(m.Name)))
  409. i--
  410. dAtA[i] = 0xa
  411. }
  412. return len(dAtA) - i, nil
  413. }
  414. func encodeVarintAuth(dAtA []byte, offset int, v uint64) int {
  415. offset -= sovAuth(v)
  416. base := offset
  417. for v >= 1<<7 {
  418. dAtA[offset] = uint8(v&0x7f | 0x80)
  419. v >>= 7
  420. offset++
  421. }
  422. dAtA[offset] = uint8(v)
  423. return base
  424. }
  425. func (m *UserAddOptions) Size() (n int) {
  426. if m == nil {
  427. return 0
  428. }
  429. var l int
  430. _ = l
  431. if m.NoPassword {
  432. n += 2
  433. }
  434. if m.XXX_unrecognized != nil {
  435. n += len(m.XXX_unrecognized)
  436. }
  437. return n
  438. }
  439. func (m *User) Size() (n int) {
  440. if m == nil {
  441. return 0
  442. }
  443. var l int
  444. _ = l
  445. l = len(m.Name)
  446. if l > 0 {
  447. n += 1 + l + sovAuth(uint64(l))
  448. }
  449. l = len(m.Password)
  450. if l > 0 {
  451. n += 1 + l + sovAuth(uint64(l))
  452. }
  453. if len(m.Roles) > 0 {
  454. for _, s := range m.Roles {
  455. l = len(s)
  456. n += 1 + l + sovAuth(uint64(l))
  457. }
  458. }
  459. if m.Options != nil {
  460. l = m.Options.Size()
  461. n += 1 + l + sovAuth(uint64(l))
  462. }
  463. if m.XXX_unrecognized != nil {
  464. n += len(m.XXX_unrecognized)
  465. }
  466. return n
  467. }
  468. func (m *Permission) Size() (n int) {
  469. if m == nil {
  470. return 0
  471. }
  472. var l int
  473. _ = l
  474. if m.PermType != 0 {
  475. n += 1 + sovAuth(uint64(m.PermType))
  476. }
  477. l = len(m.Key)
  478. if l > 0 {
  479. n += 1 + l + sovAuth(uint64(l))
  480. }
  481. l = len(m.RangeEnd)
  482. if l > 0 {
  483. n += 1 + l + sovAuth(uint64(l))
  484. }
  485. if m.XXX_unrecognized != nil {
  486. n += len(m.XXX_unrecognized)
  487. }
  488. return n
  489. }
  490. func (m *Role) Size() (n int) {
  491. if m == nil {
  492. return 0
  493. }
  494. var l int
  495. _ = l
  496. l = len(m.Name)
  497. if l > 0 {
  498. n += 1 + l + sovAuth(uint64(l))
  499. }
  500. if len(m.KeyPermission) > 0 {
  501. for _, e := range m.KeyPermission {
  502. l = e.Size()
  503. n += 1 + l + sovAuth(uint64(l))
  504. }
  505. }
  506. if m.XXX_unrecognized != nil {
  507. n += len(m.XXX_unrecognized)
  508. }
  509. return n
  510. }
  511. func sovAuth(x uint64) (n int) {
  512. return (math_bits.Len64(x|1) + 6) / 7
  513. }
  514. func sozAuth(x uint64) (n int) {
  515. return sovAuth(uint64((x << 1) ^ uint64((int64(x) >> 63))))
  516. }
  517. func (m *UserAddOptions) Unmarshal(dAtA []byte) error {
  518. l := len(dAtA)
  519. iNdEx := 0
  520. for iNdEx < l {
  521. preIndex := iNdEx
  522. var wire uint64
  523. for shift := uint(0); ; shift += 7 {
  524. if shift >= 64 {
  525. return ErrIntOverflowAuth
  526. }
  527. if iNdEx >= l {
  528. return io.ErrUnexpectedEOF
  529. }
  530. b := dAtA[iNdEx]
  531. iNdEx++
  532. wire |= uint64(b&0x7F) << shift
  533. if b < 0x80 {
  534. break
  535. }
  536. }
  537. fieldNum := int32(wire >> 3)
  538. wireType := int(wire & 0x7)
  539. if wireType == 4 {
  540. return fmt.Errorf("proto: UserAddOptions: wiretype end group for non-group")
  541. }
  542. if fieldNum <= 0 {
  543. return fmt.Errorf("proto: UserAddOptions: illegal tag %d (wire type %d)", fieldNum, wire)
  544. }
  545. switch fieldNum {
  546. case 1:
  547. if wireType != 0 {
  548. return fmt.Errorf("proto: wrong wireType = %d for field NoPassword", wireType)
  549. }
  550. var v int
  551. for shift := uint(0); ; shift += 7 {
  552. if shift >= 64 {
  553. return ErrIntOverflowAuth
  554. }
  555. if iNdEx >= l {
  556. return io.ErrUnexpectedEOF
  557. }
  558. b := dAtA[iNdEx]
  559. iNdEx++
  560. v |= int(b&0x7F) << shift
  561. if b < 0x80 {
  562. break
  563. }
  564. }
  565. m.NoPassword = bool(v != 0)
  566. default:
  567. iNdEx = preIndex
  568. skippy, err := skipAuth(dAtA[iNdEx:])
  569. if err != nil {
  570. return err
  571. }
  572. if (skippy < 0) || (iNdEx+skippy) < 0 {
  573. return ErrInvalidLengthAuth
  574. }
  575. if (iNdEx + skippy) > l {
  576. return io.ErrUnexpectedEOF
  577. }
  578. m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
  579. iNdEx += skippy
  580. }
  581. }
  582. if iNdEx > l {
  583. return io.ErrUnexpectedEOF
  584. }
  585. return nil
  586. }
  587. func (m *User) Unmarshal(dAtA []byte) error {
  588. l := len(dAtA)
  589. iNdEx := 0
  590. for iNdEx < l {
  591. preIndex := iNdEx
  592. var wire uint64
  593. for shift := uint(0); ; shift += 7 {
  594. if shift >= 64 {
  595. return ErrIntOverflowAuth
  596. }
  597. if iNdEx >= l {
  598. return io.ErrUnexpectedEOF
  599. }
  600. b := dAtA[iNdEx]
  601. iNdEx++
  602. wire |= uint64(b&0x7F) << shift
  603. if b < 0x80 {
  604. break
  605. }
  606. }
  607. fieldNum := int32(wire >> 3)
  608. wireType := int(wire & 0x7)
  609. if wireType == 4 {
  610. return fmt.Errorf("proto: User: wiretype end group for non-group")
  611. }
  612. if fieldNum <= 0 {
  613. return fmt.Errorf("proto: User: illegal tag %d (wire type %d)", fieldNum, wire)
  614. }
  615. switch fieldNum {
  616. case 1:
  617. if wireType != 2 {
  618. return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
  619. }
  620. var byteLen int
  621. for shift := uint(0); ; shift += 7 {
  622. if shift >= 64 {
  623. return ErrIntOverflowAuth
  624. }
  625. if iNdEx >= l {
  626. return io.ErrUnexpectedEOF
  627. }
  628. b := dAtA[iNdEx]
  629. iNdEx++
  630. byteLen |= int(b&0x7F) << shift
  631. if b < 0x80 {
  632. break
  633. }
  634. }
  635. if byteLen < 0 {
  636. return ErrInvalidLengthAuth
  637. }
  638. postIndex := iNdEx + byteLen
  639. if postIndex < 0 {
  640. return ErrInvalidLengthAuth
  641. }
  642. if postIndex > l {
  643. return io.ErrUnexpectedEOF
  644. }
  645. m.Name = append(m.Name[:0], dAtA[iNdEx:postIndex]...)
  646. if m.Name == nil {
  647. m.Name = []byte{}
  648. }
  649. iNdEx = postIndex
  650. case 2:
  651. if wireType != 2 {
  652. return fmt.Errorf("proto: wrong wireType = %d for field Password", wireType)
  653. }
  654. var byteLen int
  655. for shift := uint(0); ; shift += 7 {
  656. if shift >= 64 {
  657. return ErrIntOverflowAuth
  658. }
  659. if iNdEx >= l {
  660. return io.ErrUnexpectedEOF
  661. }
  662. b := dAtA[iNdEx]
  663. iNdEx++
  664. byteLen |= int(b&0x7F) << shift
  665. if b < 0x80 {
  666. break
  667. }
  668. }
  669. if byteLen < 0 {
  670. return ErrInvalidLengthAuth
  671. }
  672. postIndex := iNdEx + byteLen
  673. if postIndex < 0 {
  674. return ErrInvalidLengthAuth
  675. }
  676. if postIndex > l {
  677. return io.ErrUnexpectedEOF
  678. }
  679. m.Password = append(m.Password[:0], dAtA[iNdEx:postIndex]...)
  680. if m.Password == nil {
  681. m.Password = []byte{}
  682. }
  683. iNdEx = postIndex
  684. case 3:
  685. if wireType != 2 {
  686. return fmt.Errorf("proto: wrong wireType = %d for field Roles", wireType)
  687. }
  688. var stringLen uint64
  689. for shift := uint(0); ; shift += 7 {
  690. if shift >= 64 {
  691. return ErrIntOverflowAuth
  692. }
  693. if iNdEx >= l {
  694. return io.ErrUnexpectedEOF
  695. }
  696. b := dAtA[iNdEx]
  697. iNdEx++
  698. stringLen |= uint64(b&0x7F) << shift
  699. if b < 0x80 {
  700. break
  701. }
  702. }
  703. intStringLen := int(stringLen)
  704. if intStringLen < 0 {
  705. return ErrInvalidLengthAuth
  706. }
  707. postIndex := iNdEx + intStringLen
  708. if postIndex < 0 {
  709. return ErrInvalidLengthAuth
  710. }
  711. if postIndex > l {
  712. return io.ErrUnexpectedEOF
  713. }
  714. m.Roles = append(m.Roles, string(dAtA[iNdEx:postIndex]))
  715. iNdEx = postIndex
  716. case 4:
  717. if wireType != 2 {
  718. return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType)
  719. }
  720. var msglen int
  721. for shift := uint(0); ; shift += 7 {
  722. if shift >= 64 {
  723. return ErrIntOverflowAuth
  724. }
  725. if iNdEx >= l {
  726. return io.ErrUnexpectedEOF
  727. }
  728. b := dAtA[iNdEx]
  729. iNdEx++
  730. msglen |= int(b&0x7F) << shift
  731. if b < 0x80 {
  732. break
  733. }
  734. }
  735. if msglen < 0 {
  736. return ErrInvalidLengthAuth
  737. }
  738. postIndex := iNdEx + msglen
  739. if postIndex < 0 {
  740. return ErrInvalidLengthAuth
  741. }
  742. if postIndex > l {
  743. return io.ErrUnexpectedEOF
  744. }
  745. if m.Options == nil {
  746. m.Options = &UserAddOptions{}
  747. }
  748. if err := m.Options.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  749. return err
  750. }
  751. iNdEx = postIndex
  752. default:
  753. iNdEx = preIndex
  754. skippy, err := skipAuth(dAtA[iNdEx:])
  755. if err != nil {
  756. return err
  757. }
  758. if (skippy < 0) || (iNdEx+skippy) < 0 {
  759. return ErrInvalidLengthAuth
  760. }
  761. if (iNdEx + skippy) > l {
  762. return io.ErrUnexpectedEOF
  763. }
  764. m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
  765. iNdEx += skippy
  766. }
  767. }
  768. if iNdEx > l {
  769. return io.ErrUnexpectedEOF
  770. }
  771. return nil
  772. }
  773. func (m *Permission) Unmarshal(dAtA []byte) error {
  774. l := len(dAtA)
  775. iNdEx := 0
  776. for iNdEx < l {
  777. preIndex := iNdEx
  778. var wire uint64
  779. for shift := uint(0); ; shift += 7 {
  780. if shift >= 64 {
  781. return ErrIntOverflowAuth
  782. }
  783. if iNdEx >= l {
  784. return io.ErrUnexpectedEOF
  785. }
  786. b := dAtA[iNdEx]
  787. iNdEx++
  788. wire |= uint64(b&0x7F) << shift
  789. if b < 0x80 {
  790. break
  791. }
  792. }
  793. fieldNum := int32(wire >> 3)
  794. wireType := int(wire & 0x7)
  795. if wireType == 4 {
  796. return fmt.Errorf("proto: Permission: wiretype end group for non-group")
  797. }
  798. if fieldNum <= 0 {
  799. return fmt.Errorf("proto: Permission: illegal tag %d (wire type %d)", fieldNum, wire)
  800. }
  801. switch fieldNum {
  802. case 1:
  803. if wireType != 0 {
  804. return fmt.Errorf("proto: wrong wireType = %d for field PermType", wireType)
  805. }
  806. m.PermType = 0
  807. for shift := uint(0); ; shift += 7 {
  808. if shift >= 64 {
  809. return ErrIntOverflowAuth
  810. }
  811. if iNdEx >= l {
  812. return io.ErrUnexpectedEOF
  813. }
  814. b := dAtA[iNdEx]
  815. iNdEx++
  816. m.PermType |= Permission_Type(b&0x7F) << shift
  817. if b < 0x80 {
  818. break
  819. }
  820. }
  821. case 2:
  822. if wireType != 2 {
  823. return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
  824. }
  825. var byteLen int
  826. for shift := uint(0); ; shift += 7 {
  827. if shift >= 64 {
  828. return ErrIntOverflowAuth
  829. }
  830. if iNdEx >= l {
  831. return io.ErrUnexpectedEOF
  832. }
  833. b := dAtA[iNdEx]
  834. iNdEx++
  835. byteLen |= int(b&0x7F) << shift
  836. if b < 0x80 {
  837. break
  838. }
  839. }
  840. if byteLen < 0 {
  841. return ErrInvalidLengthAuth
  842. }
  843. postIndex := iNdEx + byteLen
  844. if postIndex < 0 {
  845. return ErrInvalidLengthAuth
  846. }
  847. if postIndex > l {
  848. return io.ErrUnexpectedEOF
  849. }
  850. m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...)
  851. if m.Key == nil {
  852. m.Key = []byte{}
  853. }
  854. iNdEx = postIndex
  855. case 3:
  856. if wireType != 2 {
  857. return fmt.Errorf("proto: wrong wireType = %d for field RangeEnd", wireType)
  858. }
  859. var byteLen int
  860. for shift := uint(0); ; shift += 7 {
  861. if shift >= 64 {
  862. return ErrIntOverflowAuth
  863. }
  864. if iNdEx >= l {
  865. return io.ErrUnexpectedEOF
  866. }
  867. b := dAtA[iNdEx]
  868. iNdEx++
  869. byteLen |= int(b&0x7F) << shift
  870. if b < 0x80 {
  871. break
  872. }
  873. }
  874. if byteLen < 0 {
  875. return ErrInvalidLengthAuth
  876. }
  877. postIndex := iNdEx + byteLen
  878. if postIndex < 0 {
  879. return ErrInvalidLengthAuth
  880. }
  881. if postIndex > l {
  882. return io.ErrUnexpectedEOF
  883. }
  884. m.RangeEnd = append(m.RangeEnd[:0], dAtA[iNdEx:postIndex]...)
  885. if m.RangeEnd == nil {
  886. m.RangeEnd = []byte{}
  887. }
  888. iNdEx = postIndex
  889. default:
  890. iNdEx = preIndex
  891. skippy, err := skipAuth(dAtA[iNdEx:])
  892. if err != nil {
  893. return err
  894. }
  895. if (skippy < 0) || (iNdEx+skippy) < 0 {
  896. return ErrInvalidLengthAuth
  897. }
  898. if (iNdEx + skippy) > l {
  899. return io.ErrUnexpectedEOF
  900. }
  901. m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
  902. iNdEx += skippy
  903. }
  904. }
  905. if iNdEx > l {
  906. return io.ErrUnexpectedEOF
  907. }
  908. return nil
  909. }
  910. func (m *Role) Unmarshal(dAtA []byte) error {
  911. l := len(dAtA)
  912. iNdEx := 0
  913. for iNdEx < l {
  914. preIndex := iNdEx
  915. var wire uint64
  916. for shift := uint(0); ; shift += 7 {
  917. if shift >= 64 {
  918. return ErrIntOverflowAuth
  919. }
  920. if iNdEx >= l {
  921. return io.ErrUnexpectedEOF
  922. }
  923. b := dAtA[iNdEx]
  924. iNdEx++
  925. wire |= uint64(b&0x7F) << shift
  926. if b < 0x80 {
  927. break
  928. }
  929. }
  930. fieldNum := int32(wire >> 3)
  931. wireType := int(wire & 0x7)
  932. if wireType == 4 {
  933. return fmt.Errorf("proto: Role: wiretype end group for non-group")
  934. }
  935. if fieldNum <= 0 {
  936. return fmt.Errorf("proto: Role: illegal tag %d (wire type %d)", fieldNum, wire)
  937. }
  938. switch fieldNum {
  939. case 1:
  940. if wireType != 2 {
  941. return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
  942. }
  943. var byteLen int
  944. for shift := uint(0); ; shift += 7 {
  945. if shift >= 64 {
  946. return ErrIntOverflowAuth
  947. }
  948. if iNdEx >= l {
  949. return io.ErrUnexpectedEOF
  950. }
  951. b := dAtA[iNdEx]
  952. iNdEx++
  953. byteLen |= int(b&0x7F) << shift
  954. if b < 0x80 {
  955. break
  956. }
  957. }
  958. if byteLen < 0 {
  959. return ErrInvalidLengthAuth
  960. }
  961. postIndex := iNdEx + byteLen
  962. if postIndex < 0 {
  963. return ErrInvalidLengthAuth
  964. }
  965. if postIndex > l {
  966. return io.ErrUnexpectedEOF
  967. }
  968. m.Name = append(m.Name[:0], dAtA[iNdEx:postIndex]...)
  969. if m.Name == nil {
  970. m.Name = []byte{}
  971. }
  972. iNdEx = postIndex
  973. case 2:
  974. if wireType != 2 {
  975. return fmt.Errorf("proto: wrong wireType = %d for field KeyPermission", wireType)
  976. }
  977. var msglen int
  978. for shift := uint(0); ; shift += 7 {
  979. if shift >= 64 {
  980. return ErrIntOverflowAuth
  981. }
  982. if iNdEx >= l {
  983. return io.ErrUnexpectedEOF
  984. }
  985. b := dAtA[iNdEx]
  986. iNdEx++
  987. msglen |= int(b&0x7F) << shift
  988. if b < 0x80 {
  989. break
  990. }
  991. }
  992. if msglen < 0 {
  993. return ErrInvalidLengthAuth
  994. }
  995. postIndex := iNdEx + msglen
  996. if postIndex < 0 {
  997. return ErrInvalidLengthAuth
  998. }
  999. if postIndex > l {
  1000. return io.ErrUnexpectedEOF
  1001. }
  1002. m.KeyPermission = append(m.KeyPermission, &Permission{})
  1003. if err := m.KeyPermission[len(m.KeyPermission)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  1004. return err
  1005. }
  1006. iNdEx = postIndex
  1007. default:
  1008. iNdEx = preIndex
  1009. skippy, err := skipAuth(dAtA[iNdEx:])
  1010. if err != nil {
  1011. return err
  1012. }
  1013. if (skippy < 0) || (iNdEx+skippy) < 0 {
  1014. return ErrInvalidLengthAuth
  1015. }
  1016. if (iNdEx + skippy) > l {
  1017. return io.ErrUnexpectedEOF
  1018. }
  1019. m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
  1020. iNdEx += skippy
  1021. }
  1022. }
  1023. if iNdEx > l {
  1024. return io.ErrUnexpectedEOF
  1025. }
  1026. return nil
  1027. }
  1028. func skipAuth(dAtA []byte) (n int, err error) {
  1029. l := len(dAtA)
  1030. iNdEx := 0
  1031. depth := 0
  1032. for iNdEx < l {
  1033. var wire uint64
  1034. for shift := uint(0); ; shift += 7 {
  1035. if shift >= 64 {
  1036. return 0, ErrIntOverflowAuth
  1037. }
  1038. if iNdEx >= l {
  1039. return 0, io.ErrUnexpectedEOF
  1040. }
  1041. b := dAtA[iNdEx]
  1042. iNdEx++
  1043. wire |= (uint64(b) & 0x7F) << shift
  1044. if b < 0x80 {
  1045. break
  1046. }
  1047. }
  1048. wireType := int(wire & 0x7)
  1049. switch wireType {
  1050. case 0:
  1051. for shift := uint(0); ; shift += 7 {
  1052. if shift >= 64 {
  1053. return 0, ErrIntOverflowAuth
  1054. }
  1055. if iNdEx >= l {
  1056. return 0, io.ErrUnexpectedEOF
  1057. }
  1058. iNdEx++
  1059. if dAtA[iNdEx-1] < 0x80 {
  1060. break
  1061. }
  1062. }
  1063. case 1:
  1064. iNdEx += 8
  1065. case 2:
  1066. var length int
  1067. for shift := uint(0); ; shift += 7 {
  1068. if shift >= 64 {
  1069. return 0, ErrIntOverflowAuth
  1070. }
  1071. if iNdEx >= l {
  1072. return 0, io.ErrUnexpectedEOF
  1073. }
  1074. b := dAtA[iNdEx]
  1075. iNdEx++
  1076. length |= (int(b) & 0x7F) << shift
  1077. if b < 0x80 {
  1078. break
  1079. }
  1080. }
  1081. if length < 0 {
  1082. return 0, ErrInvalidLengthAuth
  1083. }
  1084. iNdEx += length
  1085. case 3:
  1086. depth++
  1087. case 4:
  1088. if depth == 0 {
  1089. return 0, ErrUnexpectedEndOfGroupAuth
  1090. }
  1091. depth--
  1092. case 5:
  1093. iNdEx += 4
  1094. default:
  1095. return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
  1096. }
  1097. if iNdEx < 0 {
  1098. return 0, ErrInvalidLengthAuth
  1099. }
  1100. if depth == 0 {
  1101. return iNdEx, nil
  1102. }
  1103. }
  1104. return 0, io.ErrUnexpectedEOF
  1105. }
  1106. var (
  1107. ErrInvalidLengthAuth = fmt.Errorf("proto: negative length found during unmarshaling")
  1108. ErrIntOverflowAuth = fmt.Errorf("proto: integer overflow")
  1109. ErrUnexpectedEndOfGroupAuth = fmt.Errorf("proto: unexpected end of group")
  1110. )