refactor: integrate module integration into main repo (#2212)
This commit is contained in:
58
.github/workflows/module_integration_publish_docker.yaml
vendored
Normal file
58
.github/workflows/module_integration_publish_docker.yaml
vendored
Normal file
@@ -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
|
||||
24
framework/integration/Dockerfile
Normal file
24
framework/integration/Dockerfile
Normal file
@@ -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"]
|
||||
35
framework/integration/cmd/server/main.go
Normal file
35
framework/integration/cmd/server/main.go
Normal file
@@ -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)
|
||||
}
|
||||
}
|
||||
84
framework/integration/go.mod
Normal file
84
framework/integration/go.mod
Normal file
@@ -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
|
||||
)
|
||||
284
framework/integration/go.sum
Normal file
284
framework/integration/go.sum
Normal file
@@ -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=
|
||||
20
framework/integration/pkg/constant/constant.go
Normal file
20
framework/integration/pkg/constant/constant.go
Normal file
@@ -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
|
||||
)
|
||||
39
framework/integration/pkg/hertz/.gitignore
vendored
Normal file
39
framework/integration/pkg/hertz/.gitignore
vendored
Normal file
@@ -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
|
||||
6
framework/integration/pkg/hertz/.hz
Normal file
6
framework/integration/pkg/hertz/.hz
Normal file
@@ -0,0 +1,6 @@
|
||||
// Code generated by hz. DO NOT EDIT.
|
||||
|
||||
hz version: v0.9.7
|
||||
handlerDir: ""
|
||||
modelDir: ""
|
||||
routerDir: ""
|
||||
@@ -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
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
39
framework/integration/pkg/hertz/biz/handler/handler.go
Normal file
39
framework/integration/pkg/hertz/biz/handler/handler.go
Normal file
@@ -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)
|
||||
}
|
||||
19
framework/integration/pkg/hertz/biz/handler/ping.go
Normal file
19
framework/integration/pkg/hertz/biz/handler/ping.go
Normal file
@@ -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",
|
||||
})
|
||||
}
|
||||
2852
framework/integration/pkg/hertz/biz/model/api/account/account.go
Normal file
2852
framework/integration/pkg/hertz/biz/model/api/account/account.go
Normal file
File diff suppressed because it is too large
Load Diff
1626
framework/integration/pkg/hertz/biz/model/api/cookie/cookie.go
Normal file
1626
framework/integration/pkg/hertz/biz/model/api/cookie/cookie.go
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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"`
|
||||
}
|
||||
@@ -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)...)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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)...)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
32
framework/integration/pkg/hertz/biz/router/middleware.go
Normal file
32
framework/integration/pkg/hertz/biz/router/middleware.go
Normal file
@@ -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)
|
||||
|
||||
}
|
||||
}
|
||||
19
framework/integration/pkg/hertz/biz/router/register.go
Normal file
19
framework/integration/pkg/hertz/biz/router/register.go
Normal file
@@ -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)
|
||||
}
|
||||
6
framework/integration/pkg/hertz/build.sh
Normal file
6
framework/integration/pkg/hertz/build.sh
Normal file
@@ -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}
|
||||
34
framework/integration/pkg/hertz/hertz.go
Normal file
34
framework/integration/pkg/hertz/hertz.go
Normal file
@@ -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")
|
||||
}
|
||||
57
framework/integration/pkg/hertz/idl/account.thrift
Normal file
57
framework/integration/pkg/hertz/idl/account.thrift
Normal file
@@ -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<AccountListData> 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");
|
||||
}
|
||||
34
framework/integration/pkg/hertz/idl/cookie.thrift
Normal file
34
framework/integration/pkg/hertz/idl/cookie.thrift
Normal file
@@ -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<CookieRespData> data;
|
||||
}
|
||||
|
||||
struct CookieRespData {
|
||||
1: string domain;
|
||||
2: string account;
|
||||
3: list<CookieRespDataRaw> 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");
|
||||
}
|
||||
16
framework/integration/pkg/hertz/router.go
Normal file
16
framework/integration/pkg/hertz/router.go
Normal file
@@ -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 ...
|
||||
}
|
||||
17
framework/integration/pkg/hertz/router_gen.go
Normal file
17
framework/integration/pkg/hertz/router_gen.go
Normal file
@@ -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)
|
||||
}
|
||||
5
framework/integration/pkg/hertz/script/bootstrap.sh
Normal file
5
framework/integration/pkg/hertz/script/bootstrap.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
CURDIR=$(cd $(dirname $0); pwd)
|
||||
BinaryName=hertz_service
|
||||
echo "$CURDIR/bin/${BinaryName}"
|
||||
exec $CURDIR/bin/${BinaryName}
|
||||
18
framework/integration/pkg/utils/request.go
Normal file
18
framework/integration/pkg/utils/request.go
Normal file
@@ -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)
|
||||
}
|
||||
21
framework/integration/pkg/utils/utils.go
Normal file
21
framework/integration/pkg/utils/utils.go
Normal file
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user