diff --git a/.github/workflows/module_integration_publish_docker.yaml b/.github/workflows/module_integration_publish_docker.yaml new file mode 100644 index 000000000..6fc994ca2 --- /dev/null +++ b/.github/workflows/module_integration_publish_docker.yaml @@ -0,0 +1,58 @@ +name: Publish Integration Server to Dockerhub + +on: + workflow_dispatch: + inputs: + tags: + description: "Release Tags" + +jobs: + publish_dockerhub: + runs-on: ubuntu-latest + steps: + - name: PR Conventional Commit Validation + uses: ytanikin/PRConventionalCommits@1.1.0 + if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target' + with: + task_types: '["feat","fix","docs","test","ci","refactor","perf","chore","revert","style"]' + add_label: "true" + + - name: Check out the repo + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + image: tonistiigi/binfmt:qemu-v8.1.5 + cache-image: false + platforms: arm64 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - uses: actions/setup-go@v2 + with: + go-version: 1.23.3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASS }} + + - name: get latest tag + uses: "WyriHaximus/github-action-get-previous-tag@v1" + id: get-latest-tag + with: + fallback: latest + + - name: Build and push + uses: docker/build-push-action@v2 + with: + file: framework/integration/Dockerfile + push: true + tags: beclab/integration-server:${{ github.event.inputs.tags }} + platforms: linux/amd64,linux/arm64 + context: framework/integration diff --git a/framework/integration/Dockerfile b/framework/integration/Dockerfile new file mode 100644 index 000000000..a99c33158 --- /dev/null +++ b/framework/integration/Dockerfile @@ -0,0 +1,24 @@ +FROM golang:1.24 AS builder +WORKDIR /workspace +COPY . ./ + +RUN go install github.com/cloudwego/hertz/cmd/hz@latest && \ + GO111MODULE=on go install github.com/cloudwego/thriftgo@latest && \ + go mod download && \ + go mod tidy && \ + go mod edit -replace github.com/apache/thrift=github.com/apache/thrift@v0.13.0 && \ + go mod tidy && \ + cd pkg/hertz && \ + hz update -idl idl/account.thrift && \ + hz update -idl idl/cookie.thrift && \ + cd /workspace + +RUN CGO_ENABLED=0 go build -ldflags="-s -w " -a -o integration ./cmd/server/main.go + +FROM gcr.io/distroless/base:debug +WORKDIR / +COPY --from=builder /workspace/integration . + +EXPOSE 8090 + +ENTRYPOINT ["/integration"] diff --git a/framework/integration/cmd/server/main.go b/framework/integration/cmd/server/main.go new file mode 100644 index 000000000..baf24eb5f --- /dev/null +++ b/framework/integration/cmd/server/main.go @@ -0,0 +1,35 @@ +package main + +import ( + "integration/pkg/constant" + "integration/pkg/hertz" + "integration/pkg/utils" + + "github.com/spf13/cobra" + "k8s.io/klog/v2" +) + +var rootCmd = &cobra.Command{ + Use: "integration", + Short: "Integrated Account Services", + Run: func(cmd *cobra.Command, args []string) { + hertz.HertzServer() + }, +} + +func init() { + constant.InfisicalAddr = utils.GetenvOrDefault(constant.EnvInfisicalUrl, constant.InfisicalService) + constant.Environment = utils.GetenvOrDefault(constant.EnvEnvironment, constant.DefaultEnvironment) + constant.Workspace = utils.GetenvOrDefault(constant.EnvWorkspace, constant.DefaultWorkspace) + + rootCmd.SetVersionTemplate("Integration version {{printf \"%s\" .Version}}\n") +} + +func main() { + klog.InitFlags(nil) + klog.Info("Starting integration server...") + + if err := rootCmd.Execute(); err != nil { + klog.Fatal(err) + } +} diff --git a/framework/integration/go.mod b/framework/integration/go.mod new file mode 100644 index 000000000..4479d480d --- /dev/null +++ b/framework/integration/go.mod @@ -0,0 +1,84 @@ +module integration + +go 1.24.7 + +require ( + github.com/apache/thrift v0.13.0 + github.com/cloudwego/hertz v0.10.2 + github.com/emicklei/go-restful/v3 v3.13.0 + github.com/go-resty/resty/v2 v2.16.5 + github.com/spf13/cobra v1.10.1 + k8s.io/api v0.34.1 + k8s.io/apimachinery v0.34.1 + k8s.io/client-go v0.34.1 + k8s.io/klog/v2 v2.130.1 + k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 + sigs.k8s.io/controller-runtime v0.22.3 +) + +require ( + github.com/beorn7/perks v1.0.1 // indirect + github.com/bytedance/gopkg v0.1.1 // indirect + github.com/bytedance/sonic v1.14.0 // indirect + github.com/bytedance/sonic/loader v0.3.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/cloudwego/base64x v0.1.5 // indirect + github.com/cloudwego/gopkg v0.1.4 // indirect + github.com/cloudwego/netpoll v0.7.0 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/evanphx/json-patch/v5 v5.9.11 // indirect + github.com/fsnotify/fsnotify v1.9.0 // indirect + github.com/fxamacker/cbor/v2 v2.9.0 // indirect + github.com/go-logr/logr v1.4.2 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect + github.com/go-openapi/jsonreference v0.20.2 // indirect + github.com/go-openapi/swag v0.23.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/protobuf v1.5.4 // indirect + github.com/google/btree v1.1.3 // indirect + github.com/google/gnostic-models v0.7.0 // indirect + github.com/google/go-cmp v0.7.0 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/cpuid/v2 v2.0.9 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/nyaruka/phonenumbers v1.0.55 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/prometheus/client_golang v1.22.0 // indirect + github.com/prometheus/client_model v0.6.1 // indirect + github.com/prometheus/common v0.62.0 // indirect + github.com/prometheus/procfs v0.15.1 // indirect + github.com/spf13/pflag v1.0.9 // indirect + github.com/tidwall/gjson v1.14.4 // indirect + github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/pretty v1.2.0 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + github.com/x448/float16 v0.8.4 // indirect + go.yaml.in/yaml/v2 v2.4.2 // indirect + go.yaml.in/yaml/v3 v3.0.4 // indirect + golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect + golang.org/x/net v0.38.0 // indirect + golang.org/x/oauth2 v0.27.0 // indirect + golang.org/x/sync v0.12.0 // indirect + golang.org/x/sys v0.31.0 // indirect + golang.org/x/term v0.30.0 // indirect + golang.org/x/text v0.23.0 // indirect + golang.org/x/time v0.9.0 // indirect + gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect + google.golang.org/protobuf v1.36.5 // indirect + gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + k8s.io/apiextensions-apiserver v0.34.1 // indirect + k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect + sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect + sigs.k8s.io/randfill v1.0.0 // indirect + sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect + sigs.k8s.io/yaml v1.6.0 // indirect +) diff --git a/framework/integration/go.sum b/framework/integration/go.sum new file mode 100644 index 000000000..3b4442a59 --- /dev/null +++ b/framework/integration/go.sum @@ -0,0 +1,284 @@ +github.com/apache/thrift v0.13.0 h1:5hryIiq9gtn+MiLVn0wP37kb/uTeRZgN08WoCsAhIhI= +github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bytedance/gopkg v0.1.1 h1:3azzgSkiaw79u24a+w9arfH8OfnQQ4MHUt9lJFREEaE= +github.com/bytedance/gopkg v0.1.1/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM= +github.com/bytedance/sonic v1.14.0 h1:/OfKt8HFw0kh2rj8N0F6C/qPGRESq0BbaNZgcNXXzQQ= +github.com/bytedance/sonic v1.14.0/go.mod h1:WoEbx8WTcFJfzCe0hbmyTGrfjt8PzNEBdxlNUO24NhA= +github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= +github.com/bytedance/sonic/loader v0.3.0 h1:dskwH8edlzNMctoruo8FPTJDF3vLtDT0sXZwvZJyqeA= +github.com/bytedance/sonic/loader v0.3.0/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4= +github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= +github.com/cloudwego/gopkg v0.1.4 h1:EoQiCG4sTonTPHxOGE0VlQs+sQR+Hsi2uN0qqwu8O50= +github.com/cloudwego/gopkg v0.1.4/go.mod h1:FQuXsRWRsSqJLsMVd5SYzp8/Z1y5gXKnVvRrWUOsCMI= +github.com/cloudwego/hertz v0.10.2 h1:scaVn4E/AQ/vuMAC8FXzUzsEXS/TF1ix1I+4slPhh7c= +github.com/cloudwego/hertz v0.10.2/go.mod h1:W5dUFXZPZkyfjMMo3EQrMQbofuvTsctM9IxmhbkuT18= +github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= +github.com/cloudwego/netpoll v0.7.0 h1:bDrxQaNfijRI1zyGgXHQoE/nYegL0nr+ijO1Norelc4= +github.com/cloudwego/netpoll v0.7.0/go.mod h1:PI+YrmyS7cIr0+SD4seJz3Eo3ckkXdu2ZVKBLhURLNU= +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/emicklei/go-restful/v3 v3.13.0 h1:C4Bl2xDndpU6nJ4bc1jXd+uTmYPVUwkD6bFY/oTyCes= +github.com/emicklei/go-restful/v3 v3.13.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/evanphx/json-patch v0.5.2 h1:xVCHIVMUu1wtM/VkR9jVZ45N3FhZfYMMYGorLCR8P3k= +github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ= +github.com/evanphx/json-patch/v5 v5.9.11 h1:/8HVnzMq13/3x9TPvjG08wUGqBTmZBsCWzjTM0wiaDU= +github.com/evanphx/json-patch/v5 v5.9.11/go.mod h1:3j+LviiESTElxA4p3EMKAB9HXj3/XEtnUf6OZxqIQTM= +github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= +github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM= +github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= +github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg= +github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= +github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= +github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= +github.com/go-resty/resty/v2 v2.16.5 h1:hBKqmWrr7uRc3euHVqmh1HTHcKn99Smr7o5spptdhTM= +github.com/go-resty/resty/v2 v2.16.5/go.mod h1:hkJtXbA2iKHzJheXYvQ8snQES5ZLGKMwQ07xAwp/fiA= +github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= +github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= +github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= +github.com/google/gnostic-models v0.7.0 h1:qwTtogB15McXDaNqTZdzPJRHvaVJlAl+HVQnLmJEJxo= +github.com/google/gnostic-models v0.7.0/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7OUGxBlw57miDrQ= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo= +github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= +github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= +github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8= +github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/nyaruka/phonenumbers v1.0.55 h1:bj0nTO88Y68KeUQ/n3Lo2KgK7lM1hF7L9NFuwcCl3yg= +github.com/nyaruka/phonenumbers v1.0.55/go.mod h1:sDaTZ/KPX5f8qyV9qN+hIm+4ZBARJrupC6LuhshJq1U= +github.com/onsi/ginkgo/v2 v2.22.0 h1:Yed107/8DjTr0lKCNt7Dn8yQ6ybuDRQoMGrNFKzMfHg= +github.com/onsi/ginkgo/v2 v2.22.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= +github.com/onsi/gomega v1.36.1 h1:bJDPBO7ibjxcbHMgSCoo4Yj18UWbKDlLwX1x9sybDcw= +github.com/onsi/gomega v1.36.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.22.0 h1:rb93p9lokFEsctTys46VnV1kLCDpVZ0a/Y92Vm0Zc6Q= +github.com/prometheus/client_golang v1.22.0/go.mod h1:R7ljNsLXhuQXYZYtw6GAE9AZg8Y7vEW5scdCXrWRXC0= +github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= +github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= +github.com/prometheus/common v0.62.0 h1:xasJaQlnWAeyHdUBeGjXmutelfJHWMRr+Fg4QszZ2Io= +github.com/prometheus/common v0.62.0/go.mod h1:vyBcEuLSvWos9B1+CyL7JZ2up+uFzXhkqml0W5zIY1I= +github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s= +github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0= +github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY= +github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM= +github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= +github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= +github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= +github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= +go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +golang.org/x/arch v0.0.0-20210923205945-b76863e36670 h1:18EFjUmQOcUvxNYSkA6jO9VAiXCnxFY6NyDX0bHDmkU= +golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= +golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= +golang.org/x/oauth2 v0.27.0 h1:da9Vo7/tDv5RH/7nZDz1eMGS/q1Vv1N/7FCrBhI9I3M= +golang.org/x/oauth2 v0.27.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= +golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= +golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= +golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y= +golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= +golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= +golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY= +golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw= +gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= +google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM= +google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= +gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +k8s.io/api v0.34.1 h1:jC+153630BMdlFukegoEL8E/yT7aLyQkIVuwhmwDgJM= +k8s.io/api v0.34.1/go.mod h1:SB80FxFtXn5/gwzCoN6QCtPD7Vbu5w2n1S0J5gFfTYk= +k8s.io/apiextensions-apiserver v0.34.1 h1:NNPBva8FNAPt1iSVwIE0FsdrVriRXMsaWFMqJbII2CI= +k8s.io/apiextensions-apiserver v0.34.1/go.mod h1:hP9Rld3zF5Ay2Of3BeEpLAToP+l4s5UlxiHfqRaRcMc= +k8s.io/apimachinery v0.34.1 h1:dTlxFls/eikpJxmAC7MVE8oOeP1zryV7iRyIjB0gky4= +k8s.io/apimachinery v0.34.1/go.mod h1:/GwIlEcWuTX9zKIg2mbw0LRFIsXwrfoVxn+ef0X13lw= +k8s.io/client-go v0.34.1 h1:ZUPJKgXsnKwVwmKKdPfw4tB58+7/Ik3CrjOEhsiZ7mY= +k8s.io/client-go v0.34.1/go.mod h1:kA8v0FP+tk6sZA0yKLRG67LWjqufAoSHA2xVGKw9Of8= +k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= +k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b h1:MloQ9/bdJyIu9lb1PzujOPolHyvO06MXG5TUIj2mNAA= +k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b/go.mod h1:UZ2yyWbFTpuhSbFhv24aGNOdoRdJZgsIObGBUaYVsts= +k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 h1:SjGebBtkBqHFOli+05xYbK8YF1Dzkbzn+gDM4X9T4Ck= +k8s.io/utils v0.0.0-20251002143259-bc988d571ff4/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= +sigs.k8s.io/controller-runtime v0.22.3 h1:I7mfqz/a/WdmDCEnXmSPm8/b/yRTy6JsKKENTijTq8Y= +sigs.k8s.io/controller-runtime v0.22.3/go.mod h1:+QX1XUpTXN4mLoblf4tqr5CQcyHPAki2HLXqQMY6vh8= +sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE= +sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= +sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= +sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= +sigs.k8s.io/structured-merge-diff/v6 v6.3.0 h1:jTijUJbW353oVOd9oTlifJqOGEkUw2jB/fXCbTiQEco= +sigs.k8s.io/structured-merge-diff/v6 v6.3.0/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= +sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= +sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= diff --git a/framework/integration/pkg/constant/constant.go b/framework/integration/pkg/constant/constant.go new file mode 100644 index 000000000..02a801164 --- /dev/null +++ b/framework/integration/pkg/constant/constant.go @@ -0,0 +1,20 @@ +package constant + +const ( + InfisicalNamespace = "os-protected" + InfisicalService = "http://infisical-service." + InfisicalNamespace + DefaultEnvironment = "prod" + DefaultWorkspace = "settings" + + HeaderUserName = "X-Bfl-User" + EnvInfisicalUrl = "INFISICAL_URL" + EnvEnvironment = "ENVIRONMENT" + EnvWorkspace = "WORKSPACE" +) + +var ( + InfisicalAddr string + InfisicalPort = "8080" + Environment string + Workspace string +) diff --git a/framework/integration/pkg/hertz/.gitignore b/framework/integration/pkg/hertz/.gitignore new file mode 100644 index 000000000..4b5a5c27a --- /dev/null +++ b/framework/integration/pkg/hertz/.gitignore @@ -0,0 +1,39 @@ +*.o +*.a +*.so +_obj +_test +*.[568vq] +[568vq].out +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* +_testmain.go +*.exe +*.exe~ +*.test +*.prof +*.rar +*.zip +*.gz +*.psd +*.bmd +*.cfg +*.pptx +*.log +*nohup.out +*settings.pyc +*.sublime-project +*.sublime-workspace +!.gitkeep +.DS_Store +/.idea +/.vscode +/output +*.local.yml +dumped_hertz_remote_config.json + +# /biz/model/api/account +# /biz/model/api/cookie diff --git a/framework/integration/pkg/hertz/.hz b/framework/integration/pkg/hertz/.hz new file mode 100644 index 000000000..791041dc5 --- /dev/null +++ b/framework/integration/pkg/hertz/.hz @@ -0,0 +1,6 @@ +// Code generated by hz. DO NOT EDIT. + +hz version: v0.9.7 +handlerDir: "" +modelDir: "" +routerDir: "" diff --git a/framework/integration/pkg/hertz/biz/handler/api/account/account_service.go b/framework/integration/pkg/hertz/biz/handler/api/account/account_service.go new file mode 100644 index 000000000..c4f2f0af2 --- /dev/null +++ b/framework/integration/pkg/hertz/biz/handler/api/account/account_service.go @@ -0,0 +1,199 @@ +// Code generated by hertz generator. + +package account + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "strings" + + "integration/pkg/constant" + "integration/pkg/hertz/biz/handler" + account "integration/pkg/hertz/biz/model/api/account" + "integration/pkg/hertz/biz/model/api/infisical" + "integration/pkg/utils" + + "k8s.io/klog/v2" + + "github.com/cloudwego/hertz/pkg/app" + "github.com/cloudwego/hertz/pkg/protocol/consts" + "github.com/emicklei/go-restful/v3" +) + +// GetAccount . +// @router /api/account/retrieve [POST] +func GetAccount(ctx context.Context, c *app.RequestContext) { // + + var err error + var req account.AccountReq + err = c.BindAndValidate(&req) + if err != nil { + c.String(consts.StatusBadRequest, err.Error()) + return + } + + var name = fmt.Sprintf("integration-account:%s:%s", req.Type, req.Name) + var data = make(map[string]string) + data["name"] = name + data["env"] = constant.Environment + var infisicalUrl = fmt.Sprintf("%s:%s/RetrieveSecret?workspace=%s", constant.InfisicalAddr, constant.InfisicalPort, constant.Workspace) + + resp, err := utils.RestClient.R().SetHeader(restful.HEADER_ContentType, restful.MIME_JSON). + SetHeader(constant.HeaderUserName, req.User). + SetBody(data). + SetResult(&infisical.InfisicalResp{}). + Post(infisicalUrl) + + if err != nil { + klog.Errorf("GetAccount failed, request error: %v, account: %s", err, name) + handler.ErrorResponse(c, err) + return + } + + if resp.StatusCode() != http.StatusOK { + klog.Errorf("GetAccount failed, status code: %d, resp: %s", resp.StatusCode(), string(resp.Body())) + handler.ErrorResponse(c, fmt.Errorf("request invalid, status code: %d", resp.StatusCode())) + return + } + + accountResp := resp.Result().(*infisical.InfisicalResp) + var result = &account.AccountResp{} + + if accountResp.Code != 0 { + err := handler.FormatErrorMessage(accountResp.Message) + klog.Errorf("GetAccount failed, format error: %v, content: %s", err, accountResp.Message) + handler.ErrorResponse(c, err) + return + } + + accountType, accountName, err := getAccountName(accountResp.Data.Name) + if err != nil { + klog.Errorf("GetAccount failed, extract acount info error: %v", err) + handler.ErrorResponse(c, err) + return + } + + valueObj, err := unmarshalValue(accountResp.Data.Value) + if err != nil { + klog.Errorf("GetAccount failed, unmarshal error: %v, content: %s", err, accountResp.Data.Value) + handler.ErrorResponse(c, err) + return + } + + var rawData = &account.AccountRespDataRaw{ + ExpiresAt: valueObj.ExpiresAt, + RefreshToken: valueObj.RefreshToken, + AccessToken: valueObj.AccessToken, + Endpoint: valueObj.Endpoint, + Bucket: valueObj.Bucket, + UserId: valueObj.UserId, + Available: valueObj.Available, + CreateAt: valueObj.CreateAt, + Scope: valueObj.Scope, + IdToken: valueObj.IdToken, + ClientId: valueObj.ClientId, + } + + result.Data = &account.AccountRespData{ + Name: accountName, + Type: accountType, + RawData: rawData, + } + + c.JSON(consts.StatusOK, result) +} + +// GetList . +// @router /api/account/list [POST] +func GetList(ctx context.Context, c *app.RequestContext) { // + + var err error + var req account.AccountListReq + err = c.BindAndValidate(&req) + if err != nil { + c.String(consts.StatusBadRequest, err.Error()) + return + } + + var data = make(map[string]string) + data["env"] = constant.Environment + var infisicalUrl = fmt.Sprintf("%s:%s/ListSecret?workspace=%s", constant.InfisicalAddr, constant.InfisicalPort, constant.Workspace) + + resp, err := utils.RestClient.R().SetHeader(restful.HEADER_ContentType, restful.MIME_JSON). + SetHeader(constant.HeaderUserName, req.User). + SetBody(data). + SetResult(&infisical.InfisicalListResp{}). + Post(infisicalUrl) + + if err != nil { + klog.Errorf("GetList failed, request error: %v", err) + handler.ErrorResponse(c, err) + return + } + + if resp.StatusCode() != http.StatusOK { + klog.Errorf("GetList failed, status code: %d, resp: %s", resp.StatusCode(), string(resp.Body())) + handler.ErrorResponse(c, fmt.Errorf("request invalid, status code: %d", resp.StatusCode())) + return + } + + infisicalListResp := resp.Result().(*infisical.InfisicalListResp) + + if infisicalListResp.Code != 0 { + err := handler.FormatErrorMessage(infisicalListResp.Message) + klog.Errorf("GetList failed, format error: %v, content: %s", err, infisicalListResp.Message) + handler.ErrorResponse(c, err) + return + } + + var datas []*account.AccountListData + for _, item := range infisicalListResp.Data { + if !strings.HasPrefix(item.Name, "integration-account:") { + continue + } + accountType, accountName, err := getAccountName(item.Name) + if err != nil { + klog.Errorf("GetList failed, get accountInfo error: %v, name: %s", err, item.Name) + handler.ErrorResponse(c, err) + return + } + valueObj, err := unmarshalValue(item.Value) + if err != nil { + klog.Errorf("GetList failed, unmarshale error: %v, name: %s", err, item.Value) + handler.ErrorResponse(c, err) + return + } + + var raw = &account.AccountListData{ + Name: accountName, + Type: accountType, + Available: valueObj.Available, + CreateAt: valueObj.CreateAt, + ExpiresAt: valueObj.ExpiresAt, + } + datas = append(datas, raw) + } + + var result = &account.AccountListResp{ + Code: 0, + Data: datas, + } + + c.JSON(consts.StatusOK, result) +} + +func getAccountName(fullName string) (string, string, error) { + var tmp = strings.Split(fullName, ":") + if len(tmp) == 3 { + return tmp[1], tmp[2], nil + } + return "", "", fmt.Errorf("account type invalid") +} + +func unmarshalValue(value string) (*infisical.AccountDataRaw, error) { + var valueObj *infisical.AccountDataRaw + if err := json.Unmarshal([]byte(value), &valueObj); err != nil { + return nil, err + } + return valueObj, nil +} diff --git a/framework/integration/pkg/hertz/biz/handler/api/cookie/cookie_service.go b/framework/integration/pkg/hertz/biz/handler/api/cookie/cookie_service.go new file mode 100644 index 000000000..d38614128 --- /dev/null +++ b/framework/integration/pkg/hertz/biz/handler/api/cookie/cookie_service.go @@ -0,0 +1,102 @@ +// Code generated by hertz generator. + +package cookie + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + + "integration/pkg/constant" + "integration/pkg/hertz/biz/handler" + "integration/pkg/hertz/biz/model/api/cookie" + "integration/pkg/hertz/biz/model/api/infisical" + "integration/pkg/utils" + + "github.com/cloudwego/hertz/pkg/app" + "github.com/cloudwego/hertz/pkg/protocol/consts" + "github.com/emicklei/go-restful/v3" + "k8s.io/klog/v2" +) + +// GetCookie . +// @router /api/cookie/retrieve [POST] +func GetCookie(ctx context.Context, c *app.RequestContext) { + var err error + var req cookie.CookieReq + err = c.BindAndValidate(&req) + if err != nil { + c.String(consts.StatusBadRequest, err.Error()) + return + } + + var data = make(map[string]string) + data["name"] = fmt.Sprintf("cookie:%s:%s", req.Domain, req.User) // doamin: .xxx.com + data["env"] = constant.Environment + var infisicalUrl = fmt.Sprintf("%s:8080/RetrieveSecret?workspace=%s", constant.InfisicalAddr, constant.Workspace) + + resp, err := utils.RestClient.R().SetHeader(restful.HEADER_ContentType, restful.MIME_JSON). + SetHeader(constant.HeaderUserName, req.User). + SetBody(data). + SetResult(&infisical.InfisicalResp{}). + Post(infisicalUrl) + + if err != nil { + klog.Errorf("GetCookie failed, request error: %v, domain: %s", err, req.Domain) + handler.ErrorResponse(c, err) + return + } + + if resp.StatusCode() != http.StatusOK { + klog.Errorf("GetCookie failed, status code: %d, resp: %s", resp.StatusCode(), string(resp.Body())) + handler.ErrorResponse(c, fmt.Errorf("request invalid, status code: %d", resp.StatusCode())) + return + } + + cookieResp := resp.Result().(*infisical.InfisicalResp) + + var resultData = make([]*cookie.CookieRespData, 0) + var result = &cookie.CookieResp{ + Code: 0, + Data: resultData, + } + + if cookieResp.Code != 0 { + err := handler.FormatErrorMessage(cookieResp.Message) + klog.Errorf("GetCookie failed, format error: %v, content: %s", err, cookieResp.Message) + handler.SuccessResponse(c, result) + return + } + + var cookieData *infisical.CookieData + if err := json.Unmarshal([]byte(cookieResp.Data.Value), &cookieData); err != nil { + klog.Errorf("GetCookie failed, unmarshal error: %v, content: %s", err, cookieResp.Data.Value) + handler.SuccessResponse(c, result) + return + } + + var records []*cookie.CookieRespDataRaw + for _, record := range cookieData.Records { + var r = &cookie.CookieRespDataRaw{ + Domain: record.Domain, + Name: record.Name, + Value: record.Value, + Expires: record.Expires, + Path: record.Path, + Secure: record.Secure, + HttpOnly: record.HttpOnly, + SameSite: record.SameSite, + Other: record.Other, + } + records = append(records, r) + } + + result.Data = append(result.Data, &cookie.CookieRespData{ + Domain: cookieData.Domain, + Account: cookieData.Account, + Records: records, + }) + + handler.SuccessResponse(c, result) +} diff --git a/framework/integration/pkg/hertz/biz/handler/handler.go b/framework/integration/pkg/hertz/biz/handler/handler.go new file mode 100644 index 000000000..87d2daeeb --- /dev/null +++ b/framework/integration/pkg/hertz/biz/handler/handler.go @@ -0,0 +1,39 @@ +package handler + +import ( + "encoding/json" + "errors" + "integration/pkg/hertz/biz/model/api/infisical" + "strings" + + "github.com/cloudwego/hertz/pkg/app" + "github.com/cloudwego/hertz/pkg/common/utils" + "github.com/cloudwego/hertz/pkg/protocol/consts" +) + +func FormatErrorMessage(m string) error { + if strings.Contains(m, "{") && strings.Contains(m, "}") { + pos := strings.Index(m, "{") + errMsg := m[pos:] + var errObj *infisical.ErrorMessage + if err := json.Unmarshal([]byte(errMsg), &errObj); err != nil { + return err + } + + return errors.New(errObj.Message) + } + + return errors.New(m) +} + +func ErrorResponse(c *app.RequestContext, msg error) { + c.AbortWithStatusJSON(consts.StatusInternalServerError, + utils.H{ + "code": consts.StatusInternalServerError, + "message": msg.Error(), + }) +} + +func SuccessResponse(c *app.RequestContext, result interface{}) { + c.JSON(consts.StatusOK, result) +} diff --git a/framework/integration/pkg/hertz/biz/handler/ping.go b/framework/integration/pkg/hertz/biz/handler/ping.go new file mode 100644 index 000000000..57b195495 --- /dev/null +++ b/framework/integration/pkg/hertz/biz/handler/ping.go @@ -0,0 +1,19 @@ +// Code generated by hertz generator. + +package handler + +import ( + "context" + + "github.com/cloudwego/hertz/pkg/app" + "github.com/cloudwego/hertz/pkg/common/utils" + "github.com/cloudwego/hertz/pkg/protocol/consts" +) + +// Ping . +func Ping(ctx context.Context, c *app.RequestContext) { + c.JSON(consts.StatusOK, utils.H{ + "code": 0, + "message": "pong", + }) +} diff --git a/framework/integration/pkg/hertz/biz/model/api/account/account.go b/framework/integration/pkg/hertz/biz/model/api/account/account.go new file mode 100644 index 000000000..fb1d4621f --- /dev/null +++ b/framework/integration/pkg/hertz/biz/model/api/account/account.go @@ -0,0 +1,2852 @@ +// Code generated by thriftgo (0.4.2). DO NOT EDIT. + +package account + +import ( + "context" + "fmt" + "github.com/apache/thrift/lib/go/thrift" +) + +type AccountReq struct { + Name string `thrift:"Name,1,required" form:"name,required" json:"name,required"` + Type string `thrift:"Type,2,required" form:"type,required" json:"type,required"` + User string `thrift:"User,3,required" form:"user,required" json:"user,required"` +} + +func NewAccountReq() *AccountReq { + return &AccountReq{} +} + +func (p *AccountReq) InitDefault() { +} + +func (p *AccountReq) GetName() (v string) { + return p.Name +} + +func (p *AccountReq) GetType() (v string) { + return p.Type +} + +func (p *AccountReq) GetUser() (v string) { + return p.User +} + +var fieldIDToName_AccountReq = map[int16]string{ + 1: "Name", + 2: "Type", + 3: "User", +} + +func (p *AccountReq) Read(iprot thrift.TProtocol) (err error) { + var fieldTypeId thrift.TType + var fieldId int16 + var issetName bool = false + var issetType bool = false + var issetUser bool = false + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 1: + if fieldTypeId == thrift.STRING { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + issetName = true + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 2: + if fieldTypeId == thrift.STRING { + if err = p.ReadField2(iprot); err != nil { + goto ReadFieldError + } + issetType = true + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 3: + if fieldTypeId == thrift.STRING { + if err = p.ReadField3(iprot); err != nil { + goto ReadFieldError + } + issetUser = true + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + if !issetName { + fieldId = 1 + goto RequiredFieldNotSetError + } + + if !issetType { + fieldId = 2 + goto RequiredFieldNotSetError + } + + if !issetUser { + fieldId = 3 + goto RequiredFieldNotSetError + } + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_AccountReq[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +RequiredFieldNotSetError: + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_AccountReq[fieldId])) +} + +func (p *AccountReq) ReadField1(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Name = _field + return nil +} +func (p *AccountReq) ReadField2(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Type = _field + return nil +} +func (p *AccountReq) ReadField3(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.User = _field + return nil +} + +func (p *AccountReq) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("AccountReq"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField1(oprot); err != nil { + fieldId = 1 + goto WriteFieldError + } + if err = p.writeField2(oprot); err != nil { + fieldId = 2 + goto WriteFieldError + } + if err = p.writeField3(oprot); err != nil { + fieldId = 3 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *AccountReq) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("Name", thrift.STRING, 1); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Name); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) +} +func (p *AccountReq) writeField2(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("Type", thrift.STRING, 2); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Type); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) +} +func (p *AccountReq) writeField3(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("User", thrift.STRING, 3); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.User); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) +} + +func (p *AccountReq) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AccountReq(%+v)", *p) + +} + +type AccountResp struct { + Code int32 `thrift:"code,1" form:"code" json:"code" query:"code"` + Message string `thrift:"message,2" form:"message" json:"message" query:"message"` + Data *AccountRespData `thrift:"data,3" form:"data" json:"data" query:"data"` +} + +func NewAccountResp() *AccountResp { + return &AccountResp{} +} + +func (p *AccountResp) InitDefault() { +} + +func (p *AccountResp) GetCode() (v int32) { + return p.Code +} + +func (p *AccountResp) GetMessage() (v string) { + return p.Message +} + +var AccountResp_Data_DEFAULT *AccountRespData + +func (p *AccountResp) GetData() (v *AccountRespData) { + if !p.IsSetData() { + return AccountResp_Data_DEFAULT + } + return p.Data +} + +var fieldIDToName_AccountResp = map[int16]string{ + 1: "code", + 2: "message", + 3: "data", +} + +func (p *AccountResp) IsSetData() bool { + return p.Data != nil +} + +func (p *AccountResp) Read(iprot thrift.TProtocol) (err error) { + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 1: + if fieldTypeId == thrift.I32 { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 2: + if fieldTypeId == thrift.STRING { + if err = p.ReadField2(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 3: + if fieldTypeId == thrift.STRUCT { + if err = p.ReadField3(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_AccountResp[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +} + +func (p *AccountResp) ReadField1(iprot thrift.TProtocol) error { + + var _field int32 + if v, err := iprot.ReadI32(); err != nil { + return err + } else { + _field = v + } + p.Code = _field + return nil +} +func (p *AccountResp) ReadField2(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Message = _field + return nil +} +func (p *AccountResp) ReadField3(iprot thrift.TProtocol) error { + _field := NewAccountRespData() + if err := _field.Read(iprot); err != nil { + return err + } + p.Data = _field + return nil +} + +func (p *AccountResp) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("AccountResp"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField1(oprot); err != nil { + fieldId = 1 + goto WriteFieldError + } + if err = p.writeField2(oprot); err != nil { + fieldId = 2 + goto WriteFieldError + } + if err = p.writeField3(oprot); err != nil { + fieldId = 3 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *AccountResp) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("code", thrift.I32, 1); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteI32(p.Code); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) +} +func (p *AccountResp) writeField2(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("message", thrift.STRING, 2); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Message); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) +} +func (p *AccountResp) writeField3(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("data", thrift.STRUCT, 3); err != nil { + goto WriteFieldBeginError + } + if err := p.Data.Write(oprot); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) +} + +func (p *AccountResp) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AccountResp(%+v)", *p) + +} + +type AccountRespData struct { + Name string `thrift:"name,1" form:"name" json:"name" query:"name"` + Type string `thrift:"type,2" form:"type" json:"type" query:"type"` + RawData *AccountRespDataRaw `thrift:"rawData,3" form:"rawData" json:"rawData" query:"rawData"` +} + +func NewAccountRespData() *AccountRespData { + return &AccountRespData{} +} + +func (p *AccountRespData) InitDefault() { +} + +func (p *AccountRespData) GetName() (v string) { + return p.Name +} + +func (p *AccountRespData) GetType() (v string) { + return p.Type +} + +var AccountRespData_RawData_DEFAULT *AccountRespDataRaw + +func (p *AccountRespData) GetRawData() (v *AccountRespDataRaw) { + if !p.IsSetRawData() { + return AccountRespData_RawData_DEFAULT + } + return p.RawData +} + +var fieldIDToName_AccountRespData = map[int16]string{ + 1: "name", + 2: "type", + 3: "rawData", +} + +func (p *AccountRespData) IsSetRawData() bool { + return p.RawData != nil +} + +func (p *AccountRespData) Read(iprot thrift.TProtocol) (err error) { + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 1: + if fieldTypeId == thrift.STRING { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 2: + if fieldTypeId == thrift.STRING { + if err = p.ReadField2(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 3: + if fieldTypeId == thrift.STRUCT { + if err = p.ReadField3(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_AccountRespData[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +} + +func (p *AccountRespData) ReadField1(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Name = _field + return nil +} +func (p *AccountRespData) ReadField2(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Type = _field + return nil +} +func (p *AccountRespData) ReadField3(iprot thrift.TProtocol) error { + _field := NewAccountRespDataRaw() + if err := _field.Read(iprot); err != nil { + return err + } + p.RawData = _field + return nil +} + +func (p *AccountRespData) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("AccountRespData"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField1(oprot); err != nil { + fieldId = 1 + goto WriteFieldError + } + if err = p.writeField2(oprot); err != nil { + fieldId = 2 + goto WriteFieldError + } + if err = p.writeField3(oprot); err != nil { + fieldId = 3 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *AccountRespData) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Name); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) +} +func (p *AccountRespData) writeField2(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("type", thrift.STRING, 2); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Type); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) +} +func (p *AccountRespData) writeField3(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("rawData", thrift.STRUCT, 3); err != nil { + goto WriteFieldBeginError + } + if err := p.RawData.Write(oprot); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) +} + +func (p *AccountRespData) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AccountRespData(%+v)", *p) + +} + +type AccountRespDataRaw struct { + AccessToken string `thrift:"accessToken,1" form:"accessToken" json:"accessToken" query:"accessToken"` + RefreshToken string `thrift:"refreshToken,2" form:"refreshToken" json:"refreshToken" query:"refreshToken"` + ExpiresAt int64 `thrift:"expiresAt,3" form:"expiresAt" json:"expiresAt" query:"expiresAt"` + CreateAt int64 `thrift:"createAt,4" form:"createAt" json:"createAt" query:"createAt"` + Available bool `thrift:"available,5" form:"available" json:"available" query:"available"` + Endpoint string `thrift:"endpoint,6" json:"endpoint,omitempty" form:"endpoint" query:"endpoint"` + Bucket string `thrift:"bucket,7" json:"bucket,omitempty" form:"bucket" query:"bucket"` + UserId string `thrift:"userId,8" json:"userId,omitempty" form:"userId" query:"userId"` + Scope string `thrift:"scope,9" json:"scope,omitempty" form:"scope" query:"scope"` + IdToken string `thrift:"idToken,10" json:"idToken,omitempty" form:"idToken" query:"idToken"` + ClientId string `thrift:"clientId,11" json:"clientId,omitempty" form:"clientId" query:"clientId"` + CloudUrl string `thrift:"cloudUrl,12" json:"cloudUrl,omitempty" form:"cloudUrl" query:"cloudUrl"` +} + +func NewAccountRespDataRaw() *AccountRespDataRaw { + return &AccountRespDataRaw{} +} + +func (p *AccountRespDataRaw) InitDefault() { +} + +func (p *AccountRespDataRaw) GetAccessToken() (v string) { + return p.AccessToken +} + +func (p *AccountRespDataRaw) GetRefreshToken() (v string) { + return p.RefreshToken +} + +func (p *AccountRespDataRaw) GetExpiresAt() (v int64) { + return p.ExpiresAt +} + +func (p *AccountRespDataRaw) GetCreateAt() (v int64) { + return p.CreateAt +} + +func (p *AccountRespDataRaw) GetAvailable() (v bool) { + return p.Available +} + +func (p *AccountRespDataRaw) GetEndpoint() (v string) { + return p.Endpoint +} + +func (p *AccountRespDataRaw) GetBucket() (v string) { + return p.Bucket +} + +func (p *AccountRespDataRaw) GetUserId() (v string) { + return p.UserId +} + +func (p *AccountRespDataRaw) GetScope() (v string) { + return p.Scope +} + +func (p *AccountRespDataRaw) GetIdToken() (v string) { + return p.IdToken +} + +func (p *AccountRespDataRaw) GetClientId() (v string) { + return p.ClientId +} + +func (p *AccountRespDataRaw) GetCloudUrl() (v string) { + return p.CloudUrl +} + +var fieldIDToName_AccountRespDataRaw = map[int16]string{ + 1: "accessToken", + 2: "refreshToken", + 3: "expiresAt", + 4: "createAt", + 5: "available", + 6: "endpoint", + 7: "bucket", + 8: "userId", + 9: "scope", + 10: "idToken", + 11: "clientId", + 12: "cloudUrl", +} + +func (p *AccountRespDataRaw) Read(iprot thrift.TProtocol) (err error) { + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 1: + if fieldTypeId == thrift.STRING { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 2: + if fieldTypeId == thrift.STRING { + if err = p.ReadField2(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 3: + if fieldTypeId == thrift.I64 { + if err = p.ReadField3(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 4: + if fieldTypeId == thrift.I64 { + if err = p.ReadField4(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 5: + if fieldTypeId == thrift.BOOL { + if err = p.ReadField5(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 6: + if fieldTypeId == thrift.STRING { + if err = p.ReadField6(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 7: + if fieldTypeId == thrift.STRING { + if err = p.ReadField7(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 8: + if fieldTypeId == thrift.STRING { + if err = p.ReadField8(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 9: + if fieldTypeId == thrift.STRING { + if err = p.ReadField9(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 10: + if fieldTypeId == thrift.STRING { + if err = p.ReadField10(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 11: + if fieldTypeId == thrift.STRING { + if err = p.ReadField11(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 12: + if fieldTypeId == thrift.STRING { + if err = p.ReadField12(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_AccountRespDataRaw[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +} + +func (p *AccountRespDataRaw) ReadField1(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.AccessToken = _field + return nil +} +func (p *AccountRespDataRaw) ReadField2(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.RefreshToken = _field + return nil +} +func (p *AccountRespDataRaw) ReadField3(iprot thrift.TProtocol) error { + + var _field int64 + if v, err := iprot.ReadI64(); err != nil { + return err + } else { + _field = v + } + p.ExpiresAt = _field + return nil +} +func (p *AccountRespDataRaw) ReadField4(iprot thrift.TProtocol) error { + + var _field int64 + if v, err := iprot.ReadI64(); err != nil { + return err + } else { + _field = v + } + p.CreateAt = _field + return nil +} +func (p *AccountRespDataRaw) ReadField5(iprot thrift.TProtocol) error { + + var _field bool + if v, err := iprot.ReadBool(); err != nil { + return err + } else { + _field = v + } + p.Available = _field + return nil +} +func (p *AccountRespDataRaw) ReadField6(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Endpoint = _field + return nil +} +func (p *AccountRespDataRaw) ReadField7(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Bucket = _field + return nil +} +func (p *AccountRespDataRaw) ReadField8(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.UserId = _field + return nil +} +func (p *AccountRespDataRaw) ReadField9(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Scope = _field + return nil +} +func (p *AccountRespDataRaw) ReadField10(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.IdToken = _field + return nil +} +func (p *AccountRespDataRaw) ReadField11(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.ClientId = _field + return nil +} +func (p *AccountRespDataRaw) ReadField12(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.CloudUrl = _field + return nil +} + +func (p *AccountRespDataRaw) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("AccountRespDataRaw"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField1(oprot); err != nil { + fieldId = 1 + goto WriteFieldError + } + if err = p.writeField2(oprot); err != nil { + fieldId = 2 + goto WriteFieldError + } + if err = p.writeField3(oprot); err != nil { + fieldId = 3 + goto WriteFieldError + } + if err = p.writeField4(oprot); err != nil { + fieldId = 4 + goto WriteFieldError + } + if err = p.writeField5(oprot); err != nil { + fieldId = 5 + goto WriteFieldError + } + if err = p.writeField6(oprot); err != nil { + fieldId = 6 + goto WriteFieldError + } + if err = p.writeField7(oprot); err != nil { + fieldId = 7 + goto WriteFieldError + } + if err = p.writeField8(oprot); err != nil { + fieldId = 8 + goto WriteFieldError + } + if err = p.writeField9(oprot); err != nil { + fieldId = 9 + goto WriteFieldError + } + if err = p.writeField10(oprot); err != nil { + fieldId = 10 + goto WriteFieldError + } + if err = p.writeField11(oprot); err != nil { + fieldId = 11 + goto WriteFieldError + } + if err = p.writeField12(oprot); err != nil { + fieldId = 12 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *AccountRespDataRaw) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("accessToken", thrift.STRING, 1); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.AccessToken); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) +} +func (p *AccountRespDataRaw) writeField2(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("refreshToken", thrift.STRING, 2); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.RefreshToken); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) +} +func (p *AccountRespDataRaw) writeField3(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("expiresAt", thrift.I64, 3); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteI64(p.ExpiresAt); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) +} +func (p *AccountRespDataRaw) writeField4(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("createAt", thrift.I64, 4); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteI64(p.CreateAt); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) +} +func (p *AccountRespDataRaw) writeField5(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("available", thrift.BOOL, 5); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteBool(p.Available); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err) +} +func (p *AccountRespDataRaw) writeField6(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("endpoint", thrift.STRING, 6); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Endpoint); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err) +} +func (p *AccountRespDataRaw) writeField7(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("bucket", thrift.STRING, 7); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Bucket); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 7 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 7 end error: ", p), err) +} +func (p *AccountRespDataRaw) writeField8(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("userId", thrift.STRING, 8); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.UserId); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 8 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 8 end error: ", p), err) +} +func (p *AccountRespDataRaw) writeField9(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("scope", thrift.STRING, 9); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Scope); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 9 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 9 end error: ", p), err) +} +func (p *AccountRespDataRaw) writeField10(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("idToken", thrift.STRING, 10); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.IdToken); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 10 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 10 end error: ", p), err) +} +func (p *AccountRespDataRaw) writeField11(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("clientId", thrift.STRING, 11); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.ClientId); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 11 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 11 end error: ", p), err) +} +func (p *AccountRespDataRaw) writeField12(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("cloudUrl", thrift.STRING, 12); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.CloudUrl); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 12 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 12 end error: ", p), err) +} + +func (p *AccountRespDataRaw) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AccountRespDataRaw(%+v)", *p) + +} + +type AccountListReq struct { + User string `thrift:"User,1,required" form:"user,required" json:"user,required"` +} + +func NewAccountListReq() *AccountListReq { + return &AccountListReq{} +} + +func (p *AccountListReq) InitDefault() { +} + +func (p *AccountListReq) GetUser() (v string) { + return p.User +} + +var fieldIDToName_AccountListReq = map[int16]string{ + 1: "User", +} + +func (p *AccountListReq) Read(iprot thrift.TProtocol) (err error) { + var fieldTypeId thrift.TType + var fieldId int16 + var issetUser bool = false + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 1: + if fieldTypeId == thrift.STRING { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + issetUser = true + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + if !issetUser { + fieldId = 1 + goto RequiredFieldNotSetError + } + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_AccountListReq[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +RequiredFieldNotSetError: + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_AccountListReq[fieldId])) +} + +func (p *AccountListReq) ReadField1(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.User = _field + return nil +} + +func (p *AccountListReq) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("AccountListReq"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField1(oprot); err != nil { + fieldId = 1 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *AccountListReq) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("User", thrift.STRING, 1); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.User); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) +} + +func (p *AccountListReq) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AccountListReq(%+v)", *p) + +} + +type AccountListResp struct { + Code int32 `thrift:"code,1" form:"code" json:"code" query:"code"` + Message string `thrift:"message,2" form:"message" json:"message" query:"message"` + Data []*AccountListData `thrift:"data,3" form:"data" json:"data" query:"data"` +} + +func NewAccountListResp() *AccountListResp { + return &AccountListResp{} +} + +func (p *AccountListResp) InitDefault() { +} + +func (p *AccountListResp) GetCode() (v int32) { + return p.Code +} + +func (p *AccountListResp) GetMessage() (v string) { + return p.Message +} + +func (p *AccountListResp) GetData() (v []*AccountListData) { + return p.Data +} + +var fieldIDToName_AccountListResp = map[int16]string{ + 1: "code", + 2: "message", + 3: "data", +} + +func (p *AccountListResp) Read(iprot thrift.TProtocol) (err error) { + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 1: + if fieldTypeId == thrift.I32 { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 2: + if fieldTypeId == thrift.STRING { + if err = p.ReadField2(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 3: + if fieldTypeId == thrift.LIST { + if err = p.ReadField3(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_AccountListResp[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +} + +func (p *AccountListResp) ReadField1(iprot thrift.TProtocol) error { + + var _field int32 + if v, err := iprot.ReadI32(); err != nil { + return err + } else { + _field = v + } + p.Code = _field + return nil +} +func (p *AccountListResp) ReadField2(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Message = _field + return nil +} +func (p *AccountListResp) ReadField3(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin() + if err != nil { + return err + } + _field := make([]*AccountListData, 0, size) + values := make([]AccountListData, size) + for i := 0; i < size; i++ { + _elem := &values[i] + _elem.InitDefault() + + if err := _elem.Read(iprot); err != nil { + return err + } + + _field = append(_field, _elem) + } + if err := iprot.ReadListEnd(); err != nil { + return err + } + p.Data = _field + return nil +} + +func (p *AccountListResp) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("AccountListResp"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField1(oprot); err != nil { + fieldId = 1 + goto WriteFieldError + } + if err = p.writeField2(oprot); err != nil { + fieldId = 2 + goto WriteFieldError + } + if err = p.writeField3(oprot); err != nil { + fieldId = 3 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *AccountListResp) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("code", thrift.I32, 1); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteI32(p.Code); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) +} +func (p *AccountListResp) writeField2(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("message", thrift.STRING, 2); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Message); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) +} +func (p *AccountListResp) writeField3(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("data", thrift.LIST, 3); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Data)); err != nil { + return err + } + for _, v := range p.Data { + if err := v.Write(oprot); err != nil { + return err + } + } + if err := oprot.WriteListEnd(); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) +} + +func (p *AccountListResp) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AccountListResp(%+v)", *p) + +} + +type AccountListData struct { + Name string `thrift:"name,1" form:"name" json:"name" query:"name"` + Type string `thrift:"type,2" form:"type" json:"type" query:"type"` + Available bool `thrift:"available,3" form:"available" json:"available" query:"available"` + CreateAt int64 `thrift:"createAt,4" form:"createAt" json:"createAt" query:"createAt"` + ExpiresAt int64 `thrift:"expiresAt,5" form:"expiresAt" json:"expiresAt" query:"expiresAt"` +} + +func NewAccountListData() *AccountListData { + return &AccountListData{} +} + +func (p *AccountListData) InitDefault() { +} + +func (p *AccountListData) GetName() (v string) { + return p.Name +} + +func (p *AccountListData) GetType() (v string) { + return p.Type +} + +func (p *AccountListData) GetAvailable() (v bool) { + return p.Available +} + +func (p *AccountListData) GetCreateAt() (v int64) { + return p.CreateAt +} + +func (p *AccountListData) GetExpiresAt() (v int64) { + return p.ExpiresAt +} + +var fieldIDToName_AccountListData = map[int16]string{ + 1: "name", + 2: "type", + 3: "available", + 4: "createAt", + 5: "expiresAt", +} + +func (p *AccountListData) Read(iprot thrift.TProtocol) (err error) { + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 1: + if fieldTypeId == thrift.STRING { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 2: + if fieldTypeId == thrift.STRING { + if err = p.ReadField2(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 3: + if fieldTypeId == thrift.BOOL { + if err = p.ReadField3(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 4: + if fieldTypeId == thrift.I64 { + if err = p.ReadField4(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 5: + if fieldTypeId == thrift.I64 { + if err = p.ReadField5(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_AccountListData[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +} + +func (p *AccountListData) ReadField1(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Name = _field + return nil +} +func (p *AccountListData) ReadField2(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Type = _field + return nil +} +func (p *AccountListData) ReadField3(iprot thrift.TProtocol) error { + + var _field bool + if v, err := iprot.ReadBool(); err != nil { + return err + } else { + _field = v + } + p.Available = _field + return nil +} +func (p *AccountListData) ReadField4(iprot thrift.TProtocol) error { + + var _field int64 + if v, err := iprot.ReadI64(); err != nil { + return err + } else { + _field = v + } + p.CreateAt = _field + return nil +} +func (p *AccountListData) ReadField5(iprot thrift.TProtocol) error { + + var _field int64 + if v, err := iprot.ReadI64(); err != nil { + return err + } else { + _field = v + } + p.ExpiresAt = _field + return nil +} + +func (p *AccountListData) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("AccountListData"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField1(oprot); err != nil { + fieldId = 1 + goto WriteFieldError + } + if err = p.writeField2(oprot); err != nil { + fieldId = 2 + goto WriteFieldError + } + if err = p.writeField3(oprot); err != nil { + fieldId = 3 + goto WriteFieldError + } + if err = p.writeField4(oprot); err != nil { + fieldId = 4 + goto WriteFieldError + } + if err = p.writeField5(oprot); err != nil { + fieldId = 5 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *AccountListData) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Name); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) +} +func (p *AccountListData) writeField2(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("type", thrift.STRING, 2); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Type); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) +} +func (p *AccountListData) writeField3(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("available", thrift.BOOL, 3); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteBool(p.Available); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) +} +func (p *AccountListData) writeField4(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("createAt", thrift.I64, 4); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteI64(p.CreateAt); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) +} +func (p *AccountListData) writeField5(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("expiresAt", thrift.I64, 5); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteI64(p.ExpiresAt); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err) +} + +func (p *AccountListData) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AccountListData(%+v)", *p) + +} + +type AccountService interface { + GetAccount(ctx context.Context, request *AccountReq) (r *AccountResp, err error) + + GetList(ctx context.Context, request *AccountListReq) (r *AccountListResp, err error) +} + +type AccountServiceClient struct { + c thrift.TClient +} + +func NewAccountServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *AccountServiceClient { + return &AccountServiceClient{ + c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), + } +} + +func NewAccountServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *AccountServiceClient { + return &AccountServiceClient{ + c: thrift.NewTStandardClient(iprot, oprot), + } +} + +func NewAccountServiceClient(c thrift.TClient) *AccountServiceClient { + return &AccountServiceClient{ + c: c, + } +} + +func (p *AccountServiceClient) Client_() thrift.TClient { + return p.c +} + +func (p *AccountServiceClient) GetAccount(ctx context.Context, request *AccountReq) (r *AccountResp, err error) { + var _args AccountServiceGetAccountArgs + _args.Request = request + var _result AccountServiceGetAccountResult + if err = p.Client_().Call(ctx, "GetAccount", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *AccountServiceClient) GetList(ctx context.Context, request *AccountListReq) (r *AccountListResp, err error) { + var _args AccountServiceGetListArgs + _args.Request = request + var _result AccountServiceGetListResult + if err = p.Client_().Call(ctx, "GetList", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} + +type AccountServiceProcessor struct { + processorMap map[string]thrift.TProcessorFunction + handler AccountService +} + +func (p *AccountServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { + p.processorMap[key] = processor +} + +func (p *AccountServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { + processor, ok = p.processorMap[key] + return processor, ok +} + +func (p *AccountServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { + return p.processorMap +} + +func NewAccountServiceProcessor(handler AccountService) *AccountServiceProcessor { + self := &AccountServiceProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} + self.AddToProcessorMap("GetAccount", &accountServiceProcessorGetAccount{handler: handler}) + self.AddToProcessorMap("GetList", &accountServiceProcessorGetList{handler: handler}) + return self +} +func (p *AccountServiceProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + name, _, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return false, err + } + if processor, ok := p.GetProcessorFunction(name); ok { + return processor.Process(ctx, seqId, iprot, oprot) + } + iprot.Skip(thrift.STRUCT) + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name) + oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, x +} + +type accountServiceProcessorGetAccount struct { + handler AccountService +} + +func (p *accountServiceProcessorGetAccount) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := AccountServiceGetAccountArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("GetAccount", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err + } + + iprot.ReadMessageEnd() + var err2 error + result := AccountServiceGetAccountResult{} + var retval *AccountResp + if retval, err2 = p.handler.GetAccount(ctx, args.Request); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetAccount: "+err2.Error()) + oprot.WriteMessageBegin("GetAccount", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("GetAccount", thrift.REPLY, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(ctx); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type accountServiceProcessorGetList struct { + handler AccountService +} + +func (p *accountServiceProcessorGetList) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := AccountServiceGetListArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("GetList", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err + } + + iprot.ReadMessageEnd() + var err2 error + result := AccountServiceGetListResult{} + var retval *AccountListResp + if retval, err2 = p.handler.GetList(ctx, args.Request); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetList: "+err2.Error()) + oprot.WriteMessageBegin("GetList", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("GetList", thrift.REPLY, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(ctx); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type AccountServiceGetAccountArgs struct { + Request *AccountReq `thrift:"request,1"` +} + +func NewAccountServiceGetAccountArgs() *AccountServiceGetAccountArgs { + return &AccountServiceGetAccountArgs{} +} + +func (p *AccountServiceGetAccountArgs) InitDefault() { +} + +var AccountServiceGetAccountArgs_Request_DEFAULT *AccountReq + +func (p *AccountServiceGetAccountArgs) GetRequest() (v *AccountReq) { + if !p.IsSetRequest() { + return AccountServiceGetAccountArgs_Request_DEFAULT + } + return p.Request +} + +var fieldIDToName_AccountServiceGetAccountArgs = map[int16]string{ + 1: "request", +} + +func (p *AccountServiceGetAccountArgs) IsSetRequest() bool { + return p.Request != nil +} + +func (p *AccountServiceGetAccountArgs) Read(iprot thrift.TProtocol) (err error) { + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 1: + if fieldTypeId == thrift.STRUCT { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_AccountServiceGetAccountArgs[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +} + +func (p *AccountServiceGetAccountArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewAccountReq() + if err := _field.Read(iprot); err != nil { + return err + } + p.Request = _field + return nil +} + +func (p *AccountServiceGetAccountArgs) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("GetAccount_args"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField1(oprot); err != nil { + fieldId = 1 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *AccountServiceGetAccountArgs) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("request", thrift.STRUCT, 1); err != nil { + goto WriteFieldBeginError + } + if err := p.Request.Write(oprot); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) +} + +func (p *AccountServiceGetAccountArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AccountServiceGetAccountArgs(%+v)", *p) + +} + +type AccountServiceGetAccountResult struct { + Success *AccountResp `thrift:"success,0,optional"` +} + +func NewAccountServiceGetAccountResult() *AccountServiceGetAccountResult { + return &AccountServiceGetAccountResult{} +} + +func (p *AccountServiceGetAccountResult) InitDefault() { +} + +var AccountServiceGetAccountResult_Success_DEFAULT *AccountResp + +func (p *AccountServiceGetAccountResult) GetSuccess() (v *AccountResp) { + if !p.IsSetSuccess() { + return AccountServiceGetAccountResult_Success_DEFAULT + } + return p.Success +} + +var fieldIDToName_AccountServiceGetAccountResult = map[int16]string{ + 0: "success", +} + +func (p *AccountServiceGetAccountResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AccountServiceGetAccountResult) Read(iprot thrift.TProtocol) (err error) { + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 0: + if fieldTypeId == thrift.STRUCT { + if err = p.ReadField0(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_AccountServiceGetAccountResult[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +} + +func (p *AccountServiceGetAccountResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewAccountResp() + if err := _field.Read(iprot); err != nil { + return err + } + p.Success = _field + return nil +} + +func (p *AccountServiceGetAccountResult) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("GetAccount_result"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField0(oprot); err != nil { + fieldId = 0 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *AccountServiceGetAccountResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + goto WriteFieldBeginError + } + if err := p.Success.Write(oprot); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) +} + +func (p *AccountServiceGetAccountResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AccountServiceGetAccountResult(%+v)", *p) + +} + +type AccountServiceGetListArgs struct { + Request *AccountListReq `thrift:"request,1"` +} + +func NewAccountServiceGetListArgs() *AccountServiceGetListArgs { + return &AccountServiceGetListArgs{} +} + +func (p *AccountServiceGetListArgs) InitDefault() { +} + +var AccountServiceGetListArgs_Request_DEFAULT *AccountListReq + +func (p *AccountServiceGetListArgs) GetRequest() (v *AccountListReq) { + if !p.IsSetRequest() { + return AccountServiceGetListArgs_Request_DEFAULT + } + return p.Request +} + +var fieldIDToName_AccountServiceGetListArgs = map[int16]string{ + 1: "request", +} + +func (p *AccountServiceGetListArgs) IsSetRequest() bool { + return p.Request != nil +} + +func (p *AccountServiceGetListArgs) Read(iprot thrift.TProtocol) (err error) { + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 1: + if fieldTypeId == thrift.STRUCT { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_AccountServiceGetListArgs[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +} + +func (p *AccountServiceGetListArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewAccountListReq() + if err := _field.Read(iprot); err != nil { + return err + } + p.Request = _field + return nil +} + +func (p *AccountServiceGetListArgs) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("GetList_args"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField1(oprot); err != nil { + fieldId = 1 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *AccountServiceGetListArgs) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("request", thrift.STRUCT, 1); err != nil { + goto WriteFieldBeginError + } + if err := p.Request.Write(oprot); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) +} + +func (p *AccountServiceGetListArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AccountServiceGetListArgs(%+v)", *p) + +} + +type AccountServiceGetListResult struct { + Success *AccountListResp `thrift:"success,0,optional"` +} + +func NewAccountServiceGetListResult() *AccountServiceGetListResult { + return &AccountServiceGetListResult{} +} + +func (p *AccountServiceGetListResult) InitDefault() { +} + +var AccountServiceGetListResult_Success_DEFAULT *AccountListResp + +func (p *AccountServiceGetListResult) GetSuccess() (v *AccountListResp) { + if !p.IsSetSuccess() { + return AccountServiceGetListResult_Success_DEFAULT + } + return p.Success +} + +var fieldIDToName_AccountServiceGetListResult = map[int16]string{ + 0: "success", +} + +func (p *AccountServiceGetListResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *AccountServiceGetListResult) Read(iprot thrift.TProtocol) (err error) { + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 0: + if fieldTypeId == thrift.STRUCT { + if err = p.ReadField0(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_AccountServiceGetListResult[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +} + +func (p *AccountServiceGetListResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewAccountListResp() + if err := _field.Read(iprot); err != nil { + return err + } + p.Success = _field + return nil +} + +func (p *AccountServiceGetListResult) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("GetList_result"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField0(oprot); err != nil { + fieldId = 0 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *AccountServiceGetListResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + goto WriteFieldBeginError + } + if err := p.Success.Write(oprot); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) +} + +func (p *AccountServiceGetListResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("AccountServiceGetListResult(%+v)", *p) + +} diff --git a/framework/integration/pkg/hertz/biz/model/api/cookie/cookie.go b/framework/integration/pkg/hertz/biz/model/api/cookie/cookie.go new file mode 100644 index 000000000..821487373 --- /dev/null +++ b/framework/integration/pkg/hertz/biz/model/api/cookie/cookie.go @@ -0,0 +1,1626 @@ +// Code generated by thriftgo (0.4.2). DO NOT EDIT. + +package cookie + +import ( + "context" + "fmt" + "github.com/apache/thrift/lib/go/thrift" +) + +type CookieReq struct { + Domain string `thrift:"Domain,1,required" form:"domain,required" json:"domain,required"` + User string `thrift:"User,2,required" form:"user,required" json:"user,required"` +} + +func NewCookieReq() *CookieReq { + return &CookieReq{} +} + +func (p *CookieReq) InitDefault() { +} + +func (p *CookieReq) GetDomain() (v string) { + return p.Domain +} + +func (p *CookieReq) GetUser() (v string) { + return p.User +} + +var fieldIDToName_CookieReq = map[int16]string{ + 1: "Domain", + 2: "User", +} + +func (p *CookieReq) Read(iprot thrift.TProtocol) (err error) { + var fieldTypeId thrift.TType + var fieldId int16 + var issetDomain bool = false + var issetUser bool = false + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 1: + if fieldTypeId == thrift.STRING { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + issetDomain = true + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 2: + if fieldTypeId == thrift.STRING { + if err = p.ReadField2(iprot); err != nil { + goto ReadFieldError + } + issetUser = true + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + if !issetDomain { + fieldId = 1 + goto RequiredFieldNotSetError + } + + if !issetUser { + fieldId = 2 + goto RequiredFieldNotSetError + } + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CookieReq[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +RequiredFieldNotSetError: + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_CookieReq[fieldId])) +} + +func (p *CookieReq) ReadField1(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Domain = _field + return nil +} +func (p *CookieReq) ReadField2(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.User = _field + return nil +} + +func (p *CookieReq) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("CookieReq"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField1(oprot); err != nil { + fieldId = 1 + goto WriteFieldError + } + if err = p.writeField2(oprot); err != nil { + fieldId = 2 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *CookieReq) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("Domain", thrift.STRING, 1); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Domain); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) +} +func (p *CookieReq) writeField2(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("User", thrift.STRING, 2); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.User); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) +} + +func (p *CookieReq) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("CookieReq(%+v)", *p) + +} + +type CookieResp struct { + Code int32 `thrift:"code,1" form:"code" json:"code" query:"code"` + Message string `thrift:"message,2" form:"message" json:"message" query:"message"` + Data []*CookieRespData `thrift:"data,3" form:"data" json:"data" query:"data"` +} + +func NewCookieResp() *CookieResp { + return &CookieResp{} +} + +func (p *CookieResp) InitDefault() { +} + +func (p *CookieResp) GetCode() (v int32) { + return p.Code +} + +func (p *CookieResp) GetMessage() (v string) { + return p.Message +} + +func (p *CookieResp) GetData() (v []*CookieRespData) { + return p.Data +} + +var fieldIDToName_CookieResp = map[int16]string{ + 1: "code", + 2: "message", + 3: "data", +} + +func (p *CookieResp) Read(iprot thrift.TProtocol) (err error) { + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 1: + if fieldTypeId == thrift.I32 { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 2: + if fieldTypeId == thrift.STRING { + if err = p.ReadField2(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 3: + if fieldTypeId == thrift.LIST { + if err = p.ReadField3(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CookieResp[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +} + +func (p *CookieResp) ReadField1(iprot thrift.TProtocol) error { + + var _field int32 + if v, err := iprot.ReadI32(); err != nil { + return err + } else { + _field = v + } + p.Code = _field + return nil +} +func (p *CookieResp) ReadField2(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Message = _field + return nil +} +func (p *CookieResp) ReadField3(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin() + if err != nil { + return err + } + _field := make([]*CookieRespData, 0, size) + values := make([]CookieRespData, size) + for i := 0; i < size; i++ { + _elem := &values[i] + _elem.InitDefault() + + if err := _elem.Read(iprot); err != nil { + return err + } + + _field = append(_field, _elem) + } + if err := iprot.ReadListEnd(); err != nil { + return err + } + p.Data = _field + return nil +} + +func (p *CookieResp) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("CookieResp"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField1(oprot); err != nil { + fieldId = 1 + goto WriteFieldError + } + if err = p.writeField2(oprot); err != nil { + fieldId = 2 + goto WriteFieldError + } + if err = p.writeField3(oprot); err != nil { + fieldId = 3 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *CookieResp) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("code", thrift.I32, 1); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteI32(p.Code); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) +} +func (p *CookieResp) writeField2(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("message", thrift.STRING, 2); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Message); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) +} +func (p *CookieResp) writeField3(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("data", thrift.LIST, 3); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Data)); err != nil { + return err + } + for _, v := range p.Data { + if err := v.Write(oprot); err != nil { + return err + } + } + if err := oprot.WriteListEnd(); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) +} + +func (p *CookieResp) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("CookieResp(%+v)", *p) + +} + +type CookieRespData struct { + Domain string `thrift:"domain,1" form:"domain" json:"domain" query:"domain"` + Account string `thrift:"account,2" form:"account" json:"account" query:"account"` + Records []*CookieRespDataRaw `thrift:"records,3" form:"records" json:"records" query:"records"` +} + +func NewCookieRespData() *CookieRespData { + return &CookieRespData{} +} + +func (p *CookieRespData) InitDefault() { +} + +func (p *CookieRespData) GetDomain() (v string) { + return p.Domain +} + +func (p *CookieRespData) GetAccount() (v string) { + return p.Account +} + +func (p *CookieRespData) GetRecords() (v []*CookieRespDataRaw) { + return p.Records +} + +var fieldIDToName_CookieRespData = map[int16]string{ + 1: "domain", + 2: "account", + 3: "records", +} + +func (p *CookieRespData) Read(iprot thrift.TProtocol) (err error) { + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 1: + if fieldTypeId == thrift.STRING { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 2: + if fieldTypeId == thrift.STRING { + if err = p.ReadField2(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 3: + if fieldTypeId == thrift.LIST { + if err = p.ReadField3(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CookieRespData[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +} + +func (p *CookieRespData) ReadField1(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Domain = _field + return nil +} +func (p *CookieRespData) ReadField2(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Account = _field + return nil +} +func (p *CookieRespData) ReadField3(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin() + if err != nil { + return err + } + _field := make([]*CookieRespDataRaw, 0, size) + values := make([]CookieRespDataRaw, size) + for i := 0; i < size; i++ { + _elem := &values[i] + _elem.InitDefault() + + if err := _elem.Read(iprot); err != nil { + return err + } + + _field = append(_field, _elem) + } + if err := iprot.ReadListEnd(); err != nil { + return err + } + p.Records = _field + return nil +} + +func (p *CookieRespData) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("CookieRespData"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField1(oprot); err != nil { + fieldId = 1 + goto WriteFieldError + } + if err = p.writeField2(oprot); err != nil { + fieldId = 2 + goto WriteFieldError + } + if err = p.writeField3(oprot); err != nil { + fieldId = 3 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *CookieRespData) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("domain", thrift.STRING, 1); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Domain); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) +} +func (p *CookieRespData) writeField2(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("account", thrift.STRING, 2); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Account); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) +} +func (p *CookieRespData) writeField3(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("records", thrift.LIST, 3); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Records)); err != nil { + return err + } + for _, v := range p.Records { + if err := v.Write(oprot); err != nil { + return err + } + } + if err := oprot.WriteListEnd(); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) +} + +func (p *CookieRespData) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("CookieRespData(%+v)", *p) + +} + +type CookieRespDataRaw struct { + Domain string `thrift:"domain,1" form:"domain" json:"domain" query:"domain"` + Name string `thrift:"name,2" form:"name" json:"name" query:"name"` + Value string `thrift:"value,3" form:"value" json:"value" query:"value"` + Expires float64 `thrift:"expires,4" form:"expires" json:"expires" query:"expires"` + Path string `thrift:"path,5" form:"path" json:"path" query:"path"` + Secure bool `thrift:"secure,6" form:"secure" json:"secure" query:"secure"` + HttpOnly bool `thrift:"httpOnly,7" form:"httpOnly" json:"httpOnly" query:"httpOnly"` + SameSite string `thrift:"sameSite,8" form:"sameSite" json:"sameSite" query:"sameSite"` + Other string `thrift:"other,9" form:"other" json:"other" query:"other"` +} + +func NewCookieRespDataRaw() *CookieRespDataRaw { + return &CookieRespDataRaw{} +} + +func (p *CookieRespDataRaw) InitDefault() { +} + +func (p *CookieRespDataRaw) GetDomain() (v string) { + return p.Domain +} + +func (p *CookieRespDataRaw) GetName() (v string) { + return p.Name +} + +func (p *CookieRespDataRaw) GetValue() (v string) { + return p.Value +} + +func (p *CookieRespDataRaw) GetExpires() (v float64) { + return p.Expires +} + +func (p *CookieRespDataRaw) GetPath() (v string) { + return p.Path +} + +func (p *CookieRespDataRaw) GetSecure() (v bool) { + return p.Secure +} + +func (p *CookieRespDataRaw) GetHttpOnly() (v bool) { + return p.HttpOnly +} + +func (p *CookieRespDataRaw) GetSameSite() (v string) { + return p.SameSite +} + +func (p *CookieRespDataRaw) GetOther() (v string) { + return p.Other +} + +var fieldIDToName_CookieRespDataRaw = map[int16]string{ + 1: "domain", + 2: "name", + 3: "value", + 4: "expires", + 5: "path", + 6: "secure", + 7: "httpOnly", + 8: "sameSite", + 9: "other", +} + +func (p *CookieRespDataRaw) Read(iprot thrift.TProtocol) (err error) { + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 1: + if fieldTypeId == thrift.STRING { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 2: + if fieldTypeId == thrift.STRING { + if err = p.ReadField2(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 3: + if fieldTypeId == thrift.STRING { + if err = p.ReadField3(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 4: + if fieldTypeId == thrift.DOUBLE { + if err = p.ReadField4(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 5: + if fieldTypeId == thrift.STRING { + if err = p.ReadField5(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 6: + if fieldTypeId == thrift.BOOL { + if err = p.ReadField6(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 7: + if fieldTypeId == thrift.BOOL { + if err = p.ReadField7(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 8: + if fieldTypeId == thrift.STRING { + if err = p.ReadField8(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 9: + if fieldTypeId == thrift.STRING { + if err = p.ReadField9(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CookieRespDataRaw[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +} + +func (p *CookieRespDataRaw) ReadField1(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Domain = _field + return nil +} +func (p *CookieRespDataRaw) ReadField2(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Name = _field + return nil +} +func (p *CookieRespDataRaw) ReadField3(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Value = _field + return nil +} +func (p *CookieRespDataRaw) ReadField4(iprot thrift.TProtocol) error { + + var _field float64 + if v, err := iprot.ReadDouble(); err != nil { + return err + } else { + _field = v + } + p.Expires = _field + return nil +} +func (p *CookieRespDataRaw) ReadField5(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Path = _field + return nil +} +func (p *CookieRespDataRaw) ReadField6(iprot thrift.TProtocol) error { + + var _field bool + if v, err := iprot.ReadBool(); err != nil { + return err + } else { + _field = v + } + p.Secure = _field + return nil +} +func (p *CookieRespDataRaw) ReadField7(iprot thrift.TProtocol) error { + + var _field bool + if v, err := iprot.ReadBool(); err != nil { + return err + } else { + _field = v + } + p.HttpOnly = _field + return nil +} +func (p *CookieRespDataRaw) ReadField8(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.SameSite = _field + return nil +} +func (p *CookieRespDataRaw) ReadField9(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Other = _field + return nil +} + +func (p *CookieRespDataRaw) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("CookieRespDataRaw"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField1(oprot); err != nil { + fieldId = 1 + goto WriteFieldError + } + if err = p.writeField2(oprot); err != nil { + fieldId = 2 + goto WriteFieldError + } + if err = p.writeField3(oprot); err != nil { + fieldId = 3 + goto WriteFieldError + } + if err = p.writeField4(oprot); err != nil { + fieldId = 4 + goto WriteFieldError + } + if err = p.writeField5(oprot); err != nil { + fieldId = 5 + goto WriteFieldError + } + if err = p.writeField6(oprot); err != nil { + fieldId = 6 + goto WriteFieldError + } + if err = p.writeField7(oprot); err != nil { + fieldId = 7 + goto WriteFieldError + } + if err = p.writeField8(oprot); err != nil { + fieldId = 8 + goto WriteFieldError + } + if err = p.writeField9(oprot); err != nil { + fieldId = 9 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *CookieRespDataRaw) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("domain", thrift.STRING, 1); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Domain); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) +} +func (p *CookieRespDataRaw) writeField2(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("name", thrift.STRING, 2); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Name); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) +} +func (p *CookieRespDataRaw) writeField3(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("value", thrift.STRING, 3); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Value); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) +} +func (p *CookieRespDataRaw) writeField4(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("expires", thrift.DOUBLE, 4); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteDouble(p.Expires); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) +} +func (p *CookieRespDataRaw) writeField5(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("path", thrift.STRING, 5); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Path); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err) +} +func (p *CookieRespDataRaw) writeField6(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("secure", thrift.BOOL, 6); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteBool(p.Secure); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err) +} +func (p *CookieRespDataRaw) writeField7(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("httpOnly", thrift.BOOL, 7); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteBool(p.HttpOnly); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 7 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 7 end error: ", p), err) +} +func (p *CookieRespDataRaw) writeField8(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("sameSite", thrift.STRING, 8); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.SameSite); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 8 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 8 end error: ", p), err) +} +func (p *CookieRespDataRaw) writeField9(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("other", thrift.STRING, 9); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Other); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 9 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 9 end error: ", p), err) +} + +func (p *CookieRespDataRaw) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("CookieRespDataRaw(%+v)", *p) + +} + +type CookieService interface { + GetCookie(ctx context.Context, request *CookieReq) (r *CookieResp, err error) +} + +type CookieServiceClient struct { + c thrift.TClient +} + +func NewCookieServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *CookieServiceClient { + return &CookieServiceClient{ + c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), + } +} + +func NewCookieServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *CookieServiceClient { + return &CookieServiceClient{ + c: thrift.NewTStandardClient(iprot, oprot), + } +} + +func NewCookieServiceClient(c thrift.TClient) *CookieServiceClient { + return &CookieServiceClient{ + c: c, + } +} + +func (p *CookieServiceClient) Client_() thrift.TClient { + return p.c +} + +func (p *CookieServiceClient) GetCookie(ctx context.Context, request *CookieReq) (r *CookieResp, err error) { + var _args CookieServiceGetCookieArgs + _args.Request = request + var _result CookieServiceGetCookieResult + if err = p.Client_().Call(ctx, "GetCookie", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} + +type CookieServiceProcessor struct { + processorMap map[string]thrift.TProcessorFunction + handler CookieService +} + +func (p *CookieServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { + p.processorMap[key] = processor +} + +func (p *CookieServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { + processor, ok = p.processorMap[key] + return processor, ok +} + +func (p *CookieServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { + return p.processorMap +} + +func NewCookieServiceProcessor(handler CookieService) *CookieServiceProcessor { + self := &CookieServiceProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} + self.AddToProcessorMap("GetCookie", &cookieServiceProcessorGetCookie{handler: handler}) + return self +} +func (p *CookieServiceProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + name, _, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return false, err + } + if processor, ok := p.GetProcessorFunction(name); ok { + return processor.Process(ctx, seqId, iprot, oprot) + } + iprot.Skip(thrift.STRUCT) + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name) + oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, x +} + +type cookieServiceProcessorGetCookie struct { + handler CookieService +} + +func (p *cookieServiceProcessorGetCookie) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := CookieServiceGetCookieArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("GetCookie", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err + } + + iprot.ReadMessageEnd() + var err2 error + result := CookieServiceGetCookieResult{} + var retval *CookieResp + if retval, err2 = p.handler.GetCookie(ctx, args.Request); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetCookie: "+err2.Error()) + oprot.WriteMessageBegin("GetCookie", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("GetCookie", thrift.REPLY, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(ctx); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type CookieServiceGetCookieArgs struct { + Request *CookieReq `thrift:"request,1"` +} + +func NewCookieServiceGetCookieArgs() *CookieServiceGetCookieArgs { + return &CookieServiceGetCookieArgs{} +} + +func (p *CookieServiceGetCookieArgs) InitDefault() { +} + +var CookieServiceGetCookieArgs_Request_DEFAULT *CookieReq + +func (p *CookieServiceGetCookieArgs) GetRequest() (v *CookieReq) { + if !p.IsSetRequest() { + return CookieServiceGetCookieArgs_Request_DEFAULT + } + return p.Request +} + +var fieldIDToName_CookieServiceGetCookieArgs = map[int16]string{ + 1: "request", +} + +func (p *CookieServiceGetCookieArgs) IsSetRequest() bool { + return p.Request != nil +} + +func (p *CookieServiceGetCookieArgs) Read(iprot thrift.TProtocol) (err error) { + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 1: + if fieldTypeId == thrift.STRUCT { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CookieServiceGetCookieArgs[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +} + +func (p *CookieServiceGetCookieArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewCookieReq() + if err := _field.Read(iprot); err != nil { + return err + } + p.Request = _field + return nil +} + +func (p *CookieServiceGetCookieArgs) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("GetCookie_args"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField1(oprot); err != nil { + fieldId = 1 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *CookieServiceGetCookieArgs) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("request", thrift.STRUCT, 1); err != nil { + goto WriteFieldBeginError + } + if err := p.Request.Write(oprot); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) +} + +func (p *CookieServiceGetCookieArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("CookieServiceGetCookieArgs(%+v)", *p) + +} + +type CookieServiceGetCookieResult struct { + Success *CookieResp `thrift:"success,0,optional"` +} + +func NewCookieServiceGetCookieResult() *CookieServiceGetCookieResult { + return &CookieServiceGetCookieResult{} +} + +func (p *CookieServiceGetCookieResult) InitDefault() { +} + +var CookieServiceGetCookieResult_Success_DEFAULT *CookieResp + +func (p *CookieServiceGetCookieResult) GetSuccess() (v *CookieResp) { + if !p.IsSetSuccess() { + return CookieServiceGetCookieResult_Success_DEFAULT + } + return p.Success +} + +var fieldIDToName_CookieServiceGetCookieResult = map[int16]string{ + 0: "success", +} + +func (p *CookieServiceGetCookieResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *CookieServiceGetCookieResult) Read(iprot thrift.TProtocol) (err error) { + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 0: + if fieldTypeId == thrift.STRUCT { + if err = p.ReadField0(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CookieServiceGetCookieResult[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +} + +func (p *CookieServiceGetCookieResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewCookieResp() + if err := _field.Read(iprot); err != nil { + return err + } + p.Success = _field + return nil +} + +func (p *CookieServiceGetCookieResult) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("GetCookie_result"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField0(oprot); err != nil { + fieldId = 0 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *CookieServiceGetCookieResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + goto WriteFieldBeginError + } + if err := p.Success.Write(oprot); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) +} + +func (p *CookieServiceGetCookieResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("CookieServiceGetCookieResult(%+v)", *p) + +} diff --git a/framework/integration/pkg/hertz/biz/model/api/infisical/Infisical.go b/framework/integration/pkg/hertz/biz/model/api/infisical/Infisical.go new file mode 100644 index 000000000..27fd30ab2 --- /dev/null +++ b/framework/integration/pkg/hertz/biz/model/api/infisical/Infisical.go @@ -0,0 +1,62 @@ +package infisical + +type ErrorMessage struct { + StatusCode int `json:"statusCode"` + Message string `json:"message"` + Error string `json:"error"` +} + +type Header struct { + Code int `json:"code"` + Message string `json:"message"` +} + +type InfisicalResp struct { + Header + Data InfisicalData `json:"data"` +} + +type InfisicalListResp struct { + Header + Data []*InfisicalData `json:"data"` +} + +type InfisicalData struct { + Name string `json:"name"` + Value string `json:"value"` + Env string `json:"env"` +} + +// cookie +type CookieData struct { + Domain string `json:"domain"` + Account string `json:"account"` + Records []*CookieRecords `json:"records"` +} + +type CookieRecords struct { + Domain string `json:"domain"` + Name string `json:"name"` + Value string `json:"value"` + Expires float64 `json:"expires"` + Path string `json:"path"` + Secure bool `json:"secure"` + HttpOnly bool `json:"httpOnly"` + SameSite string `json:"sameSite"` + Other string `json:"other"` +} + +// account +type AccountDataRaw struct { + ExpiresAt int64 `json:"expires_at"` + RefreshToken string `json:"refresh_token"` + AccessToken string `json:"access_token"` + Endpoint string `json:"endpoint"` + Bucket string `json:"bucket"` + UserId string `json:"userid"` + Available bool `json:"available"` + CreateAt int64 `json:"create_at"` + Scope string `json:"scope"` + IdToken string `json:"id_token"` + ClientId string `json:"client_id"` +} diff --git a/framework/integration/pkg/hertz/biz/router/api/account/account.go b/framework/integration/pkg/hertz/biz/router/api/account/account.go new file mode 100644 index 000000000..6c665db54 --- /dev/null +++ b/framework/integration/pkg/hertz/biz/router/api/account/account.go @@ -0,0 +1,28 @@ +// Code generated by hertz generator. DO NOT EDIT. + +package account + +import ( + "github.com/cloudwego/hertz/pkg/app/server" + account "integration/pkg/hertz/biz/handler/api/account" +) + +/* + This file will register all the routes of the services in the master idl. + And it will update automatically when you use the "update" command for the idl. + So don't modify the contents of the file, or your code will be deleted when it is updated. +*/ + +// Register register routes based on the IDL 'api.${HTTP Method}' annotation. +func Register(r *server.Hertz) { + + root := r.Group("/", rootMw()...) + { + _api := root.Group("/api", _apiMw()...) + { + _account := _api.Group("/account", _accountMw()...) + _account.POST("/list", append(_getlistMw(), account.GetList)...) + _account.POST("/retrieve", append(_getaccountMw(), account.GetAccount)...) + } + } +} diff --git a/framework/integration/pkg/hertz/biz/router/api/account/middleware.go b/framework/integration/pkg/hertz/biz/router/api/account/middleware.go new file mode 100644 index 000000000..dab37fb10 --- /dev/null +++ b/framework/integration/pkg/hertz/biz/router/api/account/middleware.go @@ -0,0 +1,32 @@ +// Code generated by hertz generator. + +package account + +import ( + "github.com/cloudwego/hertz/pkg/app" +) + +func rootMw() []app.HandlerFunc { + // your code... + return nil +} + +func _apiMw() []app.HandlerFunc { + // your code... + return nil +} + +func _accountMw() []app.HandlerFunc { + // your code... + return nil +} + +func _getaccountMw() []app.HandlerFunc { + // your code... + return nil +} + +func _getlistMw() []app.HandlerFunc { + // your code... + return nil +} diff --git a/framework/integration/pkg/hertz/biz/router/api/cookie/cookie.go b/framework/integration/pkg/hertz/biz/router/api/cookie/cookie.go new file mode 100644 index 000000000..4d19173ba --- /dev/null +++ b/framework/integration/pkg/hertz/biz/router/api/cookie/cookie.go @@ -0,0 +1,27 @@ +// Code generated by hertz generator. DO NOT EDIT. + +package cookie + +import ( + "github.com/cloudwego/hertz/pkg/app/server" + cookie "integration/pkg/hertz/biz/handler/api/cookie" +) + +/* + This file will register all the routes of the services in the master idl. + And it will update automatically when you use the "update" command for the idl. + So don't modify the contents of the file, or your code will be deleted when it is updated. +*/ + +// Register register routes based on the IDL 'api.${HTTP Method}' annotation. +func Register(r *server.Hertz) { + + root := r.Group("/", rootMw()...) + { + _api := root.Group("/api", _apiMw()...) + { + _cookie := _api.Group("/cookie", _cookieMw()...) + _cookie.POST("/retrieve", append(_getcookieMw(), cookie.GetCookie)...) + } + } +} diff --git a/framework/integration/pkg/hertz/biz/router/api/cookie/middleware.go b/framework/integration/pkg/hertz/biz/router/api/cookie/middleware.go new file mode 100644 index 000000000..e5e678ff6 --- /dev/null +++ b/framework/integration/pkg/hertz/biz/router/api/cookie/middleware.go @@ -0,0 +1,27 @@ +// Code generated by hertz generator. + +package cookie + +import ( + "github.com/cloudwego/hertz/pkg/app" +) + +func rootMw() []app.HandlerFunc { + // your code... + return nil +} + +func _apiMw() []app.HandlerFunc { + // your code... + return nil +} + +func _cookieMw() []app.HandlerFunc { + // your code... + return nil +} + +func _getcookieMw() []app.HandlerFunc { + // your code... + return nil +} diff --git a/framework/integration/pkg/hertz/biz/router/middleware.go b/framework/integration/pkg/hertz/biz/router/middleware.go new file mode 100644 index 000000000..78adc6dc7 --- /dev/null +++ b/framework/integration/pkg/hertz/biz/router/middleware.go @@ -0,0 +1,32 @@ +package router + +import ( + "context" + "time" + + commonutils "integration/pkg/utils" + + "github.com/cloudwego/hertz/pkg/app" + "k8s.io/klog/v2" +) + +var excludePaths = []string{"/ping"} + +func TimingMiddleware() app.HandlerFunc { + return func(ctx context.Context, c *app.RequestContext) { + if !commonutils.ListContains(excludePaths, string(c.Request.Path())) { + start := time.Now() + + path := c.Path() + + klog.Infof("%s %s starts at %v", string(c.Method()), path, start.Format("2006-01-02 15:04:05")) + + defer func() { + elapsed := time.Since(start) + klog.Infof("%s %s execution time: %v", string(c.Method()), path, elapsed) + }() + } + c.Next(ctx) + + } +} diff --git a/framework/integration/pkg/hertz/biz/router/register.go b/framework/integration/pkg/hertz/biz/router/register.go new file mode 100644 index 000000000..77f57884d --- /dev/null +++ b/framework/integration/pkg/hertz/biz/router/register.go @@ -0,0 +1,19 @@ +// Code generated by hertz generator. DO NOT EDIT. + +package router + +import ( + api_account "integration/pkg/hertz/biz/router/api/account" + api_cookie "integration/pkg/hertz/biz/router/api/cookie" + + "github.com/cloudwego/hertz/pkg/app/server" +) + +// GeneratedRegister registers routers generated by IDL. +func GeneratedRegister(r *server.Hertz) { + //INSERT_POINT: DO NOT DELETE THIS LINE! + + api_cookie.Register(r) + + api_account.Register(r) +} diff --git a/framework/integration/pkg/hertz/build.sh b/framework/integration/pkg/hertz/build.sh new file mode 100644 index 000000000..f1ba589ca --- /dev/null +++ b/framework/integration/pkg/hertz/build.sh @@ -0,0 +1,6 @@ +#!/bin/bash +RUN_NAME=hertz_service +mkdir -p output/bin +cp script/* output 2>/dev/null +chmod +x output/bootstrap.sh +go build -o output/bin/${RUN_NAME} \ No newline at end of file diff --git a/framework/integration/pkg/hertz/hertz.go b/framework/integration/pkg/hertz/hertz.go new file mode 100644 index 000000000..dff3a44b9 --- /dev/null +++ b/framework/integration/pkg/hertz/hertz.go @@ -0,0 +1,34 @@ +package hertz + +import ( + "fmt" + router "integration/pkg/hertz/biz/router" + "time" + + "github.com/cloudwego/hertz/pkg/app/server" + "github.com/cloudwego/hertz/pkg/network/standard" + "k8s.io/klog/v2" +) + +const DefaultPort = "8090" + +func HertzServer() { + h := server.Default( + server.WithHostPorts(fmt.Sprintf(":%s", DefaultPort)), + server.WithMaxKeepBodySize(2<<20), + server.WithTransport(standard.NewTransporter), + server.WithReadTimeout(5*time.Minute), + server.WithWriteTimeout(5*time.Minute), + server.WithKeepAliveTimeout(3*time.Minute), + server.WithStreamBody(false), + server.WithReadBufferSize(64*1024), + server.WithALPN(true), + server.WithIdleTimeout(200*time.Second), + ) + + h.Use(router.TimingMiddleware()) + + register(h) + h.Spin() + klog.Info("hertz server started") +} diff --git a/framework/integration/pkg/hertz/idl/account.thrift b/framework/integration/pkg/hertz/idl/account.thrift new file mode 100644 index 000000000..488a9c9c4 --- /dev/null +++ b/framework/integration/pkg/hertz/idl/account.thrift @@ -0,0 +1,57 @@ +namespace go api.account + +struct AccountReq { + 1: required string Name (api.body="name"); + 2: required string Type (api.body="type"); + 3: required string User (api.body="user"); +} + +struct AccountResp { + 1: i32 code; + 2: string message; + 3: AccountRespData data; +} + +struct AccountRespData { + 1: string name; + 2: string type; + 3: AccountRespDataRaw rawData; +} + +struct AccountRespDataRaw { + 1: string accessToken; + 2: string refreshToken; + 3: i64 expiresAt; + 4: i64 createAt; + 5: bool available; + 6: string endpoint (go.tag='json:"endpoint,omitempty"'); + 7: string bucket (go.tag='json:"bucket,omitempty"'); + 8: string userId (go.tag='json:"userId,omitempty"'); + 9: string scope (go.tag='json:"scope,omitempty"'); + 10: string idToken (go.tag='json:"idToken,omitempty"'); + 11: string clientId (go.tag='json:"clientId,omitempty"'); + 12: string cloudUrl (go.tag='json:"cloudUrl,omitempty"'); +} + +struct AccountListReq { + 1: required string User (api.body="user"); +} + +struct AccountListResp { + 1: i32 code; + 2: string message; + 3: list data; +} + +struct AccountListData { + 1: string name; + 2: string type; + 3: bool available; + 4: i64 createAt; + 5: i64 expiresAt; +} + +service AccountService { + AccountResp GetAccount(1: AccountReq request) (api.post="/api/account/retrieve"); + AccountListResp GetList(1: AccountListReq request) (api.post="/api/account/list"); +} \ No newline at end of file diff --git a/framework/integration/pkg/hertz/idl/cookie.thrift b/framework/integration/pkg/hertz/idl/cookie.thrift new file mode 100644 index 000000000..b9087c952 --- /dev/null +++ b/framework/integration/pkg/hertz/idl/cookie.thrift @@ -0,0 +1,34 @@ +namespace go api.cookie + +struct CookieReq { + 1: required string Domain (api.body="domain"); + 2: required string User (api.body="user"); +} + +struct CookieResp { + 1: i32 code; + 2: string message; + 3: list data; +} + +struct CookieRespData { + 1: string domain; + 2: string account; + 3: list records; +} + +struct CookieRespDataRaw { + 1: string domain; + 2: string name; + 3: string value; + 4: double expires; + 5: string path; + 6: bool secure; + 7: bool httpOnly; + 8: string sameSite; + 9: string other; +} + +service CookieService { + CookieResp GetCookie(1: CookieReq request) (api.post="/api/cookie/retrieve"); +} \ No newline at end of file diff --git a/framework/integration/pkg/hertz/router.go b/framework/integration/pkg/hertz/router.go new file mode 100644 index 000000000..ca8f3345e --- /dev/null +++ b/framework/integration/pkg/hertz/router.go @@ -0,0 +1,16 @@ +// Code generated by hertz generator. + +package hertz + +import ( + handler "integration/pkg/hertz/biz/handler" + + "github.com/cloudwego/hertz/pkg/app/server" +) + +// customizeRegister registers customize routers. +func customizedRegister(r *server.Hertz) { + r.GET("/ping", handler.Ping) + + // your code ... +} diff --git a/framework/integration/pkg/hertz/router_gen.go b/framework/integration/pkg/hertz/router_gen.go new file mode 100644 index 000000000..2aed7109d --- /dev/null +++ b/framework/integration/pkg/hertz/router_gen.go @@ -0,0 +1,17 @@ +// Code generated by hertz generator. DO NOT EDIT. + +package hertz + +import ( + router "integration/pkg/hertz/biz/router" + + "github.com/cloudwego/hertz/pkg/app/server" +) + +// register registers all routers. +func register(r *server.Hertz) { + + router.GeneratedRegister(r) + + customizedRegister(r) +} diff --git a/framework/integration/pkg/hertz/script/bootstrap.sh b/framework/integration/pkg/hertz/script/bootstrap.sh new file mode 100644 index 000000000..3f3fc1afa --- /dev/null +++ b/framework/integration/pkg/hertz/script/bootstrap.sh @@ -0,0 +1,5 @@ +#!/bin/bash +CURDIR=$(cd $(dirname $0); pwd) +BinaryName=hertz_service +echo "$CURDIR/bin/${BinaryName}" +exec $CURDIR/bin/${BinaryName} \ No newline at end of file diff --git a/framework/integration/pkg/utils/request.go b/framework/integration/pkg/utils/request.go new file mode 100644 index 000000000..5dabffb24 --- /dev/null +++ b/framework/integration/pkg/utils/request.go @@ -0,0 +1,18 @@ +package utils + +import ( + "time" + + "github.com/go-resty/resty/v2" +) + +var RestClient *resty.Client + +func init() { + var envDebug = GetenvOrDefault("DEBUG", "false") + var debug = false + if envDebug == "true" { + debug = true + } + RestClient = resty.New().SetTimeout(15 * time.Second).SetDebug(debug) +} diff --git a/framework/integration/pkg/utils/utils.go b/framework/integration/pkg/utils/utils.go new file mode 100644 index 000000000..ed22f60be --- /dev/null +++ b/framework/integration/pkg/utils/utils.go @@ -0,0 +1,21 @@ +package utils + +import "os" + +func GetenvOrDefault(env string, d string) string { + v := os.Getenv(env) + if v == "" { + return d + } + + return v +} + +func ListContains[T comparable](items []T, v T) bool { + for _, item := range items { + if v == item { + return true + } + } + return false +}