Jan Dittberner
60be959c24
This commit adds health check capabilities to the hsm.Access and health response data to the messages returned by the health command.
876 lines
27 KiB
Go
876 lines
27 KiB
Go
// Code generated by msgpackgen. DO NOT EDIT.
|
|
|
|
package messages
|
|
|
|
import (
|
|
"fmt"
|
|
msgpack "github.com/shamaton/msgpackgen/msgpack"
|
|
dec "github.com/shamaton/msgpackgen/msgpack/dec"
|
|
enc "github.com/shamaton/msgpackgen/msgpack/enc"
|
|
)
|
|
|
|
// RegisterGeneratedResolver registers generated resolver.
|
|
func RegisterGeneratedResolver() {
|
|
msgpack.SetResolver(___encodeAsMap, ___encodeAsArray, ___decodeAsMap, ___decodeAsArray)
|
|
}
|
|
|
|
// encode
|
|
func ___encode(i interface{}) ([]byte, error) {
|
|
if msgpack.StructAsArray() {
|
|
return ___encodeAsArray(i)
|
|
} else {
|
|
return ___encodeAsMap(i)
|
|
}
|
|
}
|
|
|
|
// encodeAsArray
|
|
func ___encodeAsArray(i interface{}) ([]byte, error) {
|
|
switch v := i.(type) {
|
|
case HealthInfo:
|
|
encoder := enc.NewEncoder()
|
|
size, err := ___calcArraySizeHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v, encoder)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
encoder.MakeBytes(size)
|
|
b, offset, err := ___encodeArrayHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v, encoder, 0)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if size != offset {
|
|
return nil, fmt.Errorf("%s size / offset different %d : %d", "HealthInfo", size, offset)
|
|
}
|
|
return b, err
|
|
case *HealthInfo:
|
|
encoder := enc.NewEncoder()
|
|
size, err := ___calcArraySizeHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(*v, encoder)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
encoder.MakeBytes(size)
|
|
b, offset, err := ___encodeArrayHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(*v, encoder, 0)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if size != offset {
|
|
return nil, fmt.Errorf("%s size / offset different %d : %d", "HealthInfo", size, offset)
|
|
}
|
|
return b, err
|
|
case HealthResponse:
|
|
encoder := enc.NewEncoder()
|
|
size, err := ___calcArraySizeHealthResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v, encoder)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
encoder.MakeBytes(size)
|
|
b, offset, err := ___encodeArrayHealthResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v, encoder, 0)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if size != offset {
|
|
return nil, fmt.Errorf("%s size / offset different %d : %d", "HealthResponse", size, offset)
|
|
}
|
|
return b, err
|
|
case *HealthResponse:
|
|
encoder := enc.NewEncoder()
|
|
size, err := ___calcArraySizeHealthResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(*v, encoder)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
encoder.MakeBytes(size)
|
|
b, offset, err := ___encodeArrayHealthResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(*v, encoder, 0)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if size != offset {
|
|
return nil, fmt.Errorf("%s size / offset different %d : %d", "HealthResponse", size, offset)
|
|
}
|
|
return b, err
|
|
case ErrorResponse:
|
|
encoder := enc.NewEncoder()
|
|
size, err := ___calcArraySizeErrorResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v, encoder)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
encoder.MakeBytes(size)
|
|
b, offset, err := ___encodeArrayErrorResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v, encoder, 0)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if size != offset {
|
|
return nil, fmt.Errorf("%s size / offset different %d : %d", "ErrorResponse", size, offset)
|
|
}
|
|
return b, err
|
|
case *ErrorResponse:
|
|
encoder := enc.NewEncoder()
|
|
size, err := ___calcArraySizeErrorResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(*v, encoder)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
encoder.MakeBytes(size)
|
|
b, offset, err := ___encodeArrayErrorResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(*v, encoder, 0)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if size != offset {
|
|
return nil, fmt.Errorf("%s size / offset different %d : %d", "ErrorResponse", size, offset)
|
|
}
|
|
return b, err
|
|
}
|
|
return nil, nil
|
|
}
|
|
|
|
// encodeAsMap
|
|
func ___encodeAsMap(i interface{}) ([]byte, error) {
|
|
switch v := i.(type) {
|
|
case HealthInfo:
|
|
encoder := enc.NewEncoder()
|
|
size, err := ___calcMapSizeHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v, encoder)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
encoder.MakeBytes(size)
|
|
b, offset, err := ___encodeMapHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v, encoder, 0)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if size != offset {
|
|
return nil, fmt.Errorf("%s size / offset different %d : %d", "HealthInfo", size, offset)
|
|
}
|
|
return b, err
|
|
case *HealthInfo:
|
|
encoder := enc.NewEncoder()
|
|
size, err := ___calcMapSizeHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(*v, encoder)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
encoder.MakeBytes(size)
|
|
b, offset, err := ___encodeMapHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(*v, encoder, 0)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if size != offset {
|
|
return nil, fmt.Errorf("%s size / offset different %d : %d", "HealthInfo", size, offset)
|
|
}
|
|
return b, err
|
|
case HealthResponse:
|
|
encoder := enc.NewEncoder()
|
|
size, err := ___calcMapSizeHealthResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v, encoder)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
encoder.MakeBytes(size)
|
|
b, offset, err := ___encodeMapHealthResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v, encoder, 0)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if size != offset {
|
|
return nil, fmt.Errorf("%s size / offset different %d : %d", "HealthResponse", size, offset)
|
|
}
|
|
return b, err
|
|
case *HealthResponse:
|
|
encoder := enc.NewEncoder()
|
|
size, err := ___calcMapSizeHealthResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(*v, encoder)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
encoder.MakeBytes(size)
|
|
b, offset, err := ___encodeMapHealthResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(*v, encoder, 0)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if size != offset {
|
|
return nil, fmt.Errorf("%s size / offset different %d : %d", "HealthResponse", size, offset)
|
|
}
|
|
return b, err
|
|
case ErrorResponse:
|
|
encoder := enc.NewEncoder()
|
|
size, err := ___calcMapSizeErrorResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v, encoder)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
encoder.MakeBytes(size)
|
|
b, offset, err := ___encodeMapErrorResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v, encoder, 0)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if size != offset {
|
|
return nil, fmt.Errorf("%s size / offset different %d : %d", "ErrorResponse", size, offset)
|
|
}
|
|
return b, err
|
|
case *ErrorResponse:
|
|
encoder := enc.NewEncoder()
|
|
size, err := ___calcMapSizeErrorResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(*v, encoder)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
encoder.MakeBytes(size)
|
|
b, offset, err := ___encodeMapErrorResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(*v, encoder, 0)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if size != offset {
|
|
return nil, fmt.Errorf("%s size / offset different %d : %d", "ErrorResponse", size, offset)
|
|
}
|
|
return b, err
|
|
}
|
|
return nil, nil
|
|
}
|
|
|
|
// decode
|
|
func ___decode(data []byte, i interface{}) (bool, error) {
|
|
if msgpack.StructAsArray() {
|
|
return ___decodeAsArray(data, i)
|
|
} else {
|
|
return ___decodeAsMap(data, i)
|
|
}
|
|
}
|
|
|
|
// decodeAsArray
|
|
func ___decodeAsArray(data []byte, i interface{}) (bool, error) {
|
|
switch v := i.(type) {
|
|
case *HealthInfo:
|
|
decoder := dec.NewDecoder(data)
|
|
offset, err := ___decodeArrayHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v, decoder, 0)
|
|
if err == nil && offset != decoder.Len() {
|
|
return true, fmt.Errorf("read length is different [%d] [%d] ", offset, decoder.Len())
|
|
}
|
|
return true, err
|
|
case **HealthInfo:
|
|
decoder := dec.NewDecoder(data)
|
|
offset, err := ___decodeArrayHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(*v, decoder, 0)
|
|
if err == nil && offset != decoder.Len() {
|
|
return true, fmt.Errorf("read length is different [%d] [%d] ", offset, decoder.Len())
|
|
}
|
|
return true, err
|
|
case *HealthResponse:
|
|
decoder := dec.NewDecoder(data)
|
|
offset, err := ___decodeArrayHealthResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v, decoder, 0)
|
|
if err == nil && offset != decoder.Len() {
|
|
return true, fmt.Errorf("read length is different [%d] [%d] ", offset, decoder.Len())
|
|
}
|
|
return true, err
|
|
case **HealthResponse:
|
|
decoder := dec.NewDecoder(data)
|
|
offset, err := ___decodeArrayHealthResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(*v, decoder, 0)
|
|
if err == nil && offset != decoder.Len() {
|
|
return true, fmt.Errorf("read length is different [%d] [%d] ", offset, decoder.Len())
|
|
}
|
|
return true, err
|
|
case *ErrorResponse:
|
|
decoder := dec.NewDecoder(data)
|
|
offset, err := ___decodeArrayErrorResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v, decoder, 0)
|
|
if err == nil && offset != decoder.Len() {
|
|
return true, fmt.Errorf("read length is different [%d] [%d] ", offset, decoder.Len())
|
|
}
|
|
return true, err
|
|
case **ErrorResponse:
|
|
decoder := dec.NewDecoder(data)
|
|
offset, err := ___decodeArrayErrorResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(*v, decoder, 0)
|
|
if err == nil && offset != decoder.Len() {
|
|
return true, fmt.Errorf("read length is different [%d] [%d] ", offset, decoder.Len())
|
|
}
|
|
return true, err
|
|
}
|
|
return false, nil
|
|
}
|
|
|
|
// decodeAsMap
|
|
func ___decodeAsMap(data []byte, i interface{}) (bool, error) {
|
|
switch v := i.(type) {
|
|
case *HealthInfo:
|
|
decoder := dec.NewDecoder(data)
|
|
offset, err := ___decodeMapHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v, decoder, 0)
|
|
if err == nil && offset != decoder.Len() {
|
|
return true, fmt.Errorf("read length is different [%d] [%d] ", offset, decoder.Len())
|
|
}
|
|
return true, err
|
|
case **HealthInfo:
|
|
decoder := dec.NewDecoder(data)
|
|
offset, err := ___decodeMapHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(*v, decoder, 0)
|
|
if err == nil && offset != decoder.Len() {
|
|
return true, fmt.Errorf("read length is different [%d] [%d] ", offset, decoder.Len())
|
|
}
|
|
return true, err
|
|
case *HealthResponse:
|
|
decoder := dec.NewDecoder(data)
|
|
offset, err := ___decodeMapHealthResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v, decoder, 0)
|
|
if err == nil && offset != decoder.Len() {
|
|
return true, fmt.Errorf("read length is different [%d] [%d] ", offset, decoder.Len())
|
|
}
|
|
return true, err
|
|
case **HealthResponse:
|
|
decoder := dec.NewDecoder(data)
|
|
offset, err := ___decodeMapHealthResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(*v, decoder, 0)
|
|
if err == nil && offset != decoder.Len() {
|
|
return true, fmt.Errorf("read length is different [%d] [%d] ", offset, decoder.Len())
|
|
}
|
|
return true, err
|
|
case *ErrorResponse:
|
|
decoder := dec.NewDecoder(data)
|
|
offset, err := ___decodeMapErrorResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v, decoder, 0)
|
|
if err == nil && offset != decoder.Len() {
|
|
return true, fmt.Errorf("read length is different [%d] [%d] ", offset, decoder.Len())
|
|
}
|
|
return true, err
|
|
case **ErrorResponse:
|
|
decoder := dec.NewDecoder(data)
|
|
offset, err := ___decodeMapErrorResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(*v, decoder, 0)
|
|
if err == nil && offset != decoder.Len() {
|
|
return true, fmt.Errorf("read length is different [%d] [%d] ", offset, decoder.Len())
|
|
}
|
|
return true, err
|
|
}
|
|
return false, nil
|
|
}
|
|
|
|
// calculate size from git.cacert.org/cacert-gosigner/pkg/messages.HealthInfo
|
|
func ___calcArraySizeHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v HealthInfo, encoder *enc.Encoder) (int, error) {
|
|
size := 0
|
|
size += encoder.CalcStructHeaderFix(3)
|
|
size += encoder.CalcString(v.Source)
|
|
size += encoder.CalcBool(v.Healthy)
|
|
if v.MoreInfo != nil {
|
|
s, err := encoder.CalcMapLength(len(v.MoreInfo))
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
size += s
|
|
for kk, vv := range v.MoreInfo {
|
|
size += encoder.CalcString(kk)
|
|
size += encoder.CalcString(vv)
|
|
}
|
|
} else {
|
|
size += encoder.CalcNil()
|
|
}
|
|
return size, nil
|
|
}
|
|
|
|
// calculate size from git.cacert.org/cacert-gosigner/pkg/messages.HealthInfo
|
|
func ___calcMapSizeHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v HealthInfo, encoder *enc.Encoder) (int, error) {
|
|
size := 0
|
|
size += encoder.CalcStructHeaderFix(3)
|
|
size += encoder.CalcStringFix(6)
|
|
size += encoder.CalcString(v.Source)
|
|
size += encoder.CalcStringFix(7)
|
|
size += encoder.CalcBool(v.Healthy)
|
|
size += encoder.CalcStringFix(8)
|
|
if v.MoreInfo != nil {
|
|
s, err := encoder.CalcMapLength(len(v.MoreInfo))
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
size += s
|
|
for kk, vv := range v.MoreInfo {
|
|
size += encoder.CalcString(kk)
|
|
size += encoder.CalcString(vv)
|
|
}
|
|
} else {
|
|
size += encoder.CalcNil()
|
|
}
|
|
return size, nil
|
|
}
|
|
|
|
// encode from git.cacert.org/cacert-gosigner/pkg/messages.HealthInfo
|
|
func ___encodeArrayHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v HealthInfo, encoder *enc.Encoder, offset int) ([]byte, int, error) {
|
|
var err error
|
|
offset = encoder.WriteStructHeaderFixAsArray(3, offset)
|
|
offset = encoder.WriteString(v.Source, offset)
|
|
offset = encoder.WriteBool(v.Healthy, offset)
|
|
if v.MoreInfo != nil {
|
|
offset = encoder.WriteMapLength(len(v.MoreInfo), offset)
|
|
for kk, vv := range v.MoreInfo {
|
|
offset = encoder.WriteString(kk, offset)
|
|
offset = encoder.WriteString(vv, offset)
|
|
}
|
|
} else {
|
|
offset = encoder.WriteNil(offset)
|
|
}
|
|
return encoder.EncodedBytes(), offset, err
|
|
}
|
|
|
|
// encode from git.cacert.org/cacert-gosigner/pkg/messages.HealthInfo
|
|
func ___encodeMapHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v HealthInfo, encoder *enc.Encoder, offset int) ([]byte, int, error) {
|
|
var err error
|
|
offset = encoder.WriteStructHeaderFixAsMap(3, offset)
|
|
offset = encoder.WriteStringFix("Source", 6, offset)
|
|
offset = encoder.WriteString(v.Source, offset)
|
|
offset = encoder.WriteStringFix("Healthy", 7, offset)
|
|
offset = encoder.WriteBool(v.Healthy, offset)
|
|
offset = encoder.WriteStringFix("MoreInfo", 8, offset)
|
|
if v.MoreInfo != nil {
|
|
offset = encoder.WriteMapLength(len(v.MoreInfo), offset)
|
|
for kk, vv := range v.MoreInfo {
|
|
offset = encoder.WriteString(kk, offset)
|
|
offset = encoder.WriteString(vv, offset)
|
|
}
|
|
} else {
|
|
offset = encoder.WriteNil(offset)
|
|
}
|
|
return encoder.EncodedBytes(), offset, err
|
|
}
|
|
|
|
// decode to git.cacert.org/cacert-gosigner/pkg/messages.HealthInfo
|
|
func ___decodeArrayHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v *HealthInfo, decoder *dec.Decoder, offset int) (int, error) {
|
|
offset, err := decoder.CheckStructHeader(3, offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
{
|
|
var vv string
|
|
vv, offset, err = decoder.AsString(offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
v.Source = vv
|
|
}
|
|
{
|
|
var vv bool
|
|
vv, offset, err = decoder.AsBool(offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
v.Healthy = vv
|
|
}
|
|
if !decoder.IsCodeNil(offset) {
|
|
var vv map[string]string
|
|
var vvl int
|
|
vvl, offset, err = decoder.MapLength(offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
vv = make(map[string]string, vvl)
|
|
for vvi := 0; vvi < vvl; vvi++ {
|
|
var kkv string
|
|
kkv, offset, err = decoder.AsString(offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
var vvv string
|
|
vvv, offset, err = decoder.AsString(offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
vv[kkv] = vvv
|
|
}
|
|
v.MoreInfo = vv
|
|
} else {
|
|
offset++
|
|
}
|
|
return offset, err
|
|
}
|
|
|
|
// decode to git.cacert.org/cacert-gosigner/pkg/messages.HealthInfo
|
|
func ___decodeMapHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v *HealthInfo, decoder *dec.Decoder, offset int) (int, error) {
|
|
keys := [][]byte{
|
|
{uint8(0x53), uint8(0x6f), uint8(0x75), uint8(0x72), uint8(0x63), uint8(0x65)}, // Source
|
|
{uint8(0x48), uint8(0x65), uint8(0x61), uint8(0x6c), uint8(0x74), uint8(0x68), uint8(0x79)}, // Healthy
|
|
{uint8(0x4d), uint8(0x6f), uint8(0x72), uint8(0x65), uint8(0x49), uint8(0x6e), uint8(0x66), uint8(0x6f)}, // MoreInfo
|
|
}
|
|
offset, err := decoder.CheckStructHeader(3, offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
count := 0
|
|
for count < 3 {
|
|
var dataKey []byte
|
|
dataKey, offset, err = decoder.AsStringBytes(offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
fieldIndex := -1
|
|
for i, key := range keys {
|
|
if len(dataKey) != len(key) {
|
|
continue
|
|
}
|
|
fieldIndex = i
|
|
for dataKeyIndex := range dataKey {
|
|
if dataKey[dataKeyIndex] != key[dataKeyIndex] {
|
|
fieldIndex = -1
|
|
break
|
|
}
|
|
}
|
|
if fieldIndex >= 0 {
|
|
break
|
|
}
|
|
}
|
|
switch fieldIndex {
|
|
case 0:
|
|
{
|
|
var vv string
|
|
vv, offset, err = decoder.AsString(offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
v.Source = vv
|
|
}
|
|
count++
|
|
case 1:
|
|
{
|
|
var vv bool
|
|
vv, offset, err = decoder.AsBool(offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
v.Healthy = vv
|
|
}
|
|
count++
|
|
case 2:
|
|
if !decoder.IsCodeNil(offset) {
|
|
var vv map[string]string
|
|
var vvl int
|
|
vvl, offset, err = decoder.MapLength(offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
vv = make(map[string]string, vvl)
|
|
for vvi := 0; vvi < vvl; vvi++ {
|
|
var kkv string
|
|
kkv, offset, err = decoder.AsString(offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
var vvv string
|
|
vvv, offset, err = decoder.AsString(offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
vv[kkv] = vvv
|
|
}
|
|
v.MoreInfo = vv
|
|
} else {
|
|
offset++
|
|
}
|
|
count++
|
|
default:
|
|
return 0, fmt.Errorf("unknown key[%s] found", string(dataKey))
|
|
}
|
|
}
|
|
return offset, err
|
|
}
|
|
|
|
// calculate size from git.cacert.org/cacert-gosigner/pkg/messages.HealthResponse
|
|
func ___calcArraySizeHealthResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v HealthResponse, encoder *enc.Encoder) (int, error) {
|
|
size := 0
|
|
size += encoder.CalcStructHeaderFix(3)
|
|
size += encoder.CalcString(v.Version)
|
|
size += encoder.CalcBool(v.Healthy)
|
|
if v.Info != nil {
|
|
s, err := encoder.CalcSliceLength(len(v.Info), false)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
size += s
|
|
for _, vv := range v.Info {
|
|
size_vv, err := ___calcArraySizeHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(vv, encoder)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
size += size_vv
|
|
}
|
|
} else {
|
|
size += encoder.CalcNil()
|
|
}
|
|
return size, nil
|
|
}
|
|
|
|
// calculate size from git.cacert.org/cacert-gosigner/pkg/messages.HealthResponse
|
|
func ___calcMapSizeHealthResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v HealthResponse, encoder *enc.Encoder) (int, error) {
|
|
size := 0
|
|
size += encoder.CalcStructHeaderFix(3)
|
|
size += encoder.CalcStringFix(7)
|
|
size += encoder.CalcString(v.Version)
|
|
size += encoder.CalcStringFix(7)
|
|
size += encoder.CalcBool(v.Healthy)
|
|
size += encoder.CalcStringFix(4)
|
|
if v.Info != nil {
|
|
s, err := encoder.CalcSliceLength(len(v.Info), false)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
size += s
|
|
for _, vv := range v.Info {
|
|
size_vv, err := ___calcMapSizeHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(vv, encoder)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
size += size_vv
|
|
}
|
|
} else {
|
|
size += encoder.CalcNil()
|
|
}
|
|
return size, nil
|
|
}
|
|
|
|
// encode from git.cacert.org/cacert-gosigner/pkg/messages.HealthResponse
|
|
func ___encodeArrayHealthResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v HealthResponse, encoder *enc.Encoder, offset int) ([]byte, int, error) {
|
|
var err error
|
|
offset = encoder.WriteStructHeaderFixAsArray(3, offset)
|
|
offset = encoder.WriteString(v.Version, offset)
|
|
offset = encoder.WriteBool(v.Healthy, offset)
|
|
if v.Info != nil {
|
|
offset = encoder.WriteSliceLength(len(v.Info), offset, false)
|
|
for _, vv := range v.Info {
|
|
_, offset, err = ___encodeArrayHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(vv, encoder, offset)
|
|
if err != nil {
|
|
return nil, 0, err
|
|
}
|
|
}
|
|
} else {
|
|
offset = encoder.WriteNil(offset)
|
|
}
|
|
return encoder.EncodedBytes(), offset, err
|
|
}
|
|
|
|
// encode from git.cacert.org/cacert-gosigner/pkg/messages.HealthResponse
|
|
func ___encodeMapHealthResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v HealthResponse, encoder *enc.Encoder, offset int) ([]byte, int, error) {
|
|
var err error
|
|
offset = encoder.WriteStructHeaderFixAsMap(3, offset)
|
|
offset = encoder.WriteStringFix("version", 7, offset)
|
|
offset = encoder.WriteString(v.Version, offset)
|
|
offset = encoder.WriteStringFix("Healthy", 7, offset)
|
|
offset = encoder.WriteBool(v.Healthy, offset)
|
|
offset = encoder.WriteStringFix("Info", 4, offset)
|
|
if v.Info != nil {
|
|
offset = encoder.WriteSliceLength(len(v.Info), offset, false)
|
|
for _, vv := range v.Info {
|
|
_, offset, err = ___encodeMapHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(vv, encoder, offset)
|
|
if err != nil {
|
|
return nil, 0, err
|
|
}
|
|
}
|
|
} else {
|
|
offset = encoder.WriteNil(offset)
|
|
}
|
|
return encoder.EncodedBytes(), offset, err
|
|
}
|
|
|
|
// decode to git.cacert.org/cacert-gosigner/pkg/messages.HealthResponse
|
|
func ___decodeArrayHealthResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v *HealthResponse, decoder *dec.Decoder, offset int) (int, error) {
|
|
offset, err := decoder.CheckStructHeader(3, offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
{
|
|
var vv string
|
|
vv, offset, err = decoder.AsString(offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
v.Version = vv
|
|
}
|
|
{
|
|
var vv bool
|
|
vv, offset, err = decoder.AsBool(offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
v.Healthy = vv
|
|
}
|
|
if !decoder.IsCodeNil(offset) {
|
|
var vv []HealthInfo
|
|
var vvl int
|
|
vvl, offset, err = decoder.SliceLength(offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
vv = make([]HealthInfo, vvl)
|
|
for vvi := range vv {
|
|
var vvv HealthInfo
|
|
offset, err = ___decodeArrayHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(&vvv, decoder, offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
vv[vvi] = vvv
|
|
}
|
|
v.Info = vv
|
|
} else {
|
|
offset++
|
|
}
|
|
return offset, err
|
|
}
|
|
|
|
// decode to git.cacert.org/cacert-gosigner/pkg/messages.HealthResponse
|
|
func ___decodeMapHealthResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v *HealthResponse, decoder *dec.Decoder, offset int) (int, error) {
|
|
keys := [][]byte{
|
|
{uint8(0x76), uint8(0x65), uint8(0x72), uint8(0x73), uint8(0x69), uint8(0x6f), uint8(0x6e)}, // version
|
|
{uint8(0x48), uint8(0x65), uint8(0x61), uint8(0x6c), uint8(0x74), uint8(0x68), uint8(0x79)}, // Healthy
|
|
{uint8(0x49), uint8(0x6e), uint8(0x66), uint8(0x6f)}, // Info
|
|
}
|
|
offset, err := decoder.CheckStructHeader(3, offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
count := 0
|
|
for count < 3 {
|
|
var dataKey []byte
|
|
dataKey, offset, err = decoder.AsStringBytes(offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
fieldIndex := -1
|
|
for i, key := range keys {
|
|
if len(dataKey) != len(key) {
|
|
continue
|
|
}
|
|
fieldIndex = i
|
|
for dataKeyIndex := range dataKey {
|
|
if dataKey[dataKeyIndex] != key[dataKeyIndex] {
|
|
fieldIndex = -1
|
|
break
|
|
}
|
|
}
|
|
if fieldIndex >= 0 {
|
|
break
|
|
}
|
|
}
|
|
switch fieldIndex {
|
|
case 0:
|
|
{
|
|
var vv string
|
|
vv, offset, err = decoder.AsString(offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
v.Version = vv
|
|
}
|
|
count++
|
|
case 1:
|
|
{
|
|
var vv bool
|
|
vv, offset, err = decoder.AsBool(offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
v.Healthy = vv
|
|
}
|
|
count++
|
|
case 2:
|
|
if !decoder.IsCodeNil(offset) {
|
|
var vv []HealthInfo
|
|
var vvl int
|
|
vvl, offset, err = decoder.SliceLength(offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
vv = make([]HealthInfo, vvl)
|
|
for vvi := range vv {
|
|
var vvv HealthInfo
|
|
offset, err = ___decodeMapHealthInfo_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(&vvv, decoder, offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
vv[vvi] = vvv
|
|
}
|
|
v.Info = vv
|
|
} else {
|
|
offset++
|
|
}
|
|
count++
|
|
default:
|
|
return 0, fmt.Errorf("unknown key[%s] found", string(dataKey))
|
|
}
|
|
}
|
|
return offset, err
|
|
}
|
|
|
|
// calculate size from git.cacert.org/cacert-gosigner/pkg/messages.ErrorResponse
|
|
func ___calcArraySizeErrorResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v ErrorResponse, encoder *enc.Encoder) (int, error) {
|
|
size := 0
|
|
size += encoder.CalcStructHeaderFix(1)
|
|
size += encoder.CalcString(v.Message)
|
|
return size, nil
|
|
}
|
|
|
|
// calculate size from git.cacert.org/cacert-gosigner/pkg/messages.ErrorResponse
|
|
func ___calcMapSizeErrorResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v ErrorResponse, encoder *enc.Encoder) (int, error) {
|
|
size := 0
|
|
size += encoder.CalcStructHeaderFix(1)
|
|
size += encoder.CalcStringFix(7)
|
|
size += encoder.CalcString(v.Message)
|
|
return size, nil
|
|
}
|
|
|
|
// encode from git.cacert.org/cacert-gosigner/pkg/messages.ErrorResponse
|
|
func ___encodeArrayErrorResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v ErrorResponse, encoder *enc.Encoder, offset int) ([]byte, int, error) {
|
|
var err error
|
|
offset = encoder.WriteStructHeaderFixAsArray(1, offset)
|
|
offset = encoder.WriteString(v.Message, offset)
|
|
return encoder.EncodedBytes(), offset, err
|
|
}
|
|
|
|
// encode from git.cacert.org/cacert-gosigner/pkg/messages.ErrorResponse
|
|
func ___encodeMapErrorResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v ErrorResponse, encoder *enc.Encoder, offset int) ([]byte, int, error) {
|
|
var err error
|
|
offset = encoder.WriteStructHeaderFixAsMap(1, offset)
|
|
offset = encoder.WriteStringFix("message", 7, offset)
|
|
offset = encoder.WriteString(v.Message, offset)
|
|
return encoder.EncodedBytes(), offset, err
|
|
}
|
|
|
|
// decode to git.cacert.org/cacert-gosigner/pkg/messages.ErrorResponse
|
|
func ___decodeArrayErrorResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v *ErrorResponse, decoder *dec.Decoder, offset int) (int, error) {
|
|
offset, err := decoder.CheckStructHeader(1, offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
{
|
|
var vv string
|
|
vv, offset, err = decoder.AsString(offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
v.Message = vv
|
|
}
|
|
return offset, err
|
|
}
|
|
|
|
// decode to git.cacert.org/cacert-gosigner/pkg/messages.ErrorResponse
|
|
func ___decodeMapErrorResponse_e587a81c7cb163b35488bdef0f58c292f99f4bd65a81377f81e5b18c3d86855d(v *ErrorResponse, decoder *dec.Decoder, offset int) (int, error) {
|
|
keys := [][]byte{
|
|
{uint8(0x6d), uint8(0x65), uint8(0x73), uint8(0x73), uint8(0x61), uint8(0x67), uint8(0x65)}, // message
|
|
}
|
|
offset, err := decoder.CheckStructHeader(1, offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
count := 0
|
|
for count < 1 {
|
|
var dataKey []byte
|
|
dataKey, offset, err = decoder.AsStringBytes(offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
fieldIndex := -1
|
|
for i, key := range keys {
|
|
if len(dataKey) != len(key) {
|
|
continue
|
|
}
|
|
fieldIndex = i
|
|
for dataKeyIndex := range dataKey {
|
|
if dataKey[dataKeyIndex] != key[dataKeyIndex] {
|
|
fieldIndex = -1
|
|
break
|
|
}
|
|
}
|
|
if fieldIndex >= 0 {
|
|
break
|
|
}
|
|
}
|
|
switch fieldIndex {
|
|
case 0:
|
|
{
|
|
var vv string
|
|
vv, offset, err = decoder.AsString(offset)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
v.Message = vv
|
|
}
|
|
count++
|
|
default:
|
|
return 0, fmt.Errorf("unknown key[%s] found", string(dataKey))
|
|
}
|
|
}
|
|
return offset, err
|
|
}
|