diff --git a/.github/workflows/capabilities.yaml b/.github/workflows/capabilities.yaml index a703c026..51a8df75 100644 --- a/.github/workflows/capabilities.yaml +++ b/.github/workflows/capabilities.yaml @@ -1,4 +1,4 @@ -name: Generate connector capabilities +name: Generate capabilities and config schema on: push: @@ -6,7 +6,8 @@ on: - main jobs: - calculate-capabilities: + generate_outputs: + if: github.actor != 'github-actions[bot]' runs-on: ubuntu-latest steps: @@ -18,19 +19,20 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version-file: 'go.mod' + go-version-file: "go.mod" - name: Build run: go build -o connector ./cmd/baton-sendgrid - - name: Run and save output + - name: Run and save capabilities and config output env: BATON_SENDGRID_API_KEY: "${{ secrets.BATON_SENDGRID_API_KEY }}" - run: ./connector capabilities > baton_capabilities.json + run: ./connector capabilities-and-config > capabilities_and_config.yaml - name: Commit changes uses: EndBug/add-and-commit@v9 with: default_author: github_actions - message: 'Updating baton capabilities.' - add: 'baton_capabilities.json' \ No newline at end of file + message: "Updating baton config schema and capabilities." + add: | + capabilities_and_config.yaml \ No newline at end of file diff --git a/.github/workflows/capabilities_and_config.yaml b/.github/workflows/capabilities_and_config.yaml new file mode 100644 index 00000000..8aae7bb9 --- /dev/null +++ b/.github/workflows/capabilities_and_config.yaml @@ -0,0 +1,40 @@ +name: Generate capabilities and config schema + +on: + push: + branches: + - main + +jobs: + generate_outputs: + if: github.actor != 'github-actions[bot]' + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + token: ${{ secrets.RELENG_GITHUB_TOKEN }} + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: "go.mod" + + - name: Build + run: go build -o connector ./cmd/baton-sendgrid + + - name: Run and save config output + run: ./connector config > config_schema.json + + - name: Run and save capabilities output + run: ./connector capabilities > baton_capabilities.json + + - name: Commit changes + uses: EndBug/add-and-commit@v9 + with: + default_author: github_actions + message: "Updating baton config schema and capabilities." + add: | + config_schema.json + baton_capabilities.json diff --git a/.gitignore b/.gitignore index b2118062..466748b6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ *.so *.dylib *.c1z +/baton-sendgrid # Test binary, built with `go test -c` *.test diff --git a/Makefile b/Makefile index 8ff106f3..0b59f939 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ GOOS = $(shell go env GOOS) GOARCH = $(shell go env GOARCH) BUILD_DIR = dist/${GOOS}_${GOARCH} +GENERATED_CONF := pkg/config/conf.gen.go ifeq ($(GOOS),windows) OUTPUT_PATH = ${BUILD_DIR}/baton-sendgrid.exe @@ -8,9 +9,22 @@ else OUTPUT_PATH = ${BUILD_DIR}/baton-sendgrid endif +# Set the build tag conditionally based on ENABLE_LAMBDA +ifdef BATON_LAMBDA_SUPPORT + BUILD_TAGS=-tags baton_lambda_support +else + BUILD_TAGS= +endif + .PHONY: build -build: - go build -o ${OUTPUT_PATH} ./cmd/baton-sendgrid +build: $(GENERATED_CONF) + go build ${BUILD_TAGS} -o ${OUTPUT_PATH} ./cmd/baton-sendgrid + +$(GENERATED_CONF): pkg/config/config.go go.mod + @echo "Generating $(GENERATED_CONF)..." + go generate ./pkg/config + +generate: $(GENERATED_CONF) .PHONY: update-deps update-deps: @@ -18,8 +32,8 @@ update-deps: go mod tidy -v go mod vendor -.PHONY: add-dep -add-dep: +.PHONY: add-deps +add-deps: go mod tidy -v go mod vendor diff --git a/cmd/baton-sendgrid/config_test.go b/cmd/baton-sendgrid/config_test.go deleted file mode 100644 index 3b6c2ab7..00000000 --- a/cmd/baton-sendgrid/config_test.go +++ /dev/null @@ -1,20 +0,0 @@ -package main - -import ( - "testing" - - "github.com/conductorone/baton-sdk/pkg/field" - "github.com/conductorone/baton-sdk/pkg/test" -) - -func TestConfigs(t *testing.T) { - configurationSchema := field.NewConfiguration( - ConfigurationFields, - ) - - testCases := []test.TestCase{ - // Add test cases here. - } - - test.ExerciseTestCases(t, configurationSchema, ValidateConfig, testCases) -} diff --git a/cmd/baton-sendgrid/main.go b/cmd/baton-sendgrid/main.go index 2239c3b7..362b54b8 100644 --- a/cmd/baton-sendgrid/main.go +++ b/cmd/baton-sendgrid/main.go @@ -2,84 +2,23 @@ package main import ( "context" - "fmt" - "os" - "github.com/conductorone/baton-sdk/pkg/config" - "github.com/conductorone/baton-sdk/pkg/connectorbuilder" - "github.com/conductorone/baton-sdk/pkg/field" - "github.com/conductorone/baton-sdk/pkg/types" + cfg "github.com/conductorone/baton-sendgrid/pkg/config" "github.com/conductorone/baton-sendgrid/pkg/connector" - "github.com/conductorone/baton-sendgrid/pkg/connector/client" - "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" - "github.com/spf13/viper" - "go.uber.org/zap" + "github.com/conductorone/baton-sdk/pkg/config" + "github.com/conductorone/baton-sdk/pkg/connectorrunner" ) var version = "dev" func main() { ctx := context.Background() - - _, cmd, err := config.DefineConfiguration( - ctx, + config.RunConnector(ctx, "baton-sendgrid", - getConnector, - field.Configuration{ - Fields: ConfigurationFields, - }, + version, + cfg.Config, + connector.New, + connectorrunner.WithSessionStoreEnabled(), + connectorrunner.WithDefaultCapabilitiesConnectorBuilderV2(&connector.Connector{}), ) - if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } - - cmd.Version = version - - err = cmd.Execute() - if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } -} - -func getConnector(ctx context.Context, v *viper.Viper) (types.ConnectorServer, error) { - l := ctxzap.Extract(ctx) - if err := ValidateConfig(v); err != nil { - return nil, err - } - - sendGridApyKey := v.GetString(SendGridApiKeyField.GetName()) - sendgridRegion := v.GetString(SendGridRegionField.GetName()) - sendgridIgnoreSubusers := v.GetBool(IgnoreSubusers.GetName()) - - var baseUrl string - - switch sendgridRegion { - case "eu": - baseUrl = client.SendGridEUBaseUrl - case "global": - baseUrl = client.SendGridBaseUrl - default: - baseUrl = client.SendGridBaseUrl - l.Warn("invalid sendgrid region, using the default global URL", zap.String("region", sendgridRegion)) - } - - sendGridCliet, err := client.NewClient(ctx, baseUrl, sendGridApyKey) - if err != nil { - l.Error("error creating sendgrid client", zap.Error(err)) - return nil, err - } - - cb, err := connector.New(ctx, sendGridCliet, sendgridIgnoreSubusers) - if err != nil { - l.Error("error creating connector", zap.Error(err)) - return nil, err - } - connector, err := connectorbuilder.NewConnector(ctx, cb) - if err != nil { - l.Error("error creating connector", zap.Error(err)) - return nil, err - } - return connector, nil } diff --git a/go.mod b/go.mod index 375a525f..885fa26f 100644 --- a/go.mod +++ b/go.mod @@ -3,9 +3,8 @@ module github.com/conductorone/baton-sendgrid go 1.25.2 require ( - github.com/conductorone/baton-sdk v0.5.25 + github.com/conductorone/baton-sdk v0.7.10 github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 - github.com/spf13/viper v1.19.0 go.uber.org/zap v1.27.0 ) @@ -39,11 +38,10 @@ require ( github.com/conductorone/dpop v0.2.3 // indirect github.com/conductorone/dpop/integrations/dpop_grpc v0.2.3 // indirect github.com/conductorone/dpop/integrations/dpop_oauth2 v0.2.3 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/deckarep/golang-set/v2 v2.7.0 // indirect github.com/doug-martin/goqu/v9 v9.19.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/ebitengine/purego v0.8.4 // indirect + github.com/ebitengine/purego v0.9.1 // indirect github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect github.com/fsnotify/fsnotify v1.8.0 // indirect github.com/glebarez/go-sqlite v1.22.0 // indirect @@ -65,7 +63,6 @@ require ( github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/ncruces/go-strftime v0.1.9 // indirect github.com/pelletier/go-toml/v2 v2.2.3 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/pquerna/cachecontrol v0.2.0 // indirect github.com/pquerna/xjwt v0.3.0 // indirect @@ -74,16 +71,17 @@ require ( github.com/sagikazarmark/locafero v0.7.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/segmentio/ksuid v1.0.4 // indirect - github.com/shirou/gopsutil/v4 v4.25.8 // indirect + github.com/shirou/gopsutil/v4 v4.25.11 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.12.0 // indirect github.com/spf13/cast v1.7.1 // indirect github.com/spf13/cobra v1.8.1 // indirect github.com/spf13/pflag v1.0.6 // indirect - github.com/stretchr/testify v1.11.1 // indirect + github.com/spf13/viper v1.19.0 // indirect + github.com/stretchr/objx v0.5.2 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/tklauser/go-sysconf v0.3.15 // indirect - github.com/tklauser/numcpus v0.10.0 // indirect + github.com/tklauser/go-sysconf v0.3.16 // indirect + github.com/tklauser/numcpus v0.11.0 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect go.opentelemetry.io/contrib/bridges/otelzap v0.10.0 // indirect @@ -102,12 +100,14 @@ require ( go.uber.org/ratelimit v0.3.1 // indirect golang.org/x/crypto v0.34.0 // indirect golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c // indirect + golang.org/x/mod v0.23.0 // indirect golang.org/x/net v0.35.0 // indirect golang.org/x/oauth2 v0.33.0 // indirect golang.org/x/sync v0.11.0 // indirect - golang.org/x/sys v0.37.0 // indirect + golang.org/x/sys v0.38.0 // indirect golang.org/x/term v0.29.0 // indirect golang.org/x/text v0.22.0 // indirect + golang.org/x/tools v0.30.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20250218202821-56aae31c358a // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250219182151-9fdb1cabc7b2 // indirect google.golang.org/grpc v1.71.0 // indirect diff --git a/go.sum b/go.sum index 29dd60f4..a9aee930 100644 --- a/go.sum +++ b/go.sum @@ -60,8 +60,8 @@ github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyY github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/conductorone/baton-sdk v0.5.25 h1:G0+MVkqwB4lGF0FbHDFh1Zt1fPsqn7gGGQWJx88w58Q= -github.com/conductorone/baton-sdk v0.5.25/go.mod h1:TQuaFYyonGW1Xblxjm+qQE3XsJGAZvTMPGaO4c4Yv6E= +github.com/conductorone/baton-sdk v0.7.10 h1:eK/RTU8CZyTosYSNYmDzfAahGnxqpOq6rheBcwTx7w0= +github.com/conductorone/baton-sdk v0.7.10/go.mod h1:9S5feBOuIJxlNdGmkv3ObkCNHbVyOHr6foNrIrk+d4Y= github.com/conductorone/dpop v0.2.3 h1:s91U3845GHQ6P6FWrdNr2SEOy1ES/jcFs1JtKSl2S+o= github.com/conductorone/dpop v0.2.3/go.mod h1:gyo8TtzB9SCFCsjsICH4IaLZ7y64CcrDXMOPBwfq/3s= github.com/conductorone/dpop/integrations/dpop_grpc v0.2.3 h1:kLMCNIh0Mo2vbvvkCmJ3ixsPbXEJ6HPcW53Ku9yje3s= @@ -80,8 +80,8 @@ github.com/doug-martin/goqu/v9 v9.19.0 h1:PD7t1X3tRcUiSdc5TEyOFKujZA5gs3VSA7wxSv github.com/doug-martin/goqu/v9 v9.19.0/go.mod h1:nf0Wc2/hV3gYK9LiyqIrzBEVGlI8qW3GuDCEobC4wBQ= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/ebitengine/purego v0.8.4 h1:CF7LEKg5FFOsASUj0+QwaXf8Ht6TlFxg09+S9wz0omw= -github.com/ebitengine/purego v0.8.4/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= +github.com/ebitengine/purego v0.9.1 h1:a/k2f2HQU3Pi399RPW1MOaZyhKJL9w/xFpKAg4q1s0A= +github.com/ebitengine/purego v0.9.1/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -192,8 +192,8 @@ github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6g github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/segmentio/ksuid v1.0.4 h1:sBo2BdShXjmcugAMwjugoGUdUV0pcxY5mW4xKRn3v4c= github.com/segmentio/ksuid v1.0.4/go.mod h1:/XUiZBD3kVx5SmUOl55voK5yeAbBNNIed+2O73XgrPE= -github.com/shirou/gopsutil/v4 v4.25.8 h1:NnAsw9lN7587WHxjJA9ryDnqhJpFH6A+wagYWTOH970= -github.com/shirou/gopsutil/v4 v4.25.8/go.mod h1:q9QdMmfAOVIw7a+eF86P7ISEU6ka+NLgkUxlopV4RwI= +github.com/shirou/gopsutil/v4 v4.25.11 h1:X53gB7muL9Gnwwo2evPSE+SfOrltMoR6V3xJAXZILTY= +github.com/shirou/gopsutil/v4 v4.25.11/go.mod h1:EivAfP5x2EhLp2ovdpKSozecVXn1TmuG7SMzs/Wh4PU= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= @@ -221,10 +221,10 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/tklauser/go-sysconf v0.3.15 h1:VE89k0criAymJ/Os65CSn1IXaol+1wrsFHEB8Ol49K4= -github.com/tklauser/go-sysconf v0.3.15/go.mod h1:Dmjwr6tYFIseJw7a3dRLJfsHAMXZ3nEnL/aZY+0IuI4= -github.com/tklauser/numcpus v0.10.0 h1:18njr6LDBk1zuna922MgdjQuJFjrdppsZG60sHGfjso= -github.com/tklauser/numcpus v0.10.0/go.mod h1:BiTKazU708GQTYF4mB+cmlpT2Is1gLk7XVuEeem8LsQ= +github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA= +github.com/tklauser/go-sysconf v0.3.16/go.mod h1:/qNL9xxDhc7tx3HSRsLWNnuzbVfh3e7gh/BmM179nYI= +github.com/tklauser/numcpus v0.11.0 h1:nSTwhKH5e1dMNsCdVBukSZrURJRoHbSEQjdEbY+9RXw= +github.com/tklauser/numcpus v0.11.0/go.mod h1:z+LwcLq54uWZTX0u/bGobaV34u6V7KNlTZejzM6/3MQ= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= @@ -289,8 +289,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 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.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= -golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= +golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM= +golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -321,8 +321,8 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= -golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= +golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU= golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -338,8 +338,8 @@ golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtn 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.29.0 h1:Xx0h3TtM9rzQpQuR4dKLrdglAmCEN5Oi+P74JdhdzXE= -golang.org/x/tools v0.29.0/go.mod h1:KMQVMRsVxU6nHCFXrBPhDB8XncLNLM0lIy/F14RP588= +golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY= +golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY= 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= diff --git a/pkg/config/conf.gen.go b/pkg/config/conf.gen.go new file mode 100644 index 00000000..048511c3 --- /dev/null +++ b/pkg/config/conf.gen.go @@ -0,0 +1,87 @@ +// Code generated by baton-sdk. DO NOT EDIT!!! +package config + +import "reflect" + +type Sendgrid struct { + SendgridApiKey string `mapstructure:"sendgrid-api-key"` + SendgridRegion string `mapstructure:"sendgrid-region"` + IgnoreSubusers bool `mapstructure:"ignore-subusers"` +} + +func (c *Sendgrid) findFieldByTag(tagValue string) (any, bool) { + v := reflect.ValueOf(c).Elem() // Dereference pointer to struct + t := v.Type() + + for i := 0; i < t.NumField(); i++ { + field := t.Field(i) + tag := field.Tag.Get("mapstructure") + + if tag == tagValue { + return v.Field(i).Interface(), true + } + } + return nil, false +} + +func (c *Sendgrid) GetStringSlice(fieldName string) []string { + v, ok := c.findFieldByTag(fieldName) + if !ok { + return []string{} + } + t, ok := v.([]string) + if !ok { + panic("wrong type") + } + return t +} + +func (c *Sendgrid) GetString(fieldName string) string { + v, ok := c.findFieldByTag(fieldName) + if !ok { + return "" + } + if t, ok := v.(string); ok { + return t + } + if t, ok := v.([]byte); ok { + return string(t) + } + panic("wrong type") +} + +func (c *Sendgrid) GetInt(fieldName string) int { + v, ok := c.findFieldByTag(fieldName) + if !ok { + return 0 + } + t, ok := v.(int) + if !ok { + panic("wrong type") + } + return t +} + +func (c *Sendgrid) GetBool(fieldName string) bool { + v, ok := c.findFieldByTag(fieldName) + if !ok { + return false + } + t, ok := v.(bool) + if !ok { + panic("wrong type") + } + return t +} + +func (c *Sendgrid) GetStringMap(fieldName string) map[string]any { + v, ok := c.findFieldByTag(fieldName) + if !ok { + return map[string]any{} + } + t, ok := v.(map[string]any) + if !ok { + panic("wrong type") + } + return t +} diff --git a/cmd/baton-sendgrid/config.go b/pkg/config/config.go similarity index 73% rename from cmd/baton-sendgrid/config.go rename to pkg/config/config.go index b9cd1353..4095cf03 100644 --- a/cmd/baton-sendgrid/config.go +++ b/pkg/config/config.go @@ -1,19 +1,21 @@ -package main +package config import ( "github.com/conductorone/baton-sdk/pkg/field" - "github.com/spf13/viper" ) var ( SendGridApiKeyField = field.StringField( "sendgrid-api-key", + field.WithDisplayName("SendGrid API Key"), field.WithRequired(true), + field.WithIsSecret(true), field.WithDescription("API key for SendGrid service."), ) SendGridRegionField = field.StringField( "sendgrid-region", + field.WithDisplayName("SendGrid Region"), field.WithRequired(false), field.WithDefaultValue("global"), field.WithDescription("Region for SendGrid service ex: global or eu."), @@ -21,6 +23,7 @@ var ( IgnoreSubusers = field.BoolField( "ignore-subusers", + field.WithDisplayName("Ignore Subusers"), field.WithDefaultValue(false), field.WithDescription("Ignore subusers in the SendGrid account, subusers are an upgraded feature of sendgrid."), ) @@ -43,10 +46,11 @@ var ( FieldRelationships = []field.SchemaFieldRelationship{} ) -// ValidateConfig is run after the configuration is loaded, and should return an -// error if it isn't valid. Implementing this function is optional, it only -// needs to perform extra validations that cannot be encoded with configuration -// parameters. -func ValidateConfig(v *viper.Viper) error { - return nil -} +//go:generate go run ./gen +var Config = field.NewConfiguration( + ConfigurationFields, + field.WithConstraints(FieldRelationships...), + field.WithConnectorDisplayName("SendGrid"), + field.WithHelpUrl("/docs/baton/sendgrid"), + field.WithIconUrl("/static/app-icons/sendgrid.svg"), +) diff --git a/pkg/config/gen/gen.go b/pkg/config/gen/gen.go new file mode 100644 index 00000000..2be90d07 --- /dev/null +++ b/pkg/config/gen/gen.go @@ -0,0 +1,10 @@ +package main + +import ( + cfg "github.com/conductorone/baton-sendgrid/pkg/config" + "github.com/conductorone/baton-sdk/pkg/config" +) + +func main() { + config.Generate("sendgrid", cfg.Config) +} diff --git a/pkg/connector/connector.go b/pkg/connector/connector.go index 7c7beaa0..ce0cf2a3 100644 --- a/pkg/connector/connector.go +++ b/pkg/connector/connector.go @@ -5,12 +5,17 @@ import ( "errors" "io" - "github.com/conductorone/baton-sdk/pkg/pagination" + cfg "github.com/conductorone/baton-sendgrid/pkg/config" + "github.com/conductorone/baton-sendgrid/pkg/connector/client" "github.com/conductorone/baton-sendgrid/pkg/connector/models" v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" "github.com/conductorone/baton-sdk/pkg/annotations" + "github.com/conductorone/baton-sdk/pkg/cli" "github.com/conductorone/baton-sdk/pkg/connectorbuilder" + "github.com/conductorone/baton-sdk/pkg/pagination" + "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" + "go.uber.org/zap" ) var ( @@ -49,8 +54,8 @@ type Connector struct { } // ResourceSyncers returns a ResourceSyncer for each resource type that should be synced from the upstream service. -func (d *Connector) ResourceSyncers(ctx context.Context) []connectorbuilder.ResourceSyncer { - return []connectorbuilder.ResourceSyncer{ +func (d *Connector) ResourceSyncers(ctx context.Context) []connectorbuilder.ResourceSyncerV2 { + return []connectorbuilder.ResourceSyncerV2{ newTeammateBuilder(d.client), newTeammateInvitationBuilder(d.client), newScopeBuilder(d.client, d.scopeCache), @@ -114,14 +119,34 @@ func (d *Connector) Validate(ctx context.Context) (annotations.Annotations, erro } // New returns a new instance of the connector. -func New(ctx context.Context, client SendGridClient, ignoreSubusers bool) (*Connector, error) { - if client == nil { - return nil, ErrSendgridClientNotProvided +func New(ctx context.Context, cc *cfg.Sendgrid, opts *cli.ConnectorOpts) (connectorbuilder.ConnectorBuilderV2, []connectorbuilder.Opt, error) { + l := ctxzap.Extract(ctx) + + sendGridApiKey := cc.SendgridApiKey + sendgridRegion := cc.SendgridRegion + sendgridIgnoreSubusers := cc.IgnoreSubusers + + var baseUrl string + + switch sendgridRegion { + case "eu": + baseUrl = client.SendGridEUBaseUrl + case "global": + baseUrl = client.SendGridBaseUrl + default: + baseUrl = client.SendGridBaseUrl + l.Warn("invalid sendgrid region, using the default global URL", zap.String("region", sendgridRegion)) + } + + sendGridClient, err := client.NewClient(ctx, baseUrl, sendGridApiKey) + if err != nil { + l.Error("error creating sendgrid client", zap.Error(err)) + return nil, nil, err } return &Connector{ - client: client, - scopeCache: newScopeCache(client), - ignoreSubusers: ignoreSubusers, - }, nil + client: sendGridClient, + scopeCache: newScopeCache(sendGridClient), + ignoreSubusers: sendgridIgnoreSubusers, + }, nil, nil } diff --git a/pkg/connector/scopes.go b/pkg/connector/scopes.go index 64ceb1a1..1d3455c5 100644 --- a/pkg/connector/scopes.go +++ b/pkg/connector/scopes.go @@ -9,9 +9,9 @@ import ( v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" "github.com/conductorone/baton-sdk/pkg/annotations" - "github.com/conductorone/baton-sdk/pkg/pagination" ent "github.com/conductorone/baton-sdk/pkg/types/entitlement" "github.com/conductorone/baton-sdk/pkg/types/grant" + rs "github.com/conductorone/baton-sdk/pkg/types/resource" "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" "go.uber.org/zap" ) @@ -30,11 +30,11 @@ func (r *scopeBuilder) ResourceType(ctx context.Context) *v2.ResourceType { return scopeResourceType } -func (r *scopeBuilder) List(ctx context.Context, parentResourceID *v2.ResourceId, pToken *pagination.Token) ([]*v2.Resource, string, annotations.Annotations, error) { - if pToken == nil || pToken.Token == "" { +func (r *scopeBuilder) List(ctx context.Context, parentResourceID *v2.ResourceId, opts rs.SyncOpAttrs) ([]*v2.Resource, *rs.SyncOpResults, error) { + if opts.PageToken.Token == "" { err := r.scopeCache.buildCache(ctx) if err != nil { - return nil, "", nil, err + return nil, nil, err } } @@ -43,16 +43,16 @@ func (r *scopeBuilder) List(ctx context.Context, parentResourceID *v2.ResourceId for i, scope := range SendGridScopes { rb, err := scopeResource(scope) if err != nil { - return nil, "", nil, err + return nil, nil, err } rv[i] = rb } - return rv, "", nil, nil + return rv, nil, nil } -func (r *scopeBuilder) Entitlements(_ context.Context, resource *v2.Resource, _ *pagination.Token) ([]*v2.Entitlement, string, annotations.Annotations, error) { +func (r *scopeBuilder) Entitlements(_ context.Context, resource *v2.Resource, _ rs.SyncOpAttrs) ([]*v2.Entitlement, *rs.SyncOpResults, error) { var rv []*v2.Entitlement assigmentOptions := []ent.EntitlementOption{ ent.WithGrantableTo(teammateResourceType), @@ -61,10 +61,10 @@ func (r *scopeBuilder) Entitlements(_ context.Context, resource *v2.Resource, _ } rv = append(rv, ent.NewAssignmentEntitlement(resource, assignedEntitlement, assigmentOptions...)) - return rv, "", nil, nil + return rv, nil, nil } -func (r *scopeBuilder) Grants(ctx context.Context, resource *v2.Resource, pToken *pagination.Token) ([]*v2.Grant, string, annotations.Annotations, error) { +func (r *scopeBuilder) Grants(ctx context.Context, resource *v2.Resource, opts rs.SyncOpAttrs) ([]*v2.Grant, *rs.SyncOpResults, error) { scope := resource.Id.Resource users := r.scopeCache.GetUsersForScope(scope) @@ -74,13 +74,13 @@ func (r *scopeBuilder) Grants(ctx context.Context, resource *v2.Resource, pToken for _, user := range users { userGrants, err := createGrantToScopeFromTeammateScope(ctx, resource, user) if err != nil { - return nil, "", nil, err + return nil, nil, err } rv = append(rv, userGrants...) } - return rv, "", nil, nil + return rv, nil, nil } // ResourceProvisioner diff --git a/pkg/connector/subuser.go b/pkg/connector/subuser.go index 5ef26865..40548d4c 100644 --- a/pkg/connector/subuser.go +++ b/pkg/connector/subuser.go @@ -4,8 +4,7 @@ import ( "context" v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" - "github.com/conductorone/baton-sdk/pkg/annotations" - "github.com/conductorone/baton-sdk/pkg/pagination" + rs "github.com/conductorone/baton-sdk/pkg/types/resource" ) type subuserBuilder struct { @@ -26,22 +25,22 @@ func (r *subuserBuilder) ResourceType(ctx context.Context) *v2.ResourceType { return subuserResourceType } -func (r *subuserBuilder) List(ctx context.Context, parentResourceID *v2.ResourceId, pToken *pagination.Token) ([]*v2.Resource, string, annotations.Annotations, error) { +func (r *subuserBuilder) List(ctx context.Context, parentResourceID *v2.ResourceId, opts rs.SyncOpAttrs) ([]*v2.Resource, *rs.SyncOpResults, error) { var rv []*v2.Resource if r.ignoreSubusers { - return rv, "", nil, nil + return rv, nil, nil } - subusers, pNextToken, err := r.client.GetSubusers(ctx, pToken) + subusers, pNextToken, err := r.client.GetSubusers(ctx, &opts.PageToken) if err != nil { - return nil, "", nil, err + return nil, nil, err } for _, subuser := range subusers { rb, err := subuserResource(subuser) if err != nil { - return nil, "", nil, err + return nil, nil, err } rv = append(rv, rb) @@ -52,13 +51,13 @@ func (r *subuserBuilder) List(ctx context.Context, parentResourceID *v2.Resource nextToken = pNextToken } - return rv, nextToken, nil, nil + return rv, &rs.SyncOpResults{NextPageToken: nextToken}, nil } -func (r *subuserBuilder) Entitlements(_ context.Context, resource *v2.Resource, _ *pagination.Token) ([]*v2.Entitlement, string, annotations.Annotations, error) { - return nil, "", nil, nil +func (r *subuserBuilder) Entitlements(_ context.Context, resource *v2.Resource, _ rs.SyncOpAttrs) ([]*v2.Entitlement, *rs.SyncOpResults, error) { + return nil, nil, nil } -func (r *subuserBuilder) Grants(ctx context.Context, resource *v2.Resource, pToken *pagination.Token) ([]*v2.Grant, string, annotations.Annotations, error) { - return nil, "", nil, nil +func (r *subuserBuilder) Grants(ctx context.Context, resource *v2.Resource, opts rs.SyncOpAttrs) ([]*v2.Grant, *rs.SyncOpResults, error) { + return nil, nil, nil } diff --git a/pkg/connector/teammate_invitations.go b/pkg/connector/teammate_invitations.go index 0ba88cf6..999b1c11 100644 --- a/pkg/connector/teammate_invitations.go +++ b/pkg/connector/teammate_invitations.go @@ -8,7 +8,7 @@ import ( v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" "github.com/conductorone/baton-sdk/pkg/annotations" "github.com/conductorone/baton-sdk/pkg/connectorbuilder" - "github.com/conductorone/baton-sdk/pkg/pagination" + rs "github.com/conductorone/baton-sdk/pkg/types/resource" "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" "go.uber.org/zap" ) @@ -21,12 +21,12 @@ func (u *teammateInvitationBuilder) ResourceType(ctx context.Context) *v2.Resour return teammateInvitationResourceType } -func (u *teammateInvitationBuilder) List(ctx context.Context, parentResourceID *v2.ResourceId, pToken *pagination.Token) ([]*v2.Resource, string, annotations.Annotations, error) { +func (u *teammateInvitationBuilder) List(ctx context.Context, parentResourceID *v2.ResourceId, opts rs.SyncOpAttrs) ([]*v2.Resource, *rs.SyncOpResults, error) { logger := ctxzap.Extract(ctx) - invitations, pNextToken, err := u.client.GetPendingTeammates(ctx, pToken) + invitations, pNextToken, err := u.client.GetPendingTeammates(ctx, &opts.PageToken) if err != nil { - return nil, "", nil, err + return nil, nil, err } rv := make([]*v2.Resource, 0, len(invitations)) @@ -48,15 +48,15 @@ func (u *teammateInvitationBuilder) List(ctx context.Context, parentResourceID * nextToken = pNextToken } - return rv, nextToken, nil, nil + return rv, &rs.SyncOpResults{NextPageToken: nextToken}, nil } -func (u *teammateInvitationBuilder) Entitlements(_ context.Context, resource *v2.Resource, _ *pagination.Token) ([]*v2.Entitlement, string, annotations.Annotations, error) { - return nil, "", nil, nil +func (u *teammateInvitationBuilder) Entitlements(_ context.Context, resource *v2.Resource, _ rs.SyncOpAttrs) ([]*v2.Entitlement, *rs.SyncOpResults, error) { + return nil, nil, nil } -func (u *teammateInvitationBuilder) Grants(ctx context.Context, resource *v2.Resource, pToken *pagination.Token) ([]*v2.Grant, string, annotations.Annotations, error) { - return nil, "", nil, nil +func (u *teammateInvitationBuilder) Grants(ctx context.Context, resource *v2.Resource, opts rs.SyncOpAttrs) ([]*v2.Grant, *rs.SyncOpResults, error) { + return nil, nil, nil } func (u *teammateInvitationBuilder) CreateAccountCapabilityDetails(_ context.Context) (*v2.CredentialDetailsAccountProvisioning, annotations.Annotations, error) { diff --git a/pkg/connector/teammates.go b/pkg/connector/teammates.go index 80556bf9..d1d402f3 100644 --- a/pkg/connector/teammates.go +++ b/pkg/connector/teammates.go @@ -9,7 +9,6 @@ import ( v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" "github.com/conductorone/baton-sdk/pkg/annotations" - "github.com/conductorone/baton-sdk/pkg/pagination" ent "github.com/conductorone/baton-sdk/pkg/types/entitlement" "github.com/conductorone/baton-sdk/pkg/types/grant" rs "github.com/conductorone/baton-sdk/pkg/types/resource" @@ -29,17 +28,17 @@ func (u *teammateBuilder) ResourceType(ctx context.Context) *v2.ResourceType { return teammateResourceType } -func (u *teammateBuilder) List(ctx context.Context, parentResourceID *v2.ResourceId, pToken *pagination.Token) ([]*v2.Resource, string, annotations.Annotations, error) { - teammates, pNextToken, err := u.client.GetTeammates(ctx, pToken) +func (u *teammateBuilder) List(ctx context.Context, parentResourceID *v2.ResourceId, opts rs.SyncOpAttrs) ([]*v2.Resource, *rs.SyncOpResults, error) { + teammates, pNextToken, err := u.client.GetTeammates(ctx, &opts.PageToken) if err != nil { - return nil, "", nil, err + return nil, nil, err } rv := make([]*v2.Resource, len(teammates)) for i, teammate := range teammates { us, err := teammateResource(&teammate) if err != nil { - return nil, "", nil, err + return nil, nil, err } rv[i] = us } @@ -49,10 +48,10 @@ func (u *teammateBuilder) List(ctx context.Context, parentResourceID *v2.Resourc nextToken = pNextToken } - return rv, nextToken, nil, nil + return rv, &rs.SyncOpResults{NextPageToken: nextToken}, nil } -func (u *teammateBuilder) Entitlements(_ context.Context, resource *v2.Resource, _ *pagination.Token) ([]*v2.Entitlement, string, annotations.Annotations, error) { +func (u *teammateBuilder) Entitlements(_ context.Context, resource *v2.Resource, _ rs.SyncOpAttrs) ([]*v2.Entitlement, *rs.SyncOpResults, error) { var rv []*v2.Entitlement assigmentOptions := []ent.EntitlementOption{ ent.WithGrantableTo(subuserResourceType), @@ -61,17 +60,17 @@ func (u *teammateBuilder) Entitlements(_ context.Context, resource *v2.Resource, } rv = append(rv, ent.NewAssignmentEntitlement(resource, accessEntitlement, assigmentOptions...)) - return rv, "", nil, nil + return rv, nil, nil } -func (u *teammateBuilder) Grants(ctx context.Context, resource *v2.Resource, pToken *pagination.Token) ([]*v2.Grant, string, annotations.Annotations, error) { +func (u *teammateBuilder) Grants(ctx context.Context, resource *v2.Resource, opts rs.SyncOpAttrs) ([]*v2.Grant, *rs.SyncOpResults, error) { var rv []*v2.Grant username := resource.Id.Resource - access, nextToken, err := u.client.GetTeammatesSubAccess(ctx, username, pToken) + access, nextToken, err := u.client.GetTeammatesSubAccess(ctx, username, &opts.PageToken) if err != nil { - return nil, "", nil, err + return nil, nil, err } logger := ctxzap.Extract(ctx) @@ -80,13 +79,13 @@ func (u *teammateBuilder) Grants(ctx context.Context, resource *v2.Resource, pTo for _, subAcess := range access { grants, err := createGrantSubuserFromTeammate(resource, &subAcess) if err != nil { - return nil, "", nil, err + return nil, nil, err } rv = append(rv, grants...) } - return rv, nextToken, nil, nil + return rv, &rs.SyncOpResults{NextPageToken: nextToken}, nil } // Delete implements the ResourceDeleter interface for teammates. diff --git a/vendor/github.com/conductorone/baton-sdk/internal/connector/connector.go b/vendor/github.com/conductorone/baton-sdk/internal/connector/connector.go index fad4f16b..ab6da92c 100644 --- a/vendor/github.com/conductorone/baton-sdk/internal/connector/connector.go +++ b/vendor/github.com/conductorone/baton-sdk/internal/connector/connector.go @@ -25,6 +25,7 @@ import ( connectorwrapperV1 "github.com/conductorone/baton-sdk/pb/c1/connector_wrapper/v1" ratelimitV1 "github.com/conductorone/baton-sdk/pb/c1/ratelimit/v1" tlsV1 "github.com/conductorone/baton-sdk/pb/c1/utls/v1" + "github.com/conductorone/baton-sdk/pkg/bid" ratelimit2 "github.com/conductorone/baton-sdk/pkg/ratelimit" "github.com/conductorone/baton-sdk/pkg/session" "github.com/conductorone/baton-sdk/pkg/types" @@ -81,16 +82,16 @@ var ErrConnectorNotImplemented = errors.New("client does not implement connector type wrapper struct { mtx sync.RWMutex - server types.ConnectorServer - client types.ConnectorClient - serverStdin io.WriteCloser - conn *grpc.ClientConn - provisioningEnabled bool - ticketingEnabled bool - fullSyncDisabled bool - targetedSyncResourceIDs []string - sessionStoreEnabled bool - syncResourceTypeIDs []string + server types.ConnectorServer + client types.ConnectorClient + serverStdin io.WriteCloser + conn *grpc.ClientConn + provisioningEnabled bool + ticketingEnabled bool + fullSyncDisabled bool + targetedSyncResources []*connectorV2.Resource + sessionStoreEnabled bool + syncResourceTypeIDs []string rateLimiter ratelimitV1.RateLimiterServiceServer rlCfg *ratelimitV1.RateLimiterConfig @@ -153,9 +154,17 @@ func WithTicketingEnabled() Option { } } -func WithTargetedSyncResourceIDs(resourceIDs []string) Option { +func WithTargetedSyncResources(resourceIDs []string) Option { return func(ctx context.Context, w *wrapper) error { - w.targetedSyncResourceIDs = resourceIDs + resources := make([]*connectorV2.Resource, 0, len(resourceIDs)) + for _, resourceId := range resourceIDs { + r, err := bid.ParseResourceBid(resourceId) + if err != nil { + return err + } + resources = append(resources, r) + } + w.targetedSyncResources = resources return nil } } diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/config.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/config.pb.go index 14ec079e..d563d18f 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/config.pb.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/config.pb.go @@ -562,6 +562,12 @@ type Field struct { // *Field_BoolField // *Field_StringSliceField // *Field_StringMapField + // *Field_ResourceIdField + // *Field_ResourceIdSliceField + // *Field_ResourceField + // *Field_ResourceSliceField + // *Field_EntitlementSliceField + // *Field_GrantSliceField Field isField_Field `protobuf_oneof:"field"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -693,6 +699,60 @@ func (x *Field) GetStringMapField() *StringMapField { return nil } +func (x *Field) GetResourceIdField() *ResourceIdField { + if x != nil { + if x, ok := x.Field.(*Field_ResourceIdField); ok { + return x.ResourceIdField + } + } + return nil +} + +func (x *Field) GetResourceIdSliceField() *ResourceIdSliceField { + if x != nil { + if x, ok := x.Field.(*Field_ResourceIdSliceField); ok { + return x.ResourceIdSliceField + } + } + return nil +} + +func (x *Field) GetResourceField() *ResourceField { + if x != nil { + if x, ok := x.Field.(*Field_ResourceField); ok { + return x.ResourceField + } + } + return nil +} + +func (x *Field) GetResourceSliceField() *ResourceSliceField { + if x != nil { + if x, ok := x.Field.(*Field_ResourceSliceField); ok { + return x.ResourceSliceField + } + } + return nil +} + +func (x *Field) GetEntitlementSliceField() *EntitlementSliceField { + if x != nil { + if x, ok := x.Field.(*Field_EntitlementSliceField); ok { + return x.EntitlementSliceField + } + } + return nil +} + +func (x *Field) GetGrantSliceField() *GrantSliceField { + if x != nil { + if x, ok := x.Field.(*Field_GrantSliceField); ok { + return x.GrantSliceField + } + } + return nil +} + func (x *Field) SetName(v string) { x.Name = v } @@ -745,221 +805,1377 @@ func (x *Field) SetBoolField(v *BoolField) { x.Field = &Field_BoolField{v} } -func (x *Field) SetStringSliceField(v *StringSliceField) { - if v == nil { - x.Field = nil - return - } - x.Field = &Field_StringSliceField{v} +func (x *Field) SetStringSliceField(v *StringSliceField) { + if v == nil { + x.Field = nil + return + } + x.Field = &Field_StringSliceField{v} +} + +func (x *Field) SetStringMapField(v *StringMapField) { + if v == nil { + x.Field = nil + return + } + x.Field = &Field_StringMapField{v} +} + +func (x *Field) SetResourceIdField(v *ResourceIdField) { + if v == nil { + x.Field = nil + return + } + x.Field = &Field_ResourceIdField{v} +} + +func (x *Field) SetResourceIdSliceField(v *ResourceIdSliceField) { + if v == nil { + x.Field = nil + return + } + x.Field = &Field_ResourceIdSliceField{v} +} + +func (x *Field) SetResourceField(v *ResourceField) { + if v == nil { + x.Field = nil + return + } + x.Field = &Field_ResourceField{v} +} + +func (x *Field) SetResourceSliceField(v *ResourceSliceField) { + if v == nil { + x.Field = nil + return + } + x.Field = &Field_ResourceSliceField{v} +} + +func (x *Field) SetEntitlementSliceField(v *EntitlementSliceField) { + if v == nil { + x.Field = nil + return + } + x.Field = &Field_EntitlementSliceField{v} +} + +func (x *Field) SetGrantSliceField(v *GrantSliceField) { + if v == nil { + x.Field = nil + return + } + x.Field = &Field_GrantSliceField{v} +} + +func (x *Field) HasField() bool { + if x == nil { + return false + } + return x.Field != nil +} + +func (x *Field) HasStringField() bool { + if x == nil { + return false + } + _, ok := x.Field.(*Field_StringField) + return ok +} + +func (x *Field) HasIntField() bool { + if x == nil { + return false + } + _, ok := x.Field.(*Field_IntField) + return ok +} + +func (x *Field) HasBoolField() bool { + if x == nil { + return false + } + _, ok := x.Field.(*Field_BoolField) + return ok +} + +func (x *Field) HasStringSliceField() bool { + if x == nil { + return false + } + _, ok := x.Field.(*Field_StringSliceField) + return ok +} + +func (x *Field) HasStringMapField() bool { + if x == nil { + return false + } + _, ok := x.Field.(*Field_StringMapField) + return ok +} + +func (x *Field) HasResourceIdField() bool { + if x == nil { + return false + } + _, ok := x.Field.(*Field_ResourceIdField) + return ok +} + +func (x *Field) HasResourceIdSliceField() bool { + if x == nil { + return false + } + _, ok := x.Field.(*Field_ResourceIdSliceField) + return ok +} + +func (x *Field) HasResourceField() bool { + if x == nil { + return false + } + _, ok := x.Field.(*Field_ResourceField) + return ok +} + +func (x *Field) HasResourceSliceField() bool { + if x == nil { + return false + } + _, ok := x.Field.(*Field_ResourceSliceField) + return ok +} + +func (x *Field) HasEntitlementSliceField() bool { + if x == nil { + return false + } + _, ok := x.Field.(*Field_EntitlementSliceField) + return ok +} + +func (x *Field) HasGrantSliceField() bool { + if x == nil { + return false + } + _, ok := x.Field.(*Field_GrantSliceField) + return ok +} + +func (x *Field) ClearField() { + x.Field = nil +} + +func (x *Field) ClearStringField() { + if _, ok := x.Field.(*Field_StringField); ok { + x.Field = nil + } +} + +func (x *Field) ClearIntField() { + if _, ok := x.Field.(*Field_IntField); ok { + x.Field = nil + } +} + +func (x *Field) ClearBoolField() { + if _, ok := x.Field.(*Field_BoolField); ok { + x.Field = nil + } +} + +func (x *Field) ClearStringSliceField() { + if _, ok := x.Field.(*Field_StringSliceField); ok { + x.Field = nil + } +} + +func (x *Field) ClearStringMapField() { + if _, ok := x.Field.(*Field_StringMapField); ok { + x.Field = nil + } +} + +func (x *Field) ClearResourceIdField() { + if _, ok := x.Field.(*Field_ResourceIdField); ok { + x.Field = nil + } +} + +func (x *Field) ClearResourceIdSliceField() { + if _, ok := x.Field.(*Field_ResourceIdSliceField); ok { + x.Field = nil + } +} + +func (x *Field) ClearResourceField() { + if _, ok := x.Field.(*Field_ResourceField); ok { + x.Field = nil + } +} + +func (x *Field) ClearResourceSliceField() { + if _, ok := x.Field.(*Field_ResourceSliceField); ok { + x.Field = nil + } +} + +func (x *Field) ClearEntitlementSliceField() { + if _, ok := x.Field.(*Field_EntitlementSliceField); ok { + x.Field = nil + } +} + +func (x *Field) ClearGrantSliceField() { + if _, ok := x.Field.(*Field_GrantSliceField); ok { + x.Field = nil + } +} + +const Field_Field_not_set_case case_Field_Field = 0 +const Field_StringField_case case_Field_Field = 100 +const Field_IntField_case case_Field_Field = 101 +const Field_BoolField_case case_Field_Field = 102 +const Field_StringSliceField_case case_Field_Field = 103 +const Field_StringMapField_case case_Field_Field = 104 +const Field_ResourceIdField_case case_Field_Field = 105 +const Field_ResourceIdSliceField_case case_Field_Field = 106 +const Field_ResourceField_case case_Field_Field = 107 +const Field_ResourceSliceField_case case_Field_Field = 108 +const Field_EntitlementSliceField_case case_Field_Field = 109 +const Field_GrantSliceField_case case_Field_Field = 110 + +func (x *Field) WhichField() case_Field_Field { + if x == nil { + return Field_Field_not_set_case + } + switch x.Field.(type) { + case *Field_StringField: + return Field_StringField_case + case *Field_IntField: + return Field_IntField_case + case *Field_BoolField: + return Field_BoolField_case + case *Field_StringSliceField: + return Field_StringSliceField_case + case *Field_StringMapField: + return Field_StringMapField_case + case *Field_ResourceIdField: + return Field_ResourceIdField_case + case *Field_ResourceIdSliceField: + return Field_ResourceIdSliceField_case + case *Field_ResourceField: + return Field_ResourceField_case + case *Field_ResourceSliceField: + return Field_ResourceSliceField_case + case *Field_EntitlementSliceField: + return Field_EntitlementSliceField_case + case *Field_GrantSliceField: + return Field_GrantSliceField_case + default: + return Field_Field_not_set_case + } +} + +type Field_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Name string + DisplayName string + Description string + Placeholder string + IsRequired bool + IsOps bool + IsSecret bool + // Fields of oneof Field: + StringField *StringField + IntField *IntField + BoolField *BoolField + StringSliceField *StringSliceField + StringMapField *StringMapField + ResourceIdField *ResourceIdField + ResourceIdSliceField *ResourceIdSliceField + // These are meant to serve as return types for actions. + ResourceField *ResourceField + ResourceSliceField *ResourceSliceField + EntitlementSliceField *EntitlementSliceField + GrantSliceField *GrantSliceField + // -- end of Field +} + +func (b0 Field_builder) Build() *Field { + m0 := &Field{} + b, x := &b0, m0 + _, _ = b, x + x.Name = b.Name + x.DisplayName = b.DisplayName + x.Description = b.Description + x.Placeholder = b.Placeholder + x.IsRequired = b.IsRequired + x.IsOps = b.IsOps + x.IsSecret = b.IsSecret + if b.StringField != nil { + x.Field = &Field_StringField{b.StringField} + } + if b.IntField != nil { + x.Field = &Field_IntField{b.IntField} + } + if b.BoolField != nil { + x.Field = &Field_BoolField{b.BoolField} + } + if b.StringSliceField != nil { + x.Field = &Field_StringSliceField{b.StringSliceField} + } + if b.StringMapField != nil { + x.Field = &Field_StringMapField{b.StringMapField} + } + if b.ResourceIdField != nil { + x.Field = &Field_ResourceIdField{b.ResourceIdField} + } + if b.ResourceIdSliceField != nil { + x.Field = &Field_ResourceIdSliceField{b.ResourceIdSliceField} + } + if b.ResourceField != nil { + x.Field = &Field_ResourceField{b.ResourceField} + } + if b.ResourceSliceField != nil { + x.Field = &Field_ResourceSliceField{b.ResourceSliceField} + } + if b.EntitlementSliceField != nil { + x.Field = &Field_EntitlementSliceField{b.EntitlementSliceField} + } + if b.GrantSliceField != nil { + x.Field = &Field_GrantSliceField{b.GrantSliceField} + } + return m0 +} + +type case_Field_Field protoreflect.FieldNumber + +func (x case_Field_Field) String() string { + md := file_c1_config_v1_config_proto_msgTypes[3].Descriptor() + if x == 0 { + return "not set" + } + return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x)) +} + +type isField_Field interface { + isField_Field() +} + +type Field_StringField struct { + StringField *StringField `protobuf:"bytes,100,opt,name=string_field,json=stringField,proto3,oneof"` +} + +type Field_IntField struct { + IntField *IntField `protobuf:"bytes,101,opt,name=int_field,json=intField,proto3,oneof"` +} + +type Field_BoolField struct { + BoolField *BoolField `protobuf:"bytes,102,opt,name=bool_field,json=boolField,proto3,oneof"` +} + +type Field_StringSliceField struct { + StringSliceField *StringSliceField `protobuf:"bytes,103,opt,name=string_slice_field,json=stringSliceField,proto3,oneof"` +} + +type Field_StringMapField struct { + StringMapField *StringMapField `protobuf:"bytes,104,opt,name=string_map_field,json=stringMapField,proto3,oneof"` +} + +type Field_ResourceIdField struct { + ResourceIdField *ResourceIdField `protobuf:"bytes,105,opt,name=resource_id_field,json=resourceIdField,proto3,oneof"` +} + +type Field_ResourceIdSliceField struct { + ResourceIdSliceField *ResourceIdSliceField `protobuf:"bytes,106,opt,name=resource_id_slice_field,json=resourceIdSliceField,proto3,oneof"` +} + +type Field_ResourceField struct { + // These are meant to serve as return types for actions. + ResourceField *ResourceField `protobuf:"bytes,107,opt,name=resource_field,json=resourceField,proto3,oneof"` +} + +type Field_ResourceSliceField struct { + ResourceSliceField *ResourceSliceField `protobuf:"bytes,108,opt,name=resource_slice_field,json=resourceSliceField,proto3,oneof"` +} + +type Field_EntitlementSliceField struct { + EntitlementSliceField *EntitlementSliceField `protobuf:"bytes,109,opt,name=entitlement_slice_field,json=entitlementSliceField,proto3,oneof"` +} + +type Field_GrantSliceField struct { + GrantSliceField *GrantSliceField `protobuf:"bytes,110,opt,name=grant_slice_field,json=grantSliceField,proto3,oneof"` +} + +func (*Field_StringField) isField_Field() {} + +func (*Field_IntField) isField_Field() {} + +func (*Field_BoolField) isField_Field() {} + +func (*Field_StringSliceField) isField_Field() {} + +func (*Field_StringMapField) isField_Field() {} + +func (*Field_ResourceIdField) isField_Field() {} + +func (*Field_ResourceIdSliceField) isField_Field() {} + +func (*Field_ResourceField) isField_Field() {} + +func (*Field_ResourceSliceField) isField_Field() {} + +func (*Field_EntitlementSliceField) isField_Field() {} + +func (*Field_GrantSliceField) isField_Field() {} + +// These are partially duplicate with the Resource proto in the connector package. +// This is to avoid import cycles +type Resource struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + ResourceId *ResourceId `protobuf:"bytes,1,opt,name=resource_id,json=resourceId,proto3" json:"resource_id,omitempty"` + ParentResourceId *ResourceId `protobuf:"bytes,2,opt,name=parent_resource_id,json=parentResourceId,proto3" json:"parent_resource_id,omitempty"` + DisplayName string `protobuf:"bytes,3,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + Annotations []*anypb.Any `protobuf:"bytes,5,rep,name=annotations,proto3" json:"annotations,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Resource) Reset() { + *x = Resource{} + mi := &file_c1_config_v1_config_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Resource) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Resource) ProtoMessage() {} + +func (x *Resource) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_config_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Resource) GetResourceId() *ResourceId { + if x != nil { + return x.ResourceId + } + return nil +} + +func (x *Resource) GetParentResourceId() *ResourceId { + if x != nil { + return x.ParentResourceId + } + return nil +} + +func (x *Resource) GetDisplayName() string { + if x != nil { + return x.DisplayName + } + return "" +} + +func (x *Resource) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Resource) GetAnnotations() []*anypb.Any { + if x != nil { + return x.Annotations + } + return nil +} + +func (x *Resource) SetResourceId(v *ResourceId) { + x.ResourceId = v +} + +func (x *Resource) SetParentResourceId(v *ResourceId) { + x.ParentResourceId = v +} + +func (x *Resource) SetDisplayName(v string) { + x.DisplayName = v +} + +func (x *Resource) SetDescription(v string) { + x.Description = v +} + +func (x *Resource) SetAnnotations(v []*anypb.Any) { + x.Annotations = v +} + +func (x *Resource) HasResourceId() bool { + if x == nil { + return false + } + return x.ResourceId != nil +} + +func (x *Resource) HasParentResourceId() bool { + if x == nil { + return false + } + return x.ParentResourceId != nil +} + +func (x *Resource) ClearResourceId() { + x.ResourceId = nil +} + +func (x *Resource) ClearParentResourceId() { + x.ParentResourceId = nil +} + +type Resource_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + ResourceId *ResourceId + ParentResourceId *ResourceId + DisplayName string + Description string + Annotations []*anypb.Any +} + +func (b0 Resource_builder) Build() *Resource { + m0 := &Resource{} + b, x := &b0, m0 + _, _ = b, x + x.ResourceId = b.ResourceId + x.ParentResourceId = b.ParentResourceId + x.DisplayName = b.DisplayName + x.Description = b.Description + x.Annotations = b.Annotations + return m0 +} + +type ResourceId struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + ResourceTypeId string `protobuf:"bytes,1,opt,name=resource_type_id,json=resourceTypeId,proto3" json:"resource_type_id,omitempty"` + ResourceId string `protobuf:"bytes,2,opt,name=resource_id,json=resourceId,proto3" json:"resource_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResourceId) Reset() { + *x = ResourceId{} + mi := &file_c1_config_v1_config_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResourceId) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResourceId) ProtoMessage() {} + +func (x *ResourceId) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_config_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ResourceId) GetResourceTypeId() string { + if x != nil { + return x.ResourceTypeId + } + return "" +} + +func (x *ResourceId) GetResourceId() string { + if x != nil { + return x.ResourceId + } + return "" +} + +func (x *ResourceId) SetResourceTypeId(v string) { + x.ResourceTypeId = v +} + +func (x *ResourceId) SetResourceId(v string) { + x.ResourceId = v +} + +type ResourceId_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + ResourceTypeId string + ResourceId string +} + +func (b0 ResourceId_builder) Build() *ResourceId { + m0 := &ResourceId{} + b, x := &b0, m0 + _, _ = b, x + x.ResourceTypeId = b.ResourceTypeId + x.ResourceId = b.ResourceId + return m0 +} + +type ResourceField struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + DefaultValue *Resource `protobuf:"bytes,1,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResourceField) Reset() { + *x = ResourceField{} + mi := &file_c1_config_v1_config_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResourceField) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResourceField) ProtoMessage() {} + +func (x *ResourceField) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_config_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ResourceField) GetDefaultValue() *Resource { + if x != nil { + return x.DefaultValue + } + return nil +} + +func (x *ResourceField) SetDefaultValue(v *Resource) { + x.DefaultValue = v +} + +func (x *ResourceField) HasDefaultValue() bool { + if x == nil { + return false + } + return x.DefaultValue != nil +} + +func (x *ResourceField) ClearDefaultValue() { + x.DefaultValue = nil +} + +type ResourceField_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + DefaultValue *Resource +} + +func (b0 ResourceField_builder) Build() *ResourceField { + m0 := &ResourceField{} + b, x := &b0, m0 + _, _ = b, x + x.DefaultValue = b.DefaultValue + return m0 +} + +type ResourceSliceField struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + DefaultValue []*Resource `protobuf:"bytes,1,rep,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResourceSliceField) Reset() { + *x = ResourceSliceField{} + mi := &file_c1_config_v1_config_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResourceSliceField) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResourceSliceField) ProtoMessage() {} + +func (x *ResourceSliceField) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_config_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ResourceSliceField) GetDefaultValue() []*Resource { + if x != nil { + return x.DefaultValue + } + return nil +} + +func (x *ResourceSliceField) SetDefaultValue(v []*Resource) { + x.DefaultValue = v +} + +type ResourceSliceField_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + DefaultValue []*Resource +} + +func (b0 ResourceSliceField_builder) Build() *ResourceSliceField { + m0 := &ResourceSliceField{} + b, x := &b0, m0 + _, _ = b, x + x.DefaultValue = b.DefaultValue + return m0 +} + +// Simplified Entitlement for config return types (avoids import cycles with connector package) +type Entitlement struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + Slug string `protobuf:"bytes,4,opt,name=slug,proto3" json:"slug,omitempty"` + Purpose string `protobuf:"bytes,5,opt,name=purpose,proto3" json:"purpose,omitempty"` // "PURPOSE_VALUE_ASSIGNMENT", "PURPOSE_VALUE_PERMISSION", or "PURPOSE_VALUE_OWNERSHIP" + GrantableToResourceTypeIds []string `protobuf:"bytes,6,rep,name=grantable_to_resource_type_ids,json=grantableToResourceTypeIds,proto3" json:"grantable_to_resource_type_ids,omitempty"` + ResourceId string `protobuf:"bytes,7,opt,name=resource_id,json=resourceId,proto3" json:"resource_id,omitempty"` + ResourceTypeId string `protobuf:"bytes,8,opt,name=resource_type_id,json=resourceTypeId,proto3" json:"resource_type_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Entitlement) Reset() { + *x = Entitlement{} + mi := &file_c1_config_v1_config_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Entitlement) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Entitlement) ProtoMessage() {} + +func (x *Entitlement) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_config_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Entitlement) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Entitlement) GetDisplayName() string { + if x != nil { + return x.DisplayName + } + return "" +} + +func (x *Entitlement) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Entitlement) GetSlug() string { + if x != nil { + return x.Slug + } + return "" +} + +func (x *Entitlement) GetPurpose() string { + if x != nil { + return x.Purpose + } + return "" +} + +func (x *Entitlement) GetGrantableToResourceTypeIds() []string { + if x != nil { + return x.GrantableToResourceTypeIds + } + return nil +} + +func (x *Entitlement) GetResourceId() string { + if x != nil { + return x.ResourceId + } + return "" +} + +func (x *Entitlement) GetResourceTypeId() string { + if x != nil { + return x.ResourceTypeId + } + return "" +} + +func (x *Entitlement) SetId(v string) { + x.Id = v +} + +func (x *Entitlement) SetDisplayName(v string) { + x.DisplayName = v +} + +func (x *Entitlement) SetDescription(v string) { + x.Description = v +} + +func (x *Entitlement) SetSlug(v string) { + x.Slug = v +} + +func (x *Entitlement) SetPurpose(v string) { + x.Purpose = v +} + +func (x *Entitlement) SetGrantableToResourceTypeIds(v []string) { + x.GrantableToResourceTypeIds = v +} + +func (x *Entitlement) SetResourceId(v string) { + x.ResourceId = v +} + +func (x *Entitlement) SetResourceTypeId(v string) { + x.ResourceTypeId = v +} + +type Entitlement_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Id string + DisplayName string + Description string + Slug string + Purpose string + GrantableToResourceTypeIds []string + ResourceId string + ResourceTypeId string +} + +func (b0 Entitlement_builder) Build() *Entitlement { + m0 := &Entitlement{} + b, x := &b0, m0 + _, _ = b, x + x.Id = b.Id + x.DisplayName = b.DisplayName + x.Description = b.Description + x.Slug = b.Slug + x.Purpose = b.Purpose + x.GrantableToResourceTypeIds = b.GrantableToResourceTypeIds + x.ResourceId = b.ResourceId + x.ResourceTypeId = b.ResourceTypeId + return m0 +} + +type EntitlementSliceField struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + DefaultValue []*Entitlement `protobuf:"bytes,1,rep,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EntitlementSliceField) Reset() { + *x = EntitlementSliceField{} + mi := &file_c1_config_v1_config_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EntitlementSliceField) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EntitlementSliceField) ProtoMessage() {} + +func (x *EntitlementSliceField) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_config_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *EntitlementSliceField) GetDefaultValue() []*Entitlement { + if x != nil { + return x.DefaultValue + } + return nil +} + +func (x *EntitlementSliceField) SetDefaultValue(v []*Entitlement) { + x.DefaultValue = v +} + +type EntitlementSliceField_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + DefaultValue []*Entitlement +} + +func (b0 EntitlementSliceField_builder) Build() *EntitlementSliceField { + m0 := &EntitlementSliceField{} + b, x := &b0, m0 + _, _ = b, x + x.DefaultValue = b.DefaultValue + return m0 +} + +// Reference to an entitlement (used in Grant) +type EntitlementRef struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EntitlementRef) Reset() { + *x = EntitlementRef{} + mi := &file_c1_config_v1_config_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EntitlementRef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EntitlementRef) ProtoMessage() {} + +func (x *EntitlementRef) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_config_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *EntitlementRef) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *EntitlementRef) SetId(v string) { + x.Id = v +} + +type EntitlementRef_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Id string +} + +func (b0 EntitlementRef_builder) Build() *EntitlementRef { + m0 := &EntitlementRef{} + b, x := &b0, m0 + _, _ = b, x + x.Id = b.Id + return m0 +} + +// Simplified Grant for config return types (avoids import cycles with connector package) +type Grant struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Entitlement *EntitlementRef `protobuf:"bytes,2,opt,name=entitlement,proto3" json:"entitlement,omitempty"` + Principal *Resource `protobuf:"bytes,3,opt,name=principal,proto3" json:"principal,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Grant) Reset() { + *x = Grant{} + mi := &file_c1_config_v1_config_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Grant) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Grant) ProtoMessage() {} + +func (x *Grant) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_config_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Grant) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Grant) GetEntitlement() *EntitlementRef { + if x != nil { + return x.Entitlement + } + return nil +} + +func (x *Grant) GetPrincipal() *Resource { + if x != nil { + return x.Principal + } + return nil +} + +func (x *Grant) SetId(v string) { + x.Id = v +} + +func (x *Grant) SetEntitlement(v *EntitlementRef) { + x.Entitlement = v +} + +func (x *Grant) SetPrincipal(v *Resource) { + x.Principal = v +} + +func (x *Grant) HasEntitlement() bool { + if x == nil { + return false + } + return x.Entitlement != nil +} + +func (x *Grant) HasPrincipal() bool { + if x == nil { + return false + } + return x.Principal != nil +} + +func (x *Grant) ClearEntitlement() { + x.Entitlement = nil +} + +func (x *Grant) ClearPrincipal() { + x.Principal = nil +} + +type Grant_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Id string + Entitlement *EntitlementRef + Principal *Resource +} + +func (b0 Grant_builder) Build() *Grant { + m0 := &Grant{} + b, x := &b0, m0 + _, _ = b, x + x.Id = b.Id + x.Entitlement = b.Entitlement + x.Principal = b.Principal + return m0 +} + +type GrantSliceField struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + DefaultValue []*Grant `protobuf:"bytes,1,rep,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GrantSliceField) Reset() { + *x = GrantSliceField{} + mi := &file_c1_config_v1_config_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (x *Field) SetStringMapField(v *StringMapField) { - if v == nil { - x.Field = nil - return - } - x.Field = &Field_StringMapField{v} +func (x *GrantSliceField) String() string { + return protoimpl.X.MessageStringOf(x) } -func (x *Field) HasField() bool { - if x == nil { - return false +func (*GrantSliceField) ProtoMessage() {} + +func (x *GrantSliceField) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_config_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return x.Field != nil + return mi.MessageOf(x) } -func (x *Field) HasStringField() bool { - if x == nil { - return false +func (x *GrantSliceField) GetDefaultValue() []*Grant { + if x != nil { + return x.DefaultValue } - _, ok := x.Field.(*Field_StringField) - return ok + return nil } -func (x *Field) HasIntField() bool { - if x == nil { - return false - } - _, ok := x.Field.(*Field_IntField) - return ok +func (x *GrantSliceField) SetDefaultValue(v []*Grant) { + x.DefaultValue = v } -func (x *Field) HasBoolField() bool { - if x == nil { - return false - } - _, ok := x.Field.(*Field_BoolField) - return ok +type GrantSliceField_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + DefaultValue []*Grant } -func (x *Field) HasStringSliceField() bool { - if x == nil { - return false - } - _, ok := x.Field.(*Field_StringSliceField) - return ok +func (b0 GrantSliceField_builder) Build() *GrantSliceField { + m0 := &GrantSliceField{} + b, x := &b0, m0 + _, _ = b, x + x.DefaultValue = b.DefaultValue + return m0 } -func (x *Field) HasStringMapField() bool { - if x == nil { - return false - } - _, ok := x.Field.(*Field_StringMapField) - return ok +type ResourceIdField struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + DefaultValue *ResourceId `protobuf:"bytes,1,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` + Rules *ResourceIDRules `protobuf:"bytes,3,opt,name=rules,proto3,oneof" json:"rules,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (x *Field) ClearField() { - x.Field = nil +func (x *ResourceIdField) Reset() { + *x = ResourceIdField{} + mi := &file_c1_config_v1_config_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (x *Field) ClearStringField() { - if _, ok := x.Field.(*Field_StringField); ok { - x.Field = nil - } +func (x *ResourceIdField) String() string { + return protoimpl.X.MessageStringOf(x) } -func (x *Field) ClearIntField() { - if _, ok := x.Field.(*Field_IntField); ok { - x.Field = nil +func (*ResourceIdField) ProtoMessage() {} + +func (x *ResourceIdField) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_config_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } + return mi.MessageOf(x) } -func (x *Field) ClearBoolField() { - if _, ok := x.Field.(*Field_BoolField); ok { - x.Field = nil +func (x *ResourceIdField) GetDefaultValue() *ResourceId { + if x != nil { + return x.DefaultValue } + return nil } -func (x *Field) ClearStringSliceField() { - if _, ok := x.Field.(*Field_StringSliceField); ok { - x.Field = nil +func (x *ResourceIdField) GetRules() *ResourceIDRules { + if x != nil { + return x.Rules } + return nil } -func (x *Field) ClearStringMapField() { - if _, ok := x.Field.(*Field_StringMapField); ok { - x.Field = nil - } +func (x *ResourceIdField) SetDefaultValue(v *ResourceId) { + x.DefaultValue = v } -const Field_Field_not_set_case case_Field_Field = 0 -const Field_StringField_case case_Field_Field = 100 -const Field_IntField_case case_Field_Field = 101 -const Field_BoolField_case case_Field_Field = 102 -const Field_StringSliceField_case case_Field_Field = 103 -const Field_StringMapField_case case_Field_Field = 104 +func (x *ResourceIdField) SetRules(v *ResourceIDRules) { + x.Rules = v +} -func (x *Field) WhichField() case_Field_Field { +func (x *ResourceIdField) HasDefaultValue() bool { if x == nil { - return Field_Field_not_set_case + return false } - switch x.Field.(type) { - case *Field_StringField: - return Field_StringField_case - case *Field_IntField: - return Field_IntField_case - case *Field_BoolField: - return Field_BoolField_case - case *Field_StringSliceField: - return Field_StringSliceField_case - case *Field_StringMapField: - return Field_StringMapField_case - default: - return Field_Field_not_set_case + return x.DefaultValue != nil +} + +func (x *ResourceIdField) HasRules() bool { + if x == nil { + return false } + return x.Rules != nil } -type Field_builder struct { +func (x *ResourceIdField) ClearDefaultValue() { + x.DefaultValue = nil +} + +func (x *ResourceIdField) ClearRules() { + x.Rules = nil +} + +type ResourceIdField_builder struct { _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. - Name string - DisplayName string - Description string - Placeholder string - IsRequired bool - IsOps bool - IsSecret bool - // Fields of oneof Field: - StringField *StringField - IntField *IntField - BoolField *BoolField - StringSliceField *StringSliceField - StringMapField *StringMapField - // -- end of Field + DefaultValue *ResourceId + Rules *ResourceIDRules } -func (b0 Field_builder) Build() *Field { - m0 := &Field{} +func (b0 ResourceIdField_builder) Build() *ResourceIdField { + m0 := &ResourceIdField{} b, x := &b0, m0 _, _ = b, x - x.Name = b.Name - x.DisplayName = b.DisplayName - x.Description = b.Description - x.Placeholder = b.Placeholder - x.IsRequired = b.IsRequired - x.IsOps = b.IsOps - x.IsSecret = b.IsSecret - if b.StringField != nil { - x.Field = &Field_StringField{b.StringField} - } - if b.IntField != nil { - x.Field = &Field_IntField{b.IntField} - } - if b.BoolField != nil { - x.Field = &Field_BoolField{b.BoolField} - } - if b.StringSliceField != nil { - x.Field = &Field_StringSliceField{b.StringSliceField} - } - if b.StringMapField != nil { - x.Field = &Field_StringMapField{b.StringMapField} - } + x.DefaultValue = b.DefaultValue + x.Rules = b.Rules return m0 } -type case_Field_Field protoreflect.FieldNumber +type ResourceIdSliceField struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + DefaultValue []*ResourceIdField `protobuf:"bytes,1,rep,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` + Rules *RepeatedResourceIdRules `protobuf:"bytes,2,opt,name=rules,proto3,oneof" json:"rules,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} -func (x case_Field_Field) String() string { - md := file_c1_config_v1_config_proto_msgTypes[3].Descriptor() - if x == 0 { - return "not set" - } - return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x)) +func (x *ResourceIdSliceField) Reset() { + *x = ResourceIdSliceField{} + mi := &file_c1_config_v1_config_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -type isField_Field interface { - isField_Field() +func (x *ResourceIdSliceField) String() string { + return protoimpl.X.MessageStringOf(x) } -type Field_StringField struct { - StringField *StringField `protobuf:"bytes,100,opt,name=string_field,json=stringField,proto3,oneof"` +func (*ResourceIdSliceField) ProtoMessage() {} + +func (x *ResourceIdSliceField) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_config_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -type Field_IntField struct { - IntField *IntField `protobuf:"bytes,101,opt,name=int_field,json=intField,proto3,oneof"` +func (x *ResourceIdSliceField) GetDefaultValue() []*ResourceIdField { + if x != nil { + return x.DefaultValue + } + return nil } -type Field_BoolField struct { - BoolField *BoolField `protobuf:"bytes,102,opt,name=bool_field,json=boolField,proto3,oneof"` +func (x *ResourceIdSliceField) GetRules() *RepeatedResourceIdRules { + if x != nil { + return x.Rules + } + return nil } -type Field_StringSliceField struct { - StringSliceField *StringSliceField `protobuf:"bytes,103,opt,name=string_slice_field,json=stringSliceField,proto3,oneof"` +func (x *ResourceIdSliceField) SetDefaultValue(v []*ResourceIdField) { + x.DefaultValue = v } -type Field_StringMapField struct { - StringMapField *StringMapField `protobuf:"bytes,104,opt,name=string_map_field,json=stringMapField,proto3,oneof"` +func (x *ResourceIdSliceField) SetRules(v *RepeatedResourceIdRules) { + x.Rules = v } -func (*Field_StringField) isField_Field() {} +func (x *ResourceIdSliceField) HasRules() bool { + if x == nil { + return false + } + return x.Rules != nil +} -func (*Field_IntField) isField_Field() {} +func (x *ResourceIdSliceField) ClearRules() { + x.Rules = nil +} -func (*Field_BoolField) isField_Field() {} +type ResourceIdSliceField_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. -func (*Field_StringSliceField) isField_Field() {} + DefaultValue []*ResourceIdField + Rules *RepeatedResourceIdRules +} -func (*Field_StringMapField) isField_Field() {} +func (b0 ResourceIdSliceField_builder) Build() *ResourceIdSliceField { + m0 := &ResourceIdSliceField{} + b, x := &b0, m0 + _, _ = b, x + x.DefaultValue = b.DefaultValue + x.Rules = b.Rules + return m0 +} type IntField struct { state protoimpl.MessageState `protogen:"hybrid.v1"` @@ -972,7 +2188,7 @@ type IntField struct { func (x *IntField) Reset() { *x = IntField{} - mi := &file_c1_config_v1_config_proto_msgTypes[4] + mi := &file_c1_config_v1_config_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -984,7 +2200,7 @@ func (x *IntField) String() string { func (*IntField) ProtoMessage() {} func (x *IntField) ProtoReflect() protoreflect.Message { - mi := &file_c1_config_v1_config_proto_msgTypes[4] + mi := &file_c1_config_v1_config_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1055,7 +2271,7 @@ type BoolField struct { func (x *BoolField) Reset() { *x = BoolField{} - mi := &file_c1_config_v1_config_proto_msgTypes[5] + mi := &file_c1_config_v1_config_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1067,7 +2283,7 @@ func (x *BoolField) String() string { func (*BoolField) ProtoMessage() {} func (x *BoolField) ProtoReflect() protoreflect.Message { - mi := &file_c1_config_v1_config_proto_msgTypes[5] + mi := &file_c1_config_v1_config_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1137,7 +2353,7 @@ type StringSliceField struct { func (x *StringSliceField) Reset() { *x = StringSliceField{} - mi := &file_c1_config_v1_config_proto_msgTypes[6] + mi := &file_c1_config_v1_config_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1149,7 +2365,7 @@ func (x *StringSliceField) String() string { func (*StringSliceField) ProtoMessage() {} func (x *StringSliceField) ProtoReflect() protoreflect.Message { - mi := &file_c1_config_v1_config_proto_msgTypes[6] + mi := &file_c1_config_v1_config_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1219,7 +2435,7 @@ type StringMapField struct { func (x *StringMapField) Reset() { *x = StringMapField{} - mi := &file_c1_config_v1_config_proto_msgTypes[7] + mi := &file_c1_config_v1_config_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1231,7 +2447,7 @@ func (x *StringMapField) String() string { func (*StringMapField) ProtoMessage() {} func (x *StringMapField) ProtoReflect() protoreflect.Message { - mi := &file_c1_config_v1_config_proto_msgTypes[7] + mi := &file_c1_config_v1_config_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1302,7 +2518,7 @@ type StringFieldOption struct { func (x *StringFieldOption) Reset() { *x = StringFieldOption{} - mi := &file_c1_config_v1_config_proto_msgTypes[8] + mi := &file_c1_config_v1_config_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1314,7 +2530,7 @@ func (x *StringFieldOption) String() string { func (*StringFieldOption) ProtoMessage() {} func (x *StringFieldOption) ProtoReflect() protoreflect.Message { - mi := &file_c1_config_v1_config_proto_msgTypes[8] + mi := &file_c1_config_v1_config_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1390,7 +2606,7 @@ type StringField struct { func (x *StringField) Reset() { *x = StringField{} - mi := &file_c1_config_v1_config_proto_msgTypes[9] + mi := &file_c1_config_v1_config_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1402,7 +2618,7 @@ func (x *StringField) String() string { func (*StringField) ProtoMessage() {} func (x *StringField) ProtoReflect() protoreflect.Message { - mi := &file_c1_config_v1_config_proto_msgTypes[9] + mi := &file_c1_config_v1_config_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1535,7 +2751,7 @@ const file_c1_config_v1_config_proto_rawDesc = "" + "\fdisplay_name\x18\x02 \x01(\tR\vdisplayName\x12\x1b\n" + "\thelp_text\x18\x03 \x01(\tR\bhelpText\x12\x16\n" + "\x06fields\x18\x04 \x03(\tR\x06fields\x12\x18\n" + - "\adefault\x18\x05 \x01(\bR\adefault\"\xab\x04\n" + + "\adefault\x18\x05 \x01(\bR\adefault\"\x9d\b\n" + "\x05Field\x12\x12\n" + "\x04name\x18\x01 \x01(\tR\x04name\x12!\n" + "\fdisplay_name\x18\x02 \x01(\tR\vdisplayName\x12 \n" + @@ -1550,8 +2766,58 @@ const file_c1_config_v1_config_proto_rawDesc = "" + "\n" + "bool_field\x18f \x01(\v2\x17.c1.config.v1.BoolFieldH\x00R\tboolField\x12N\n" + "\x12string_slice_field\x18g \x01(\v2\x1e.c1.config.v1.StringSliceFieldH\x00R\x10stringSliceField\x12H\n" + - "\x10string_map_field\x18h \x01(\v2\x1c.c1.config.v1.StringMapFieldH\x00R\x0estringMapFieldB\a\n" + - "\x05field\"n\n" + + "\x10string_map_field\x18h \x01(\v2\x1c.c1.config.v1.StringMapFieldH\x00R\x0estringMapField\x12K\n" + + "\x11resource_id_field\x18i \x01(\v2\x1d.c1.config.v1.ResourceIdFieldH\x00R\x0fresourceIdField\x12[\n" + + "\x17resource_id_slice_field\x18j \x01(\v2\".c1.config.v1.ResourceIdSliceFieldH\x00R\x14resourceIdSliceField\x12D\n" + + "\x0eresource_field\x18k \x01(\v2\x1b.c1.config.v1.ResourceFieldH\x00R\rresourceField\x12T\n" + + "\x14resource_slice_field\x18l \x01(\v2 .c1.config.v1.ResourceSliceFieldH\x00R\x12resourceSliceField\x12]\n" + + "\x17entitlement_slice_field\x18m \x01(\v2#.c1.config.v1.EntitlementSliceFieldH\x00R\x15entitlementSliceField\x12K\n" + + "\x11grant_slice_field\x18n \x01(\v2\x1d.c1.config.v1.GrantSliceFieldH\x00R\x0fgrantSliceFieldB\a\n" + + "\x05field\"\x8a\x02\n" + + "\bResource\x129\n" + + "\vresource_id\x18\x01 \x01(\v2\x18.c1.config.v1.ResourceIdR\n" + + "resourceId\x12F\n" + + "\x12parent_resource_id\x18\x02 \x01(\v2\x18.c1.config.v1.ResourceIdR\x10parentResourceId\x12!\n" + + "\fdisplay_name\x18\x03 \x01(\tR\vdisplayName\x12 \n" + + "\vdescription\x18\x04 \x01(\tR\vdescription\x126\n" + + "\vannotations\x18\x05 \x03(\v2\x14.google.protobuf.AnyR\vannotations\"W\n" + + "\n" + + "ResourceId\x12(\n" + + "\x10resource_type_id\x18\x01 \x01(\tR\x0eresourceTypeId\x12\x1f\n" + + "\vresource_id\x18\x02 \x01(\tR\n" + + "resourceId\"L\n" + + "\rResourceField\x12;\n" + + "\rdefault_value\x18\x01 \x01(\v2\x16.c1.config.v1.ResourceR\fdefaultValue\"Q\n" + + "\x12ResourceSliceField\x12;\n" + + "\rdefault_value\x18\x01 \x03(\v2\x16.c1.config.v1.ResourceR\fdefaultValue\"\x9f\x02\n" + + "\vEntitlement\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12!\n" + + "\fdisplay_name\x18\x02 \x01(\tR\vdisplayName\x12 \n" + + "\vdescription\x18\x03 \x01(\tR\vdescription\x12\x12\n" + + "\x04slug\x18\x04 \x01(\tR\x04slug\x12\x18\n" + + "\apurpose\x18\x05 \x01(\tR\apurpose\x12B\n" + + "\x1egrantable_to_resource_type_ids\x18\x06 \x03(\tR\x1agrantableToResourceTypeIds\x12\x1f\n" + + "\vresource_id\x18\a \x01(\tR\n" + + "resourceId\x12(\n" + + "\x10resource_type_id\x18\b \x01(\tR\x0eresourceTypeId\"W\n" + + "\x15EntitlementSliceField\x12>\n" + + "\rdefault_value\x18\x01 \x03(\v2\x19.c1.config.v1.EntitlementR\fdefaultValue\" \n" + + "\x0eEntitlementRef\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\"\x8d\x01\n" + + "\x05Grant\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12>\n" + + "\ventitlement\x18\x02 \x01(\v2\x1c.c1.config.v1.EntitlementRefR\ventitlement\x124\n" + + "\tprincipal\x18\x03 \x01(\v2\x16.c1.config.v1.ResourceR\tprincipal\"K\n" + + "\x0fGrantSliceField\x128\n" + + "\rdefault_value\x18\x01 \x03(\v2\x13.c1.config.v1.GrantR\fdefaultValue\"\x94\x01\n" + + "\x0fResourceIdField\x12=\n" + + "\rdefault_value\x18\x01 \x01(\v2\x18.c1.config.v1.ResourceIdR\fdefaultValue\x128\n" + + "\x05rules\x18\x03 \x01(\v2\x1d.c1.config.v1.ResourceIDRulesH\x00R\x05rules\x88\x01\x01B\b\n" + + "\x06_rules\"\xa6\x01\n" + + "\x14ResourceIdSliceField\x12B\n" + + "\rdefault_value\x18\x01 \x03(\v2\x1d.c1.config.v1.ResourceIdFieldR\fdefaultValue\x12@\n" + + "\x05rules\x18\x02 \x01(\v2%.c1.config.v1.RepeatedResourceIdRulesH\x00R\x05rules\x88\x01\x01B\b\n" + + "\x06_rules\"n\n" + "\bIntField\x12#\n" + "\rdefault_value\x18\x01 \x01(\x03R\fdefaultValue\x123\n" + "\x05rules\x18\x02 \x01(\v2\x18.c1.config.v1.Int64RulesH\x00R\x05rules\x88\x01\x01B\b\n" + @@ -1596,52 +2862,84 @@ const file_c1_config_v1_config_proto_rawDesc = "" + "\x1dSTRING_FIELD_TYPE_FILE_UPLOAD\x10\x04B3Z1github.com/conductorone/baton-sdk/pb/c1/config/v1b\x06proto3" var file_c1_config_v1_config_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_c1_config_v1_config_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_c1_config_v1_config_proto_msgTypes = make([]protoimpl.MessageInfo, 22) var file_c1_config_v1_config_proto_goTypes = []any{ - (ConstraintKind)(0), // 0: c1.config.v1.ConstraintKind - (StringFieldType)(0), // 1: c1.config.v1.StringFieldType - (*Configuration)(nil), // 2: c1.config.v1.Configuration - (*Constraint)(nil), // 3: c1.config.v1.Constraint - (*FieldGroup)(nil), // 4: c1.config.v1.FieldGroup - (*Field)(nil), // 5: c1.config.v1.Field - (*IntField)(nil), // 6: c1.config.v1.IntField - (*BoolField)(nil), // 7: c1.config.v1.BoolField - (*StringSliceField)(nil), // 8: c1.config.v1.StringSliceField - (*StringMapField)(nil), // 9: c1.config.v1.StringMapField - (*StringFieldOption)(nil), // 10: c1.config.v1.StringFieldOption - (*StringField)(nil), // 11: c1.config.v1.StringField - nil, // 12: c1.config.v1.StringMapField.DefaultValueEntry - (*Int64Rules)(nil), // 13: c1.config.v1.Int64Rules - (*BoolRules)(nil), // 14: c1.config.v1.BoolRules - (*RepeatedStringRules)(nil), // 15: c1.config.v1.RepeatedStringRules - (*StringMapRules)(nil), // 16: c1.config.v1.StringMapRules - (*StringRules)(nil), // 17: c1.config.v1.StringRules - (*anypb.Any)(nil), // 18: google.protobuf.Any + (ConstraintKind)(0), // 0: c1.config.v1.ConstraintKind + (StringFieldType)(0), // 1: c1.config.v1.StringFieldType + (*Configuration)(nil), // 2: c1.config.v1.Configuration + (*Constraint)(nil), // 3: c1.config.v1.Constraint + (*FieldGroup)(nil), // 4: c1.config.v1.FieldGroup + (*Field)(nil), // 5: c1.config.v1.Field + (*Resource)(nil), // 6: c1.config.v1.Resource + (*ResourceId)(nil), // 7: c1.config.v1.ResourceId + (*ResourceField)(nil), // 8: c1.config.v1.ResourceField + (*ResourceSliceField)(nil), // 9: c1.config.v1.ResourceSliceField + (*Entitlement)(nil), // 10: c1.config.v1.Entitlement + (*EntitlementSliceField)(nil), // 11: c1.config.v1.EntitlementSliceField + (*EntitlementRef)(nil), // 12: c1.config.v1.EntitlementRef + (*Grant)(nil), // 13: c1.config.v1.Grant + (*GrantSliceField)(nil), // 14: c1.config.v1.GrantSliceField + (*ResourceIdField)(nil), // 15: c1.config.v1.ResourceIdField + (*ResourceIdSliceField)(nil), // 16: c1.config.v1.ResourceIdSliceField + (*IntField)(nil), // 17: c1.config.v1.IntField + (*BoolField)(nil), // 18: c1.config.v1.BoolField + (*StringSliceField)(nil), // 19: c1.config.v1.StringSliceField + (*StringMapField)(nil), // 20: c1.config.v1.StringMapField + (*StringFieldOption)(nil), // 21: c1.config.v1.StringFieldOption + (*StringField)(nil), // 22: c1.config.v1.StringField + nil, // 23: c1.config.v1.StringMapField.DefaultValueEntry + (*anypb.Any)(nil), // 24: google.protobuf.Any + (*ResourceIDRules)(nil), // 25: c1.config.v1.ResourceIDRules + (*RepeatedResourceIdRules)(nil), // 26: c1.config.v1.RepeatedResourceIdRules + (*Int64Rules)(nil), // 27: c1.config.v1.Int64Rules + (*BoolRules)(nil), // 28: c1.config.v1.BoolRules + (*RepeatedStringRules)(nil), // 29: c1.config.v1.RepeatedStringRules + (*StringMapRules)(nil), // 30: c1.config.v1.StringMapRules + (*StringRules)(nil), // 31: c1.config.v1.StringRules } var file_c1_config_v1_config_proto_depIdxs = []int32{ 5, // 0: c1.config.v1.Configuration.fields:type_name -> c1.config.v1.Field 3, // 1: c1.config.v1.Configuration.constraints:type_name -> c1.config.v1.Constraint 4, // 2: c1.config.v1.Configuration.field_groups:type_name -> c1.config.v1.FieldGroup 0, // 3: c1.config.v1.Constraint.kind:type_name -> c1.config.v1.ConstraintKind - 11, // 4: c1.config.v1.Field.string_field:type_name -> c1.config.v1.StringField - 6, // 5: c1.config.v1.Field.int_field:type_name -> c1.config.v1.IntField - 7, // 6: c1.config.v1.Field.bool_field:type_name -> c1.config.v1.BoolField - 8, // 7: c1.config.v1.Field.string_slice_field:type_name -> c1.config.v1.StringSliceField - 9, // 8: c1.config.v1.Field.string_map_field:type_name -> c1.config.v1.StringMapField - 13, // 9: c1.config.v1.IntField.rules:type_name -> c1.config.v1.Int64Rules - 14, // 10: c1.config.v1.BoolField.rules:type_name -> c1.config.v1.BoolRules - 15, // 11: c1.config.v1.StringSliceField.rules:type_name -> c1.config.v1.RepeatedStringRules - 12, // 12: c1.config.v1.StringMapField.default_value:type_name -> c1.config.v1.StringMapField.DefaultValueEntry - 16, // 13: c1.config.v1.StringMapField.rules:type_name -> c1.config.v1.StringMapRules - 17, // 14: c1.config.v1.StringField.rules:type_name -> c1.config.v1.StringRules - 1, // 15: c1.config.v1.StringField.type:type_name -> c1.config.v1.StringFieldType - 10, // 16: c1.config.v1.StringField.options:type_name -> c1.config.v1.StringFieldOption - 18, // 17: c1.config.v1.StringMapField.DefaultValueEntry.value:type_name -> google.protobuf.Any - 18, // [18:18] is the sub-list for method output_type - 18, // [18:18] is the sub-list for method input_type - 18, // [18:18] is the sub-list for extension type_name - 18, // [18:18] is the sub-list for extension extendee - 0, // [0:18] is the sub-list for field type_name + 22, // 4: c1.config.v1.Field.string_field:type_name -> c1.config.v1.StringField + 17, // 5: c1.config.v1.Field.int_field:type_name -> c1.config.v1.IntField + 18, // 6: c1.config.v1.Field.bool_field:type_name -> c1.config.v1.BoolField + 19, // 7: c1.config.v1.Field.string_slice_field:type_name -> c1.config.v1.StringSliceField + 20, // 8: c1.config.v1.Field.string_map_field:type_name -> c1.config.v1.StringMapField + 15, // 9: c1.config.v1.Field.resource_id_field:type_name -> c1.config.v1.ResourceIdField + 16, // 10: c1.config.v1.Field.resource_id_slice_field:type_name -> c1.config.v1.ResourceIdSliceField + 8, // 11: c1.config.v1.Field.resource_field:type_name -> c1.config.v1.ResourceField + 9, // 12: c1.config.v1.Field.resource_slice_field:type_name -> c1.config.v1.ResourceSliceField + 11, // 13: c1.config.v1.Field.entitlement_slice_field:type_name -> c1.config.v1.EntitlementSliceField + 14, // 14: c1.config.v1.Field.grant_slice_field:type_name -> c1.config.v1.GrantSliceField + 7, // 15: c1.config.v1.Resource.resource_id:type_name -> c1.config.v1.ResourceId + 7, // 16: c1.config.v1.Resource.parent_resource_id:type_name -> c1.config.v1.ResourceId + 24, // 17: c1.config.v1.Resource.annotations:type_name -> google.protobuf.Any + 6, // 18: c1.config.v1.ResourceField.default_value:type_name -> c1.config.v1.Resource + 6, // 19: c1.config.v1.ResourceSliceField.default_value:type_name -> c1.config.v1.Resource + 10, // 20: c1.config.v1.EntitlementSliceField.default_value:type_name -> c1.config.v1.Entitlement + 12, // 21: c1.config.v1.Grant.entitlement:type_name -> c1.config.v1.EntitlementRef + 6, // 22: c1.config.v1.Grant.principal:type_name -> c1.config.v1.Resource + 13, // 23: c1.config.v1.GrantSliceField.default_value:type_name -> c1.config.v1.Grant + 7, // 24: c1.config.v1.ResourceIdField.default_value:type_name -> c1.config.v1.ResourceId + 25, // 25: c1.config.v1.ResourceIdField.rules:type_name -> c1.config.v1.ResourceIDRules + 15, // 26: c1.config.v1.ResourceIdSliceField.default_value:type_name -> c1.config.v1.ResourceIdField + 26, // 27: c1.config.v1.ResourceIdSliceField.rules:type_name -> c1.config.v1.RepeatedResourceIdRules + 27, // 28: c1.config.v1.IntField.rules:type_name -> c1.config.v1.Int64Rules + 28, // 29: c1.config.v1.BoolField.rules:type_name -> c1.config.v1.BoolRules + 29, // 30: c1.config.v1.StringSliceField.rules:type_name -> c1.config.v1.RepeatedStringRules + 23, // 31: c1.config.v1.StringMapField.default_value:type_name -> c1.config.v1.StringMapField.DefaultValueEntry + 30, // 32: c1.config.v1.StringMapField.rules:type_name -> c1.config.v1.StringMapRules + 31, // 33: c1.config.v1.StringField.rules:type_name -> c1.config.v1.StringRules + 1, // 34: c1.config.v1.StringField.type:type_name -> c1.config.v1.StringFieldType + 21, // 35: c1.config.v1.StringField.options:type_name -> c1.config.v1.StringFieldOption + 24, // 36: c1.config.v1.StringMapField.DefaultValueEntry.value:type_name -> google.protobuf.Any + 37, // [37:37] is the sub-list for method output_type + 37, // [37:37] is the sub-list for method input_type + 37, // [37:37] is the sub-list for extension type_name + 37, // [37:37] is the sub-list for extension extendee + 0, // [0:37] is the sub-list for field type_name } func init() { file_c1_config_v1_config_proto_init() } @@ -1656,19 +2954,27 @@ func file_c1_config_v1_config_proto_init() { (*Field_BoolField)(nil), (*Field_StringSliceField)(nil), (*Field_StringMapField)(nil), - } - file_c1_config_v1_config_proto_msgTypes[4].OneofWrappers = []any{} - file_c1_config_v1_config_proto_msgTypes[5].OneofWrappers = []any{} - file_c1_config_v1_config_proto_msgTypes[6].OneofWrappers = []any{} - file_c1_config_v1_config_proto_msgTypes[7].OneofWrappers = []any{} - file_c1_config_v1_config_proto_msgTypes[9].OneofWrappers = []any{} + (*Field_ResourceIdField)(nil), + (*Field_ResourceIdSliceField)(nil), + (*Field_ResourceField)(nil), + (*Field_ResourceSliceField)(nil), + (*Field_EntitlementSliceField)(nil), + (*Field_GrantSliceField)(nil), + } + file_c1_config_v1_config_proto_msgTypes[13].OneofWrappers = []any{} + file_c1_config_v1_config_proto_msgTypes[14].OneofWrappers = []any{} + file_c1_config_v1_config_proto_msgTypes[15].OneofWrappers = []any{} + file_c1_config_v1_config_proto_msgTypes[16].OneofWrappers = []any{} + file_c1_config_v1_config_proto_msgTypes[17].OneofWrappers = []any{} + file_c1_config_v1_config_proto_msgTypes[18].OneofWrappers = []any{} + file_c1_config_v1_config_proto_msgTypes[20].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_c1_config_v1_config_proto_rawDesc), len(file_c1_config_v1_config_proto_rawDesc)), NumEnums: 2, - NumMessages: 11, + NumMessages: 22, NumExtensions: 0, NumServices: 0, }, diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/config.pb.validate.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/config.pb.validate.go index ff0ca67d..3c99fe9b 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/config.pb.validate.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/config.pb.validate.go @@ -706,6 +706,252 @@ func (m *Field) validate(all bool) error { } } + case *Field_ResourceIdField: + if v == nil { + err := FieldValidationError{ + field: "Field", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetResourceIdField()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, FieldValidationError{ + field: "ResourceIdField", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, FieldValidationError{ + field: "ResourceIdField", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetResourceIdField()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return FieldValidationError{ + field: "ResourceIdField", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *Field_ResourceIdSliceField: + if v == nil { + err := FieldValidationError{ + field: "Field", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetResourceIdSliceField()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, FieldValidationError{ + field: "ResourceIdSliceField", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, FieldValidationError{ + field: "ResourceIdSliceField", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetResourceIdSliceField()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return FieldValidationError{ + field: "ResourceIdSliceField", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *Field_ResourceField: + if v == nil { + err := FieldValidationError{ + field: "Field", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetResourceField()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, FieldValidationError{ + field: "ResourceField", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, FieldValidationError{ + field: "ResourceField", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetResourceField()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return FieldValidationError{ + field: "ResourceField", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *Field_ResourceSliceField: + if v == nil { + err := FieldValidationError{ + field: "Field", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetResourceSliceField()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, FieldValidationError{ + field: "ResourceSliceField", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, FieldValidationError{ + field: "ResourceSliceField", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetResourceSliceField()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return FieldValidationError{ + field: "ResourceSliceField", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *Field_EntitlementSliceField: + if v == nil { + err := FieldValidationError{ + field: "Field", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetEntitlementSliceField()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, FieldValidationError{ + field: "EntitlementSliceField", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, FieldValidationError{ + field: "EntitlementSliceField", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetEntitlementSliceField()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return FieldValidationError{ + field: "EntitlementSliceField", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *Field_GrantSliceField: + if v == nil { + err := FieldValidationError{ + field: "Field", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetGrantSliceField()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, FieldValidationError{ + field: "GrantSliceField", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, FieldValidationError{ + field: "GrantSliceField", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetGrantSliceField()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return FieldValidationError{ + field: "GrantSliceField", + reason: "embedded message failed validation", + cause: err, + } + } + } + default: _ = v // ensures v is used } @@ -787,6 +1033,1543 @@ var _ interface { ErrorName() string } = FieldValidationError{} +// Validate checks the field values on Resource with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *Resource) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Resource with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in ResourceMultiError, or nil +// if none found. +func (m *Resource) ValidateAll() error { + return m.validate(true) +} + +func (m *Resource) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetResourceId()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ResourceValidationError{ + field: "ResourceId", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ResourceValidationError{ + field: "ResourceId", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetResourceId()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ResourceValidationError{ + field: "ResourceId", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetParentResourceId()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ResourceValidationError{ + field: "ParentResourceId", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ResourceValidationError{ + field: "ParentResourceId", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetParentResourceId()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ResourceValidationError{ + field: "ParentResourceId", + reason: "embedded message failed validation", + cause: err, + } + } + } + + // no validation rules for DisplayName + + // no validation rules for Description + + for idx, item := range m.GetAnnotations() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ResourceValidationError{ + field: fmt.Sprintf("Annotations[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ResourceValidationError{ + field: fmt.Sprintf("Annotations[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ResourceValidationError{ + field: fmt.Sprintf("Annotations[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return ResourceMultiError(errors) + } + + return nil +} + +// ResourceMultiError is an error wrapping multiple validation errors returned +// by Resource.ValidateAll() if the designated constraints aren't met. +type ResourceMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ResourceMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ResourceMultiError) AllErrors() []error { return m } + +// ResourceValidationError is the validation error returned by +// Resource.Validate if the designated constraints aren't met. +type ResourceValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ResourceValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ResourceValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ResourceValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ResourceValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ResourceValidationError) ErrorName() string { return "ResourceValidationError" } + +// Error satisfies the builtin error interface +func (e ResourceValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sResource.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ResourceValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ResourceValidationError{} + +// Validate checks the field values on ResourceId with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *ResourceId) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ResourceId with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in ResourceIdMultiError, or +// nil if none found. +func (m *ResourceId) ValidateAll() error { + return m.validate(true) +} + +func (m *ResourceId) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for ResourceTypeId + + // no validation rules for ResourceId + + if len(errors) > 0 { + return ResourceIdMultiError(errors) + } + + return nil +} + +// ResourceIdMultiError is an error wrapping multiple validation errors +// returned by ResourceId.ValidateAll() if the designated constraints aren't met. +type ResourceIdMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ResourceIdMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ResourceIdMultiError) AllErrors() []error { return m } + +// ResourceIdValidationError is the validation error returned by +// ResourceId.Validate if the designated constraints aren't met. +type ResourceIdValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ResourceIdValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ResourceIdValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ResourceIdValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ResourceIdValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ResourceIdValidationError) ErrorName() string { return "ResourceIdValidationError" } + +// Error satisfies the builtin error interface +func (e ResourceIdValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sResourceId.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ResourceIdValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ResourceIdValidationError{} + +// Validate checks the field values on ResourceField with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *ResourceField) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ResourceField with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in ResourceFieldMultiError, or +// nil if none found. +func (m *ResourceField) ValidateAll() error { + return m.validate(true) +} + +func (m *ResourceField) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetDefaultValue()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ResourceFieldValidationError{ + field: "DefaultValue", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ResourceFieldValidationError{ + field: "DefaultValue", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetDefaultValue()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ResourceFieldValidationError{ + field: "DefaultValue", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return ResourceFieldMultiError(errors) + } + + return nil +} + +// ResourceFieldMultiError is an error wrapping multiple validation errors +// returned by ResourceField.ValidateAll() if the designated constraints +// aren't met. +type ResourceFieldMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ResourceFieldMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ResourceFieldMultiError) AllErrors() []error { return m } + +// ResourceFieldValidationError is the validation error returned by +// ResourceField.Validate if the designated constraints aren't met. +type ResourceFieldValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ResourceFieldValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ResourceFieldValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ResourceFieldValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ResourceFieldValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ResourceFieldValidationError) ErrorName() string { return "ResourceFieldValidationError" } + +// Error satisfies the builtin error interface +func (e ResourceFieldValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sResourceField.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ResourceFieldValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ResourceFieldValidationError{} + +// Validate checks the field values on ResourceSliceField with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *ResourceSliceField) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ResourceSliceField with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ResourceSliceFieldMultiError, or nil if none found. +func (m *ResourceSliceField) ValidateAll() error { + return m.validate(true) +} + +func (m *ResourceSliceField) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + for idx, item := range m.GetDefaultValue() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ResourceSliceFieldValidationError{ + field: fmt.Sprintf("DefaultValue[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ResourceSliceFieldValidationError{ + field: fmt.Sprintf("DefaultValue[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ResourceSliceFieldValidationError{ + field: fmt.Sprintf("DefaultValue[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return ResourceSliceFieldMultiError(errors) + } + + return nil +} + +// ResourceSliceFieldMultiError is an error wrapping multiple validation errors +// returned by ResourceSliceField.ValidateAll() if the designated constraints +// aren't met. +type ResourceSliceFieldMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ResourceSliceFieldMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ResourceSliceFieldMultiError) AllErrors() []error { return m } + +// ResourceSliceFieldValidationError is the validation error returned by +// ResourceSliceField.Validate if the designated constraints aren't met. +type ResourceSliceFieldValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ResourceSliceFieldValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ResourceSliceFieldValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ResourceSliceFieldValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ResourceSliceFieldValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ResourceSliceFieldValidationError) ErrorName() string { + return "ResourceSliceFieldValidationError" +} + +// Error satisfies the builtin error interface +func (e ResourceSliceFieldValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sResourceSliceField.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ResourceSliceFieldValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ResourceSliceFieldValidationError{} + +// Validate checks the field values on Entitlement with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *Entitlement) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Entitlement with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in EntitlementMultiError, or +// nil if none found. +func (m *Entitlement) ValidateAll() error { + return m.validate(true) +} + +func (m *Entitlement) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Id + + // no validation rules for DisplayName + + // no validation rules for Description + + // no validation rules for Slug + + // no validation rules for Purpose + + // no validation rules for ResourceId + + // no validation rules for ResourceTypeId + + if len(errors) > 0 { + return EntitlementMultiError(errors) + } + + return nil +} + +// EntitlementMultiError is an error wrapping multiple validation errors +// returned by Entitlement.ValidateAll() if the designated constraints aren't met. +type EntitlementMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m EntitlementMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m EntitlementMultiError) AllErrors() []error { return m } + +// EntitlementValidationError is the validation error returned by +// Entitlement.Validate if the designated constraints aren't met. +type EntitlementValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e EntitlementValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e EntitlementValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e EntitlementValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e EntitlementValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e EntitlementValidationError) ErrorName() string { return "EntitlementValidationError" } + +// Error satisfies the builtin error interface +func (e EntitlementValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sEntitlement.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = EntitlementValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = EntitlementValidationError{} + +// Validate checks the field values on EntitlementSliceField with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *EntitlementSliceField) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on EntitlementSliceField with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// EntitlementSliceFieldMultiError, or nil if none found. +func (m *EntitlementSliceField) ValidateAll() error { + return m.validate(true) +} + +func (m *EntitlementSliceField) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + for idx, item := range m.GetDefaultValue() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, EntitlementSliceFieldValidationError{ + field: fmt.Sprintf("DefaultValue[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, EntitlementSliceFieldValidationError{ + field: fmt.Sprintf("DefaultValue[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return EntitlementSliceFieldValidationError{ + field: fmt.Sprintf("DefaultValue[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return EntitlementSliceFieldMultiError(errors) + } + + return nil +} + +// EntitlementSliceFieldMultiError is an error wrapping multiple validation +// errors returned by EntitlementSliceField.ValidateAll() if the designated +// constraints aren't met. +type EntitlementSliceFieldMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m EntitlementSliceFieldMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m EntitlementSliceFieldMultiError) AllErrors() []error { return m } + +// EntitlementSliceFieldValidationError is the validation error returned by +// EntitlementSliceField.Validate if the designated constraints aren't met. +type EntitlementSliceFieldValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e EntitlementSliceFieldValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e EntitlementSliceFieldValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e EntitlementSliceFieldValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e EntitlementSliceFieldValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e EntitlementSliceFieldValidationError) ErrorName() string { + return "EntitlementSliceFieldValidationError" +} + +// Error satisfies the builtin error interface +func (e EntitlementSliceFieldValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sEntitlementSliceField.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = EntitlementSliceFieldValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = EntitlementSliceFieldValidationError{} + +// Validate checks the field values on EntitlementRef with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *EntitlementRef) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on EntitlementRef with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in EntitlementRefMultiError, +// or nil if none found. +func (m *EntitlementRef) ValidateAll() error { + return m.validate(true) +} + +func (m *EntitlementRef) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Id + + if len(errors) > 0 { + return EntitlementRefMultiError(errors) + } + + return nil +} + +// EntitlementRefMultiError is an error wrapping multiple validation errors +// returned by EntitlementRef.ValidateAll() if the designated constraints +// aren't met. +type EntitlementRefMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m EntitlementRefMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m EntitlementRefMultiError) AllErrors() []error { return m } + +// EntitlementRefValidationError is the validation error returned by +// EntitlementRef.Validate if the designated constraints aren't met. +type EntitlementRefValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e EntitlementRefValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e EntitlementRefValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e EntitlementRefValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e EntitlementRefValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e EntitlementRefValidationError) ErrorName() string { return "EntitlementRefValidationError" } + +// Error satisfies the builtin error interface +func (e EntitlementRefValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sEntitlementRef.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = EntitlementRefValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = EntitlementRefValidationError{} + +// Validate checks the field values on Grant with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *Grant) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Grant with the rules defined in the +// proto definition for this message. If any rules are violated, the result is +// a list of violation errors wrapped in GrantMultiError, or nil if none found. +func (m *Grant) ValidateAll() error { + return m.validate(true) +} + +func (m *Grant) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Id + + if all { + switch v := interface{}(m.GetEntitlement()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, GrantValidationError{ + field: "Entitlement", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, GrantValidationError{ + field: "Entitlement", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetEntitlement()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return GrantValidationError{ + field: "Entitlement", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetPrincipal()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, GrantValidationError{ + field: "Principal", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, GrantValidationError{ + field: "Principal", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetPrincipal()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return GrantValidationError{ + field: "Principal", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return GrantMultiError(errors) + } + + return nil +} + +// GrantMultiError is an error wrapping multiple validation errors returned by +// Grant.ValidateAll() if the designated constraints aren't met. +type GrantMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m GrantMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m GrantMultiError) AllErrors() []error { return m } + +// GrantValidationError is the validation error returned by Grant.Validate if +// the designated constraints aren't met. +type GrantValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GrantValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GrantValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GrantValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GrantValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GrantValidationError) ErrorName() string { return "GrantValidationError" } + +// Error satisfies the builtin error interface +func (e GrantValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGrant.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GrantValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GrantValidationError{} + +// Validate checks the field values on GrantSliceField with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *GrantSliceField) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on GrantSliceField with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// GrantSliceFieldMultiError, or nil if none found. +func (m *GrantSliceField) ValidateAll() error { + return m.validate(true) +} + +func (m *GrantSliceField) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + for idx, item := range m.GetDefaultValue() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, GrantSliceFieldValidationError{ + field: fmt.Sprintf("DefaultValue[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, GrantSliceFieldValidationError{ + field: fmt.Sprintf("DefaultValue[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return GrantSliceFieldValidationError{ + field: fmt.Sprintf("DefaultValue[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return GrantSliceFieldMultiError(errors) + } + + return nil +} + +// GrantSliceFieldMultiError is an error wrapping multiple validation errors +// returned by GrantSliceField.ValidateAll() if the designated constraints +// aren't met. +type GrantSliceFieldMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m GrantSliceFieldMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m GrantSliceFieldMultiError) AllErrors() []error { return m } + +// GrantSliceFieldValidationError is the validation error returned by +// GrantSliceField.Validate if the designated constraints aren't met. +type GrantSliceFieldValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GrantSliceFieldValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GrantSliceFieldValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GrantSliceFieldValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GrantSliceFieldValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GrantSliceFieldValidationError) ErrorName() string { return "GrantSliceFieldValidationError" } + +// Error satisfies the builtin error interface +func (e GrantSliceFieldValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGrantSliceField.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GrantSliceFieldValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GrantSliceFieldValidationError{} + +// Validate checks the field values on ResourceIdField with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *ResourceIdField) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ResourceIdField with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ResourceIdFieldMultiError, or nil if none found. +func (m *ResourceIdField) ValidateAll() error { + return m.validate(true) +} + +func (m *ResourceIdField) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetDefaultValue()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ResourceIdFieldValidationError{ + field: "DefaultValue", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ResourceIdFieldValidationError{ + field: "DefaultValue", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetDefaultValue()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ResourceIdFieldValidationError{ + field: "DefaultValue", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if m.Rules != nil { + + if all { + switch v := interface{}(m.GetRules()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ResourceIdFieldValidationError{ + field: "Rules", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ResourceIdFieldValidationError{ + field: "Rules", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetRules()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ResourceIdFieldValidationError{ + field: "Rules", + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return ResourceIdFieldMultiError(errors) + } + + return nil +} + +// ResourceIdFieldMultiError is an error wrapping multiple validation errors +// returned by ResourceIdField.ValidateAll() if the designated constraints +// aren't met. +type ResourceIdFieldMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ResourceIdFieldMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ResourceIdFieldMultiError) AllErrors() []error { return m } + +// ResourceIdFieldValidationError is the validation error returned by +// ResourceIdField.Validate if the designated constraints aren't met. +type ResourceIdFieldValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ResourceIdFieldValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ResourceIdFieldValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ResourceIdFieldValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ResourceIdFieldValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ResourceIdFieldValidationError) ErrorName() string { return "ResourceIdFieldValidationError" } + +// Error satisfies the builtin error interface +func (e ResourceIdFieldValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sResourceIdField.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ResourceIdFieldValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ResourceIdFieldValidationError{} + +// Validate checks the field values on ResourceIdSliceField with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *ResourceIdSliceField) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ResourceIdSliceField with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ResourceIdSliceFieldMultiError, or nil if none found. +func (m *ResourceIdSliceField) ValidateAll() error { + return m.validate(true) +} + +func (m *ResourceIdSliceField) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + for idx, item := range m.GetDefaultValue() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ResourceIdSliceFieldValidationError{ + field: fmt.Sprintf("DefaultValue[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ResourceIdSliceFieldValidationError{ + field: fmt.Sprintf("DefaultValue[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ResourceIdSliceFieldValidationError{ + field: fmt.Sprintf("DefaultValue[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if m.Rules != nil { + + if all { + switch v := interface{}(m.GetRules()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ResourceIdSliceFieldValidationError{ + field: "Rules", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ResourceIdSliceFieldValidationError{ + field: "Rules", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetRules()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ResourceIdSliceFieldValidationError{ + field: "Rules", + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return ResourceIdSliceFieldMultiError(errors) + } + + return nil +} + +// ResourceIdSliceFieldMultiError is an error wrapping multiple validation +// errors returned by ResourceIdSliceField.ValidateAll() if the designated +// constraints aren't met. +type ResourceIdSliceFieldMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ResourceIdSliceFieldMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ResourceIdSliceFieldMultiError) AllErrors() []error { return m } + +// ResourceIdSliceFieldValidationError is the validation error returned by +// ResourceIdSliceField.Validate if the designated constraints aren't met. +type ResourceIdSliceFieldValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ResourceIdSliceFieldValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ResourceIdSliceFieldValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ResourceIdSliceFieldValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ResourceIdSliceFieldValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ResourceIdSliceFieldValidationError) ErrorName() string { + return "ResourceIdSliceFieldValidationError" +} + +// Error satisfies the builtin error interface +func (e ResourceIdSliceFieldValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sResourceIdSliceField.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ResourceIdSliceFieldValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ResourceIdSliceFieldValidationError{} + // Validate checks the field values on IntField with the rules defined in the // proto definition for this message. If any rules are violated, the first // error encountered is returned, or nil if there are no violations. diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/config_protoopaque.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/config_protoopaque.pb.go index 5dd83dbf..a236f5f3 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/config_protoopaque.pb.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/config_protoopaque.pb.go @@ -685,6 +685,60 @@ func (x *Field) GetStringMapField() *StringMapField { return nil } +func (x *Field) GetResourceIdField() *ResourceIdField { + if x != nil { + if x, ok := x.xxx_hidden_Field.(*field_ResourceIdField); ok { + return x.ResourceIdField + } + } + return nil +} + +func (x *Field) GetResourceIdSliceField() *ResourceIdSliceField { + if x != nil { + if x, ok := x.xxx_hidden_Field.(*field_ResourceIdSliceField); ok { + return x.ResourceIdSliceField + } + } + return nil +} + +func (x *Field) GetResourceField() *ResourceField { + if x != nil { + if x, ok := x.xxx_hidden_Field.(*field_ResourceField); ok { + return x.ResourceField + } + } + return nil +} + +func (x *Field) GetResourceSliceField() *ResourceSliceField { + if x != nil { + if x, ok := x.xxx_hidden_Field.(*field_ResourceSliceField); ok { + return x.ResourceSliceField + } + } + return nil +} + +func (x *Field) GetEntitlementSliceField() *EntitlementSliceField { + if x != nil { + if x, ok := x.xxx_hidden_Field.(*field_EntitlementSliceField); ok { + return x.EntitlementSliceField + } + } + return nil +} + +func (x *Field) GetGrantSliceField() *GrantSliceField { + if x != nil { + if x, ok := x.xxx_hidden_Field.(*field_GrantSliceField); ok { + return x.GrantSliceField + } + } + return nil +} + func (x *Field) SetName(v string) { x.xxx_hidden_Name = v } @@ -705,253 +759,1419 @@ func (x *Field) SetIsRequired(v bool) { x.xxx_hidden_IsRequired = v } -func (x *Field) SetIsOps(v bool) { - x.xxx_hidden_IsOps = v +func (x *Field) SetIsOps(v bool) { + x.xxx_hidden_IsOps = v +} + +func (x *Field) SetIsSecret(v bool) { + x.xxx_hidden_IsSecret = v +} + +func (x *Field) SetStringField(v *StringField) { + if v == nil { + x.xxx_hidden_Field = nil + return + } + x.xxx_hidden_Field = &field_StringField{v} +} + +func (x *Field) SetIntField(v *IntField) { + if v == nil { + x.xxx_hidden_Field = nil + return + } + x.xxx_hidden_Field = &field_IntField{v} +} + +func (x *Field) SetBoolField(v *BoolField) { + if v == nil { + x.xxx_hidden_Field = nil + return + } + x.xxx_hidden_Field = &field_BoolField{v} +} + +func (x *Field) SetStringSliceField(v *StringSliceField) { + if v == nil { + x.xxx_hidden_Field = nil + return + } + x.xxx_hidden_Field = &field_StringSliceField{v} +} + +func (x *Field) SetStringMapField(v *StringMapField) { + if v == nil { + x.xxx_hidden_Field = nil + return + } + x.xxx_hidden_Field = &field_StringMapField{v} +} + +func (x *Field) SetResourceIdField(v *ResourceIdField) { + if v == nil { + x.xxx_hidden_Field = nil + return + } + x.xxx_hidden_Field = &field_ResourceIdField{v} +} + +func (x *Field) SetResourceIdSliceField(v *ResourceIdSliceField) { + if v == nil { + x.xxx_hidden_Field = nil + return + } + x.xxx_hidden_Field = &field_ResourceIdSliceField{v} +} + +func (x *Field) SetResourceField(v *ResourceField) { + if v == nil { + x.xxx_hidden_Field = nil + return + } + x.xxx_hidden_Field = &field_ResourceField{v} +} + +func (x *Field) SetResourceSliceField(v *ResourceSliceField) { + if v == nil { + x.xxx_hidden_Field = nil + return + } + x.xxx_hidden_Field = &field_ResourceSliceField{v} +} + +func (x *Field) SetEntitlementSliceField(v *EntitlementSliceField) { + if v == nil { + x.xxx_hidden_Field = nil + return + } + x.xxx_hidden_Field = &field_EntitlementSliceField{v} +} + +func (x *Field) SetGrantSliceField(v *GrantSliceField) { + if v == nil { + x.xxx_hidden_Field = nil + return + } + x.xxx_hidden_Field = &field_GrantSliceField{v} +} + +func (x *Field) HasField() bool { + if x == nil { + return false + } + return x.xxx_hidden_Field != nil +} + +func (x *Field) HasStringField() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Field.(*field_StringField) + return ok +} + +func (x *Field) HasIntField() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Field.(*field_IntField) + return ok +} + +func (x *Field) HasBoolField() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Field.(*field_BoolField) + return ok +} + +func (x *Field) HasStringSliceField() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Field.(*field_StringSliceField) + return ok +} + +func (x *Field) HasStringMapField() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Field.(*field_StringMapField) + return ok +} + +func (x *Field) HasResourceIdField() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Field.(*field_ResourceIdField) + return ok +} + +func (x *Field) HasResourceIdSliceField() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Field.(*field_ResourceIdSliceField) + return ok +} + +func (x *Field) HasResourceField() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Field.(*field_ResourceField) + return ok +} + +func (x *Field) HasResourceSliceField() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Field.(*field_ResourceSliceField) + return ok +} + +func (x *Field) HasEntitlementSliceField() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Field.(*field_EntitlementSliceField) + return ok +} + +func (x *Field) HasGrantSliceField() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Field.(*field_GrantSliceField) + return ok +} + +func (x *Field) ClearField() { + x.xxx_hidden_Field = nil +} + +func (x *Field) ClearStringField() { + if _, ok := x.xxx_hidden_Field.(*field_StringField); ok { + x.xxx_hidden_Field = nil + } +} + +func (x *Field) ClearIntField() { + if _, ok := x.xxx_hidden_Field.(*field_IntField); ok { + x.xxx_hidden_Field = nil + } +} + +func (x *Field) ClearBoolField() { + if _, ok := x.xxx_hidden_Field.(*field_BoolField); ok { + x.xxx_hidden_Field = nil + } +} + +func (x *Field) ClearStringSliceField() { + if _, ok := x.xxx_hidden_Field.(*field_StringSliceField); ok { + x.xxx_hidden_Field = nil + } +} + +func (x *Field) ClearStringMapField() { + if _, ok := x.xxx_hidden_Field.(*field_StringMapField); ok { + x.xxx_hidden_Field = nil + } +} + +func (x *Field) ClearResourceIdField() { + if _, ok := x.xxx_hidden_Field.(*field_ResourceIdField); ok { + x.xxx_hidden_Field = nil + } +} + +func (x *Field) ClearResourceIdSliceField() { + if _, ok := x.xxx_hidden_Field.(*field_ResourceIdSliceField); ok { + x.xxx_hidden_Field = nil + } +} + +func (x *Field) ClearResourceField() { + if _, ok := x.xxx_hidden_Field.(*field_ResourceField); ok { + x.xxx_hidden_Field = nil + } +} + +func (x *Field) ClearResourceSliceField() { + if _, ok := x.xxx_hidden_Field.(*field_ResourceSliceField); ok { + x.xxx_hidden_Field = nil + } +} + +func (x *Field) ClearEntitlementSliceField() { + if _, ok := x.xxx_hidden_Field.(*field_EntitlementSliceField); ok { + x.xxx_hidden_Field = nil + } +} + +func (x *Field) ClearGrantSliceField() { + if _, ok := x.xxx_hidden_Field.(*field_GrantSliceField); ok { + x.xxx_hidden_Field = nil + } +} + +const Field_Field_not_set_case case_Field_Field = 0 +const Field_StringField_case case_Field_Field = 100 +const Field_IntField_case case_Field_Field = 101 +const Field_BoolField_case case_Field_Field = 102 +const Field_StringSliceField_case case_Field_Field = 103 +const Field_StringMapField_case case_Field_Field = 104 +const Field_ResourceIdField_case case_Field_Field = 105 +const Field_ResourceIdSliceField_case case_Field_Field = 106 +const Field_ResourceField_case case_Field_Field = 107 +const Field_ResourceSliceField_case case_Field_Field = 108 +const Field_EntitlementSliceField_case case_Field_Field = 109 +const Field_GrantSliceField_case case_Field_Field = 110 + +func (x *Field) WhichField() case_Field_Field { + if x == nil { + return Field_Field_not_set_case + } + switch x.xxx_hidden_Field.(type) { + case *field_StringField: + return Field_StringField_case + case *field_IntField: + return Field_IntField_case + case *field_BoolField: + return Field_BoolField_case + case *field_StringSliceField: + return Field_StringSliceField_case + case *field_StringMapField: + return Field_StringMapField_case + case *field_ResourceIdField: + return Field_ResourceIdField_case + case *field_ResourceIdSliceField: + return Field_ResourceIdSliceField_case + case *field_ResourceField: + return Field_ResourceField_case + case *field_ResourceSliceField: + return Field_ResourceSliceField_case + case *field_EntitlementSliceField: + return Field_EntitlementSliceField_case + case *field_GrantSliceField: + return Field_GrantSliceField_case + default: + return Field_Field_not_set_case + } +} + +type Field_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Name string + DisplayName string + Description string + Placeholder string + IsRequired bool + IsOps bool + IsSecret bool + // Fields of oneof xxx_hidden_Field: + StringField *StringField + IntField *IntField + BoolField *BoolField + StringSliceField *StringSliceField + StringMapField *StringMapField + ResourceIdField *ResourceIdField + ResourceIdSliceField *ResourceIdSliceField + // These are meant to serve as return types for actions. + ResourceField *ResourceField + ResourceSliceField *ResourceSliceField + EntitlementSliceField *EntitlementSliceField + GrantSliceField *GrantSliceField + // -- end of xxx_hidden_Field +} + +func (b0 Field_builder) Build() *Field { + m0 := &Field{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Name = b.Name + x.xxx_hidden_DisplayName = b.DisplayName + x.xxx_hidden_Description = b.Description + x.xxx_hidden_Placeholder = b.Placeholder + x.xxx_hidden_IsRequired = b.IsRequired + x.xxx_hidden_IsOps = b.IsOps + x.xxx_hidden_IsSecret = b.IsSecret + if b.StringField != nil { + x.xxx_hidden_Field = &field_StringField{b.StringField} + } + if b.IntField != nil { + x.xxx_hidden_Field = &field_IntField{b.IntField} + } + if b.BoolField != nil { + x.xxx_hidden_Field = &field_BoolField{b.BoolField} + } + if b.StringSliceField != nil { + x.xxx_hidden_Field = &field_StringSliceField{b.StringSliceField} + } + if b.StringMapField != nil { + x.xxx_hidden_Field = &field_StringMapField{b.StringMapField} + } + if b.ResourceIdField != nil { + x.xxx_hidden_Field = &field_ResourceIdField{b.ResourceIdField} + } + if b.ResourceIdSliceField != nil { + x.xxx_hidden_Field = &field_ResourceIdSliceField{b.ResourceIdSliceField} + } + if b.ResourceField != nil { + x.xxx_hidden_Field = &field_ResourceField{b.ResourceField} + } + if b.ResourceSliceField != nil { + x.xxx_hidden_Field = &field_ResourceSliceField{b.ResourceSliceField} + } + if b.EntitlementSliceField != nil { + x.xxx_hidden_Field = &field_EntitlementSliceField{b.EntitlementSliceField} + } + if b.GrantSliceField != nil { + x.xxx_hidden_Field = &field_GrantSliceField{b.GrantSliceField} + } + return m0 +} + +type case_Field_Field protoreflect.FieldNumber + +func (x case_Field_Field) String() string { + md := file_c1_config_v1_config_proto_msgTypes[3].Descriptor() + if x == 0 { + return "not set" + } + return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x)) +} + +type isField_Field interface { + isField_Field() +} + +type field_StringField struct { + StringField *StringField `protobuf:"bytes,100,opt,name=string_field,json=stringField,proto3,oneof"` +} + +type field_IntField struct { + IntField *IntField `protobuf:"bytes,101,opt,name=int_field,json=intField,proto3,oneof"` +} + +type field_BoolField struct { + BoolField *BoolField `protobuf:"bytes,102,opt,name=bool_field,json=boolField,proto3,oneof"` +} + +type field_StringSliceField struct { + StringSliceField *StringSliceField `protobuf:"bytes,103,opt,name=string_slice_field,json=stringSliceField,proto3,oneof"` +} + +type field_StringMapField struct { + StringMapField *StringMapField `protobuf:"bytes,104,opt,name=string_map_field,json=stringMapField,proto3,oneof"` +} + +type field_ResourceIdField struct { + ResourceIdField *ResourceIdField `protobuf:"bytes,105,opt,name=resource_id_field,json=resourceIdField,proto3,oneof"` +} + +type field_ResourceIdSliceField struct { + ResourceIdSliceField *ResourceIdSliceField `protobuf:"bytes,106,opt,name=resource_id_slice_field,json=resourceIdSliceField,proto3,oneof"` +} + +type field_ResourceField struct { + // These are meant to serve as return types for actions. + ResourceField *ResourceField `protobuf:"bytes,107,opt,name=resource_field,json=resourceField,proto3,oneof"` +} + +type field_ResourceSliceField struct { + ResourceSliceField *ResourceSliceField `protobuf:"bytes,108,opt,name=resource_slice_field,json=resourceSliceField,proto3,oneof"` +} + +type field_EntitlementSliceField struct { + EntitlementSliceField *EntitlementSliceField `protobuf:"bytes,109,opt,name=entitlement_slice_field,json=entitlementSliceField,proto3,oneof"` +} + +type field_GrantSliceField struct { + GrantSliceField *GrantSliceField `protobuf:"bytes,110,opt,name=grant_slice_field,json=grantSliceField,proto3,oneof"` +} + +func (*field_StringField) isField_Field() {} + +func (*field_IntField) isField_Field() {} + +func (*field_BoolField) isField_Field() {} + +func (*field_StringSliceField) isField_Field() {} + +func (*field_StringMapField) isField_Field() {} + +func (*field_ResourceIdField) isField_Field() {} + +func (*field_ResourceIdSliceField) isField_Field() {} + +func (*field_ResourceField) isField_Field() {} + +func (*field_ResourceSliceField) isField_Field() {} + +func (*field_EntitlementSliceField) isField_Field() {} + +func (*field_GrantSliceField) isField_Field() {} + +// These are partially duplicate with the Resource proto in the connector package. +// This is to avoid import cycles +type Resource struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_ResourceId *ResourceId `protobuf:"bytes,1,opt,name=resource_id,json=resourceId,proto3"` + xxx_hidden_ParentResourceId *ResourceId `protobuf:"bytes,2,opt,name=parent_resource_id,json=parentResourceId,proto3"` + xxx_hidden_DisplayName string `protobuf:"bytes,3,opt,name=display_name,json=displayName,proto3"` + xxx_hidden_Description string `protobuf:"bytes,4,opt,name=description,proto3"` + xxx_hidden_Annotations *[]*anypb.Any `protobuf:"bytes,5,rep,name=annotations,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Resource) Reset() { + *x = Resource{} + mi := &file_c1_config_v1_config_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Resource) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Resource) ProtoMessage() {} + +func (x *Resource) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_config_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Resource) GetResourceId() *ResourceId { + if x != nil { + return x.xxx_hidden_ResourceId + } + return nil +} + +func (x *Resource) GetParentResourceId() *ResourceId { + if x != nil { + return x.xxx_hidden_ParentResourceId + } + return nil +} + +func (x *Resource) GetDisplayName() string { + if x != nil { + return x.xxx_hidden_DisplayName + } + return "" +} + +func (x *Resource) GetDescription() string { + if x != nil { + return x.xxx_hidden_Description + } + return "" +} + +func (x *Resource) GetAnnotations() []*anypb.Any { + if x != nil { + if x.xxx_hidden_Annotations != nil { + return *x.xxx_hidden_Annotations + } + } + return nil +} + +func (x *Resource) SetResourceId(v *ResourceId) { + x.xxx_hidden_ResourceId = v +} + +func (x *Resource) SetParentResourceId(v *ResourceId) { + x.xxx_hidden_ParentResourceId = v +} + +func (x *Resource) SetDisplayName(v string) { + x.xxx_hidden_DisplayName = v +} + +func (x *Resource) SetDescription(v string) { + x.xxx_hidden_Description = v +} + +func (x *Resource) SetAnnotations(v []*anypb.Any) { + x.xxx_hidden_Annotations = &v +} + +func (x *Resource) HasResourceId() bool { + if x == nil { + return false + } + return x.xxx_hidden_ResourceId != nil +} + +func (x *Resource) HasParentResourceId() bool { + if x == nil { + return false + } + return x.xxx_hidden_ParentResourceId != nil +} + +func (x *Resource) ClearResourceId() { + x.xxx_hidden_ResourceId = nil +} + +func (x *Resource) ClearParentResourceId() { + x.xxx_hidden_ParentResourceId = nil +} + +type Resource_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + ResourceId *ResourceId + ParentResourceId *ResourceId + DisplayName string + Description string + Annotations []*anypb.Any +} + +func (b0 Resource_builder) Build() *Resource { + m0 := &Resource{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_ResourceId = b.ResourceId + x.xxx_hidden_ParentResourceId = b.ParentResourceId + x.xxx_hidden_DisplayName = b.DisplayName + x.xxx_hidden_Description = b.Description + x.xxx_hidden_Annotations = &b.Annotations + return m0 +} + +type ResourceId struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_ResourceTypeId string `protobuf:"bytes,1,opt,name=resource_type_id,json=resourceTypeId,proto3"` + xxx_hidden_ResourceId string `protobuf:"bytes,2,opt,name=resource_id,json=resourceId,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResourceId) Reset() { + *x = ResourceId{} + mi := &file_c1_config_v1_config_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResourceId) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResourceId) ProtoMessage() {} + +func (x *ResourceId) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_config_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ResourceId) GetResourceTypeId() string { + if x != nil { + return x.xxx_hidden_ResourceTypeId + } + return "" +} + +func (x *ResourceId) GetResourceId() string { + if x != nil { + return x.xxx_hidden_ResourceId + } + return "" +} + +func (x *ResourceId) SetResourceTypeId(v string) { + x.xxx_hidden_ResourceTypeId = v +} + +func (x *ResourceId) SetResourceId(v string) { + x.xxx_hidden_ResourceId = v +} + +type ResourceId_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + ResourceTypeId string + ResourceId string +} + +func (b0 ResourceId_builder) Build() *ResourceId { + m0 := &ResourceId{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_ResourceTypeId = b.ResourceTypeId + x.xxx_hidden_ResourceId = b.ResourceId + return m0 +} + +type ResourceField struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_DefaultValue *Resource `protobuf:"bytes,1,opt,name=default_value,json=defaultValue,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResourceField) Reset() { + *x = ResourceField{} + mi := &file_c1_config_v1_config_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResourceField) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResourceField) ProtoMessage() {} + +func (x *ResourceField) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_config_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ResourceField) GetDefaultValue() *Resource { + if x != nil { + return x.xxx_hidden_DefaultValue + } + return nil +} + +func (x *ResourceField) SetDefaultValue(v *Resource) { + x.xxx_hidden_DefaultValue = v +} + +func (x *ResourceField) HasDefaultValue() bool { + if x == nil { + return false + } + return x.xxx_hidden_DefaultValue != nil +} + +func (x *ResourceField) ClearDefaultValue() { + x.xxx_hidden_DefaultValue = nil +} + +type ResourceField_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + DefaultValue *Resource +} + +func (b0 ResourceField_builder) Build() *ResourceField { + m0 := &ResourceField{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_DefaultValue = b.DefaultValue + return m0 +} + +type ResourceSliceField struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_DefaultValue *[]*Resource `protobuf:"bytes,1,rep,name=default_value,json=defaultValue,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResourceSliceField) Reset() { + *x = ResourceSliceField{} + mi := &file_c1_config_v1_config_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResourceSliceField) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResourceSliceField) ProtoMessage() {} + +func (x *ResourceSliceField) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_config_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ResourceSliceField) GetDefaultValue() []*Resource { + if x != nil { + if x.xxx_hidden_DefaultValue != nil { + return *x.xxx_hidden_DefaultValue + } + } + return nil +} + +func (x *ResourceSliceField) SetDefaultValue(v []*Resource) { + x.xxx_hidden_DefaultValue = &v +} + +type ResourceSliceField_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + DefaultValue []*Resource +} + +func (b0 ResourceSliceField_builder) Build() *ResourceSliceField { + m0 := &ResourceSliceField{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_DefaultValue = &b.DefaultValue + return m0 +} + +// Simplified Entitlement for config return types (avoids import cycles with connector package) +type Entitlement struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Id string `protobuf:"bytes,1,opt,name=id,proto3"` + xxx_hidden_DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3"` + xxx_hidden_Description string `protobuf:"bytes,3,opt,name=description,proto3"` + xxx_hidden_Slug string `protobuf:"bytes,4,opt,name=slug,proto3"` + xxx_hidden_Purpose string `protobuf:"bytes,5,opt,name=purpose,proto3"` + xxx_hidden_GrantableToResourceTypeIds []string `protobuf:"bytes,6,rep,name=grantable_to_resource_type_ids,json=grantableToResourceTypeIds,proto3"` + xxx_hidden_ResourceId string `protobuf:"bytes,7,opt,name=resource_id,json=resourceId,proto3"` + xxx_hidden_ResourceTypeId string `protobuf:"bytes,8,opt,name=resource_type_id,json=resourceTypeId,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Entitlement) Reset() { + *x = Entitlement{} + mi := &file_c1_config_v1_config_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Entitlement) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Entitlement) ProtoMessage() {} + +func (x *Entitlement) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_config_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Entitlement) GetId() string { + if x != nil { + return x.xxx_hidden_Id + } + return "" +} + +func (x *Entitlement) GetDisplayName() string { + if x != nil { + return x.xxx_hidden_DisplayName + } + return "" +} + +func (x *Entitlement) GetDescription() string { + if x != nil { + return x.xxx_hidden_Description + } + return "" +} + +func (x *Entitlement) GetSlug() string { + if x != nil { + return x.xxx_hidden_Slug + } + return "" +} + +func (x *Entitlement) GetPurpose() string { + if x != nil { + return x.xxx_hidden_Purpose + } + return "" +} + +func (x *Entitlement) GetGrantableToResourceTypeIds() []string { + if x != nil { + return x.xxx_hidden_GrantableToResourceTypeIds + } + return nil +} + +func (x *Entitlement) GetResourceId() string { + if x != nil { + return x.xxx_hidden_ResourceId + } + return "" +} + +func (x *Entitlement) GetResourceTypeId() string { + if x != nil { + return x.xxx_hidden_ResourceTypeId + } + return "" +} + +func (x *Entitlement) SetId(v string) { + x.xxx_hidden_Id = v +} + +func (x *Entitlement) SetDisplayName(v string) { + x.xxx_hidden_DisplayName = v +} + +func (x *Entitlement) SetDescription(v string) { + x.xxx_hidden_Description = v +} + +func (x *Entitlement) SetSlug(v string) { + x.xxx_hidden_Slug = v +} + +func (x *Entitlement) SetPurpose(v string) { + x.xxx_hidden_Purpose = v +} + +func (x *Entitlement) SetGrantableToResourceTypeIds(v []string) { + x.xxx_hidden_GrantableToResourceTypeIds = v +} + +func (x *Entitlement) SetResourceId(v string) { + x.xxx_hidden_ResourceId = v +} + +func (x *Entitlement) SetResourceTypeId(v string) { + x.xxx_hidden_ResourceTypeId = v +} + +type Entitlement_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Id string + DisplayName string + Description string + Slug string + Purpose string + GrantableToResourceTypeIds []string + ResourceId string + ResourceTypeId string +} + +func (b0 Entitlement_builder) Build() *Entitlement { + m0 := &Entitlement{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Id = b.Id + x.xxx_hidden_DisplayName = b.DisplayName + x.xxx_hidden_Description = b.Description + x.xxx_hidden_Slug = b.Slug + x.xxx_hidden_Purpose = b.Purpose + x.xxx_hidden_GrantableToResourceTypeIds = b.GrantableToResourceTypeIds + x.xxx_hidden_ResourceId = b.ResourceId + x.xxx_hidden_ResourceTypeId = b.ResourceTypeId + return m0 +} + +type EntitlementSliceField struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_DefaultValue *[]*Entitlement `protobuf:"bytes,1,rep,name=default_value,json=defaultValue,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EntitlementSliceField) Reset() { + *x = EntitlementSliceField{} + mi := &file_c1_config_v1_config_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EntitlementSliceField) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EntitlementSliceField) ProtoMessage() {} + +func (x *EntitlementSliceField) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_config_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *EntitlementSliceField) GetDefaultValue() []*Entitlement { + if x != nil { + if x.xxx_hidden_DefaultValue != nil { + return *x.xxx_hidden_DefaultValue + } + } + return nil +} + +func (x *EntitlementSliceField) SetDefaultValue(v []*Entitlement) { + x.xxx_hidden_DefaultValue = &v +} + +type EntitlementSliceField_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + DefaultValue []*Entitlement +} + +func (b0 EntitlementSliceField_builder) Build() *EntitlementSliceField { + m0 := &EntitlementSliceField{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_DefaultValue = &b.DefaultValue + return m0 +} + +// Reference to an entitlement (used in Grant) +type EntitlementRef struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Id string `protobuf:"bytes,1,opt,name=id,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EntitlementRef) Reset() { + *x = EntitlementRef{} + mi := &file_c1_config_v1_config_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EntitlementRef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EntitlementRef) ProtoMessage() {} + +func (x *EntitlementRef) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_config_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *EntitlementRef) GetId() string { + if x != nil { + return x.xxx_hidden_Id + } + return "" +} + +func (x *EntitlementRef) SetId(v string) { + x.xxx_hidden_Id = v +} + +type EntitlementRef_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Id string +} + +func (b0 EntitlementRef_builder) Build() *EntitlementRef { + m0 := &EntitlementRef{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Id = b.Id + return m0 +} + +// Simplified Grant for config return types (avoids import cycles with connector package) +type Grant struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Id string `protobuf:"bytes,1,opt,name=id,proto3"` + xxx_hidden_Entitlement *EntitlementRef `protobuf:"bytes,2,opt,name=entitlement,proto3"` + xxx_hidden_Principal *Resource `protobuf:"bytes,3,opt,name=principal,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Grant) Reset() { + *x = Grant{} + mi := &file_c1_config_v1_config_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Grant) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Grant) ProtoMessage() {} + +func (x *Grant) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_config_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Grant) GetId() string { + if x != nil { + return x.xxx_hidden_Id + } + return "" +} + +func (x *Grant) GetEntitlement() *EntitlementRef { + if x != nil { + return x.xxx_hidden_Entitlement + } + return nil +} + +func (x *Grant) GetPrincipal() *Resource { + if x != nil { + return x.xxx_hidden_Principal + } + return nil +} + +func (x *Grant) SetId(v string) { + x.xxx_hidden_Id = v +} + +func (x *Grant) SetEntitlement(v *EntitlementRef) { + x.xxx_hidden_Entitlement = v +} + +func (x *Grant) SetPrincipal(v *Resource) { + x.xxx_hidden_Principal = v +} + +func (x *Grant) HasEntitlement() bool { + if x == nil { + return false + } + return x.xxx_hidden_Entitlement != nil +} + +func (x *Grant) HasPrincipal() bool { + if x == nil { + return false + } + return x.xxx_hidden_Principal != nil +} + +func (x *Grant) ClearEntitlement() { + x.xxx_hidden_Entitlement = nil +} + +func (x *Grant) ClearPrincipal() { + x.xxx_hidden_Principal = nil +} + +type Grant_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Id string + Entitlement *EntitlementRef + Principal *Resource +} + +func (b0 Grant_builder) Build() *Grant { + m0 := &Grant{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Id = b.Id + x.xxx_hidden_Entitlement = b.Entitlement + x.xxx_hidden_Principal = b.Principal + return m0 +} + +type GrantSliceField struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_DefaultValue *[]*Grant `protobuf:"bytes,1,rep,name=default_value,json=defaultValue,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GrantSliceField) Reset() { + *x = GrantSliceField{} + mi := &file_c1_config_v1_config_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GrantSliceField) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GrantSliceField) ProtoMessage() {} + +func (x *GrantSliceField) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_config_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *GrantSliceField) GetDefaultValue() []*Grant { + if x != nil { + if x.xxx_hidden_DefaultValue != nil { + return *x.xxx_hidden_DefaultValue + } + } + return nil +} + +func (x *GrantSliceField) SetDefaultValue(v []*Grant) { + x.xxx_hidden_DefaultValue = &v } -func (x *Field) SetIsSecret(v bool) { - x.xxx_hidden_IsSecret = v +type GrantSliceField_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + DefaultValue []*Grant } -func (x *Field) SetStringField(v *StringField) { - if v == nil { - x.xxx_hidden_Field = nil - return - } - x.xxx_hidden_Field = &field_StringField{v} +func (b0 GrantSliceField_builder) Build() *GrantSliceField { + m0 := &GrantSliceField{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_DefaultValue = &b.DefaultValue + return m0 } -func (x *Field) SetIntField(v *IntField) { - if v == nil { - x.xxx_hidden_Field = nil - return - } - x.xxx_hidden_Field = &field_IntField{v} +type ResourceIdField struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_DefaultValue *ResourceId `protobuf:"bytes,1,opt,name=default_value,json=defaultValue,proto3"` + xxx_hidden_Rules *ResourceIDRules `protobuf:"bytes,3,opt,name=rules,proto3,oneof"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (x *Field) SetBoolField(v *BoolField) { - if v == nil { - x.xxx_hidden_Field = nil - return - } - x.xxx_hidden_Field = &field_BoolField{v} +func (x *ResourceIdField) Reset() { + *x = ResourceIdField{} + mi := &file_c1_config_v1_config_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (x *Field) SetStringSliceField(v *StringSliceField) { - if v == nil { - x.xxx_hidden_Field = nil - return - } - x.xxx_hidden_Field = &field_StringSliceField{v} +func (x *ResourceIdField) String() string { + return protoimpl.X.MessageStringOf(x) } -func (x *Field) SetStringMapField(v *StringMapField) { - if v == nil { - x.xxx_hidden_Field = nil - return +func (*ResourceIdField) ProtoMessage() {} + +func (x *ResourceIdField) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_config_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - x.xxx_hidden_Field = &field_StringMapField{v} + return mi.MessageOf(x) } -func (x *Field) HasField() bool { - if x == nil { - return false +func (x *ResourceIdField) GetDefaultValue() *ResourceId { + if x != nil { + return x.xxx_hidden_DefaultValue } - return x.xxx_hidden_Field != nil + return nil } -func (x *Field) HasStringField() bool { - if x == nil { - return false +func (x *ResourceIdField) GetRules() *ResourceIDRules { + if x != nil { + return x.xxx_hidden_Rules } - _, ok := x.xxx_hidden_Field.(*field_StringField) - return ok + return nil } -func (x *Field) HasIntField() bool { - if x == nil { - return false - } - _, ok := x.xxx_hidden_Field.(*field_IntField) - return ok +func (x *ResourceIdField) SetDefaultValue(v *ResourceId) { + x.xxx_hidden_DefaultValue = v } -func (x *Field) HasBoolField() bool { - if x == nil { - return false - } - _, ok := x.xxx_hidden_Field.(*field_BoolField) - return ok +func (x *ResourceIdField) SetRules(v *ResourceIDRules) { + x.xxx_hidden_Rules = v } -func (x *Field) HasStringSliceField() bool { +func (x *ResourceIdField) HasDefaultValue() bool { if x == nil { return false } - _, ok := x.xxx_hidden_Field.(*field_StringSliceField) - return ok + return x.xxx_hidden_DefaultValue != nil } -func (x *Field) HasStringMapField() bool { +func (x *ResourceIdField) HasRules() bool { if x == nil { return false } - _, ok := x.xxx_hidden_Field.(*field_StringMapField) - return ok + return x.xxx_hidden_Rules != nil } -func (x *Field) ClearField() { - x.xxx_hidden_Field = nil +func (x *ResourceIdField) ClearDefaultValue() { + x.xxx_hidden_DefaultValue = nil } -func (x *Field) ClearStringField() { - if _, ok := x.xxx_hidden_Field.(*field_StringField); ok { - x.xxx_hidden_Field = nil - } +func (x *ResourceIdField) ClearRules() { + x.xxx_hidden_Rules = nil } -func (x *Field) ClearIntField() { - if _, ok := x.xxx_hidden_Field.(*field_IntField); ok { - x.xxx_hidden_Field = nil - } -} +type ResourceIdField_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. -func (x *Field) ClearBoolField() { - if _, ok := x.xxx_hidden_Field.(*field_BoolField); ok { - x.xxx_hidden_Field = nil - } + DefaultValue *ResourceId + Rules *ResourceIDRules } -func (x *Field) ClearStringSliceField() { - if _, ok := x.xxx_hidden_Field.(*field_StringSliceField); ok { - x.xxx_hidden_Field = nil - } +func (b0 ResourceIdField_builder) Build() *ResourceIdField { + m0 := &ResourceIdField{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_DefaultValue = b.DefaultValue + x.xxx_hidden_Rules = b.Rules + return m0 } -func (x *Field) ClearStringMapField() { - if _, ok := x.xxx_hidden_Field.(*field_StringMapField); ok { - x.xxx_hidden_Field = nil - } +type ResourceIdSliceField struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_DefaultValue *[]*ResourceIdField `protobuf:"bytes,1,rep,name=default_value,json=defaultValue,proto3"` + xxx_hidden_Rules *RepeatedResourceIdRules `protobuf:"bytes,2,opt,name=rules,proto3,oneof"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -const Field_Field_not_set_case case_Field_Field = 0 -const Field_StringField_case case_Field_Field = 100 -const Field_IntField_case case_Field_Field = 101 -const Field_BoolField_case case_Field_Field = 102 -const Field_StringSliceField_case case_Field_Field = 103 -const Field_StringMapField_case case_Field_Field = 104 +func (x *ResourceIdSliceField) Reset() { + *x = ResourceIdSliceField{} + mi := &file_c1_config_v1_config_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} -func (x *Field) WhichField() case_Field_Field { - if x == nil { - return Field_Field_not_set_case - } - switch x.xxx_hidden_Field.(type) { - case *field_StringField: - return Field_StringField_case - case *field_IntField: - return Field_IntField_case - case *field_BoolField: - return Field_BoolField_case - case *field_StringSliceField: - return Field_StringSliceField_case - case *field_StringMapField: - return Field_StringMapField_case - default: - return Field_Field_not_set_case - } +func (x *ResourceIdSliceField) String() string { + return protoimpl.X.MessageStringOf(x) } -type Field_builder struct { - _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. +func (*ResourceIdSliceField) ProtoMessage() {} - Name string - DisplayName string - Description string - Placeholder string - IsRequired bool - IsOps bool - IsSecret bool - // Fields of oneof xxx_hidden_Field: - StringField *StringField - IntField *IntField - BoolField *BoolField - StringSliceField *StringSliceField - StringMapField *StringMapField - // -- end of xxx_hidden_Field +func (x *ResourceIdSliceField) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_config_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -func (b0 Field_builder) Build() *Field { - m0 := &Field{} - b, x := &b0, m0 - _, _ = b, x - x.xxx_hidden_Name = b.Name - x.xxx_hidden_DisplayName = b.DisplayName - x.xxx_hidden_Description = b.Description - x.xxx_hidden_Placeholder = b.Placeholder - x.xxx_hidden_IsRequired = b.IsRequired - x.xxx_hidden_IsOps = b.IsOps - x.xxx_hidden_IsSecret = b.IsSecret - if b.StringField != nil { - x.xxx_hidden_Field = &field_StringField{b.StringField} - } - if b.IntField != nil { - x.xxx_hidden_Field = &field_IntField{b.IntField} - } - if b.BoolField != nil { - x.xxx_hidden_Field = &field_BoolField{b.BoolField} - } - if b.StringSliceField != nil { - x.xxx_hidden_Field = &field_StringSliceField{b.StringSliceField} - } - if b.StringMapField != nil { - x.xxx_hidden_Field = &field_StringMapField{b.StringMapField} +func (x *ResourceIdSliceField) GetDefaultValue() []*ResourceIdField { + if x != nil { + if x.xxx_hidden_DefaultValue != nil { + return *x.xxx_hidden_DefaultValue + } } - return m0 + return nil } -type case_Field_Field protoreflect.FieldNumber - -func (x case_Field_Field) String() string { - md := file_c1_config_v1_config_proto_msgTypes[3].Descriptor() - if x == 0 { - return "not set" +func (x *ResourceIdSliceField) GetRules() *RepeatedResourceIdRules { + if x != nil { + return x.xxx_hidden_Rules } - return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x)) + return nil } -type isField_Field interface { - isField_Field() +func (x *ResourceIdSliceField) SetDefaultValue(v []*ResourceIdField) { + x.xxx_hidden_DefaultValue = &v } -type field_StringField struct { - StringField *StringField `protobuf:"bytes,100,opt,name=string_field,json=stringField,proto3,oneof"` +func (x *ResourceIdSliceField) SetRules(v *RepeatedResourceIdRules) { + x.xxx_hidden_Rules = v } -type field_IntField struct { - IntField *IntField `protobuf:"bytes,101,opt,name=int_field,json=intField,proto3,oneof"` +func (x *ResourceIdSliceField) HasRules() bool { + if x == nil { + return false + } + return x.xxx_hidden_Rules != nil } -type field_BoolField struct { - BoolField *BoolField `protobuf:"bytes,102,opt,name=bool_field,json=boolField,proto3,oneof"` +func (x *ResourceIdSliceField) ClearRules() { + x.xxx_hidden_Rules = nil } -type field_StringSliceField struct { - StringSliceField *StringSliceField `protobuf:"bytes,103,opt,name=string_slice_field,json=stringSliceField,proto3,oneof"` -} +type ResourceIdSliceField_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. -type field_StringMapField struct { - StringMapField *StringMapField `protobuf:"bytes,104,opt,name=string_map_field,json=stringMapField,proto3,oneof"` + DefaultValue []*ResourceIdField + Rules *RepeatedResourceIdRules } -func (*field_StringField) isField_Field() {} - -func (*field_IntField) isField_Field() {} - -func (*field_BoolField) isField_Field() {} - -func (*field_StringSliceField) isField_Field() {} - -func (*field_StringMapField) isField_Field() {} +func (b0 ResourceIdSliceField_builder) Build() *ResourceIdSliceField { + m0 := &ResourceIdSliceField{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_DefaultValue = &b.DefaultValue + x.xxx_hidden_Rules = b.Rules + return m0 +} type IntField struct { state protoimpl.MessageState `protogen:"opaque.v1"` @@ -963,7 +2183,7 @@ type IntField struct { func (x *IntField) Reset() { *x = IntField{} - mi := &file_c1_config_v1_config_proto_msgTypes[4] + mi := &file_c1_config_v1_config_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -975,7 +2195,7 @@ func (x *IntField) String() string { func (*IntField) ProtoMessage() {} func (x *IntField) ProtoReflect() protoreflect.Message { - mi := &file_c1_config_v1_config_proto_msgTypes[4] + mi := &file_c1_config_v1_config_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1046,7 +2266,7 @@ type BoolField struct { func (x *BoolField) Reset() { *x = BoolField{} - mi := &file_c1_config_v1_config_proto_msgTypes[5] + mi := &file_c1_config_v1_config_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1058,7 +2278,7 @@ func (x *BoolField) String() string { func (*BoolField) ProtoMessage() {} func (x *BoolField) ProtoReflect() protoreflect.Message { - mi := &file_c1_config_v1_config_proto_msgTypes[5] + mi := &file_c1_config_v1_config_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1128,7 +2348,7 @@ type StringSliceField struct { func (x *StringSliceField) Reset() { *x = StringSliceField{} - mi := &file_c1_config_v1_config_proto_msgTypes[6] + mi := &file_c1_config_v1_config_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1140,7 +2360,7 @@ func (x *StringSliceField) String() string { func (*StringSliceField) ProtoMessage() {} func (x *StringSliceField) ProtoReflect() protoreflect.Message { - mi := &file_c1_config_v1_config_proto_msgTypes[6] + mi := &file_c1_config_v1_config_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1210,7 +2430,7 @@ type StringMapField struct { func (x *StringMapField) Reset() { *x = StringMapField{} - mi := &file_c1_config_v1_config_proto_msgTypes[7] + mi := &file_c1_config_v1_config_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1222,7 +2442,7 @@ func (x *StringMapField) String() string { func (*StringMapField) ProtoMessage() {} func (x *StringMapField) ProtoReflect() protoreflect.Message { - mi := &file_c1_config_v1_config_proto_msgTypes[7] + mi := &file_c1_config_v1_config_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1293,7 +2513,7 @@ type StringFieldOption struct { func (x *StringFieldOption) Reset() { *x = StringFieldOption{} - mi := &file_c1_config_v1_config_proto_msgTypes[8] + mi := &file_c1_config_v1_config_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1305,7 +2525,7 @@ func (x *StringFieldOption) String() string { func (*StringFieldOption) ProtoMessage() {} func (x *StringFieldOption) ProtoReflect() protoreflect.Message { - mi := &file_c1_config_v1_config_proto_msgTypes[8] + mi := &file_c1_config_v1_config_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1380,7 +2600,7 @@ type StringField struct { func (x *StringField) Reset() { *x = StringField{} - mi := &file_c1_config_v1_config_proto_msgTypes[9] + mi := &file_c1_config_v1_config_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1392,7 +2612,7 @@ func (x *StringField) String() string { func (*StringField) ProtoMessage() {} func (x *StringField) ProtoReflect() protoreflect.Message { - mi := &file_c1_config_v1_config_proto_msgTypes[9] + mi := &file_c1_config_v1_config_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1527,7 +2747,7 @@ const file_c1_config_v1_config_proto_rawDesc = "" + "\fdisplay_name\x18\x02 \x01(\tR\vdisplayName\x12\x1b\n" + "\thelp_text\x18\x03 \x01(\tR\bhelpText\x12\x16\n" + "\x06fields\x18\x04 \x03(\tR\x06fields\x12\x18\n" + - "\adefault\x18\x05 \x01(\bR\adefault\"\xab\x04\n" + + "\adefault\x18\x05 \x01(\bR\adefault\"\x9d\b\n" + "\x05Field\x12\x12\n" + "\x04name\x18\x01 \x01(\tR\x04name\x12!\n" + "\fdisplay_name\x18\x02 \x01(\tR\vdisplayName\x12 \n" + @@ -1542,8 +2762,58 @@ const file_c1_config_v1_config_proto_rawDesc = "" + "\n" + "bool_field\x18f \x01(\v2\x17.c1.config.v1.BoolFieldH\x00R\tboolField\x12N\n" + "\x12string_slice_field\x18g \x01(\v2\x1e.c1.config.v1.StringSliceFieldH\x00R\x10stringSliceField\x12H\n" + - "\x10string_map_field\x18h \x01(\v2\x1c.c1.config.v1.StringMapFieldH\x00R\x0estringMapFieldB\a\n" + - "\x05field\"n\n" + + "\x10string_map_field\x18h \x01(\v2\x1c.c1.config.v1.StringMapFieldH\x00R\x0estringMapField\x12K\n" + + "\x11resource_id_field\x18i \x01(\v2\x1d.c1.config.v1.ResourceIdFieldH\x00R\x0fresourceIdField\x12[\n" + + "\x17resource_id_slice_field\x18j \x01(\v2\".c1.config.v1.ResourceIdSliceFieldH\x00R\x14resourceIdSliceField\x12D\n" + + "\x0eresource_field\x18k \x01(\v2\x1b.c1.config.v1.ResourceFieldH\x00R\rresourceField\x12T\n" + + "\x14resource_slice_field\x18l \x01(\v2 .c1.config.v1.ResourceSliceFieldH\x00R\x12resourceSliceField\x12]\n" + + "\x17entitlement_slice_field\x18m \x01(\v2#.c1.config.v1.EntitlementSliceFieldH\x00R\x15entitlementSliceField\x12K\n" + + "\x11grant_slice_field\x18n \x01(\v2\x1d.c1.config.v1.GrantSliceFieldH\x00R\x0fgrantSliceFieldB\a\n" + + "\x05field\"\x8a\x02\n" + + "\bResource\x129\n" + + "\vresource_id\x18\x01 \x01(\v2\x18.c1.config.v1.ResourceIdR\n" + + "resourceId\x12F\n" + + "\x12parent_resource_id\x18\x02 \x01(\v2\x18.c1.config.v1.ResourceIdR\x10parentResourceId\x12!\n" + + "\fdisplay_name\x18\x03 \x01(\tR\vdisplayName\x12 \n" + + "\vdescription\x18\x04 \x01(\tR\vdescription\x126\n" + + "\vannotations\x18\x05 \x03(\v2\x14.google.protobuf.AnyR\vannotations\"W\n" + + "\n" + + "ResourceId\x12(\n" + + "\x10resource_type_id\x18\x01 \x01(\tR\x0eresourceTypeId\x12\x1f\n" + + "\vresource_id\x18\x02 \x01(\tR\n" + + "resourceId\"L\n" + + "\rResourceField\x12;\n" + + "\rdefault_value\x18\x01 \x01(\v2\x16.c1.config.v1.ResourceR\fdefaultValue\"Q\n" + + "\x12ResourceSliceField\x12;\n" + + "\rdefault_value\x18\x01 \x03(\v2\x16.c1.config.v1.ResourceR\fdefaultValue\"\x9f\x02\n" + + "\vEntitlement\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12!\n" + + "\fdisplay_name\x18\x02 \x01(\tR\vdisplayName\x12 \n" + + "\vdescription\x18\x03 \x01(\tR\vdescription\x12\x12\n" + + "\x04slug\x18\x04 \x01(\tR\x04slug\x12\x18\n" + + "\apurpose\x18\x05 \x01(\tR\apurpose\x12B\n" + + "\x1egrantable_to_resource_type_ids\x18\x06 \x03(\tR\x1agrantableToResourceTypeIds\x12\x1f\n" + + "\vresource_id\x18\a \x01(\tR\n" + + "resourceId\x12(\n" + + "\x10resource_type_id\x18\b \x01(\tR\x0eresourceTypeId\"W\n" + + "\x15EntitlementSliceField\x12>\n" + + "\rdefault_value\x18\x01 \x03(\v2\x19.c1.config.v1.EntitlementR\fdefaultValue\" \n" + + "\x0eEntitlementRef\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\"\x8d\x01\n" + + "\x05Grant\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12>\n" + + "\ventitlement\x18\x02 \x01(\v2\x1c.c1.config.v1.EntitlementRefR\ventitlement\x124\n" + + "\tprincipal\x18\x03 \x01(\v2\x16.c1.config.v1.ResourceR\tprincipal\"K\n" + + "\x0fGrantSliceField\x128\n" + + "\rdefault_value\x18\x01 \x03(\v2\x13.c1.config.v1.GrantR\fdefaultValue\"\x94\x01\n" + + "\x0fResourceIdField\x12=\n" + + "\rdefault_value\x18\x01 \x01(\v2\x18.c1.config.v1.ResourceIdR\fdefaultValue\x128\n" + + "\x05rules\x18\x03 \x01(\v2\x1d.c1.config.v1.ResourceIDRulesH\x00R\x05rules\x88\x01\x01B\b\n" + + "\x06_rules\"\xa6\x01\n" + + "\x14ResourceIdSliceField\x12B\n" + + "\rdefault_value\x18\x01 \x03(\v2\x1d.c1.config.v1.ResourceIdFieldR\fdefaultValue\x12@\n" + + "\x05rules\x18\x02 \x01(\v2%.c1.config.v1.RepeatedResourceIdRulesH\x00R\x05rules\x88\x01\x01B\b\n" + + "\x06_rules\"n\n" + "\bIntField\x12#\n" + "\rdefault_value\x18\x01 \x01(\x03R\fdefaultValue\x123\n" + "\x05rules\x18\x02 \x01(\v2\x18.c1.config.v1.Int64RulesH\x00R\x05rules\x88\x01\x01B\b\n" + @@ -1588,52 +2858,84 @@ const file_c1_config_v1_config_proto_rawDesc = "" + "\x1dSTRING_FIELD_TYPE_FILE_UPLOAD\x10\x04B3Z1github.com/conductorone/baton-sdk/pb/c1/config/v1b\x06proto3" var file_c1_config_v1_config_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_c1_config_v1_config_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_c1_config_v1_config_proto_msgTypes = make([]protoimpl.MessageInfo, 22) var file_c1_config_v1_config_proto_goTypes = []any{ - (ConstraintKind)(0), // 0: c1.config.v1.ConstraintKind - (StringFieldType)(0), // 1: c1.config.v1.StringFieldType - (*Configuration)(nil), // 2: c1.config.v1.Configuration - (*Constraint)(nil), // 3: c1.config.v1.Constraint - (*FieldGroup)(nil), // 4: c1.config.v1.FieldGroup - (*Field)(nil), // 5: c1.config.v1.Field - (*IntField)(nil), // 6: c1.config.v1.IntField - (*BoolField)(nil), // 7: c1.config.v1.BoolField - (*StringSliceField)(nil), // 8: c1.config.v1.StringSliceField - (*StringMapField)(nil), // 9: c1.config.v1.StringMapField - (*StringFieldOption)(nil), // 10: c1.config.v1.StringFieldOption - (*StringField)(nil), // 11: c1.config.v1.StringField - nil, // 12: c1.config.v1.StringMapField.DefaultValueEntry - (*Int64Rules)(nil), // 13: c1.config.v1.Int64Rules - (*BoolRules)(nil), // 14: c1.config.v1.BoolRules - (*RepeatedStringRules)(nil), // 15: c1.config.v1.RepeatedStringRules - (*StringMapRules)(nil), // 16: c1.config.v1.StringMapRules - (*StringRules)(nil), // 17: c1.config.v1.StringRules - (*anypb.Any)(nil), // 18: google.protobuf.Any + (ConstraintKind)(0), // 0: c1.config.v1.ConstraintKind + (StringFieldType)(0), // 1: c1.config.v1.StringFieldType + (*Configuration)(nil), // 2: c1.config.v1.Configuration + (*Constraint)(nil), // 3: c1.config.v1.Constraint + (*FieldGroup)(nil), // 4: c1.config.v1.FieldGroup + (*Field)(nil), // 5: c1.config.v1.Field + (*Resource)(nil), // 6: c1.config.v1.Resource + (*ResourceId)(nil), // 7: c1.config.v1.ResourceId + (*ResourceField)(nil), // 8: c1.config.v1.ResourceField + (*ResourceSliceField)(nil), // 9: c1.config.v1.ResourceSliceField + (*Entitlement)(nil), // 10: c1.config.v1.Entitlement + (*EntitlementSliceField)(nil), // 11: c1.config.v1.EntitlementSliceField + (*EntitlementRef)(nil), // 12: c1.config.v1.EntitlementRef + (*Grant)(nil), // 13: c1.config.v1.Grant + (*GrantSliceField)(nil), // 14: c1.config.v1.GrantSliceField + (*ResourceIdField)(nil), // 15: c1.config.v1.ResourceIdField + (*ResourceIdSliceField)(nil), // 16: c1.config.v1.ResourceIdSliceField + (*IntField)(nil), // 17: c1.config.v1.IntField + (*BoolField)(nil), // 18: c1.config.v1.BoolField + (*StringSliceField)(nil), // 19: c1.config.v1.StringSliceField + (*StringMapField)(nil), // 20: c1.config.v1.StringMapField + (*StringFieldOption)(nil), // 21: c1.config.v1.StringFieldOption + (*StringField)(nil), // 22: c1.config.v1.StringField + nil, // 23: c1.config.v1.StringMapField.DefaultValueEntry + (*anypb.Any)(nil), // 24: google.protobuf.Any + (*ResourceIDRules)(nil), // 25: c1.config.v1.ResourceIDRules + (*RepeatedResourceIdRules)(nil), // 26: c1.config.v1.RepeatedResourceIdRules + (*Int64Rules)(nil), // 27: c1.config.v1.Int64Rules + (*BoolRules)(nil), // 28: c1.config.v1.BoolRules + (*RepeatedStringRules)(nil), // 29: c1.config.v1.RepeatedStringRules + (*StringMapRules)(nil), // 30: c1.config.v1.StringMapRules + (*StringRules)(nil), // 31: c1.config.v1.StringRules } var file_c1_config_v1_config_proto_depIdxs = []int32{ 5, // 0: c1.config.v1.Configuration.fields:type_name -> c1.config.v1.Field 3, // 1: c1.config.v1.Configuration.constraints:type_name -> c1.config.v1.Constraint 4, // 2: c1.config.v1.Configuration.field_groups:type_name -> c1.config.v1.FieldGroup 0, // 3: c1.config.v1.Constraint.kind:type_name -> c1.config.v1.ConstraintKind - 11, // 4: c1.config.v1.Field.string_field:type_name -> c1.config.v1.StringField - 6, // 5: c1.config.v1.Field.int_field:type_name -> c1.config.v1.IntField - 7, // 6: c1.config.v1.Field.bool_field:type_name -> c1.config.v1.BoolField - 8, // 7: c1.config.v1.Field.string_slice_field:type_name -> c1.config.v1.StringSliceField - 9, // 8: c1.config.v1.Field.string_map_field:type_name -> c1.config.v1.StringMapField - 13, // 9: c1.config.v1.IntField.rules:type_name -> c1.config.v1.Int64Rules - 14, // 10: c1.config.v1.BoolField.rules:type_name -> c1.config.v1.BoolRules - 15, // 11: c1.config.v1.StringSliceField.rules:type_name -> c1.config.v1.RepeatedStringRules - 12, // 12: c1.config.v1.StringMapField.default_value:type_name -> c1.config.v1.StringMapField.DefaultValueEntry - 16, // 13: c1.config.v1.StringMapField.rules:type_name -> c1.config.v1.StringMapRules - 17, // 14: c1.config.v1.StringField.rules:type_name -> c1.config.v1.StringRules - 1, // 15: c1.config.v1.StringField.type:type_name -> c1.config.v1.StringFieldType - 10, // 16: c1.config.v1.StringField.options:type_name -> c1.config.v1.StringFieldOption - 18, // 17: c1.config.v1.StringMapField.DefaultValueEntry.value:type_name -> google.protobuf.Any - 18, // [18:18] is the sub-list for method output_type - 18, // [18:18] is the sub-list for method input_type - 18, // [18:18] is the sub-list for extension type_name - 18, // [18:18] is the sub-list for extension extendee - 0, // [0:18] is the sub-list for field type_name + 22, // 4: c1.config.v1.Field.string_field:type_name -> c1.config.v1.StringField + 17, // 5: c1.config.v1.Field.int_field:type_name -> c1.config.v1.IntField + 18, // 6: c1.config.v1.Field.bool_field:type_name -> c1.config.v1.BoolField + 19, // 7: c1.config.v1.Field.string_slice_field:type_name -> c1.config.v1.StringSliceField + 20, // 8: c1.config.v1.Field.string_map_field:type_name -> c1.config.v1.StringMapField + 15, // 9: c1.config.v1.Field.resource_id_field:type_name -> c1.config.v1.ResourceIdField + 16, // 10: c1.config.v1.Field.resource_id_slice_field:type_name -> c1.config.v1.ResourceIdSliceField + 8, // 11: c1.config.v1.Field.resource_field:type_name -> c1.config.v1.ResourceField + 9, // 12: c1.config.v1.Field.resource_slice_field:type_name -> c1.config.v1.ResourceSliceField + 11, // 13: c1.config.v1.Field.entitlement_slice_field:type_name -> c1.config.v1.EntitlementSliceField + 14, // 14: c1.config.v1.Field.grant_slice_field:type_name -> c1.config.v1.GrantSliceField + 7, // 15: c1.config.v1.Resource.resource_id:type_name -> c1.config.v1.ResourceId + 7, // 16: c1.config.v1.Resource.parent_resource_id:type_name -> c1.config.v1.ResourceId + 24, // 17: c1.config.v1.Resource.annotations:type_name -> google.protobuf.Any + 6, // 18: c1.config.v1.ResourceField.default_value:type_name -> c1.config.v1.Resource + 6, // 19: c1.config.v1.ResourceSliceField.default_value:type_name -> c1.config.v1.Resource + 10, // 20: c1.config.v1.EntitlementSliceField.default_value:type_name -> c1.config.v1.Entitlement + 12, // 21: c1.config.v1.Grant.entitlement:type_name -> c1.config.v1.EntitlementRef + 6, // 22: c1.config.v1.Grant.principal:type_name -> c1.config.v1.Resource + 13, // 23: c1.config.v1.GrantSliceField.default_value:type_name -> c1.config.v1.Grant + 7, // 24: c1.config.v1.ResourceIdField.default_value:type_name -> c1.config.v1.ResourceId + 25, // 25: c1.config.v1.ResourceIdField.rules:type_name -> c1.config.v1.ResourceIDRules + 15, // 26: c1.config.v1.ResourceIdSliceField.default_value:type_name -> c1.config.v1.ResourceIdField + 26, // 27: c1.config.v1.ResourceIdSliceField.rules:type_name -> c1.config.v1.RepeatedResourceIdRules + 27, // 28: c1.config.v1.IntField.rules:type_name -> c1.config.v1.Int64Rules + 28, // 29: c1.config.v1.BoolField.rules:type_name -> c1.config.v1.BoolRules + 29, // 30: c1.config.v1.StringSliceField.rules:type_name -> c1.config.v1.RepeatedStringRules + 23, // 31: c1.config.v1.StringMapField.default_value:type_name -> c1.config.v1.StringMapField.DefaultValueEntry + 30, // 32: c1.config.v1.StringMapField.rules:type_name -> c1.config.v1.StringMapRules + 31, // 33: c1.config.v1.StringField.rules:type_name -> c1.config.v1.StringRules + 1, // 34: c1.config.v1.StringField.type:type_name -> c1.config.v1.StringFieldType + 21, // 35: c1.config.v1.StringField.options:type_name -> c1.config.v1.StringFieldOption + 24, // 36: c1.config.v1.StringMapField.DefaultValueEntry.value:type_name -> google.protobuf.Any + 37, // [37:37] is the sub-list for method output_type + 37, // [37:37] is the sub-list for method input_type + 37, // [37:37] is the sub-list for extension type_name + 37, // [37:37] is the sub-list for extension extendee + 0, // [0:37] is the sub-list for field type_name } func init() { file_c1_config_v1_config_proto_init() } @@ -1648,19 +2950,27 @@ func file_c1_config_v1_config_proto_init() { (*field_BoolField)(nil), (*field_StringSliceField)(nil), (*field_StringMapField)(nil), - } - file_c1_config_v1_config_proto_msgTypes[4].OneofWrappers = []any{} - file_c1_config_v1_config_proto_msgTypes[5].OneofWrappers = []any{} - file_c1_config_v1_config_proto_msgTypes[6].OneofWrappers = []any{} - file_c1_config_v1_config_proto_msgTypes[7].OneofWrappers = []any{} - file_c1_config_v1_config_proto_msgTypes[9].OneofWrappers = []any{} + (*field_ResourceIdField)(nil), + (*field_ResourceIdSliceField)(nil), + (*field_ResourceField)(nil), + (*field_ResourceSliceField)(nil), + (*field_EntitlementSliceField)(nil), + (*field_GrantSliceField)(nil), + } + file_c1_config_v1_config_proto_msgTypes[13].OneofWrappers = []any{} + file_c1_config_v1_config_proto_msgTypes[14].OneofWrappers = []any{} + file_c1_config_v1_config_proto_msgTypes[15].OneofWrappers = []any{} + file_c1_config_v1_config_proto_msgTypes[16].OneofWrappers = []any{} + file_c1_config_v1_config_proto_msgTypes[17].OneofWrappers = []any{} + file_c1_config_v1_config_proto_msgTypes[18].OneofWrappers = []any{} + file_c1_config_v1_config_proto_msgTypes[20].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_c1_config_v1_config_proto_rawDesc), len(file_c1_config_v1_config_proto_rawDesc)), NumEnums: 2, - NumMessages: 11, + NumMessages: 22, NumExtensions: 0, NumServices: 0, }, diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/rules.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/rules.pb.go index 616e289a..afe1a1ff 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/rules.pb.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/rules.pb.go @@ -1427,6 +1427,226 @@ func (b0 StringMapRules_builder) Build() *StringMapRules { return m0 } +type ResourceIDRules struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + AllowedResourceTypeIds []string `protobuf:"bytes,1,rep,name=allowed_resource_type_ids,json=allowedResourceTypeIds,proto3" json:"allowed_resource_type_ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResourceIDRules) Reset() { + *x = ResourceIDRules{} + mi := &file_c1_config_v1_rules_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResourceIDRules) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResourceIDRules) ProtoMessage() {} + +func (x *ResourceIDRules) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_rules_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ResourceIDRules) GetAllowedResourceTypeIds() []string { + if x != nil { + return x.AllowedResourceTypeIds + } + return nil +} + +func (x *ResourceIDRules) SetAllowedResourceTypeIds(v []string) { + x.AllowedResourceTypeIds = v +} + +type ResourceIDRules_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + AllowedResourceTypeIds []string +} + +func (b0 ResourceIDRules_builder) Build() *ResourceIDRules { + m0 := &ResourceIDRules{} + b, x := &b0, m0 + _, _ = b, x + x.AllowedResourceTypeIds = b.AllowedResourceTypeIds + return m0 +} + +type RepeatedResourceIdRules struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + AllowedResourceTypeIds []string `protobuf:"bytes,1,rep,name=allowed_resource_type_ids,json=allowedResourceTypeIds,proto3" json:"allowed_resource_type_ids,omitempty"` + // MinItems specifies that this field must have the specified number of + // items at a minimum + MinItems *uint64 `protobuf:"varint,2,opt,name=min_items,json=minItems,proto3,oneof" json:"min_items,omitempty"` + // MaxItems specifies that this field must have the specified number of + // items at a maximum + MaxItems *uint64 `protobuf:"varint,3,opt,name=max_items,json=maxItems,proto3,oneof" json:"max_items,omitempty"` + // Unique specifies that all elements in this field must be unique. + Unique bool `protobuf:"varint,4,opt,name=unique,proto3" json:"unique,omitempty"` + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + ValidateEmpty bool `protobuf:"varint,5,opt,name=validate_empty,json=validateEmpty,proto3" json:"validate_empty,omitempty"` + IsRequired bool `protobuf:"varint,6,opt,name=is_required,json=isRequired,proto3" json:"is_required,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RepeatedResourceIdRules) Reset() { + *x = RepeatedResourceIdRules{} + mi := &file_c1_config_v1_rules_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RepeatedResourceIdRules) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepeatedResourceIdRules) ProtoMessage() {} + +func (x *RepeatedResourceIdRules) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_rules_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RepeatedResourceIdRules) GetAllowedResourceTypeIds() []string { + if x != nil { + return x.AllowedResourceTypeIds + } + return nil +} + +func (x *RepeatedResourceIdRules) GetMinItems() uint64 { + if x != nil && x.MinItems != nil { + return *x.MinItems + } + return 0 +} + +func (x *RepeatedResourceIdRules) GetMaxItems() uint64 { + if x != nil && x.MaxItems != nil { + return *x.MaxItems + } + return 0 +} + +func (x *RepeatedResourceIdRules) GetUnique() bool { + if x != nil { + return x.Unique + } + return false +} + +func (x *RepeatedResourceIdRules) GetValidateEmpty() bool { + if x != nil { + return x.ValidateEmpty + } + return false +} + +func (x *RepeatedResourceIdRules) GetIsRequired() bool { + if x != nil { + return x.IsRequired + } + return false +} + +func (x *RepeatedResourceIdRules) SetAllowedResourceTypeIds(v []string) { + x.AllowedResourceTypeIds = v +} + +func (x *RepeatedResourceIdRules) SetMinItems(v uint64) { + x.MinItems = &v +} + +func (x *RepeatedResourceIdRules) SetMaxItems(v uint64) { + x.MaxItems = &v +} + +func (x *RepeatedResourceIdRules) SetUnique(v bool) { + x.Unique = v +} + +func (x *RepeatedResourceIdRules) SetValidateEmpty(v bool) { + x.ValidateEmpty = v +} + +func (x *RepeatedResourceIdRules) SetIsRequired(v bool) { + x.IsRequired = v +} + +func (x *RepeatedResourceIdRules) HasMinItems() bool { + if x == nil { + return false + } + return x.MinItems != nil +} + +func (x *RepeatedResourceIdRules) HasMaxItems() bool { + if x == nil { + return false + } + return x.MaxItems != nil +} + +func (x *RepeatedResourceIdRules) ClearMinItems() { + x.MinItems = nil +} + +func (x *RepeatedResourceIdRules) ClearMaxItems() { + x.MaxItems = nil +} + +type RepeatedResourceIdRules_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + AllowedResourceTypeIds []string + // MinItems specifies that this field must have the specified number of + // items at a minimum + MinItems *uint64 + // MaxItems specifies that this field must have the specified number of + // items at a maximum + MaxItems *uint64 + // Unique specifies that all elements in this field must be unique. + Unique bool + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + ValidateEmpty bool + IsRequired bool +} + +func (b0 RepeatedResourceIdRules_builder) Build() *RepeatedResourceIdRules { + m0 := &RepeatedResourceIdRules{} + b, x := &b0, m0 + _, _ = b, x + x.AllowedResourceTypeIds = b.AllowedResourceTypeIds + x.MinItems = b.MinItems + x.MaxItems = b.MaxItems + x.Unique = b.Unique + x.ValidateEmpty = b.ValidateEmpty + x.IsRequired = b.IsRequired + return m0 +} + var File_c1_config_v1_rules_proto protoreflect.FileDescriptor const file_c1_config_v1_rules_proto_rawDesc = "" + @@ -1514,7 +1734,21 @@ const file_c1_config_v1_rules_proto_rawDesc = "" + "\x0eStringMapRules\x12%\n" + "\x0evalidate_empty\x18\x01 \x01(\bR\rvalidateEmpty\x12\x1f\n" + "\vis_required\x18\x02 \x01(\bR\n" + - "isRequired*\x99\x02\n" + + "isRequired\"L\n" + + "\x0fResourceIDRules\x129\n" + + "\x19allowed_resource_type_ids\x18\x01 \x03(\tR\x16allowedResourceTypeIds\"\x94\x02\n" + + "\x17RepeatedResourceIdRules\x129\n" + + "\x19allowed_resource_type_ids\x18\x01 \x03(\tR\x16allowedResourceTypeIds\x12 \n" + + "\tmin_items\x18\x02 \x01(\x04H\x00R\bminItems\x88\x01\x01\x12 \n" + + "\tmax_items\x18\x03 \x01(\x04H\x01R\bmaxItems\x88\x01\x01\x12\x16\n" + + "\x06unique\x18\x04 \x01(\bR\x06unique\x12%\n" + + "\x0evalidate_empty\x18\x05 \x01(\bR\rvalidateEmpty\x12\x1f\n" + + "\vis_required\x18\x06 \x01(\bR\n" + + "isRequiredB\f\n" + + "\n" + + "_min_itemsB\f\n" + + "\n" + + "_max_items*\x99\x02\n" + "\x0fWellKnownString\x12!\n" + "\x1dWELL_KNOWN_STRING_UNSPECIFIED\x10\x00\x12\x1b\n" + "\x17WELL_KNOWN_STRING_EMAIL\x10\x01\x12\x1e\n" + @@ -1527,15 +1761,17 @@ const file_c1_config_v1_rules_proto_rawDesc = "" + "\x16WELL_KNOWN_STRING_UUID\x10\bB3Z1github.com/conductorone/baton-sdk/pb/c1/config/v1b\x06proto3" var file_c1_config_v1_rules_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_c1_config_v1_rules_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_c1_config_v1_rules_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_c1_config_v1_rules_proto_goTypes = []any{ - (WellKnownString)(0), // 0: c1.config.v1.WellKnownString - (*Int64Rules)(nil), // 1: c1.config.v1.Int64Rules - (*BoolRules)(nil), // 2: c1.config.v1.BoolRules - (*RepeatedRules)(nil), // 3: c1.config.v1.RepeatedRules - (*RepeatedStringRules)(nil), // 4: c1.config.v1.RepeatedStringRules - (*StringRules)(nil), // 5: c1.config.v1.StringRules - (*StringMapRules)(nil), // 6: c1.config.v1.StringMapRules + (WellKnownString)(0), // 0: c1.config.v1.WellKnownString + (*Int64Rules)(nil), // 1: c1.config.v1.Int64Rules + (*BoolRules)(nil), // 2: c1.config.v1.BoolRules + (*RepeatedRules)(nil), // 3: c1.config.v1.RepeatedRules + (*RepeatedStringRules)(nil), // 4: c1.config.v1.RepeatedStringRules + (*StringRules)(nil), // 5: c1.config.v1.StringRules + (*StringMapRules)(nil), // 6: c1.config.v1.StringMapRules + (*ResourceIDRules)(nil), // 7: c1.config.v1.ResourceIDRules + (*RepeatedResourceIdRules)(nil), // 8: c1.config.v1.RepeatedResourceIdRules } var file_c1_config_v1_rules_proto_depIdxs = []int32{ 1, // 0: c1.config.v1.RepeatedRules.int64:type_name -> c1.config.v1.Int64Rules @@ -1564,13 +1800,14 @@ func file_c1_config_v1_rules_proto_init() { } file_c1_config_v1_rules_proto_msgTypes[3].OneofWrappers = []any{} file_c1_config_v1_rules_proto_msgTypes[4].OneofWrappers = []any{} + file_c1_config_v1_rules_proto_msgTypes[7].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_c1_config_v1_rules_proto_rawDesc), len(file_c1_config_v1_rules_proto_rawDesc)), NumEnums: 1, - NumMessages: 6, + NumMessages: 8, NumExtensions: 0, NumServices: 0, }, diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/rules.pb.validate.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/rules.pb.validate.go index a2c8ff0d..ef7e9c54 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/rules.pb.validate.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/rules.pb.validate.go @@ -892,3 +892,219 @@ var _ interface { Cause() error ErrorName() string } = StringMapRulesValidationError{} + +// Validate checks the field values on ResourceIDRules with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *ResourceIDRules) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ResourceIDRules with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ResourceIDRulesMultiError, or nil if none found. +func (m *ResourceIDRules) ValidateAll() error { + return m.validate(true) +} + +func (m *ResourceIDRules) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if len(errors) > 0 { + return ResourceIDRulesMultiError(errors) + } + + return nil +} + +// ResourceIDRulesMultiError is an error wrapping multiple validation errors +// returned by ResourceIDRules.ValidateAll() if the designated constraints +// aren't met. +type ResourceIDRulesMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ResourceIDRulesMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ResourceIDRulesMultiError) AllErrors() []error { return m } + +// ResourceIDRulesValidationError is the validation error returned by +// ResourceIDRules.Validate if the designated constraints aren't met. +type ResourceIDRulesValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ResourceIDRulesValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ResourceIDRulesValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ResourceIDRulesValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ResourceIDRulesValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ResourceIDRulesValidationError) ErrorName() string { return "ResourceIDRulesValidationError" } + +// Error satisfies the builtin error interface +func (e ResourceIDRulesValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sResourceIDRules.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ResourceIDRulesValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ResourceIDRulesValidationError{} + +// Validate checks the field values on RepeatedResourceIdRules with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *RepeatedResourceIdRules) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on RepeatedResourceIdRules with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// RepeatedResourceIdRulesMultiError, or nil if none found. +func (m *RepeatedResourceIdRules) ValidateAll() error { + return m.validate(true) +} + +func (m *RepeatedResourceIdRules) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Unique + + // no validation rules for ValidateEmpty + + // no validation rules for IsRequired + + if m.MinItems != nil { + // no validation rules for MinItems + } + + if m.MaxItems != nil { + // no validation rules for MaxItems + } + + if len(errors) > 0 { + return RepeatedResourceIdRulesMultiError(errors) + } + + return nil +} + +// RepeatedResourceIdRulesMultiError is an error wrapping multiple validation +// errors returned by RepeatedResourceIdRules.ValidateAll() if the designated +// constraints aren't met. +type RepeatedResourceIdRulesMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m RepeatedResourceIdRulesMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m RepeatedResourceIdRulesMultiError) AllErrors() []error { return m } + +// RepeatedResourceIdRulesValidationError is the validation error returned by +// RepeatedResourceIdRules.Validate if the designated constraints aren't met. +type RepeatedResourceIdRulesValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e RepeatedResourceIdRulesValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e RepeatedResourceIdRulesValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e RepeatedResourceIdRulesValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e RepeatedResourceIdRulesValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e RepeatedResourceIdRulesValidationError) ErrorName() string { + return "RepeatedResourceIdRulesValidationError" +} + +// Error satisfies the builtin error interface +func (e RepeatedResourceIdRulesValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRepeatedResourceIdRules.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = RepeatedResourceIdRulesValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = RepeatedResourceIdRulesValidationError{} diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/rules_protoopaque.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/rules_protoopaque.pb.go index 048da3ed..a4f425ba 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/rules_protoopaque.pb.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/config/v1/rules_protoopaque.pb.go @@ -1464,6 +1464,231 @@ func (b0 StringMapRules_builder) Build() *StringMapRules { return m0 } +type ResourceIDRules struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_AllowedResourceTypeIds []string `protobuf:"bytes,1,rep,name=allowed_resource_type_ids,json=allowedResourceTypeIds,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResourceIDRules) Reset() { + *x = ResourceIDRules{} + mi := &file_c1_config_v1_rules_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResourceIDRules) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResourceIDRules) ProtoMessage() {} + +func (x *ResourceIDRules) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_rules_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ResourceIDRules) GetAllowedResourceTypeIds() []string { + if x != nil { + return x.xxx_hidden_AllowedResourceTypeIds + } + return nil +} + +func (x *ResourceIDRules) SetAllowedResourceTypeIds(v []string) { + x.xxx_hidden_AllowedResourceTypeIds = v +} + +type ResourceIDRules_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + AllowedResourceTypeIds []string +} + +func (b0 ResourceIDRules_builder) Build() *ResourceIDRules { + m0 := &ResourceIDRules{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_AllowedResourceTypeIds = b.AllowedResourceTypeIds + return m0 +} + +type RepeatedResourceIdRules struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_AllowedResourceTypeIds []string `protobuf:"bytes,1,rep,name=allowed_resource_type_ids,json=allowedResourceTypeIds,proto3"` + xxx_hidden_MinItems uint64 `protobuf:"varint,2,opt,name=min_items,json=minItems,proto3,oneof"` + xxx_hidden_MaxItems uint64 `protobuf:"varint,3,opt,name=max_items,json=maxItems,proto3,oneof"` + xxx_hidden_Unique bool `protobuf:"varint,4,opt,name=unique,proto3"` + xxx_hidden_ValidateEmpty bool `protobuf:"varint,5,opt,name=validate_empty,json=validateEmpty,proto3"` + xxx_hidden_IsRequired bool `protobuf:"varint,6,opt,name=is_required,json=isRequired,proto3"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RepeatedResourceIdRules) Reset() { + *x = RepeatedResourceIdRules{} + mi := &file_c1_config_v1_rules_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RepeatedResourceIdRules) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepeatedResourceIdRules) ProtoMessage() {} + +func (x *RepeatedResourceIdRules) ProtoReflect() protoreflect.Message { + mi := &file_c1_config_v1_rules_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RepeatedResourceIdRules) GetAllowedResourceTypeIds() []string { + if x != nil { + return x.xxx_hidden_AllowedResourceTypeIds + } + return nil +} + +func (x *RepeatedResourceIdRules) GetMinItems() uint64 { + if x != nil { + return x.xxx_hidden_MinItems + } + return 0 +} + +func (x *RepeatedResourceIdRules) GetMaxItems() uint64 { + if x != nil { + return x.xxx_hidden_MaxItems + } + return 0 +} + +func (x *RepeatedResourceIdRules) GetUnique() bool { + if x != nil { + return x.xxx_hidden_Unique + } + return false +} + +func (x *RepeatedResourceIdRules) GetValidateEmpty() bool { + if x != nil { + return x.xxx_hidden_ValidateEmpty + } + return false +} + +func (x *RepeatedResourceIdRules) GetIsRequired() bool { + if x != nil { + return x.xxx_hidden_IsRequired + } + return false +} + +func (x *RepeatedResourceIdRules) SetAllowedResourceTypeIds(v []string) { + x.xxx_hidden_AllowedResourceTypeIds = v +} + +func (x *RepeatedResourceIdRules) SetMinItems(v uint64) { + x.xxx_hidden_MinItems = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 6) +} + +func (x *RepeatedResourceIdRules) SetMaxItems(v uint64) { + x.xxx_hidden_MaxItems = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 6) +} + +func (x *RepeatedResourceIdRules) SetUnique(v bool) { + x.xxx_hidden_Unique = v +} + +func (x *RepeatedResourceIdRules) SetValidateEmpty(v bool) { + x.xxx_hidden_ValidateEmpty = v +} + +func (x *RepeatedResourceIdRules) SetIsRequired(v bool) { + x.xxx_hidden_IsRequired = v +} + +func (x *RepeatedResourceIdRules) HasMinItems() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *RepeatedResourceIdRules) HasMaxItems() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *RepeatedResourceIdRules) ClearMinItems() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_MinItems = 0 +} + +func (x *RepeatedResourceIdRules) ClearMaxItems() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_MaxItems = 0 +} + +type RepeatedResourceIdRules_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + AllowedResourceTypeIds []string + // MinItems specifies that this field must have the specified number of + // items at a minimum + MinItems *uint64 + // MaxItems specifies that this field must have the specified number of + // items at a maximum + MaxItems *uint64 + // Unique specifies that all elements in this field must be unique. + Unique bool + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + ValidateEmpty bool + IsRequired bool +} + +func (b0 RepeatedResourceIdRules_builder) Build() *RepeatedResourceIdRules { + m0 := &RepeatedResourceIdRules{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_AllowedResourceTypeIds = b.AllowedResourceTypeIds + if b.MinItems != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 6) + x.xxx_hidden_MinItems = *b.MinItems + } + if b.MaxItems != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 6) + x.xxx_hidden_MaxItems = *b.MaxItems + } + x.xxx_hidden_Unique = b.Unique + x.xxx_hidden_ValidateEmpty = b.ValidateEmpty + x.xxx_hidden_IsRequired = b.IsRequired + return m0 +} + var File_c1_config_v1_rules_proto protoreflect.FileDescriptor const file_c1_config_v1_rules_proto_rawDesc = "" + @@ -1551,7 +1776,21 @@ const file_c1_config_v1_rules_proto_rawDesc = "" + "\x0eStringMapRules\x12%\n" + "\x0evalidate_empty\x18\x01 \x01(\bR\rvalidateEmpty\x12\x1f\n" + "\vis_required\x18\x02 \x01(\bR\n" + - "isRequired*\x99\x02\n" + + "isRequired\"L\n" + + "\x0fResourceIDRules\x129\n" + + "\x19allowed_resource_type_ids\x18\x01 \x03(\tR\x16allowedResourceTypeIds\"\x94\x02\n" + + "\x17RepeatedResourceIdRules\x129\n" + + "\x19allowed_resource_type_ids\x18\x01 \x03(\tR\x16allowedResourceTypeIds\x12 \n" + + "\tmin_items\x18\x02 \x01(\x04H\x00R\bminItems\x88\x01\x01\x12 \n" + + "\tmax_items\x18\x03 \x01(\x04H\x01R\bmaxItems\x88\x01\x01\x12\x16\n" + + "\x06unique\x18\x04 \x01(\bR\x06unique\x12%\n" + + "\x0evalidate_empty\x18\x05 \x01(\bR\rvalidateEmpty\x12\x1f\n" + + "\vis_required\x18\x06 \x01(\bR\n" + + "isRequiredB\f\n" + + "\n" + + "_min_itemsB\f\n" + + "\n" + + "_max_items*\x99\x02\n" + "\x0fWellKnownString\x12!\n" + "\x1dWELL_KNOWN_STRING_UNSPECIFIED\x10\x00\x12\x1b\n" + "\x17WELL_KNOWN_STRING_EMAIL\x10\x01\x12\x1e\n" + @@ -1564,15 +1803,17 @@ const file_c1_config_v1_rules_proto_rawDesc = "" + "\x16WELL_KNOWN_STRING_UUID\x10\bB3Z1github.com/conductorone/baton-sdk/pb/c1/config/v1b\x06proto3" var file_c1_config_v1_rules_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_c1_config_v1_rules_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_c1_config_v1_rules_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_c1_config_v1_rules_proto_goTypes = []any{ - (WellKnownString)(0), // 0: c1.config.v1.WellKnownString - (*Int64Rules)(nil), // 1: c1.config.v1.Int64Rules - (*BoolRules)(nil), // 2: c1.config.v1.BoolRules - (*RepeatedRules)(nil), // 3: c1.config.v1.RepeatedRules - (*RepeatedStringRules)(nil), // 4: c1.config.v1.RepeatedStringRules - (*StringRules)(nil), // 5: c1.config.v1.StringRules - (*StringMapRules)(nil), // 6: c1.config.v1.StringMapRules + (WellKnownString)(0), // 0: c1.config.v1.WellKnownString + (*Int64Rules)(nil), // 1: c1.config.v1.Int64Rules + (*BoolRules)(nil), // 2: c1.config.v1.BoolRules + (*RepeatedRules)(nil), // 3: c1.config.v1.RepeatedRules + (*RepeatedStringRules)(nil), // 4: c1.config.v1.RepeatedStringRules + (*StringRules)(nil), // 5: c1.config.v1.StringRules + (*StringMapRules)(nil), // 6: c1.config.v1.StringMapRules + (*ResourceIDRules)(nil), // 7: c1.config.v1.ResourceIDRules + (*RepeatedResourceIdRules)(nil), // 8: c1.config.v1.RepeatedResourceIdRules } var file_c1_config_v1_rules_proto_depIdxs = []int32{ 1, // 0: c1.config.v1.RepeatedRules.int64:type_name -> c1.config.v1.Int64Rules @@ -1601,13 +1842,14 @@ func file_c1_config_v1_rules_proto_init() { } file_c1_config_v1_rules_proto_msgTypes[3].OneofWrappers = []any{} file_c1_config_v1_rules_proto_msgTypes[4].OneofWrappers = []any{} + file_c1_config_v1_rules_proto_msgTypes[7].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_c1_config_v1_rules_proto_rawDesc), len(file_c1_config_v1_rules_proto_rawDesc)), NumEnums: 1, - NumMessages: 6, + NumMessages: 8, NumExtensions: 0, NumServices: 0, }, diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/action.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/action.pb.go index 1801c93c..d8fbaf70 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/action.pb.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/action.pb.go @@ -88,6 +88,11 @@ const ( ActionType_ACTION_TYPE_ACCOUNT_UPDATE_PROFILE ActionType = 3 ActionType_ACTION_TYPE_ACCOUNT_DISABLE ActionType = 4 ActionType_ACTION_TYPE_ACCOUNT_ENABLE ActionType = 5 + // Generic resource actions + ActionType_ACTION_TYPE_RESOURCE_CREATE ActionType = 6 + ActionType_ACTION_TYPE_RESOURCE_DELETE ActionType = 7 + ActionType_ACTION_TYPE_RESOURCE_ENABLE ActionType = 8 + ActionType_ACTION_TYPE_RESOURCE_DISABLE ActionType = 9 ) // Enum value maps for ActionType. @@ -99,6 +104,10 @@ var ( 3: "ACTION_TYPE_ACCOUNT_UPDATE_PROFILE", 4: "ACTION_TYPE_ACCOUNT_DISABLE", 5: "ACTION_TYPE_ACCOUNT_ENABLE", + 6: "ACTION_TYPE_RESOURCE_CREATE", + 7: "ACTION_TYPE_RESOURCE_DELETE", + 8: "ACTION_TYPE_RESOURCE_ENABLE", + 9: "ACTION_TYPE_RESOURCE_DISABLE", } ActionType_value = map[string]int32{ "ACTION_TYPE_UNSPECIFIED": 0, @@ -107,6 +116,10 @@ var ( "ACTION_TYPE_ACCOUNT_UPDATE_PROFILE": 3, "ACTION_TYPE_ACCOUNT_DISABLE": 4, "ACTION_TYPE_ACCOUNT_ENABLE": 5, + "ACTION_TYPE_RESOURCE_CREATE": 6, + "ACTION_TYPE_RESOURCE_DELETE": 7, + "ACTION_TYPE_RESOURCE_ENABLE": 8, + "ACTION_TYPE_RESOURCE_DISABLE": 9, } ) @@ -133,16 +146,18 @@ func (x ActionType) Number() protoreflect.EnumNumber { } type BatonActionSchema struct { - state protoimpl.MessageState `protogen:"hybrid.v1"` - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Arguments []*v1.Field `protobuf:"bytes,2,rep,name=arguments,proto3" json:"arguments,omitempty"` - Constraints []*v1.Constraint `protobuf:"bytes,3,rep,name=constraints,proto3" json:"constraints,omitempty"` - ReturnTypes []*v1.Field `protobuf:"bytes,4,rep,name=return_types,json=returnTypes,proto3" json:"return_types,omitempty"` - DisplayName string `protobuf:"bytes,5,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` - Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` - ActionType []ActionType `protobuf:"varint,7,rep,packed,name=action_type,json=actionType,proto3,enum=c1.connector.v2.ActionType" json:"action_type,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"hybrid.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Arguments []*v1.Field `protobuf:"bytes,2,rep,name=arguments,proto3" json:"arguments,omitempty"` + Constraints []*v1.Constraint `protobuf:"bytes,3,rep,name=constraints,proto3" json:"constraints,omitempty"` + ReturnTypes []*v1.Field `protobuf:"bytes,4,rep,name=return_types,json=returnTypes,proto3" json:"return_types,omitempty"` + DisplayName string `protobuf:"bytes,5,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` + Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` + ActionType []ActionType `protobuf:"varint,7,rep,packed,name=action_type,json=actionType,proto3,enum=c1.connector.v2.ActionType" json:"action_type,omitempty"` + // Optional: if set, this action is scoped to a specific resource type + ResourceTypeId string `protobuf:"bytes,8,opt,name=resource_type_id,json=resourceTypeId,proto3" json:"resource_type_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *BatonActionSchema) Reset() { @@ -219,6 +234,13 @@ func (x *BatonActionSchema) GetActionType() []ActionType { return nil } +func (x *BatonActionSchema) GetResourceTypeId() string { + if x != nil { + return x.ResourceTypeId + } + return "" +} + func (x *BatonActionSchema) SetName(v string) { x.Name = v } @@ -247,6 +269,10 @@ func (x *BatonActionSchema) SetActionType(v []ActionType) { x.ActionType = v } +func (x *BatonActionSchema) SetResourceTypeId(v string) { + x.ResourceTypeId = v +} + type BatonActionSchema_builder struct { _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. @@ -257,6 +283,8 @@ type BatonActionSchema_builder struct { DisplayName string Description string ActionType []ActionType + // Optional: if set, this action is scoped to a specific resource type + ResourceTypeId string } func (b0 BatonActionSchema_builder) Build() *BatonActionSchema { @@ -270,16 +298,19 @@ func (b0 BatonActionSchema_builder) Build() *BatonActionSchema { x.DisplayName = b.DisplayName x.Description = b.Description x.ActionType = b.ActionType + x.ResourceTypeId = b.ResourceTypeId return m0 } type InvokeActionRequest struct { - state protoimpl.MessageState `protogen:"hybrid.v1"` - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Args *structpb.Struct `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty"` - Annotations []*anypb.Any `protobuf:"bytes,3,rep,name=annotations,proto3" json:"annotations,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"hybrid.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Args *structpb.Struct `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty"` + Annotations []*anypb.Any `protobuf:"bytes,3,rep,name=annotations,proto3" json:"annotations,omitempty"` + // Optional: if set, invokes a resource-scoped action + ResourceTypeId string `protobuf:"bytes,4,opt,name=resource_type_id,json=resourceTypeId,proto3" json:"resource_type_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *InvokeActionRequest) Reset() { @@ -328,6 +359,13 @@ func (x *InvokeActionRequest) GetAnnotations() []*anypb.Any { return nil } +func (x *InvokeActionRequest) GetResourceTypeId() string { + if x != nil { + return x.ResourceTypeId + } + return "" +} + func (x *InvokeActionRequest) SetName(v string) { x.Name = v } @@ -340,6 +378,10 @@ func (x *InvokeActionRequest) SetAnnotations(v []*anypb.Any) { x.Annotations = v } +func (x *InvokeActionRequest) SetResourceTypeId(v string) { + x.ResourceTypeId = v +} + func (x *InvokeActionRequest) HasArgs() bool { if x == nil { return false @@ -357,6 +399,8 @@ type InvokeActionRequest_builder struct { Name string Args *structpb.Struct Annotations []*anypb.Any + // Optional: if set, invokes a resource-scoped action + ResourceTypeId string } func (b0 InvokeActionRequest_builder) Build() *InvokeActionRequest { @@ -366,6 +410,7 @@ func (b0 InvokeActionRequest_builder) Build() *InvokeActionRequest { x.Name = b.Name x.Args = b.Args x.Annotations = b.Annotations + x.ResourceTypeId = b.ResourceTypeId return m0 } @@ -860,10 +905,12 @@ func (b0 GetActionSchemaResponse_builder) Build() *GetActionSchemaResponse { } type ListActionSchemasRequest struct { - state protoimpl.MessageState `protogen:"hybrid.v1"` - Annotations []*anypb.Any `protobuf:"bytes,1,rep,name=annotations,proto3" json:"annotations,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"hybrid.v1"` + Annotations []*anypb.Any `protobuf:"bytes,1,rep,name=annotations,proto3" json:"annotations,omitempty"` + // Optional: filter to only return actions for a specific resource type + ResourceTypeId string `protobuf:"bytes,2,opt,name=resource_type_id,json=resourceTypeId,proto3" json:"resource_type_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ListActionSchemasRequest) Reset() { @@ -898,14 +945,27 @@ func (x *ListActionSchemasRequest) GetAnnotations() []*anypb.Any { return nil } +func (x *ListActionSchemasRequest) GetResourceTypeId() string { + if x != nil { + return x.ResourceTypeId + } + return "" +} + func (x *ListActionSchemasRequest) SetAnnotations(v []*anypb.Any) { x.Annotations = v } +func (x *ListActionSchemasRequest) SetResourceTypeId(v string) { + x.ResourceTypeId = v +} + type ListActionSchemasRequest_builder struct { _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. Annotations []*anypb.Any + // Optional: filter to only return actions for a specific resource type + ResourceTypeId string } func (b0 ListActionSchemasRequest_builder) Build() *ListActionSchemasRequest { @@ -913,6 +973,7 @@ func (b0 ListActionSchemasRequest_builder) Build() *ListActionSchemasRequest { b, x := &b0, m0 _, _ = b, x x.Annotations = b.Annotations + x.ResourceTypeId = b.ResourceTypeId return m0 } @@ -991,7 +1052,7 @@ var File_c1_connector_v2_action_proto protoreflect.FileDescriptor const file_c1_connector_v2_action_proto_rawDesc = "" + "\n" + - "\x1cc1/connector/v2/action.proto\x12\x0fc1.connector.v2\x1a\x19c1/config/v1/config.proto\x1a\x19google/protobuf/any.proto\x1a\x1cgoogle/protobuf/struct.proto\"\xd1\x02\n" + + "\x1cc1/connector/v2/action.proto\x12\x0fc1.connector.v2\x1a\x19c1/config/v1/config.proto\x1a\x19google/protobuf/any.proto\x1a\x1cgoogle/protobuf/struct.proto\"\xfb\x02\n" + "\x11BatonActionSchema\x12\x12\n" + "\x04name\x18\x01 \x01(\tR\x04name\x121\n" + "\targuments\x18\x02 \x03(\v2\x13.c1.config.v1.FieldR\targuments\x12:\n" + @@ -1000,11 +1061,13 @@ const file_c1_connector_v2_action_proto_rawDesc = "" + "\fdisplay_name\x18\x05 \x01(\tR\vdisplayName\x12 \n" + "\vdescription\x18\x06 \x01(\tR\vdescription\x12<\n" + "\vaction_type\x18\a \x03(\x0e2\x1b.c1.connector.v2.ActionTypeR\n" + - "actionType\"\x8e\x01\n" + + "actionType\x12(\n" + + "\x10resource_type_id\x18\b \x01(\tR\x0eresourceTypeId\"\xb8\x01\n" + "\x13InvokeActionRequest\x12\x12\n" + "\x04name\x18\x01 \x01(\tR\x04name\x12+\n" + "\x04args\x18\x02 \x01(\v2\x17.google.protobuf.StructR\x04args\x126\n" + - "\vannotations\x18\x03 \x03(\v2\x14.google.protobuf.AnyR\vannotations\"\xe3\x01\n" + + "\vannotations\x18\x03 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x12(\n" + + "\x10resource_type_id\x18\x04 \x01(\tR\x0eresourceTypeId\"\xe3\x01\n" + "\x14InvokeActionResponse\x12\x0e\n" + "\x02id\x18\x01 \x01(\tR\x02id\x12:\n" + "\x06status\x18\x02 \x01(\x0e2\".c1.connector.v2.BatonActionStatusR\x06status\x126\n" + @@ -1026,9 +1089,10 @@ const file_c1_connector_v2_action_proto_rawDesc = "" + "\vannotations\x18\x02 \x03(\v2\x14.google.protobuf.AnyR\vannotations\"\x8d\x01\n" + "\x17GetActionSchemaResponse\x12:\n" + "\x06schema\x18\x01 \x01(\v2\".c1.connector.v2.BatonActionSchemaR\x06schema\x126\n" + - "\vannotations\x18\x02 \x03(\v2\x14.google.protobuf.AnyR\vannotations\"R\n" + + "\vannotations\x18\x02 \x03(\v2\x14.google.protobuf.AnyR\vannotations\"|\n" + "\x18ListActionSchemasRequest\x126\n" + - "\vannotations\x18\x01 \x03(\v2\x14.google.protobuf.AnyR\vannotations\"\x91\x01\n" + + "\vannotations\x18\x01 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x12(\n" + + "\x10resource_type_id\x18\x02 \x01(\tR\x0eresourceTypeId\"\x91\x01\n" + "\x19ListActionSchemasResponse\x12<\n" + "\aschemas\x18\x01 \x03(\v2\".c1.connector.v2.BatonActionSchemaR\aschemas\x126\n" + "\vannotations\x18\x02 \x03(\v2\x14.google.protobuf.AnyR\vannotations*\xdd\x01\n" + @@ -1038,7 +1102,7 @@ const file_c1_connector_v2_action_proto_rawDesc = "" + "\x1bBATON_ACTION_STATUS_PENDING\x10\x02\x12\x1f\n" + "\x1bBATON_ACTION_STATUS_RUNNING\x10\x03\x12 \n" + "\x1cBATON_ACTION_STATUS_COMPLETE\x10\x04\x12\x1e\n" + - "\x1aBATON_ACTION_STATUS_FAILED\x10\x05*\xc4\x01\n" + + "\x1aBATON_ACTION_STATUS_FAILED\x10\x05*\xc9\x02\n" + "\n" + "ActionType\x12\x1b\n" + "\x17ACTION_TYPE_UNSPECIFIED\x10\x00\x12\x17\n" + @@ -1046,7 +1110,11 @@ const file_c1_connector_v2_action_proto_rawDesc = "" + "\x13ACTION_TYPE_ACCOUNT\x10\x02\x12&\n" + "\"ACTION_TYPE_ACCOUNT_UPDATE_PROFILE\x10\x03\x12\x1f\n" + "\x1bACTION_TYPE_ACCOUNT_DISABLE\x10\x04\x12\x1e\n" + - "\x1aACTION_TYPE_ACCOUNT_ENABLE\x10\x052\xa4\x03\n" + + "\x1aACTION_TYPE_ACCOUNT_ENABLE\x10\x05\x12\x1f\n" + + "\x1bACTION_TYPE_RESOURCE_CREATE\x10\x06\x12\x1f\n" + + "\x1bACTION_TYPE_RESOURCE_DELETE\x10\a\x12\x1f\n" + + "\x1bACTION_TYPE_RESOURCE_ENABLE\x10\b\x12 \n" + + "\x1cACTION_TYPE_RESOURCE_DISABLE\x10\t2\xa4\x03\n" + "\rActionService\x12[\n" + "\fInvokeAction\x12$.c1.connector.v2.InvokeActionRequest\x1a%.c1.connector.v2.InvokeActionResponse\x12d\n" + "\x0fGetActionStatus\x12'.c1.connector.v2.GetActionStatusRequest\x1a(.c1.connector.v2.GetActionStatusResponse\x12d\n" + diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/action.pb.validate.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/action.pb.validate.go index 590b0616..40566def 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/action.pb.validate.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/action.pb.validate.go @@ -165,6 +165,8 @@ func (m *BatonActionSchema) validate(all bool) error { // no validation rules for Description + // no validation rules for ResourceTypeId + if len(errors) > 0 { return BatonActionSchemaMultiError(errors) } @@ -332,6 +334,8 @@ func (m *InvokeActionRequest) validate(all bool) error { } + // no validation rules for ResourceTypeId + if len(errors) > 0 { return InvokeActionRequestMultiError(errors) } @@ -1253,6 +1257,8 @@ func (m *ListActionSchemasRequest) validate(all bool) error { } + // no validation rules for ResourceTypeId + if len(errors) > 0 { return ListActionSchemasRequestMultiError(errors) } diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/action_protoopaque.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/action_protoopaque.pb.go index e8a0e89d..44664477 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/action_protoopaque.pb.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/action_protoopaque.pb.go @@ -88,6 +88,11 @@ const ( ActionType_ACTION_TYPE_ACCOUNT_UPDATE_PROFILE ActionType = 3 ActionType_ACTION_TYPE_ACCOUNT_DISABLE ActionType = 4 ActionType_ACTION_TYPE_ACCOUNT_ENABLE ActionType = 5 + // Generic resource actions + ActionType_ACTION_TYPE_RESOURCE_CREATE ActionType = 6 + ActionType_ACTION_TYPE_RESOURCE_DELETE ActionType = 7 + ActionType_ACTION_TYPE_RESOURCE_ENABLE ActionType = 8 + ActionType_ACTION_TYPE_RESOURCE_DISABLE ActionType = 9 ) // Enum value maps for ActionType. @@ -99,6 +104,10 @@ var ( 3: "ACTION_TYPE_ACCOUNT_UPDATE_PROFILE", 4: "ACTION_TYPE_ACCOUNT_DISABLE", 5: "ACTION_TYPE_ACCOUNT_ENABLE", + 6: "ACTION_TYPE_RESOURCE_CREATE", + 7: "ACTION_TYPE_RESOURCE_DELETE", + 8: "ACTION_TYPE_RESOURCE_ENABLE", + 9: "ACTION_TYPE_RESOURCE_DISABLE", } ActionType_value = map[string]int32{ "ACTION_TYPE_UNSPECIFIED": 0, @@ -107,6 +116,10 @@ var ( "ACTION_TYPE_ACCOUNT_UPDATE_PROFILE": 3, "ACTION_TYPE_ACCOUNT_DISABLE": 4, "ACTION_TYPE_ACCOUNT_ENABLE": 5, + "ACTION_TYPE_RESOURCE_CREATE": 6, + "ACTION_TYPE_RESOURCE_DELETE": 7, + "ACTION_TYPE_RESOURCE_ENABLE": 8, + "ACTION_TYPE_RESOURCE_DISABLE": 9, } ) @@ -133,16 +146,17 @@ func (x ActionType) Number() protoreflect.EnumNumber { } type BatonActionSchema struct { - state protoimpl.MessageState `protogen:"opaque.v1"` - xxx_hidden_Name string `protobuf:"bytes,1,opt,name=name,proto3"` - xxx_hidden_Arguments *[]*v1.Field `protobuf:"bytes,2,rep,name=arguments,proto3"` - xxx_hidden_Constraints *[]*v1.Constraint `protobuf:"bytes,3,rep,name=constraints,proto3"` - xxx_hidden_ReturnTypes *[]*v1.Field `protobuf:"bytes,4,rep,name=return_types,json=returnTypes,proto3"` - xxx_hidden_DisplayName string `protobuf:"bytes,5,opt,name=display_name,json=displayName,proto3"` - xxx_hidden_Description string `protobuf:"bytes,6,opt,name=description,proto3"` - xxx_hidden_ActionType []ActionType `protobuf:"varint,7,rep,packed,name=action_type,json=actionType,proto3,enum=c1.connector.v2.ActionType"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Name string `protobuf:"bytes,1,opt,name=name,proto3"` + xxx_hidden_Arguments *[]*v1.Field `protobuf:"bytes,2,rep,name=arguments,proto3"` + xxx_hidden_Constraints *[]*v1.Constraint `protobuf:"bytes,3,rep,name=constraints,proto3"` + xxx_hidden_ReturnTypes *[]*v1.Field `protobuf:"bytes,4,rep,name=return_types,json=returnTypes,proto3"` + xxx_hidden_DisplayName string `protobuf:"bytes,5,opt,name=display_name,json=displayName,proto3"` + xxx_hidden_Description string `protobuf:"bytes,6,opt,name=description,proto3"` + xxx_hidden_ActionType []ActionType `protobuf:"varint,7,rep,packed,name=action_type,json=actionType,proto3,enum=c1.connector.v2.ActionType"` + xxx_hidden_ResourceTypeId string `protobuf:"bytes,8,opt,name=resource_type_id,json=resourceTypeId,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *BatonActionSchema) Reset() { @@ -225,6 +239,13 @@ func (x *BatonActionSchema) GetActionType() []ActionType { return nil } +func (x *BatonActionSchema) GetResourceTypeId() string { + if x != nil { + return x.xxx_hidden_ResourceTypeId + } + return "" +} + func (x *BatonActionSchema) SetName(v string) { x.xxx_hidden_Name = v } @@ -253,6 +274,10 @@ func (x *BatonActionSchema) SetActionType(v []ActionType) { x.xxx_hidden_ActionType = v } +func (x *BatonActionSchema) SetResourceTypeId(v string) { + x.xxx_hidden_ResourceTypeId = v +} + type BatonActionSchema_builder struct { _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. @@ -263,6 +288,8 @@ type BatonActionSchema_builder struct { DisplayName string Description string ActionType []ActionType + // Optional: if set, this action is scoped to a specific resource type + ResourceTypeId string } func (b0 BatonActionSchema_builder) Build() *BatonActionSchema { @@ -276,16 +303,18 @@ func (b0 BatonActionSchema_builder) Build() *BatonActionSchema { x.xxx_hidden_DisplayName = b.DisplayName x.xxx_hidden_Description = b.Description x.xxx_hidden_ActionType = b.ActionType + x.xxx_hidden_ResourceTypeId = b.ResourceTypeId return m0 } type InvokeActionRequest struct { - state protoimpl.MessageState `protogen:"opaque.v1"` - xxx_hidden_Name string `protobuf:"bytes,1,opt,name=name,proto3"` - xxx_hidden_Args *structpb.Struct `protobuf:"bytes,2,opt,name=args,proto3"` - xxx_hidden_Annotations *[]*anypb.Any `protobuf:"bytes,3,rep,name=annotations,proto3"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Name string `protobuf:"bytes,1,opt,name=name,proto3"` + xxx_hidden_Args *structpb.Struct `protobuf:"bytes,2,opt,name=args,proto3"` + xxx_hidden_Annotations *[]*anypb.Any `protobuf:"bytes,3,rep,name=annotations,proto3"` + xxx_hidden_ResourceTypeId string `protobuf:"bytes,4,opt,name=resource_type_id,json=resourceTypeId,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *InvokeActionRequest) Reset() { @@ -336,6 +365,13 @@ func (x *InvokeActionRequest) GetAnnotations() []*anypb.Any { return nil } +func (x *InvokeActionRequest) GetResourceTypeId() string { + if x != nil { + return x.xxx_hidden_ResourceTypeId + } + return "" +} + func (x *InvokeActionRequest) SetName(v string) { x.xxx_hidden_Name = v } @@ -348,6 +384,10 @@ func (x *InvokeActionRequest) SetAnnotations(v []*anypb.Any) { x.xxx_hidden_Annotations = &v } +func (x *InvokeActionRequest) SetResourceTypeId(v string) { + x.xxx_hidden_ResourceTypeId = v +} + func (x *InvokeActionRequest) HasArgs() bool { if x == nil { return false @@ -365,6 +405,8 @@ type InvokeActionRequest_builder struct { Name string Args *structpb.Struct Annotations []*anypb.Any + // Optional: if set, invokes a resource-scoped action + ResourceTypeId string } func (b0 InvokeActionRequest_builder) Build() *InvokeActionRequest { @@ -374,6 +416,7 @@ func (b0 InvokeActionRequest_builder) Build() *InvokeActionRequest { x.xxx_hidden_Name = b.Name x.xxx_hidden_Args = b.Args x.xxx_hidden_Annotations = &b.Annotations + x.xxx_hidden_ResourceTypeId = b.ResourceTypeId return m0 } @@ -877,10 +920,11 @@ func (b0 GetActionSchemaResponse_builder) Build() *GetActionSchemaResponse { } type ListActionSchemasRequest struct { - state protoimpl.MessageState `protogen:"opaque.v1"` - xxx_hidden_Annotations *[]*anypb.Any `protobuf:"bytes,1,rep,name=annotations,proto3"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Annotations *[]*anypb.Any `protobuf:"bytes,1,rep,name=annotations,proto3"` + xxx_hidden_ResourceTypeId string `protobuf:"bytes,2,opt,name=resource_type_id,json=resourceTypeId,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ListActionSchemasRequest) Reset() { @@ -917,14 +961,27 @@ func (x *ListActionSchemasRequest) GetAnnotations() []*anypb.Any { return nil } +func (x *ListActionSchemasRequest) GetResourceTypeId() string { + if x != nil { + return x.xxx_hidden_ResourceTypeId + } + return "" +} + func (x *ListActionSchemasRequest) SetAnnotations(v []*anypb.Any) { x.xxx_hidden_Annotations = &v } +func (x *ListActionSchemasRequest) SetResourceTypeId(v string) { + x.xxx_hidden_ResourceTypeId = v +} + type ListActionSchemasRequest_builder struct { _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. Annotations []*anypb.Any + // Optional: filter to only return actions for a specific resource type + ResourceTypeId string } func (b0 ListActionSchemasRequest_builder) Build() *ListActionSchemasRequest { @@ -932,6 +989,7 @@ func (b0 ListActionSchemasRequest_builder) Build() *ListActionSchemasRequest { b, x := &b0, m0 _, _ = b, x x.xxx_hidden_Annotations = &b.Annotations + x.xxx_hidden_ResourceTypeId = b.ResourceTypeId return m0 } @@ -1014,7 +1072,7 @@ var File_c1_connector_v2_action_proto protoreflect.FileDescriptor const file_c1_connector_v2_action_proto_rawDesc = "" + "\n" + - "\x1cc1/connector/v2/action.proto\x12\x0fc1.connector.v2\x1a\x19c1/config/v1/config.proto\x1a\x19google/protobuf/any.proto\x1a\x1cgoogle/protobuf/struct.proto\"\xd1\x02\n" + + "\x1cc1/connector/v2/action.proto\x12\x0fc1.connector.v2\x1a\x19c1/config/v1/config.proto\x1a\x19google/protobuf/any.proto\x1a\x1cgoogle/protobuf/struct.proto\"\xfb\x02\n" + "\x11BatonActionSchema\x12\x12\n" + "\x04name\x18\x01 \x01(\tR\x04name\x121\n" + "\targuments\x18\x02 \x03(\v2\x13.c1.config.v1.FieldR\targuments\x12:\n" + @@ -1023,11 +1081,13 @@ const file_c1_connector_v2_action_proto_rawDesc = "" + "\fdisplay_name\x18\x05 \x01(\tR\vdisplayName\x12 \n" + "\vdescription\x18\x06 \x01(\tR\vdescription\x12<\n" + "\vaction_type\x18\a \x03(\x0e2\x1b.c1.connector.v2.ActionTypeR\n" + - "actionType\"\x8e\x01\n" + + "actionType\x12(\n" + + "\x10resource_type_id\x18\b \x01(\tR\x0eresourceTypeId\"\xb8\x01\n" + "\x13InvokeActionRequest\x12\x12\n" + "\x04name\x18\x01 \x01(\tR\x04name\x12+\n" + "\x04args\x18\x02 \x01(\v2\x17.google.protobuf.StructR\x04args\x126\n" + - "\vannotations\x18\x03 \x03(\v2\x14.google.protobuf.AnyR\vannotations\"\xe3\x01\n" + + "\vannotations\x18\x03 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x12(\n" + + "\x10resource_type_id\x18\x04 \x01(\tR\x0eresourceTypeId\"\xe3\x01\n" + "\x14InvokeActionResponse\x12\x0e\n" + "\x02id\x18\x01 \x01(\tR\x02id\x12:\n" + "\x06status\x18\x02 \x01(\x0e2\".c1.connector.v2.BatonActionStatusR\x06status\x126\n" + @@ -1049,9 +1109,10 @@ const file_c1_connector_v2_action_proto_rawDesc = "" + "\vannotations\x18\x02 \x03(\v2\x14.google.protobuf.AnyR\vannotations\"\x8d\x01\n" + "\x17GetActionSchemaResponse\x12:\n" + "\x06schema\x18\x01 \x01(\v2\".c1.connector.v2.BatonActionSchemaR\x06schema\x126\n" + - "\vannotations\x18\x02 \x03(\v2\x14.google.protobuf.AnyR\vannotations\"R\n" + + "\vannotations\x18\x02 \x03(\v2\x14.google.protobuf.AnyR\vannotations\"|\n" + "\x18ListActionSchemasRequest\x126\n" + - "\vannotations\x18\x01 \x03(\v2\x14.google.protobuf.AnyR\vannotations\"\x91\x01\n" + + "\vannotations\x18\x01 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x12(\n" + + "\x10resource_type_id\x18\x02 \x01(\tR\x0eresourceTypeId\"\x91\x01\n" + "\x19ListActionSchemasResponse\x12<\n" + "\aschemas\x18\x01 \x03(\v2\".c1.connector.v2.BatonActionSchemaR\aschemas\x126\n" + "\vannotations\x18\x02 \x03(\v2\x14.google.protobuf.AnyR\vannotations*\xdd\x01\n" + @@ -1061,7 +1122,7 @@ const file_c1_connector_v2_action_proto_rawDesc = "" + "\x1bBATON_ACTION_STATUS_PENDING\x10\x02\x12\x1f\n" + "\x1bBATON_ACTION_STATUS_RUNNING\x10\x03\x12 \n" + "\x1cBATON_ACTION_STATUS_COMPLETE\x10\x04\x12\x1e\n" + - "\x1aBATON_ACTION_STATUS_FAILED\x10\x05*\xc4\x01\n" + + "\x1aBATON_ACTION_STATUS_FAILED\x10\x05*\xc9\x02\n" + "\n" + "ActionType\x12\x1b\n" + "\x17ACTION_TYPE_UNSPECIFIED\x10\x00\x12\x17\n" + @@ -1069,7 +1130,11 @@ const file_c1_connector_v2_action_proto_rawDesc = "" + "\x13ACTION_TYPE_ACCOUNT\x10\x02\x12&\n" + "\"ACTION_TYPE_ACCOUNT_UPDATE_PROFILE\x10\x03\x12\x1f\n" + "\x1bACTION_TYPE_ACCOUNT_DISABLE\x10\x04\x12\x1e\n" + - "\x1aACTION_TYPE_ACCOUNT_ENABLE\x10\x052\xa4\x03\n" + + "\x1aACTION_TYPE_ACCOUNT_ENABLE\x10\x05\x12\x1f\n" + + "\x1bACTION_TYPE_RESOURCE_CREATE\x10\x06\x12\x1f\n" + + "\x1bACTION_TYPE_RESOURCE_DELETE\x10\a\x12\x1f\n" + + "\x1bACTION_TYPE_RESOURCE_ENABLE\x10\b\x12 \n" + + "\x1cACTION_TYPE_RESOURCE_DISABLE\x10\t2\xa4\x03\n" + "\rActionService\x12[\n" + "\fInvokeAction\x12$.c1.connector.v2.InvokeActionRequest\x1a%.c1.connector.v2.InvokeActionResponse\x12d\n" + "\x0fGetActionStatus\x12'.c1.connector.v2.GetActionStatusRequest\x1a(.c1.connector.v2.GetActionStatusResponse\x12d\n" + diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_resource.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_resource.pb.go new file mode 100644 index 00000000..39fa94b8 --- /dev/null +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_resource.pb.go @@ -0,0 +1,110 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc (unknown) +// source: c1/connector/v2/annotation_resource.proto + +//go:build !protoopaque + +package v2 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Resource was not deleted because the resource does not exist. +type ResourceDoesNotExist struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResourceDoesNotExist) Reset() { + *x = ResourceDoesNotExist{} + mi := &file_c1_connector_v2_annotation_resource_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResourceDoesNotExist) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResourceDoesNotExist) ProtoMessage() {} + +func (x *ResourceDoesNotExist) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_annotation_resource_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +type ResourceDoesNotExist_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + +} + +func (b0 ResourceDoesNotExist_builder) Build() *ResourceDoesNotExist { + m0 := &ResourceDoesNotExist{} + b, x := &b0, m0 + _, _ = b, x + return m0 +} + +var File_c1_connector_v2_annotation_resource_proto protoreflect.FileDescriptor + +const file_c1_connector_v2_annotation_resource_proto_rawDesc = "" + + "\n" + + ")c1/connector/v2/annotation_resource.proto\x12\x0fc1.connector.v2\"\x16\n" + + "\x14ResourceDoesNotExistB6Z4github.com/conductorone/baton-sdk/pb/c1/connector/v2b\x06proto3" + +var file_c1_connector_v2_annotation_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_c1_connector_v2_annotation_resource_proto_goTypes = []any{ + (*ResourceDoesNotExist)(nil), // 0: c1.connector.v2.ResourceDoesNotExist +} +var file_c1_connector_v2_annotation_resource_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_c1_connector_v2_annotation_resource_proto_init() } +func file_c1_connector_v2_annotation_resource_proto_init() { + if File_c1_connector_v2_annotation_resource_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_c1_connector_v2_annotation_resource_proto_rawDesc), len(file_c1_connector_v2_annotation_resource_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_c1_connector_v2_annotation_resource_proto_goTypes, + DependencyIndexes: file_c1_connector_v2_annotation_resource_proto_depIdxs, + MessageInfos: file_c1_connector_v2_annotation_resource_proto_msgTypes, + }.Build() + File_c1_connector_v2_annotation_resource_proto = out.File + file_c1_connector_v2_annotation_resource_proto_goTypes = nil + file_c1_connector_v2_annotation_resource_proto_depIdxs = nil +} diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_resource.pb.validate.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_resource.pb.validate.go new file mode 100644 index 00000000..06cd9eab --- /dev/null +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_resource.pb.validate.go @@ -0,0 +1,138 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: c1/connector/v2/annotation_resource.proto + +package v2 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "google.golang.org/protobuf/types/known/anypb" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = anypb.Any{} + _ = sort.Sort +) + +// Validate checks the field values on ResourceDoesNotExist with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *ResourceDoesNotExist) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ResourceDoesNotExist with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ResourceDoesNotExistMultiError, or nil if none found. +func (m *ResourceDoesNotExist) ValidateAll() error { + return m.validate(true) +} + +func (m *ResourceDoesNotExist) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if len(errors) > 0 { + return ResourceDoesNotExistMultiError(errors) + } + + return nil +} + +// ResourceDoesNotExistMultiError is an error wrapping multiple validation +// errors returned by ResourceDoesNotExist.ValidateAll() if the designated +// constraints aren't met. +type ResourceDoesNotExistMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ResourceDoesNotExistMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ResourceDoesNotExistMultiError) AllErrors() []error { return m } + +// ResourceDoesNotExistValidationError is the validation error returned by +// ResourceDoesNotExist.Validate if the designated constraints aren't met. +type ResourceDoesNotExistValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ResourceDoesNotExistValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ResourceDoesNotExistValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ResourceDoesNotExistValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ResourceDoesNotExistValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ResourceDoesNotExistValidationError) ErrorName() string { + return "ResourceDoesNotExistValidationError" +} + +// Error satisfies the builtin error interface +func (e ResourceDoesNotExistValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sResourceDoesNotExist.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ResourceDoesNotExistValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ResourceDoesNotExistValidationError{} diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_resource_protoopaque.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_resource_protoopaque.pb.go new file mode 100644 index 00000000..3c9ff590 --- /dev/null +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_resource_protoopaque.pb.go @@ -0,0 +1,110 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc (unknown) +// source: c1/connector/v2/annotation_resource.proto + +//go:build protoopaque + +package v2 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Resource was not deleted because the resource does not exist. +type ResourceDoesNotExist struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResourceDoesNotExist) Reset() { + *x = ResourceDoesNotExist{} + mi := &file_c1_connector_v2_annotation_resource_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResourceDoesNotExist) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResourceDoesNotExist) ProtoMessage() {} + +func (x *ResourceDoesNotExist) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_annotation_resource_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +type ResourceDoesNotExist_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + +} + +func (b0 ResourceDoesNotExist_builder) Build() *ResourceDoesNotExist { + m0 := &ResourceDoesNotExist{} + b, x := &b0, m0 + _, _ = b, x + return m0 +} + +var File_c1_connector_v2_annotation_resource_proto protoreflect.FileDescriptor + +const file_c1_connector_v2_annotation_resource_proto_rawDesc = "" + + "\n" + + ")c1/connector/v2/annotation_resource.proto\x12\x0fc1.connector.v2\"\x16\n" + + "\x14ResourceDoesNotExistB6Z4github.com/conductorone/baton-sdk/pb/c1/connector/v2b\x06proto3" + +var file_c1_connector_v2_annotation_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_c1_connector_v2_annotation_resource_proto_goTypes = []any{ + (*ResourceDoesNotExist)(nil), // 0: c1.connector.v2.ResourceDoesNotExist +} +var file_c1_connector_v2_annotation_resource_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_c1_connector_v2_annotation_resource_proto_init() } +func file_c1_connector_v2_annotation_resource_proto_init() { + if File_c1_connector_v2_annotation_resource_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_c1_connector_v2_annotation_resource_proto_rawDesc), len(file_c1_connector_v2_annotation_resource_proto_rawDesc)), + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_c1_connector_v2_annotation_resource_proto_goTypes, + DependencyIndexes: file_c1_connector_v2_annotation_resource_proto_depIdxs, + MessageInfos: file_c1_connector_v2_annotation_resource_proto_msgTypes, + }.Build() + File_c1_connector_v2_annotation_resource_proto = out.File + file_c1_connector_v2_annotation_resource_proto_goTypes = nil + file_c1_connector_v2_annotation_resource_proto_depIdxs = nil +} diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_resource_tree.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_resource_tree.pb.go index b14ee19a..407721f2 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_resource_tree.pb.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_resource_tree.pb.go @@ -165,6 +165,49 @@ func (b0 SkipGrants_builder) Build() *SkipGrants { return m0 } +type SkipEntitlements struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SkipEntitlements) Reset() { + *x = SkipEntitlements{} + mi := &file_c1_connector_v2_annotation_resource_tree_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SkipEntitlements) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SkipEntitlements) ProtoMessage() {} + +func (x *SkipEntitlements) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_annotation_resource_tree_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +type SkipEntitlements_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + +} + +func (b0 SkipEntitlements_builder) Build() *SkipEntitlements { + m0 := &SkipEntitlements{} + b, x := &b0, m0 + _, _ = b, x + return m0 +} + var File_c1_connector_v2_annotation_resource_tree_proto protoreflect.FileDescriptor const file_c1_connector_v2_annotation_resource_tree_proto_rawDesc = "" + @@ -174,13 +217,15 @@ const file_c1_connector_v2_annotation_resource_tree_proto_rawDesc = "" + "\x10resource_type_id\x18\x01 \x01(\tR\x0eresourceTypeId\"\x1b\n" + "\x19SkipEntitlementsAndGrants\"\f\n" + "\n" + - "SkipGrantsB6Z4github.com/conductorone/baton-sdk/pb/c1/connector/v2b\x06proto3" + "SkipGrants\"\x12\n" + + "\x10SkipEntitlementsB6Z4github.com/conductorone/baton-sdk/pb/c1/connector/v2b\x06proto3" -var file_c1_connector_v2_annotation_resource_tree_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_c1_connector_v2_annotation_resource_tree_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_c1_connector_v2_annotation_resource_tree_proto_goTypes = []any{ (*ChildResourceType)(nil), // 0: c1.connector.v2.ChildResourceType (*SkipEntitlementsAndGrants)(nil), // 1: c1.connector.v2.SkipEntitlementsAndGrants (*SkipGrants)(nil), // 2: c1.connector.v2.SkipGrants + (*SkipEntitlements)(nil), // 3: c1.connector.v2.SkipEntitlements } var file_c1_connector_v2_annotation_resource_tree_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type @@ -201,7 +246,7 @@ func file_c1_connector_v2_annotation_resource_tree_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_c1_connector_v2_annotation_resource_tree_proto_rawDesc), len(file_c1_connector_v2_annotation_resource_tree_proto_rawDesc)), NumEnums: 0, - NumMessages: 3, + NumMessages: 4, NumExtensions: 0, NumServices: 0, }, diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_resource_tree.pb.validate.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_resource_tree.pb.validate.go index 36e768bd..8cff9db3 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_resource_tree.pb.validate.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_resource_tree.pb.validate.go @@ -339,3 +339,103 @@ var _ interface { Cause() error ErrorName() string } = SkipGrantsValidationError{} + +// Validate checks the field values on SkipEntitlements with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *SkipEntitlements) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on SkipEntitlements with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// SkipEntitlementsMultiError, or nil if none found. +func (m *SkipEntitlements) ValidateAll() error { + return m.validate(true) +} + +func (m *SkipEntitlements) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if len(errors) > 0 { + return SkipEntitlementsMultiError(errors) + } + + return nil +} + +// SkipEntitlementsMultiError is an error wrapping multiple validation errors +// returned by SkipEntitlements.ValidateAll() if the designated constraints +// aren't met. +type SkipEntitlementsMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m SkipEntitlementsMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m SkipEntitlementsMultiError) AllErrors() []error { return m } + +// SkipEntitlementsValidationError is the validation error returned by +// SkipEntitlements.Validate if the designated constraints aren't met. +type SkipEntitlementsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SkipEntitlementsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SkipEntitlementsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SkipEntitlementsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SkipEntitlementsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SkipEntitlementsValidationError) ErrorName() string { return "SkipEntitlementsValidationError" } + +// Error satisfies the builtin error interface +func (e SkipEntitlementsValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sSkipEntitlements.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SkipEntitlementsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SkipEntitlementsValidationError{} diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_resource_tree_protoopaque.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_resource_tree_protoopaque.pb.go index e382fb0d..187165f9 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_resource_tree_protoopaque.pb.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_resource_tree_protoopaque.pb.go @@ -165,6 +165,49 @@ func (b0 SkipGrants_builder) Build() *SkipGrants { return m0 } +type SkipEntitlements struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SkipEntitlements) Reset() { + *x = SkipEntitlements{} + mi := &file_c1_connector_v2_annotation_resource_tree_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SkipEntitlements) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SkipEntitlements) ProtoMessage() {} + +func (x *SkipEntitlements) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_annotation_resource_tree_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +type SkipEntitlements_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + +} + +func (b0 SkipEntitlements_builder) Build() *SkipEntitlements { + m0 := &SkipEntitlements{} + b, x := &b0, m0 + _, _ = b, x + return m0 +} + var File_c1_connector_v2_annotation_resource_tree_proto protoreflect.FileDescriptor const file_c1_connector_v2_annotation_resource_tree_proto_rawDesc = "" + @@ -174,13 +217,15 @@ const file_c1_connector_v2_annotation_resource_tree_proto_rawDesc = "" + "\x10resource_type_id\x18\x01 \x01(\tR\x0eresourceTypeId\"\x1b\n" + "\x19SkipEntitlementsAndGrants\"\f\n" + "\n" + - "SkipGrantsB6Z4github.com/conductorone/baton-sdk/pb/c1/connector/v2b\x06proto3" + "SkipGrants\"\x12\n" + + "\x10SkipEntitlementsB6Z4github.com/conductorone/baton-sdk/pb/c1/connector/v2b\x06proto3" -var file_c1_connector_v2_annotation_resource_tree_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_c1_connector_v2_annotation_resource_tree_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_c1_connector_v2_annotation_resource_tree_proto_goTypes = []any{ (*ChildResourceType)(nil), // 0: c1.connector.v2.ChildResourceType (*SkipEntitlementsAndGrants)(nil), // 1: c1.connector.v2.SkipEntitlementsAndGrants (*SkipGrants)(nil), // 2: c1.connector.v2.SkipGrants + (*SkipEntitlements)(nil), // 3: c1.connector.v2.SkipEntitlements } var file_c1_connector_v2_annotation_resource_tree_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type @@ -201,7 +246,7 @@ func file_c1_connector_v2_annotation_resource_tree_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_c1_connector_v2_annotation_resource_tree_proto_rawDesc), len(file_c1_connector_v2_annotation_resource_tree_proto_rawDesc)), NumEnums: 0, - NumMessages: 3, + NumMessages: 4, NumExtensions: 0, NumServices: 0, }, diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_security_insight.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_security_insight.pb.go new file mode 100644 index 00000000..354f27af --- /dev/null +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_security_insight.pb.go @@ -0,0 +1,922 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc (unknown) +// source: c1/connector/v2/annotation_security_insight.proto + +//go:build !protoopaque + +package v2 + +import ( + _ "github.com/envoyproxy/protoc-gen-validate/validate" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// RiskScore represents a risk score insight +type RiskScore struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // The risk score value (e.g., "85", "High") + Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RiskScore) Reset() { + *x = RiskScore{} + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RiskScore) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RiskScore) ProtoMessage() {} + +func (x *RiskScore) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RiskScore) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + +func (x *RiskScore) SetValue(v string) { + x.Value = v +} + +type RiskScore_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The risk score value (e.g., "85", "High") + Value string +} + +func (b0 RiskScore_builder) Build() *RiskScore { + m0 := &RiskScore{} + b, x := &b0, m0 + _, _ = b, x + x.Value = b.Value + return m0 +} + +// Issue represents a security issue or vulnerability +type Issue struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // The issue description or severity (e.g., "Critical", "CVE-2024-1234") + Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + Severity string `protobuf:"bytes,2,opt,name=severity,proto3" json:"severity,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Issue) Reset() { + *x = Issue{} + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Issue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Issue) ProtoMessage() {} + +func (x *Issue) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Issue) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + +func (x *Issue) GetSeverity() string { + if x != nil { + return x.Severity + } + return "" +} + +func (x *Issue) SetValue(v string) { + x.Value = v +} + +func (x *Issue) SetSeverity(v string) { + x.Severity = v +} + +type Issue_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The issue description or severity (e.g., "Critical", "CVE-2024-1234") + Value string + Severity string +} + +func (b0 Issue_builder) Build() *Issue { + m0 := &Issue{} + b, x := &b0, m0 + _, _ = b, x + x.Value = b.Value + x.Severity = b.Severity + return m0 +} + +// SecurityInsightTrait is the trait annotation for resources with TRAIT_SECURITY_INSIGHT. +// It contains the metadata for the security insight including type, value, observation time, +// and the target entity (user or resource) that this insight should be bound to. +type SecurityInsightTrait struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // The type and value of the insight + // + // Types that are valid to be assigned to InsightType: + // + // *SecurityInsightTrait_RiskScore + // *SecurityInsightTrait_Issue + InsightType isSecurityInsightTrait_InsightType `protobuf_oneof:"insight_type"` + // When this insight was observed/captured from the source system + ObservedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=observed_at,json=observedAt,proto3" json:"observed_at,omitempty"` + // The target entity this insight should be bound to + // + // Types that are valid to be assigned to Target: + // + // *SecurityInsightTrait_User + // *SecurityInsightTrait_ResourceId + // *SecurityInsightTrait_ExternalResource + // *SecurityInsightTrait_AppUser + Target isSecurityInsightTrait_Target `protobuf_oneof:"target"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SecurityInsightTrait) Reset() { + *x = SecurityInsightTrait{} + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SecurityInsightTrait) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SecurityInsightTrait) ProtoMessage() {} + +func (x *SecurityInsightTrait) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SecurityInsightTrait) GetInsightType() isSecurityInsightTrait_InsightType { + if x != nil { + return x.InsightType + } + return nil +} + +func (x *SecurityInsightTrait) GetRiskScore() *RiskScore { + if x != nil { + if x, ok := x.InsightType.(*SecurityInsightTrait_RiskScore); ok { + return x.RiskScore + } + } + return nil +} + +func (x *SecurityInsightTrait) GetIssue() *Issue { + if x != nil { + if x, ok := x.InsightType.(*SecurityInsightTrait_Issue); ok { + return x.Issue + } + } + return nil +} + +func (x *SecurityInsightTrait) GetObservedAt() *timestamppb.Timestamp { + if x != nil { + return x.ObservedAt + } + return nil +} + +func (x *SecurityInsightTrait) GetTarget() isSecurityInsightTrait_Target { + if x != nil { + return x.Target + } + return nil +} + +func (x *SecurityInsightTrait) GetUser() *SecurityInsightTrait_UserTarget { + if x != nil { + if x, ok := x.Target.(*SecurityInsightTrait_User); ok { + return x.User + } + } + return nil +} + +func (x *SecurityInsightTrait) GetResourceId() *ResourceId { + if x != nil { + if x, ok := x.Target.(*SecurityInsightTrait_ResourceId); ok { + return x.ResourceId + } + } + return nil +} + +func (x *SecurityInsightTrait) GetExternalResource() *SecurityInsightTrait_ExternalResourceTarget { + if x != nil { + if x, ok := x.Target.(*SecurityInsightTrait_ExternalResource); ok { + return x.ExternalResource + } + } + return nil +} + +func (x *SecurityInsightTrait) GetAppUser() *SecurityInsightTrait_AppUserTarget { + if x != nil { + if x, ok := x.Target.(*SecurityInsightTrait_AppUser); ok { + return x.AppUser + } + } + return nil +} + +func (x *SecurityInsightTrait) SetRiskScore(v *RiskScore) { + if v == nil { + x.InsightType = nil + return + } + x.InsightType = &SecurityInsightTrait_RiskScore{v} +} + +func (x *SecurityInsightTrait) SetIssue(v *Issue) { + if v == nil { + x.InsightType = nil + return + } + x.InsightType = &SecurityInsightTrait_Issue{v} +} + +func (x *SecurityInsightTrait) SetObservedAt(v *timestamppb.Timestamp) { + x.ObservedAt = v +} + +func (x *SecurityInsightTrait) SetUser(v *SecurityInsightTrait_UserTarget) { + if v == nil { + x.Target = nil + return + } + x.Target = &SecurityInsightTrait_User{v} +} + +func (x *SecurityInsightTrait) SetResourceId(v *ResourceId) { + if v == nil { + x.Target = nil + return + } + x.Target = &SecurityInsightTrait_ResourceId{v} +} + +func (x *SecurityInsightTrait) SetExternalResource(v *SecurityInsightTrait_ExternalResourceTarget) { + if v == nil { + x.Target = nil + return + } + x.Target = &SecurityInsightTrait_ExternalResource{v} +} + +func (x *SecurityInsightTrait) SetAppUser(v *SecurityInsightTrait_AppUserTarget) { + if v == nil { + x.Target = nil + return + } + x.Target = &SecurityInsightTrait_AppUser{v} +} + +func (x *SecurityInsightTrait) HasInsightType() bool { + if x == nil { + return false + } + return x.InsightType != nil +} + +func (x *SecurityInsightTrait) HasRiskScore() bool { + if x == nil { + return false + } + _, ok := x.InsightType.(*SecurityInsightTrait_RiskScore) + return ok +} + +func (x *SecurityInsightTrait) HasIssue() bool { + if x == nil { + return false + } + _, ok := x.InsightType.(*SecurityInsightTrait_Issue) + return ok +} + +func (x *SecurityInsightTrait) HasObservedAt() bool { + if x == nil { + return false + } + return x.ObservedAt != nil +} + +func (x *SecurityInsightTrait) HasTarget() bool { + if x == nil { + return false + } + return x.Target != nil +} + +func (x *SecurityInsightTrait) HasUser() bool { + if x == nil { + return false + } + _, ok := x.Target.(*SecurityInsightTrait_User) + return ok +} + +func (x *SecurityInsightTrait) HasResourceId() bool { + if x == nil { + return false + } + _, ok := x.Target.(*SecurityInsightTrait_ResourceId) + return ok +} + +func (x *SecurityInsightTrait) HasExternalResource() bool { + if x == nil { + return false + } + _, ok := x.Target.(*SecurityInsightTrait_ExternalResource) + return ok +} + +func (x *SecurityInsightTrait) HasAppUser() bool { + if x == nil { + return false + } + _, ok := x.Target.(*SecurityInsightTrait_AppUser) + return ok +} + +func (x *SecurityInsightTrait) ClearInsightType() { + x.InsightType = nil +} + +func (x *SecurityInsightTrait) ClearRiskScore() { + if _, ok := x.InsightType.(*SecurityInsightTrait_RiskScore); ok { + x.InsightType = nil + } +} + +func (x *SecurityInsightTrait) ClearIssue() { + if _, ok := x.InsightType.(*SecurityInsightTrait_Issue); ok { + x.InsightType = nil + } +} + +func (x *SecurityInsightTrait) ClearObservedAt() { + x.ObservedAt = nil +} + +func (x *SecurityInsightTrait) ClearTarget() { + x.Target = nil +} + +func (x *SecurityInsightTrait) ClearUser() { + if _, ok := x.Target.(*SecurityInsightTrait_User); ok { + x.Target = nil + } +} + +func (x *SecurityInsightTrait) ClearResourceId() { + if _, ok := x.Target.(*SecurityInsightTrait_ResourceId); ok { + x.Target = nil + } +} + +func (x *SecurityInsightTrait) ClearExternalResource() { + if _, ok := x.Target.(*SecurityInsightTrait_ExternalResource); ok { + x.Target = nil + } +} + +func (x *SecurityInsightTrait) ClearAppUser() { + if _, ok := x.Target.(*SecurityInsightTrait_AppUser); ok { + x.Target = nil + } +} + +const SecurityInsightTrait_InsightType_not_set_case case_SecurityInsightTrait_InsightType = 0 +const SecurityInsightTrait_RiskScore_case case_SecurityInsightTrait_InsightType = 1 +const SecurityInsightTrait_Issue_case case_SecurityInsightTrait_InsightType = 2 + +func (x *SecurityInsightTrait) WhichInsightType() case_SecurityInsightTrait_InsightType { + if x == nil { + return SecurityInsightTrait_InsightType_not_set_case + } + switch x.InsightType.(type) { + case *SecurityInsightTrait_RiskScore: + return SecurityInsightTrait_RiskScore_case + case *SecurityInsightTrait_Issue: + return SecurityInsightTrait_Issue_case + default: + return SecurityInsightTrait_InsightType_not_set_case + } +} + +const SecurityInsightTrait_Target_not_set_case case_SecurityInsightTrait_Target = 0 +const SecurityInsightTrait_User_case case_SecurityInsightTrait_Target = 4 +const SecurityInsightTrait_ResourceId_case case_SecurityInsightTrait_Target = 5 +const SecurityInsightTrait_ExternalResource_case case_SecurityInsightTrait_Target = 6 +const SecurityInsightTrait_AppUser_case case_SecurityInsightTrait_Target = 7 + +func (x *SecurityInsightTrait) WhichTarget() case_SecurityInsightTrait_Target { + if x == nil { + return SecurityInsightTrait_Target_not_set_case + } + switch x.Target.(type) { + case *SecurityInsightTrait_User: + return SecurityInsightTrait_User_case + case *SecurityInsightTrait_ResourceId: + return SecurityInsightTrait_ResourceId_case + case *SecurityInsightTrait_ExternalResource: + return SecurityInsightTrait_ExternalResource_case + case *SecurityInsightTrait_AppUser: + return SecurityInsightTrait_AppUser_case + default: + return SecurityInsightTrait_Target_not_set_case + } +} + +type SecurityInsightTrait_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The type and value of the insight + + // Fields of oneof InsightType: + RiskScore *RiskScore + Issue *Issue + // -- end of InsightType + // When this insight was observed/captured from the source system + ObservedAt *timestamppb.Timestamp + // The target entity this insight should be bound to + + // Fields of oneof Target: + // For binding to a C1 User by email address + User *SecurityInsightTrait_UserTarget + // For direct reference to a resource the connector knows about + ResourceId *ResourceId + // For binding to an AppResource by external ID + ExternalResource *SecurityInsightTrait_ExternalResourceTarget + // For binding to an AppUser by email address + AppUser *SecurityInsightTrait_AppUserTarget + // -- end of Target +} + +func (b0 SecurityInsightTrait_builder) Build() *SecurityInsightTrait { + m0 := &SecurityInsightTrait{} + b, x := &b0, m0 + _, _ = b, x + if b.RiskScore != nil { + x.InsightType = &SecurityInsightTrait_RiskScore{b.RiskScore} + } + if b.Issue != nil { + x.InsightType = &SecurityInsightTrait_Issue{b.Issue} + } + x.ObservedAt = b.ObservedAt + if b.User != nil { + x.Target = &SecurityInsightTrait_User{b.User} + } + if b.ResourceId != nil { + x.Target = &SecurityInsightTrait_ResourceId{b.ResourceId} + } + if b.ExternalResource != nil { + x.Target = &SecurityInsightTrait_ExternalResource{b.ExternalResource} + } + if b.AppUser != nil { + x.Target = &SecurityInsightTrait_AppUser{b.AppUser} + } + return m0 +} + +type case_SecurityInsightTrait_InsightType protoreflect.FieldNumber + +func (x case_SecurityInsightTrait_InsightType) String() string { + md := file_c1_connector_v2_annotation_security_insight_proto_msgTypes[2].Descriptor() + if x == 0 { + return "not set" + } + return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x)) +} + +type case_SecurityInsightTrait_Target protoreflect.FieldNumber + +func (x case_SecurityInsightTrait_Target) String() string { + md := file_c1_connector_v2_annotation_security_insight_proto_msgTypes[2].Descriptor() + if x == 0 { + return "not set" + } + return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x)) +} + +type isSecurityInsightTrait_InsightType interface { + isSecurityInsightTrait_InsightType() +} + +type SecurityInsightTrait_RiskScore struct { + RiskScore *RiskScore `protobuf:"bytes,1,opt,name=risk_score,json=riskScore,proto3,oneof"` +} + +type SecurityInsightTrait_Issue struct { + Issue *Issue `protobuf:"bytes,2,opt,name=issue,proto3,oneof"` +} + +func (*SecurityInsightTrait_RiskScore) isSecurityInsightTrait_InsightType() {} + +func (*SecurityInsightTrait_Issue) isSecurityInsightTrait_InsightType() {} + +type isSecurityInsightTrait_Target interface { + isSecurityInsightTrait_Target() +} + +type SecurityInsightTrait_User struct { + // For binding to a C1 User by email address + User *SecurityInsightTrait_UserTarget `protobuf:"bytes,4,opt,name=user,proto3,oneof"` +} + +type SecurityInsightTrait_ResourceId struct { + // For direct reference to a resource the connector knows about + ResourceId *ResourceId `protobuf:"bytes,5,opt,name=resource_id,json=resourceId,proto3,oneof"` +} + +type SecurityInsightTrait_ExternalResource struct { + // For binding to an AppResource by external ID + ExternalResource *SecurityInsightTrait_ExternalResourceTarget `protobuf:"bytes,6,opt,name=external_resource,json=externalResource,proto3,oneof"` +} + +type SecurityInsightTrait_AppUser struct { + // For binding to an AppUser by email address + AppUser *SecurityInsightTrait_AppUserTarget `protobuf:"bytes,7,opt,name=app_user,json=appUser,proto3,oneof"` +} + +func (*SecurityInsightTrait_User) isSecurityInsightTrait_Target() {} + +func (*SecurityInsightTrait_ResourceId) isSecurityInsightTrait_Target() {} + +func (*SecurityInsightTrait_ExternalResource) isSecurityInsightTrait_Target() {} + +func (*SecurityInsightTrait_AppUser) isSecurityInsightTrait_Target() {} + +// UserTarget identifies a user by email for resolution to a C1 User +type SecurityInsightTrait_UserTarget struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SecurityInsightTrait_UserTarget) Reset() { + *x = SecurityInsightTrait_UserTarget{} + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SecurityInsightTrait_UserTarget) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SecurityInsightTrait_UserTarget) ProtoMessage() {} + +func (x *SecurityInsightTrait_UserTarget) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SecurityInsightTrait_UserTarget) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *SecurityInsightTrait_UserTarget) SetEmail(v string) { + x.Email = v +} + +type SecurityInsightTrait_UserTarget_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Email string +} + +func (b0 SecurityInsightTrait_UserTarget_builder) Build() *SecurityInsightTrait_UserTarget { + m0 := &SecurityInsightTrait_UserTarget{} + b, x := &b0, m0 + _, _ = b, x + x.Email = b.Email + return m0 +} + +// AppUserTarget identifies a user by email for resolution to an AppUser. +type SecurityInsightTrait_AppUserTarget struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` + // The external identifier of the user (e.g., ID, GUID, etc.) + ExternalId string `protobuf:"bytes,2,opt,name=external_id,json=externalId,proto3" json:"external_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SecurityInsightTrait_AppUserTarget) Reset() { + *x = SecurityInsightTrait_AppUserTarget{} + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SecurityInsightTrait_AppUserTarget) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SecurityInsightTrait_AppUserTarget) ProtoMessage() {} + +func (x *SecurityInsightTrait_AppUserTarget) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SecurityInsightTrait_AppUserTarget) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *SecurityInsightTrait_AppUserTarget) GetExternalId() string { + if x != nil { + return x.ExternalId + } + return "" +} + +func (x *SecurityInsightTrait_AppUserTarget) SetEmail(v string) { + x.Email = v +} + +func (x *SecurityInsightTrait_AppUserTarget) SetExternalId(v string) { + x.ExternalId = v +} + +type SecurityInsightTrait_AppUserTarget_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Email string + // The external identifier of the user (e.g., ID, GUID, etc.) + ExternalId string +} + +func (b0 SecurityInsightTrait_AppUserTarget_builder) Build() *SecurityInsightTrait_AppUserTarget { + m0 := &SecurityInsightTrait_AppUserTarget{} + b, x := &b0, m0 + _, _ = b, x + x.Email = b.Email + x.ExternalId = b.ExternalId + return m0 +} + +// ExternalResourceTarget identifies a resource by external ID for resolution to an AppResource. +// Use this when the connector doesn't sync the target resource itself. +type SecurityInsightTrait_ExternalResourceTarget struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + // The external identifier of the resource (e.g., ARN, GUID, etc.) + ExternalId string `protobuf:"bytes,1,opt,name=external_id,json=externalId,proto3" json:"external_id,omitempty"` + // Optional hint to help find the owning app (e.g., "aws", "github") + AppHint string `protobuf:"bytes,2,opt,name=app_hint,json=appHint,proto3" json:"app_hint,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SecurityInsightTrait_ExternalResourceTarget) Reset() { + *x = SecurityInsightTrait_ExternalResourceTarget{} + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SecurityInsightTrait_ExternalResourceTarget) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SecurityInsightTrait_ExternalResourceTarget) ProtoMessage() {} + +func (x *SecurityInsightTrait_ExternalResourceTarget) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SecurityInsightTrait_ExternalResourceTarget) GetExternalId() string { + if x != nil { + return x.ExternalId + } + return "" +} + +func (x *SecurityInsightTrait_ExternalResourceTarget) GetAppHint() string { + if x != nil { + return x.AppHint + } + return "" +} + +func (x *SecurityInsightTrait_ExternalResourceTarget) SetExternalId(v string) { + x.ExternalId = v +} + +func (x *SecurityInsightTrait_ExternalResourceTarget) SetAppHint(v string) { + x.AppHint = v +} + +type SecurityInsightTrait_ExternalResourceTarget_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The external identifier of the resource (e.g., ARN, GUID, etc.) + ExternalId string + // Optional hint to help find the owning app (e.g., "aws", "github") + AppHint string +} + +func (b0 SecurityInsightTrait_ExternalResourceTarget_builder) Build() *SecurityInsightTrait_ExternalResourceTarget { + m0 := &SecurityInsightTrait_ExternalResourceTarget{} + b, x := &b0, m0 + _, _ = b, x + x.ExternalId = b.ExternalId + x.AppHint = b.AppHint + return m0 +} + +var File_c1_connector_v2_annotation_security_insight_proto protoreflect.FileDescriptor + +const file_c1_connector_v2_annotation_security_insight_proto_rawDesc = "" + + "\n" + + "1c1/connector/v2/annotation_security_insight.proto\x12\x0fc1.connector.v2\x1a\x1ec1/connector/v2/resource.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17validate/validate.proto\"!\n" + + "\tRiskScore\x12\x14\n" + + "\x05value\x18\x01 \x01(\tR\x05value\"E\n" + + "\x05Issue\x12\x14\n" + + "\x05value\x18\x01 \x01(\tR\x05value\x12&\n" + + "\bseverity\x18\x02 \x01(\tB\n" + + "\xfaB\ar\x05 \x00(\x80\bR\bseverity\"\xae\x06\n" + + "\x14SecurityInsightTrait\x12;\n" + + "\n" + + "risk_score\x18\x01 \x01(\v2\x1a.c1.connector.v2.RiskScoreH\x00R\triskScore\x12.\n" + + "\x05issue\x18\x02 \x01(\v2\x16.c1.connector.v2.IssueH\x00R\x05issue\x12;\n" + + "\vobserved_at\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\n" + + "observedAt\x12F\n" + + "\x04user\x18\x04 \x01(\v20.c1.connector.v2.SecurityInsightTrait.UserTargetH\x01R\x04user\x12>\n" + + "\vresource_id\x18\x05 \x01(\v2\x1b.c1.connector.v2.ResourceIdH\x01R\n" + + "resourceId\x12k\n" + + "\x11external_resource\x18\x06 \x01(\v2<.c1.connector.v2.SecurityInsightTrait.ExternalResourceTargetH\x01R\x10externalResource\x12P\n" + + "\bapp_user\x18\a \x01(\v23.c1.connector.v2.SecurityInsightTrait.AppUserTargetH\x01R\aappUser\x1a0\n" + + "\n" + + "UserTarget\x12\"\n" + + "\x05email\x18\x01 \x01(\tB\f\xfaB\tr\a \x01(\x80\b`\x01R\x05email\x1a`\n" + + "\rAppUserTarget\x12\"\n" + + "\x05email\x18\x01 \x01(\tB\f\xfaB\tr\a \x01(\x80\b`\x01R\x05email\x12+\n" + + "\vexternal_id\x18\x02 \x01(\tB\n" + + "\xfaB\ar\x05 \x01(\x80 R\n" + + "externalId\x1am\n" + + "\x16ExternalResourceTarget\x12+\n" + + "\vexternal_id\x18\x01 \x01(\tB\n" + + "\xfaB\ar\x05 \x01(\x80 R\n" + + "externalId\x12&\n" + + "\bapp_hint\x18\x02 \x01(\tB\v\xfaB\br\x06(\x80\b\xd0\x01\x01R\aappHintB\x13\n" + + "\finsight_type\x12\x03\xf8B\x01B\r\n" + + "\x06target\x12\x03\xf8B\x01B6Z4github.com/conductorone/baton-sdk/pb/c1/connector/v2b\x06proto3" + +var file_c1_connector_v2_annotation_security_insight_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_c1_connector_v2_annotation_security_insight_proto_goTypes = []any{ + (*RiskScore)(nil), // 0: c1.connector.v2.RiskScore + (*Issue)(nil), // 1: c1.connector.v2.Issue + (*SecurityInsightTrait)(nil), // 2: c1.connector.v2.SecurityInsightTrait + (*SecurityInsightTrait_UserTarget)(nil), // 3: c1.connector.v2.SecurityInsightTrait.UserTarget + (*SecurityInsightTrait_AppUserTarget)(nil), // 4: c1.connector.v2.SecurityInsightTrait.AppUserTarget + (*SecurityInsightTrait_ExternalResourceTarget)(nil), // 5: c1.connector.v2.SecurityInsightTrait.ExternalResourceTarget + (*timestamppb.Timestamp)(nil), // 6: google.protobuf.Timestamp + (*ResourceId)(nil), // 7: c1.connector.v2.ResourceId +} +var file_c1_connector_v2_annotation_security_insight_proto_depIdxs = []int32{ + 0, // 0: c1.connector.v2.SecurityInsightTrait.risk_score:type_name -> c1.connector.v2.RiskScore + 1, // 1: c1.connector.v2.SecurityInsightTrait.issue:type_name -> c1.connector.v2.Issue + 6, // 2: c1.connector.v2.SecurityInsightTrait.observed_at:type_name -> google.protobuf.Timestamp + 3, // 3: c1.connector.v2.SecurityInsightTrait.user:type_name -> c1.connector.v2.SecurityInsightTrait.UserTarget + 7, // 4: c1.connector.v2.SecurityInsightTrait.resource_id:type_name -> c1.connector.v2.ResourceId + 5, // 5: c1.connector.v2.SecurityInsightTrait.external_resource:type_name -> c1.connector.v2.SecurityInsightTrait.ExternalResourceTarget + 4, // 6: c1.connector.v2.SecurityInsightTrait.app_user:type_name -> c1.connector.v2.SecurityInsightTrait.AppUserTarget + 7, // [7:7] is the sub-list for method output_type + 7, // [7:7] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_c1_connector_v2_annotation_security_insight_proto_init() } +func file_c1_connector_v2_annotation_security_insight_proto_init() { + if File_c1_connector_v2_annotation_security_insight_proto != nil { + return + } + file_c1_connector_v2_resource_proto_init() + file_c1_connector_v2_annotation_security_insight_proto_msgTypes[2].OneofWrappers = []any{ + (*SecurityInsightTrait_RiskScore)(nil), + (*SecurityInsightTrait_Issue)(nil), + (*SecurityInsightTrait_User)(nil), + (*SecurityInsightTrait_ResourceId)(nil), + (*SecurityInsightTrait_ExternalResource)(nil), + (*SecurityInsightTrait_AppUser)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_c1_connector_v2_annotation_security_insight_proto_rawDesc), len(file_c1_connector_v2_annotation_security_insight_proto_rawDesc)), + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_c1_connector_v2_annotation_security_insight_proto_goTypes, + DependencyIndexes: file_c1_connector_v2_annotation_security_insight_proto_depIdxs, + MessageInfos: file_c1_connector_v2_annotation_security_insight_proto_msgTypes, + }.Build() + File_c1_connector_v2_annotation_security_insight_proto = out.File + file_c1_connector_v2_annotation_security_insight_proto_goTypes = nil + file_c1_connector_v2_annotation_security_insight_proto_depIdxs = nil +} diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_security_insight.pb.validate.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_security_insight.pb.validate.go new file mode 100644 index 00000000..6b83aee6 --- /dev/null +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_security_insight.pb.validate.go @@ -0,0 +1,1159 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: c1/connector/v2/annotation_security_insight.proto + +package v2 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "google.golang.org/protobuf/types/known/anypb" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = anypb.Any{} + _ = sort.Sort +) + +// Validate checks the field values on RiskScore with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *RiskScore) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on RiskScore with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in RiskScoreMultiError, or nil +// if none found. +func (m *RiskScore) ValidateAll() error { + return m.validate(true) +} + +func (m *RiskScore) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Value + + if len(errors) > 0 { + return RiskScoreMultiError(errors) + } + + return nil +} + +// RiskScoreMultiError is an error wrapping multiple validation errors returned +// by RiskScore.ValidateAll() if the designated constraints aren't met. +type RiskScoreMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m RiskScoreMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m RiskScoreMultiError) AllErrors() []error { return m } + +// RiskScoreValidationError is the validation error returned by +// RiskScore.Validate if the designated constraints aren't met. +type RiskScoreValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e RiskScoreValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e RiskScoreValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e RiskScoreValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e RiskScoreValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e RiskScoreValidationError) ErrorName() string { return "RiskScoreValidationError" } + +// Error satisfies the builtin error interface +func (e RiskScoreValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRiskScore.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = RiskScoreValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = RiskScoreValidationError{} + +// Validate checks the field values on Issue with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *Issue) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Issue with the rules defined in the +// proto definition for this message. If any rules are violated, the result is +// a list of violation errors wrapped in IssueMultiError, or nil if none found. +func (m *Issue) ValidateAll() error { + return m.validate(true) +} + +func (m *Issue) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Value + + if l := len(m.GetSeverity()); l < 0 || l > 1024 { + err := IssueValidationError{ + field: "Severity", + reason: "value length must be between 0 and 1024 bytes, inclusive", + } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return IssueMultiError(errors) + } + + return nil +} + +// IssueMultiError is an error wrapping multiple validation errors returned by +// Issue.ValidateAll() if the designated constraints aren't met. +type IssueMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m IssueMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m IssueMultiError) AllErrors() []error { return m } + +// IssueValidationError is the validation error returned by Issue.Validate if +// the designated constraints aren't met. +type IssueValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e IssueValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e IssueValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e IssueValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e IssueValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e IssueValidationError) ErrorName() string { return "IssueValidationError" } + +// Error satisfies the builtin error interface +func (e IssueValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sIssue.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = IssueValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = IssueValidationError{} + +// Validate checks the field values on SecurityInsightTrait with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *SecurityInsightTrait) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on SecurityInsightTrait with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// SecurityInsightTraitMultiError, or nil if none found. +func (m *SecurityInsightTrait) ValidateAll() error { + return m.validate(true) +} + +func (m *SecurityInsightTrait) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetObservedAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SecurityInsightTraitValidationError{ + field: "ObservedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SecurityInsightTraitValidationError{ + field: "ObservedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetObservedAt()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return SecurityInsightTraitValidationError{ + field: "ObservedAt", + reason: "embedded message failed validation", + cause: err, + } + } + } + + oneofInsightTypePresent := false + switch v := m.InsightType.(type) { + case *SecurityInsightTrait_RiskScore: + if v == nil { + err := SecurityInsightTraitValidationError{ + field: "InsightType", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + oneofInsightTypePresent = true + + if all { + switch v := interface{}(m.GetRiskScore()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SecurityInsightTraitValidationError{ + field: "RiskScore", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SecurityInsightTraitValidationError{ + field: "RiskScore", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetRiskScore()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return SecurityInsightTraitValidationError{ + field: "RiskScore", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *SecurityInsightTrait_Issue: + if v == nil { + err := SecurityInsightTraitValidationError{ + field: "InsightType", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + oneofInsightTypePresent = true + + if all { + switch v := interface{}(m.GetIssue()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SecurityInsightTraitValidationError{ + field: "Issue", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SecurityInsightTraitValidationError{ + field: "Issue", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetIssue()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return SecurityInsightTraitValidationError{ + field: "Issue", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + _ = v // ensures v is used + } + if !oneofInsightTypePresent { + err := SecurityInsightTraitValidationError{ + field: "InsightType", + reason: "value is required", + } + if !all { + return err + } + errors = append(errors, err) + } + oneofTargetPresent := false + switch v := m.Target.(type) { + case *SecurityInsightTrait_User: + if v == nil { + err := SecurityInsightTraitValidationError{ + field: "Target", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + oneofTargetPresent = true + + if all { + switch v := interface{}(m.GetUser()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SecurityInsightTraitValidationError{ + field: "User", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SecurityInsightTraitValidationError{ + field: "User", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUser()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return SecurityInsightTraitValidationError{ + field: "User", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *SecurityInsightTrait_ResourceId: + if v == nil { + err := SecurityInsightTraitValidationError{ + field: "Target", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + oneofTargetPresent = true + + if all { + switch v := interface{}(m.GetResourceId()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SecurityInsightTraitValidationError{ + field: "ResourceId", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SecurityInsightTraitValidationError{ + field: "ResourceId", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetResourceId()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return SecurityInsightTraitValidationError{ + field: "ResourceId", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *SecurityInsightTrait_ExternalResource: + if v == nil { + err := SecurityInsightTraitValidationError{ + field: "Target", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + oneofTargetPresent = true + + if all { + switch v := interface{}(m.GetExternalResource()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SecurityInsightTraitValidationError{ + field: "ExternalResource", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SecurityInsightTraitValidationError{ + field: "ExternalResource", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetExternalResource()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return SecurityInsightTraitValidationError{ + field: "ExternalResource", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *SecurityInsightTrait_AppUser: + if v == nil { + err := SecurityInsightTraitValidationError{ + field: "Target", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + oneofTargetPresent = true + + if all { + switch v := interface{}(m.GetAppUser()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SecurityInsightTraitValidationError{ + field: "AppUser", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SecurityInsightTraitValidationError{ + field: "AppUser", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetAppUser()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return SecurityInsightTraitValidationError{ + field: "AppUser", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + _ = v // ensures v is used + } + if !oneofTargetPresent { + err := SecurityInsightTraitValidationError{ + field: "Target", + reason: "value is required", + } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return SecurityInsightTraitMultiError(errors) + } + + return nil +} + +// SecurityInsightTraitMultiError is an error wrapping multiple validation +// errors returned by SecurityInsightTrait.ValidateAll() if the designated +// constraints aren't met. +type SecurityInsightTraitMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m SecurityInsightTraitMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m SecurityInsightTraitMultiError) AllErrors() []error { return m } + +// SecurityInsightTraitValidationError is the validation error returned by +// SecurityInsightTrait.Validate if the designated constraints aren't met. +type SecurityInsightTraitValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SecurityInsightTraitValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SecurityInsightTraitValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SecurityInsightTraitValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SecurityInsightTraitValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SecurityInsightTraitValidationError) ErrorName() string { + return "SecurityInsightTraitValidationError" +} + +// Error satisfies the builtin error interface +func (e SecurityInsightTraitValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sSecurityInsightTrait.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SecurityInsightTraitValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SecurityInsightTraitValidationError{} + +// Validate checks the field values on SecurityInsightTrait_UserTarget with the +// rules defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *SecurityInsightTrait_UserTarget) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on SecurityInsightTrait_UserTarget with +// the rules defined in the proto definition for this message. If any rules +// are violated, the result is a list of violation errors wrapped in +// SecurityInsightTrait_UserTargetMultiError, or nil if none found. +func (m *SecurityInsightTrait_UserTarget) ValidateAll() error { + return m.validate(true) +} + +func (m *SecurityInsightTrait_UserTarget) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if l := len(m.GetEmail()); l < 1 || l > 1024 { + err := SecurityInsightTrait_UserTargetValidationError{ + field: "Email", + reason: "value length must be between 1 and 1024 bytes, inclusive", + } + if !all { + return err + } + errors = append(errors, err) + } + + if err := m._validateEmail(m.GetEmail()); err != nil { + err = SecurityInsightTrait_UserTargetValidationError{ + field: "Email", + reason: "value must be a valid email address", + cause: err, + } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return SecurityInsightTrait_UserTargetMultiError(errors) + } + + return nil +} + +func (m *SecurityInsightTrait_UserTarget) _validateHostname(host string) error { + s := strings.ToLower(strings.TrimSuffix(host, ".")) + + if len(host) > 253 { + return errors.New("hostname cannot exceed 253 characters") + } + + for _, part := range strings.Split(s, ".") { + if l := len(part); l == 0 || l > 63 { + return errors.New("hostname part must be non-empty and cannot exceed 63 characters") + } + + if part[0] == '-' { + return errors.New("hostname parts cannot begin with hyphens") + } + + if part[len(part)-1] == '-' { + return errors.New("hostname parts cannot end with hyphens") + } + + for _, r := range part { + if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { + return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) + } + } + } + + return nil +} + +func (m *SecurityInsightTrait_UserTarget) _validateEmail(addr string) error { + a, err := mail.ParseAddress(addr) + if err != nil { + return err + } + addr = a.Address + + if len(addr) > 254 { + return errors.New("email addresses cannot exceed 254 characters") + } + + parts := strings.SplitN(addr, "@", 2) + + if len(parts[0]) > 64 { + return errors.New("email address local phrase cannot exceed 64 characters") + } + + return m._validateHostname(parts[1]) +} + +// SecurityInsightTrait_UserTargetMultiError is an error wrapping multiple +// validation errors returned by SecurityInsightTrait_UserTarget.ValidateAll() +// if the designated constraints aren't met. +type SecurityInsightTrait_UserTargetMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m SecurityInsightTrait_UserTargetMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m SecurityInsightTrait_UserTargetMultiError) AllErrors() []error { return m } + +// SecurityInsightTrait_UserTargetValidationError is the validation error +// returned by SecurityInsightTrait_UserTarget.Validate if the designated +// constraints aren't met. +type SecurityInsightTrait_UserTargetValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SecurityInsightTrait_UserTargetValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SecurityInsightTrait_UserTargetValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SecurityInsightTrait_UserTargetValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SecurityInsightTrait_UserTargetValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SecurityInsightTrait_UserTargetValidationError) ErrorName() string { + return "SecurityInsightTrait_UserTargetValidationError" +} + +// Error satisfies the builtin error interface +func (e SecurityInsightTrait_UserTargetValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sSecurityInsightTrait_UserTarget.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SecurityInsightTrait_UserTargetValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SecurityInsightTrait_UserTargetValidationError{} + +// Validate checks the field values on SecurityInsightTrait_AppUserTarget with +// the rules defined in the proto definition for this message. If any rules +// are violated, the first error encountered is returned, or nil if there are +// no violations. +func (m *SecurityInsightTrait_AppUserTarget) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on SecurityInsightTrait_AppUserTarget +// with the rules defined in the proto definition for this message. If any +// rules are violated, the result is a list of violation errors wrapped in +// SecurityInsightTrait_AppUserTargetMultiError, or nil if none found. +func (m *SecurityInsightTrait_AppUserTarget) ValidateAll() error { + return m.validate(true) +} + +func (m *SecurityInsightTrait_AppUserTarget) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if l := len(m.GetEmail()); l < 1 || l > 1024 { + err := SecurityInsightTrait_AppUserTargetValidationError{ + field: "Email", + reason: "value length must be between 1 and 1024 bytes, inclusive", + } + if !all { + return err + } + errors = append(errors, err) + } + + if err := m._validateEmail(m.GetEmail()); err != nil { + err = SecurityInsightTrait_AppUserTargetValidationError{ + field: "Email", + reason: "value must be a valid email address", + cause: err, + } + if !all { + return err + } + errors = append(errors, err) + } + + if l := len(m.GetExternalId()); l < 1 || l > 4096 { + err := SecurityInsightTrait_AppUserTargetValidationError{ + field: "ExternalId", + reason: "value length must be between 1 and 4096 bytes, inclusive", + } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return SecurityInsightTrait_AppUserTargetMultiError(errors) + } + + return nil +} + +func (m *SecurityInsightTrait_AppUserTarget) _validateHostname(host string) error { + s := strings.ToLower(strings.TrimSuffix(host, ".")) + + if len(host) > 253 { + return errors.New("hostname cannot exceed 253 characters") + } + + for _, part := range strings.Split(s, ".") { + if l := len(part); l == 0 || l > 63 { + return errors.New("hostname part must be non-empty and cannot exceed 63 characters") + } + + if part[0] == '-' { + return errors.New("hostname parts cannot begin with hyphens") + } + + if part[len(part)-1] == '-' { + return errors.New("hostname parts cannot end with hyphens") + } + + for _, r := range part { + if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { + return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) + } + } + } + + return nil +} + +func (m *SecurityInsightTrait_AppUserTarget) _validateEmail(addr string) error { + a, err := mail.ParseAddress(addr) + if err != nil { + return err + } + addr = a.Address + + if len(addr) > 254 { + return errors.New("email addresses cannot exceed 254 characters") + } + + parts := strings.SplitN(addr, "@", 2) + + if len(parts[0]) > 64 { + return errors.New("email address local phrase cannot exceed 64 characters") + } + + return m._validateHostname(parts[1]) +} + +// SecurityInsightTrait_AppUserTargetMultiError is an error wrapping multiple +// validation errors returned by +// SecurityInsightTrait_AppUserTarget.ValidateAll() if the designated +// constraints aren't met. +type SecurityInsightTrait_AppUserTargetMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m SecurityInsightTrait_AppUserTargetMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m SecurityInsightTrait_AppUserTargetMultiError) AllErrors() []error { return m } + +// SecurityInsightTrait_AppUserTargetValidationError is the validation error +// returned by SecurityInsightTrait_AppUserTarget.Validate if the designated +// constraints aren't met. +type SecurityInsightTrait_AppUserTargetValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SecurityInsightTrait_AppUserTargetValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SecurityInsightTrait_AppUserTargetValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SecurityInsightTrait_AppUserTargetValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SecurityInsightTrait_AppUserTargetValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SecurityInsightTrait_AppUserTargetValidationError) ErrorName() string { + return "SecurityInsightTrait_AppUserTargetValidationError" +} + +// Error satisfies the builtin error interface +func (e SecurityInsightTrait_AppUserTargetValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sSecurityInsightTrait_AppUserTarget.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SecurityInsightTrait_AppUserTargetValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SecurityInsightTrait_AppUserTargetValidationError{} + +// Validate checks the field values on +// SecurityInsightTrait_ExternalResourceTarget with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *SecurityInsightTrait_ExternalResourceTarget) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on +// SecurityInsightTrait_ExternalResourceTarget with the rules defined in the +// proto definition for this message. If any rules are violated, the result is +// a list of violation errors wrapped in +// SecurityInsightTrait_ExternalResourceTargetMultiError, or nil if none found. +func (m *SecurityInsightTrait_ExternalResourceTarget) ValidateAll() error { + return m.validate(true) +} + +func (m *SecurityInsightTrait_ExternalResourceTarget) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if l := len(m.GetExternalId()); l < 1 || l > 4096 { + err := SecurityInsightTrait_ExternalResourceTargetValidationError{ + field: "ExternalId", + reason: "value length must be between 1 and 4096 bytes, inclusive", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetAppHint() != "" { + + if len(m.GetAppHint()) > 1024 { + err := SecurityInsightTrait_ExternalResourceTargetValidationError{ + field: "AppHint", + reason: "value length must be at most 1024 bytes", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if len(errors) > 0 { + return SecurityInsightTrait_ExternalResourceTargetMultiError(errors) + } + + return nil +} + +// SecurityInsightTrait_ExternalResourceTargetMultiError is an error wrapping +// multiple validation errors returned by +// SecurityInsightTrait_ExternalResourceTarget.ValidateAll() if the designated +// constraints aren't met. +type SecurityInsightTrait_ExternalResourceTargetMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m SecurityInsightTrait_ExternalResourceTargetMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m SecurityInsightTrait_ExternalResourceTargetMultiError) AllErrors() []error { return m } + +// SecurityInsightTrait_ExternalResourceTargetValidationError is the validation +// error returned by SecurityInsightTrait_ExternalResourceTarget.Validate if +// the designated constraints aren't met. +type SecurityInsightTrait_ExternalResourceTargetValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SecurityInsightTrait_ExternalResourceTargetValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SecurityInsightTrait_ExternalResourceTargetValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SecurityInsightTrait_ExternalResourceTargetValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SecurityInsightTrait_ExternalResourceTargetValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SecurityInsightTrait_ExternalResourceTargetValidationError) ErrorName() string { + return "SecurityInsightTrait_ExternalResourceTargetValidationError" +} + +// Error satisfies the builtin error interface +func (e SecurityInsightTrait_ExternalResourceTargetValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sSecurityInsightTrait_ExternalResourceTarget.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SecurityInsightTrait_ExternalResourceTargetValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SecurityInsightTrait_ExternalResourceTargetValidationError{} diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_security_insight_protoopaque.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_security_insight_protoopaque.pb.go new file mode 100644 index 00000000..394575c8 --- /dev/null +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_security_insight_protoopaque.pb.go @@ -0,0 +1,888 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc (unknown) +// source: c1/connector/v2/annotation_security_insight.proto + +//go:build protoopaque + +package v2 + +import ( + _ "github.com/envoyproxy/protoc-gen-validate/validate" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// RiskScore represents a risk score insight +type RiskScore struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Value string `protobuf:"bytes,1,opt,name=value,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RiskScore) Reset() { + *x = RiskScore{} + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RiskScore) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RiskScore) ProtoMessage() {} + +func (x *RiskScore) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RiskScore) GetValue() string { + if x != nil { + return x.xxx_hidden_Value + } + return "" +} + +func (x *RiskScore) SetValue(v string) { + x.xxx_hidden_Value = v +} + +type RiskScore_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The risk score value (e.g., "85", "High") + Value string +} + +func (b0 RiskScore_builder) Build() *RiskScore { + m0 := &RiskScore{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Value = b.Value + return m0 +} + +// Issue represents a security issue or vulnerability +type Issue struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Value string `protobuf:"bytes,1,opt,name=value,proto3"` + xxx_hidden_Severity string `protobuf:"bytes,2,opt,name=severity,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Issue) Reset() { + *x = Issue{} + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Issue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Issue) ProtoMessage() {} + +func (x *Issue) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Issue) GetValue() string { + if x != nil { + return x.xxx_hidden_Value + } + return "" +} + +func (x *Issue) GetSeverity() string { + if x != nil { + return x.xxx_hidden_Severity + } + return "" +} + +func (x *Issue) SetValue(v string) { + x.xxx_hidden_Value = v +} + +func (x *Issue) SetSeverity(v string) { + x.xxx_hidden_Severity = v +} + +type Issue_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The issue description or severity (e.g., "Critical", "CVE-2024-1234") + Value string + Severity string +} + +func (b0 Issue_builder) Build() *Issue { + m0 := &Issue{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Value = b.Value + x.xxx_hidden_Severity = b.Severity + return m0 +} + +// SecurityInsightTrait is the trait annotation for resources with TRAIT_SECURITY_INSIGHT. +// It contains the metadata for the security insight including type, value, observation time, +// and the target entity (user or resource) that this insight should be bound to. +type SecurityInsightTrait struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_InsightType isSecurityInsightTrait_InsightType `protobuf_oneof:"insight_type"` + xxx_hidden_ObservedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=observed_at,json=observedAt,proto3"` + xxx_hidden_Target isSecurityInsightTrait_Target `protobuf_oneof:"target"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SecurityInsightTrait) Reset() { + *x = SecurityInsightTrait{} + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SecurityInsightTrait) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SecurityInsightTrait) ProtoMessage() {} + +func (x *SecurityInsightTrait) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SecurityInsightTrait) GetRiskScore() *RiskScore { + if x != nil { + if x, ok := x.xxx_hidden_InsightType.(*securityInsightTrait_RiskScore); ok { + return x.RiskScore + } + } + return nil +} + +func (x *SecurityInsightTrait) GetIssue() *Issue { + if x != nil { + if x, ok := x.xxx_hidden_InsightType.(*securityInsightTrait_Issue); ok { + return x.Issue + } + } + return nil +} + +func (x *SecurityInsightTrait) GetObservedAt() *timestamppb.Timestamp { + if x != nil { + return x.xxx_hidden_ObservedAt + } + return nil +} + +func (x *SecurityInsightTrait) GetUser() *SecurityInsightTrait_UserTarget { + if x != nil { + if x, ok := x.xxx_hidden_Target.(*securityInsightTrait_User); ok { + return x.User + } + } + return nil +} + +func (x *SecurityInsightTrait) GetResourceId() *ResourceId { + if x != nil { + if x, ok := x.xxx_hidden_Target.(*securityInsightTrait_ResourceId); ok { + return x.ResourceId + } + } + return nil +} + +func (x *SecurityInsightTrait) GetExternalResource() *SecurityInsightTrait_ExternalResourceTarget { + if x != nil { + if x, ok := x.xxx_hidden_Target.(*securityInsightTrait_ExternalResource); ok { + return x.ExternalResource + } + } + return nil +} + +func (x *SecurityInsightTrait) GetAppUser() *SecurityInsightTrait_AppUserTarget { + if x != nil { + if x, ok := x.xxx_hidden_Target.(*securityInsightTrait_AppUser); ok { + return x.AppUser + } + } + return nil +} + +func (x *SecurityInsightTrait) SetRiskScore(v *RiskScore) { + if v == nil { + x.xxx_hidden_InsightType = nil + return + } + x.xxx_hidden_InsightType = &securityInsightTrait_RiskScore{v} +} + +func (x *SecurityInsightTrait) SetIssue(v *Issue) { + if v == nil { + x.xxx_hidden_InsightType = nil + return + } + x.xxx_hidden_InsightType = &securityInsightTrait_Issue{v} +} + +func (x *SecurityInsightTrait) SetObservedAt(v *timestamppb.Timestamp) { + x.xxx_hidden_ObservedAt = v +} + +func (x *SecurityInsightTrait) SetUser(v *SecurityInsightTrait_UserTarget) { + if v == nil { + x.xxx_hidden_Target = nil + return + } + x.xxx_hidden_Target = &securityInsightTrait_User{v} +} + +func (x *SecurityInsightTrait) SetResourceId(v *ResourceId) { + if v == nil { + x.xxx_hidden_Target = nil + return + } + x.xxx_hidden_Target = &securityInsightTrait_ResourceId{v} +} + +func (x *SecurityInsightTrait) SetExternalResource(v *SecurityInsightTrait_ExternalResourceTarget) { + if v == nil { + x.xxx_hidden_Target = nil + return + } + x.xxx_hidden_Target = &securityInsightTrait_ExternalResource{v} +} + +func (x *SecurityInsightTrait) SetAppUser(v *SecurityInsightTrait_AppUserTarget) { + if v == nil { + x.xxx_hidden_Target = nil + return + } + x.xxx_hidden_Target = &securityInsightTrait_AppUser{v} +} + +func (x *SecurityInsightTrait) HasInsightType() bool { + if x == nil { + return false + } + return x.xxx_hidden_InsightType != nil +} + +func (x *SecurityInsightTrait) HasRiskScore() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_InsightType.(*securityInsightTrait_RiskScore) + return ok +} + +func (x *SecurityInsightTrait) HasIssue() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_InsightType.(*securityInsightTrait_Issue) + return ok +} + +func (x *SecurityInsightTrait) HasObservedAt() bool { + if x == nil { + return false + } + return x.xxx_hidden_ObservedAt != nil +} + +func (x *SecurityInsightTrait) HasTarget() bool { + if x == nil { + return false + } + return x.xxx_hidden_Target != nil +} + +func (x *SecurityInsightTrait) HasUser() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Target.(*securityInsightTrait_User) + return ok +} + +func (x *SecurityInsightTrait) HasResourceId() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Target.(*securityInsightTrait_ResourceId) + return ok +} + +func (x *SecurityInsightTrait) HasExternalResource() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Target.(*securityInsightTrait_ExternalResource) + return ok +} + +func (x *SecurityInsightTrait) HasAppUser() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Target.(*securityInsightTrait_AppUser) + return ok +} + +func (x *SecurityInsightTrait) ClearInsightType() { + x.xxx_hidden_InsightType = nil +} + +func (x *SecurityInsightTrait) ClearRiskScore() { + if _, ok := x.xxx_hidden_InsightType.(*securityInsightTrait_RiskScore); ok { + x.xxx_hidden_InsightType = nil + } +} + +func (x *SecurityInsightTrait) ClearIssue() { + if _, ok := x.xxx_hidden_InsightType.(*securityInsightTrait_Issue); ok { + x.xxx_hidden_InsightType = nil + } +} + +func (x *SecurityInsightTrait) ClearObservedAt() { + x.xxx_hidden_ObservedAt = nil +} + +func (x *SecurityInsightTrait) ClearTarget() { + x.xxx_hidden_Target = nil +} + +func (x *SecurityInsightTrait) ClearUser() { + if _, ok := x.xxx_hidden_Target.(*securityInsightTrait_User); ok { + x.xxx_hidden_Target = nil + } +} + +func (x *SecurityInsightTrait) ClearResourceId() { + if _, ok := x.xxx_hidden_Target.(*securityInsightTrait_ResourceId); ok { + x.xxx_hidden_Target = nil + } +} + +func (x *SecurityInsightTrait) ClearExternalResource() { + if _, ok := x.xxx_hidden_Target.(*securityInsightTrait_ExternalResource); ok { + x.xxx_hidden_Target = nil + } +} + +func (x *SecurityInsightTrait) ClearAppUser() { + if _, ok := x.xxx_hidden_Target.(*securityInsightTrait_AppUser); ok { + x.xxx_hidden_Target = nil + } +} + +const SecurityInsightTrait_InsightType_not_set_case case_SecurityInsightTrait_InsightType = 0 +const SecurityInsightTrait_RiskScore_case case_SecurityInsightTrait_InsightType = 1 +const SecurityInsightTrait_Issue_case case_SecurityInsightTrait_InsightType = 2 + +func (x *SecurityInsightTrait) WhichInsightType() case_SecurityInsightTrait_InsightType { + if x == nil { + return SecurityInsightTrait_InsightType_not_set_case + } + switch x.xxx_hidden_InsightType.(type) { + case *securityInsightTrait_RiskScore: + return SecurityInsightTrait_RiskScore_case + case *securityInsightTrait_Issue: + return SecurityInsightTrait_Issue_case + default: + return SecurityInsightTrait_InsightType_not_set_case + } +} + +const SecurityInsightTrait_Target_not_set_case case_SecurityInsightTrait_Target = 0 +const SecurityInsightTrait_User_case case_SecurityInsightTrait_Target = 4 +const SecurityInsightTrait_ResourceId_case case_SecurityInsightTrait_Target = 5 +const SecurityInsightTrait_ExternalResource_case case_SecurityInsightTrait_Target = 6 +const SecurityInsightTrait_AppUser_case case_SecurityInsightTrait_Target = 7 + +func (x *SecurityInsightTrait) WhichTarget() case_SecurityInsightTrait_Target { + if x == nil { + return SecurityInsightTrait_Target_not_set_case + } + switch x.xxx_hidden_Target.(type) { + case *securityInsightTrait_User: + return SecurityInsightTrait_User_case + case *securityInsightTrait_ResourceId: + return SecurityInsightTrait_ResourceId_case + case *securityInsightTrait_ExternalResource: + return SecurityInsightTrait_ExternalResource_case + case *securityInsightTrait_AppUser: + return SecurityInsightTrait_AppUser_case + default: + return SecurityInsightTrait_Target_not_set_case + } +} + +type SecurityInsightTrait_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The type and value of the insight + + // Fields of oneof xxx_hidden_InsightType: + RiskScore *RiskScore + Issue *Issue + // -- end of xxx_hidden_InsightType + // When this insight was observed/captured from the source system + ObservedAt *timestamppb.Timestamp + // The target entity this insight should be bound to + + // Fields of oneof xxx_hidden_Target: + // For binding to a C1 User by email address + User *SecurityInsightTrait_UserTarget + // For direct reference to a resource the connector knows about + ResourceId *ResourceId + // For binding to an AppResource by external ID + ExternalResource *SecurityInsightTrait_ExternalResourceTarget + // For binding to an AppUser by email address + AppUser *SecurityInsightTrait_AppUserTarget + // -- end of xxx_hidden_Target +} + +func (b0 SecurityInsightTrait_builder) Build() *SecurityInsightTrait { + m0 := &SecurityInsightTrait{} + b, x := &b0, m0 + _, _ = b, x + if b.RiskScore != nil { + x.xxx_hidden_InsightType = &securityInsightTrait_RiskScore{b.RiskScore} + } + if b.Issue != nil { + x.xxx_hidden_InsightType = &securityInsightTrait_Issue{b.Issue} + } + x.xxx_hidden_ObservedAt = b.ObservedAt + if b.User != nil { + x.xxx_hidden_Target = &securityInsightTrait_User{b.User} + } + if b.ResourceId != nil { + x.xxx_hidden_Target = &securityInsightTrait_ResourceId{b.ResourceId} + } + if b.ExternalResource != nil { + x.xxx_hidden_Target = &securityInsightTrait_ExternalResource{b.ExternalResource} + } + if b.AppUser != nil { + x.xxx_hidden_Target = &securityInsightTrait_AppUser{b.AppUser} + } + return m0 +} + +type case_SecurityInsightTrait_InsightType protoreflect.FieldNumber + +func (x case_SecurityInsightTrait_InsightType) String() string { + md := file_c1_connector_v2_annotation_security_insight_proto_msgTypes[2].Descriptor() + if x == 0 { + return "not set" + } + return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x)) +} + +type case_SecurityInsightTrait_Target protoreflect.FieldNumber + +func (x case_SecurityInsightTrait_Target) String() string { + md := file_c1_connector_v2_annotation_security_insight_proto_msgTypes[2].Descriptor() + if x == 0 { + return "not set" + } + return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x)) +} + +type isSecurityInsightTrait_InsightType interface { + isSecurityInsightTrait_InsightType() +} + +type securityInsightTrait_RiskScore struct { + RiskScore *RiskScore `protobuf:"bytes,1,opt,name=risk_score,json=riskScore,proto3,oneof"` +} + +type securityInsightTrait_Issue struct { + Issue *Issue `protobuf:"bytes,2,opt,name=issue,proto3,oneof"` +} + +func (*securityInsightTrait_RiskScore) isSecurityInsightTrait_InsightType() {} + +func (*securityInsightTrait_Issue) isSecurityInsightTrait_InsightType() {} + +type isSecurityInsightTrait_Target interface { + isSecurityInsightTrait_Target() +} + +type securityInsightTrait_User struct { + // For binding to a C1 User by email address + User *SecurityInsightTrait_UserTarget `protobuf:"bytes,4,opt,name=user,proto3,oneof"` +} + +type securityInsightTrait_ResourceId struct { + // For direct reference to a resource the connector knows about + ResourceId *ResourceId `protobuf:"bytes,5,opt,name=resource_id,json=resourceId,proto3,oneof"` +} + +type securityInsightTrait_ExternalResource struct { + // For binding to an AppResource by external ID + ExternalResource *SecurityInsightTrait_ExternalResourceTarget `protobuf:"bytes,6,opt,name=external_resource,json=externalResource,proto3,oneof"` +} + +type securityInsightTrait_AppUser struct { + // For binding to an AppUser by email address + AppUser *SecurityInsightTrait_AppUserTarget `protobuf:"bytes,7,opt,name=app_user,json=appUser,proto3,oneof"` +} + +func (*securityInsightTrait_User) isSecurityInsightTrait_Target() {} + +func (*securityInsightTrait_ResourceId) isSecurityInsightTrait_Target() {} + +func (*securityInsightTrait_ExternalResource) isSecurityInsightTrait_Target() {} + +func (*securityInsightTrait_AppUser) isSecurityInsightTrait_Target() {} + +// UserTarget identifies a user by email for resolution to a C1 User +type SecurityInsightTrait_UserTarget struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Email string `protobuf:"bytes,1,opt,name=email,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SecurityInsightTrait_UserTarget) Reset() { + *x = SecurityInsightTrait_UserTarget{} + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SecurityInsightTrait_UserTarget) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SecurityInsightTrait_UserTarget) ProtoMessage() {} + +func (x *SecurityInsightTrait_UserTarget) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SecurityInsightTrait_UserTarget) GetEmail() string { + if x != nil { + return x.xxx_hidden_Email + } + return "" +} + +func (x *SecurityInsightTrait_UserTarget) SetEmail(v string) { + x.xxx_hidden_Email = v +} + +type SecurityInsightTrait_UserTarget_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Email string +} + +func (b0 SecurityInsightTrait_UserTarget_builder) Build() *SecurityInsightTrait_UserTarget { + m0 := &SecurityInsightTrait_UserTarget{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Email = b.Email + return m0 +} + +// AppUserTarget identifies a user by email for resolution to an AppUser. +type SecurityInsightTrait_AppUserTarget struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Email string `protobuf:"bytes,1,opt,name=email,proto3"` + xxx_hidden_ExternalId string `protobuf:"bytes,2,opt,name=external_id,json=externalId,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SecurityInsightTrait_AppUserTarget) Reset() { + *x = SecurityInsightTrait_AppUserTarget{} + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SecurityInsightTrait_AppUserTarget) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SecurityInsightTrait_AppUserTarget) ProtoMessage() {} + +func (x *SecurityInsightTrait_AppUserTarget) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SecurityInsightTrait_AppUserTarget) GetEmail() string { + if x != nil { + return x.xxx_hidden_Email + } + return "" +} + +func (x *SecurityInsightTrait_AppUserTarget) GetExternalId() string { + if x != nil { + return x.xxx_hidden_ExternalId + } + return "" +} + +func (x *SecurityInsightTrait_AppUserTarget) SetEmail(v string) { + x.xxx_hidden_Email = v +} + +func (x *SecurityInsightTrait_AppUserTarget) SetExternalId(v string) { + x.xxx_hidden_ExternalId = v +} + +type SecurityInsightTrait_AppUserTarget_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Email string + // The external identifier of the user (e.g., ID, GUID, etc.) + ExternalId string +} + +func (b0 SecurityInsightTrait_AppUserTarget_builder) Build() *SecurityInsightTrait_AppUserTarget { + m0 := &SecurityInsightTrait_AppUserTarget{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Email = b.Email + x.xxx_hidden_ExternalId = b.ExternalId + return m0 +} + +// ExternalResourceTarget identifies a resource by external ID for resolution to an AppResource. +// Use this when the connector doesn't sync the target resource itself. +type SecurityInsightTrait_ExternalResourceTarget struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_ExternalId string `protobuf:"bytes,1,opt,name=external_id,json=externalId,proto3"` + xxx_hidden_AppHint string `protobuf:"bytes,2,opt,name=app_hint,json=appHint,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SecurityInsightTrait_ExternalResourceTarget) Reset() { + *x = SecurityInsightTrait_ExternalResourceTarget{} + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SecurityInsightTrait_ExternalResourceTarget) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SecurityInsightTrait_ExternalResourceTarget) ProtoMessage() {} + +func (x *SecurityInsightTrait_ExternalResourceTarget) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_annotation_security_insight_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *SecurityInsightTrait_ExternalResourceTarget) GetExternalId() string { + if x != nil { + return x.xxx_hidden_ExternalId + } + return "" +} + +func (x *SecurityInsightTrait_ExternalResourceTarget) GetAppHint() string { + if x != nil { + return x.xxx_hidden_AppHint + } + return "" +} + +func (x *SecurityInsightTrait_ExternalResourceTarget) SetExternalId(v string) { + x.xxx_hidden_ExternalId = v +} + +func (x *SecurityInsightTrait_ExternalResourceTarget) SetAppHint(v string) { + x.xxx_hidden_AppHint = v +} + +type SecurityInsightTrait_ExternalResourceTarget_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The external identifier of the resource (e.g., ARN, GUID, etc.) + ExternalId string + // Optional hint to help find the owning app (e.g., "aws", "github") + AppHint string +} + +func (b0 SecurityInsightTrait_ExternalResourceTarget_builder) Build() *SecurityInsightTrait_ExternalResourceTarget { + m0 := &SecurityInsightTrait_ExternalResourceTarget{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_ExternalId = b.ExternalId + x.xxx_hidden_AppHint = b.AppHint + return m0 +} + +var File_c1_connector_v2_annotation_security_insight_proto protoreflect.FileDescriptor + +const file_c1_connector_v2_annotation_security_insight_proto_rawDesc = "" + + "\n" + + "1c1/connector/v2/annotation_security_insight.proto\x12\x0fc1.connector.v2\x1a\x1ec1/connector/v2/resource.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17validate/validate.proto\"!\n" + + "\tRiskScore\x12\x14\n" + + "\x05value\x18\x01 \x01(\tR\x05value\"E\n" + + "\x05Issue\x12\x14\n" + + "\x05value\x18\x01 \x01(\tR\x05value\x12&\n" + + "\bseverity\x18\x02 \x01(\tB\n" + + "\xfaB\ar\x05 \x00(\x80\bR\bseverity\"\xae\x06\n" + + "\x14SecurityInsightTrait\x12;\n" + + "\n" + + "risk_score\x18\x01 \x01(\v2\x1a.c1.connector.v2.RiskScoreH\x00R\triskScore\x12.\n" + + "\x05issue\x18\x02 \x01(\v2\x16.c1.connector.v2.IssueH\x00R\x05issue\x12;\n" + + "\vobserved_at\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\n" + + "observedAt\x12F\n" + + "\x04user\x18\x04 \x01(\v20.c1.connector.v2.SecurityInsightTrait.UserTargetH\x01R\x04user\x12>\n" + + "\vresource_id\x18\x05 \x01(\v2\x1b.c1.connector.v2.ResourceIdH\x01R\n" + + "resourceId\x12k\n" + + "\x11external_resource\x18\x06 \x01(\v2<.c1.connector.v2.SecurityInsightTrait.ExternalResourceTargetH\x01R\x10externalResource\x12P\n" + + "\bapp_user\x18\a \x01(\v23.c1.connector.v2.SecurityInsightTrait.AppUserTargetH\x01R\aappUser\x1a0\n" + + "\n" + + "UserTarget\x12\"\n" + + "\x05email\x18\x01 \x01(\tB\f\xfaB\tr\a \x01(\x80\b`\x01R\x05email\x1a`\n" + + "\rAppUserTarget\x12\"\n" + + "\x05email\x18\x01 \x01(\tB\f\xfaB\tr\a \x01(\x80\b`\x01R\x05email\x12+\n" + + "\vexternal_id\x18\x02 \x01(\tB\n" + + "\xfaB\ar\x05 \x01(\x80 R\n" + + "externalId\x1am\n" + + "\x16ExternalResourceTarget\x12+\n" + + "\vexternal_id\x18\x01 \x01(\tB\n" + + "\xfaB\ar\x05 \x01(\x80 R\n" + + "externalId\x12&\n" + + "\bapp_hint\x18\x02 \x01(\tB\v\xfaB\br\x06(\x80\b\xd0\x01\x01R\aappHintB\x13\n" + + "\finsight_type\x12\x03\xf8B\x01B\r\n" + + "\x06target\x12\x03\xf8B\x01B6Z4github.com/conductorone/baton-sdk/pb/c1/connector/v2b\x06proto3" + +var file_c1_connector_v2_annotation_security_insight_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_c1_connector_v2_annotation_security_insight_proto_goTypes = []any{ + (*RiskScore)(nil), // 0: c1.connector.v2.RiskScore + (*Issue)(nil), // 1: c1.connector.v2.Issue + (*SecurityInsightTrait)(nil), // 2: c1.connector.v2.SecurityInsightTrait + (*SecurityInsightTrait_UserTarget)(nil), // 3: c1.connector.v2.SecurityInsightTrait.UserTarget + (*SecurityInsightTrait_AppUserTarget)(nil), // 4: c1.connector.v2.SecurityInsightTrait.AppUserTarget + (*SecurityInsightTrait_ExternalResourceTarget)(nil), // 5: c1.connector.v2.SecurityInsightTrait.ExternalResourceTarget + (*timestamppb.Timestamp)(nil), // 6: google.protobuf.Timestamp + (*ResourceId)(nil), // 7: c1.connector.v2.ResourceId +} +var file_c1_connector_v2_annotation_security_insight_proto_depIdxs = []int32{ + 0, // 0: c1.connector.v2.SecurityInsightTrait.risk_score:type_name -> c1.connector.v2.RiskScore + 1, // 1: c1.connector.v2.SecurityInsightTrait.issue:type_name -> c1.connector.v2.Issue + 6, // 2: c1.connector.v2.SecurityInsightTrait.observed_at:type_name -> google.protobuf.Timestamp + 3, // 3: c1.connector.v2.SecurityInsightTrait.user:type_name -> c1.connector.v2.SecurityInsightTrait.UserTarget + 7, // 4: c1.connector.v2.SecurityInsightTrait.resource_id:type_name -> c1.connector.v2.ResourceId + 5, // 5: c1.connector.v2.SecurityInsightTrait.external_resource:type_name -> c1.connector.v2.SecurityInsightTrait.ExternalResourceTarget + 4, // 6: c1.connector.v2.SecurityInsightTrait.app_user:type_name -> c1.connector.v2.SecurityInsightTrait.AppUserTarget + 7, // [7:7] is the sub-list for method output_type + 7, // [7:7] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_c1_connector_v2_annotation_security_insight_proto_init() } +func file_c1_connector_v2_annotation_security_insight_proto_init() { + if File_c1_connector_v2_annotation_security_insight_proto != nil { + return + } + file_c1_connector_v2_resource_proto_init() + file_c1_connector_v2_annotation_security_insight_proto_msgTypes[2].OneofWrappers = []any{ + (*securityInsightTrait_RiskScore)(nil), + (*securityInsightTrait_Issue)(nil), + (*securityInsightTrait_User)(nil), + (*securityInsightTrait_ResourceId)(nil), + (*securityInsightTrait_ExternalResource)(nil), + (*securityInsightTrait_AppUser)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_c1_connector_v2_annotation_security_insight_proto_rawDesc), len(file_c1_connector_v2_annotation_security_insight_proto_rawDesc)), + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_c1_connector_v2_annotation_security_insight_proto_goTypes, + DependencyIndexes: file_c1_connector_v2_annotation_security_insight_proto_depIdxs, + MessageInfos: file_c1_connector_v2_annotation_security_insight_proto_msgTypes, + }.Build() + File_c1_connector_v2_annotation_security_insight_proto = out.File + file_c1_connector_v2_annotation_security_insight_proto_goTypes = nil + file_c1_connector_v2_annotation_security_insight_proto_depIdxs = nil +} diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_trait.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_trait.pb.go index 7b79389a..8a50448f 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_trait.pb.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_trait.pb.go @@ -583,10 +583,11 @@ func (b0 GroupTrait_builder) Build() *GroupTrait { } type RoleTrait struct { - state protoimpl.MessageState `protogen:"hybrid.v1"` - Profile *structpb.Struct `protobuf:"bytes,1,opt,name=profile,proto3" json:"profile,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"hybrid.v1"` + Profile *structpb.Struct `protobuf:"bytes,1,opt,name=profile,proto3" json:"profile,omitempty"` + RoleScopeConditions *RoleScopeConditions `protobuf:"bytes,2,opt,name=role_scope_conditions,json=roleScopeConditions,proto3" json:"role_scope_conditions,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *RoleTrait) Reset() { @@ -621,10 +622,21 @@ func (x *RoleTrait) GetProfile() *structpb.Struct { return nil } +func (x *RoleTrait) GetRoleScopeConditions() *RoleScopeConditions { + if x != nil { + return x.RoleScopeConditions + } + return nil +} + func (x *RoleTrait) SetProfile(v *structpb.Struct) { x.Profile = v } +func (x *RoleTrait) SetRoleScopeConditions(v *RoleScopeConditions) { + x.RoleScopeConditions = v +} + func (x *RoleTrait) HasProfile() bool { if x == nil { return false @@ -632,14 +644,26 @@ func (x *RoleTrait) HasProfile() bool { return x.Profile != nil } +func (x *RoleTrait) HasRoleScopeConditions() bool { + if x == nil { + return false + } + return x.RoleScopeConditions != nil +} + func (x *RoleTrait) ClearProfile() { x.Profile = nil } +func (x *RoleTrait) ClearRoleScopeConditions() { + x.RoleScopeConditions = nil +} + type RoleTrait_builder struct { _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. - Profile *structpb.Struct + Profile *structpb.Struct + RoleScopeConditions *RoleScopeConditions } func (b0 RoleTrait_builder) Build() *RoleTrait { @@ -647,6 +671,234 @@ func (b0 RoleTrait_builder) Build() *RoleTrait { b, x := &b0, m0 _, _ = b, x x.Profile = b.Profile + x.RoleScopeConditions = b.RoleScopeConditions + return m0 +} + +type RoleScopeConditions struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Conditions []*RoleScopeCondition `protobuf:"bytes,3,rep,name=conditions,proto3" json:"conditions,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RoleScopeConditions) Reset() { + *x = RoleScopeConditions{} + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RoleScopeConditions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoleScopeConditions) ProtoMessage() {} + +func (x *RoleScopeConditions) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RoleScopeConditions) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *RoleScopeConditions) GetConditions() []*RoleScopeCondition { + if x != nil { + return x.Conditions + } + return nil +} + +func (x *RoleScopeConditions) SetType(v string) { + x.Type = v +} + +func (x *RoleScopeConditions) SetConditions(v []*RoleScopeCondition) { + x.Conditions = v +} + +type RoleScopeConditions_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Type string + Conditions []*RoleScopeCondition +} + +func (b0 RoleScopeConditions_builder) Build() *RoleScopeConditions { + m0 := &RoleScopeConditions{} + b, x := &b0, m0 + _, _ = b, x + x.Type = b.Type + x.Conditions = b.Conditions + return m0 +} + +type RoleScopeCondition struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + Expression string `protobuf:"bytes,1,opt,name=expression,proto3" json:"expression,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RoleScopeCondition) Reset() { + *x = RoleScopeCondition{} + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RoleScopeCondition) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoleScopeCondition) ProtoMessage() {} + +func (x *RoleScopeCondition) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RoleScopeCondition) GetExpression() string { + if x != nil { + return x.Expression + } + return "" +} + +func (x *RoleScopeCondition) SetExpression(v string) { + x.Expression = v +} + +type RoleScopeCondition_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Expression string +} + +func (b0 RoleScopeCondition_builder) Build() *RoleScopeCondition { + m0 := &RoleScopeCondition{} + b, x := &b0, m0 + _, _ = b, x + x.Expression = b.Expression + return m0 +} + +// ScopeBindingTrait is used to scope a role to a resource or set of resources. +// The scope may be static (determined at crawl time) or dynamic (determined based on conditions). +// For example, in Azure a role definition can be scoped to a subscription, management group, or resource group. +// In that case, the role ID would be the resource ID of the role definition, and the scope resource ID would be the resource ID of the subscription, management group, or resource group. +type ScopeBindingTrait struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + RoleId *ResourceId `protobuf:"bytes,1,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"` // The role that is scoped. Must be a resource with the role trait. + // Remove required if we add more ways to scope roles. (eg: Expressions.) + ScopeResourceId *ResourceId `protobuf:"bytes,2,opt,name=scope_resource_id,json=scopeResourceId,proto3" json:"scope_resource_id,omitempty"` // The resource that the role is scoped to. + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ScopeBindingTrait) Reset() { + *x = ScopeBindingTrait{} + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ScopeBindingTrait) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ScopeBindingTrait) ProtoMessage() {} + +func (x *ScopeBindingTrait) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ScopeBindingTrait) GetRoleId() *ResourceId { + if x != nil { + return x.RoleId + } + return nil +} + +func (x *ScopeBindingTrait) GetScopeResourceId() *ResourceId { + if x != nil { + return x.ScopeResourceId + } + return nil +} + +func (x *ScopeBindingTrait) SetRoleId(v *ResourceId) { + x.RoleId = v +} + +func (x *ScopeBindingTrait) SetScopeResourceId(v *ResourceId) { + x.ScopeResourceId = v +} + +func (x *ScopeBindingTrait) HasRoleId() bool { + if x == nil { + return false + } + return x.RoleId != nil +} + +func (x *ScopeBindingTrait) HasScopeResourceId() bool { + if x == nil { + return false + } + return x.ScopeResourceId != nil +} + +func (x *ScopeBindingTrait) ClearRoleId() { + x.RoleId = nil +} + +func (x *ScopeBindingTrait) ClearScopeResourceId() { + x.ScopeResourceId = nil +} + +type ScopeBindingTrait_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + RoleId *ResourceId + // Remove required if we add more ways to scope roles. (eg: Expressions.) + ScopeResourceId *ResourceId +} + +func (b0 ScopeBindingTrait_builder) Build() *ScopeBindingTrait { + m0 := &ScopeBindingTrait{} + b, x := &b0, m0 + _, _ = b, x + x.RoleId = b.RoleId + x.ScopeResourceId = b.ScopeResourceId return m0 } @@ -663,7 +915,7 @@ type AppTrait struct { func (x *AppTrait) Reset() { *x = AppTrait{} - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[3] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -675,7 +927,7 @@ func (x *AppTrait) String() string { func (*AppTrait) ProtoMessage() {} func (x *AppTrait) ProtoReflect() protoreflect.Message { - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[3] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -810,7 +1062,7 @@ type SecretTrait struct { func (x *SecretTrait) Reset() { *x = SecretTrait{} - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[4] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -822,7 +1074,7 @@ func (x *SecretTrait) String() string { func (*SecretTrait) ProtoMessage() {} func (x *SecretTrait) ProtoReflect() protoreflect.Message { - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[4] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1000,7 +1252,7 @@ type UserTrait_Email struct { func (x *UserTrait_Email) Reset() { *x = UserTrait_Email{} - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[5] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1012,7 +1264,7 @@ func (x *UserTrait_Email) String() string { func (*UserTrait_Email) ProtoMessage() {} func (x *UserTrait_Email) ProtoReflect() protoreflect.Message { - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[5] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1072,7 +1324,7 @@ type UserTrait_Status struct { func (x *UserTrait_Status) Reset() { *x = UserTrait_Status{} - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[6] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1084,7 +1336,7 @@ func (x *UserTrait_Status) String() string { func (*UserTrait_Status) ProtoMessage() {} func (x *UserTrait_Status) ProtoReflect() protoreflect.Message { - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[6] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1142,7 +1394,7 @@ type UserTrait_MFAStatus struct { func (x *UserTrait_MFAStatus) Reset() { *x = UserTrait_MFAStatus{} - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[7] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1154,7 +1406,7 @@ func (x *UserTrait_MFAStatus) String() string { func (*UserTrait_MFAStatus) ProtoMessage() {} func (x *UserTrait_MFAStatus) ProtoReflect() protoreflect.Message { - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[7] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1199,7 +1451,7 @@ type UserTrait_SSOStatus struct { func (x *UserTrait_SSOStatus) Reset() { *x = UserTrait_SSOStatus{} - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[8] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1211,7 +1463,7 @@ func (x *UserTrait_SSOStatus) String() string { func (*UserTrait_SSOStatus) ProtoMessage() {} func (x *UserTrait_SSOStatus) ProtoReflect() protoreflect.Message { - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[8] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1260,7 +1512,7 @@ type UserTrait_StructuredName struct { func (x *UserTrait_StructuredName) Reset() { *x = UserTrait_StructuredName{} - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[9] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1272,7 +1524,7 @@ func (x *UserTrait_StructuredName) String() string { func (*UserTrait_StructuredName) ProtoMessage() {} func (x *UserTrait_StructuredName) ProtoReflect() protoreflect.Message { - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[9] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1419,9 +1671,22 @@ const file_c1_connector_v2_annotation_trait_proto_rawDesc = "" + "\n" + "GroupTrait\x12-\n" + "\x04icon\x18\x01 \x01(\v2\x19.c1.connector.v2.AssetRefR\x04icon\x121\n" + - "\aprofile\x18\x02 \x01(\v2\x17.google.protobuf.StructR\aprofile\">\n" + + "\aprofile\x18\x02 \x01(\v2\x17.google.protobuf.StructR\aprofile\"\x98\x01\n" + "\tRoleTrait\x121\n" + - "\aprofile\x18\x01 \x01(\v2\x17.google.protobuf.StructR\aprofile\"\x9a\x03\n" + + "\aprofile\x18\x01 \x01(\v2\x17.google.protobuf.StructR\aprofile\x12X\n" + + "\x15role_scope_conditions\x18\x02 \x01(\v2$.c1.connector.v2.RoleScopeConditionsR\x13roleScopeConditions\"n\n" + + "\x13RoleScopeConditions\x12\x12\n" + + "\x04type\x18\x01 \x01(\tR\x04type\x12C\n" + + "\n" + + "conditions\x18\x03 \x03(\v2#.c1.connector.v2.RoleScopeConditionR\n" + + "conditions\"4\n" + + "\x12RoleScopeCondition\x12\x1e\n" + + "\n" + + "expression\x18\x01 \x01(\tR\n" + + "expression\"\xa6\x01\n" + + "\x11ScopeBindingTrait\x12>\n" + + "\arole_id\x18\x01 \x01(\v2\x1b.c1.connector.v2.ResourceIdB\b\xfaB\x05\x8a\x01\x02\x10\x01R\x06roleId\x12Q\n" + + "\x11scope_resource_id\x18\x02 \x01(\v2\x1b.c1.connector.v2.ResourceIdB\b\xfaB\x05\x8a\x01\x02\x10\x01R\x0fscopeResourceId\"\x9a\x03\n" + "\bAppTrait\x125\n" + "\bhelp_url\x18\x01 \x01(\tB\x1a\xfaB\x17r\x15 \x01(\x80\b:\bhttps://\xd0\x01\x01\x88\x01\x01R\ahelpUrl\x12-\n" + "\x04icon\x18\x02 \x01(\v2\x19.c1.connector.v2.AssetRefR\x04icon\x12-\n" + @@ -1448,7 +1713,7 @@ const file_c1_connector_v2_annotation_trait_proto_rawDesc = "" + "identityIdB6Z4github.com/conductorone/baton-sdk/pb/c1/connector/v2b\x06proto3" var file_c1_connector_v2_annotation_trait_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file_c1_connector_v2_annotation_trait_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_c1_connector_v2_annotation_trait_proto_msgTypes = make([]protoimpl.MessageInfo, 13) var file_c1_connector_v2_annotation_trait_proto_goTypes = []any{ (UserTrait_AccountType)(0), // 0: c1.connector.v2.UserTrait.AccountType (UserTrait_Status_Status)(0), // 1: c1.connector.v2.UserTrait.Status.Status @@ -1456,48 +1721,55 @@ var file_c1_connector_v2_annotation_trait_proto_goTypes = []any{ (*UserTrait)(nil), // 3: c1.connector.v2.UserTrait (*GroupTrait)(nil), // 4: c1.connector.v2.GroupTrait (*RoleTrait)(nil), // 5: c1.connector.v2.RoleTrait - (*AppTrait)(nil), // 6: c1.connector.v2.AppTrait - (*SecretTrait)(nil), // 7: c1.connector.v2.SecretTrait - (*UserTrait_Email)(nil), // 8: c1.connector.v2.UserTrait.Email - (*UserTrait_Status)(nil), // 9: c1.connector.v2.UserTrait.Status - (*UserTrait_MFAStatus)(nil), // 10: c1.connector.v2.UserTrait.MFAStatus - (*UserTrait_SSOStatus)(nil), // 11: c1.connector.v2.UserTrait.SSOStatus - (*UserTrait_StructuredName)(nil), // 12: c1.connector.v2.UserTrait.StructuredName - (*structpb.Struct)(nil), // 13: google.protobuf.Struct - (*AssetRef)(nil), // 14: c1.connector.v2.AssetRef - (*timestamppb.Timestamp)(nil), // 15: google.protobuf.Timestamp - (*ResourceId)(nil), // 16: c1.connector.v2.ResourceId + (*RoleScopeConditions)(nil), // 6: c1.connector.v2.RoleScopeConditions + (*RoleScopeCondition)(nil), // 7: c1.connector.v2.RoleScopeCondition + (*ScopeBindingTrait)(nil), // 8: c1.connector.v2.ScopeBindingTrait + (*AppTrait)(nil), // 9: c1.connector.v2.AppTrait + (*SecretTrait)(nil), // 10: c1.connector.v2.SecretTrait + (*UserTrait_Email)(nil), // 11: c1.connector.v2.UserTrait.Email + (*UserTrait_Status)(nil), // 12: c1.connector.v2.UserTrait.Status + (*UserTrait_MFAStatus)(nil), // 13: c1.connector.v2.UserTrait.MFAStatus + (*UserTrait_SSOStatus)(nil), // 14: c1.connector.v2.UserTrait.SSOStatus + (*UserTrait_StructuredName)(nil), // 15: c1.connector.v2.UserTrait.StructuredName + (*structpb.Struct)(nil), // 16: google.protobuf.Struct + (*AssetRef)(nil), // 17: c1.connector.v2.AssetRef + (*timestamppb.Timestamp)(nil), // 18: google.protobuf.Timestamp + (*ResourceId)(nil), // 19: c1.connector.v2.ResourceId } var file_c1_connector_v2_annotation_trait_proto_depIdxs = []int32{ - 8, // 0: c1.connector.v2.UserTrait.emails:type_name -> c1.connector.v2.UserTrait.Email - 9, // 1: c1.connector.v2.UserTrait.status:type_name -> c1.connector.v2.UserTrait.Status - 13, // 2: c1.connector.v2.UserTrait.profile:type_name -> google.protobuf.Struct - 14, // 3: c1.connector.v2.UserTrait.icon:type_name -> c1.connector.v2.AssetRef + 11, // 0: c1.connector.v2.UserTrait.emails:type_name -> c1.connector.v2.UserTrait.Email + 12, // 1: c1.connector.v2.UserTrait.status:type_name -> c1.connector.v2.UserTrait.Status + 16, // 2: c1.connector.v2.UserTrait.profile:type_name -> google.protobuf.Struct + 17, // 3: c1.connector.v2.UserTrait.icon:type_name -> c1.connector.v2.AssetRef 0, // 4: c1.connector.v2.UserTrait.account_type:type_name -> c1.connector.v2.UserTrait.AccountType - 15, // 5: c1.connector.v2.UserTrait.created_at:type_name -> google.protobuf.Timestamp - 15, // 6: c1.connector.v2.UserTrait.last_login:type_name -> google.protobuf.Timestamp - 10, // 7: c1.connector.v2.UserTrait.mfa_status:type_name -> c1.connector.v2.UserTrait.MFAStatus - 11, // 8: c1.connector.v2.UserTrait.sso_status:type_name -> c1.connector.v2.UserTrait.SSOStatus - 12, // 9: c1.connector.v2.UserTrait.structured_name:type_name -> c1.connector.v2.UserTrait.StructuredName - 14, // 10: c1.connector.v2.GroupTrait.icon:type_name -> c1.connector.v2.AssetRef - 13, // 11: c1.connector.v2.GroupTrait.profile:type_name -> google.protobuf.Struct - 13, // 12: c1.connector.v2.RoleTrait.profile:type_name -> google.protobuf.Struct - 14, // 13: c1.connector.v2.AppTrait.icon:type_name -> c1.connector.v2.AssetRef - 14, // 14: c1.connector.v2.AppTrait.logo:type_name -> c1.connector.v2.AssetRef - 13, // 15: c1.connector.v2.AppTrait.profile:type_name -> google.protobuf.Struct - 2, // 16: c1.connector.v2.AppTrait.flags:type_name -> c1.connector.v2.AppTrait.AppFlag - 13, // 17: c1.connector.v2.SecretTrait.profile:type_name -> google.protobuf.Struct - 15, // 18: c1.connector.v2.SecretTrait.created_at:type_name -> google.protobuf.Timestamp - 15, // 19: c1.connector.v2.SecretTrait.expires_at:type_name -> google.protobuf.Timestamp - 15, // 20: c1.connector.v2.SecretTrait.last_used_at:type_name -> google.protobuf.Timestamp - 16, // 21: c1.connector.v2.SecretTrait.created_by_id:type_name -> c1.connector.v2.ResourceId - 16, // 22: c1.connector.v2.SecretTrait.identity_id:type_name -> c1.connector.v2.ResourceId - 1, // 23: c1.connector.v2.UserTrait.Status.status:type_name -> c1.connector.v2.UserTrait.Status.Status - 24, // [24:24] is the sub-list for method output_type - 24, // [24:24] is the sub-list for method input_type - 24, // [24:24] is the sub-list for extension type_name - 24, // [24:24] is the sub-list for extension extendee - 0, // [0:24] is the sub-list for field type_name + 18, // 5: c1.connector.v2.UserTrait.created_at:type_name -> google.protobuf.Timestamp + 18, // 6: c1.connector.v2.UserTrait.last_login:type_name -> google.protobuf.Timestamp + 13, // 7: c1.connector.v2.UserTrait.mfa_status:type_name -> c1.connector.v2.UserTrait.MFAStatus + 14, // 8: c1.connector.v2.UserTrait.sso_status:type_name -> c1.connector.v2.UserTrait.SSOStatus + 15, // 9: c1.connector.v2.UserTrait.structured_name:type_name -> c1.connector.v2.UserTrait.StructuredName + 17, // 10: c1.connector.v2.GroupTrait.icon:type_name -> c1.connector.v2.AssetRef + 16, // 11: c1.connector.v2.GroupTrait.profile:type_name -> google.protobuf.Struct + 16, // 12: c1.connector.v2.RoleTrait.profile:type_name -> google.protobuf.Struct + 6, // 13: c1.connector.v2.RoleTrait.role_scope_conditions:type_name -> c1.connector.v2.RoleScopeConditions + 7, // 14: c1.connector.v2.RoleScopeConditions.conditions:type_name -> c1.connector.v2.RoleScopeCondition + 19, // 15: c1.connector.v2.ScopeBindingTrait.role_id:type_name -> c1.connector.v2.ResourceId + 19, // 16: c1.connector.v2.ScopeBindingTrait.scope_resource_id:type_name -> c1.connector.v2.ResourceId + 17, // 17: c1.connector.v2.AppTrait.icon:type_name -> c1.connector.v2.AssetRef + 17, // 18: c1.connector.v2.AppTrait.logo:type_name -> c1.connector.v2.AssetRef + 16, // 19: c1.connector.v2.AppTrait.profile:type_name -> google.protobuf.Struct + 2, // 20: c1.connector.v2.AppTrait.flags:type_name -> c1.connector.v2.AppTrait.AppFlag + 16, // 21: c1.connector.v2.SecretTrait.profile:type_name -> google.protobuf.Struct + 18, // 22: c1.connector.v2.SecretTrait.created_at:type_name -> google.protobuf.Timestamp + 18, // 23: c1.connector.v2.SecretTrait.expires_at:type_name -> google.protobuf.Timestamp + 18, // 24: c1.connector.v2.SecretTrait.last_used_at:type_name -> google.protobuf.Timestamp + 19, // 25: c1.connector.v2.SecretTrait.created_by_id:type_name -> c1.connector.v2.ResourceId + 19, // 26: c1.connector.v2.SecretTrait.identity_id:type_name -> c1.connector.v2.ResourceId + 1, // 27: c1.connector.v2.UserTrait.Status.status:type_name -> c1.connector.v2.UserTrait.Status.Status + 28, // [28:28] is the sub-list for method output_type + 28, // [28:28] is the sub-list for method input_type + 28, // [28:28] is the sub-list for extension type_name + 28, // [28:28] is the sub-list for extension extendee + 0, // [0:28] is the sub-list for field type_name } func init() { file_c1_connector_v2_annotation_trait_proto_init() } @@ -1513,7 +1785,7 @@ func file_c1_connector_v2_annotation_trait_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_c1_connector_v2_annotation_trait_proto_rawDesc), len(file_c1_connector_v2_annotation_trait_proto_rawDesc)), NumEnums: 3, - NumMessages: 10, + NumMessages: 13, NumExtensions: 0, NumServices: 0, }, diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_trait.pb.validate.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_trait.pb.validate.go index a0288dc3..c79b43ca 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_trait.pb.validate.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_trait.pb.validate.go @@ -632,6 +632,35 @@ func (m *RoleTrait) validate(all bool) error { } } + if all { + switch v := interface{}(m.GetRoleScopeConditions()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, RoleTraitValidationError{ + field: "RoleScopeConditions", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, RoleTraitValidationError{ + field: "RoleScopeConditions", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetRoleScopeConditions()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RoleTraitValidationError{ + field: "RoleScopeConditions", + reason: "embedded message failed validation", + cause: err, + } + } + } + if len(errors) > 0 { return RoleTraitMultiError(errors) } @@ -709,6 +738,430 @@ var _ interface { ErrorName() string } = RoleTraitValidationError{} +// Validate checks the field values on RoleScopeConditions with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *RoleScopeConditions) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on RoleScopeConditions with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// RoleScopeConditionsMultiError, or nil if none found. +func (m *RoleScopeConditions) ValidateAll() error { + return m.validate(true) +} + +func (m *RoleScopeConditions) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Type + + for idx, item := range m.GetConditions() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, RoleScopeConditionsValidationError{ + field: fmt.Sprintf("Conditions[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, RoleScopeConditionsValidationError{ + field: fmt.Sprintf("Conditions[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RoleScopeConditionsValidationError{ + field: fmt.Sprintf("Conditions[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return RoleScopeConditionsMultiError(errors) + } + + return nil +} + +// RoleScopeConditionsMultiError is an error wrapping multiple validation +// errors returned by RoleScopeConditions.ValidateAll() if the designated +// constraints aren't met. +type RoleScopeConditionsMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m RoleScopeConditionsMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m RoleScopeConditionsMultiError) AllErrors() []error { return m } + +// RoleScopeConditionsValidationError is the validation error returned by +// RoleScopeConditions.Validate if the designated constraints aren't met. +type RoleScopeConditionsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e RoleScopeConditionsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e RoleScopeConditionsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e RoleScopeConditionsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e RoleScopeConditionsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e RoleScopeConditionsValidationError) ErrorName() string { + return "RoleScopeConditionsValidationError" +} + +// Error satisfies the builtin error interface +func (e RoleScopeConditionsValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRoleScopeConditions.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = RoleScopeConditionsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = RoleScopeConditionsValidationError{} + +// Validate checks the field values on RoleScopeCondition with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *RoleScopeCondition) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on RoleScopeCondition with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// RoleScopeConditionMultiError, or nil if none found. +func (m *RoleScopeCondition) ValidateAll() error { + return m.validate(true) +} + +func (m *RoleScopeCondition) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Expression + + if len(errors) > 0 { + return RoleScopeConditionMultiError(errors) + } + + return nil +} + +// RoleScopeConditionMultiError is an error wrapping multiple validation errors +// returned by RoleScopeCondition.ValidateAll() if the designated constraints +// aren't met. +type RoleScopeConditionMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m RoleScopeConditionMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m RoleScopeConditionMultiError) AllErrors() []error { return m } + +// RoleScopeConditionValidationError is the validation error returned by +// RoleScopeCondition.Validate if the designated constraints aren't met. +type RoleScopeConditionValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e RoleScopeConditionValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e RoleScopeConditionValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e RoleScopeConditionValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e RoleScopeConditionValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e RoleScopeConditionValidationError) ErrorName() string { + return "RoleScopeConditionValidationError" +} + +// Error satisfies the builtin error interface +func (e RoleScopeConditionValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRoleScopeCondition.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = RoleScopeConditionValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = RoleScopeConditionValidationError{} + +// Validate checks the field values on ScopeBindingTrait with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *ScopeBindingTrait) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ScopeBindingTrait with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ScopeBindingTraitMultiError, or nil if none found. +func (m *ScopeBindingTrait) ValidateAll() error { + return m.validate(true) +} + +func (m *ScopeBindingTrait) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if m.GetRoleId() == nil { + err := ScopeBindingTraitValidationError{ + field: "RoleId", + reason: "value is required", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetRoleId()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ScopeBindingTraitValidationError{ + field: "RoleId", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ScopeBindingTraitValidationError{ + field: "RoleId", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetRoleId()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ScopeBindingTraitValidationError{ + field: "RoleId", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if m.GetScopeResourceId() == nil { + err := ScopeBindingTraitValidationError{ + field: "ScopeResourceId", + reason: "value is required", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetScopeResourceId()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ScopeBindingTraitValidationError{ + field: "ScopeResourceId", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ScopeBindingTraitValidationError{ + field: "ScopeResourceId", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetScopeResourceId()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ScopeBindingTraitValidationError{ + field: "ScopeResourceId", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return ScopeBindingTraitMultiError(errors) + } + + return nil +} + +// ScopeBindingTraitMultiError is an error wrapping multiple validation errors +// returned by ScopeBindingTrait.ValidateAll() if the designated constraints +// aren't met. +type ScopeBindingTraitMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ScopeBindingTraitMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ScopeBindingTraitMultiError) AllErrors() []error { return m } + +// ScopeBindingTraitValidationError is the validation error returned by +// ScopeBindingTrait.Validate if the designated constraints aren't met. +type ScopeBindingTraitValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ScopeBindingTraitValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ScopeBindingTraitValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ScopeBindingTraitValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ScopeBindingTraitValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ScopeBindingTraitValidationError) ErrorName() string { + return "ScopeBindingTraitValidationError" +} + +// Error satisfies the builtin error interface +func (e ScopeBindingTraitValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sScopeBindingTrait.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ScopeBindingTraitValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ScopeBindingTraitValidationError{} + // Validate checks the field values on AppTrait with the rules defined in the // proto definition for this message. If any rules are violated, the first // error encountered is returned, or nil if there are no violations. diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_trait_protoopaque.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_trait_protoopaque.pb.go index c7a4531b..db2e7db8 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_trait_protoopaque.pb.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_trait_protoopaque.pb.go @@ -583,10 +583,11 @@ func (b0 GroupTrait_builder) Build() *GroupTrait { } type RoleTrait struct { - state protoimpl.MessageState `protogen:"opaque.v1"` - xxx_hidden_Profile *structpb.Struct `protobuf:"bytes,1,opt,name=profile,proto3"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Profile *structpb.Struct `protobuf:"bytes,1,opt,name=profile,proto3"` + xxx_hidden_RoleScopeConditions *RoleScopeConditions `protobuf:"bytes,2,opt,name=role_scope_conditions,json=roleScopeConditions,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *RoleTrait) Reset() { @@ -621,10 +622,21 @@ func (x *RoleTrait) GetProfile() *structpb.Struct { return nil } +func (x *RoleTrait) GetRoleScopeConditions() *RoleScopeConditions { + if x != nil { + return x.xxx_hidden_RoleScopeConditions + } + return nil +} + func (x *RoleTrait) SetProfile(v *structpb.Struct) { x.xxx_hidden_Profile = v } +func (x *RoleTrait) SetRoleScopeConditions(v *RoleScopeConditions) { + x.xxx_hidden_RoleScopeConditions = v +} + func (x *RoleTrait) HasProfile() bool { if x == nil { return false @@ -632,14 +644,26 @@ func (x *RoleTrait) HasProfile() bool { return x.xxx_hidden_Profile != nil } +func (x *RoleTrait) HasRoleScopeConditions() bool { + if x == nil { + return false + } + return x.xxx_hidden_RoleScopeConditions != nil +} + func (x *RoleTrait) ClearProfile() { x.xxx_hidden_Profile = nil } +func (x *RoleTrait) ClearRoleScopeConditions() { + x.xxx_hidden_RoleScopeConditions = nil +} + type RoleTrait_builder struct { _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. - Profile *structpb.Struct + Profile *structpb.Struct + RoleScopeConditions *RoleScopeConditions } func (b0 RoleTrait_builder) Build() *RoleTrait { @@ -647,6 +671,235 @@ func (b0 RoleTrait_builder) Build() *RoleTrait { b, x := &b0, m0 _, _ = b, x x.xxx_hidden_Profile = b.Profile + x.xxx_hidden_RoleScopeConditions = b.RoleScopeConditions + return m0 +} + +type RoleScopeConditions struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Type string `protobuf:"bytes,1,opt,name=type,proto3"` + xxx_hidden_Conditions *[]*RoleScopeCondition `protobuf:"bytes,3,rep,name=conditions,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RoleScopeConditions) Reset() { + *x = RoleScopeConditions{} + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RoleScopeConditions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoleScopeConditions) ProtoMessage() {} + +func (x *RoleScopeConditions) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RoleScopeConditions) GetType() string { + if x != nil { + return x.xxx_hidden_Type + } + return "" +} + +func (x *RoleScopeConditions) GetConditions() []*RoleScopeCondition { + if x != nil { + if x.xxx_hidden_Conditions != nil { + return *x.xxx_hidden_Conditions + } + } + return nil +} + +func (x *RoleScopeConditions) SetType(v string) { + x.xxx_hidden_Type = v +} + +func (x *RoleScopeConditions) SetConditions(v []*RoleScopeCondition) { + x.xxx_hidden_Conditions = &v +} + +type RoleScopeConditions_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Type string + Conditions []*RoleScopeCondition +} + +func (b0 RoleScopeConditions_builder) Build() *RoleScopeConditions { + m0 := &RoleScopeConditions{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Type = b.Type + x.xxx_hidden_Conditions = &b.Conditions + return m0 +} + +type RoleScopeCondition struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Expression string `protobuf:"bytes,1,opt,name=expression,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RoleScopeCondition) Reset() { + *x = RoleScopeCondition{} + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RoleScopeCondition) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoleScopeCondition) ProtoMessage() {} + +func (x *RoleScopeCondition) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RoleScopeCondition) GetExpression() string { + if x != nil { + return x.xxx_hidden_Expression + } + return "" +} + +func (x *RoleScopeCondition) SetExpression(v string) { + x.xxx_hidden_Expression = v +} + +type RoleScopeCondition_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Expression string +} + +func (b0 RoleScopeCondition_builder) Build() *RoleScopeCondition { + m0 := &RoleScopeCondition{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Expression = b.Expression + return m0 +} + +// ScopeBindingTrait is used to scope a role to a resource or set of resources. +// The scope may be static (determined at crawl time) or dynamic (determined based on conditions). +// For example, in Azure a role definition can be scoped to a subscription, management group, or resource group. +// In that case, the role ID would be the resource ID of the role definition, and the scope resource ID would be the resource ID of the subscription, management group, or resource group. +type ScopeBindingTrait struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_RoleId *ResourceId `protobuf:"bytes,1,opt,name=role_id,json=roleId,proto3"` + xxx_hidden_ScopeResourceId *ResourceId `protobuf:"bytes,2,opt,name=scope_resource_id,json=scopeResourceId,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ScopeBindingTrait) Reset() { + *x = ScopeBindingTrait{} + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ScopeBindingTrait) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ScopeBindingTrait) ProtoMessage() {} + +func (x *ScopeBindingTrait) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ScopeBindingTrait) GetRoleId() *ResourceId { + if x != nil { + return x.xxx_hidden_RoleId + } + return nil +} + +func (x *ScopeBindingTrait) GetScopeResourceId() *ResourceId { + if x != nil { + return x.xxx_hidden_ScopeResourceId + } + return nil +} + +func (x *ScopeBindingTrait) SetRoleId(v *ResourceId) { + x.xxx_hidden_RoleId = v +} + +func (x *ScopeBindingTrait) SetScopeResourceId(v *ResourceId) { + x.xxx_hidden_ScopeResourceId = v +} + +func (x *ScopeBindingTrait) HasRoleId() bool { + if x == nil { + return false + } + return x.xxx_hidden_RoleId != nil +} + +func (x *ScopeBindingTrait) HasScopeResourceId() bool { + if x == nil { + return false + } + return x.xxx_hidden_ScopeResourceId != nil +} + +func (x *ScopeBindingTrait) ClearRoleId() { + x.xxx_hidden_RoleId = nil +} + +func (x *ScopeBindingTrait) ClearScopeResourceId() { + x.xxx_hidden_ScopeResourceId = nil +} + +type ScopeBindingTrait_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + RoleId *ResourceId + // Remove required if we add more ways to scope roles. (eg: Expressions.) + ScopeResourceId *ResourceId +} + +func (b0 ScopeBindingTrait_builder) Build() *ScopeBindingTrait { + m0 := &ScopeBindingTrait{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_RoleId = b.RoleId + x.xxx_hidden_ScopeResourceId = b.ScopeResourceId return m0 } @@ -663,7 +916,7 @@ type AppTrait struct { func (x *AppTrait) Reset() { *x = AppTrait{} - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[3] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -675,7 +928,7 @@ func (x *AppTrait) String() string { func (*AppTrait) ProtoMessage() {} func (x *AppTrait) ProtoReflect() protoreflect.Message { - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[3] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -810,7 +1063,7 @@ type SecretTrait struct { func (x *SecretTrait) Reset() { *x = SecretTrait{} - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[4] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -822,7 +1075,7 @@ func (x *SecretTrait) String() string { func (*SecretTrait) ProtoMessage() {} func (x *SecretTrait) ProtoReflect() protoreflect.Message { - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[4] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -999,7 +1252,7 @@ type UserTrait_Email struct { func (x *UserTrait_Email) Reset() { *x = UserTrait_Email{} - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[5] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1011,7 +1264,7 @@ func (x *UserTrait_Email) String() string { func (*UserTrait_Email) ProtoMessage() {} func (x *UserTrait_Email) ProtoReflect() protoreflect.Message { - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[5] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1071,7 +1324,7 @@ type UserTrait_Status struct { func (x *UserTrait_Status) Reset() { *x = UserTrait_Status{} - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[6] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1083,7 +1336,7 @@ func (x *UserTrait_Status) String() string { func (*UserTrait_Status) ProtoMessage() {} func (x *UserTrait_Status) ProtoReflect() protoreflect.Message { - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[6] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1141,7 +1394,7 @@ type UserTrait_MFAStatus struct { func (x *UserTrait_MFAStatus) Reset() { *x = UserTrait_MFAStatus{} - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[7] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1153,7 +1406,7 @@ func (x *UserTrait_MFAStatus) String() string { func (*UserTrait_MFAStatus) ProtoMessage() {} func (x *UserTrait_MFAStatus) ProtoReflect() protoreflect.Message { - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[7] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1198,7 +1451,7 @@ type UserTrait_SSOStatus struct { func (x *UserTrait_SSOStatus) Reset() { *x = UserTrait_SSOStatus{} - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[8] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1210,7 +1463,7 @@ func (x *UserTrait_SSOStatus) String() string { func (*UserTrait_SSOStatus) ProtoMessage() {} func (x *UserTrait_SSOStatus) ProtoReflect() protoreflect.Message { - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[8] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1259,7 +1512,7 @@ type UserTrait_StructuredName struct { func (x *UserTrait_StructuredName) Reset() { *x = UserTrait_StructuredName{} - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[9] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1271,7 +1524,7 @@ func (x *UserTrait_StructuredName) String() string { func (*UserTrait_StructuredName) ProtoMessage() {} func (x *UserTrait_StructuredName) ProtoReflect() protoreflect.Message { - mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[9] + mi := &file_c1_connector_v2_annotation_trait_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1418,9 +1671,22 @@ const file_c1_connector_v2_annotation_trait_proto_rawDesc = "" + "\n" + "GroupTrait\x12-\n" + "\x04icon\x18\x01 \x01(\v2\x19.c1.connector.v2.AssetRefR\x04icon\x121\n" + - "\aprofile\x18\x02 \x01(\v2\x17.google.protobuf.StructR\aprofile\">\n" + + "\aprofile\x18\x02 \x01(\v2\x17.google.protobuf.StructR\aprofile\"\x98\x01\n" + "\tRoleTrait\x121\n" + - "\aprofile\x18\x01 \x01(\v2\x17.google.protobuf.StructR\aprofile\"\x9a\x03\n" + + "\aprofile\x18\x01 \x01(\v2\x17.google.protobuf.StructR\aprofile\x12X\n" + + "\x15role_scope_conditions\x18\x02 \x01(\v2$.c1.connector.v2.RoleScopeConditionsR\x13roleScopeConditions\"n\n" + + "\x13RoleScopeConditions\x12\x12\n" + + "\x04type\x18\x01 \x01(\tR\x04type\x12C\n" + + "\n" + + "conditions\x18\x03 \x03(\v2#.c1.connector.v2.RoleScopeConditionR\n" + + "conditions\"4\n" + + "\x12RoleScopeCondition\x12\x1e\n" + + "\n" + + "expression\x18\x01 \x01(\tR\n" + + "expression\"\xa6\x01\n" + + "\x11ScopeBindingTrait\x12>\n" + + "\arole_id\x18\x01 \x01(\v2\x1b.c1.connector.v2.ResourceIdB\b\xfaB\x05\x8a\x01\x02\x10\x01R\x06roleId\x12Q\n" + + "\x11scope_resource_id\x18\x02 \x01(\v2\x1b.c1.connector.v2.ResourceIdB\b\xfaB\x05\x8a\x01\x02\x10\x01R\x0fscopeResourceId\"\x9a\x03\n" + "\bAppTrait\x125\n" + "\bhelp_url\x18\x01 \x01(\tB\x1a\xfaB\x17r\x15 \x01(\x80\b:\bhttps://\xd0\x01\x01\x88\x01\x01R\ahelpUrl\x12-\n" + "\x04icon\x18\x02 \x01(\v2\x19.c1.connector.v2.AssetRefR\x04icon\x12-\n" + @@ -1447,7 +1713,7 @@ const file_c1_connector_v2_annotation_trait_proto_rawDesc = "" + "identityIdB6Z4github.com/conductorone/baton-sdk/pb/c1/connector/v2b\x06proto3" var file_c1_connector_v2_annotation_trait_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file_c1_connector_v2_annotation_trait_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_c1_connector_v2_annotation_trait_proto_msgTypes = make([]protoimpl.MessageInfo, 13) var file_c1_connector_v2_annotation_trait_proto_goTypes = []any{ (UserTrait_AccountType)(0), // 0: c1.connector.v2.UserTrait.AccountType (UserTrait_Status_Status)(0), // 1: c1.connector.v2.UserTrait.Status.Status @@ -1455,48 +1721,55 @@ var file_c1_connector_v2_annotation_trait_proto_goTypes = []any{ (*UserTrait)(nil), // 3: c1.connector.v2.UserTrait (*GroupTrait)(nil), // 4: c1.connector.v2.GroupTrait (*RoleTrait)(nil), // 5: c1.connector.v2.RoleTrait - (*AppTrait)(nil), // 6: c1.connector.v2.AppTrait - (*SecretTrait)(nil), // 7: c1.connector.v2.SecretTrait - (*UserTrait_Email)(nil), // 8: c1.connector.v2.UserTrait.Email - (*UserTrait_Status)(nil), // 9: c1.connector.v2.UserTrait.Status - (*UserTrait_MFAStatus)(nil), // 10: c1.connector.v2.UserTrait.MFAStatus - (*UserTrait_SSOStatus)(nil), // 11: c1.connector.v2.UserTrait.SSOStatus - (*UserTrait_StructuredName)(nil), // 12: c1.connector.v2.UserTrait.StructuredName - (*structpb.Struct)(nil), // 13: google.protobuf.Struct - (*AssetRef)(nil), // 14: c1.connector.v2.AssetRef - (*timestamppb.Timestamp)(nil), // 15: google.protobuf.Timestamp - (*ResourceId)(nil), // 16: c1.connector.v2.ResourceId + (*RoleScopeConditions)(nil), // 6: c1.connector.v2.RoleScopeConditions + (*RoleScopeCondition)(nil), // 7: c1.connector.v2.RoleScopeCondition + (*ScopeBindingTrait)(nil), // 8: c1.connector.v2.ScopeBindingTrait + (*AppTrait)(nil), // 9: c1.connector.v2.AppTrait + (*SecretTrait)(nil), // 10: c1.connector.v2.SecretTrait + (*UserTrait_Email)(nil), // 11: c1.connector.v2.UserTrait.Email + (*UserTrait_Status)(nil), // 12: c1.connector.v2.UserTrait.Status + (*UserTrait_MFAStatus)(nil), // 13: c1.connector.v2.UserTrait.MFAStatus + (*UserTrait_SSOStatus)(nil), // 14: c1.connector.v2.UserTrait.SSOStatus + (*UserTrait_StructuredName)(nil), // 15: c1.connector.v2.UserTrait.StructuredName + (*structpb.Struct)(nil), // 16: google.protobuf.Struct + (*AssetRef)(nil), // 17: c1.connector.v2.AssetRef + (*timestamppb.Timestamp)(nil), // 18: google.protobuf.Timestamp + (*ResourceId)(nil), // 19: c1.connector.v2.ResourceId } var file_c1_connector_v2_annotation_trait_proto_depIdxs = []int32{ - 8, // 0: c1.connector.v2.UserTrait.emails:type_name -> c1.connector.v2.UserTrait.Email - 9, // 1: c1.connector.v2.UserTrait.status:type_name -> c1.connector.v2.UserTrait.Status - 13, // 2: c1.connector.v2.UserTrait.profile:type_name -> google.protobuf.Struct - 14, // 3: c1.connector.v2.UserTrait.icon:type_name -> c1.connector.v2.AssetRef + 11, // 0: c1.connector.v2.UserTrait.emails:type_name -> c1.connector.v2.UserTrait.Email + 12, // 1: c1.connector.v2.UserTrait.status:type_name -> c1.connector.v2.UserTrait.Status + 16, // 2: c1.connector.v2.UserTrait.profile:type_name -> google.protobuf.Struct + 17, // 3: c1.connector.v2.UserTrait.icon:type_name -> c1.connector.v2.AssetRef 0, // 4: c1.connector.v2.UserTrait.account_type:type_name -> c1.connector.v2.UserTrait.AccountType - 15, // 5: c1.connector.v2.UserTrait.created_at:type_name -> google.protobuf.Timestamp - 15, // 6: c1.connector.v2.UserTrait.last_login:type_name -> google.protobuf.Timestamp - 10, // 7: c1.connector.v2.UserTrait.mfa_status:type_name -> c1.connector.v2.UserTrait.MFAStatus - 11, // 8: c1.connector.v2.UserTrait.sso_status:type_name -> c1.connector.v2.UserTrait.SSOStatus - 12, // 9: c1.connector.v2.UserTrait.structured_name:type_name -> c1.connector.v2.UserTrait.StructuredName - 14, // 10: c1.connector.v2.GroupTrait.icon:type_name -> c1.connector.v2.AssetRef - 13, // 11: c1.connector.v2.GroupTrait.profile:type_name -> google.protobuf.Struct - 13, // 12: c1.connector.v2.RoleTrait.profile:type_name -> google.protobuf.Struct - 14, // 13: c1.connector.v2.AppTrait.icon:type_name -> c1.connector.v2.AssetRef - 14, // 14: c1.connector.v2.AppTrait.logo:type_name -> c1.connector.v2.AssetRef - 13, // 15: c1.connector.v2.AppTrait.profile:type_name -> google.protobuf.Struct - 2, // 16: c1.connector.v2.AppTrait.flags:type_name -> c1.connector.v2.AppTrait.AppFlag - 13, // 17: c1.connector.v2.SecretTrait.profile:type_name -> google.protobuf.Struct - 15, // 18: c1.connector.v2.SecretTrait.created_at:type_name -> google.protobuf.Timestamp - 15, // 19: c1.connector.v2.SecretTrait.expires_at:type_name -> google.protobuf.Timestamp - 15, // 20: c1.connector.v2.SecretTrait.last_used_at:type_name -> google.protobuf.Timestamp - 16, // 21: c1.connector.v2.SecretTrait.created_by_id:type_name -> c1.connector.v2.ResourceId - 16, // 22: c1.connector.v2.SecretTrait.identity_id:type_name -> c1.connector.v2.ResourceId - 1, // 23: c1.connector.v2.UserTrait.Status.status:type_name -> c1.connector.v2.UserTrait.Status.Status - 24, // [24:24] is the sub-list for method output_type - 24, // [24:24] is the sub-list for method input_type - 24, // [24:24] is the sub-list for extension type_name - 24, // [24:24] is the sub-list for extension extendee - 0, // [0:24] is the sub-list for field type_name + 18, // 5: c1.connector.v2.UserTrait.created_at:type_name -> google.protobuf.Timestamp + 18, // 6: c1.connector.v2.UserTrait.last_login:type_name -> google.protobuf.Timestamp + 13, // 7: c1.connector.v2.UserTrait.mfa_status:type_name -> c1.connector.v2.UserTrait.MFAStatus + 14, // 8: c1.connector.v2.UserTrait.sso_status:type_name -> c1.connector.v2.UserTrait.SSOStatus + 15, // 9: c1.connector.v2.UserTrait.structured_name:type_name -> c1.connector.v2.UserTrait.StructuredName + 17, // 10: c1.connector.v2.GroupTrait.icon:type_name -> c1.connector.v2.AssetRef + 16, // 11: c1.connector.v2.GroupTrait.profile:type_name -> google.protobuf.Struct + 16, // 12: c1.connector.v2.RoleTrait.profile:type_name -> google.protobuf.Struct + 6, // 13: c1.connector.v2.RoleTrait.role_scope_conditions:type_name -> c1.connector.v2.RoleScopeConditions + 7, // 14: c1.connector.v2.RoleScopeConditions.conditions:type_name -> c1.connector.v2.RoleScopeCondition + 19, // 15: c1.connector.v2.ScopeBindingTrait.role_id:type_name -> c1.connector.v2.ResourceId + 19, // 16: c1.connector.v2.ScopeBindingTrait.scope_resource_id:type_name -> c1.connector.v2.ResourceId + 17, // 17: c1.connector.v2.AppTrait.icon:type_name -> c1.connector.v2.AssetRef + 17, // 18: c1.connector.v2.AppTrait.logo:type_name -> c1.connector.v2.AssetRef + 16, // 19: c1.connector.v2.AppTrait.profile:type_name -> google.protobuf.Struct + 2, // 20: c1.connector.v2.AppTrait.flags:type_name -> c1.connector.v2.AppTrait.AppFlag + 16, // 21: c1.connector.v2.SecretTrait.profile:type_name -> google.protobuf.Struct + 18, // 22: c1.connector.v2.SecretTrait.created_at:type_name -> google.protobuf.Timestamp + 18, // 23: c1.connector.v2.SecretTrait.expires_at:type_name -> google.protobuf.Timestamp + 18, // 24: c1.connector.v2.SecretTrait.last_used_at:type_name -> google.protobuf.Timestamp + 19, // 25: c1.connector.v2.SecretTrait.created_by_id:type_name -> c1.connector.v2.ResourceId + 19, // 26: c1.connector.v2.SecretTrait.identity_id:type_name -> c1.connector.v2.ResourceId + 1, // 27: c1.connector.v2.UserTrait.Status.status:type_name -> c1.connector.v2.UserTrait.Status.Status + 28, // [28:28] is the sub-list for method output_type + 28, // [28:28] is the sub-list for method input_type + 28, // [28:28] is the sub-list for extension type_name + 28, // [28:28] is the sub-list for extension extendee + 0, // [0:28] is the sub-list for field type_name } func init() { file_c1_connector_v2_annotation_trait_proto_init() } @@ -1512,7 +1785,7 @@ func file_c1_connector_v2_annotation_trait_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_c1_connector_v2_annotation_trait_proto_rawDesc), len(file_c1_connector_v2_annotation_trait_proto_rawDesc)), NumEnums: 3, - NumMessages: 10, + NumMessages: 13, NumExtensions: 0, NumServices: 0, }, diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/connector.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/connector.pb.go index 21ac6d98..8795297d 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/connector.pb.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/connector.pb.go @@ -28,19 +28,20 @@ const ( type Capability int32 const ( - Capability_CAPABILITY_UNSPECIFIED Capability = 0 - Capability_CAPABILITY_PROVISION Capability = 1 - Capability_CAPABILITY_SYNC Capability = 2 - Capability_CAPABILITY_EVENT_FEED Capability = 3 - Capability_CAPABILITY_TICKETING Capability = 4 - Capability_CAPABILITY_ACCOUNT_PROVISIONING Capability = 5 - Capability_CAPABILITY_CREDENTIAL_ROTATION Capability = 6 - Capability_CAPABILITY_RESOURCE_CREATE Capability = 7 - Capability_CAPABILITY_RESOURCE_DELETE Capability = 8 - Capability_CAPABILITY_SYNC_SECRETS Capability = 9 - Capability_CAPABILITY_ACTIONS Capability = 10 - Capability_CAPABILITY_TARGETED_SYNC Capability = 11 - Capability_CAPABILITY_EVENT_FEED_V2 Capability = 12 + Capability_CAPABILITY_UNSPECIFIED Capability = 0 + Capability_CAPABILITY_PROVISION Capability = 1 + Capability_CAPABILITY_SYNC Capability = 2 + Capability_CAPABILITY_EVENT_FEED Capability = 3 + Capability_CAPABILITY_TICKETING Capability = 4 + Capability_CAPABILITY_ACCOUNT_PROVISIONING Capability = 5 + Capability_CAPABILITY_CREDENTIAL_ROTATION Capability = 6 + Capability_CAPABILITY_RESOURCE_CREATE Capability = 7 + Capability_CAPABILITY_RESOURCE_DELETE Capability = 8 + Capability_CAPABILITY_SYNC_SECRETS Capability = 9 + Capability_CAPABILITY_ACTIONS Capability = 10 + Capability_CAPABILITY_TARGETED_SYNC Capability = 11 + Capability_CAPABILITY_EVENT_FEED_V2 Capability = 12 + Capability_CAPABILITY_SERVICE_MODE_TARGETED_SYNC Capability = 13 ) // Enum value maps for Capability. @@ -59,21 +60,23 @@ var ( 10: "CAPABILITY_ACTIONS", 11: "CAPABILITY_TARGETED_SYNC", 12: "CAPABILITY_EVENT_FEED_V2", + 13: "CAPABILITY_SERVICE_MODE_TARGETED_SYNC", } Capability_value = map[string]int32{ - "CAPABILITY_UNSPECIFIED": 0, - "CAPABILITY_PROVISION": 1, - "CAPABILITY_SYNC": 2, - "CAPABILITY_EVENT_FEED": 3, - "CAPABILITY_TICKETING": 4, - "CAPABILITY_ACCOUNT_PROVISIONING": 5, - "CAPABILITY_CREDENTIAL_ROTATION": 6, - "CAPABILITY_RESOURCE_CREATE": 7, - "CAPABILITY_RESOURCE_DELETE": 8, - "CAPABILITY_SYNC_SECRETS": 9, - "CAPABILITY_ACTIONS": 10, - "CAPABILITY_TARGETED_SYNC": 11, - "CAPABILITY_EVENT_FEED_V2": 12, + "CAPABILITY_UNSPECIFIED": 0, + "CAPABILITY_PROVISION": 1, + "CAPABILITY_SYNC": 2, + "CAPABILITY_EVENT_FEED": 3, + "CAPABILITY_TICKETING": 4, + "CAPABILITY_ACCOUNT_PROVISIONING": 5, + "CAPABILITY_CREDENTIAL_ROTATION": 6, + "CAPABILITY_RESOURCE_CREATE": 7, + "CAPABILITY_RESOURCE_DELETE": 8, + "CAPABILITY_SYNC_SECRETS": 9, + "CAPABILITY_ACTIONS": 10, + "CAPABILITY_TARGETED_SYNC": 11, + "CAPABILITY_EVENT_FEED_V2": 12, + "CAPABILITY_SERVICE_MODE_TARGETED_SYNC": 13, } ) @@ -2151,7 +2154,7 @@ const file_c1_connector_v2_connector_proto_rawDesc = "" + "\rdefault_value\x18\x01 \x03(\v2J.c1.connector.v2.ConnectorAccountCreationSchema.MapField.DefaultValueEntryR\fdefaultValue\x1av\n" + "\x11DefaultValueEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12K\n" + - "\x05value\x18\x02 \x01(\v25.c1.connector.v2.ConnectorAccountCreationSchema.FieldR\x05value:\x028\x01*\x86\x03\n" + + "\x05value\x18\x02 \x01(\v25.c1.connector.v2.ConnectorAccountCreationSchema.FieldR\x05value:\x028\x01*\xb1\x03\n" + "\n" + "Capability\x12\x1a\n" + "\x16CAPABILITY_UNSPECIFIED\x10\x00\x12\x18\n" + @@ -2167,7 +2170,8 @@ const file_c1_connector_v2_connector_proto_rawDesc = "" + "\x12CAPABILITY_ACTIONS\x10\n" + "\x12\x1c\n" + "\x18CAPABILITY_TARGETED_SYNC\x10\v\x12\x1c\n" + - "\x18CAPABILITY_EVENT_FEED_V2\x10\f*\xae\x02\n" + + "\x18CAPABILITY_EVENT_FEED_V2\x10\f\x12)\n" + + "%CAPABILITY_SERVICE_MODE_TARGETED_SYNC\x10\r*\xae\x02\n" + " CapabilityDetailCredentialOption\x123\n" + "/CAPABILITY_DETAIL_CREDENTIAL_OPTION_UNSPECIFIED\x10\x00\x123\n" + "/CAPABILITY_DETAIL_CREDENTIAL_OPTION_NO_PASSWORD\x10\x01\x127\n" + diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/connector_protoopaque.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/connector_protoopaque.pb.go index e8ec7de5..2025995c 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/connector_protoopaque.pb.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/connector_protoopaque.pb.go @@ -28,19 +28,20 @@ const ( type Capability int32 const ( - Capability_CAPABILITY_UNSPECIFIED Capability = 0 - Capability_CAPABILITY_PROVISION Capability = 1 - Capability_CAPABILITY_SYNC Capability = 2 - Capability_CAPABILITY_EVENT_FEED Capability = 3 - Capability_CAPABILITY_TICKETING Capability = 4 - Capability_CAPABILITY_ACCOUNT_PROVISIONING Capability = 5 - Capability_CAPABILITY_CREDENTIAL_ROTATION Capability = 6 - Capability_CAPABILITY_RESOURCE_CREATE Capability = 7 - Capability_CAPABILITY_RESOURCE_DELETE Capability = 8 - Capability_CAPABILITY_SYNC_SECRETS Capability = 9 - Capability_CAPABILITY_ACTIONS Capability = 10 - Capability_CAPABILITY_TARGETED_SYNC Capability = 11 - Capability_CAPABILITY_EVENT_FEED_V2 Capability = 12 + Capability_CAPABILITY_UNSPECIFIED Capability = 0 + Capability_CAPABILITY_PROVISION Capability = 1 + Capability_CAPABILITY_SYNC Capability = 2 + Capability_CAPABILITY_EVENT_FEED Capability = 3 + Capability_CAPABILITY_TICKETING Capability = 4 + Capability_CAPABILITY_ACCOUNT_PROVISIONING Capability = 5 + Capability_CAPABILITY_CREDENTIAL_ROTATION Capability = 6 + Capability_CAPABILITY_RESOURCE_CREATE Capability = 7 + Capability_CAPABILITY_RESOURCE_DELETE Capability = 8 + Capability_CAPABILITY_SYNC_SECRETS Capability = 9 + Capability_CAPABILITY_ACTIONS Capability = 10 + Capability_CAPABILITY_TARGETED_SYNC Capability = 11 + Capability_CAPABILITY_EVENT_FEED_V2 Capability = 12 + Capability_CAPABILITY_SERVICE_MODE_TARGETED_SYNC Capability = 13 ) // Enum value maps for Capability. @@ -59,21 +60,23 @@ var ( 10: "CAPABILITY_ACTIONS", 11: "CAPABILITY_TARGETED_SYNC", 12: "CAPABILITY_EVENT_FEED_V2", + 13: "CAPABILITY_SERVICE_MODE_TARGETED_SYNC", } Capability_value = map[string]int32{ - "CAPABILITY_UNSPECIFIED": 0, - "CAPABILITY_PROVISION": 1, - "CAPABILITY_SYNC": 2, - "CAPABILITY_EVENT_FEED": 3, - "CAPABILITY_TICKETING": 4, - "CAPABILITY_ACCOUNT_PROVISIONING": 5, - "CAPABILITY_CREDENTIAL_ROTATION": 6, - "CAPABILITY_RESOURCE_CREATE": 7, - "CAPABILITY_RESOURCE_DELETE": 8, - "CAPABILITY_SYNC_SECRETS": 9, - "CAPABILITY_ACTIONS": 10, - "CAPABILITY_TARGETED_SYNC": 11, - "CAPABILITY_EVENT_FEED_V2": 12, + "CAPABILITY_UNSPECIFIED": 0, + "CAPABILITY_PROVISION": 1, + "CAPABILITY_SYNC": 2, + "CAPABILITY_EVENT_FEED": 3, + "CAPABILITY_TICKETING": 4, + "CAPABILITY_ACCOUNT_PROVISIONING": 5, + "CAPABILITY_CREDENTIAL_ROTATION": 6, + "CAPABILITY_RESOURCE_CREATE": 7, + "CAPABILITY_RESOURCE_DELETE": 8, + "CAPABILITY_SYNC_SECRETS": 9, + "CAPABILITY_ACTIONS": 10, + "CAPABILITY_TARGETED_SYNC": 11, + "CAPABILITY_EVENT_FEED_V2": 12, + "CAPABILITY_SERVICE_MODE_TARGETED_SYNC": 13, } ) @@ -2173,7 +2176,7 @@ const file_c1_connector_v2_connector_proto_rawDesc = "" + "\rdefault_value\x18\x01 \x03(\v2J.c1.connector.v2.ConnectorAccountCreationSchema.MapField.DefaultValueEntryR\fdefaultValue\x1av\n" + "\x11DefaultValueEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12K\n" + - "\x05value\x18\x02 \x01(\v25.c1.connector.v2.ConnectorAccountCreationSchema.FieldR\x05value:\x028\x01*\x86\x03\n" + + "\x05value\x18\x02 \x01(\v25.c1.connector.v2.ConnectorAccountCreationSchema.FieldR\x05value:\x028\x01*\xb1\x03\n" + "\n" + "Capability\x12\x1a\n" + "\x16CAPABILITY_UNSPECIFIED\x10\x00\x12\x18\n" + @@ -2189,7 +2192,8 @@ const file_c1_connector_v2_connector_proto_rawDesc = "" + "\x12CAPABILITY_ACTIONS\x10\n" + "\x12\x1c\n" + "\x18CAPABILITY_TARGETED_SYNC\x10\v\x12\x1c\n" + - "\x18CAPABILITY_EVENT_FEED_V2\x10\f*\xae\x02\n" + + "\x18CAPABILITY_EVENT_FEED_V2\x10\f\x12)\n" + + "%CAPABILITY_SERVICE_MODE_TARGETED_SYNC\x10\r*\xae\x02\n" + " CapabilityDetailCredentialOption\x123\n" + "/CAPABILITY_DETAIL_CREDENTIAL_OPTION_UNSPECIFIED\x10\x00\x123\n" + "/CAPABILITY_DETAIL_CREDENTIAL_OPTION_NO_PASSWORD\x10\x01\x127\n" + diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/entitlement.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/entitlement.pb.go index fca3e908..d1926c4a 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/entitlement.pb.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/entitlement.pb.go @@ -30,6 +30,7 @@ const ( Entitlement_PURPOSE_VALUE_UNSPECIFIED Entitlement_PurposeValue = 0 Entitlement_PURPOSE_VALUE_ASSIGNMENT Entitlement_PurposeValue = 1 Entitlement_PURPOSE_VALUE_PERMISSION Entitlement_PurposeValue = 2 + Entitlement_PURPOSE_VALUE_OWNERSHIP Entitlement_PurposeValue = 3 ) // Enum value maps for Entitlement_PurposeValue. @@ -38,11 +39,13 @@ var ( 0: "PURPOSE_VALUE_UNSPECIFIED", 1: "PURPOSE_VALUE_ASSIGNMENT", 2: "PURPOSE_VALUE_PERMISSION", + 3: "PURPOSE_VALUE_OWNERSHIP", } Entitlement_PurposeValue_value = map[string]int32{ "PURPOSE_VALUE_UNSPECIFIED": 0, "PURPOSE_VALUE_ASSIGNMENT": 1, "PURPOSE_VALUE_PERMISSION": 2, + "PURPOSE_VALUE_OWNERSHIP": 3, } ) @@ -645,7 +648,7 @@ var File_c1_connector_v2_entitlement_proto protoreflect.FileDescriptor const file_c1_connector_v2_entitlement_proto_rawDesc = "" + "\n" + - "!c1/connector/v2/entitlement.proto\x12\x0fc1.connector.v2\x1a\x1ec1/connector/v2/resource.proto\x1a\x19google/protobuf/any.proto\x1a\x17validate/validate.proto\"\x95\x04\n" + + "!c1/connector/v2/entitlement.proto\x12\x0fc1.connector.v2\x1a\x1ec1/connector/v2/resource.proto\x1a\x19google/protobuf/any.proto\x1a\x17validate/validate.proto\"\xb3\x04\n" + "\vEntitlement\x12?\n" + "\bresource\x18\x01 \x01(\v2\x19.c1.connector.v2.ResourceB\b\xfaB\x05\x8a\x01\x02\x10\x01R\bresource\x12\x1a\n" + "\x02id\x18\x02 \x01(\tB\n" + @@ -657,11 +660,12 @@ const file_c1_connector_v2_entitlement_proto_rawDesc = "" + "\fgrantable_to\x18\x05 \x03(\v2\x1d.c1.connector.v2.ResourceTypeR\vgrantableTo\x126\n" + "\vannotations\x18\x06 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x12M\n" + "\apurpose\x18\a \x01(\x0e2).c1.connector.v2.Entitlement.PurposeValueB\b\xfaB\x05\x82\x01\x02\x10\x01R\apurpose\x12\x12\n" + - "\x04slug\x18\b \x01(\tR\x04slug\"i\n" + + "\x04slug\x18\b \x01(\tR\x04slug\"\x86\x01\n" + "\fPurposeValue\x12\x1d\n" + "\x19PURPOSE_VALUE_UNSPECIFIED\x10\x00\x12\x1c\n" + "\x18PURPOSE_VALUE_ASSIGNMENT\x10\x01\x12\x1c\n" + - "\x18PURPOSE_VALUE_PERMISSION\x10\x02\"\xa8\x02\n" + + "\x18PURPOSE_VALUE_PERMISSION\x10\x02\x12\x1b\n" + + "\x17PURPOSE_VALUE_OWNERSHIP\x10\x03\"\xa8\x02\n" + "*EntitlementsServiceListEntitlementsRequest\x125\n" + "\bresource\x18\x01 \x01(\v2\x19.c1.connector.v2.ResourceR\bresource\x12'\n" + "\tpage_size\x18\x02 \x01(\rB\n" + diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/entitlement_protoopaque.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/entitlement_protoopaque.pb.go index 88a1142b..0fc2b471 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/entitlement_protoopaque.pb.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/entitlement_protoopaque.pb.go @@ -30,6 +30,7 @@ const ( Entitlement_PURPOSE_VALUE_UNSPECIFIED Entitlement_PurposeValue = 0 Entitlement_PURPOSE_VALUE_ASSIGNMENT Entitlement_PurposeValue = 1 Entitlement_PURPOSE_VALUE_PERMISSION Entitlement_PurposeValue = 2 + Entitlement_PURPOSE_VALUE_OWNERSHIP Entitlement_PurposeValue = 3 ) // Enum value maps for Entitlement_PurposeValue. @@ -38,11 +39,13 @@ var ( 0: "PURPOSE_VALUE_UNSPECIFIED", 1: "PURPOSE_VALUE_ASSIGNMENT", 2: "PURPOSE_VALUE_PERMISSION", + 3: "PURPOSE_VALUE_OWNERSHIP", } Entitlement_PurposeValue_value = map[string]int32{ "PURPOSE_VALUE_UNSPECIFIED": 0, "PURPOSE_VALUE_ASSIGNMENT": 1, "PURPOSE_VALUE_PERMISSION": 2, + "PURPOSE_VALUE_OWNERSHIP": 3, } ) @@ -661,7 +664,7 @@ var File_c1_connector_v2_entitlement_proto protoreflect.FileDescriptor const file_c1_connector_v2_entitlement_proto_rawDesc = "" + "\n" + - "!c1/connector/v2/entitlement.proto\x12\x0fc1.connector.v2\x1a\x1ec1/connector/v2/resource.proto\x1a\x19google/protobuf/any.proto\x1a\x17validate/validate.proto\"\x95\x04\n" + + "!c1/connector/v2/entitlement.proto\x12\x0fc1.connector.v2\x1a\x1ec1/connector/v2/resource.proto\x1a\x19google/protobuf/any.proto\x1a\x17validate/validate.proto\"\xb3\x04\n" + "\vEntitlement\x12?\n" + "\bresource\x18\x01 \x01(\v2\x19.c1.connector.v2.ResourceB\b\xfaB\x05\x8a\x01\x02\x10\x01R\bresource\x12\x1a\n" + "\x02id\x18\x02 \x01(\tB\n" + @@ -673,11 +676,12 @@ const file_c1_connector_v2_entitlement_proto_rawDesc = "" + "\fgrantable_to\x18\x05 \x03(\v2\x1d.c1.connector.v2.ResourceTypeR\vgrantableTo\x126\n" + "\vannotations\x18\x06 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x12M\n" + "\apurpose\x18\a \x01(\x0e2).c1.connector.v2.Entitlement.PurposeValueB\b\xfaB\x05\x82\x01\x02\x10\x01R\apurpose\x12\x12\n" + - "\x04slug\x18\b \x01(\tR\x04slug\"i\n" + + "\x04slug\x18\b \x01(\tR\x04slug\"\x86\x01\n" + "\fPurposeValue\x12\x1d\n" + "\x19PURPOSE_VALUE_UNSPECIFIED\x10\x00\x12\x1c\n" + "\x18PURPOSE_VALUE_ASSIGNMENT\x10\x01\x12\x1c\n" + - "\x18PURPOSE_VALUE_PERMISSION\x10\x02\"\xa8\x02\n" + + "\x18PURPOSE_VALUE_PERMISSION\x10\x02\x12\x1b\n" + + "\x17PURPOSE_VALUE_OWNERSHIP\x10\x03\"\xa8\x02\n" + "*EntitlementsServiceListEntitlementsRequest\x125\n" + "\bresource\x18\x01 \x01(\v2\x19.c1.connector.v2.ResourceR\bresource\x12'\n" + "\tpage_size\x18\x02 \x01(\rB\n" + diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/resource.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/resource.pb.go index f09a6418..34601877 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/resource.pb.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/resource.pb.go @@ -28,12 +28,14 @@ const ( type ResourceType_Trait int32 const ( - ResourceType_TRAIT_UNSPECIFIED ResourceType_Trait = 0 - ResourceType_TRAIT_USER ResourceType_Trait = 1 - ResourceType_TRAIT_GROUP ResourceType_Trait = 2 - ResourceType_TRAIT_ROLE ResourceType_Trait = 3 - ResourceType_TRAIT_APP ResourceType_Trait = 4 - ResourceType_TRAIT_SECRET ResourceType_Trait = 5 + ResourceType_TRAIT_UNSPECIFIED ResourceType_Trait = 0 + ResourceType_TRAIT_USER ResourceType_Trait = 1 + ResourceType_TRAIT_GROUP ResourceType_Trait = 2 + ResourceType_TRAIT_ROLE ResourceType_Trait = 3 + ResourceType_TRAIT_APP ResourceType_Trait = 4 + ResourceType_TRAIT_SECRET ResourceType_Trait = 5 + ResourceType_TRAIT_SECURITY_INSIGHT ResourceType_Trait = 6 + ResourceType_TRAIT_SCOPE_BINDING ResourceType_Trait = 7 ) // Enum value maps for ResourceType_Trait. @@ -45,14 +47,18 @@ var ( 3: "TRAIT_ROLE", 4: "TRAIT_APP", 5: "TRAIT_SECRET", + 6: "TRAIT_SECURITY_INSIGHT", + 7: "TRAIT_SCOPE_BINDING", } ResourceType_Trait_value = map[string]int32{ - "TRAIT_UNSPECIFIED": 0, - "TRAIT_USER": 1, - "TRAIT_GROUP": 2, - "TRAIT_ROLE": 3, - "TRAIT_APP": 4, - "TRAIT_SECRET": 5, + "TRAIT_UNSPECIFIED": 0, + "TRAIT_USER": 1, + "TRAIT_GROUP": 2, + "TRAIT_ROLE": 3, + "TRAIT_APP": 4, + "TRAIT_SECRET": 5, + "TRAIT_SECURITY_INSIGHT": 6, + "TRAIT_SCOPE_BINDING": 7, } ) @@ -78,7 +84,6 @@ func (x ResourceType_Trait) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } -// FIXME(mstanbCO): call this something else? Should it just be a bool? Possibly just use an annotation? type Resource_CreationSource int32 const ( @@ -1875,6 +1880,7 @@ type CreateAccountRequest struct { AccountInfo *AccountInfo `protobuf:"bytes,1,opt,name=account_info,json=accountInfo,proto3" json:"account_info,omitempty"` CredentialOptions *CredentialOptions `protobuf:"bytes,2,opt,name=credential_options,json=credentialOptions,proto3" json:"credential_options,omitempty"` EncryptionConfigs []*EncryptionConfig `protobuf:"bytes,3,rep,name=encryption_configs,json=encryptionConfigs,proto3" json:"encryption_configs,omitempty"` + ResourceTypeId string `protobuf:"bytes,4,opt,name=resource_type_id,json=resourceTypeId,proto3" json:"resource_type_id,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -1925,6 +1931,13 @@ func (x *CreateAccountRequest) GetEncryptionConfigs() []*EncryptionConfig { return nil } +func (x *CreateAccountRequest) GetResourceTypeId() string { + if x != nil { + return x.ResourceTypeId + } + return "" +} + func (x *CreateAccountRequest) SetAccountInfo(v *AccountInfo) { x.AccountInfo = v } @@ -1937,6 +1950,10 @@ func (x *CreateAccountRequest) SetEncryptionConfigs(v []*EncryptionConfig) { x.EncryptionConfigs = v } +func (x *CreateAccountRequest) SetResourceTypeId(v string) { + x.ResourceTypeId = v +} + func (x *CreateAccountRequest) HasAccountInfo() bool { if x == nil { return false @@ -1965,6 +1982,7 @@ type CreateAccountRequest_builder struct { AccountInfo *AccountInfo CredentialOptions *CredentialOptions EncryptionConfigs []*EncryptionConfig + ResourceTypeId string } func (b0 CreateAccountRequest_builder) Build() *CreateAccountRequest { @@ -1974,6 +1992,7 @@ func (b0 CreateAccountRequest_builder) Build() *CreateAccountRequest { x.AccountInfo = b.AccountInfo x.CredentialOptions = b.CredentialOptions x.EncryptionConfigs = b.EncryptionConfigs + x.ResourceTypeId = b.ResourceTypeId return m0 } @@ -1983,6 +2002,8 @@ type CreateAccountResponse struct { // // *CreateAccountResponse_Success // *CreateAccountResponse_ActionRequired + // *CreateAccountResponse_AlreadyExists + // *CreateAccountResponse_InProgress Result isCreateAccountResponse_Result `protobuf_oneof:"result"` EncryptedData []*EncryptedData `protobuf:"bytes,2,rep,name=encrypted_data,json=encryptedData,proto3" json:"encrypted_data,omitempty"` Annotations []*anypb.Any `protobuf:"bytes,3,rep,name=annotations,proto3" json:"annotations,omitempty"` @@ -2040,6 +2061,24 @@ func (x *CreateAccountResponse) GetActionRequired() *CreateAccountResponse_Actio return nil } +func (x *CreateAccountResponse) GetAlreadyExists() *CreateAccountResponse_AlreadyExistsResult { + if x != nil { + if x, ok := x.Result.(*CreateAccountResponse_AlreadyExists); ok { + return x.AlreadyExists + } + } + return nil +} + +func (x *CreateAccountResponse) GetInProgress() *CreateAccountResponse_InProgressResult { + if x != nil { + if x, ok := x.Result.(*CreateAccountResponse_InProgress); ok { + return x.InProgress + } + } + return nil +} + func (x *CreateAccountResponse) GetEncryptedData() []*EncryptedData { if x != nil { return x.EncryptedData @@ -2070,6 +2109,22 @@ func (x *CreateAccountResponse) SetActionRequired(v *CreateAccountResponse_Actio x.Result = &CreateAccountResponse_ActionRequired{v} } +func (x *CreateAccountResponse) SetAlreadyExists(v *CreateAccountResponse_AlreadyExistsResult) { + if v == nil { + x.Result = nil + return + } + x.Result = &CreateAccountResponse_AlreadyExists{v} +} + +func (x *CreateAccountResponse) SetInProgress(v *CreateAccountResponse_InProgressResult) { + if v == nil { + x.Result = nil + return + } + x.Result = &CreateAccountResponse_InProgress{v} +} + func (x *CreateAccountResponse) SetEncryptedData(v []*EncryptedData) { x.EncryptedData = v } @@ -2101,6 +2156,22 @@ func (x *CreateAccountResponse) HasActionRequired() bool { return ok } +func (x *CreateAccountResponse) HasAlreadyExists() bool { + if x == nil { + return false + } + _, ok := x.Result.(*CreateAccountResponse_AlreadyExists) + return ok +} + +func (x *CreateAccountResponse) HasInProgress() bool { + if x == nil { + return false + } + _, ok := x.Result.(*CreateAccountResponse_InProgress) + return ok +} + func (x *CreateAccountResponse) ClearResult() { x.Result = nil } @@ -2117,9 +2188,23 @@ func (x *CreateAccountResponse) ClearActionRequired() { } } +func (x *CreateAccountResponse) ClearAlreadyExists() { + if _, ok := x.Result.(*CreateAccountResponse_AlreadyExists); ok { + x.Result = nil + } +} + +func (x *CreateAccountResponse) ClearInProgress() { + if _, ok := x.Result.(*CreateAccountResponse_InProgress); ok { + x.Result = nil + } +} + const CreateAccountResponse_Result_not_set_case case_CreateAccountResponse_Result = 0 const CreateAccountResponse_Success_case case_CreateAccountResponse_Result = 100 const CreateAccountResponse_ActionRequired_case case_CreateAccountResponse_Result = 101 +const CreateAccountResponse_AlreadyExists_case case_CreateAccountResponse_Result = 102 +const CreateAccountResponse_InProgress_case case_CreateAccountResponse_Result = 103 func (x *CreateAccountResponse) WhichResult() case_CreateAccountResponse_Result { if x == nil { @@ -2130,6 +2215,10 @@ func (x *CreateAccountResponse) WhichResult() case_CreateAccountResponse_Result return CreateAccountResponse_Success_case case *CreateAccountResponse_ActionRequired: return CreateAccountResponse_ActionRequired_case + case *CreateAccountResponse_AlreadyExists: + return CreateAccountResponse_AlreadyExists_case + case *CreateAccountResponse_InProgress: + return CreateAccountResponse_InProgress_case default: return CreateAccountResponse_Result_not_set_case } @@ -2141,6 +2230,8 @@ type CreateAccountResponse_builder struct { // Fields of oneof Result: Success *CreateAccountResponse_SuccessResult ActionRequired *CreateAccountResponse_ActionRequiredResult + AlreadyExists *CreateAccountResponse_AlreadyExistsResult + InProgress *CreateAccountResponse_InProgressResult // -- end of Result EncryptedData []*EncryptedData Annotations []*anypb.Any @@ -2156,6 +2247,12 @@ func (b0 CreateAccountResponse_builder) Build() *CreateAccountResponse { if b.ActionRequired != nil { x.Result = &CreateAccountResponse_ActionRequired{b.ActionRequired} } + if b.AlreadyExists != nil { + x.Result = &CreateAccountResponse_AlreadyExists{b.AlreadyExists} + } + if b.InProgress != nil { + x.Result = &CreateAccountResponse_InProgress{b.InProgress} + } x.EncryptedData = b.EncryptedData x.Annotations = b.Annotations return m0 @@ -2183,10 +2280,22 @@ type CreateAccountResponse_ActionRequired struct { ActionRequired *CreateAccountResponse_ActionRequiredResult `protobuf:"bytes,101,opt,name=action_required,json=actionRequired,proto3,oneof"` } +type CreateAccountResponse_AlreadyExists struct { + AlreadyExists *CreateAccountResponse_AlreadyExistsResult `protobuf:"bytes,102,opt,name=already_exists,json=alreadyExists,proto3,oneof"` +} + +type CreateAccountResponse_InProgress struct { + InProgress *CreateAccountResponse_InProgressResult `protobuf:"bytes,103,opt,name=in_progress,json=inProgress,proto3,oneof"` +} + func (*CreateAccountResponse_Success) isCreateAccountResponse_Result() {} func (*CreateAccountResponse_ActionRequired) isCreateAccountResponse_Result() {} +func (*CreateAccountResponse_AlreadyExists) isCreateAccountResponse_Result() {} + +func (*CreateAccountResponse_InProgress) isCreateAccountResponse_Result() {} + type EncryptedData struct { state protoimpl.MessageState `protogen:"hybrid.v1"` Provider string `protobuf:"bytes,1,opt,name=provider,proto3" json:"provider,omitempty"` @@ -2713,17 +2822,23 @@ func (b0 ResourceId_builder) Build() *ResourceId { } type Resource struct { - state protoimpl.MessageState `protogen:"hybrid.v1"` - Id *ResourceId `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - ParentResourceId *ResourceId `protobuf:"bytes,2,opt,name=parent_resource_id,json=parentResourceId,proto3" json:"parent_resource_id,omitempty"` - DisplayName string `protobuf:"bytes,3,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` - Annotations []*anypb.Any `protobuf:"bytes,4,rep,name=annotations,proto3" json:"annotations,omitempty"` - Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` - BatonResource bool `protobuf:"varint,6,opt,name=baton_resource,json=batonResource,proto3" json:"baton_resource,omitempty"` - ExternalId *ExternalId `protobuf:"bytes,7,opt,name=external_id,json=externalId,proto3" json:"external_id,omitempty"` - CreationSource Resource_CreationSource `protobuf:"varint,8,opt,name=creation_source,json=creationSource,proto3,enum=c1.connector.v2.Resource_CreationSource" json:"creation_source,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"hybrid.v1"` + Id *ResourceId `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ParentResourceId *ResourceId `protobuf:"bytes,2,opt,name=parent_resource_id,json=parentResourceId,proto3" json:"parent_resource_id,omitempty"` + DisplayName string `protobuf:"bytes,3,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` + Annotations []*anypb.Any `protobuf:"bytes,4,rep,name=annotations,proto3" json:"annotations,omitempty"` + Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` + BatonResource bool `protobuf:"varint,6,opt,name=baton_resource,json=batonResource,proto3" json:"baton_resource,omitempty"` + // Deprecated. This is no longer used. + // + // Deprecated: Marked as deprecated in c1/connector/v2/resource.proto. + ExternalId *ExternalId `protobuf:"bytes,7,opt,name=external_id,json=externalId,proto3" json:"external_id,omitempty"` + // Deprecated. This is no longer used. + // + // Deprecated: Marked as deprecated in c1/connector/v2/resource.proto. + CreationSource Resource_CreationSource `protobuf:"varint,8,opt,name=creation_source,json=creationSource,proto3,enum=c1.connector.v2.Resource_CreationSource" json:"creation_source,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Resource) Reset() { @@ -2793,6 +2908,7 @@ func (x *Resource) GetBatonResource() bool { return false } +// Deprecated: Marked as deprecated in c1/connector/v2/resource.proto. func (x *Resource) GetExternalId() *ExternalId { if x != nil { return x.ExternalId @@ -2800,6 +2916,7 @@ func (x *Resource) GetExternalId() *ExternalId { return nil } +// Deprecated: Marked as deprecated in c1/connector/v2/resource.proto. func (x *Resource) GetCreationSource() Resource_CreationSource { if x != nil { return x.CreationSource @@ -2831,10 +2948,12 @@ func (x *Resource) SetBatonResource(v bool) { x.BatonResource = v } +// Deprecated: Marked as deprecated in c1/connector/v2/resource.proto. func (x *Resource) SetExternalId(v *ExternalId) { x.ExternalId = v } +// Deprecated: Marked as deprecated in c1/connector/v2/resource.proto. func (x *Resource) SetCreationSource(v Resource_CreationSource) { x.CreationSource = v } @@ -2853,6 +2972,7 @@ func (x *Resource) HasParentResourceId() bool { return x.ParentResourceId != nil } +// Deprecated: Marked as deprecated in c1/connector/v2/resource.proto. func (x *Resource) HasExternalId() bool { if x == nil { return false @@ -2868,6 +2988,7 @@ func (x *Resource) ClearParentResourceId() { x.ParentResourceId = nil } +// Deprecated: Marked as deprecated in c1/connector/v2/resource.proto. func (x *Resource) ClearExternalId() { x.ExternalId = nil } @@ -2881,8 +3002,14 @@ type Resource_builder struct { Annotations []*anypb.Any Description string BatonResource bool - ExternalId *ExternalId - CreationSource Resource_CreationSource + // Deprecated. This is no longer used. + // + // Deprecated: Marked as deprecated in c1/connector/v2/resource.proto. + ExternalId *ExternalId + // Deprecated. This is no longer used. + // + // Deprecated: Marked as deprecated in c1/connector/v2/resource.proto. + CreationSource Resource_CreationSource } func (b0 Resource_builder) Build() *Resource { @@ -4118,6 +4245,170 @@ func (b0 CreateAccountResponse_ActionRequiredResult_builder) Build() *CreateAcco return m0 } +type CreateAccountResponse_AlreadyExistsResult struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` + IsCreateAccountResult bool `protobuf:"varint,2,opt,name=is_create_account_result,json=isCreateAccountResult,proto3" json:"is_create_account_result,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateAccountResponse_AlreadyExistsResult) Reset() { + *x = CreateAccountResponse_AlreadyExistsResult{} + mi := &file_c1_connector_v2_resource_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateAccountResponse_AlreadyExistsResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateAccountResponse_AlreadyExistsResult) ProtoMessage() {} + +func (x *CreateAccountResponse_AlreadyExistsResult) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_resource_proto_msgTypes[38] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *CreateAccountResponse_AlreadyExistsResult) GetResource() *Resource { + if x != nil { + return x.Resource + } + return nil +} + +func (x *CreateAccountResponse_AlreadyExistsResult) GetIsCreateAccountResult() bool { + if x != nil { + return x.IsCreateAccountResult + } + return false +} + +func (x *CreateAccountResponse_AlreadyExistsResult) SetResource(v *Resource) { + x.Resource = v +} + +func (x *CreateAccountResponse_AlreadyExistsResult) SetIsCreateAccountResult(v bool) { + x.IsCreateAccountResult = v +} + +func (x *CreateAccountResponse_AlreadyExistsResult) HasResource() bool { + if x == nil { + return false + } + return x.Resource != nil +} + +func (x *CreateAccountResponse_AlreadyExistsResult) ClearResource() { + x.Resource = nil +} + +type CreateAccountResponse_AlreadyExistsResult_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Resource *Resource + IsCreateAccountResult bool +} + +func (b0 CreateAccountResponse_AlreadyExistsResult_builder) Build() *CreateAccountResponse_AlreadyExistsResult { + m0 := &CreateAccountResponse_AlreadyExistsResult{} + b, x := &b0, m0 + _, _ = b, x + x.Resource = b.Resource + x.IsCreateAccountResult = b.IsCreateAccountResult + return m0 +} + +type CreateAccountResponse_InProgressResult struct { + state protoimpl.MessageState `protogen:"hybrid.v1"` + Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` // Optional. + IsCreateAccountResult bool `protobuf:"varint,2,opt,name=is_create_account_result,json=isCreateAccountResult,proto3" json:"is_create_account_result,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateAccountResponse_InProgressResult) Reset() { + *x = CreateAccountResponse_InProgressResult{} + mi := &file_c1_connector_v2_resource_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateAccountResponse_InProgressResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateAccountResponse_InProgressResult) ProtoMessage() {} + +func (x *CreateAccountResponse_InProgressResult) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_resource_proto_msgTypes[39] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *CreateAccountResponse_InProgressResult) GetResource() *Resource { + if x != nil { + return x.Resource + } + return nil +} + +func (x *CreateAccountResponse_InProgressResult) GetIsCreateAccountResult() bool { + if x != nil { + return x.IsCreateAccountResult + } + return false +} + +func (x *CreateAccountResponse_InProgressResult) SetResource(v *Resource) { + x.Resource = v +} + +func (x *CreateAccountResponse_InProgressResult) SetIsCreateAccountResult(v bool) { + x.IsCreateAccountResult = v +} + +func (x *CreateAccountResponse_InProgressResult) HasResource() bool { + if x == nil { + return false + } + return x.Resource != nil +} + +func (x *CreateAccountResponse_InProgressResult) ClearResource() { + x.Resource = nil +} + +type CreateAccountResponse_InProgressResult_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Resource *Resource + IsCreateAccountResult bool +} + +func (b0 CreateAccountResponse_InProgressResult_builder) Build() *CreateAccountResponse_InProgressResult { + m0 := &CreateAccountResponse_InProgressResult{} + b, x := &b0, m0 + _, _ = b, x + x.Resource = b.Resource + x.IsCreateAccountResult = b.IsCreateAccountResult + return m0 +} + type EncryptionConfig_JWKPublicKeyConfig struct { state protoimpl.MessageState `protogen:"hybrid.v1"` PubKey []byte `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` @@ -4127,7 +4418,7 @@ type EncryptionConfig_JWKPublicKeyConfig struct { func (x *EncryptionConfig_JWKPublicKeyConfig) Reset() { *x = EncryptionConfig_JWKPublicKeyConfig{} - mi := &file_c1_connector_v2_resource_proto_msgTypes[38] + mi := &file_c1_connector_v2_resource_proto_msgTypes[40] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4139,7 +4430,7 @@ func (x *EncryptionConfig_JWKPublicKeyConfig) String() string { func (*EncryptionConfig_JWKPublicKeyConfig) ProtoMessage() {} func (x *EncryptionConfig_JWKPublicKeyConfig) ProtoReflect() protoreflect.Message { - mi := &file_c1_connector_v2_resource_proto_msgTypes[38] + mi := &file_c1_connector_v2_resource_proto_msgTypes[40] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4182,7 +4473,7 @@ var File_c1_connector_v2_resource_proto protoreflect.FileDescriptor const file_c1_connector_v2_resource_proto_rawDesc = "" + "\n" + - "\x1ec1/connector/v2/resource.proto\x12\x0fc1.connector.v2\x1a\x19google/protobuf/any.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x17validate/validate.proto\"\xb4\x03\n" + + "\x1ec1/connector/v2/resource.proto\x12\x0fc1.connector.v2\x1a\x19google/protobuf/any.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x17validate/validate.proto\"\xea\x03\n" + "\fResourceType\x12\x1a\n" + "\x02id\x18\x01 \x01(\tB\n" + "\xfaB\ar\x05 \x01(\x80\bR\x02id\x120\n" + @@ -4192,7 +4483,7 @@ const file_c1_connector_v2_resource_proto_rawDesc = "" + "\vannotations\x18\x04 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x12/\n" + "\vdescription\x18\x05 \x01(\tB\r\xfaB\n" + "r\b \x01(\x80 \xd0\x01\x01R\vdescription\x12-\n" + - "\x12sourced_externally\x18\x06 \x01(\bR\x11sourcedExternally\"p\n" + + "\x12sourced_externally\x18\x06 \x01(\bR\x11sourcedExternally\"\xa5\x01\n" + "\x05Trait\x12\x15\n" + "\x11TRAIT_UNSPECIFIED\x10\x00\x12\x0e\n" + "\n" + @@ -4201,7 +4492,9 @@ const file_c1_connector_v2_resource_proto_rawDesc = "" + "\n" + "TRAIT_ROLE\x10\x03\x12\r\n" + "\tTRAIT_APP\x10\x04\x12\x10\n" + - "\fTRAIT_SECRET\x10\x05\"\xa6\x02\n" + + "\fTRAIT_SECRET\x10\x05\x12\x1a\n" + + "\x16TRAIT_SECURITY_INSIGHT\x10\x06\x12\x17\n" + + "\x13TRAIT_SCOPE_BINDING\x10\a\"\xa6\x02\n" + ",ResourceTypesServiceListResourceTypesRequest\x121\n" + "\x06parent\x18\x01 \x01(\v2\x19.c1.connector.v2.ResourceR\x06parent\x12'\n" + "\tpage_size\x18\x02 \x01(\rB\n" + @@ -4287,14 +4580,19 @@ const file_c1_connector_v2_resource_proto_rawDesc = "" + "\aoptions\"L\n" + "\x12PasswordConstraint\x12\x19\n" + "\bchar_set\x18\x01 \x01(\tR\acharSet\x12\x1b\n" + - "\tmin_count\x18\x02 \x01(\rR\bminCount\"\xfc\x01\n" + + "\tmin_count\x18\x02 \x01(\rR\bminCount\"\xb5\x02\n" + "\x14CreateAccountRequest\x12?\n" + "\faccount_info\x18\x01 \x01(\v2\x1c.c1.connector.v2.AccountInfoR\vaccountInfo\x12Q\n" + "\x12credential_options\x18\x02 \x01(\v2\".c1.connector.v2.CredentialOptionsR\x11credentialOptions\x12P\n" + - "\x12encryption_configs\x18\x03 \x03(\v2!.c1.connector.v2.EncryptionConfigR\x11encryptionConfigs\"\xfe\x04\n" + + "\x12encryption_configs\x18\x03 \x03(\v2!.c1.connector.v2.EncryptionConfigR\x11encryptionConfigs\x127\n" + + "\x10resource_type_id\x18\x04 \x01(\tB\r\xfaB\n" + + "r\b \x01(\x80\b\xd0\x01\x01R\x0eresourceTypeId\"\xcc\b\n" + "\x15CreateAccountResponse\x12P\n" + "\asuccess\x18d \x01(\v24.c1.connector.v2.CreateAccountResponse.SuccessResultH\x00R\asuccess\x12f\n" + - "\x0faction_required\x18e \x01(\v2;.c1.connector.v2.CreateAccountResponse.ActionRequiredResultH\x00R\x0eactionRequired\x12E\n" + + "\x0faction_required\x18e \x01(\v2;.c1.connector.v2.CreateAccountResponse.ActionRequiredResultH\x00R\x0eactionRequired\x12c\n" + + "\x0ealready_exists\x18f \x01(\v2:.c1.connector.v2.CreateAccountResponse.AlreadyExistsResultH\x00R\ralreadyExists\x12Z\n" + + "\vin_progress\x18g \x01(\v27.c1.connector.v2.CreateAccountResponse.InProgressResultH\x00R\n" + + "inProgress\x12E\n" + "\x0eencrypted_data\x18\x02 \x03(\v2\x1e.c1.connector.v2.EncryptedDataR\rencryptedData\x126\n" + "\vannotations\x18\x03 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1a\x7f\n" + "\rSuccessResult\x125\n" + @@ -4303,7 +4601,13 @@ const file_c1_connector_v2_resource_proto_rawDesc = "" + "\x14ActionRequiredResult\x125\n" + "\bresource\x18\x01 \x01(\v2\x19.c1.connector.v2.ResourceR\bresource\x12\x18\n" + "\amessage\x18\x02 \x01(\tR\amessage\x127\n" + - "\x18is_create_account_result\x18\x03 \x01(\bR\x15isCreateAccountResultB\b\n" + + "\x18is_create_account_result\x18\x03 \x01(\bR\x15isCreateAccountResult\x1a\x85\x01\n" + + "\x13AlreadyExistsResult\x125\n" + + "\bresource\x18\x01 \x01(\v2\x19.c1.connector.v2.ResourceR\bresource\x127\n" + + "\x18is_create_account_result\x18\x02 \x01(\bR\x15isCreateAccountResult\x1a\x82\x01\n" + + "\x10InProgressResult\x125\n" + + "\bresource\x18\x01 \x01(\v2\x19.c1.connector.v2.ResourceR\bresource\x127\n" + + "\x18is_create_account_result\x18\x02 \x01(\bR\x15isCreateAccountResultB\b\n" + "\x06result\"\xd6\x01\n" + "\rEncryptedData\x12\x1a\n" + "\bprovider\x18\x01 \x01(\tR\bprovider\x12\x19\n" + @@ -4332,7 +4636,7 @@ const file_c1_connector_v2_resource_proto_rawDesc = "" + "\xfaB\ar\x05 \x01(\x80\bR\fresourceType\x12&\n" + "\bresource\x18\x02 \x01(\tB\n" + "\xfaB\ar\x05 \x01(\x80\bR\bresource\x12%\n" + - "\x0ebaton_resource\x18\x03 \x01(\bR\rbatonResource\"\xf0\x04\n" + + "\x0ebaton_resource\x18\x03 \x01(\bR\rbatonResource\"\xf8\x04\n" + "\bResource\x12+\n" + "\x02id\x18\x01 \x01(\v2\x1b.c1.connector.v2.ResourceIdR\x02id\x12I\n" + "\x12parent_resource_id\x18\x02 \x01(\v2\x1b.c1.connector.v2.ResourceIdR\x10parentResourceId\x120\n" + @@ -4341,10 +4645,10 @@ const file_c1_connector_v2_resource_proto_rawDesc = "" + "\vannotations\x18\x04 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x12/\n" + "\vdescription\x18\x05 \x01(\tB\r\xfaB\n" + "r\b \x01(\x80\x10\xd0\x01\x01R\vdescription\x12%\n" + - "\x0ebaton_resource\x18\x06 \x01(\bR\rbatonResource\x12<\n" + - "\vexternal_id\x18\a \x01(\v2\x1b.c1.connector.v2.ExternalIdR\n" + - "externalId\x12Q\n" + - "\x0fcreation_source\x18\b \x01(\x0e2(.c1.connector.v2.Resource.CreationSourceR\x0ecreationSource\"\x98\x01\n" + + "\x0ebaton_resource\x18\x06 \x01(\bR\rbatonResource\x12@\n" + + "\vexternal_id\x18\a \x01(\v2\x1b.c1.connector.v2.ExternalIdB\x02\x18\x01R\n" + + "externalId\x12U\n" + + "\x0fcreation_source\x18\b \x01(\x0e2(.c1.connector.v2.Resource.CreationSourceB\x02\x18\x01R\x0ecreationSource\"\x98\x01\n" + "\x0eCreationSource\x12\x1f\n" + "\x1bCREATION_SOURCE_UNSPECIFIED\x10\x00\x12,\n" + "(CREATION_SOURCE_CONNECTOR_LIST_RESOURCES\x10\x01\x127\n" + @@ -4396,7 +4700,7 @@ const file_c1_connector_v2_resource_proto_rawDesc = "" + "\rCreateAccount\x12%.c1.connector.v2.CreateAccountRequest\x1a&.c1.connector.v2.CreateAccountResponseB6Z4github.com/conductorone/baton-sdk/pb/c1/connector/v2b\x06proto3" var file_c1_connector_v2_resource_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_c1_connector_v2_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 39) +var file_c1_connector_v2_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 41) var file_c1_connector_v2_resource_proto_goTypes = []any{ (ResourceType_Trait)(0), // 0: c1.connector.v2.ResourceType.Trait (Resource_CreationSource)(0), // 1: c1.connector.v2.Resource.CreationSource @@ -4438,34 +4742,36 @@ var file_c1_connector_v2_resource_proto_goTypes = []any{ (*LocalCredentialOptions_PlaintextPassword)(nil), // 37: c1.connector.v2.LocalCredentialOptions.PlaintextPassword (*CreateAccountResponse_SuccessResult)(nil), // 38: c1.connector.v2.CreateAccountResponse.SuccessResult (*CreateAccountResponse_ActionRequiredResult)(nil), // 39: c1.connector.v2.CreateAccountResponse.ActionRequiredResult - (*EncryptionConfig_JWKPublicKeyConfig)(nil), // 40: c1.connector.v2.EncryptionConfig.JWKPublicKeyConfig - (*anypb.Any)(nil), // 41: google.protobuf.Any - (*structpb.Struct)(nil), // 42: google.protobuf.Struct + (*CreateAccountResponse_AlreadyExistsResult)(nil), // 40: c1.connector.v2.CreateAccountResponse.AlreadyExistsResult + (*CreateAccountResponse_InProgressResult)(nil), // 41: c1.connector.v2.CreateAccountResponse.InProgressResult + (*EncryptionConfig_JWKPublicKeyConfig)(nil), // 42: c1.connector.v2.EncryptionConfig.JWKPublicKeyConfig + (*anypb.Any)(nil), // 43: google.protobuf.Any + (*structpb.Struct)(nil), // 44: google.protobuf.Struct } var file_c1_connector_v2_resource_proto_depIdxs = []int32{ 0, // 0: c1.connector.v2.ResourceType.traits:type_name -> c1.connector.v2.ResourceType.Trait - 41, // 1: c1.connector.v2.ResourceType.annotations:type_name -> google.protobuf.Any + 43, // 1: c1.connector.v2.ResourceType.annotations:type_name -> google.protobuf.Any 23, // 2: c1.connector.v2.ResourceTypesServiceListResourceTypesRequest.parent:type_name -> c1.connector.v2.Resource - 41, // 3: c1.connector.v2.ResourceTypesServiceListResourceTypesRequest.annotations:type_name -> google.protobuf.Any + 43, // 3: c1.connector.v2.ResourceTypesServiceListResourceTypesRequest.annotations:type_name -> google.protobuf.Any 2, // 4: c1.connector.v2.ResourceTypesServiceListResourceTypesResponse.list:type_name -> c1.connector.v2.ResourceType - 41, // 5: c1.connector.v2.ResourceTypesServiceListResourceTypesResponse.annotations:type_name -> google.protobuf.Any + 43, // 5: c1.connector.v2.ResourceTypesServiceListResourceTypesResponse.annotations:type_name -> google.protobuf.Any 23, // 6: c1.connector.v2.CreateResourceRequest.resource:type_name -> c1.connector.v2.Resource 23, // 7: c1.connector.v2.CreateResourceResponse.created:type_name -> c1.connector.v2.Resource - 41, // 8: c1.connector.v2.CreateResourceResponse.annotations:type_name -> google.protobuf.Any + 43, // 8: c1.connector.v2.CreateResourceResponse.annotations:type_name -> google.protobuf.Any 22, // 9: c1.connector.v2.DeleteResourceRequest.resource_id:type_name -> c1.connector.v2.ResourceId 22, // 10: c1.connector.v2.DeleteResourceRequest.parent_resource_id:type_name -> c1.connector.v2.ResourceId - 41, // 11: c1.connector.v2.DeleteResourceResponse.annotations:type_name -> google.protobuf.Any + 43, // 11: c1.connector.v2.DeleteResourceResponse.annotations:type_name -> google.protobuf.Any 22, // 12: c1.connector.v2.DeleteResourceV2Request.resource_id:type_name -> c1.connector.v2.ResourceId 22, // 13: c1.connector.v2.DeleteResourceV2Request.parent_resource_id:type_name -> c1.connector.v2.ResourceId - 41, // 14: c1.connector.v2.DeleteResourceV2Response.annotations:type_name -> google.protobuf.Any + 43, // 14: c1.connector.v2.DeleteResourceV2Response.annotations:type_name -> google.protobuf.Any 22, // 15: c1.connector.v2.RotateCredentialRequest.resource_id:type_name -> c1.connector.v2.ResourceId 14, // 16: c1.connector.v2.RotateCredentialRequest.credential_options:type_name -> c1.connector.v2.CredentialOptions 21, // 17: c1.connector.v2.RotateCredentialRequest.encryption_configs:type_name -> c1.connector.v2.EncryptionConfig 19, // 18: c1.connector.v2.RotateCredentialResponse.encrypted_data:type_name -> c1.connector.v2.EncryptedData 22, // 19: c1.connector.v2.RotateCredentialResponse.resource_id:type_name -> c1.connector.v2.ResourceId - 41, // 20: c1.connector.v2.RotateCredentialResponse.annotations:type_name -> google.protobuf.Any + 43, // 20: c1.connector.v2.RotateCredentialResponse.annotations:type_name -> google.protobuf.Any 29, // 21: c1.connector.v2.AccountInfo.emails:type_name -> c1.connector.v2.AccountInfo.Email - 42, // 22: c1.connector.v2.AccountInfo.profile:type_name -> google.protobuf.Struct + 44, // 22: c1.connector.v2.AccountInfo.profile:type_name -> google.protobuf.Struct 30, // 23: c1.connector.v2.CredentialOptions.random_password:type_name -> c1.connector.v2.CredentialOptions.RandomPassword 31, // 24: c1.connector.v2.CredentialOptions.no_password:type_name -> c1.connector.v2.CredentialOptions.NoPassword 32, // 25: c1.connector.v2.CredentialOptions.sso:type_name -> c1.connector.v2.CredentialOptions.SSO @@ -4479,50 +4785,54 @@ var file_c1_connector_v2_resource_proto_depIdxs = []int32{ 21, // 33: c1.connector.v2.CreateAccountRequest.encryption_configs:type_name -> c1.connector.v2.EncryptionConfig 38, // 34: c1.connector.v2.CreateAccountResponse.success:type_name -> c1.connector.v2.CreateAccountResponse.SuccessResult 39, // 35: c1.connector.v2.CreateAccountResponse.action_required:type_name -> c1.connector.v2.CreateAccountResponse.ActionRequiredResult - 19, // 36: c1.connector.v2.CreateAccountResponse.encrypted_data:type_name -> c1.connector.v2.EncryptedData - 41, // 37: c1.connector.v2.CreateAccountResponse.annotations:type_name -> google.protobuf.Any - 23, // 38: c1.connector.v2.EncryptionConfig.principal:type_name -> c1.connector.v2.Resource - 40, // 39: c1.connector.v2.EncryptionConfig.jwk_public_key_config:type_name -> c1.connector.v2.EncryptionConfig.JWKPublicKeyConfig - 22, // 40: c1.connector.v2.Resource.id:type_name -> c1.connector.v2.ResourceId - 22, // 41: c1.connector.v2.Resource.parent_resource_id:type_name -> c1.connector.v2.ResourceId - 41, // 42: c1.connector.v2.Resource.annotations:type_name -> google.protobuf.Any - 28, // 43: c1.connector.v2.Resource.external_id:type_name -> c1.connector.v2.ExternalId - 1, // 44: c1.connector.v2.Resource.creation_source:type_name -> c1.connector.v2.Resource.CreationSource - 22, // 45: c1.connector.v2.ResourcesServiceListResourcesRequest.parent_resource_id:type_name -> c1.connector.v2.ResourceId - 41, // 46: c1.connector.v2.ResourcesServiceListResourcesRequest.annotations:type_name -> google.protobuf.Any - 23, // 47: c1.connector.v2.ResourcesServiceListResourcesResponse.list:type_name -> c1.connector.v2.Resource - 41, // 48: c1.connector.v2.ResourcesServiceListResourcesResponse.annotations:type_name -> google.protobuf.Any - 22, // 49: c1.connector.v2.ResourceGetterServiceGetResourceRequest.resource_id:type_name -> c1.connector.v2.ResourceId - 22, // 50: c1.connector.v2.ResourceGetterServiceGetResourceRequest.parent_resource_id:type_name -> c1.connector.v2.ResourceId - 41, // 51: c1.connector.v2.ResourceGetterServiceGetResourceRequest.annotations:type_name -> google.protobuf.Any - 23, // 52: c1.connector.v2.ResourceGetterServiceGetResourceResponse.resource:type_name -> c1.connector.v2.Resource - 41, // 53: c1.connector.v2.ResourceGetterServiceGetResourceResponse.annotations:type_name -> google.protobuf.Any - 16, // 54: c1.connector.v2.CredentialOptions.RandomPassword.constraints:type_name -> c1.connector.v2.PasswordConstraint - 19, // 55: c1.connector.v2.CredentialOptions.EncryptedPassword.encrypted_passwords:type_name -> c1.connector.v2.EncryptedData - 16, // 56: c1.connector.v2.LocalCredentialOptions.RandomPassword.constraints:type_name -> c1.connector.v2.PasswordConstraint - 23, // 57: c1.connector.v2.CreateAccountResponse.SuccessResult.resource:type_name -> c1.connector.v2.Resource - 23, // 58: c1.connector.v2.CreateAccountResponse.ActionRequiredResult.resource:type_name -> c1.connector.v2.Resource - 3, // 59: c1.connector.v2.ResourceTypesService.ListResourceTypes:input_type -> c1.connector.v2.ResourceTypesServiceListResourceTypesRequest - 24, // 60: c1.connector.v2.ResourcesService.ListResources:input_type -> c1.connector.v2.ResourcesServiceListResourcesRequest - 26, // 61: c1.connector.v2.ResourceGetterService.GetResource:input_type -> c1.connector.v2.ResourceGetterServiceGetResourceRequest - 5, // 62: c1.connector.v2.ResourceManagerService.CreateResource:input_type -> c1.connector.v2.CreateResourceRequest - 7, // 63: c1.connector.v2.ResourceManagerService.DeleteResource:input_type -> c1.connector.v2.DeleteResourceRequest - 9, // 64: c1.connector.v2.ResourceDeleterService.DeleteResourceV2:input_type -> c1.connector.v2.DeleteResourceV2Request - 11, // 65: c1.connector.v2.CredentialManagerService.RotateCredential:input_type -> c1.connector.v2.RotateCredentialRequest - 17, // 66: c1.connector.v2.AccountManagerService.CreateAccount:input_type -> c1.connector.v2.CreateAccountRequest - 4, // 67: c1.connector.v2.ResourceTypesService.ListResourceTypes:output_type -> c1.connector.v2.ResourceTypesServiceListResourceTypesResponse - 25, // 68: c1.connector.v2.ResourcesService.ListResources:output_type -> c1.connector.v2.ResourcesServiceListResourcesResponse - 27, // 69: c1.connector.v2.ResourceGetterService.GetResource:output_type -> c1.connector.v2.ResourceGetterServiceGetResourceResponse - 6, // 70: c1.connector.v2.ResourceManagerService.CreateResource:output_type -> c1.connector.v2.CreateResourceResponse - 8, // 71: c1.connector.v2.ResourceManagerService.DeleteResource:output_type -> c1.connector.v2.DeleteResourceResponse - 10, // 72: c1.connector.v2.ResourceDeleterService.DeleteResourceV2:output_type -> c1.connector.v2.DeleteResourceV2Response - 12, // 73: c1.connector.v2.CredentialManagerService.RotateCredential:output_type -> c1.connector.v2.RotateCredentialResponse - 18, // 74: c1.connector.v2.AccountManagerService.CreateAccount:output_type -> c1.connector.v2.CreateAccountResponse - 67, // [67:75] is the sub-list for method output_type - 59, // [59:67] is the sub-list for method input_type - 59, // [59:59] is the sub-list for extension type_name - 59, // [59:59] is the sub-list for extension extendee - 0, // [0:59] is the sub-list for field type_name + 40, // 36: c1.connector.v2.CreateAccountResponse.already_exists:type_name -> c1.connector.v2.CreateAccountResponse.AlreadyExistsResult + 41, // 37: c1.connector.v2.CreateAccountResponse.in_progress:type_name -> c1.connector.v2.CreateAccountResponse.InProgressResult + 19, // 38: c1.connector.v2.CreateAccountResponse.encrypted_data:type_name -> c1.connector.v2.EncryptedData + 43, // 39: c1.connector.v2.CreateAccountResponse.annotations:type_name -> google.protobuf.Any + 23, // 40: c1.connector.v2.EncryptionConfig.principal:type_name -> c1.connector.v2.Resource + 42, // 41: c1.connector.v2.EncryptionConfig.jwk_public_key_config:type_name -> c1.connector.v2.EncryptionConfig.JWKPublicKeyConfig + 22, // 42: c1.connector.v2.Resource.id:type_name -> c1.connector.v2.ResourceId + 22, // 43: c1.connector.v2.Resource.parent_resource_id:type_name -> c1.connector.v2.ResourceId + 43, // 44: c1.connector.v2.Resource.annotations:type_name -> google.protobuf.Any + 28, // 45: c1.connector.v2.Resource.external_id:type_name -> c1.connector.v2.ExternalId + 1, // 46: c1.connector.v2.Resource.creation_source:type_name -> c1.connector.v2.Resource.CreationSource + 22, // 47: c1.connector.v2.ResourcesServiceListResourcesRequest.parent_resource_id:type_name -> c1.connector.v2.ResourceId + 43, // 48: c1.connector.v2.ResourcesServiceListResourcesRequest.annotations:type_name -> google.protobuf.Any + 23, // 49: c1.connector.v2.ResourcesServiceListResourcesResponse.list:type_name -> c1.connector.v2.Resource + 43, // 50: c1.connector.v2.ResourcesServiceListResourcesResponse.annotations:type_name -> google.protobuf.Any + 22, // 51: c1.connector.v2.ResourceGetterServiceGetResourceRequest.resource_id:type_name -> c1.connector.v2.ResourceId + 22, // 52: c1.connector.v2.ResourceGetterServiceGetResourceRequest.parent_resource_id:type_name -> c1.connector.v2.ResourceId + 43, // 53: c1.connector.v2.ResourceGetterServiceGetResourceRequest.annotations:type_name -> google.protobuf.Any + 23, // 54: c1.connector.v2.ResourceGetterServiceGetResourceResponse.resource:type_name -> c1.connector.v2.Resource + 43, // 55: c1.connector.v2.ResourceGetterServiceGetResourceResponse.annotations:type_name -> google.protobuf.Any + 16, // 56: c1.connector.v2.CredentialOptions.RandomPassword.constraints:type_name -> c1.connector.v2.PasswordConstraint + 19, // 57: c1.connector.v2.CredentialOptions.EncryptedPassword.encrypted_passwords:type_name -> c1.connector.v2.EncryptedData + 16, // 58: c1.connector.v2.LocalCredentialOptions.RandomPassword.constraints:type_name -> c1.connector.v2.PasswordConstraint + 23, // 59: c1.connector.v2.CreateAccountResponse.SuccessResult.resource:type_name -> c1.connector.v2.Resource + 23, // 60: c1.connector.v2.CreateAccountResponse.ActionRequiredResult.resource:type_name -> c1.connector.v2.Resource + 23, // 61: c1.connector.v2.CreateAccountResponse.AlreadyExistsResult.resource:type_name -> c1.connector.v2.Resource + 23, // 62: c1.connector.v2.CreateAccountResponse.InProgressResult.resource:type_name -> c1.connector.v2.Resource + 3, // 63: c1.connector.v2.ResourceTypesService.ListResourceTypes:input_type -> c1.connector.v2.ResourceTypesServiceListResourceTypesRequest + 24, // 64: c1.connector.v2.ResourcesService.ListResources:input_type -> c1.connector.v2.ResourcesServiceListResourcesRequest + 26, // 65: c1.connector.v2.ResourceGetterService.GetResource:input_type -> c1.connector.v2.ResourceGetterServiceGetResourceRequest + 5, // 66: c1.connector.v2.ResourceManagerService.CreateResource:input_type -> c1.connector.v2.CreateResourceRequest + 7, // 67: c1.connector.v2.ResourceManagerService.DeleteResource:input_type -> c1.connector.v2.DeleteResourceRequest + 9, // 68: c1.connector.v2.ResourceDeleterService.DeleteResourceV2:input_type -> c1.connector.v2.DeleteResourceV2Request + 11, // 69: c1.connector.v2.CredentialManagerService.RotateCredential:input_type -> c1.connector.v2.RotateCredentialRequest + 17, // 70: c1.connector.v2.AccountManagerService.CreateAccount:input_type -> c1.connector.v2.CreateAccountRequest + 4, // 71: c1.connector.v2.ResourceTypesService.ListResourceTypes:output_type -> c1.connector.v2.ResourceTypesServiceListResourceTypesResponse + 25, // 72: c1.connector.v2.ResourcesService.ListResources:output_type -> c1.connector.v2.ResourcesServiceListResourcesResponse + 27, // 73: c1.connector.v2.ResourceGetterService.GetResource:output_type -> c1.connector.v2.ResourceGetterServiceGetResourceResponse + 6, // 74: c1.connector.v2.ResourceManagerService.CreateResource:output_type -> c1.connector.v2.CreateResourceResponse + 8, // 75: c1.connector.v2.ResourceManagerService.DeleteResource:output_type -> c1.connector.v2.DeleteResourceResponse + 10, // 76: c1.connector.v2.ResourceDeleterService.DeleteResourceV2:output_type -> c1.connector.v2.DeleteResourceV2Response + 12, // 77: c1.connector.v2.CredentialManagerService.RotateCredential:output_type -> c1.connector.v2.RotateCredentialResponse + 18, // 78: c1.connector.v2.AccountManagerService.CreateAccount:output_type -> c1.connector.v2.CreateAccountResponse + 71, // [71:79] is the sub-list for method output_type + 63, // [63:71] is the sub-list for method input_type + 63, // [63:63] is the sub-list for extension type_name + 63, // [63:63] is the sub-list for extension extendee + 0, // [0:63] is the sub-list for field type_name } func init() { file_c1_connector_v2_resource_proto_init() } @@ -4545,6 +4855,8 @@ func file_c1_connector_v2_resource_proto_init() { file_c1_connector_v2_resource_proto_msgTypes[16].OneofWrappers = []any{ (*CreateAccountResponse_Success)(nil), (*CreateAccountResponse_ActionRequired)(nil), + (*CreateAccountResponse_AlreadyExists)(nil), + (*CreateAccountResponse_InProgress)(nil), } file_c1_connector_v2_resource_proto_msgTypes[19].OneofWrappers = []any{ (*EncryptionConfig_JwkPublicKeyConfig)(nil), @@ -4555,7 +4867,7 @@ func file_c1_connector_v2_resource_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_c1_connector_v2_resource_proto_rawDesc), len(file_c1_connector_v2_resource_proto_rawDesc)), NumEnums: 2, - NumMessages: 39, + NumMessages: 41, NumExtensions: 0, NumServices: 7, }, diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/resource.pb.validate.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/resource.pb.validate.go index 48fa3515..1e2e556a 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/resource.pb.validate.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/resource.pb.validate.go @@ -2860,6 +2860,21 @@ func (m *CreateAccountRequest) validate(all bool) error { } + if m.GetResourceTypeId() != "" { + + if l := len(m.GetResourceTypeId()); l < 1 || l > 1024 { + err := CreateAccountRequestValidationError{ + field: "ResourceTypeId", + reason: "value length must be between 1 and 1024 bytes, inclusive", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + if len(errors) > 0 { return CreateAccountRequestMultiError(errors) } @@ -3113,6 +3128,88 @@ func (m *CreateAccountResponse) validate(all bool) error { } } + case *CreateAccountResponse_AlreadyExists: + if v == nil { + err := CreateAccountResponseValidationError{ + field: "Result", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetAlreadyExists()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CreateAccountResponseValidationError{ + field: "AlreadyExists", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CreateAccountResponseValidationError{ + field: "AlreadyExists", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetAlreadyExists()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CreateAccountResponseValidationError{ + field: "AlreadyExists", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *CreateAccountResponse_InProgress: + if v == nil { + err := CreateAccountResponseValidationError{ + field: "Result", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetInProgress()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CreateAccountResponseValidationError{ + field: "InProgress", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CreateAccountResponseValidationError{ + field: "InProgress", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetInProgress()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CreateAccountResponseValidationError{ + field: "InProgress", + reason: "embedded message failed validation", + cause: err, + } + } + } + default: _ = v // ensures v is used } @@ -6287,6 +6384,280 @@ var _ interface { ErrorName() string } = CreateAccountResponse_ActionRequiredResultValidationError{} +// Validate checks the field values on +// CreateAccountResponse_AlreadyExistsResult with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *CreateAccountResponse_AlreadyExistsResult) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on +// CreateAccountResponse_AlreadyExistsResult with the rules defined in the +// proto definition for this message. If any rules are violated, the result is +// a list of violation errors wrapped in +// CreateAccountResponse_AlreadyExistsResultMultiError, or nil if none found. +func (m *CreateAccountResponse_AlreadyExistsResult) ValidateAll() error { + return m.validate(true) +} + +func (m *CreateAccountResponse_AlreadyExistsResult) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetResource()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CreateAccountResponse_AlreadyExistsResultValidationError{ + field: "Resource", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CreateAccountResponse_AlreadyExistsResultValidationError{ + field: "Resource", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetResource()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CreateAccountResponse_AlreadyExistsResultValidationError{ + field: "Resource", + reason: "embedded message failed validation", + cause: err, + } + } + } + + // no validation rules for IsCreateAccountResult + + if len(errors) > 0 { + return CreateAccountResponse_AlreadyExistsResultMultiError(errors) + } + + return nil +} + +// CreateAccountResponse_AlreadyExistsResultMultiError is an error wrapping +// multiple validation errors returned by +// CreateAccountResponse_AlreadyExistsResult.ValidateAll() if the designated +// constraints aren't met. +type CreateAccountResponse_AlreadyExistsResultMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CreateAccountResponse_AlreadyExistsResultMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m CreateAccountResponse_AlreadyExistsResultMultiError) AllErrors() []error { return m } + +// CreateAccountResponse_AlreadyExistsResultValidationError is the validation +// error returned by CreateAccountResponse_AlreadyExistsResult.Validate if the +// designated constraints aren't met. +type CreateAccountResponse_AlreadyExistsResultValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CreateAccountResponse_AlreadyExistsResultValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CreateAccountResponse_AlreadyExistsResultValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CreateAccountResponse_AlreadyExistsResultValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CreateAccountResponse_AlreadyExistsResultValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CreateAccountResponse_AlreadyExistsResultValidationError) ErrorName() string { + return "CreateAccountResponse_AlreadyExistsResultValidationError" +} + +// Error satisfies the builtin error interface +func (e CreateAccountResponse_AlreadyExistsResultValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCreateAccountResponse_AlreadyExistsResult.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CreateAccountResponse_AlreadyExistsResultValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CreateAccountResponse_AlreadyExistsResultValidationError{} + +// Validate checks the field values on CreateAccountResponse_InProgressResult +// with the rules defined in the proto definition for this message. If any +// rules are violated, the first error encountered is returned, or nil if +// there are no violations. +func (m *CreateAccountResponse_InProgressResult) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on +// CreateAccountResponse_InProgressResult with the rules defined in the proto +// definition for this message. If any rules are violated, the result is a +// list of violation errors wrapped in +// CreateAccountResponse_InProgressResultMultiError, or nil if none found. +func (m *CreateAccountResponse_InProgressResult) ValidateAll() error { + return m.validate(true) +} + +func (m *CreateAccountResponse_InProgressResult) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetResource()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CreateAccountResponse_InProgressResultValidationError{ + field: "Resource", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CreateAccountResponse_InProgressResultValidationError{ + field: "Resource", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetResource()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CreateAccountResponse_InProgressResultValidationError{ + field: "Resource", + reason: "embedded message failed validation", + cause: err, + } + } + } + + // no validation rules for IsCreateAccountResult + + if len(errors) > 0 { + return CreateAccountResponse_InProgressResultMultiError(errors) + } + + return nil +} + +// CreateAccountResponse_InProgressResultMultiError is an error wrapping +// multiple validation errors returned by +// CreateAccountResponse_InProgressResult.ValidateAll() if the designated +// constraints aren't met. +type CreateAccountResponse_InProgressResultMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CreateAccountResponse_InProgressResultMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m CreateAccountResponse_InProgressResultMultiError) AllErrors() []error { return m } + +// CreateAccountResponse_InProgressResultValidationError is the validation +// error returned by CreateAccountResponse_InProgressResult.Validate if the +// designated constraints aren't met. +type CreateAccountResponse_InProgressResultValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CreateAccountResponse_InProgressResultValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CreateAccountResponse_InProgressResultValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CreateAccountResponse_InProgressResultValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CreateAccountResponse_InProgressResultValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CreateAccountResponse_InProgressResultValidationError) ErrorName() string { + return "CreateAccountResponse_InProgressResultValidationError" +} + +// Error satisfies the builtin error interface +func (e CreateAccountResponse_InProgressResultValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCreateAccountResponse_InProgressResult.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CreateAccountResponse_InProgressResultValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CreateAccountResponse_InProgressResultValidationError{} + // Validate checks the field values on EncryptionConfig_JWKPublicKeyConfig with // the rules defined in the proto definition for this message. If any rules // are violated, the first error encountered is returned, or nil if there are diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/resource_protoopaque.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/resource_protoopaque.pb.go index f0285145..12dcb8a5 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/resource_protoopaque.pb.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/resource_protoopaque.pb.go @@ -28,12 +28,14 @@ const ( type ResourceType_Trait int32 const ( - ResourceType_TRAIT_UNSPECIFIED ResourceType_Trait = 0 - ResourceType_TRAIT_USER ResourceType_Trait = 1 - ResourceType_TRAIT_GROUP ResourceType_Trait = 2 - ResourceType_TRAIT_ROLE ResourceType_Trait = 3 - ResourceType_TRAIT_APP ResourceType_Trait = 4 - ResourceType_TRAIT_SECRET ResourceType_Trait = 5 + ResourceType_TRAIT_UNSPECIFIED ResourceType_Trait = 0 + ResourceType_TRAIT_USER ResourceType_Trait = 1 + ResourceType_TRAIT_GROUP ResourceType_Trait = 2 + ResourceType_TRAIT_ROLE ResourceType_Trait = 3 + ResourceType_TRAIT_APP ResourceType_Trait = 4 + ResourceType_TRAIT_SECRET ResourceType_Trait = 5 + ResourceType_TRAIT_SECURITY_INSIGHT ResourceType_Trait = 6 + ResourceType_TRAIT_SCOPE_BINDING ResourceType_Trait = 7 ) // Enum value maps for ResourceType_Trait. @@ -45,14 +47,18 @@ var ( 3: "TRAIT_ROLE", 4: "TRAIT_APP", 5: "TRAIT_SECRET", + 6: "TRAIT_SECURITY_INSIGHT", + 7: "TRAIT_SCOPE_BINDING", } ResourceType_Trait_value = map[string]int32{ - "TRAIT_UNSPECIFIED": 0, - "TRAIT_USER": 1, - "TRAIT_GROUP": 2, - "TRAIT_ROLE": 3, - "TRAIT_APP": 4, - "TRAIT_SECRET": 5, + "TRAIT_UNSPECIFIED": 0, + "TRAIT_USER": 1, + "TRAIT_GROUP": 2, + "TRAIT_ROLE": 3, + "TRAIT_APP": 4, + "TRAIT_SECRET": 5, + "TRAIT_SECURITY_INSIGHT": 6, + "TRAIT_SCOPE_BINDING": 7, } ) @@ -78,7 +84,6 @@ func (x ResourceType_Trait) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } -// FIXME(mstanbCO): call this something else? Should it just be a bool? Possibly just use an annotation? type Resource_CreationSource int32 const ( @@ -1869,6 +1874,7 @@ type CreateAccountRequest struct { xxx_hidden_AccountInfo *AccountInfo `protobuf:"bytes,1,opt,name=account_info,json=accountInfo,proto3"` xxx_hidden_CredentialOptions *CredentialOptions `protobuf:"bytes,2,opt,name=credential_options,json=credentialOptions,proto3"` xxx_hidden_EncryptionConfigs *[]*EncryptionConfig `protobuf:"bytes,3,rep,name=encryption_configs,json=encryptionConfigs,proto3"` + xxx_hidden_ResourceTypeId string `protobuf:"bytes,4,opt,name=resource_type_id,json=resourceTypeId,proto3"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -1921,6 +1927,13 @@ func (x *CreateAccountRequest) GetEncryptionConfigs() []*EncryptionConfig { return nil } +func (x *CreateAccountRequest) GetResourceTypeId() string { + if x != nil { + return x.xxx_hidden_ResourceTypeId + } + return "" +} + func (x *CreateAccountRequest) SetAccountInfo(v *AccountInfo) { x.xxx_hidden_AccountInfo = v } @@ -1933,6 +1946,10 @@ func (x *CreateAccountRequest) SetEncryptionConfigs(v []*EncryptionConfig) { x.xxx_hidden_EncryptionConfigs = &v } +func (x *CreateAccountRequest) SetResourceTypeId(v string) { + x.xxx_hidden_ResourceTypeId = v +} + func (x *CreateAccountRequest) HasAccountInfo() bool { if x == nil { return false @@ -1961,6 +1978,7 @@ type CreateAccountRequest_builder struct { AccountInfo *AccountInfo CredentialOptions *CredentialOptions EncryptionConfigs []*EncryptionConfig + ResourceTypeId string } func (b0 CreateAccountRequest_builder) Build() *CreateAccountRequest { @@ -1970,6 +1988,7 @@ func (b0 CreateAccountRequest_builder) Build() *CreateAccountRequest { x.xxx_hidden_AccountInfo = b.AccountInfo x.xxx_hidden_CredentialOptions = b.CredentialOptions x.xxx_hidden_EncryptionConfigs = &b.EncryptionConfigs + x.xxx_hidden_ResourceTypeId = b.ResourceTypeId return m0 } @@ -2025,6 +2044,24 @@ func (x *CreateAccountResponse) GetActionRequired() *CreateAccountResponse_Actio return nil } +func (x *CreateAccountResponse) GetAlreadyExists() *CreateAccountResponse_AlreadyExistsResult { + if x != nil { + if x, ok := x.xxx_hidden_Result.(*createAccountResponse_AlreadyExists); ok { + return x.AlreadyExists + } + } + return nil +} + +func (x *CreateAccountResponse) GetInProgress() *CreateAccountResponse_InProgressResult { + if x != nil { + if x, ok := x.xxx_hidden_Result.(*createAccountResponse_InProgress); ok { + return x.InProgress + } + } + return nil +} + func (x *CreateAccountResponse) GetEncryptedData() []*EncryptedData { if x != nil { if x.xxx_hidden_EncryptedData != nil { @@ -2059,6 +2096,22 @@ func (x *CreateAccountResponse) SetActionRequired(v *CreateAccountResponse_Actio x.xxx_hidden_Result = &createAccountResponse_ActionRequired{v} } +func (x *CreateAccountResponse) SetAlreadyExists(v *CreateAccountResponse_AlreadyExistsResult) { + if v == nil { + x.xxx_hidden_Result = nil + return + } + x.xxx_hidden_Result = &createAccountResponse_AlreadyExists{v} +} + +func (x *CreateAccountResponse) SetInProgress(v *CreateAccountResponse_InProgressResult) { + if v == nil { + x.xxx_hidden_Result = nil + return + } + x.xxx_hidden_Result = &createAccountResponse_InProgress{v} +} + func (x *CreateAccountResponse) SetEncryptedData(v []*EncryptedData) { x.xxx_hidden_EncryptedData = &v } @@ -2090,6 +2143,22 @@ func (x *CreateAccountResponse) HasActionRequired() bool { return ok } +func (x *CreateAccountResponse) HasAlreadyExists() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Result.(*createAccountResponse_AlreadyExists) + return ok +} + +func (x *CreateAccountResponse) HasInProgress() bool { + if x == nil { + return false + } + _, ok := x.xxx_hidden_Result.(*createAccountResponse_InProgress) + return ok +} + func (x *CreateAccountResponse) ClearResult() { x.xxx_hidden_Result = nil } @@ -2106,9 +2175,23 @@ func (x *CreateAccountResponse) ClearActionRequired() { } } +func (x *CreateAccountResponse) ClearAlreadyExists() { + if _, ok := x.xxx_hidden_Result.(*createAccountResponse_AlreadyExists); ok { + x.xxx_hidden_Result = nil + } +} + +func (x *CreateAccountResponse) ClearInProgress() { + if _, ok := x.xxx_hidden_Result.(*createAccountResponse_InProgress); ok { + x.xxx_hidden_Result = nil + } +} + const CreateAccountResponse_Result_not_set_case case_CreateAccountResponse_Result = 0 const CreateAccountResponse_Success_case case_CreateAccountResponse_Result = 100 const CreateAccountResponse_ActionRequired_case case_CreateAccountResponse_Result = 101 +const CreateAccountResponse_AlreadyExists_case case_CreateAccountResponse_Result = 102 +const CreateAccountResponse_InProgress_case case_CreateAccountResponse_Result = 103 func (x *CreateAccountResponse) WhichResult() case_CreateAccountResponse_Result { if x == nil { @@ -2119,6 +2202,10 @@ func (x *CreateAccountResponse) WhichResult() case_CreateAccountResponse_Result return CreateAccountResponse_Success_case case *createAccountResponse_ActionRequired: return CreateAccountResponse_ActionRequired_case + case *createAccountResponse_AlreadyExists: + return CreateAccountResponse_AlreadyExists_case + case *createAccountResponse_InProgress: + return CreateAccountResponse_InProgress_case default: return CreateAccountResponse_Result_not_set_case } @@ -2130,6 +2217,8 @@ type CreateAccountResponse_builder struct { // Fields of oneof xxx_hidden_Result: Success *CreateAccountResponse_SuccessResult ActionRequired *CreateAccountResponse_ActionRequiredResult + AlreadyExists *CreateAccountResponse_AlreadyExistsResult + InProgress *CreateAccountResponse_InProgressResult // -- end of xxx_hidden_Result EncryptedData []*EncryptedData Annotations []*anypb.Any @@ -2145,6 +2234,12 @@ func (b0 CreateAccountResponse_builder) Build() *CreateAccountResponse { if b.ActionRequired != nil { x.xxx_hidden_Result = &createAccountResponse_ActionRequired{b.ActionRequired} } + if b.AlreadyExists != nil { + x.xxx_hidden_Result = &createAccountResponse_AlreadyExists{b.AlreadyExists} + } + if b.InProgress != nil { + x.xxx_hidden_Result = &createAccountResponse_InProgress{b.InProgress} + } x.xxx_hidden_EncryptedData = &b.EncryptedData x.xxx_hidden_Annotations = &b.Annotations return m0 @@ -2172,10 +2267,22 @@ type createAccountResponse_ActionRequired struct { ActionRequired *CreateAccountResponse_ActionRequiredResult `protobuf:"bytes,101,opt,name=action_required,json=actionRequired,proto3,oneof"` } +type createAccountResponse_AlreadyExists struct { + AlreadyExists *CreateAccountResponse_AlreadyExistsResult `protobuf:"bytes,102,opt,name=already_exists,json=alreadyExists,proto3,oneof"` +} + +type createAccountResponse_InProgress struct { + InProgress *CreateAccountResponse_InProgressResult `protobuf:"bytes,103,opt,name=in_progress,json=inProgress,proto3,oneof"` +} + func (*createAccountResponse_Success) isCreateAccountResponse_Result() {} func (*createAccountResponse_ActionRequired) isCreateAccountResponse_Result() {} +func (*createAccountResponse_AlreadyExists) isCreateAccountResponse_Result() {} + +func (*createAccountResponse_InProgress) isCreateAccountResponse_Result() {} + type EncryptedData struct { state protoimpl.MessageState `protogen:"opaque.v1"` xxx_hidden_Provider string `protobuf:"bytes,1,opt,name=provider,proto3"` @@ -2773,6 +2880,7 @@ func (x *Resource) GetBatonResource() bool { return false } +// Deprecated: Marked as deprecated in c1/connector/v2/resource.proto. func (x *Resource) GetExternalId() *ExternalId { if x != nil { return x.xxx_hidden_ExternalId @@ -2780,6 +2888,7 @@ func (x *Resource) GetExternalId() *ExternalId { return nil } +// Deprecated: Marked as deprecated in c1/connector/v2/resource.proto. func (x *Resource) GetCreationSource() Resource_CreationSource { if x != nil { return x.xxx_hidden_CreationSource @@ -2811,10 +2920,12 @@ func (x *Resource) SetBatonResource(v bool) { x.xxx_hidden_BatonResource = v } +// Deprecated: Marked as deprecated in c1/connector/v2/resource.proto. func (x *Resource) SetExternalId(v *ExternalId) { x.xxx_hidden_ExternalId = v } +// Deprecated: Marked as deprecated in c1/connector/v2/resource.proto. func (x *Resource) SetCreationSource(v Resource_CreationSource) { x.xxx_hidden_CreationSource = v } @@ -2833,6 +2944,7 @@ func (x *Resource) HasParentResourceId() bool { return x.xxx_hidden_ParentResourceId != nil } +// Deprecated: Marked as deprecated in c1/connector/v2/resource.proto. func (x *Resource) HasExternalId() bool { if x == nil { return false @@ -2848,6 +2960,7 @@ func (x *Resource) ClearParentResourceId() { x.xxx_hidden_ParentResourceId = nil } +// Deprecated: Marked as deprecated in c1/connector/v2/resource.proto. func (x *Resource) ClearExternalId() { x.xxx_hidden_ExternalId = nil } @@ -2861,8 +2974,14 @@ type Resource_builder struct { Annotations []*anypb.Any Description string BatonResource bool - ExternalId *ExternalId - CreationSource Resource_CreationSource + // Deprecated. This is no longer used. + // + // Deprecated: Marked as deprecated in c1/connector/v2/resource.proto. + ExternalId *ExternalId + // Deprecated. This is no longer used. + // + // Deprecated: Marked as deprecated in c1/connector/v2/resource.proto. + CreationSource Resource_CreationSource } func (b0 Resource_builder) Build() *Resource { @@ -4113,6 +4232,170 @@ func (b0 CreateAccountResponse_ActionRequiredResult_builder) Build() *CreateAcco return m0 } +type CreateAccountResponse_AlreadyExistsResult struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3"` + xxx_hidden_IsCreateAccountResult bool `protobuf:"varint,2,opt,name=is_create_account_result,json=isCreateAccountResult,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateAccountResponse_AlreadyExistsResult) Reset() { + *x = CreateAccountResponse_AlreadyExistsResult{} + mi := &file_c1_connector_v2_resource_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateAccountResponse_AlreadyExistsResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateAccountResponse_AlreadyExistsResult) ProtoMessage() {} + +func (x *CreateAccountResponse_AlreadyExistsResult) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_resource_proto_msgTypes[38] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *CreateAccountResponse_AlreadyExistsResult) GetResource() *Resource { + if x != nil { + return x.xxx_hidden_Resource + } + return nil +} + +func (x *CreateAccountResponse_AlreadyExistsResult) GetIsCreateAccountResult() bool { + if x != nil { + return x.xxx_hidden_IsCreateAccountResult + } + return false +} + +func (x *CreateAccountResponse_AlreadyExistsResult) SetResource(v *Resource) { + x.xxx_hidden_Resource = v +} + +func (x *CreateAccountResponse_AlreadyExistsResult) SetIsCreateAccountResult(v bool) { + x.xxx_hidden_IsCreateAccountResult = v +} + +func (x *CreateAccountResponse_AlreadyExistsResult) HasResource() bool { + if x == nil { + return false + } + return x.xxx_hidden_Resource != nil +} + +func (x *CreateAccountResponse_AlreadyExistsResult) ClearResource() { + x.xxx_hidden_Resource = nil +} + +type CreateAccountResponse_AlreadyExistsResult_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Resource *Resource + IsCreateAccountResult bool +} + +func (b0 CreateAccountResponse_AlreadyExistsResult_builder) Build() *CreateAccountResponse_AlreadyExistsResult { + m0 := &CreateAccountResponse_AlreadyExistsResult{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Resource = b.Resource + x.xxx_hidden_IsCreateAccountResult = b.IsCreateAccountResult + return m0 +} + +type CreateAccountResponse_InProgressResult struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3"` + xxx_hidden_IsCreateAccountResult bool `protobuf:"varint,2,opt,name=is_create_account_result,json=isCreateAccountResult,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateAccountResponse_InProgressResult) Reset() { + *x = CreateAccountResponse_InProgressResult{} + mi := &file_c1_connector_v2_resource_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateAccountResponse_InProgressResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateAccountResponse_InProgressResult) ProtoMessage() {} + +func (x *CreateAccountResponse_InProgressResult) ProtoReflect() protoreflect.Message { + mi := &file_c1_connector_v2_resource_proto_msgTypes[39] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *CreateAccountResponse_InProgressResult) GetResource() *Resource { + if x != nil { + return x.xxx_hidden_Resource + } + return nil +} + +func (x *CreateAccountResponse_InProgressResult) GetIsCreateAccountResult() bool { + if x != nil { + return x.xxx_hidden_IsCreateAccountResult + } + return false +} + +func (x *CreateAccountResponse_InProgressResult) SetResource(v *Resource) { + x.xxx_hidden_Resource = v +} + +func (x *CreateAccountResponse_InProgressResult) SetIsCreateAccountResult(v bool) { + x.xxx_hidden_IsCreateAccountResult = v +} + +func (x *CreateAccountResponse_InProgressResult) HasResource() bool { + if x == nil { + return false + } + return x.xxx_hidden_Resource != nil +} + +func (x *CreateAccountResponse_InProgressResult) ClearResource() { + x.xxx_hidden_Resource = nil +} + +type CreateAccountResponse_InProgressResult_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Resource *Resource + IsCreateAccountResult bool +} + +func (b0 CreateAccountResponse_InProgressResult_builder) Build() *CreateAccountResponse_InProgressResult { + m0 := &CreateAccountResponse_InProgressResult{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Resource = b.Resource + x.xxx_hidden_IsCreateAccountResult = b.IsCreateAccountResult + return m0 +} + type EncryptionConfig_JWKPublicKeyConfig struct { state protoimpl.MessageState `protogen:"opaque.v1"` xxx_hidden_PubKey []byte `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3"` @@ -4122,7 +4405,7 @@ type EncryptionConfig_JWKPublicKeyConfig struct { func (x *EncryptionConfig_JWKPublicKeyConfig) Reset() { *x = EncryptionConfig_JWKPublicKeyConfig{} - mi := &file_c1_connector_v2_resource_proto_msgTypes[38] + mi := &file_c1_connector_v2_resource_proto_msgTypes[40] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4134,7 +4417,7 @@ func (x *EncryptionConfig_JWKPublicKeyConfig) String() string { func (*EncryptionConfig_JWKPublicKeyConfig) ProtoMessage() {} func (x *EncryptionConfig_JWKPublicKeyConfig) ProtoReflect() protoreflect.Message { - mi := &file_c1_connector_v2_resource_proto_msgTypes[38] + mi := &file_c1_connector_v2_resource_proto_msgTypes[40] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4177,7 +4460,7 @@ var File_c1_connector_v2_resource_proto protoreflect.FileDescriptor const file_c1_connector_v2_resource_proto_rawDesc = "" + "\n" + - "\x1ec1/connector/v2/resource.proto\x12\x0fc1.connector.v2\x1a\x19google/protobuf/any.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x17validate/validate.proto\"\xb4\x03\n" + + "\x1ec1/connector/v2/resource.proto\x12\x0fc1.connector.v2\x1a\x19google/protobuf/any.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x17validate/validate.proto\"\xea\x03\n" + "\fResourceType\x12\x1a\n" + "\x02id\x18\x01 \x01(\tB\n" + "\xfaB\ar\x05 \x01(\x80\bR\x02id\x120\n" + @@ -4187,7 +4470,7 @@ const file_c1_connector_v2_resource_proto_rawDesc = "" + "\vannotations\x18\x04 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x12/\n" + "\vdescription\x18\x05 \x01(\tB\r\xfaB\n" + "r\b \x01(\x80 \xd0\x01\x01R\vdescription\x12-\n" + - "\x12sourced_externally\x18\x06 \x01(\bR\x11sourcedExternally\"p\n" + + "\x12sourced_externally\x18\x06 \x01(\bR\x11sourcedExternally\"\xa5\x01\n" + "\x05Trait\x12\x15\n" + "\x11TRAIT_UNSPECIFIED\x10\x00\x12\x0e\n" + "\n" + @@ -4196,7 +4479,9 @@ const file_c1_connector_v2_resource_proto_rawDesc = "" + "\n" + "TRAIT_ROLE\x10\x03\x12\r\n" + "\tTRAIT_APP\x10\x04\x12\x10\n" + - "\fTRAIT_SECRET\x10\x05\"\xa6\x02\n" + + "\fTRAIT_SECRET\x10\x05\x12\x1a\n" + + "\x16TRAIT_SECURITY_INSIGHT\x10\x06\x12\x17\n" + + "\x13TRAIT_SCOPE_BINDING\x10\a\"\xa6\x02\n" + ",ResourceTypesServiceListResourceTypesRequest\x121\n" + "\x06parent\x18\x01 \x01(\v2\x19.c1.connector.v2.ResourceR\x06parent\x12'\n" + "\tpage_size\x18\x02 \x01(\rB\n" + @@ -4282,14 +4567,19 @@ const file_c1_connector_v2_resource_proto_rawDesc = "" + "\aoptions\"L\n" + "\x12PasswordConstraint\x12\x19\n" + "\bchar_set\x18\x01 \x01(\tR\acharSet\x12\x1b\n" + - "\tmin_count\x18\x02 \x01(\rR\bminCount\"\xfc\x01\n" + + "\tmin_count\x18\x02 \x01(\rR\bminCount\"\xb5\x02\n" + "\x14CreateAccountRequest\x12?\n" + "\faccount_info\x18\x01 \x01(\v2\x1c.c1.connector.v2.AccountInfoR\vaccountInfo\x12Q\n" + "\x12credential_options\x18\x02 \x01(\v2\".c1.connector.v2.CredentialOptionsR\x11credentialOptions\x12P\n" + - "\x12encryption_configs\x18\x03 \x03(\v2!.c1.connector.v2.EncryptionConfigR\x11encryptionConfigs\"\xfe\x04\n" + + "\x12encryption_configs\x18\x03 \x03(\v2!.c1.connector.v2.EncryptionConfigR\x11encryptionConfigs\x127\n" + + "\x10resource_type_id\x18\x04 \x01(\tB\r\xfaB\n" + + "r\b \x01(\x80\b\xd0\x01\x01R\x0eresourceTypeId\"\xcc\b\n" + "\x15CreateAccountResponse\x12P\n" + "\asuccess\x18d \x01(\v24.c1.connector.v2.CreateAccountResponse.SuccessResultH\x00R\asuccess\x12f\n" + - "\x0faction_required\x18e \x01(\v2;.c1.connector.v2.CreateAccountResponse.ActionRequiredResultH\x00R\x0eactionRequired\x12E\n" + + "\x0faction_required\x18e \x01(\v2;.c1.connector.v2.CreateAccountResponse.ActionRequiredResultH\x00R\x0eactionRequired\x12c\n" + + "\x0ealready_exists\x18f \x01(\v2:.c1.connector.v2.CreateAccountResponse.AlreadyExistsResultH\x00R\ralreadyExists\x12Z\n" + + "\vin_progress\x18g \x01(\v27.c1.connector.v2.CreateAccountResponse.InProgressResultH\x00R\n" + + "inProgress\x12E\n" + "\x0eencrypted_data\x18\x02 \x03(\v2\x1e.c1.connector.v2.EncryptedDataR\rencryptedData\x126\n" + "\vannotations\x18\x03 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1a\x7f\n" + "\rSuccessResult\x125\n" + @@ -4298,7 +4588,13 @@ const file_c1_connector_v2_resource_proto_rawDesc = "" + "\x14ActionRequiredResult\x125\n" + "\bresource\x18\x01 \x01(\v2\x19.c1.connector.v2.ResourceR\bresource\x12\x18\n" + "\amessage\x18\x02 \x01(\tR\amessage\x127\n" + - "\x18is_create_account_result\x18\x03 \x01(\bR\x15isCreateAccountResultB\b\n" + + "\x18is_create_account_result\x18\x03 \x01(\bR\x15isCreateAccountResult\x1a\x85\x01\n" + + "\x13AlreadyExistsResult\x125\n" + + "\bresource\x18\x01 \x01(\v2\x19.c1.connector.v2.ResourceR\bresource\x127\n" + + "\x18is_create_account_result\x18\x02 \x01(\bR\x15isCreateAccountResult\x1a\x82\x01\n" + + "\x10InProgressResult\x125\n" + + "\bresource\x18\x01 \x01(\v2\x19.c1.connector.v2.ResourceR\bresource\x127\n" + + "\x18is_create_account_result\x18\x02 \x01(\bR\x15isCreateAccountResultB\b\n" + "\x06result\"\xd6\x01\n" + "\rEncryptedData\x12\x1a\n" + "\bprovider\x18\x01 \x01(\tR\bprovider\x12\x19\n" + @@ -4327,7 +4623,7 @@ const file_c1_connector_v2_resource_proto_rawDesc = "" + "\xfaB\ar\x05 \x01(\x80\bR\fresourceType\x12&\n" + "\bresource\x18\x02 \x01(\tB\n" + "\xfaB\ar\x05 \x01(\x80\bR\bresource\x12%\n" + - "\x0ebaton_resource\x18\x03 \x01(\bR\rbatonResource\"\xf0\x04\n" + + "\x0ebaton_resource\x18\x03 \x01(\bR\rbatonResource\"\xf8\x04\n" + "\bResource\x12+\n" + "\x02id\x18\x01 \x01(\v2\x1b.c1.connector.v2.ResourceIdR\x02id\x12I\n" + "\x12parent_resource_id\x18\x02 \x01(\v2\x1b.c1.connector.v2.ResourceIdR\x10parentResourceId\x120\n" + @@ -4336,10 +4632,10 @@ const file_c1_connector_v2_resource_proto_rawDesc = "" + "\vannotations\x18\x04 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x12/\n" + "\vdescription\x18\x05 \x01(\tB\r\xfaB\n" + "r\b \x01(\x80\x10\xd0\x01\x01R\vdescription\x12%\n" + - "\x0ebaton_resource\x18\x06 \x01(\bR\rbatonResource\x12<\n" + - "\vexternal_id\x18\a \x01(\v2\x1b.c1.connector.v2.ExternalIdR\n" + - "externalId\x12Q\n" + - "\x0fcreation_source\x18\b \x01(\x0e2(.c1.connector.v2.Resource.CreationSourceR\x0ecreationSource\"\x98\x01\n" + + "\x0ebaton_resource\x18\x06 \x01(\bR\rbatonResource\x12@\n" + + "\vexternal_id\x18\a \x01(\v2\x1b.c1.connector.v2.ExternalIdB\x02\x18\x01R\n" + + "externalId\x12U\n" + + "\x0fcreation_source\x18\b \x01(\x0e2(.c1.connector.v2.Resource.CreationSourceB\x02\x18\x01R\x0ecreationSource\"\x98\x01\n" + "\x0eCreationSource\x12\x1f\n" + "\x1bCREATION_SOURCE_UNSPECIFIED\x10\x00\x12,\n" + "(CREATION_SOURCE_CONNECTOR_LIST_RESOURCES\x10\x01\x127\n" + @@ -4391,7 +4687,7 @@ const file_c1_connector_v2_resource_proto_rawDesc = "" + "\rCreateAccount\x12%.c1.connector.v2.CreateAccountRequest\x1a&.c1.connector.v2.CreateAccountResponseB6Z4github.com/conductorone/baton-sdk/pb/c1/connector/v2b\x06proto3" var file_c1_connector_v2_resource_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_c1_connector_v2_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 39) +var file_c1_connector_v2_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 41) var file_c1_connector_v2_resource_proto_goTypes = []any{ (ResourceType_Trait)(0), // 0: c1.connector.v2.ResourceType.Trait (Resource_CreationSource)(0), // 1: c1.connector.v2.Resource.CreationSource @@ -4433,34 +4729,36 @@ var file_c1_connector_v2_resource_proto_goTypes = []any{ (*LocalCredentialOptions_PlaintextPassword)(nil), // 37: c1.connector.v2.LocalCredentialOptions.PlaintextPassword (*CreateAccountResponse_SuccessResult)(nil), // 38: c1.connector.v2.CreateAccountResponse.SuccessResult (*CreateAccountResponse_ActionRequiredResult)(nil), // 39: c1.connector.v2.CreateAccountResponse.ActionRequiredResult - (*EncryptionConfig_JWKPublicKeyConfig)(nil), // 40: c1.connector.v2.EncryptionConfig.JWKPublicKeyConfig - (*anypb.Any)(nil), // 41: google.protobuf.Any - (*structpb.Struct)(nil), // 42: google.protobuf.Struct + (*CreateAccountResponse_AlreadyExistsResult)(nil), // 40: c1.connector.v2.CreateAccountResponse.AlreadyExistsResult + (*CreateAccountResponse_InProgressResult)(nil), // 41: c1.connector.v2.CreateAccountResponse.InProgressResult + (*EncryptionConfig_JWKPublicKeyConfig)(nil), // 42: c1.connector.v2.EncryptionConfig.JWKPublicKeyConfig + (*anypb.Any)(nil), // 43: google.protobuf.Any + (*structpb.Struct)(nil), // 44: google.protobuf.Struct } var file_c1_connector_v2_resource_proto_depIdxs = []int32{ 0, // 0: c1.connector.v2.ResourceType.traits:type_name -> c1.connector.v2.ResourceType.Trait - 41, // 1: c1.connector.v2.ResourceType.annotations:type_name -> google.protobuf.Any + 43, // 1: c1.connector.v2.ResourceType.annotations:type_name -> google.protobuf.Any 23, // 2: c1.connector.v2.ResourceTypesServiceListResourceTypesRequest.parent:type_name -> c1.connector.v2.Resource - 41, // 3: c1.connector.v2.ResourceTypesServiceListResourceTypesRequest.annotations:type_name -> google.protobuf.Any + 43, // 3: c1.connector.v2.ResourceTypesServiceListResourceTypesRequest.annotations:type_name -> google.protobuf.Any 2, // 4: c1.connector.v2.ResourceTypesServiceListResourceTypesResponse.list:type_name -> c1.connector.v2.ResourceType - 41, // 5: c1.connector.v2.ResourceTypesServiceListResourceTypesResponse.annotations:type_name -> google.protobuf.Any + 43, // 5: c1.connector.v2.ResourceTypesServiceListResourceTypesResponse.annotations:type_name -> google.protobuf.Any 23, // 6: c1.connector.v2.CreateResourceRequest.resource:type_name -> c1.connector.v2.Resource 23, // 7: c1.connector.v2.CreateResourceResponse.created:type_name -> c1.connector.v2.Resource - 41, // 8: c1.connector.v2.CreateResourceResponse.annotations:type_name -> google.protobuf.Any + 43, // 8: c1.connector.v2.CreateResourceResponse.annotations:type_name -> google.protobuf.Any 22, // 9: c1.connector.v2.DeleteResourceRequest.resource_id:type_name -> c1.connector.v2.ResourceId 22, // 10: c1.connector.v2.DeleteResourceRequest.parent_resource_id:type_name -> c1.connector.v2.ResourceId - 41, // 11: c1.connector.v2.DeleteResourceResponse.annotations:type_name -> google.protobuf.Any + 43, // 11: c1.connector.v2.DeleteResourceResponse.annotations:type_name -> google.protobuf.Any 22, // 12: c1.connector.v2.DeleteResourceV2Request.resource_id:type_name -> c1.connector.v2.ResourceId 22, // 13: c1.connector.v2.DeleteResourceV2Request.parent_resource_id:type_name -> c1.connector.v2.ResourceId - 41, // 14: c1.connector.v2.DeleteResourceV2Response.annotations:type_name -> google.protobuf.Any + 43, // 14: c1.connector.v2.DeleteResourceV2Response.annotations:type_name -> google.protobuf.Any 22, // 15: c1.connector.v2.RotateCredentialRequest.resource_id:type_name -> c1.connector.v2.ResourceId 14, // 16: c1.connector.v2.RotateCredentialRequest.credential_options:type_name -> c1.connector.v2.CredentialOptions 21, // 17: c1.connector.v2.RotateCredentialRequest.encryption_configs:type_name -> c1.connector.v2.EncryptionConfig 19, // 18: c1.connector.v2.RotateCredentialResponse.encrypted_data:type_name -> c1.connector.v2.EncryptedData 22, // 19: c1.connector.v2.RotateCredentialResponse.resource_id:type_name -> c1.connector.v2.ResourceId - 41, // 20: c1.connector.v2.RotateCredentialResponse.annotations:type_name -> google.protobuf.Any + 43, // 20: c1.connector.v2.RotateCredentialResponse.annotations:type_name -> google.protobuf.Any 29, // 21: c1.connector.v2.AccountInfo.emails:type_name -> c1.connector.v2.AccountInfo.Email - 42, // 22: c1.connector.v2.AccountInfo.profile:type_name -> google.protobuf.Struct + 44, // 22: c1.connector.v2.AccountInfo.profile:type_name -> google.protobuf.Struct 30, // 23: c1.connector.v2.CredentialOptions.random_password:type_name -> c1.connector.v2.CredentialOptions.RandomPassword 31, // 24: c1.connector.v2.CredentialOptions.no_password:type_name -> c1.connector.v2.CredentialOptions.NoPassword 32, // 25: c1.connector.v2.CredentialOptions.sso:type_name -> c1.connector.v2.CredentialOptions.SSO @@ -4474,50 +4772,54 @@ var file_c1_connector_v2_resource_proto_depIdxs = []int32{ 21, // 33: c1.connector.v2.CreateAccountRequest.encryption_configs:type_name -> c1.connector.v2.EncryptionConfig 38, // 34: c1.connector.v2.CreateAccountResponse.success:type_name -> c1.connector.v2.CreateAccountResponse.SuccessResult 39, // 35: c1.connector.v2.CreateAccountResponse.action_required:type_name -> c1.connector.v2.CreateAccountResponse.ActionRequiredResult - 19, // 36: c1.connector.v2.CreateAccountResponse.encrypted_data:type_name -> c1.connector.v2.EncryptedData - 41, // 37: c1.connector.v2.CreateAccountResponse.annotations:type_name -> google.protobuf.Any - 23, // 38: c1.connector.v2.EncryptionConfig.principal:type_name -> c1.connector.v2.Resource - 40, // 39: c1.connector.v2.EncryptionConfig.jwk_public_key_config:type_name -> c1.connector.v2.EncryptionConfig.JWKPublicKeyConfig - 22, // 40: c1.connector.v2.Resource.id:type_name -> c1.connector.v2.ResourceId - 22, // 41: c1.connector.v2.Resource.parent_resource_id:type_name -> c1.connector.v2.ResourceId - 41, // 42: c1.connector.v2.Resource.annotations:type_name -> google.protobuf.Any - 28, // 43: c1.connector.v2.Resource.external_id:type_name -> c1.connector.v2.ExternalId - 1, // 44: c1.connector.v2.Resource.creation_source:type_name -> c1.connector.v2.Resource.CreationSource - 22, // 45: c1.connector.v2.ResourcesServiceListResourcesRequest.parent_resource_id:type_name -> c1.connector.v2.ResourceId - 41, // 46: c1.connector.v2.ResourcesServiceListResourcesRequest.annotations:type_name -> google.protobuf.Any - 23, // 47: c1.connector.v2.ResourcesServiceListResourcesResponse.list:type_name -> c1.connector.v2.Resource - 41, // 48: c1.connector.v2.ResourcesServiceListResourcesResponse.annotations:type_name -> google.protobuf.Any - 22, // 49: c1.connector.v2.ResourceGetterServiceGetResourceRequest.resource_id:type_name -> c1.connector.v2.ResourceId - 22, // 50: c1.connector.v2.ResourceGetterServiceGetResourceRequest.parent_resource_id:type_name -> c1.connector.v2.ResourceId - 41, // 51: c1.connector.v2.ResourceGetterServiceGetResourceRequest.annotations:type_name -> google.protobuf.Any - 23, // 52: c1.connector.v2.ResourceGetterServiceGetResourceResponse.resource:type_name -> c1.connector.v2.Resource - 41, // 53: c1.connector.v2.ResourceGetterServiceGetResourceResponse.annotations:type_name -> google.protobuf.Any - 16, // 54: c1.connector.v2.CredentialOptions.RandomPassword.constraints:type_name -> c1.connector.v2.PasswordConstraint - 19, // 55: c1.connector.v2.CredentialOptions.EncryptedPassword.encrypted_passwords:type_name -> c1.connector.v2.EncryptedData - 16, // 56: c1.connector.v2.LocalCredentialOptions.RandomPassword.constraints:type_name -> c1.connector.v2.PasswordConstraint - 23, // 57: c1.connector.v2.CreateAccountResponse.SuccessResult.resource:type_name -> c1.connector.v2.Resource - 23, // 58: c1.connector.v2.CreateAccountResponse.ActionRequiredResult.resource:type_name -> c1.connector.v2.Resource - 3, // 59: c1.connector.v2.ResourceTypesService.ListResourceTypes:input_type -> c1.connector.v2.ResourceTypesServiceListResourceTypesRequest - 24, // 60: c1.connector.v2.ResourcesService.ListResources:input_type -> c1.connector.v2.ResourcesServiceListResourcesRequest - 26, // 61: c1.connector.v2.ResourceGetterService.GetResource:input_type -> c1.connector.v2.ResourceGetterServiceGetResourceRequest - 5, // 62: c1.connector.v2.ResourceManagerService.CreateResource:input_type -> c1.connector.v2.CreateResourceRequest - 7, // 63: c1.connector.v2.ResourceManagerService.DeleteResource:input_type -> c1.connector.v2.DeleteResourceRequest - 9, // 64: c1.connector.v2.ResourceDeleterService.DeleteResourceV2:input_type -> c1.connector.v2.DeleteResourceV2Request - 11, // 65: c1.connector.v2.CredentialManagerService.RotateCredential:input_type -> c1.connector.v2.RotateCredentialRequest - 17, // 66: c1.connector.v2.AccountManagerService.CreateAccount:input_type -> c1.connector.v2.CreateAccountRequest - 4, // 67: c1.connector.v2.ResourceTypesService.ListResourceTypes:output_type -> c1.connector.v2.ResourceTypesServiceListResourceTypesResponse - 25, // 68: c1.connector.v2.ResourcesService.ListResources:output_type -> c1.connector.v2.ResourcesServiceListResourcesResponse - 27, // 69: c1.connector.v2.ResourceGetterService.GetResource:output_type -> c1.connector.v2.ResourceGetterServiceGetResourceResponse - 6, // 70: c1.connector.v2.ResourceManagerService.CreateResource:output_type -> c1.connector.v2.CreateResourceResponse - 8, // 71: c1.connector.v2.ResourceManagerService.DeleteResource:output_type -> c1.connector.v2.DeleteResourceResponse - 10, // 72: c1.connector.v2.ResourceDeleterService.DeleteResourceV2:output_type -> c1.connector.v2.DeleteResourceV2Response - 12, // 73: c1.connector.v2.CredentialManagerService.RotateCredential:output_type -> c1.connector.v2.RotateCredentialResponse - 18, // 74: c1.connector.v2.AccountManagerService.CreateAccount:output_type -> c1.connector.v2.CreateAccountResponse - 67, // [67:75] is the sub-list for method output_type - 59, // [59:67] is the sub-list for method input_type - 59, // [59:59] is the sub-list for extension type_name - 59, // [59:59] is the sub-list for extension extendee - 0, // [0:59] is the sub-list for field type_name + 40, // 36: c1.connector.v2.CreateAccountResponse.already_exists:type_name -> c1.connector.v2.CreateAccountResponse.AlreadyExistsResult + 41, // 37: c1.connector.v2.CreateAccountResponse.in_progress:type_name -> c1.connector.v2.CreateAccountResponse.InProgressResult + 19, // 38: c1.connector.v2.CreateAccountResponse.encrypted_data:type_name -> c1.connector.v2.EncryptedData + 43, // 39: c1.connector.v2.CreateAccountResponse.annotations:type_name -> google.protobuf.Any + 23, // 40: c1.connector.v2.EncryptionConfig.principal:type_name -> c1.connector.v2.Resource + 42, // 41: c1.connector.v2.EncryptionConfig.jwk_public_key_config:type_name -> c1.connector.v2.EncryptionConfig.JWKPublicKeyConfig + 22, // 42: c1.connector.v2.Resource.id:type_name -> c1.connector.v2.ResourceId + 22, // 43: c1.connector.v2.Resource.parent_resource_id:type_name -> c1.connector.v2.ResourceId + 43, // 44: c1.connector.v2.Resource.annotations:type_name -> google.protobuf.Any + 28, // 45: c1.connector.v2.Resource.external_id:type_name -> c1.connector.v2.ExternalId + 1, // 46: c1.connector.v2.Resource.creation_source:type_name -> c1.connector.v2.Resource.CreationSource + 22, // 47: c1.connector.v2.ResourcesServiceListResourcesRequest.parent_resource_id:type_name -> c1.connector.v2.ResourceId + 43, // 48: c1.connector.v2.ResourcesServiceListResourcesRequest.annotations:type_name -> google.protobuf.Any + 23, // 49: c1.connector.v2.ResourcesServiceListResourcesResponse.list:type_name -> c1.connector.v2.Resource + 43, // 50: c1.connector.v2.ResourcesServiceListResourcesResponse.annotations:type_name -> google.protobuf.Any + 22, // 51: c1.connector.v2.ResourceGetterServiceGetResourceRequest.resource_id:type_name -> c1.connector.v2.ResourceId + 22, // 52: c1.connector.v2.ResourceGetterServiceGetResourceRequest.parent_resource_id:type_name -> c1.connector.v2.ResourceId + 43, // 53: c1.connector.v2.ResourceGetterServiceGetResourceRequest.annotations:type_name -> google.protobuf.Any + 23, // 54: c1.connector.v2.ResourceGetterServiceGetResourceResponse.resource:type_name -> c1.connector.v2.Resource + 43, // 55: c1.connector.v2.ResourceGetterServiceGetResourceResponse.annotations:type_name -> google.protobuf.Any + 16, // 56: c1.connector.v2.CredentialOptions.RandomPassword.constraints:type_name -> c1.connector.v2.PasswordConstraint + 19, // 57: c1.connector.v2.CredentialOptions.EncryptedPassword.encrypted_passwords:type_name -> c1.connector.v2.EncryptedData + 16, // 58: c1.connector.v2.LocalCredentialOptions.RandomPassword.constraints:type_name -> c1.connector.v2.PasswordConstraint + 23, // 59: c1.connector.v2.CreateAccountResponse.SuccessResult.resource:type_name -> c1.connector.v2.Resource + 23, // 60: c1.connector.v2.CreateAccountResponse.ActionRequiredResult.resource:type_name -> c1.connector.v2.Resource + 23, // 61: c1.connector.v2.CreateAccountResponse.AlreadyExistsResult.resource:type_name -> c1.connector.v2.Resource + 23, // 62: c1.connector.v2.CreateAccountResponse.InProgressResult.resource:type_name -> c1.connector.v2.Resource + 3, // 63: c1.connector.v2.ResourceTypesService.ListResourceTypes:input_type -> c1.connector.v2.ResourceTypesServiceListResourceTypesRequest + 24, // 64: c1.connector.v2.ResourcesService.ListResources:input_type -> c1.connector.v2.ResourcesServiceListResourcesRequest + 26, // 65: c1.connector.v2.ResourceGetterService.GetResource:input_type -> c1.connector.v2.ResourceGetterServiceGetResourceRequest + 5, // 66: c1.connector.v2.ResourceManagerService.CreateResource:input_type -> c1.connector.v2.CreateResourceRequest + 7, // 67: c1.connector.v2.ResourceManagerService.DeleteResource:input_type -> c1.connector.v2.DeleteResourceRequest + 9, // 68: c1.connector.v2.ResourceDeleterService.DeleteResourceV2:input_type -> c1.connector.v2.DeleteResourceV2Request + 11, // 69: c1.connector.v2.CredentialManagerService.RotateCredential:input_type -> c1.connector.v2.RotateCredentialRequest + 17, // 70: c1.connector.v2.AccountManagerService.CreateAccount:input_type -> c1.connector.v2.CreateAccountRequest + 4, // 71: c1.connector.v2.ResourceTypesService.ListResourceTypes:output_type -> c1.connector.v2.ResourceTypesServiceListResourceTypesResponse + 25, // 72: c1.connector.v2.ResourcesService.ListResources:output_type -> c1.connector.v2.ResourcesServiceListResourcesResponse + 27, // 73: c1.connector.v2.ResourceGetterService.GetResource:output_type -> c1.connector.v2.ResourceGetterServiceGetResourceResponse + 6, // 74: c1.connector.v2.ResourceManagerService.CreateResource:output_type -> c1.connector.v2.CreateResourceResponse + 8, // 75: c1.connector.v2.ResourceManagerService.DeleteResource:output_type -> c1.connector.v2.DeleteResourceResponse + 10, // 76: c1.connector.v2.ResourceDeleterService.DeleteResourceV2:output_type -> c1.connector.v2.DeleteResourceV2Response + 12, // 77: c1.connector.v2.CredentialManagerService.RotateCredential:output_type -> c1.connector.v2.RotateCredentialResponse + 18, // 78: c1.connector.v2.AccountManagerService.CreateAccount:output_type -> c1.connector.v2.CreateAccountResponse + 71, // [71:79] is the sub-list for method output_type + 63, // [63:71] is the sub-list for method input_type + 63, // [63:63] is the sub-list for extension type_name + 63, // [63:63] is the sub-list for extension extendee + 0, // [0:63] is the sub-list for field type_name } func init() { file_c1_connector_v2_resource_proto_init() } @@ -4540,6 +4842,8 @@ func file_c1_connector_v2_resource_proto_init() { file_c1_connector_v2_resource_proto_msgTypes[16].OneofWrappers = []any{ (*createAccountResponse_Success)(nil), (*createAccountResponse_ActionRequired)(nil), + (*createAccountResponse_AlreadyExists)(nil), + (*createAccountResponse_InProgress)(nil), } file_c1_connector_v2_resource_proto_msgTypes[19].OneofWrappers = []any{ (*encryptionConfig_JwkPublicKeyConfig)(nil), @@ -4550,7 +4854,7 @@ func file_c1_connector_v2_resource_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_c1_connector_v2_resource_proto_rawDesc), len(file_c1_connector_v2_resource_proto_rawDesc)), NumEnums: 2, - NumMessages: 39, + NumMessages: 41, NumExtensions: 0, NumServices: 7, }, diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/baton.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/baton.pb.go index 6807375a..76d95c61 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/baton.pb.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/baton.pb.go @@ -2541,6 +2541,7 @@ type Task_SyncFullTask struct { Annotations []*anypb.Any `protobuf:"bytes,1,rep,name=annotations,proto3" json:"annotations,omitempty"` SkipExpandGrants bool `protobuf:"varint,2,opt,name=skip_expand_grants,json=skipExpandGrants,proto3" json:"skip_expand_grants,omitempty"` SkipEntitlementsAndGrants bool `protobuf:"varint,3,opt,name=skip_entitlements_and_grants,json=skipEntitlementsAndGrants,proto3" json:"skip_entitlements_and_grants,omitempty"` + TargetedSyncResources []*v2.Resource `protobuf:"bytes,4,rep,name=targeted_sync_resources,json=targetedSyncResources,proto3" json:"targeted_sync_resources,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -2591,6 +2592,13 @@ func (x *Task_SyncFullTask) GetSkipEntitlementsAndGrants() bool { return false } +func (x *Task_SyncFullTask) GetTargetedSyncResources() []*v2.Resource { + if x != nil { + return x.TargetedSyncResources + } + return nil +} + func (x *Task_SyncFullTask) SetAnnotations(v []*anypb.Any) { x.Annotations = v } @@ -2603,12 +2611,17 @@ func (x *Task_SyncFullTask) SetSkipEntitlementsAndGrants(v bool) { x.SkipEntitlementsAndGrants = v } +func (x *Task_SyncFullTask) SetTargetedSyncResources(v []*v2.Resource) { + x.TargetedSyncResources = v +} + type Task_SyncFullTask_builder struct { _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. Annotations []*anypb.Any SkipExpandGrants bool SkipEntitlementsAndGrants bool + TargetedSyncResources []*v2.Resource } func (b0 Task_SyncFullTask_builder) Build() *Task_SyncFullTask { @@ -2618,6 +2631,7 @@ func (b0 Task_SyncFullTask_builder) Build() *Task_SyncFullTask { x.Annotations = b.Annotations x.SkipExpandGrants = b.SkipExpandGrants x.SkipEntitlementsAndGrants = b.SkipEntitlementsAndGrants + x.TargetedSyncResources = b.TargetedSyncResources return m0 } @@ -2922,6 +2936,7 @@ type Task_CreateAccountTask struct { AccountInfo *v2.AccountInfo `protobuf:"bytes,1,opt,name=account_info,json=accountInfo,proto3" json:"account_info,omitempty"` CredentialOptions *v2.CredentialOptions `protobuf:"bytes,2,opt,name=credential_options,json=credentialOptions,proto3" json:"credential_options,omitempty"` EncryptionConfigs []*v2.EncryptionConfig `protobuf:"bytes,3,rep,name=encryption_configs,json=encryptionConfigs,proto3" json:"encryption_configs,omitempty"` + ResourceTypeId string `protobuf:"bytes,4,opt,name=resource_type_id,json=resourceTypeId,proto3" json:"resource_type_id,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -2972,6 +2987,13 @@ func (x *Task_CreateAccountTask) GetEncryptionConfigs() []*v2.EncryptionConfig { return nil } +func (x *Task_CreateAccountTask) GetResourceTypeId() string { + if x != nil { + return x.ResourceTypeId + } + return "" +} + func (x *Task_CreateAccountTask) SetAccountInfo(v *v2.AccountInfo) { x.AccountInfo = v } @@ -2984,6 +3006,10 @@ func (x *Task_CreateAccountTask) SetEncryptionConfigs(v []*v2.EncryptionConfig) x.EncryptionConfigs = v } +func (x *Task_CreateAccountTask) SetResourceTypeId(v string) { + x.ResourceTypeId = v +} + func (x *Task_CreateAccountTask) HasAccountInfo() bool { if x == nil { return false @@ -3012,6 +3038,7 @@ type Task_CreateAccountTask_builder struct { AccountInfo *v2.AccountInfo CredentialOptions *v2.CredentialOptions EncryptionConfigs []*v2.EncryptionConfig + ResourceTypeId string } func (b0 Task_CreateAccountTask_builder) Build() *Task_CreateAccountTask { @@ -3021,6 +3048,7 @@ func (b0 Task_CreateAccountTask_builder) Build() *Task_CreateAccountTask { x.AccountInfo = b.AccountInfo x.CredentialOptions = b.CredentialOptions x.EncryptionConfigs = b.EncryptionConfigs + x.ResourceTypeId = b.ResourceTypeId return m0 } @@ -3642,10 +3670,12 @@ func (b0 Task_GetTicketTask_builder) Build() *Task_GetTicketTask { } type Task_ActionListSchemasTask struct { - state protoimpl.MessageState `protogen:"hybrid.v1"` - Annotations []*anypb.Any `protobuf:"bytes,1,rep,name=annotations,proto3" json:"annotations,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"hybrid.v1"` + Annotations []*anypb.Any `protobuf:"bytes,1,rep,name=annotations,proto3" json:"annotations,omitempty"` + // Optional: filter to only return actions for a specific resource type + ResourceTypeId string `protobuf:"bytes,2,opt,name=resource_type_id,json=resourceTypeId,proto3" json:"resource_type_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Task_ActionListSchemasTask) Reset() { @@ -3680,14 +3710,27 @@ func (x *Task_ActionListSchemasTask) GetAnnotations() []*anypb.Any { return nil } +func (x *Task_ActionListSchemasTask) GetResourceTypeId() string { + if x != nil { + return x.ResourceTypeId + } + return "" +} + func (x *Task_ActionListSchemasTask) SetAnnotations(v []*anypb.Any) { x.Annotations = v } +func (x *Task_ActionListSchemasTask) SetResourceTypeId(v string) { + x.ResourceTypeId = v +} + type Task_ActionListSchemasTask_builder struct { _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. Annotations []*anypb.Any + // Optional: filter to only return actions for a specific resource type + ResourceTypeId string } func (b0 Task_ActionListSchemasTask_builder) Build() *Task_ActionListSchemasTask { @@ -3695,6 +3738,7 @@ func (b0 Task_ActionListSchemasTask_builder) Build() *Task_ActionListSchemasTask b, x := &b0, m0 _, _ = b, x x.Annotations = b.Annotations + x.ResourceTypeId = b.ResourceTypeId return m0 } @@ -3770,12 +3814,14 @@ func (b0 Task_ActionGetSchemaTask_builder) Build() *Task_ActionGetSchemaTask { } type Task_ActionInvokeTask struct { - state protoimpl.MessageState `protogen:"hybrid.v1"` - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Args *structpb.Struct `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty"` - Annotations []*anypb.Any `protobuf:"bytes,3,rep,name=annotations,proto3" json:"annotations,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"hybrid.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Args *structpb.Struct `protobuf:"bytes,2,opt,name=args,proto3" json:"args,omitempty"` + Annotations []*anypb.Any `protobuf:"bytes,3,rep,name=annotations,proto3" json:"annotations,omitempty"` + // Optional: if set, invokes a resource-scoped action + ResourceTypeId string `protobuf:"bytes,4,opt,name=resource_type_id,json=resourceTypeId,proto3" json:"resource_type_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Task_ActionInvokeTask) Reset() { @@ -3824,6 +3870,13 @@ func (x *Task_ActionInvokeTask) GetAnnotations() []*anypb.Any { return nil } +func (x *Task_ActionInvokeTask) GetResourceTypeId() string { + if x != nil { + return x.ResourceTypeId + } + return "" +} + func (x *Task_ActionInvokeTask) SetName(v string) { x.Name = v } @@ -3836,6 +3889,10 @@ func (x *Task_ActionInvokeTask) SetAnnotations(v []*anypb.Any) { x.Annotations = v } +func (x *Task_ActionInvokeTask) SetResourceTypeId(v string) { + x.ResourceTypeId = v +} + func (x *Task_ActionInvokeTask) HasArgs() bool { if x == nil { return false @@ -3853,6 +3910,8 @@ type Task_ActionInvokeTask_builder struct { Name string Args *structpb.Struct Annotations []*anypb.Any + // Optional: if set, invokes a resource-scoped action + ResourceTypeId string } func (b0 Task_ActionInvokeTask_builder) Build() *Task_ActionInvokeTask { @@ -3862,6 +3921,7 @@ func (b0 Task_ActionInvokeTask_builder) Build() *Task_ActionInvokeTask { x.Name = b.Name x.Args = b.Args x.Annotations = b.Annotations + x.ResourceTypeId = b.ResourceTypeId return m0 } @@ -4826,7 +4886,7 @@ var File_c1_connectorapi_baton_v1_baton_proto protoreflect.FileDescriptor const file_c1_connectorapi_baton_v1_baton_proto_rawDesc = "" + "\n" + - "$c1/connectorapi/baton/v1/baton.proto\x12\x18c1.connectorapi.baton.v1\x1a\x1fc1/connector/v2/connector.proto\x1a!c1/connector/v2/entitlement.proto\x1a\x1bc1/connector/v2/grant.proto\x1a\x1ec1/connector/v2/resource.proto\x1a\x1cc1/connector/v2/ticket.proto\x1a\x19google/protobuf/any.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/rpc/status.proto\x1a\x17validate/validate.proto\"\xd9'\n" + + "$c1/connectorapi/baton/v1/baton.proto\x12\x18c1.connectorapi.baton.v1\x1a\x1fc1/connector/v2/connector.proto\x1a!c1/connector/v2/entitlement.proto\x1a\x1bc1/connector/v2/grant.proto\x1a\x1ec1/connector/v2/resource.proto\x1a\x1cc1/connector/v2/ticket.proto\x1a\x19google/protobuf/any.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/rpc/status.proto\x1a\x17validate/validate.proto\"\xb9)\n" + "\x04Task\x12\x0e\n" + "\x02id\x18\x01 \x01(\tR\x02id\x12=\n" + "\x06status\x18\x02 \x01(\x0e2%.c1.connectorapi.baton.v1.Task.StatusR\x06status\x12=\n" + @@ -4857,11 +4917,12 @@ const file_c1_connectorapi_baton_v1_baton_proto_rawDesc = "" + "\bNoneTask\x126\n" + "\vannotations\x18\x01 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1aC\n" + "\tHelloTask\x126\n" + - "\vannotations\x18\x01 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1a\xb5\x01\n" + + "\vannotations\x18\x01 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1a\x88\x02\n" + "\fSyncFullTask\x126\n" + "\vannotations\x18\x01 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x12,\n" + "\x12skip_expand_grants\x18\x02 \x01(\bR\x10skipExpandGrants\x12?\n" + - "\x1cskip_entitlements_and_grants\x18\x03 \x01(\bR\x19skipEntitlementsAndGrants\x1a~\n" + + "\x1cskip_entitlements_and_grants\x18\x03 \x01(\bR\x19skipEntitlementsAndGrants\x12Q\n" + + "\x17targeted_sync_resources\x18\x04 \x03(\v2\x19.c1.connector.v2.ResourceR\x15targetedSyncResources\x1a~\n" + "\rEventFeedTask\x126\n" + "\vannotations\x18\x01 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x125\n" + "\bstart_at\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\astartAt\x1a\xf3\x01\n" + @@ -4873,11 +4934,13 @@ const file_c1_connectorapi_baton_v1_baton_proto_rawDesc = "" + "\n" + "RevokeTask\x12,\n" + "\x05grant\x18\x01 \x01(\v2\x16.c1.connector.v2.GrantR\x05grant\x126\n" + - "\vannotations\x18\x02 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1a\xf9\x01\n" + + "\vannotations\x18\x02 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1a\xb2\x02\n" + "\x11CreateAccountTask\x12?\n" + "\faccount_info\x18\x01 \x01(\v2\x1c.c1.connector.v2.AccountInfoR\vaccountInfo\x12Q\n" + "\x12credential_options\x18\x02 \x01(\v2\".c1.connector.v2.CredentialOptionsR\x11credentialOptions\x12P\n" + - "\x12encryption_configs\x18\x03 \x03(\v2!.c1.connector.v2.EncryptionConfigR\x11encryptionConfigs\x1aK\n" + + "\x12encryption_configs\x18\x03 \x03(\v2!.c1.connector.v2.EncryptionConfigR\x11encryptionConfigs\x127\n" + + "\x10resource_type_id\x18\x04 \x01(\tB\r\xfaB\n" + + "r\b \x01(\x80\b\xd0\x01\x01R\x0eresourceTypeId\x1aK\n" + "\x12CreateResourceTask\x125\n" + "\bresource\x18\x01 \x01(\v2\x19.c1.connector.v2.ResourceR\bresource\x1a\x9d\x01\n" + "\x12DeleteResourceTask\x12<\n" + @@ -4901,16 +4964,18 @@ const file_c1_connectorapi_baton_v1_baton_proto_rawDesc = "" + "\vannotations\x18\x01 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1ad\n" + "\rGetTicketTask\x12\x1b\n" + "\tticket_id\x18\x01 \x01(\tR\bticketId\x126\n" + - "\vannotations\x18\x02 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1aO\n" + + "\vannotations\x18\x02 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1ay\n" + "\x15ActionListSchemasTask\x126\n" + - "\vannotations\x18\x01 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1aa\n" + + "\vannotations\x18\x01 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x12(\n" + + "\x10resource_type_id\x18\x02 \x01(\tR\x0eresourceTypeId\x1aa\n" + "\x13ActionGetSchemaTask\x12\x12\n" + "\x04name\x18\x01 \x01(\tR\x04name\x126\n" + - "\vannotations\x18\x02 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1a\x8b\x01\n" + + "\vannotations\x18\x02 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1a\xb5\x01\n" + "\x10ActionInvokeTask\x12\x12\n" + "\x04name\x18\x01 \x01(\tR\x04name\x12+\n" + "\x04args\x18\x02 \x01(\v2\x17.google.protobuf.StructR\x04args\x126\n" + - "\vannotations\x18\x03 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1an\n" + + "\vannotations\x18\x03 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x12(\n" + + "\x10resource_type_id\x18\x04 \x01(\tR\x0eresourceTypeId\x1an\n" + "\x10ActionStatusTask\x12\x12\n" + "\x04name\x18\x01 \x01(\tR\x04name\x12\x0e\n" + "\x02id\x18\x02 \x01(\tR\x02id\x126\n" + @@ -5084,9 +5149,9 @@ var file_c1_connectorapi_baton_v1_baton_proto_goTypes = []any{ (*anypb.Any)(nil), // 44: google.protobuf.Any (*durationpb.Duration)(nil), // 45: google.protobuf.Duration (*status.Status)(nil), // 46: google.rpc.Status - (*timestamppb.Timestamp)(nil), // 47: google.protobuf.Timestamp - (*v2.Entitlement)(nil), // 48: c1.connector.v2.Entitlement - (*v2.Resource)(nil), // 49: c1.connector.v2.Resource + (*v2.Resource)(nil), // 47: c1.connector.v2.Resource + (*timestamppb.Timestamp)(nil), // 48: google.protobuf.Timestamp + (*v2.Entitlement)(nil), // 49: c1.connector.v2.Entitlement (*v2.Grant)(nil), // 50: c1.connector.v2.Grant (*v2.AccountInfo)(nil), // 51: c1.connector.v2.AccountInfo (*v2.CredentialOptions)(nil), // 52: c1.connector.v2.CredentialOptions @@ -5142,61 +5207,62 @@ var file_c1_connectorapi_baton_v1_baton_proto_depIdxs = []int32{ 44, // 42: c1.connectorapi.baton.v1.Task.NoneTask.annotations:type_name -> google.protobuf.Any 44, // 43: c1.connectorapi.baton.v1.Task.HelloTask.annotations:type_name -> google.protobuf.Any 44, // 44: c1.connectorapi.baton.v1.Task.SyncFullTask.annotations:type_name -> google.protobuf.Any - 44, // 45: c1.connectorapi.baton.v1.Task.EventFeedTask.annotations:type_name -> google.protobuf.Any - 47, // 46: c1.connectorapi.baton.v1.Task.EventFeedTask.start_at:type_name -> google.protobuf.Timestamp - 48, // 47: c1.connectorapi.baton.v1.Task.GrantTask.entitlement:type_name -> c1.connector.v2.Entitlement - 49, // 48: c1.connectorapi.baton.v1.Task.GrantTask.principal:type_name -> c1.connector.v2.Resource - 44, // 49: c1.connectorapi.baton.v1.Task.GrantTask.annotations:type_name -> google.protobuf.Any - 45, // 50: c1.connectorapi.baton.v1.Task.GrantTask.duration:type_name -> google.protobuf.Duration - 50, // 51: c1.connectorapi.baton.v1.Task.RevokeTask.grant:type_name -> c1.connector.v2.Grant - 44, // 52: c1.connectorapi.baton.v1.Task.RevokeTask.annotations:type_name -> google.protobuf.Any - 51, // 53: c1.connectorapi.baton.v1.Task.CreateAccountTask.account_info:type_name -> c1.connector.v2.AccountInfo - 52, // 54: c1.connectorapi.baton.v1.Task.CreateAccountTask.credential_options:type_name -> c1.connector.v2.CredentialOptions - 53, // 55: c1.connectorapi.baton.v1.Task.CreateAccountTask.encryption_configs:type_name -> c1.connector.v2.EncryptionConfig - 49, // 56: c1.connectorapi.baton.v1.Task.CreateResourceTask.resource:type_name -> c1.connector.v2.Resource - 54, // 57: c1.connectorapi.baton.v1.Task.DeleteResourceTask.resource_id:type_name -> c1.connector.v2.ResourceId - 54, // 58: c1.connectorapi.baton.v1.Task.DeleteResourceTask.parent_resource_id:type_name -> c1.connector.v2.ResourceId - 54, // 59: c1.connectorapi.baton.v1.Task.RotateCredentialsTask.resource_id:type_name -> c1.connector.v2.ResourceId - 52, // 60: c1.connectorapi.baton.v1.Task.RotateCredentialsTask.credential_options:type_name -> c1.connector.v2.CredentialOptions - 53, // 61: c1.connectorapi.baton.v1.Task.RotateCredentialsTask.encryption_configs:type_name -> c1.connector.v2.EncryptionConfig - 55, // 62: c1.connectorapi.baton.v1.Task.CreateTicketTask.ticket_request:type_name -> c1.connector.v2.TicketRequest - 56, // 63: c1.connectorapi.baton.v1.Task.CreateTicketTask.ticket_schema:type_name -> c1.connector.v2.TicketSchema - 44, // 64: c1.connectorapi.baton.v1.Task.CreateTicketTask.annotations:type_name -> google.protobuf.Any - 24, // 65: c1.connectorapi.baton.v1.Task.BulkCreateTicketsTask.ticket_requests:type_name -> c1.connectorapi.baton.v1.Task.CreateTicketTask - 28, // 66: c1.connectorapi.baton.v1.Task.BulkGetTicketsTask.ticket_requests:type_name -> c1.connectorapi.baton.v1.Task.GetTicketTask - 44, // 67: c1.connectorapi.baton.v1.Task.ListTicketSchemasTask.annotations:type_name -> google.protobuf.Any - 44, // 68: c1.connectorapi.baton.v1.Task.GetTicketTask.annotations:type_name -> google.protobuf.Any - 44, // 69: c1.connectorapi.baton.v1.Task.ActionListSchemasTask.annotations:type_name -> google.protobuf.Any - 44, // 70: c1.connectorapi.baton.v1.Task.ActionGetSchemaTask.annotations:type_name -> google.protobuf.Any - 57, // 71: c1.connectorapi.baton.v1.Task.ActionInvokeTask.args:type_name -> google.protobuf.Struct - 44, // 72: c1.connectorapi.baton.v1.Task.ActionInvokeTask.annotations:type_name -> google.protobuf.Any - 44, // 73: c1.connectorapi.baton.v1.Task.ActionStatusTask.annotations:type_name -> google.protobuf.Any - 44, // 74: c1.connectorapi.baton.v1.Task.CreateSyncDiffTask.annotations:type_name -> google.protobuf.Any - 35, // 75: c1.connectorapi.baton.v1.Task.CompactSyncs.compactable_syncs:type_name -> c1.connectorapi.baton.v1.Task.CompactSyncs.CompactableSync - 44, // 76: c1.connectorapi.baton.v1.Task.CompactSyncs.annotations:type_name -> google.protobuf.Any - 44, // 77: c1.connectorapi.baton.v1.BatonServiceUploadAssetRequest.UploadMetadata.annotations:type_name -> google.protobuf.Any - 44, // 78: c1.connectorapi.baton.v1.BatonServiceUploadAssetRequest.UploadEOF.annotations:type_name -> google.protobuf.Any - 44, // 79: c1.connectorapi.baton.v1.BatonServiceFinishTaskRequest.Error.annotations:type_name -> google.protobuf.Any - 44, // 80: c1.connectorapi.baton.v1.BatonServiceFinishTaskRequest.Error.response:type_name -> google.protobuf.Any - 44, // 81: c1.connectorapi.baton.v1.BatonServiceFinishTaskRequest.Success.annotations:type_name -> google.protobuf.Any - 44, // 82: c1.connectorapi.baton.v1.BatonServiceFinishTaskRequest.Success.response:type_name -> google.protobuf.Any - 2, // 83: c1.connectorapi.baton.v1.BatonService.Hello:input_type -> c1.connectorapi.baton.v1.BatonServiceHelloRequest - 4, // 84: c1.connectorapi.baton.v1.BatonService.GetTask:input_type -> c1.connectorapi.baton.v1.BatonServiceGetTaskRequest - 6, // 85: c1.connectorapi.baton.v1.BatonService.Heartbeat:input_type -> c1.connectorapi.baton.v1.BatonServiceHeartbeatRequest - 10, // 86: c1.connectorapi.baton.v1.BatonService.FinishTask:input_type -> c1.connectorapi.baton.v1.BatonServiceFinishTaskRequest - 8, // 87: c1.connectorapi.baton.v1.BatonService.UploadAsset:input_type -> c1.connectorapi.baton.v1.BatonServiceUploadAssetRequest - 12, // 88: c1.connectorapi.baton.v1.BatonService.StartDebugging:input_type -> c1.connectorapi.baton.v1.StartDebuggingRequest - 3, // 89: c1.connectorapi.baton.v1.BatonService.Hello:output_type -> c1.connectorapi.baton.v1.BatonServiceHelloResponse - 5, // 90: c1.connectorapi.baton.v1.BatonService.GetTask:output_type -> c1.connectorapi.baton.v1.BatonServiceGetTaskResponse - 7, // 91: c1.connectorapi.baton.v1.BatonService.Heartbeat:output_type -> c1.connectorapi.baton.v1.BatonServiceHeartbeatResponse - 11, // 92: c1.connectorapi.baton.v1.BatonService.FinishTask:output_type -> c1.connectorapi.baton.v1.BatonServiceFinishTaskResponse - 9, // 93: c1.connectorapi.baton.v1.BatonService.UploadAsset:output_type -> c1.connectorapi.baton.v1.BatonServiceUploadAssetResponse - 13, // 94: c1.connectorapi.baton.v1.BatonService.StartDebugging:output_type -> c1.connectorapi.baton.v1.StartDebuggingResponse - 89, // [89:95] is the sub-list for method output_type - 83, // [83:89] is the sub-list for method input_type - 83, // [83:83] is the sub-list for extension type_name - 83, // [83:83] is the sub-list for extension extendee - 0, // [0:83] is the sub-list for field type_name + 47, // 45: c1.connectorapi.baton.v1.Task.SyncFullTask.targeted_sync_resources:type_name -> c1.connector.v2.Resource + 44, // 46: c1.connectorapi.baton.v1.Task.EventFeedTask.annotations:type_name -> google.protobuf.Any + 48, // 47: c1.connectorapi.baton.v1.Task.EventFeedTask.start_at:type_name -> google.protobuf.Timestamp + 49, // 48: c1.connectorapi.baton.v1.Task.GrantTask.entitlement:type_name -> c1.connector.v2.Entitlement + 47, // 49: c1.connectorapi.baton.v1.Task.GrantTask.principal:type_name -> c1.connector.v2.Resource + 44, // 50: c1.connectorapi.baton.v1.Task.GrantTask.annotations:type_name -> google.protobuf.Any + 45, // 51: c1.connectorapi.baton.v1.Task.GrantTask.duration:type_name -> google.protobuf.Duration + 50, // 52: c1.connectorapi.baton.v1.Task.RevokeTask.grant:type_name -> c1.connector.v2.Grant + 44, // 53: c1.connectorapi.baton.v1.Task.RevokeTask.annotations:type_name -> google.protobuf.Any + 51, // 54: c1.connectorapi.baton.v1.Task.CreateAccountTask.account_info:type_name -> c1.connector.v2.AccountInfo + 52, // 55: c1.connectorapi.baton.v1.Task.CreateAccountTask.credential_options:type_name -> c1.connector.v2.CredentialOptions + 53, // 56: c1.connectorapi.baton.v1.Task.CreateAccountTask.encryption_configs:type_name -> c1.connector.v2.EncryptionConfig + 47, // 57: c1.connectorapi.baton.v1.Task.CreateResourceTask.resource:type_name -> c1.connector.v2.Resource + 54, // 58: c1.connectorapi.baton.v1.Task.DeleteResourceTask.resource_id:type_name -> c1.connector.v2.ResourceId + 54, // 59: c1.connectorapi.baton.v1.Task.DeleteResourceTask.parent_resource_id:type_name -> c1.connector.v2.ResourceId + 54, // 60: c1.connectorapi.baton.v1.Task.RotateCredentialsTask.resource_id:type_name -> c1.connector.v2.ResourceId + 52, // 61: c1.connectorapi.baton.v1.Task.RotateCredentialsTask.credential_options:type_name -> c1.connector.v2.CredentialOptions + 53, // 62: c1.connectorapi.baton.v1.Task.RotateCredentialsTask.encryption_configs:type_name -> c1.connector.v2.EncryptionConfig + 55, // 63: c1.connectorapi.baton.v1.Task.CreateTicketTask.ticket_request:type_name -> c1.connector.v2.TicketRequest + 56, // 64: c1.connectorapi.baton.v1.Task.CreateTicketTask.ticket_schema:type_name -> c1.connector.v2.TicketSchema + 44, // 65: c1.connectorapi.baton.v1.Task.CreateTicketTask.annotations:type_name -> google.protobuf.Any + 24, // 66: c1.connectorapi.baton.v1.Task.BulkCreateTicketsTask.ticket_requests:type_name -> c1.connectorapi.baton.v1.Task.CreateTicketTask + 28, // 67: c1.connectorapi.baton.v1.Task.BulkGetTicketsTask.ticket_requests:type_name -> c1.connectorapi.baton.v1.Task.GetTicketTask + 44, // 68: c1.connectorapi.baton.v1.Task.ListTicketSchemasTask.annotations:type_name -> google.protobuf.Any + 44, // 69: c1.connectorapi.baton.v1.Task.GetTicketTask.annotations:type_name -> google.protobuf.Any + 44, // 70: c1.connectorapi.baton.v1.Task.ActionListSchemasTask.annotations:type_name -> google.protobuf.Any + 44, // 71: c1.connectorapi.baton.v1.Task.ActionGetSchemaTask.annotations:type_name -> google.protobuf.Any + 57, // 72: c1.connectorapi.baton.v1.Task.ActionInvokeTask.args:type_name -> google.protobuf.Struct + 44, // 73: c1.connectorapi.baton.v1.Task.ActionInvokeTask.annotations:type_name -> google.protobuf.Any + 44, // 74: c1.connectorapi.baton.v1.Task.ActionStatusTask.annotations:type_name -> google.protobuf.Any + 44, // 75: c1.connectorapi.baton.v1.Task.CreateSyncDiffTask.annotations:type_name -> google.protobuf.Any + 35, // 76: c1.connectorapi.baton.v1.Task.CompactSyncs.compactable_syncs:type_name -> c1.connectorapi.baton.v1.Task.CompactSyncs.CompactableSync + 44, // 77: c1.connectorapi.baton.v1.Task.CompactSyncs.annotations:type_name -> google.protobuf.Any + 44, // 78: c1.connectorapi.baton.v1.BatonServiceUploadAssetRequest.UploadMetadata.annotations:type_name -> google.protobuf.Any + 44, // 79: c1.connectorapi.baton.v1.BatonServiceUploadAssetRequest.UploadEOF.annotations:type_name -> google.protobuf.Any + 44, // 80: c1.connectorapi.baton.v1.BatonServiceFinishTaskRequest.Error.annotations:type_name -> google.protobuf.Any + 44, // 81: c1.connectorapi.baton.v1.BatonServiceFinishTaskRequest.Error.response:type_name -> google.protobuf.Any + 44, // 82: c1.connectorapi.baton.v1.BatonServiceFinishTaskRequest.Success.annotations:type_name -> google.protobuf.Any + 44, // 83: c1.connectorapi.baton.v1.BatonServiceFinishTaskRequest.Success.response:type_name -> google.protobuf.Any + 2, // 84: c1.connectorapi.baton.v1.BatonService.Hello:input_type -> c1.connectorapi.baton.v1.BatonServiceHelloRequest + 4, // 85: c1.connectorapi.baton.v1.BatonService.GetTask:input_type -> c1.connectorapi.baton.v1.BatonServiceGetTaskRequest + 6, // 86: c1.connectorapi.baton.v1.BatonService.Heartbeat:input_type -> c1.connectorapi.baton.v1.BatonServiceHeartbeatRequest + 10, // 87: c1.connectorapi.baton.v1.BatonService.FinishTask:input_type -> c1.connectorapi.baton.v1.BatonServiceFinishTaskRequest + 8, // 88: c1.connectorapi.baton.v1.BatonService.UploadAsset:input_type -> c1.connectorapi.baton.v1.BatonServiceUploadAssetRequest + 12, // 89: c1.connectorapi.baton.v1.BatonService.StartDebugging:input_type -> c1.connectorapi.baton.v1.StartDebuggingRequest + 3, // 90: c1.connectorapi.baton.v1.BatonService.Hello:output_type -> c1.connectorapi.baton.v1.BatonServiceHelloResponse + 5, // 91: c1.connectorapi.baton.v1.BatonService.GetTask:output_type -> c1.connectorapi.baton.v1.BatonServiceGetTaskResponse + 7, // 92: c1.connectorapi.baton.v1.BatonService.Heartbeat:output_type -> c1.connectorapi.baton.v1.BatonServiceHeartbeatResponse + 11, // 93: c1.connectorapi.baton.v1.BatonService.FinishTask:output_type -> c1.connectorapi.baton.v1.BatonServiceFinishTaskResponse + 9, // 94: c1.connectorapi.baton.v1.BatonService.UploadAsset:output_type -> c1.connectorapi.baton.v1.BatonServiceUploadAssetResponse + 13, // 95: c1.connectorapi.baton.v1.BatonService.StartDebugging:output_type -> c1.connectorapi.baton.v1.StartDebuggingResponse + 90, // [90:96] is the sub-list for method output_type + 84, // [84:90] is the sub-list for method input_type + 84, // [84:84] is the sub-list for extension type_name + 84, // [84:84] is the sub-list for extension extendee + 0, // [0:84] is the sub-list for field type_name } func init() { file_c1_connectorapi_baton_v1_baton_proto_init() } diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/baton.pb.validate.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/baton.pb.validate.go index bf4b6afe..a7b9b06d 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/baton.pb.validate.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/baton.pb.validate.go @@ -3418,6 +3418,40 @@ func (m *Task_SyncFullTask) validate(all bool) error { // no validation rules for SkipEntitlementsAndGrants + for idx, item := range m.GetTargetedSyncResources() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, Task_SyncFullTaskValidationError{ + field: fmt.Sprintf("TargetedSyncResources[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, Task_SyncFullTaskValidationError{ + field: fmt.Sprintf("TargetedSyncResources[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return Task_SyncFullTaskValidationError{ + field: fmt.Sprintf("TargetedSyncResources[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + if len(errors) > 0 { return Task_SyncFullTaskMultiError(errors) } @@ -4161,6 +4195,21 @@ func (m *Task_CreateAccountTask) validate(all bool) error { } + if m.GetResourceTypeId() != "" { + + if l := len(m.GetResourceTypeId()); l < 1 || l > 1024 { + err := Task_CreateAccountTaskValidationError{ + field: "ResourceTypeId", + reason: "value length must be between 1 and 1024 bytes, inclusive", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + if len(errors) > 0 { return Task_CreateAccountTaskMultiError(errors) } @@ -5522,6 +5571,8 @@ func (m *Task_ActionListSchemasTask) validate(all bool) error { } + // no validation rules for ResourceTypeId + if len(errors) > 0 { return Task_ActionListSchemasTaskMultiError(errors) } @@ -5827,6 +5878,8 @@ func (m *Task_ActionInvokeTask) validate(all bool) error { } + // no validation rules for ResourceTypeId + if len(errors) > 0 { return Task_ActionInvokeTaskMultiError(errors) } diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/baton_protoopaque.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/baton_protoopaque.pb.go index 63c75c00..65db2f42 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/baton_protoopaque.pb.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/baton_protoopaque.pb.go @@ -2506,6 +2506,7 @@ type Task_SyncFullTask struct { xxx_hidden_Annotations *[]*anypb.Any `protobuf:"bytes,1,rep,name=annotations,proto3"` xxx_hidden_SkipExpandGrants bool `protobuf:"varint,2,opt,name=skip_expand_grants,json=skipExpandGrants,proto3"` xxx_hidden_SkipEntitlementsAndGrants bool `protobuf:"varint,3,opt,name=skip_entitlements_and_grants,json=skipEntitlementsAndGrants,proto3"` + xxx_hidden_TargetedSyncResources *[]*v2.Resource `protobuf:"bytes,4,rep,name=targeted_sync_resources,json=targetedSyncResources,proto3"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -2558,6 +2559,15 @@ func (x *Task_SyncFullTask) GetSkipEntitlementsAndGrants() bool { return false } +func (x *Task_SyncFullTask) GetTargetedSyncResources() []*v2.Resource { + if x != nil { + if x.xxx_hidden_TargetedSyncResources != nil { + return *x.xxx_hidden_TargetedSyncResources + } + } + return nil +} + func (x *Task_SyncFullTask) SetAnnotations(v []*anypb.Any) { x.xxx_hidden_Annotations = &v } @@ -2570,12 +2580,17 @@ func (x *Task_SyncFullTask) SetSkipEntitlementsAndGrants(v bool) { x.xxx_hidden_SkipEntitlementsAndGrants = v } +func (x *Task_SyncFullTask) SetTargetedSyncResources(v []*v2.Resource) { + x.xxx_hidden_TargetedSyncResources = &v +} + type Task_SyncFullTask_builder struct { _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. Annotations []*anypb.Any SkipExpandGrants bool SkipEntitlementsAndGrants bool + TargetedSyncResources []*v2.Resource } func (b0 Task_SyncFullTask_builder) Build() *Task_SyncFullTask { @@ -2585,6 +2600,7 @@ func (b0 Task_SyncFullTask_builder) Build() *Task_SyncFullTask { x.xxx_hidden_Annotations = &b.Annotations x.xxx_hidden_SkipExpandGrants = b.SkipExpandGrants x.xxx_hidden_SkipEntitlementsAndGrants = b.SkipEntitlementsAndGrants + x.xxx_hidden_TargetedSyncResources = &b.TargetedSyncResources return m0 } @@ -2895,6 +2911,7 @@ type Task_CreateAccountTask struct { xxx_hidden_AccountInfo *v2.AccountInfo `protobuf:"bytes,1,opt,name=account_info,json=accountInfo,proto3"` xxx_hidden_CredentialOptions *v2.CredentialOptions `protobuf:"bytes,2,opt,name=credential_options,json=credentialOptions,proto3"` xxx_hidden_EncryptionConfigs *[]*v2.EncryptionConfig `protobuf:"bytes,3,rep,name=encryption_configs,json=encryptionConfigs,proto3"` + xxx_hidden_ResourceTypeId string `protobuf:"bytes,4,opt,name=resource_type_id,json=resourceTypeId,proto3"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -2947,6 +2964,13 @@ func (x *Task_CreateAccountTask) GetEncryptionConfigs() []*v2.EncryptionConfig { return nil } +func (x *Task_CreateAccountTask) GetResourceTypeId() string { + if x != nil { + return x.xxx_hidden_ResourceTypeId + } + return "" +} + func (x *Task_CreateAccountTask) SetAccountInfo(v *v2.AccountInfo) { x.xxx_hidden_AccountInfo = v } @@ -2959,6 +2983,10 @@ func (x *Task_CreateAccountTask) SetEncryptionConfigs(v []*v2.EncryptionConfig) x.xxx_hidden_EncryptionConfigs = &v } +func (x *Task_CreateAccountTask) SetResourceTypeId(v string) { + x.xxx_hidden_ResourceTypeId = v +} + func (x *Task_CreateAccountTask) HasAccountInfo() bool { if x == nil { return false @@ -2987,6 +3015,7 @@ type Task_CreateAccountTask_builder struct { AccountInfo *v2.AccountInfo CredentialOptions *v2.CredentialOptions EncryptionConfigs []*v2.EncryptionConfig + ResourceTypeId string } func (b0 Task_CreateAccountTask_builder) Build() *Task_CreateAccountTask { @@ -2996,6 +3025,7 @@ func (b0 Task_CreateAccountTask_builder) Build() *Task_CreateAccountTask { x.xxx_hidden_AccountInfo = b.AccountInfo x.xxx_hidden_CredentialOptions = b.CredentialOptions x.xxx_hidden_EncryptionConfigs = &b.EncryptionConfigs + x.xxx_hidden_ResourceTypeId = b.ResourceTypeId return m0 } @@ -3629,10 +3659,11 @@ func (b0 Task_GetTicketTask_builder) Build() *Task_GetTicketTask { } type Task_ActionListSchemasTask struct { - state protoimpl.MessageState `protogen:"opaque.v1"` - xxx_hidden_Annotations *[]*anypb.Any `protobuf:"bytes,1,rep,name=annotations,proto3"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Annotations *[]*anypb.Any `protobuf:"bytes,1,rep,name=annotations,proto3"` + xxx_hidden_ResourceTypeId string `protobuf:"bytes,2,opt,name=resource_type_id,json=resourceTypeId,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Task_ActionListSchemasTask) Reset() { @@ -3669,14 +3700,27 @@ func (x *Task_ActionListSchemasTask) GetAnnotations() []*anypb.Any { return nil } +func (x *Task_ActionListSchemasTask) GetResourceTypeId() string { + if x != nil { + return x.xxx_hidden_ResourceTypeId + } + return "" +} + func (x *Task_ActionListSchemasTask) SetAnnotations(v []*anypb.Any) { x.xxx_hidden_Annotations = &v } +func (x *Task_ActionListSchemasTask) SetResourceTypeId(v string) { + x.xxx_hidden_ResourceTypeId = v +} + type Task_ActionListSchemasTask_builder struct { _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. Annotations []*anypb.Any + // Optional: filter to only return actions for a specific resource type + ResourceTypeId string } func (b0 Task_ActionListSchemasTask_builder) Build() *Task_ActionListSchemasTask { @@ -3684,6 +3728,7 @@ func (b0 Task_ActionListSchemasTask_builder) Build() *Task_ActionListSchemasTask b, x := &b0, m0 _, _ = b, x x.xxx_hidden_Annotations = &b.Annotations + x.xxx_hidden_ResourceTypeId = b.ResourceTypeId return m0 } @@ -3761,12 +3806,13 @@ func (b0 Task_ActionGetSchemaTask_builder) Build() *Task_ActionGetSchemaTask { } type Task_ActionInvokeTask struct { - state protoimpl.MessageState `protogen:"opaque.v1"` - xxx_hidden_Name string `protobuf:"bytes,1,opt,name=name,proto3"` - xxx_hidden_Args *structpb.Struct `protobuf:"bytes,2,opt,name=args,proto3"` - xxx_hidden_Annotations *[]*anypb.Any `protobuf:"bytes,3,rep,name=annotations,proto3"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Name string `protobuf:"bytes,1,opt,name=name,proto3"` + xxx_hidden_Args *structpb.Struct `protobuf:"bytes,2,opt,name=args,proto3"` + xxx_hidden_Annotations *[]*anypb.Any `protobuf:"bytes,3,rep,name=annotations,proto3"` + xxx_hidden_ResourceTypeId string `protobuf:"bytes,4,opt,name=resource_type_id,json=resourceTypeId,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Task_ActionInvokeTask) Reset() { @@ -3817,6 +3863,13 @@ func (x *Task_ActionInvokeTask) GetAnnotations() []*anypb.Any { return nil } +func (x *Task_ActionInvokeTask) GetResourceTypeId() string { + if x != nil { + return x.xxx_hidden_ResourceTypeId + } + return "" +} + func (x *Task_ActionInvokeTask) SetName(v string) { x.xxx_hidden_Name = v } @@ -3829,6 +3882,10 @@ func (x *Task_ActionInvokeTask) SetAnnotations(v []*anypb.Any) { x.xxx_hidden_Annotations = &v } +func (x *Task_ActionInvokeTask) SetResourceTypeId(v string) { + x.xxx_hidden_ResourceTypeId = v +} + func (x *Task_ActionInvokeTask) HasArgs() bool { if x == nil { return false @@ -3846,6 +3903,8 @@ type Task_ActionInvokeTask_builder struct { Name string Args *structpb.Struct Annotations []*anypb.Any + // Optional: if set, invokes a resource-scoped action + ResourceTypeId string } func (b0 Task_ActionInvokeTask_builder) Build() *Task_ActionInvokeTask { @@ -3855,6 +3914,7 @@ func (b0 Task_ActionInvokeTask_builder) Build() *Task_ActionInvokeTask { x.xxx_hidden_Name = b.Name x.xxx_hidden_Args = b.Args x.xxx_hidden_Annotations = &b.Annotations + x.xxx_hidden_ResourceTypeId = b.ResourceTypeId return m0 } @@ -4831,7 +4891,7 @@ var File_c1_connectorapi_baton_v1_baton_proto protoreflect.FileDescriptor const file_c1_connectorapi_baton_v1_baton_proto_rawDesc = "" + "\n" + - "$c1/connectorapi/baton/v1/baton.proto\x12\x18c1.connectorapi.baton.v1\x1a\x1fc1/connector/v2/connector.proto\x1a!c1/connector/v2/entitlement.proto\x1a\x1bc1/connector/v2/grant.proto\x1a\x1ec1/connector/v2/resource.proto\x1a\x1cc1/connector/v2/ticket.proto\x1a\x19google/protobuf/any.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/rpc/status.proto\x1a\x17validate/validate.proto\"\xd9'\n" + + "$c1/connectorapi/baton/v1/baton.proto\x12\x18c1.connectorapi.baton.v1\x1a\x1fc1/connector/v2/connector.proto\x1a!c1/connector/v2/entitlement.proto\x1a\x1bc1/connector/v2/grant.proto\x1a\x1ec1/connector/v2/resource.proto\x1a\x1cc1/connector/v2/ticket.proto\x1a\x19google/protobuf/any.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/rpc/status.proto\x1a\x17validate/validate.proto\"\xb9)\n" + "\x04Task\x12\x0e\n" + "\x02id\x18\x01 \x01(\tR\x02id\x12=\n" + "\x06status\x18\x02 \x01(\x0e2%.c1.connectorapi.baton.v1.Task.StatusR\x06status\x12=\n" + @@ -4862,11 +4922,12 @@ const file_c1_connectorapi_baton_v1_baton_proto_rawDesc = "" + "\bNoneTask\x126\n" + "\vannotations\x18\x01 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1aC\n" + "\tHelloTask\x126\n" + - "\vannotations\x18\x01 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1a\xb5\x01\n" + + "\vannotations\x18\x01 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1a\x88\x02\n" + "\fSyncFullTask\x126\n" + "\vannotations\x18\x01 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x12,\n" + "\x12skip_expand_grants\x18\x02 \x01(\bR\x10skipExpandGrants\x12?\n" + - "\x1cskip_entitlements_and_grants\x18\x03 \x01(\bR\x19skipEntitlementsAndGrants\x1a~\n" + + "\x1cskip_entitlements_and_grants\x18\x03 \x01(\bR\x19skipEntitlementsAndGrants\x12Q\n" + + "\x17targeted_sync_resources\x18\x04 \x03(\v2\x19.c1.connector.v2.ResourceR\x15targetedSyncResources\x1a~\n" + "\rEventFeedTask\x126\n" + "\vannotations\x18\x01 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x125\n" + "\bstart_at\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\astartAt\x1a\xf3\x01\n" + @@ -4878,11 +4939,13 @@ const file_c1_connectorapi_baton_v1_baton_proto_rawDesc = "" + "\n" + "RevokeTask\x12,\n" + "\x05grant\x18\x01 \x01(\v2\x16.c1.connector.v2.GrantR\x05grant\x126\n" + - "\vannotations\x18\x02 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1a\xf9\x01\n" + + "\vannotations\x18\x02 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1a\xb2\x02\n" + "\x11CreateAccountTask\x12?\n" + "\faccount_info\x18\x01 \x01(\v2\x1c.c1.connector.v2.AccountInfoR\vaccountInfo\x12Q\n" + "\x12credential_options\x18\x02 \x01(\v2\".c1.connector.v2.CredentialOptionsR\x11credentialOptions\x12P\n" + - "\x12encryption_configs\x18\x03 \x03(\v2!.c1.connector.v2.EncryptionConfigR\x11encryptionConfigs\x1aK\n" + + "\x12encryption_configs\x18\x03 \x03(\v2!.c1.connector.v2.EncryptionConfigR\x11encryptionConfigs\x127\n" + + "\x10resource_type_id\x18\x04 \x01(\tB\r\xfaB\n" + + "r\b \x01(\x80\b\xd0\x01\x01R\x0eresourceTypeId\x1aK\n" + "\x12CreateResourceTask\x125\n" + "\bresource\x18\x01 \x01(\v2\x19.c1.connector.v2.ResourceR\bresource\x1a\x9d\x01\n" + "\x12DeleteResourceTask\x12<\n" + @@ -4906,16 +4969,18 @@ const file_c1_connectorapi_baton_v1_baton_proto_rawDesc = "" + "\vannotations\x18\x01 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1ad\n" + "\rGetTicketTask\x12\x1b\n" + "\tticket_id\x18\x01 \x01(\tR\bticketId\x126\n" + - "\vannotations\x18\x02 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1aO\n" + + "\vannotations\x18\x02 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1ay\n" + "\x15ActionListSchemasTask\x126\n" + - "\vannotations\x18\x01 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1aa\n" + + "\vannotations\x18\x01 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x12(\n" + + "\x10resource_type_id\x18\x02 \x01(\tR\x0eresourceTypeId\x1aa\n" + "\x13ActionGetSchemaTask\x12\x12\n" + "\x04name\x18\x01 \x01(\tR\x04name\x126\n" + - "\vannotations\x18\x02 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1a\x8b\x01\n" + + "\vannotations\x18\x02 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1a\xb5\x01\n" + "\x10ActionInvokeTask\x12\x12\n" + "\x04name\x18\x01 \x01(\tR\x04name\x12+\n" + "\x04args\x18\x02 \x01(\v2\x17.google.protobuf.StructR\x04args\x126\n" + - "\vannotations\x18\x03 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x1an\n" + + "\vannotations\x18\x03 \x03(\v2\x14.google.protobuf.AnyR\vannotations\x12(\n" + + "\x10resource_type_id\x18\x04 \x01(\tR\x0eresourceTypeId\x1an\n" + "\x10ActionStatusTask\x12\x12\n" + "\x04name\x18\x01 \x01(\tR\x04name\x12\x0e\n" + "\x02id\x18\x02 \x01(\tR\x02id\x126\n" + @@ -5089,9 +5154,9 @@ var file_c1_connectorapi_baton_v1_baton_proto_goTypes = []any{ (*anypb.Any)(nil), // 44: google.protobuf.Any (*durationpb.Duration)(nil), // 45: google.protobuf.Duration (*status.Status)(nil), // 46: google.rpc.Status - (*timestamppb.Timestamp)(nil), // 47: google.protobuf.Timestamp - (*v2.Entitlement)(nil), // 48: c1.connector.v2.Entitlement - (*v2.Resource)(nil), // 49: c1.connector.v2.Resource + (*v2.Resource)(nil), // 47: c1.connector.v2.Resource + (*timestamppb.Timestamp)(nil), // 48: google.protobuf.Timestamp + (*v2.Entitlement)(nil), // 49: c1.connector.v2.Entitlement (*v2.Grant)(nil), // 50: c1.connector.v2.Grant (*v2.AccountInfo)(nil), // 51: c1.connector.v2.AccountInfo (*v2.CredentialOptions)(nil), // 52: c1.connector.v2.CredentialOptions @@ -5147,61 +5212,62 @@ var file_c1_connectorapi_baton_v1_baton_proto_depIdxs = []int32{ 44, // 42: c1.connectorapi.baton.v1.Task.NoneTask.annotations:type_name -> google.protobuf.Any 44, // 43: c1.connectorapi.baton.v1.Task.HelloTask.annotations:type_name -> google.protobuf.Any 44, // 44: c1.connectorapi.baton.v1.Task.SyncFullTask.annotations:type_name -> google.protobuf.Any - 44, // 45: c1.connectorapi.baton.v1.Task.EventFeedTask.annotations:type_name -> google.protobuf.Any - 47, // 46: c1.connectorapi.baton.v1.Task.EventFeedTask.start_at:type_name -> google.protobuf.Timestamp - 48, // 47: c1.connectorapi.baton.v1.Task.GrantTask.entitlement:type_name -> c1.connector.v2.Entitlement - 49, // 48: c1.connectorapi.baton.v1.Task.GrantTask.principal:type_name -> c1.connector.v2.Resource - 44, // 49: c1.connectorapi.baton.v1.Task.GrantTask.annotations:type_name -> google.protobuf.Any - 45, // 50: c1.connectorapi.baton.v1.Task.GrantTask.duration:type_name -> google.protobuf.Duration - 50, // 51: c1.connectorapi.baton.v1.Task.RevokeTask.grant:type_name -> c1.connector.v2.Grant - 44, // 52: c1.connectorapi.baton.v1.Task.RevokeTask.annotations:type_name -> google.protobuf.Any - 51, // 53: c1.connectorapi.baton.v1.Task.CreateAccountTask.account_info:type_name -> c1.connector.v2.AccountInfo - 52, // 54: c1.connectorapi.baton.v1.Task.CreateAccountTask.credential_options:type_name -> c1.connector.v2.CredentialOptions - 53, // 55: c1.connectorapi.baton.v1.Task.CreateAccountTask.encryption_configs:type_name -> c1.connector.v2.EncryptionConfig - 49, // 56: c1.connectorapi.baton.v1.Task.CreateResourceTask.resource:type_name -> c1.connector.v2.Resource - 54, // 57: c1.connectorapi.baton.v1.Task.DeleteResourceTask.resource_id:type_name -> c1.connector.v2.ResourceId - 54, // 58: c1.connectorapi.baton.v1.Task.DeleteResourceTask.parent_resource_id:type_name -> c1.connector.v2.ResourceId - 54, // 59: c1.connectorapi.baton.v1.Task.RotateCredentialsTask.resource_id:type_name -> c1.connector.v2.ResourceId - 52, // 60: c1.connectorapi.baton.v1.Task.RotateCredentialsTask.credential_options:type_name -> c1.connector.v2.CredentialOptions - 53, // 61: c1.connectorapi.baton.v1.Task.RotateCredentialsTask.encryption_configs:type_name -> c1.connector.v2.EncryptionConfig - 55, // 62: c1.connectorapi.baton.v1.Task.CreateTicketTask.ticket_request:type_name -> c1.connector.v2.TicketRequest - 56, // 63: c1.connectorapi.baton.v1.Task.CreateTicketTask.ticket_schema:type_name -> c1.connector.v2.TicketSchema - 44, // 64: c1.connectorapi.baton.v1.Task.CreateTicketTask.annotations:type_name -> google.protobuf.Any - 24, // 65: c1.connectorapi.baton.v1.Task.BulkCreateTicketsTask.ticket_requests:type_name -> c1.connectorapi.baton.v1.Task.CreateTicketTask - 28, // 66: c1.connectorapi.baton.v1.Task.BulkGetTicketsTask.ticket_requests:type_name -> c1.connectorapi.baton.v1.Task.GetTicketTask - 44, // 67: c1.connectorapi.baton.v1.Task.ListTicketSchemasTask.annotations:type_name -> google.protobuf.Any - 44, // 68: c1.connectorapi.baton.v1.Task.GetTicketTask.annotations:type_name -> google.protobuf.Any - 44, // 69: c1.connectorapi.baton.v1.Task.ActionListSchemasTask.annotations:type_name -> google.protobuf.Any - 44, // 70: c1.connectorapi.baton.v1.Task.ActionGetSchemaTask.annotations:type_name -> google.protobuf.Any - 57, // 71: c1.connectorapi.baton.v1.Task.ActionInvokeTask.args:type_name -> google.protobuf.Struct - 44, // 72: c1.connectorapi.baton.v1.Task.ActionInvokeTask.annotations:type_name -> google.protobuf.Any - 44, // 73: c1.connectorapi.baton.v1.Task.ActionStatusTask.annotations:type_name -> google.protobuf.Any - 44, // 74: c1.connectorapi.baton.v1.Task.CreateSyncDiffTask.annotations:type_name -> google.protobuf.Any - 35, // 75: c1.connectorapi.baton.v1.Task.CompactSyncs.compactable_syncs:type_name -> c1.connectorapi.baton.v1.Task.CompactSyncs.CompactableSync - 44, // 76: c1.connectorapi.baton.v1.Task.CompactSyncs.annotations:type_name -> google.protobuf.Any - 44, // 77: c1.connectorapi.baton.v1.BatonServiceUploadAssetRequest.UploadMetadata.annotations:type_name -> google.protobuf.Any - 44, // 78: c1.connectorapi.baton.v1.BatonServiceUploadAssetRequest.UploadEOF.annotations:type_name -> google.protobuf.Any - 44, // 79: c1.connectorapi.baton.v1.BatonServiceFinishTaskRequest.Error.annotations:type_name -> google.protobuf.Any - 44, // 80: c1.connectorapi.baton.v1.BatonServiceFinishTaskRequest.Error.response:type_name -> google.protobuf.Any - 44, // 81: c1.connectorapi.baton.v1.BatonServiceFinishTaskRequest.Success.annotations:type_name -> google.protobuf.Any - 44, // 82: c1.connectorapi.baton.v1.BatonServiceFinishTaskRequest.Success.response:type_name -> google.protobuf.Any - 2, // 83: c1.connectorapi.baton.v1.BatonService.Hello:input_type -> c1.connectorapi.baton.v1.BatonServiceHelloRequest - 4, // 84: c1.connectorapi.baton.v1.BatonService.GetTask:input_type -> c1.connectorapi.baton.v1.BatonServiceGetTaskRequest - 6, // 85: c1.connectorapi.baton.v1.BatonService.Heartbeat:input_type -> c1.connectorapi.baton.v1.BatonServiceHeartbeatRequest - 10, // 86: c1.connectorapi.baton.v1.BatonService.FinishTask:input_type -> c1.connectorapi.baton.v1.BatonServiceFinishTaskRequest - 8, // 87: c1.connectorapi.baton.v1.BatonService.UploadAsset:input_type -> c1.connectorapi.baton.v1.BatonServiceUploadAssetRequest - 12, // 88: c1.connectorapi.baton.v1.BatonService.StartDebugging:input_type -> c1.connectorapi.baton.v1.StartDebuggingRequest - 3, // 89: c1.connectorapi.baton.v1.BatonService.Hello:output_type -> c1.connectorapi.baton.v1.BatonServiceHelloResponse - 5, // 90: c1.connectorapi.baton.v1.BatonService.GetTask:output_type -> c1.connectorapi.baton.v1.BatonServiceGetTaskResponse - 7, // 91: c1.connectorapi.baton.v1.BatonService.Heartbeat:output_type -> c1.connectorapi.baton.v1.BatonServiceHeartbeatResponse - 11, // 92: c1.connectorapi.baton.v1.BatonService.FinishTask:output_type -> c1.connectorapi.baton.v1.BatonServiceFinishTaskResponse - 9, // 93: c1.connectorapi.baton.v1.BatonService.UploadAsset:output_type -> c1.connectorapi.baton.v1.BatonServiceUploadAssetResponse - 13, // 94: c1.connectorapi.baton.v1.BatonService.StartDebugging:output_type -> c1.connectorapi.baton.v1.StartDebuggingResponse - 89, // [89:95] is the sub-list for method output_type - 83, // [83:89] is the sub-list for method input_type - 83, // [83:83] is the sub-list for extension type_name - 83, // [83:83] is the sub-list for extension extendee - 0, // [0:83] is the sub-list for field type_name + 47, // 45: c1.connectorapi.baton.v1.Task.SyncFullTask.targeted_sync_resources:type_name -> c1.connector.v2.Resource + 44, // 46: c1.connectorapi.baton.v1.Task.EventFeedTask.annotations:type_name -> google.protobuf.Any + 48, // 47: c1.connectorapi.baton.v1.Task.EventFeedTask.start_at:type_name -> google.protobuf.Timestamp + 49, // 48: c1.connectorapi.baton.v1.Task.GrantTask.entitlement:type_name -> c1.connector.v2.Entitlement + 47, // 49: c1.connectorapi.baton.v1.Task.GrantTask.principal:type_name -> c1.connector.v2.Resource + 44, // 50: c1.connectorapi.baton.v1.Task.GrantTask.annotations:type_name -> google.protobuf.Any + 45, // 51: c1.connectorapi.baton.v1.Task.GrantTask.duration:type_name -> google.protobuf.Duration + 50, // 52: c1.connectorapi.baton.v1.Task.RevokeTask.grant:type_name -> c1.connector.v2.Grant + 44, // 53: c1.connectorapi.baton.v1.Task.RevokeTask.annotations:type_name -> google.protobuf.Any + 51, // 54: c1.connectorapi.baton.v1.Task.CreateAccountTask.account_info:type_name -> c1.connector.v2.AccountInfo + 52, // 55: c1.connectorapi.baton.v1.Task.CreateAccountTask.credential_options:type_name -> c1.connector.v2.CredentialOptions + 53, // 56: c1.connectorapi.baton.v1.Task.CreateAccountTask.encryption_configs:type_name -> c1.connector.v2.EncryptionConfig + 47, // 57: c1.connectorapi.baton.v1.Task.CreateResourceTask.resource:type_name -> c1.connector.v2.Resource + 54, // 58: c1.connectorapi.baton.v1.Task.DeleteResourceTask.resource_id:type_name -> c1.connector.v2.ResourceId + 54, // 59: c1.connectorapi.baton.v1.Task.DeleteResourceTask.parent_resource_id:type_name -> c1.connector.v2.ResourceId + 54, // 60: c1.connectorapi.baton.v1.Task.RotateCredentialsTask.resource_id:type_name -> c1.connector.v2.ResourceId + 52, // 61: c1.connectorapi.baton.v1.Task.RotateCredentialsTask.credential_options:type_name -> c1.connector.v2.CredentialOptions + 53, // 62: c1.connectorapi.baton.v1.Task.RotateCredentialsTask.encryption_configs:type_name -> c1.connector.v2.EncryptionConfig + 55, // 63: c1.connectorapi.baton.v1.Task.CreateTicketTask.ticket_request:type_name -> c1.connector.v2.TicketRequest + 56, // 64: c1.connectorapi.baton.v1.Task.CreateTicketTask.ticket_schema:type_name -> c1.connector.v2.TicketSchema + 44, // 65: c1.connectorapi.baton.v1.Task.CreateTicketTask.annotations:type_name -> google.protobuf.Any + 24, // 66: c1.connectorapi.baton.v1.Task.BulkCreateTicketsTask.ticket_requests:type_name -> c1.connectorapi.baton.v1.Task.CreateTicketTask + 28, // 67: c1.connectorapi.baton.v1.Task.BulkGetTicketsTask.ticket_requests:type_name -> c1.connectorapi.baton.v1.Task.GetTicketTask + 44, // 68: c1.connectorapi.baton.v1.Task.ListTicketSchemasTask.annotations:type_name -> google.protobuf.Any + 44, // 69: c1.connectorapi.baton.v1.Task.GetTicketTask.annotations:type_name -> google.protobuf.Any + 44, // 70: c1.connectorapi.baton.v1.Task.ActionListSchemasTask.annotations:type_name -> google.protobuf.Any + 44, // 71: c1.connectorapi.baton.v1.Task.ActionGetSchemaTask.annotations:type_name -> google.protobuf.Any + 57, // 72: c1.connectorapi.baton.v1.Task.ActionInvokeTask.args:type_name -> google.protobuf.Struct + 44, // 73: c1.connectorapi.baton.v1.Task.ActionInvokeTask.annotations:type_name -> google.protobuf.Any + 44, // 74: c1.connectorapi.baton.v1.Task.ActionStatusTask.annotations:type_name -> google.protobuf.Any + 44, // 75: c1.connectorapi.baton.v1.Task.CreateSyncDiffTask.annotations:type_name -> google.protobuf.Any + 35, // 76: c1.connectorapi.baton.v1.Task.CompactSyncs.compactable_syncs:type_name -> c1.connectorapi.baton.v1.Task.CompactSyncs.CompactableSync + 44, // 77: c1.connectorapi.baton.v1.Task.CompactSyncs.annotations:type_name -> google.protobuf.Any + 44, // 78: c1.connectorapi.baton.v1.BatonServiceUploadAssetRequest.UploadMetadata.annotations:type_name -> google.protobuf.Any + 44, // 79: c1.connectorapi.baton.v1.BatonServiceUploadAssetRequest.UploadEOF.annotations:type_name -> google.protobuf.Any + 44, // 80: c1.connectorapi.baton.v1.BatonServiceFinishTaskRequest.Error.annotations:type_name -> google.protobuf.Any + 44, // 81: c1.connectorapi.baton.v1.BatonServiceFinishTaskRequest.Error.response:type_name -> google.protobuf.Any + 44, // 82: c1.connectorapi.baton.v1.BatonServiceFinishTaskRequest.Success.annotations:type_name -> google.protobuf.Any + 44, // 83: c1.connectorapi.baton.v1.BatonServiceFinishTaskRequest.Success.response:type_name -> google.protobuf.Any + 2, // 84: c1.connectorapi.baton.v1.BatonService.Hello:input_type -> c1.connectorapi.baton.v1.BatonServiceHelloRequest + 4, // 85: c1.connectorapi.baton.v1.BatonService.GetTask:input_type -> c1.connectorapi.baton.v1.BatonServiceGetTaskRequest + 6, // 86: c1.connectorapi.baton.v1.BatonService.Heartbeat:input_type -> c1.connectorapi.baton.v1.BatonServiceHeartbeatRequest + 10, // 87: c1.connectorapi.baton.v1.BatonService.FinishTask:input_type -> c1.connectorapi.baton.v1.BatonServiceFinishTaskRequest + 8, // 88: c1.connectorapi.baton.v1.BatonService.UploadAsset:input_type -> c1.connectorapi.baton.v1.BatonServiceUploadAssetRequest + 12, // 89: c1.connectorapi.baton.v1.BatonService.StartDebugging:input_type -> c1.connectorapi.baton.v1.StartDebuggingRequest + 3, // 90: c1.connectorapi.baton.v1.BatonService.Hello:output_type -> c1.connectorapi.baton.v1.BatonServiceHelloResponse + 5, // 91: c1.connectorapi.baton.v1.BatonService.GetTask:output_type -> c1.connectorapi.baton.v1.BatonServiceGetTaskResponse + 7, // 92: c1.connectorapi.baton.v1.BatonService.Heartbeat:output_type -> c1.connectorapi.baton.v1.BatonServiceHeartbeatResponse + 11, // 93: c1.connectorapi.baton.v1.BatonService.FinishTask:output_type -> c1.connectorapi.baton.v1.BatonServiceFinishTaskResponse + 9, // 94: c1.connectorapi.baton.v1.BatonService.UploadAsset:output_type -> c1.connectorapi.baton.v1.BatonServiceUploadAssetResponse + 13, // 95: c1.connectorapi.baton.v1.BatonService.StartDebugging:output_type -> c1.connectorapi.baton.v1.StartDebuggingResponse + 90, // [90:96] is the sub-list for method output_type + 84, // [84:90] is the sub-list for method input_type + 84, // [84:84] is the sub-list for extension type_name + 84, // [84:84] is the sub-list for extension extendee + 0, // [0:84] is the sub-list for field type_name } func init() { file_c1_connectorapi_baton_v1_baton_proto_init() } diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/session.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/session.pb.go index dd64fa42..18537268 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/session.pb.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/session.pb.go @@ -268,10 +268,11 @@ func (b0 GetManyRequest_builder) Build() *GetManyRequest { } type GetManyResponse struct { - state protoimpl.MessageState `protogen:"hybrid.v1"` - Items []*GetManyItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"hybrid.v1"` + Items []*GetManyItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` + UnprocessedKeys []string `protobuf:"bytes,2,rep,name=unprocessed_keys,json=unprocessedKeys,proto3" json:"unprocessed_keys,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *GetManyResponse) Reset() { @@ -306,14 +307,26 @@ func (x *GetManyResponse) GetItems() []*GetManyItem { return nil } +func (x *GetManyResponse) GetUnprocessedKeys() []string { + if x != nil { + return x.UnprocessedKeys + } + return nil +} + func (x *GetManyResponse) SetItems(v []*GetManyItem) { x.Items = v } +func (x *GetManyResponse) SetUnprocessedKeys(v []string) { + x.UnprocessedKeys = v +} + type GetManyResponse_builder struct { _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. - Items []*GetManyItem + Items []*GetManyItem + UnprocessedKeys []string } func (b0 GetManyResponse_builder) Build() *GetManyResponse { @@ -321,6 +334,7 @@ func (b0 GetManyResponse_builder) Build() *GetManyResponse { b, x := &b0, m0 _, _ = b, x x.Items = b.Items + x.UnprocessedKeys = b.UnprocessedKeys return m0 } @@ -1289,9 +1303,10 @@ const file_c1_connectorapi_baton_v1_session_proto_rawDesc = "" + "\x0eGetManyRequest\x121\n" + "\async_id\x18\x01 \x01(\tB\x18\xfaB\x15r\x132\x11^[a-zA-Z0-9]{27}$R\x06syncId\x12)\n" + "\x04keys\x18\x02 \x03(\tB\x15\xfaB\x12\x92\x01\x0f\b\x01\x10d\x18\x01\"\ar\x05\x10\x01\x18\x80\x02R\x04keys\x12 \n" + - "\x06prefix\x18\x03 \x01(\tB\b\xfaB\x05r\x03\x18\x80\x02R\x06prefix\"N\n" + + "\x06prefix\x18\x03 \x01(\tB\b\xfaB\x05r\x03\x18\x80\x02R\x06prefix\"y\n" + "\x0fGetManyResponse\x12;\n" + - "\x05items\x18\x01 \x03(\v2%.c1.connectorapi.baton.v1.GetManyItemR\x05items\"5\n" + + "\x05items\x18\x01 \x03(\v2%.c1.connectorapi.baton.v1.GetManyItemR\x05items\x12)\n" + + "\x10unprocessed_keys\x18\x02 \x03(\tR\x0funprocessedKeys\"5\n" + "\vGetManyItem\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + "\x05value\x18\x02 \x01(\fR\x05value\"\x83\x01\n" + @@ -1307,18 +1322,18 @@ const file_c1_connectorapi_baton_v1_session_proto_rawDesc = "" + "\n" + "GetAllItem\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\fR\x05value\"\xa2\x01\n" + + "\x05value\x18\x02 \x01(\fR\x05value\"\xa3\x01\n" + "\n" + "SetRequest\x121\n" + "\async_id\x18\x01 \x01(\tB\x18\xfaB\x15r\x132\x11^[a-zA-Z0-9]{27}$R\x06syncId\x12\x1c\n" + "\x03key\x18\x02 \x01(\tB\n" + - "\xfaB\ar\x05\x10\x01\x18\x80\x02R\x03key\x12!\n" + - "\x05value\x18\x03 \x01(\fB\v\xfaB\bz\x06\x10\x01\x18\x80\x98\x02R\x05value\x12 \n" + + "\xfaB\ar\x05\x10\x01\x18\x80\x02R\x03key\x12\"\n" + + "\x05value\x18\x03 \x01(\fB\f\xfaB\tz\a\x10\x00\x18\x80\xe8\xfd\x01R\x05value\x12 \n" + "\x06prefix\x18\x04 \x01(\tB\b\xfaB\x05r\x03\x18\x80\x02R\x06prefix\"\r\n" + - "\vSetResponse\"\x8d\x02\n" + + "\vSetResponse\"\x8e\x02\n" + "\x0eSetManyRequest\x121\n" + - "\async_id\x18\x01 \x01(\tB\x18\xfaB\x15r\x132\x11^[a-zA-Z0-9]{27}$R\x06syncId\x12k\n" + - "\x06values\x18\x02 \x03(\v24.c1.connectorapi.baton.v1.SetManyRequest.ValuesEntryB\x1d\xfaB\x1a\x9a\x01\x17\b\x01\x10d\"\ar\x05\x10\x01\x18\x80\x02*\bz\x06\x10\x01\x18\x80\x98\x02R\x06values\x12 \n" + + "\async_id\x18\x01 \x01(\tB\x18\xfaB\x15r\x132\x11^[a-zA-Z0-9]{27}$R\x06syncId\x12l\n" + + "\x06values\x18\x02 \x03(\v24.c1.connectorapi.baton.v1.SetManyRequest.ValuesEntryB\x1e\xfaB\x1b\x9a\x01\x18\b\x01\x10d\"\ar\x05\x10\x01\x18\x80\x02*\tz\a\x10\x00\x18\x80\xe8\xfd\x01R\x06values\x12 \n" + "\x06prefix\x18\x03 \x01(\tB\b\xfaB\x05r\x03\x18\x80\x02R\x06prefix\x1a9\n" + "\vValuesEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/session.pb.validate.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/session.pb.validate.go index 87696b1f..7f0c234b 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/session.pb.validate.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/session.pb.validate.go @@ -1084,10 +1084,10 @@ func (m *SetRequest) validate(all bool) error { errors = append(errors, err) } - if l := len(m.GetValue()); l < 1 || l > 35840 { + if l := len(m.GetValue()); l < 0 || l > 4158464 { err := SetRequestValidationError{ field: "Value", - reason: "value length must be between 1 and 35840 bytes, inclusive", + reason: "value length must be between 0 and 4158464 bytes, inclusive", } if !all { return err @@ -1351,10 +1351,10 @@ func (m *SetManyRequest) validate(all bool) error { errors = append(errors, err) } - if l := len(val); l < 1 || l > 35840 { + if l := len(val); l < 0 || l > 4158464 { err := SetManyRequestValidationError{ field: fmt.Sprintf("Values[%v]", key), - reason: "value length must be between 1 and 35840 bytes, inclusive", + reason: "value length must be between 0 and 4158464 bytes, inclusive", } if !all { return err diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/session_protoopaque.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/session_protoopaque.pb.go index 0285f149..870613bb 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/session_protoopaque.pb.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1/session_protoopaque.pb.go @@ -268,10 +268,11 @@ func (b0 GetManyRequest_builder) Build() *GetManyRequest { } type GetManyResponse struct { - state protoimpl.MessageState `protogen:"opaque.v1"` - xxx_hidden_Items *[]*GetManyItem `protobuf:"bytes,1,rep,name=items,proto3"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Items *[]*GetManyItem `protobuf:"bytes,1,rep,name=items,proto3"` + xxx_hidden_UnprocessedKeys []string `protobuf:"bytes,2,rep,name=unprocessed_keys,json=unprocessedKeys,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *GetManyResponse) Reset() { @@ -308,14 +309,26 @@ func (x *GetManyResponse) GetItems() []*GetManyItem { return nil } +func (x *GetManyResponse) GetUnprocessedKeys() []string { + if x != nil { + return x.xxx_hidden_UnprocessedKeys + } + return nil +} + func (x *GetManyResponse) SetItems(v []*GetManyItem) { x.xxx_hidden_Items = &v } +func (x *GetManyResponse) SetUnprocessedKeys(v []string) { + x.xxx_hidden_UnprocessedKeys = v +} + type GetManyResponse_builder struct { _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. - Items []*GetManyItem + Items []*GetManyItem + UnprocessedKeys []string } func (b0 GetManyResponse_builder) Build() *GetManyResponse { @@ -323,6 +336,7 @@ func (b0 GetManyResponse_builder) Build() *GetManyResponse { b, x := &b0, m0 _, _ = b, x x.xxx_hidden_Items = &b.Items + x.xxx_hidden_UnprocessedKeys = b.UnprocessedKeys return m0 } @@ -1293,9 +1307,10 @@ const file_c1_connectorapi_baton_v1_session_proto_rawDesc = "" + "\x0eGetManyRequest\x121\n" + "\async_id\x18\x01 \x01(\tB\x18\xfaB\x15r\x132\x11^[a-zA-Z0-9]{27}$R\x06syncId\x12)\n" + "\x04keys\x18\x02 \x03(\tB\x15\xfaB\x12\x92\x01\x0f\b\x01\x10d\x18\x01\"\ar\x05\x10\x01\x18\x80\x02R\x04keys\x12 \n" + - "\x06prefix\x18\x03 \x01(\tB\b\xfaB\x05r\x03\x18\x80\x02R\x06prefix\"N\n" + + "\x06prefix\x18\x03 \x01(\tB\b\xfaB\x05r\x03\x18\x80\x02R\x06prefix\"y\n" + "\x0fGetManyResponse\x12;\n" + - "\x05items\x18\x01 \x03(\v2%.c1.connectorapi.baton.v1.GetManyItemR\x05items\"5\n" + + "\x05items\x18\x01 \x03(\v2%.c1.connectorapi.baton.v1.GetManyItemR\x05items\x12)\n" + + "\x10unprocessed_keys\x18\x02 \x03(\tR\x0funprocessedKeys\"5\n" + "\vGetManyItem\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + "\x05value\x18\x02 \x01(\fR\x05value\"\x83\x01\n" + @@ -1311,18 +1326,18 @@ const file_c1_connectorapi_baton_v1_session_proto_rawDesc = "" + "\n" + "GetAllItem\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\fR\x05value\"\xa2\x01\n" + + "\x05value\x18\x02 \x01(\fR\x05value\"\xa3\x01\n" + "\n" + "SetRequest\x121\n" + "\async_id\x18\x01 \x01(\tB\x18\xfaB\x15r\x132\x11^[a-zA-Z0-9]{27}$R\x06syncId\x12\x1c\n" + "\x03key\x18\x02 \x01(\tB\n" + - "\xfaB\ar\x05\x10\x01\x18\x80\x02R\x03key\x12!\n" + - "\x05value\x18\x03 \x01(\fB\v\xfaB\bz\x06\x10\x01\x18\x80\x98\x02R\x05value\x12 \n" + + "\xfaB\ar\x05\x10\x01\x18\x80\x02R\x03key\x12\"\n" + + "\x05value\x18\x03 \x01(\fB\f\xfaB\tz\a\x10\x00\x18\x80\xe8\xfd\x01R\x05value\x12 \n" + "\x06prefix\x18\x04 \x01(\tB\b\xfaB\x05r\x03\x18\x80\x02R\x06prefix\"\r\n" + - "\vSetResponse\"\x8d\x02\n" + + "\vSetResponse\"\x8e\x02\n" + "\x0eSetManyRequest\x121\n" + - "\async_id\x18\x01 \x01(\tB\x18\xfaB\x15r\x132\x11^[a-zA-Z0-9]{27}$R\x06syncId\x12k\n" + - "\x06values\x18\x02 \x03(\v24.c1.connectorapi.baton.v1.SetManyRequest.ValuesEntryB\x1d\xfaB\x1a\x9a\x01\x17\b\x01\x10d\"\ar\x05\x10\x01\x18\x80\x02*\bz\x06\x10\x01\x18\x80\x98\x02R\x06values\x12 \n" + + "\async_id\x18\x01 \x01(\tB\x18\xfaB\x15r\x132\x11^[a-zA-Z0-9]{27}$R\x06syncId\x12l\n" + + "\x06values\x18\x02 \x03(\v24.c1.connectorapi.baton.v1.SetManyRequest.ValuesEntryB\x1e\xfaB\x1b\x9a\x01\x18\b\x01\x10d\"\ar\x05\x10\x01\x18\x80\x02*\tz\a\x10\x00\x18\x80\xe8\xfd\x01R\x06values\x12 \n" + "\x06prefix\x18\x03 \x01(\tB\b\xfaB\x05r\x03\x18\x80\x02R\x06prefix\x1a9\n" + "\vValuesEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/reader/v2/grant.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/reader/v2/grant.pb.go index 5cd35410..9d341d60 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/reader/v2/grant.pb.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/reader/v2/grant.pb.go @@ -165,14 +165,15 @@ func (b0 GrantsReaderServiceGetGrantResponse_builder) Build() *GrantsReaderServi } type GrantsReaderServiceListGrantsForEntitlementRequest struct { - state protoimpl.MessageState `protogen:"hybrid.v1"` - Entitlement *v2.Entitlement `protobuf:"bytes,1,opt,name=entitlement,proto3" json:"entitlement,omitempty"` - PrincipalId *v2.ResourceId `protobuf:"bytes,5,opt,name=principal_id,json=principalId,proto3" json:"principal_id,omitempty"` - PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` - Annotations []*anypb.Any `protobuf:"bytes,4,rep,name=annotations,proto3" json:"annotations,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"hybrid.v1"` + Entitlement *v2.Entitlement `protobuf:"bytes,1,opt,name=entitlement,proto3" json:"entitlement,omitempty"` + PrincipalId *v2.ResourceId `protobuf:"bytes,5,opt,name=principal_id,json=principalId,proto3" json:"principal_id,omitempty"` + PrincipalResourceTypeIds []string `protobuf:"bytes,6,rep,name=principal_resource_type_ids,json=principalResourceTypeIds,proto3" json:"principal_resource_type_ids,omitempty"` + PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Annotations []*anypb.Any `protobuf:"bytes,4,rep,name=annotations,proto3" json:"annotations,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *GrantsReaderServiceListGrantsForEntitlementRequest) Reset() { @@ -214,6 +215,13 @@ func (x *GrantsReaderServiceListGrantsForEntitlementRequest) GetPrincipalId() *v return nil } +func (x *GrantsReaderServiceListGrantsForEntitlementRequest) GetPrincipalResourceTypeIds() []string { + if x != nil { + return x.PrincipalResourceTypeIds + } + return nil +} + func (x *GrantsReaderServiceListGrantsForEntitlementRequest) GetPageSize() uint32 { if x != nil { return x.PageSize @@ -243,6 +251,10 @@ func (x *GrantsReaderServiceListGrantsForEntitlementRequest) SetPrincipalId(v *v x.PrincipalId = v } +func (x *GrantsReaderServiceListGrantsForEntitlementRequest) SetPrincipalResourceTypeIds(v []string) { + x.PrincipalResourceTypeIds = v +} + func (x *GrantsReaderServiceListGrantsForEntitlementRequest) SetPageSize(v uint32) { x.PageSize = v } @@ -280,11 +292,12 @@ func (x *GrantsReaderServiceListGrantsForEntitlementRequest) ClearPrincipalId() type GrantsReaderServiceListGrantsForEntitlementRequest_builder struct { _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. - Entitlement *v2.Entitlement - PrincipalId *v2.ResourceId - PageSize uint32 - PageToken string - Annotations []*anypb.Any + Entitlement *v2.Entitlement + PrincipalId *v2.ResourceId + PrincipalResourceTypeIds []string + PageSize uint32 + PageToken string + Annotations []*anypb.Any } func (b0 GrantsReaderServiceListGrantsForEntitlementRequest_builder) Build() *GrantsReaderServiceListGrantsForEntitlementRequest { @@ -293,6 +306,7 @@ func (b0 GrantsReaderServiceListGrantsForEntitlementRequest_builder) Build() *Gr _, _ = b, x x.Entitlement = b.Entitlement x.PrincipalId = b.PrincipalId + x.PrincipalResourceTypeIds = b.PrincipalResourceTypeIds x.PageSize = b.PageSize x.PageToken = b.PageToken x.Annotations = b.Annotations @@ -550,10 +564,11 @@ const file_c1_reader_v2_grant_proto_rawDesc = "" + "\xfaB\ar\x05 \x01(\x80\bR\agrantId\x126\n" + "\vannotations\x18\x02 \x03(\v2\x14.google.protobuf.AnyR\vannotations\"S\n" + "#GrantsReaderServiceGetGrantResponse\x12,\n" + - "\x05grant\x18\x01 \x01(\v2\x16.c1.connector.v2.GrantR\x05grant\"\xd7\x02\n" + + "\x05grant\x18\x01 \x01(\v2\x16.c1.connector.v2.GrantR\x05grant\"\x96\x03\n" + "2GrantsReaderServiceListGrantsForEntitlementRequest\x12H\n" + "\ventitlement\x18\x01 \x01(\v2\x1c.c1.connector.v2.EntitlementB\b\xfaB\x05\x8a\x01\x02\x10\x01R\ventitlement\x12H\n" + - "\fprincipal_id\x18\x05 \x01(\v2\x1b.c1.connector.v2.ResourceIdB\b\xfaB\x05\x8a\x01\x02\x10\x00R\vprincipalId\x12'\n" + + "\fprincipal_id\x18\x05 \x01(\v2\x1b.c1.connector.v2.ResourceIdB\b\xfaB\x05\x8a\x01\x02\x10\x00R\vprincipalId\x12=\n" + + "\x1bprincipal_resource_type_ids\x18\x06 \x03(\tR\x18principalResourceTypeIds\x12'\n" + "\tpage_size\x18\x02 \x01(\rB\n" + "\xfaB\a*\x05\x18\xfa\x01@\x01R\bpageSize\x12,\n" + "\n" + diff --git a/vendor/github.com/conductorone/baton-sdk/pb/c1/reader/v2/grant_protoopaque.pb.go b/vendor/github.com/conductorone/baton-sdk/pb/c1/reader/v2/grant_protoopaque.pb.go index 78519c6b..52a4bec1 100644 --- a/vendor/github.com/conductorone/baton-sdk/pb/c1/reader/v2/grant_protoopaque.pb.go +++ b/vendor/github.com/conductorone/baton-sdk/pb/c1/reader/v2/grant_protoopaque.pb.go @@ -167,14 +167,15 @@ func (b0 GrantsReaderServiceGetGrantResponse_builder) Build() *GrantsReaderServi } type GrantsReaderServiceListGrantsForEntitlementRequest struct { - state protoimpl.MessageState `protogen:"opaque.v1"` - xxx_hidden_Entitlement *v2.Entitlement `protobuf:"bytes,1,opt,name=entitlement,proto3"` - xxx_hidden_PrincipalId *v2.ResourceId `protobuf:"bytes,5,opt,name=principal_id,json=principalId,proto3"` - xxx_hidden_PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3"` - xxx_hidden_PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3"` - xxx_hidden_Annotations *[]*anypb.Any `protobuf:"bytes,4,rep,name=annotations,proto3"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Entitlement *v2.Entitlement `protobuf:"bytes,1,opt,name=entitlement,proto3"` + xxx_hidden_PrincipalId *v2.ResourceId `protobuf:"bytes,5,opt,name=principal_id,json=principalId,proto3"` + xxx_hidden_PrincipalResourceTypeIds []string `protobuf:"bytes,6,rep,name=principal_resource_type_ids,json=principalResourceTypeIds,proto3"` + xxx_hidden_PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3"` + xxx_hidden_PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3"` + xxx_hidden_Annotations *[]*anypb.Any `protobuf:"bytes,4,rep,name=annotations,proto3"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *GrantsReaderServiceListGrantsForEntitlementRequest) Reset() { @@ -216,6 +217,13 @@ func (x *GrantsReaderServiceListGrantsForEntitlementRequest) GetPrincipalId() *v return nil } +func (x *GrantsReaderServiceListGrantsForEntitlementRequest) GetPrincipalResourceTypeIds() []string { + if x != nil { + return x.xxx_hidden_PrincipalResourceTypeIds + } + return nil +} + func (x *GrantsReaderServiceListGrantsForEntitlementRequest) GetPageSize() uint32 { if x != nil { return x.xxx_hidden_PageSize @@ -247,6 +255,10 @@ func (x *GrantsReaderServiceListGrantsForEntitlementRequest) SetPrincipalId(v *v x.xxx_hidden_PrincipalId = v } +func (x *GrantsReaderServiceListGrantsForEntitlementRequest) SetPrincipalResourceTypeIds(v []string) { + x.xxx_hidden_PrincipalResourceTypeIds = v +} + func (x *GrantsReaderServiceListGrantsForEntitlementRequest) SetPageSize(v uint32) { x.xxx_hidden_PageSize = v } @@ -284,11 +296,12 @@ func (x *GrantsReaderServiceListGrantsForEntitlementRequest) ClearPrincipalId() type GrantsReaderServiceListGrantsForEntitlementRequest_builder struct { _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. - Entitlement *v2.Entitlement - PrincipalId *v2.ResourceId - PageSize uint32 - PageToken string - Annotations []*anypb.Any + Entitlement *v2.Entitlement + PrincipalId *v2.ResourceId + PrincipalResourceTypeIds []string + PageSize uint32 + PageToken string + Annotations []*anypb.Any } func (b0 GrantsReaderServiceListGrantsForEntitlementRequest_builder) Build() *GrantsReaderServiceListGrantsForEntitlementRequest { @@ -297,6 +310,7 @@ func (b0 GrantsReaderServiceListGrantsForEntitlementRequest_builder) Build() *Gr _, _ = b, x x.xxx_hidden_Entitlement = b.Entitlement x.xxx_hidden_PrincipalId = b.PrincipalId + x.xxx_hidden_PrincipalResourceTypeIds = b.PrincipalResourceTypeIds x.xxx_hidden_PageSize = b.PageSize x.xxx_hidden_PageToken = b.PageToken x.xxx_hidden_Annotations = &b.Annotations @@ -560,10 +574,11 @@ const file_c1_reader_v2_grant_proto_rawDesc = "" + "\xfaB\ar\x05 \x01(\x80\bR\agrantId\x126\n" + "\vannotations\x18\x02 \x03(\v2\x14.google.protobuf.AnyR\vannotations\"S\n" + "#GrantsReaderServiceGetGrantResponse\x12,\n" + - "\x05grant\x18\x01 \x01(\v2\x16.c1.connector.v2.GrantR\x05grant\"\xd7\x02\n" + + "\x05grant\x18\x01 \x01(\v2\x16.c1.connector.v2.GrantR\x05grant\"\x96\x03\n" + "2GrantsReaderServiceListGrantsForEntitlementRequest\x12H\n" + "\ventitlement\x18\x01 \x01(\v2\x1c.c1.connector.v2.EntitlementB\b\xfaB\x05\x8a\x01\x02\x10\x01R\ventitlement\x12H\n" + - "\fprincipal_id\x18\x05 \x01(\v2\x1b.c1.connector.v2.ResourceIdB\b\xfaB\x05\x8a\x01\x02\x10\x00R\vprincipalId\x12'\n" + + "\fprincipal_id\x18\x05 \x01(\v2\x1b.c1.connector.v2.ResourceIdB\b\xfaB\x05\x8a\x01\x02\x10\x00R\vprincipalId\x12=\n" + + "\x1bprincipal_resource_type_ids\x18\x06 \x03(\tR\x18principalResourceTypeIds\x12'\n" + "\tpage_size\x18\x02 \x01(\rB\n" + "\xfaB\a*\x05\x18\xfa\x01@\x01R\bpageSize\x12,\n" + "\n" + diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/actions/actions.go b/vendor/github.com/conductorone/baton-sdk/pkg/actions/actions.go new file mode 100644 index 00000000..5d997718 --- /dev/null +++ b/vendor/github.com/conductorone/baton-sdk/pkg/actions/actions.go @@ -0,0 +1,635 @@ +package actions + +import ( + "context" + "errors" + "fmt" + "sort" + "sync" + "time" + + config "github.com/conductorone/baton-sdk/pb/c1/config/v1" + v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" + "github.com/conductorone/baton-sdk/pkg/annotations" + "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" + "github.com/segmentio/ksuid" + "go.uber.org/zap" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/structpb" +) + +type ActionHandler func(ctx context.Context, args *structpb.Struct) (*structpb.Struct, annotations.Annotations, error) + +type OutstandingAction struct { + Id string + Name string + Status v2.BatonActionStatus + Rv *structpb.Struct + Annos annotations.Annotations + Err error + StartedAt time.Time + sync.Mutex +} + +func NewOutstandingAction(id, name string) *OutstandingAction { + return &OutstandingAction{ + Id: id, + Name: name, + Status: v2.BatonActionStatus_BATON_ACTION_STATUS_PENDING, + StartedAt: time.Now(), + } +} + +func (oa *OutstandingAction) SetStatus(ctx context.Context, status v2.BatonActionStatus) { + oa.Lock() + defer oa.Unlock() + l := ctxzap.Extract(ctx).With( + zap.String("action_id", oa.Id), + zap.String("action_name", oa.Name), + zap.String("status", status.String()), + ) + if oa.Status == v2.BatonActionStatus_BATON_ACTION_STATUS_COMPLETE || oa.Status == v2.BatonActionStatus_BATON_ACTION_STATUS_FAILED { + l.Error("cannot set status on completed action") + } + if status == v2.BatonActionStatus_BATON_ACTION_STATUS_RUNNING && oa.Status != v2.BatonActionStatus_BATON_ACTION_STATUS_PENDING { + l.Error("cannot set status to running unless action is pending") + } + + oa.Status = status +} + +func (oa *OutstandingAction) setError(_ context.Context, err error) { + oa.Lock() + defer oa.Unlock() + if oa.Rv == nil { + oa.Rv = &structpb.Struct{} + } + if oa.Rv.Fields == nil { + oa.Rv.Fields = make(map[string]*structpb.Value) + } + oa.Rv.Fields["error"] = &structpb.Value{ + Kind: &structpb.Value_StringValue{ + StringValue: err.Error(), + }, + } + oa.Err = err +} + +func (oa *OutstandingAction) SetError(ctx context.Context, err error) { + oa.setError(ctx, err) + oa.SetStatus(ctx, v2.BatonActionStatus_BATON_ACTION_STATUS_FAILED) +} + +const maxOldActions = 1000 + +// ActionRegistry provides methods for registering actions. +// Used by both GlobalActionProvider (global actions) and ResourceActionProvider (resource-scoped actions). +type ActionRegistry interface { + // Register registers an action using the name from the schema. + Register(ctx context.Context, schema *v2.BatonActionSchema, handler ActionHandler) error + + // Deprecated: Use Register instead. + // RegisterAction registers an action. + RegisterAction(ctx context.Context, name string, schema *v2.BatonActionSchema, handler ActionHandler) error +} + +// Deprecated: Use ActionRegistry instead. +// ResourceTypeActionRegistry is an alias for ActionRegistry for backwards compatibility. +type ResourceTypeActionRegistry = ActionRegistry + +// ActionManager manages both global actions and resource-scoped actions. +type ActionManager struct { + // Global actions (no resource type) + schemas map[string]*v2.BatonActionSchema // actionName -> schema + handlers map[string]ActionHandler // actionName -> handler + + // Resource-scoped actions (keyed by resource type) + resourceSchemas map[string]map[string]*v2.BatonActionSchema // resourceTypeID -> actionName -> schema + resourceHandlers map[string]map[string]ActionHandler // resourceTypeID -> actionName -> handler + + // Outstanding actions (shared across global and resource-scoped) + actions map[string]*OutstandingAction // actionID -> outstanding action + + mu sync.RWMutex +} + +func NewActionManager(_ context.Context) *ActionManager { + return &ActionManager{ + schemas: make(map[string]*v2.BatonActionSchema), + handlers: make(map[string]ActionHandler), + resourceSchemas: make(map[string]map[string]*v2.BatonActionSchema), + resourceHandlers: make(map[string]map[string]ActionHandler), + actions: make(map[string]*OutstandingAction), + } +} + +func (a *ActionManager) GetNewActionId() string { + uid := ksuid.New() + return uid.String() +} + +func (a *ActionManager) GetNewAction(name string) *OutstandingAction { + a.mu.Lock() + defer a.mu.Unlock() + actionId := a.GetNewActionId() + oa := NewOutstandingAction(actionId, name) + a.actions[actionId] = oa + return oa +} + +func (a *ActionManager) CleanupOldActions(ctx context.Context) { + a.mu.Lock() + defer a.mu.Unlock() + + if len(a.actions) < maxOldActions { + return + } + + l := ctxzap.Extract(ctx) + l.Debug("cleaning up old actions") + // Create a slice to hold the actions + actionList := make([]*OutstandingAction, 0, len(a.actions)) + for _, action := range a.actions { + actionList = append(actionList, action) + } + + // Sort the actions by StartedAt time + sort.Slice(actionList, func(i, j int) bool { + return actionList[i].StartedAt.Before(actionList[j].StartedAt) + }) + + count := 0 + // Delete the oldest actions + for i := 0; i < len(actionList)-maxOldActions; i++ { + action := actionList[i] + if action.Status == v2.BatonActionStatus_BATON_ACTION_STATUS_COMPLETE || action.Status == v2.BatonActionStatus_BATON_ACTION_STATUS_FAILED { + count++ + delete(a.actions, actionList[i].Id) + } + } + l.Debug("cleaned up old actions", zap.Int("count", count)) +} + +func (a *ActionManager) registerActionSchema(_ context.Context, name string, schema *v2.BatonActionSchema) error { + if name == "" { + return errors.New("action name cannot be empty") + } + if schema == nil { + return errors.New("action schema cannot be nil") + } + if _, ok := a.schemas[name]; ok { + return fmt.Errorf("action schema %s already registered", name) + } + a.schemas[name] = schema + return nil +} + +// Register registers a global action using the name from the schema. +func (a *ActionManager) Register(ctx context.Context, schema *v2.BatonActionSchema, handler ActionHandler) error { + if schema == nil { + return errors.New("action schema cannot be nil") + } + return a.RegisterAction(ctx, schema.GetName(), schema, handler) +} + +// Deprecated: Use Register instead. +// RegisterAction registers a global action (not scoped to a resource type). +func (a *ActionManager) RegisterAction(ctx context.Context, name string, schema *v2.BatonActionSchema, handler ActionHandler) error { + a.mu.Lock() + defer a.mu.Unlock() + + if handler == nil { + return errors.New("action handler cannot be nil") + } + err := a.registerActionSchema(ctx, name, schema) + if err != nil { + return err + } + + if _, ok := a.handlers[name]; ok { + return fmt.Errorf("action handler %s already registered", name) + } + a.handlers[name] = handler + + l := ctxzap.Extract(ctx) + l.Debug("registered action", zap.String("name", name)) + + return nil +} + +func (a *ActionManager) HasActions() bool { + a.mu.RLock() + defer a.mu.RUnlock() + return len(a.schemas) > 0 || len(a.resourceSchemas) > 0 +} + +// RegisterResourceAction registers a resource-scoped action. +func (a *ActionManager) RegisterResourceAction( + ctx context.Context, + resourceTypeID string, + schema *v2.BatonActionSchema, + handler ActionHandler, +) error { + if resourceTypeID == "" { + return errors.New("resource type ID cannot be empty") + } + if schema == nil { + return errors.New("action schema cannot be nil") + } + if schema.GetName() == "" { + return errors.New("action schema name cannot be empty") + } + if handler == nil { + return fmt.Errorf("handler cannot be nil for action %s", schema.GetName()) + } + + a.mu.Lock() + defer a.mu.Unlock() + + // Set the resource type ID on the schema + schema.SetResourceTypeId(resourceTypeID) + + if a.resourceSchemas[resourceTypeID] == nil { + a.resourceSchemas[resourceTypeID] = make(map[string]*v2.BatonActionSchema) + } + if a.resourceHandlers[resourceTypeID] == nil { + a.resourceHandlers[resourceTypeID] = make(map[string]ActionHandler) + } + + actionName := schema.GetName() + + // Check for duplicate action names + if _, ok := a.resourceSchemas[resourceTypeID][actionName]; ok { + return fmt.Errorf("action schema %s already registered for resource type %s", actionName, resourceTypeID) + } + + // Check for duplicate action types + if len(schema.GetActionType()) > 0 { + for existingName, existingSchema := range a.resourceSchemas[resourceTypeID] { + if existingSchema == nil || len(existingSchema.GetActionType()) == 0 { + continue + } + // Check if any ActionType in the new schema matches any in existing schemas + for _, newActionType := range schema.GetActionType() { + if newActionType == v2.ActionType_ACTION_TYPE_UNSPECIFIED || newActionType == v2.ActionType_ACTION_TYPE_DYNAMIC { + continue // Skip unspecified and dynamic types as they can overlap + } + for _, existingActionType := range existingSchema.GetActionType() { + if newActionType == existingActionType { + return fmt.Errorf("action type %s already registered for resource type %s (existing action: %s)", newActionType.String(), resourceTypeID, existingName) + } + } + } + } + } + + a.resourceSchemas[resourceTypeID][actionName] = schema + a.resourceHandlers[resourceTypeID][actionName] = handler + + ctxzap.Extract(ctx).Debug("registered resource action", zap.String("resource_type", resourceTypeID), zap.String("action_name", actionName)) + + return nil +} + +// resourceTypeActionRegistry implements ResourceTypeActionRegistry for a specific resource type. +type resourceTypeActionRegistry struct { + resourceTypeID string + actionManager *ActionManager +} + +func (r *resourceTypeActionRegistry) Register(ctx context.Context, schema *v2.BatonActionSchema, handler ActionHandler) error { + return r.actionManager.RegisterResourceAction(ctx, r.resourceTypeID, schema, handler) +} + +// Deprecated: Use Register instead. +// RegisterAction registers a resource-scoped action. The name parameter is ignored; the name from schema is used. +func (r *resourceTypeActionRegistry) RegisterAction(ctx context.Context, name string, schema *v2.BatonActionSchema, handler ActionHandler) error { + return r.Register(ctx, schema, handler) +} + +// GetTypeRegistry returns an ActionRegistry for registering actions scoped to a specific resource type. +func (a *ActionManager) GetTypeRegistry(_ context.Context, resourceTypeID string) (ActionRegistry, error) { + if resourceTypeID == "" { + return nil, errors.New("resource type ID cannot be empty") + } + return &resourceTypeActionRegistry{resourceTypeID: resourceTypeID, actionManager: a}, nil +} + +func (a *ActionManager) UnregisterAction(ctx context.Context, name string) error { + a.mu.Lock() + defer a.mu.Unlock() + + if _, ok := a.schemas[name]; !ok { + return fmt.Errorf("action %s not registered", name) + } + delete(a.schemas, name) + if _, ok := a.handlers[name]; !ok { + return fmt.Errorf("action handler %s not registered", name) + } + delete(a.handlers, name) + + l := ctxzap.Extract(ctx) + l.Debug("unregistered action", zap.String("name", name)) + + // TODO: cancel & clean up outstanding actions? + + return nil +} + +// ListActionSchemas returns all action schemas, optionally filtered by resource type. +// If resourceTypeID is empty, returns all global actions plus all resource-scoped actions. +// If resourceTypeID is set, returns only actions for that resource type. +func (a *ActionManager) ListActionSchemas(_ context.Context, resourceTypeID string) ([]*v2.BatonActionSchema, annotations.Annotations, error) { + a.mu.RLock() + defer a.mu.RUnlock() + + var rv []*v2.BatonActionSchema + + if resourceTypeID == "" { + // Return all global actions + rv = make([]*v2.BatonActionSchema, 0, len(a.schemas)) + for _, schema := range a.schemas { + rv = append(rv, schema) + } + + // Also return all resource-scoped actions + for _, schemas := range a.resourceSchemas { + for _, schema := range schemas { + rv = append(rv, schema) + } + } + } else { + // Return only actions for the specified resource type + schemas, ok := a.resourceSchemas[resourceTypeID] + if !ok { + return []*v2.BatonActionSchema{}, nil, nil + } + + rv = make([]*v2.BatonActionSchema, 0, len(schemas)) + for _, schema := range schemas { + rv = append(rv, schema) + } + } + + return rv, nil, nil +} + +func (a *ActionManager) GetActionSchema(_ context.Context, name string) (*v2.BatonActionSchema, annotations.Annotations, error) { + a.mu.RLock() + defer a.mu.RUnlock() + + schema, ok := a.schemas[name] + if !ok { + return nil, nil, status.Error(codes.NotFound, fmt.Sprintf("action %s not found", name)) + } + return schema, nil, nil +} + +func (a *ActionManager) GetActionStatus(_ context.Context, actionId string) (v2.BatonActionStatus, string, *structpb.Struct, annotations.Annotations, error) { + a.mu.RLock() + defer a.mu.RUnlock() + + oa := a.actions[actionId] + if oa == nil { + return v2.BatonActionStatus_BATON_ACTION_STATUS_UNKNOWN, "", nil, nil, status.Error(codes.NotFound, fmt.Sprintf("action id %s not found", actionId)) + } + + // Don't return oa.Err here because error is for GetActionStatus, not the action itself. + // oa.Rv contains any error. + return oa.Status, oa.Name, oa.Rv, oa.Annos, nil +} + +// InvokeAction invokes an action. If resourceTypeID is set, it invokes a resource-scoped action. +// Otherwise, it invokes a global action. +func (a *ActionManager) InvokeAction( + ctx context.Context, + name string, + resourceTypeID string, + args *structpb.Struct, +) (string, v2.BatonActionStatus, *structpb.Struct, annotations.Annotations, error) { + if resourceTypeID != "" { + return a.invokeResourceAction(ctx, resourceTypeID, name, args) + } + + return a.invokeGlobalAction(ctx, name, args) +} + +// invokeGlobalAction invokes a global (non-resource-scoped) action. +func (a *ActionManager) invokeGlobalAction(ctx context.Context, name string, args *structpb.Struct) (string, v2.BatonActionStatus, *structpb.Struct, annotations.Annotations, error) { + a.mu.RLock() + handler, ok := a.handlers[name] + schema, schemaOk := a.schemas[name] + a.mu.RUnlock() + + if !ok { + return "", v2.BatonActionStatus_BATON_ACTION_STATUS_FAILED, nil, nil, status.Error(codes.NotFound, fmt.Sprintf("handler for action %s not found", name)) + } + if !schemaOk || schema == nil { + return "", v2.BatonActionStatus_BATON_ACTION_STATUS_FAILED, nil, nil, status.Error(codes.Internal, fmt.Sprintf("schema for action %s not found", name)) + } + + // Validate constraints + if err := validateActionConstraints(schema.GetConstraints(), args); err != nil { + return "", v2.BatonActionStatus_BATON_ACTION_STATUS_FAILED, nil, nil, status.Error(codes.InvalidArgument, err.Error()) + } + + oa := a.GetNewAction(name) + + done := make(chan struct{}) + + // If handler exits within a second, return result. + // If handler takes longer than 1 second, return status pending. + // If handler takes longer than an hour, return status failed. + go func() { + defer close(done) + oa.SetStatus(ctx, v2.BatonActionStatus_BATON_ACTION_STATUS_RUNNING) + handlerCtx, cancel := context.WithTimeoutCause(context.Background(), 1*time.Hour, errors.New("action handler timed out")) + defer cancel() + var oaErr error + oa.Rv, oa.Annos, oaErr = handler(handlerCtx, args) + if oaErr == nil { + oa.SetStatus(ctx, v2.BatonActionStatus_BATON_ACTION_STATUS_COMPLETE) + } else { + oa.SetError(ctx, oaErr) + } + }() + + select { + case <-done: + return oa.Id, oa.Status, oa.Rv, oa.Annos, nil + case <-time.After(1 * time.Second): + return oa.Id, oa.Status, oa.Rv, oa.Annos, nil + case <-ctx.Done(): + oa.SetError(ctx, ctx.Err()) + return oa.Id, oa.Status, oa.Rv, oa.Annos, ctx.Err() + } +} + +// invokeResourceAction invokes a resource-scoped action. +func (a *ActionManager) invokeResourceAction( + ctx context.Context, + resourceTypeID string, + actionName string, + args *structpb.Struct, +) (string, v2.BatonActionStatus, *structpb.Struct, annotations.Annotations, error) { + if resourceTypeID == "" { + return "", v2.BatonActionStatus_BATON_ACTION_STATUS_FAILED, nil, nil, status.Error(codes.InvalidArgument, "resource type ID is required") + } + if actionName == "" { + return "", v2.BatonActionStatus_BATON_ACTION_STATUS_FAILED, nil, nil, status.Error(codes.InvalidArgument, "action name is required") + } + + a.mu.RLock() + handlers, ok := a.resourceHandlers[resourceTypeID] + if !ok { + a.mu.RUnlock() + return "", v2.BatonActionStatus_BATON_ACTION_STATUS_FAILED, nil, nil, status.Error(codes.NotFound, fmt.Sprintf("no actions found for resource type %s", resourceTypeID)) + } + + handler, ok := handlers[actionName] + if !ok { + a.mu.RUnlock() + return "", + v2.BatonActionStatus_BATON_ACTION_STATUS_FAILED, + nil, + nil, + status.Error(codes.NotFound, fmt.Sprintf("handler for action %s not found for resource type %s", actionName, resourceTypeID)) + } + + schemas, ok := a.resourceSchemas[resourceTypeID] + if !ok { + a.mu.RUnlock() + return "", v2.BatonActionStatus_BATON_ACTION_STATUS_FAILED, nil, nil, status.Error(codes.Internal, fmt.Sprintf("schemas not found for resource type %s", resourceTypeID)) + } + + schema, ok := schemas[actionName] + if !ok { + a.mu.RUnlock() + return "", v2.BatonActionStatus_BATON_ACTION_STATUS_FAILED, nil, nil, status.Error(codes.Internal, fmt.Sprintf("schema not found for action %s", actionName)) + } + a.mu.RUnlock() + + // Validate constraints + if err := validateActionConstraints(schema.GetConstraints(), args); err != nil { + return "", v2.BatonActionStatus_BATON_ACTION_STATUS_FAILED, nil, nil, status.Error(codes.InvalidArgument, err.Error()) + } + + oa := a.GetNewAction(actionName) + done := make(chan struct{}) + + // Invoke handler in goroutine + go func() { + defer close(done) + oa.SetStatus(ctx, v2.BatonActionStatus_BATON_ACTION_STATUS_RUNNING) + handlerCtx, cancel := context.WithTimeoutCause(ctxzap.ToContext(context.Background(), ctxzap.Extract(ctx)), 1*time.Hour, errors.New("action handler timed out")) + defer cancel() + var oaErr error + oa.Rv, oa.Annos, oaErr = handler(handlerCtx, args) + if oaErr == nil { + oa.SetStatus(ctx, v2.BatonActionStatus_BATON_ACTION_STATUS_COMPLETE) + } else { + oa.SetError(ctx, oaErr) + } + }() + + // Wait for completion or timeout + select { + case <-done: + return oa.Id, oa.Status, oa.Rv, oa.Annos, nil + case <-time.After(1 * time.Second): + return oa.Id, oa.Status, oa.Rv, oa.Annos, nil + case <-ctx.Done(): + oa.SetError(ctx, ctx.Err()) + return oa.Id, oa.Status, oa.Rv, oa.Annos, ctx.Err() + } +} + +// validateActionConstraints validates that the provided args satisfy the schema constraints. +func validateActionConstraints(constraints []*config.Constraint, args *structpb.Struct) error { + if len(constraints) == 0 { + return nil + } + + // Build map of present fields (non-null values in struct) + present := make(map[string]bool) + if args != nil { + for fieldName, value := range args.GetFields() { + if !isNullValue(value) { + present[fieldName] = true + } + } + } + + // Validate each constraint + for _, constraint := range constraints { + if err := validateConstraint(constraint, present); err != nil { + return err + } + } + return nil +} + +func validateConstraint(c *config.Constraint, present map[string]bool) error { + // Deduplicate field names to handle cases where the same field is listed multiple times + uniqueFieldNames := deduplicateStrings(c.GetFieldNames()) + + // Count how many unique primary fields are present + var primaryPresent int + for _, name := range uniqueFieldNames { + if present[name] { + primaryPresent++ + } + } + + switch c.GetKind() { + case config.ConstraintKind_CONSTRAINT_KIND_REQUIRED_TOGETHER: + if primaryPresent > 0 && primaryPresent < len(uniqueFieldNames) { + return fmt.Errorf("fields required together: %v", uniqueFieldNames) + } + case config.ConstraintKind_CONSTRAINT_KIND_MUTUALLY_EXCLUSIVE: + if primaryPresent > 1 { + return fmt.Errorf("fields are mutually exclusive: %v", uniqueFieldNames) + } + case config.ConstraintKind_CONSTRAINT_KIND_AT_LEAST_ONE: + if primaryPresent == 0 { + return fmt.Errorf("at least one required: %v", uniqueFieldNames) + } + case config.ConstraintKind_CONSTRAINT_KIND_DEPENDENT_ON: + if primaryPresent > 0 { + // Deduplicate secondary field names and check they are all present + uniqueSecondaryFieldNames := deduplicateStrings(c.GetSecondaryFieldNames()) + for _, name := range uniqueSecondaryFieldNames { + if !present[name] { + return fmt.Errorf("fields %v depend on %v which must also be present", uniqueFieldNames, uniqueSecondaryFieldNames) + } + } + } + case config.ConstraintKind_CONSTRAINT_KIND_UNSPECIFIED: + return nil + default: + return fmt.Errorf("unknown constraint kind: %v", c.GetKind()) + } + return nil +} + +// deduplicateStrings returns a new slice with duplicate strings removed, preserving order. +func deduplicateStrings(input []string) []string { + seen := make(map[string]bool) + result := make([]string, 0, len(input)) + for _, s := range input { + if !seen[s] { + seen[s] = true + result = append(result, s) + } + } + return result +} + +func isNullValue(v *structpb.Value) bool { + if v == nil { + return true + } + _, isNull := v.GetKind().(*structpb.Value_NullValue) + return isNull +} diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/actions/args.go b/vendor/github.com/conductorone/baton-sdk/pkg/actions/args.go new file mode 100644 index 00000000..995a4cb2 --- /dev/null +++ b/vendor/github.com/conductorone/baton-sdk/pkg/actions/args.go @@ -0,0 +1,771 @@ +package actions + +import ( + "fmt" + + config "github.com/conductorone/baton-sdk/pb/c1/config/v1" + v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/types/known/structpb" +) + +// GetStringArg extracts a string value from the args struct by key. +// Returns the value and true if found, empty string and false otherwise. +func GetStringArg(args *structpb.Struct, key string) (string, bool) { + if args == nil || args.Fields == nil { + return "", false + } + + value, ok := args.Fields[key] + if !ok { + return "", false + } + + stringValue, ok := value.GetKind().(*structpb.Value_StringValue) + if !ok { + return "", false + } + + return stringValue.StringValue, true +} + +// GetIntArg extracts an int64 value from the args struct by key. +// Returns the value and true if found, 0 and false otherwise. +func GetIntArg(args *structpb.Struct, key string) (int64, bool) { + if args == nil || args.Fields == nil { + return 0, false + } + + value, ok := args.Fields[key] + if !ok { + return 0, false + } + + numberValue, ok := value.GetKind().(*structpb.Value_NumberValue) + if !ok { + return 0, false + } + + return int64(numberValue.NumberValue), true +} + +// GetBoolArg extracts a bool value from the args struct by key. +// Returns the value and true if found, false and false otherwise. +func GetBoolArg(args *structpb.Struct, key string) (bool, bool) { + if args == nil || args.Fields == nil { + return false, false + } + + value, ok := args.Fields[key] + if !ok { + return false, false + } + + boolValue, ok := value.GetKind().(*structpb.Value_BoolValue) + if !ok { + return false, false + } + + return boolValue.BoolValue, true +} + +// GetResourceIDArg extracts a ResourceId from the args struct by key. +// The value is expected to be a struct with "resource_type_id" and "resource_id" fields +// (as stored by ResourceField). Returns the ResourceId and true if found, nil and false otherwise. +func GetResourceIDArg(args *structpb.Struct, key string) (*v2.ResourceId, bool) { + if args == nil || args.Fields == nil { + return nil, false + } + + value, ok := args.Fields[key] + if !ok { + return nil, false + } + + structValue, ok := value.GetKind().(*structpb.Value_StructValue) + if !ok { + return nil, false + } + + // Try to get resource_type_id and resource_id fields + resourceTypeID, ok := GetStringArg(structValue.StructValue, "resource_type_id") + if !ok { + // Also try resource_type as an alternative + resourceTypeID, ok = GetStringArg(structValue.StructValue, "resource_type") + if !ok { + return nil, false + } + } + + resourceID, ok := GetStringArg(structValue.StructValue, "resource_id") + if !ok { + // Also try resource as an alternative + resourceID, ok = GetStringArg(structValue.StructValue, "resource") + if !ok { + return nil, false + } + } + + return &v2.ResourceId{ + ResourceType: resourceTypeID, + Resource: resourceID, + }, true +} + +// GetStringSliceArg extracts a string slice from the args struct by key. +// Returns the slice and true if found, nil and false otherwise. +func GetStringSliceArg(args *structpb.Struct, key string) ([]string, bool) { + if args == nil || args.Fields == nil { + return nil, false + } + + value, ok := args.Fields[key] + if !ok { + return nil, false + } + + listValue, ok := value.GetKind().(*structpb.Value_ListValue) + if !ok { + return nil, false + } + + result := make([]string, 0, len(listValue.ListValue.Values)) + for _, v := range listValue.ListValue.Values { + stringValue, ok := v.GetKind().(*structpb.Value_StringValue) + if !ok { + return nil, false + } + result = append(result, stringValue.StringValue) + } + + return result, true +} + +// GetStructArg extracts a nested struct from the args struct by key. +// Returns the struct and true if found, nil and false otherwise. +func GetStructArg(args *structpb.Struct, key string) (*structpb.Struct, bool) { + if args == nil || args.Fields == nil { + return nil, false + } + + value, ok := args.Fields[key] + if !ok { + return nil, false + } + + structValue, ok := value.GetKind().(*structpb.Value_StructValue) + if !ok { + return nil, false + } + + return structValue.StructValue, true +} + +// RequireStringArg extracts a string value from the args struct by key. +// Returns the value or an error if not found or invalid. +func RequireStringArg(args *structpb.Struct, key string) (string, error) { + value, ok := GetStringArg(args, key) + if !ok { + return "", fmt.Errorf("required argument %s is missing or invalid", key) + } + return value, nil +} + +// RequireResourceIDArg extracts a ResourceId from the args struct by key. +// Returns the ResourceId or an error if not found or invalid. +func RequireResourceIDArg(args *structpb.Struct, key string) (*v2.ResourceId, error) { + value, ok := GetResourceIDArg(args, key) + if !ok { + return nil, fmt.Errorf("required argument %s is missing or invalid", key) + } + return value, nil +} + +// RequireResourceIdListArg extracts a list of ResourceId from the args struct by key. +// Returns the list of ResourceId or an error if not found or invalid. +func RequireResourceIdListArg(args *structpb.Struct, key string) ([]*v2.ResourceId, error) { + list, ok := GetResourceIdListArg(args, key) + if !ok { + return nil, fmt.Errorf("required argument %s is missing or invalid", key) + } + return list, nil +} + +// GetResourceIdListArg extracts a list of ResourceId from the args struct by key. +// Returns the list and true if found and valid, or nil and false otherwise. +func GetResourceIdListArg(args *structpb.Struct, key string) ([]*v2.ResourceId, bool) { + if args == nil || args.Fields == nil { + return nil, false + } + + value, ok := args.Fields[key] + if !ok { + return nil, false + } + + listValue, ok := value.GetKind().(*structpb.Value_ListValue) + if !ok { + return nil, false + } + + var resourceIDs []*v2.ResourceId + for _, v := range listValue.ListValue.Values { + structValue, ok := v.GetKind().(*structpb.Value_StructValue) + if !ok { + return nil, false + } + // Try to get resource_type_id and resource_id fields + resourceTypeID, ok := GetStringArg(structValue.StructValue, "resource_type_id") + if !ok { + // Also try resource_type as an alternative + resourceTypeID, ok = GetStringArg(structValue.StructValue, "resource_type") + if !ok { + return nil, false + } + } + + resourceID, ok := GetStringArg(structValue.StructValue, "resource_id") + if !ok { + // Also try resource as an alternative + resourceID, ok = GetStringArg(structValue.StructValue, "resource") + if !ok { + return nil, false + } + } + resourceIDs = append(resourceIDs, &v2.ResourceId{ + ResourceType: resourceTypeID, + Resource: resourceID, + }) + } + + return resourceIDs, true +} + +// GetResourceFieldArg extracts a Resource proto message from the args struct by key. +// The Resource is expected to be stored as a JSON-serialized struct value. +// Returns the Resource and true if found and valid, or nil and false otherwise. +func GetResourceFieldArg(args *structpb.Struct, key string) (*v2.Resource, bool) { + if args == nil || args.Fields == nil { + return nil, false + } + value, ok := args.Fields[key] + if !ok { + return nil, false + } + structValue, ok := value.GetKind().(*structpb.Value_StructValue) + if !ok { + return nil, false + } + + // Marshal the struct value back to JSON, then unmarshal into the proto message + jsonBytes, err := protojson.Marshal(structValue.StructValue) + if err != nil { + return nil, false + } + + basicResource := &config.Resource{} + if err := protojson.Unmarshal(jsonBytes, basicResource); err != nil { + return nil, false + } + + return basicResourceToResource(basicResource), true +} + +func resourceToBasicResource(resource *v2.Resource) *config.Resource { + var resourceId *config.ResourceId + if resource.Id != nil { + resourceId = config.ResourceId_builder{ + ResourceTypeId: resource.Id.ResourceType, + ResourceId: resource.Id.Resource, + }.Build() + } + var parentResourceId *config.ResourceId + if resource.ParentResourceId != nil { + parentResourceId = config.ResourceId_builder{ + ResourceTypeId: resource.ParentResourceId.ResourceType, + ResourceId: resource.ParentResourceId.Resource, + }.Build() + } + return config.Resource_builder{ + ResourceId: resourceId, + ParentResourceId: parentResourceId, + DisplayName: resource.DisplayName, + Description: resource.Description, + Annotations: resource.Annotations, + }.Build() +} + +func basicResourceToResource(basicResource *config.Resource) *v2.Resource { + var resourceId *v2.ResourceId + if basicResource.GetResourceId() != nil { + resourceId = &v2.ResourceId{ + ResourceType: basicResource.GetResourceId().GetResourceTypeId(), + Resource: basicResource.GetResourceId().GetResourceId(), + } + } + var parentResourceId *v2.ResourceId + if basicResource.GetParentResourceId() != nil { + parentResourceId = &v2.ResourceId{ + ResourceType: basicResource.GetParentResourceId().GetResourceTypeId(), + Resource: basicResource.GetParentResourceId().GetResourceId(), + } + } + return &v2.Resource{ + Id: resourceId, + ParentResourceId: parentResourceId, + DisplayName: basicResource.GetDisplayName(), + Description: basicResource.GetDescription(), + Annotations: basicResource.GetAnnotations(), + } +} + +// GetResourceListFieldArg extracts a list of Resource proto messages from the args struct by key. +// Each Resource is expected to be stored as a JSON-serialized struct value. +// Returns the list of Resource and true if found and valid, or nil and false otherwise. +func GetResourceListFieldArg(args *structpb.Struct, key string) ([]*v2.Resource, bool) { + if args == nil || args.Fields == nil { + return nil, false + } + value, ok := args.Fields[key] + if !ok { + return nil, false + } + listValue, ok := value.GetKind().(*structpb.Value_ListValue) + if !ok { + return nil, false + } + var resources []*v2.Resource + for _, v := range listValue.ListValue.Values { + structValue, ok := v.GetKind().(*structpb.Value_StructValue) + if !ok { + return nil, false + } + + // Marshal the struct value back to JSON, then unmarshal into the proto message + jsonBytes, err := protojson.Marshal(structValue.StructValue) + if err != nil { + return nil, false + } + + basicResource := &config.Resource{} + if err := protojson.Unmarshal(jsonBytes, basicResource); err != nil { + return nil, false + } + + resources = append(resources, basicResourceToResource(basicResource)) + } + return resources, true +} + +// SetResourceFieldArg stores a Resource proto message in the args struct by key. +// The Resource is serialized as a JSON struct value. +func SetResourceFieldArg(args *structpb.Struct, key string, resource *v2.Resource) error { + if args == nil { + return fmt.Errorf("args cannot be nil") + } + if resource == nil { + return fmt.Errorf("resource cannot be nil") + } + + basicResource := resourceToBasicResource(resource) + + // Marshal the proto message to JSON, then unmarshal into a struct value + jsonBytes, err := protojson.Marshal(basicResource) + if err != nil { + return fmt.Errorf("failed to marshal resource: %w", err) + } + + structValue := &structpb.Struct{} + if err := protojson.Unmarshal(jsonBytes, structValue); err != nil { + return fmt.Errorf("failed to unmarshal resource to struct: %w", err) + } + + if args.Fields == nil { + args.Fields = make(map[string]*structpb.Value) + } + args.Fields[key] = structpb.NewStructValue(structValue) + return nil +} + +// ReturnField represents a key-value pair for action return values. +type ReturnField struct { + Key string + Value *structpb.Value +} + +// NewReturnField creates a new return field with the given key and value. +func NewReturnField(key string, value *structpb.Value) ReturnField { + return ReturnField{Key: key, Value: value} +} + +// NewStringReturnField creates a return field with a string value. +func NewStringReturnField(key string, value string) ReturnField { + return ReturnField{Key: key, Value: structpb.NewStringValue(value)} +} + +// NewBoolReturnField creates a return field with a bool value. +func NewBoolReturnField(key string, value bool) ReturnField { + return ReturnField{Key: key, Value: structpb.NewBoolValue(value)} +} + +// NewNumberReturnField creates a return field with a number value. +func NewNumberReturnField(key string, value float64) ReturnField { + return ReturnField{Key: key, Value: structpb.NewNumberValue(value)} +} + +// NewResourceReturnField creates a return field with a Resource proto value. +func NewResourceReturnField(key string, resource *v2.Resource) (ReturnField, error) { + if resource == nil { + return ReturnField{}, fmt.Errorf("resource cannot be nil") + } + basicResource := resourceToBasicResource(resource) + jsonBytes, err := protojson.Marshal(basicResource) + if err != nil { + return ReturnField{}, fmt.Errorf("failed to marshal resource: %w", err) + } + + structValue := &structpb.Struct{} + if err := protojson.Unmarshal(jsonBytes, structValue); err != nil { + return ReturnField{}, fmt.Errorf("failed to unmarshal resource to struct: %w", err) + } + + return ReturnField{Key: key, Value: structpb.NewStructValue(structValue)}, nil +} + +// NewResourceIdReturnField creates a return field with a ResourceId proto value. +func NewResourceIdReturnField(key string, resourceId *v2.ResourceId) (ReturnField, error) { + if resourceId == nil { + return ReturnField{}, fmt.Errorf("resource ID cannot be nil") + } + basicResourceId := config.ResourceId_builder{ + ResourceTypeId: resourceId.ResourceType, + ResourceId: resourceId.Resource, + }.Build() + jsonBytes, err := protojson.Marshal(basicResourceId) + if err != nil { + return ReturnField{}, fmt.Errorf("failed to marshal resource id: %w", err) + } + + structValue := &structpb.Struct{} + if err := protojson.Unmarshal(jsonBytes, structValue); err != nil { + return ReturnField{}, fmt.Errorf("failed to unmarshal resource id to struct: %w", err) + } + + return ReturnField{Key: key, Value: structpb.NewStructValue(structValue)}, nil +} + +// NewStringListReturnField creates a return field with a list of string values. +func NewStringListReturnField(key string, values []string) ReturnField { + listValues := make([]*structpb.Value, len(values)) + for i, v := range values { + listValues[i] = structpb.NewStringValue(v) + } + return ReturnField{Key: key, Value: structpb.NewListValue(&structpb.ListValue{Values: listValues})} +} + +// NewNumberListReturnField creates a return field with a list of number values. +func NewNumberListReturnField(key string, values []float64) ReturnField { + listValues := make([]*structpb.Value, len(values)) + for i, v := range values { + listValues[i] = structpb.NewNumberValue(v) + } + return ReturnField{Key: key, Value: structpb.NewListValue(&structpb.ListValue{Values: listValues})} +} + +// NewResourceListReturnField creates a return field with a list of Resource proto values. +func NewResourceListReturnField(key string, resources []*v2.Resource) (ReturnField, error) { + listValues := make([]*structpb.Value, len(resources)) + for i, resource := range resources { + if resource == nil { + return ReturnField{}, fmt.Errorf("resource at index %d cannot be nil", i) + } + basicResource := resourceToBasicResource(resource) + jsonBytes, err := protojson.Marshal(basicResource) + if err != nil { + return ReturnField{}, fmt.Errorf("failed to marshal resource: %w", err) + } + + structValue := &structpb.Struct{} + if err := protojson.Unmarshal(jsonBytes, structValue); err != nil { + return ReturnField{}, fmt.Errorf("failed to unmarshal resource to struct: %w", err) + } + + listValues[i] = structpb.NewStructValue(structValue) + } + return ReturnField{Key: key, Value: structpb.NewListValue(&structpb.ListValue{Values: listValues})}, nil +} + +// NewResourceIdListReturnField creates a return field with a list of ResourceId proto values. +func NewResourceIdListReturnField(key string, resourceIDs []*v2.ResourceId) (ReturnField, error) { + listValues := make([]*structpb.Value, len(resourceIDs)) + for i, resourceId := range resourceIDs { + if resourceId == nil { + return ReturnField{}, fmt.Errorf("resource id at index %d cannot be nil", i) + } + basicResourceId := config.ResourceId_builder{ + ResourceTypeId: resourceId.ResourceType, + ResourceId: resourceId.Resource, + }.Build() + jsonBytes, err := protojson.Marshal(basicResourceId) + if err != nil { + return ReturnField{}, fmt.Errorf("failed to marshal resource id: %w", err) + } + + structValue := &structpb.Struct{} + if err := protojson.Unmarshal(jsonBytes, structValue); err != nil { + return ReturnField{}, fmt.Errorf("failed to unmarshal resource id to struct: %w", err) + } + + listValues[i] = structpb.NewStructValue(structValue) + } + return ReturnField{Key: key, Value: structpb.NewListValue(&structpb.ListValue{Values: listValues})}, nil +} + +// NewListReturnField creates a return field with a list of arbitrary values. +func NewListReturnField(key string, values []*structpb.Value) ReturnField { + return ReturnField{Key: key, Value: structpb.NewListValue(&structpb.ListValue{Values: values})} +} + +// NewReturnValues creates a return struct with the specified success status and fields. +// This helps users avoid having to remember the correct structure for return values. +func NewReturnValues(success bool, fields ...ReturnField) *structpb.Struct { + rv := &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "success": structpb.NewBoolValue(success), + }, + } + + for _, field := range fields { + rv.Fields[field.Key] = field.Value + } + + return rv +} + +// entitlementToBasicEntitlement converts a v2.Entitlement to a config.Entitlement. +func entitlementToBasicEntitlement(entitlement *v2.Entitlement) *config.Entitlement { + var grantableToResourceTypeIDs []string + for _, rt := range entitlement.GetGrantableTo() { + grantableToResourceTypeIDs = append(grantableToResourceTypeIDs, rt.GetId()) + } + + var resourceId, resourceTypeId string + if entitlement.GetResource() != nil && entitlement.GetResource().GetId() != nil { + resourceId = entitlement.GetResource().GetId().GetResource() + resourceTypeId = entitlement.GetResource().GetId().GetResourceType() + } + + return config.Entitlement_builder{ + Id: entitlement.GetId(), + DisplayName: entitlement.GetDisplayName(), + Description: entitlement.GetDescription(), + Slug: entitlement.GetSlug(), + Purpose: entitlement.GetPurpose().String(), + GrantableToResourceTypeIds: grantableToResourceTypeIDs, + ResourceId: resourceId, + ResourceTypeId: resourceTypeId, + }.Build() +} + +// basicEntitlementToEntitlement converts a config.Entitlement to a v2.Entitlement. +func basicEntitlementToEntitlement(basicEntitlement *config.Entitlement) *v2.Entitlement { + var grantableTo []*v2.ResourceType + for _, rtId := range basicEntitlement.GetGrantableToResourceTypeIds() { + grantableTo = append(grantableTo, &v2.ResourceType{Id: rtId}) + } + + var resource *v2.Resource + if basicEntitlement.GetResourceId() != "" && basicEntitlement.GetResourceTypeId() != "" { + resource = &v2.Resource{ + Id: &v2.ResourceId{ + Resource: basicEntitlement.GetResourceId(), + ResourceType: basicEntitlement.GetResourceTypeId(), + }, + } + } + + // Parse purpose from string + purposeValue := v2.Entitlement_PURPOSE_VALUE_UNSPECIFIED + switch basicEntitlement.GetPurpose() { + case "PURPOSE_VALUE_ASSIGNMENT": + purposeValue = v2.Entitlement_PURPOSE_VALUE_ASSIGNMENT + case "PURPOSE_VALUE_PERMISSION": + purposeValue = v2.Entitlement_PURPOSE_VALUE_PERMISSION + case "PURPOSE_VALUE_OWNERSHIP": + purposeValue = v2.Entitlement_PURPOSE_VALUE_OWNERSHIP + } + + return &v2.Entitlement{ + Id: basicEntitlement.GetId(), + DisplayName: basicEntitlement.GetDisplayName(), + Description: basicEntitlement.GetDescription(), + Slug: basicEntitlement.GetSlug(), + Purpose: purposeValue, + GrantableTo: grantableTo, + Resource: resource, + } +} + +// grantToBasicGrant converts a v2.Grant to a config.Grant. +func grantToBasicGrant(grant *v2.Grant) *config.Grant { + var entitlementRef *config.EntitlementRef + if grant.GetEntitlement() != nil { + entitlementRef = config.EntitlementRef_builder{ + Id: grant.GetEntitlement().GetId(), + }.Build() + } + + var principal *config.Resource + if grant.GetPrincipal() != nil { + principal = resourceToBasicResource(grant.GetPrincipal()) + } + + return config.Grant_builder{ + Id: grant.GetId(), + Entitlement: entitlementRef, + Principal: principal, + }.Build() +} + +// basicGrantToGrant converts a config.Grant to a v2.Grant. +func basicGrantToGrant(basicGrant *config.Grant) *v2.Grant { + var entitlement *v2.Entitlement + if basicGrant.GetEntitlement() != nil { + entitlement = &v2.Entitlement{ + Id: basicGrant.GetEntitlement().GetId(), + } + } + + var principal *v2.Resource + if basicGrant.GetPrincipal() != nil { + principal = basicResourceToResource(basicGrant.GetPrincipal()) + } + + return &v2.Grant{ + Id: basicGrant.GetId(), + Entitlement: entitlement, + Principal: principal, + } +} + +// GetEntitlementListFieldArg extracts a list of Entitlement proto messages from the args struct by key. +// Each Entitlement is expected to be stored as a JSON-serialized struct value. +// Returns the list of Entitlement and true if found and valid, or nil and false otherwise. +func GetEntitlementListFieldArg(args *structpb.Struct, key string) ([]*v2.Entitlement, bool) { + if args == nil || args.Fields == nil { + return nil, false + } + value, ok := args.Fields[key] + if !ok { + return nil, false + } + listValue, ok := value.GetKind().(*structpb.Value_ListValue) + if !ok { + return nil, false + } + var entitlements []*v2.Entitlement + for _, v := range listValue.ListValue.Values { + structValue, ok := v.GetKind().(*structpb.Value_StructValue) + if !ok { + return nil, false + } + + // Marshal the struct value back to JSON, then unmarshal into the proto message + jsonBytes, err := protojson.Marshal(structValue.StructValue) + if err != nil { + return nil, false + } + + basicEntitlement := &config.Entitlement{} + if err := protojson.Unmarshal(jsonBytes, basicEntitlement); err != nil { + return nil, false + } + + entitlements = append(entitlements, basicEntitlementToEntitlement(basicEntitlement)) + } + return entitlements, true +} + +// GetGrantListFieldArg extracts a list of Grant proto messages from the args struct by key. +// Each Grant is expected to be stored as a JSON-serialized struct value. +// Returns the list of Grant and true if found and valid, or nil and false otherwise. +func GetGrantListFieldArg(args *structpb.Struct, key string) ([]*v2.Grant, bool) { + if args == nil || args.Fields == nil { + return nil, false + } + value, ok := args.Fields[key] + if !ok { + return nil, false + } + listValue, ok := value.GetKind().(*structpb.Value_ListValue) + if !ok { + return nil, false + } + var grants []*v2.Grant + for _, v := range listValue.ListValue.Values { + structValue, ok := v.GetKind().(*structpb.Value_StructValue) + if !ok { + return nil, false + } + + // Marshal the struct value back to JSON, then unmarshal into the proto message + jsonBytes, err := protojson.Marshal(structValue.StructValue) + if err != nil { + return nil, false + } + + basicGrant := &config.Grant{} + if err := protojson.Unmarshal(jsonBytes, basicGrant); err != nil { + return nil, false + } + + grants = append(grants, basicGrantToGrant(basicGrant)) + } + return grants, true +} + +// NewEntitlementListReturnField creates a return field with a list of Entitlement proto values. +func NewEntitlementListReturnField(key string, entitlements []*v2.Entitlement) (ReturnField, error) { + listValues := make([]*structpb.Value, len(entitlements)) + for i, entitlement := range entitlements { + if entitlement == nil { + return ReturnField{}, fmt.Errorf("entitlement at index %d cannot be nil", i) + } + basicEntitlement := entitlementToBasicEntitlement(entitlement) + jsonBytes, err := protojson.Marshal(basicEntitlement) + if err != nil { + return ReturnField{}, fmt.Errorf("failed to marshal entitlement: %w", err) + } + + structValue := &structpb.Struct{} + if err := protojson.Unmarshal(jsonBytes, structValue); err != nil { + return ReturnField{}, fmt.Errorf("failed to unmarshal entitlement to struct: %w", err) + } + + listValues[i] = structpb.NewStructValue(structValue) + } + return ReturnField{Key: key, Value: structpb.NewListValue(&structpb.ListValue{Values: listValues})}, nil +} + +// NewGrantListReturnField creates a return field with a list of Grant proto values. +func NewGrantListReturnField(key string, grants []*v2.Grant) (ReturnField, error) { + listValues := make([]*structpb.Value, len(grants)) + for i, grant := range grants { + if grant == nil { + return ReturnField{}, fmt.Errorf("grant at index %d cannot be nil", i) + } + basicGrant := grantToBasicGrant(grant) + jsonBytes, err := protojson.Marshal(basicGrant) + if err != nil { + return ReturnField{}, fmt.Errorf("failed to marshal grant: %w", err) + } + + structValue := &structpb.Struct{} + if err := protojson.Unmarshal(jsonBytes, structValue); err != nil { + return ReturnField{}, fmt.Errorf("failed to unmarshal grant to struct: %w", err) + } + + listValues[i] = structpb.NewStructValue(structValue) + } + return ReturnField{Key: key, Value: structpb.NewListValue(&structpb.ListValue{Values: listValues})}, nil +} diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/cli/cli.go b/vendor/github.com/conductorone/baton-sdk/pkg/cli/cli.go index 93a6e3ba..8adde283 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/cli/cli.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/cli/cli.go @@ -16,8 +16,9 @@ import ( ) type RunTimeOpts struct { - SessionStore sessions.SessionStore - TokenSource oauth2.TokenSource + SessionStore sessions.SessionStore + TokenSource oauth2.TokenSource + SelectedAuthMethod string } // GetConnectorFunc is a function type that creates a connector instance. @@ -35,7 +36,8 @@ func WithSessionCache(ctx context.Context, constructor sessions.SessionStoreCons } type ConnectorOpts struct { - TokenSource oauth2.TokenSource + TokenSource oauth2.TokenSource + SelectedAuthMethod string } type NewConnector[T field.Configurable] func(ctx context.Context, cfg T, opts *ConnectorOpts) (connectorbuilder.ConnectorBuilderV2, []connectorbuilder.Opt, error) diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/cli/commands.go b/vendor/github.com/conductorone/baton-sdk/pkg/cli/commands.go index eea84255..1b7aadcd 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/cli/commands.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/cli/commands.go @@ -7,9 +7,10 @@ import ( "encoding/json" "fmt" "os" - "sort" "time" + "github.com/conductorone/baton-sdk/pkg/connectorbuilder" + "github.com/conductorone/baton-sdk/pkg/types" "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" "github.com/maypok86/otter/v2" "github.com/spf13/cobra" @@ -178,6 +179,13 @@ func MakeMainCommand[T field.Configurable]( if v.GetBool("skip-full-sync") { opts = append(opts, connectorrunner.WithFullSyncDisabled()) } + if v.GetBool("health-check") { + opts = append(opts, connectorrunner.WithHealthCheck( + true, + v.GetInt("health-check-port"), + v.GetString("health-check-bind-address"), + )) + } } else { switch { case v.GetString("grant-entitlement") != "": @@ -235,6 +243,7 @@ func MakeMainCommand[T field.Configurable]( login, email, profile, + v.GetString("create-account-resource-type"), )) case v.GetString("create-account-login") != "": // should only be here if no create-account-profile is provided, so lets make one. @@ -252,6 +261,7 @@ func MakeMainCommand[T field.Configurable]( v.GetString("create-account-login"), v.GetString("create-account-email"), profile, + v.GetString("create-account-resource-type"), )) case v.GetString("invoke-action") != "": invokeActionArgsStr := v.GetString("invoke-action-args") @@ -271,8 +281,16 @@ func MakeMainCommand[T field.Configurable]( connectorrunner.WithOnDemandInvokeAction( v.GetString("file"), v.GetString("invoke-action"), + v.GetString("invoke-action-resource-type"), // Optional resource type for resource-scoped actions invokeActionArgsStruct, )) + case v.GetBool("list-action-schemas"): + opts = append(opts, + connectorrunner.WithActionsEnabled(), + connectorrunner.WithOnDemandListActionSchemas( + v.GetString("file"), + v.GetString("list-action-schemas-resource-type"), // Optional resource type filter + )) case v.GetString("delete-resource") != "": opts = append(opts, connectorrunner.WithProvisioningEnabled(), @@ -324,7 +342,7 @@ func MakeMainCommand[T field.Configurable]( default: if len(v.GetStringSlice("sync-resources")) > 0 { opts = append(opts, - connectorrunner.WithTargetedSyncResourceIDs(v.GetStringSlice("sync-resources"))) + connectorrunner.WithTargetedSyncResources(v.GetStringSlice("sync-resources"))) } if len(v.GetStringSlice("sync-resource-types")) > 0 { opts = append(opts, @@ -357,11 +375,13 @@ func MakeMainCommand[T field.Configurable]( } opts = append(opts, connectorrunner.WithSkipEntitlementsAndGrants(v.GetBool("skip-entitlements-and-grants"))) + if v.GetBool("skip-grants") { opts = append(opts, connectorrunner.WithSkipGrants(v.GetBool("skip-grants"))) } - c, err := getconnector(runCtx, t, RunTimeOpts{}) + // Save the selected authentication method and get the connector. + c, err := getconnector(runCtx, t, RunTimeOpts{SelectedAuthMethod: v.GetString("auth-method")}) if err != nil { return err } @@ -530,6 +550,7 @@ func MakeGRPCServerCommand[T field.Configurable]( otterOptions.MaximumWeight = uint64(sessionStoreMaximumSize) } }), + SelectedAuthMethod: v.GetString("auth-method"), }) if err != nil { return err @@ -550,7 +571,7 @@ func MakeGRPCServerCommand[T field.Configurable]( } if len(v.GetStringSlice("sync-resources")) > 0 { - copts = append(copts, connector.WithTargetedSyncResourceIDs(v.GetStringSlice("sync-resources"))) + copts = append(copts, connector.WithTargetedSyncResources(v.GetStringSlice("sync-resources"))) } if len(v.GetStringSlice("sync-resource-types")) > 0 { @@ -595,6 +616,7 @@ func MakeCapabilitiesCommand[T field.Configurable]( v *viper.Viper, confschema field.Configuration, getconnector GetConnectorFunc2[T], + opts ...connectorrunner.Option, ) func(*cobra.Command, []string) error { return func(cmd *cobra.Command, args []string) error { // NOTE(shackra): bind all the flags (persistent and @@ -616,29 +638,60 @@ func MakeCapabilitiesCommand[T field.Configurable]( return err } - readFromPath := true - decodeOpts := field.WithAdditionalDecodeHooks(field.FileUploadDecodeHook(readFromPath)) - t, err := MakeGenericConfiguration[T](v, decodeOpts) + var c types.ConnectorServer + + c, err = defaultConnectorBuilder(ctx, opts...) if err != nil { - return fmt.Errorf("failed to make configuration: %w", err) + return fmt.Errorf("failed to build default connector: %w", err) } - // validate required fields and relationship constraints - if err := field.Validate(confschema, t, field.WithAuthMethod(v.GetString("auth-method"))); err != nil { - return err + + if c == nil { + readFromPath := true + decodeOpts := field.WithAdditionalDecodeHooks(field.FileUploadDecodeHook(readFromPath)) + t, err := MakeGenericConfiguration[T](v, decodeOpts) + if err != nil { + return fmt.Errorf("failed to make configuration: %w", err) + } + authMethod := v.GetString("auth-method") + // validate required fields and relationship constraints + if err := field.Validate(confschema, t, field.WithAuthMethod(authMethod)); err != nil { + return err + } + + c, err = getconnector(runCtx, t, RunTimeOpts{SelectedAuthMethod: authMethod}) + if err != nil { + return err + } } - c, err := getconnector(runCtx, t, RunTimeOpts{}) - if err != nil { - return err + if c == nil { + return fmt.Errorf("could not create connector %w", err) } - md, err := c.GetMetadata(runCtx, &v2.ConnectorServiceGetMetadataRequest{}) - if err != nil { - return err + type getter interface { + GetCapabilities(ctx context.Context) (*v2.ConnectorCapabilities, error) + } + + var capabilities *v2.ConnectorCapabilities + + if getCap, ok := c.(getter); ok { + capabilities, err = getCap.GetCapabilities(runCtx) + if err != nil { + return err + } } - if !md.GetMetadata().HasCapabilities() { - return fmt.Errorf("connector does not support capabilities") + if capabilities == nil { + md, err := c.GetMetadata(runCtx, &v2.ConnectorServiceGetMetadataRequest{}) + if err != nil { + return err + } + + if !md.GetMetadata().HasCapabilities() { + return fmt.Errorf("connector does not support capabilities") + } + + capabilities = md.GetMetadata().GetCapabilities() } protoMarshaller := protojson.MarshalOptions{ @@ -647,7 +700,7 @@ func MakeCapabilitiesCommand[T field.Configurable]( } a := &anypb.Any{} - err = anypb.MarshalFrom(a, md.GetMetadata().GetCapabilities(), proto.MarshalOptions{Deterministic: true}) + err = anypb.MarshalFrom(a, capabilities, proto.MarshalOptions{Deterministic: true}) if err != nil { return err } @@ -674,11 +727,6 @@ func MakeConfigSchemaCommand[T field.Configurable]( getconnector GetConnectorFunc2[T], ) func(*cobra.Command, []string) error { return func(cmd *cobra.Command, args []string) error { - // Sort fields by FieldName - sort.Slice(confschema.Fields, func(i, j int) bool { - return confschema.Fields[i].FieldName < confschema.Fields[j].FieldName - }) - // Use MarshalIndent for pretty printing pb, err := json.MarshalIndent(&confschema, "", " ") if err != nil { @@ -691,3 +739,20 @@ func MakeConfigSchemaCommand[T field.Configurable]( return nil } } + +func defaultConnectorBuilder(ctx context.Context, opts ...connectorrunner.Option) (types.ConnectorServer, error) { + defaultConnector, err := connectorrunner.ExtractDefaultConnector(ctx, opts...) + if err != nil { + return nil, err + } + + if defaultConnector == nil { + return nil, nil + } + + c, err := connectorbuilder.NewConnector(ctx, defaultConnector) + if err != nil { + return nil, err + } + return c, nil +} diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/cli/healthcheck_command.go b/vendor/github.com/conductorone/baton-sdk/pkg/cli/healthcheck_command.go new file mode 100644 index 00000000..63b0f3c3 --- /dev/null +++ b/vendor/github.com/conductorone/baton-sdk/pkg/cli/healthcheck_command.go @@ -0,0 +1,81 @@ +package cli + +import ( + "context" + "fmt" + "net" + "net/http" + "net/url" + "strconv" + "time" + + "github.com/conductorone/baton-sdk/pkg/uhttp" + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +var validHealthCheckEndpoints = map[string]string{ + "health": "/health", + "ready": "/ready", + "live": "/live", +} + +func MakeHealthCheckCommand( + ctx context.Context, + v *viper.Viper, +) func(*cobra.Command, []string) error { + return func(cmd *cobra.Command, args []string) error { + err := v.BindPFlags(cmd.Flags()) + if err != nil { + return err + } + + // Get configuration from persistent parent flags + port := v.GetInt("health-check-port") + bindAddress := v.GetString("health-check-bind-address") + + // Get subcommand-specific flags + endpoint, _ := cmd.Flags().GetString("endpoint") + timeout, _ := cmd.Flags().GetInt("timeout") + + // Validate endpoint + path, ok := validHealthCheckEndpoints[endpoint] + if !ok { + return fmt.Errorf("invalid endpoint: %s (valid: health, ready, live)", endpoint) + } + + // Construct URL + u := &url.URL{ + Scheme: "http", + Host: net.JoinHostPort(bindAddress, strconv.Itoa(port)), + Path: path, + } + + // Create HTTP client using baton-sdk uhttp package + client, err := uhttp.NewClient(ctx) + if err != nil { + return fmt.Errorf("failed to create http client: %w", err) + } + // Override the default 5-minute timeout with our configured timeout + client.Timeout = time.Duration(timeout) * time.Second + + // Make request + req, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil) + if err != nil { + return fmt.Errorf("failed to create request: %w", err) + } + + resp, err := client.Do(req) + if err != nil { + return fmt.Errorf("health check failed: %w", err) + } + defer resp.Body.Close() + + // Check response status + if resp.StatusCode != http.StatusOK { + return fmt.Errorf("health check returned status %d", resp.StatusCode) + } + + return nil + } +} diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/cli/lambda_server__added.go b/vendor/github.com/conductorone/baton-sdk/pkg/cli/lambda_server__added.go index c2fd1848..3d9cf060 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/cli/lambda_server__added.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/cli/lambda_server__added.go @@ -178,12 +178,24 @@ func OptionallyAddLambdaCommand[T field.Configurable]( configStructMap := configStruct.AsMap() - var fieldOptions []field.Option + var ( + fieldOptions []field.Option + schemaFields []field.SchemaField + authMethodStr string + ) if authMethod, ok := configStructMap["auth-method"]; ok { - if authMethodStr, ok := authMethod.(string); ok { + if authMethodStr, ok = authMethod.(string); ok { fieldOptions = append(fieldOptions, field.WithAuthMethod(authMethodStr)) } } + schemaFieldsMap := connectorSchema.FieldGroupFields(authMethodStr) + for _, field := range schemaFieldsMap { + schemaFields = append(schemaFields, field) + } + + if len(schemaFields) == 0 { + schemaFields = connectorSchema.Fields + } if err := field.Validate(connectorSchema, t, fieldOptions...); err != nil { return fmt.Errorf("lambda-run: failed to validate config: %w", err) @@ -214,9 +226,10 @@ func OptionallyAddLambdaCommand[T field.Configurable]( otterOptions.MaximumWeight = uint64(sessionStoreMaximumSize) } }), + SelectedAuthMethod: authMethodStr, } - if hasOauthField(connectorSchema.Fields) { + if hasOauthField(schemaFields) { ops.TokenSource = &lambdaTokenSource{ ctx: runCtx, webKey: webKey, diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/cli/lazy_session.go b/vendor/github.com/conductorone/baton-sdk/pkg/cli/lazy_session.go index 6e03e0e7..224ff248 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/cli/lazy_session.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/cli/lazy_session.go @@ -81,9 +81,9 @@ func (l *lazyCachingSessionStore) Get(ctx context.Context, key string, opt ...se } // GetMany implements types.SessionStore. -func (l *lazyCachingSessionStore) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string][]byte, error) { +func (l *lazyCachingSessionStore) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string][]byte, []string, error) { if err := l.ensureSession(ctx); err != nil { - return nil, err + return nil, nil, err } return l.session.GetMany(ctx, keys, opt...) } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/config/config.go b/vendor/github.com/conductorone/baton-sdk/pkg/config/config.go index c018e940..f6ae6be2 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/config/config.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/config/config.go @@ -30,7 +30,8 @@ func RunConnector[T field.Configurable]( ) { f := func(ctx context.Context, cfg T, runTimeOpts cli.RunTimeOpts) (types.ConnectorServer, error) { l := ctxzap.Extract(ctx) - connector, builderOpts, err := cf(ctx, cfg, &cli.ConnectorOpts{TokenSource: runTimeOpts.TokenSource}) + connector, builderOpts, err := cf(ctx, cfg, &cli.ConnectorOpts{TokenSource: runTimeOpts.TokenSource, + SelectedAuthMethod: runTimeOpts.SelectedAuthMethod}) if err != nil { return nil, err } @@ -61,6 +62,8 @@ func RunConnector[T field.Configurable]( } } +var ErrDuplicateField = errors.New("multiple fields with the same name") + // GetConnectorFunc is a function type that creates a connector instance. // It takes a context and configuration. The session cache constructor is retrieved from the context. // deprecated - prefer RunConnector. @@ -111,23 +114,48 @@ func DefineConfigurationV2[T field.Configurable]( v.SetEnvKeyReplacer(strings.NewReplacer("-", "_")) v.AutomaticEnv() + defaultFieldsByName := make(map[string]field.SchemaField) + for _, f := range field.DefaultFields { + if _, ok := defaultFieldsByName[f.FieldName]; ok { + return nil, nil, fmt.Errorf("multiple default fields with the same name: %s", f.FieldName) + } + defaultFieldsByName[f.FieldName] = f + } + confschema := schema confschema.Fields = append(field.DefaultFields, confschema.Fields...) // Ensure unique fields uniqueFields := make(map[string]field.SchemaField) + fieldsToDelete := make(map[string]bool) for _, f := range confschema.Fields { - if s, ok := uniqueFields[f.FieldName]; ok { - if !f.WasReExported && !s.WasReExported { - return nil, nil, fmt.Errorf("multiple fields with the same name: %s.If you want to use a default field in the SDK, use ExportAs on the connector schema field", f.FieldName) + if existingField, ok := uniqueFields[f.FieldName]; ok { + // If the duplicate field is not a default field, error. + if _, ok := defaultFieldsByName[f.FieldName]; !ok { + return nil, nil, fmt.Errorf("%w: %s", ErrDuplicateField, f.FieldName) + } + // If redeclaring a default field and not reexporting it, error. + if !f.WasReExported { + return nil, nil, fmt.Errorf("%w: %s. If you want to use a default field in the SDK, use ExportAs on the connector schema field", ErrDuplicateField, f.FieldName) + } + if existingField.WasReExported { + return nil, nil, fmt.Errorf("%w: %s. If you want to use a default field in the SDK, use ExportAs on the connector schema field", ErrDuplicateField, f.FieldName) } + + fieldsToDelete[existingField.FieldName] = true } uniqueFields[f.FieldName] = f } - confschema.Fields = make([]field.SchemaField, 0, len(uniqueFields)) - for _, f := range uniqueFields { - confschema.Fields = append(confschema.Fields, f) + + // Filter out fields that were not reexported and were in the fieldsToDelete list. + fields := make([]field.SchemaField, 0, len(confschema.Fields)) + for _, f := range confschema.Fields { + if !f.WasReExported && fieldsToDelete[f.FieldName] { + continue + } + fields = append(fields, f) } + confschema.Fields = fields // setup CLI with cobra mainCMD := &cobra.Command{ @@ -180,15 +208,28 @@ func DefineConfigurationV2[T field.Configurable]( return nil, nil, err } - _, err = cli.AddCommand(mainCMD, v, &schema, &cobra.Command{ - Use: "capabilities", - Short: "Get connector capabilities", - RunE: cli.MakeCapabilitiesCommand(ctx, connectorName, v, confschema, connector), - }) - + defaultConnector, err := connectorrunner.ExtractDefaultConnector(ctx, options...) if err != nil { return nil, nil, err } + if defaultConnector == nil { + _, err = cli.AddCommand(mainCMD, v, &schema, &cobra.Command{ + Use: "capabilities", + Short: "Get connector capabilities", + RunE: cli.MakeCapabilitiesCommand(ctx, connectorName, v, confschema, connector), + }) + if err != nil { + return nil, nil, err + } + } else { + // We don't want to use cli.AddCommand here because we don't want to validate config flags + // So we can call capabilities even with incomplete config + mainCMD.AddCommand(&cobra.Command{ + Use: "capabilities", + Short: "Get connector capabilities", + RunE: cli.MakeCapabilitiesCommand(ctx, connectorName, v, confschema, connector, options...), + }) + } _, err = cli.AddCommand(mainCMD, v, nil, &cobra.Command{ Use: "config", @@ -200,6 +241,30 @@ func DefineConfigurationV2[T field.Configurable]( return nil, nil, err } + // Health check client command - doesn't need connector config validation + healthCheckCmd := &cobra.Command{ + Use: "health-check", + Short: "Check the health of a running connector", + Long: `Query the health check server of a running connector. + +This command is designed for use in container/Kubernetes health check scenarios. +It queries the specified endpoint and exits with code 0 if healthy, or non-zero otherwise. + +Examples: + # Check health using defaults (localhost:8081/health) + connector-name health-check + + # Check readiness endpoint + connector-name health-check --endpoint=ready + + # Check liveness with custom port + connector-name health-check --endpoint=live --health-check-port=9090`, + RunE: cli.MakeHealthCheckCommand(ctx, v), + } + healthCheckCmd.Flags().String("endpoint", "health", "Endpoint to check: health, ready, or live") + healthCheckCmd.Flags().Int("timeout", 5, "Request timeout in seconds") + mainCMD.AddCommand(healthCheckCmd) + return v, mainCMD, nil } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/accounts.go b/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/accounts.go index 2ab3df56..adccd2ef 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/accounts.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/accounts.go @@ -33,6 +33,11 @@ type AccountManager interface { AccountManagerLimited } +type AccountManagerV2 interface { + ResourceSyncerV2 + AccountManagerLimited +} + type AccountManagerLimited interface { CreateAccount(ctx context.Context, accountInfo *v2.AccountInfo, @@ -54,30 +59,64 @@ func (b *builder) CreateAccount(ctx context.Context, request *v2.CreateAccountRe start := b.nowFunc() tt := tasks.CreateAccountType l := ctxzap.Extract(ctx) - if b.accountManager == nil { + + if len(b.accountManagers) == 0 { l.Error("error: connector does not have account manager configured") - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, status.Error(codes.Unimplemented, "connector does not have account manager configured") + err := status.Error(codes.Unimplemented, "connector does not have account manager configured") + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err + } + + var accountManager AccountManagerLimited + if request.GetResourceTypeId() == "" { + if len(b.accountManagers) == 1 { + // If there's only one account manager, use it. + for _, am := range b.accountManagers { + accountManager = am + break + } + } else { + // If there are multiple account managers, default to user resource type. + var ok bool + accountManager, ok = b.accountManagers["user"] + if !ok { + err := status.Error(codes.Unimplemented, "connector has multiple account managers configured, but no resource type specified, and no default account manager configured") + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err + } + } + } + + // If resource type is specified, use the account manager for that resource type. + if accountManager == nil { + var ok bool + accountManager, ok = b.accountManagers[request.GetResourceTypeId()] + if !ok { + l.Error("error: connector does not have account manager configured") + err := status.Errorf(codes.Unimplemented, "connector does not have account manager configured for resource type: %s", request.GetResourceTypeId()) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err + } } opts, err := crypto.ConvertCredentialOptions(ctx, b.clientSecret, request.GetCredentialOptions(), request.GetEncryptionConfigs()) if err != nil { l.Error("error: converting credential options failed", zap.Error(err)) - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, fmt.Errorf("error: converting credential options failed: %w", err) } - result, plaintexts, annos, err := b.accountManager.CreateAccount(ctx, request.GetAccountInfo(), opts) + result, plaintexts, annos, err := accountManager.CreateAccount(ctx, request.GetAccountInfo(), opts) if err != nil { l.Error("error: create account failed", zap.Error(err)) - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, fmt.Errorf("error: create account failed: %w", err) } pkem, err := crypto.NewEncryptionManager(request.GetCredentialOptions(), request.GetEncryptionConfigs()) if err != nil { l.Error("error: creating encryption manager failed", zap.Error(err)) - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, fmt.Errorf("error: creating encryption manager failed: %w", err) } @@ -85,7 +124,7 @@ func (b *builder) CreateAccount(ctx context.Context, request *v2.CreateAccountRe for _, plaintextCredential := range plaintexts { encryptedData, err := pkem.Encrypt(ctx, plaintextCredential) if err != nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, err } encryptedDatas = append(encryptedDatas, encryptedData...) @@ -101,27 +140,30 @@ func (b *builder) CreateAccount(ctx context.Context, request *v2.CreateAccountRe rv.SetSuccess(proto.ValueOrDefault(r)) case *v2.CreateAccountResponse_ActionRequiredResult: rv.SetActionRequired(proto.ValueOrDefault(r)) + case *v2.CreateAccountResponse_AlreadyExistsResult: + rv.SetAlreadyExists(proto.ValueOrDefault(r)) + case *v2.CreateAccountResponse_InProgressResult: + rv.SetInProgress(proto.ValueOrDefault(r)) default: - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, status.Error(codes.Unimplemented, fmt.Sprintf("unknown result type: %T", result)) + err := status.Error(codes.Unimplemented, fmt.Sprintf("unknown result type: %T", result)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } b.m.RecordTaskSuccess(ctx, tt, b.nowFunc().Sub(start)) return rv, nil } -func (b *builder) addAccountManager(_ context.Context, typeId string, in interface{}) error { +func (b *builder) addAccountManager(_ context.Context, typeId string, in any) error { if _, ok := in.(OldAccountManager); ok { return fmt.Errorf("error: old account manager interface implemented for %s", typeId) } if accountManager, ok := in.(AccountManagerLimited); ok { - // NOTE(kans): currently unused - but these should probably be (resource) typed - b.accountManagers[typeId] = accountManager - if b.accountManager != nil { + if _, ok := b.accountManagers[typeId]; ok { return fmt.Errorf("error: duplicate resource type found for account manager %s", typeId) } - b.accountManager = accountManager + b.accountManagers[typeId] = accountManager } return nil } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/actions.go b/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/actions.go index f8e0ccc7..b24adff3 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/actions.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/actions.go @@ -5,33 +5,94 @@ import ( "fmt" v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" + "github.com/conductorone/baton-sdk/pkg/actions" "github.com/conductorone/baton-sdk/pkg/annotations" "github.com/conductorone/baton-sdk/pkg/types/tasks" "google.golang.org/protobuf/types/known/structpb" ) -// CustomActionManager defines capabilities for handling custom actions. -// -// Note: RegisterActionManager is preferred for new connectors. +// ActionManager defines the interface for managing actions in the connector builder. +// This is the internal interface used by the builder for dispatch. +// The *actions.ActionManager type implements this interface. +type ActionManager interface { + // ListActionSchemas returns all action schemas, optionally filtered by resource type. + // If resourceTypeID is empty, returns all actions (both global and resource-scoped). + // If resourceTypeID is set, returns only actions for that resource type. + ListActionSchemas(ctx context.Context, resourceTypeID string) ([]*v2.BatonActionSchema, annotations.Annotations, error) + + // GetActionSchema returns the schema for a specific action by name. + GetActionSchema(ctx context.Context, name string) (*v2.BatonActionSchema, annotations.Annotations, error) + + // InvokeAction invokes an action. If resourceTypeID is set, invokes a resource-scoped action. + InvokeAction( + ctx context.Context, + name string, + resourceTypeID string, + args *structpb.Struct, + ) (string, v2.BatonActionStatus, *structpb.Struct, annotations.Annotations, error) + + // GetActionStatus returns the status of an outstanding action. + GetActionStatus(ctx context.Context, id string) (v2.BatonActionStatus, string, *structpb.Struct, annotations.Annotations, error) + + // GetTypeRegistry returns a registry for registering resource-scoped actions. + GetTypeRegistry(ctx context.Context, resourceTypeID string) (actions.ActionRegistry, error) + + // HasActions returns true if there are any registered actions. + HasActions() bool +} + +// GlobalActionProvider allows connectors to register global (non-resource-scoped) actions. +// This is the preferred method for registering global actions in new connectors. +// Implement this interface instead of the deprecated CustomActionManager or RegisterActionManagerLimited. +type GlobalActionProvider interface { + GlobalActions(ctx context.Context, registry actions.ActionRegistry) error +} + +// ResourceActionProvider is an interface that resource builders can implement +// to provide resource-scoped actions for their resource type. +type ResourceActionProvider interface { + // ResourceActions returns the schemas and handlers for all resource actions + // supported by this resource type. + ResourceActions(ctx context.Context, registry actions.ActionRegistry) error +} + +// Deprecated: CustomActionManager is deprecated. Implement GlobalActionProvider instead, +// which registers actions directly into the SDK's ActionManager. // // This interface allows connectors to define and execute custom actions -// that can be triggered from Baton. +// that can be triggered from Baton. It supports both global actions and +// resource-scoped actions through the resourceTypeID parameter. type CustomActionManager interface { - ListActionSchemas(ctx context.Context) ([]*v2.BatonActionSchema, annotations.Annotations, error) + // ListActionSchemas returns all action schemas, optionally filtered by resource type. + // If resourceTypeID is empty, returns all actions (both global and resource-scoped). + // If resourceTypeID is set, returns only actions for that resource type. + ListActionSchemas(ctx context.Context, resourceTypeID string) ([]*v2.BatonActionSchema, annotations.Annotations, error) + + // GetActionSchema returns the schema for a specific action by name. GetActionSchema(ctx context.Context, name string) (*v2.BatonActionSchema, annotations.Annotations, error) - InvokeAction(ctx context.Context, name string, args *structpb.Struct) (string, v2.BatonActionStatus, *structpb.Struct, annotations.Annotations, error) + + // InvokeAction invokes an action. If resourceTypeID is set, invokes a resource-scoped action. + InvokeAction( + ctx context.Context, + name string, + resourceTypeID string, + args *structpb.Struct, + ) (string, v2.BatonActionStatus, *structpb.Struct, annotations.Annotations, error) + + // GetActionStatus returns the status of an outstanding action. GetActionStatus(ctx context.Context, id string) (v2.BatonActionStatus, string, *structpb.Struct, annotations.Annotations, error) } -// RegisterActionManager extends ConnectorBuilder to add capabilities for registering custom actions. +// Deprecated: RegisterActionManager is deprecated. Implement GlobalActionProvider instead. // -// This is the recommended interface for implementing custom action support in new connectors. +// RegisterActionManager extends ConnectorBuilder to add capabilities for registering custom actions. // It provides a mechanism to register a CustomActionManager with the connector. type RegisterActionManager interface { ConnectorBuilder RegisterActionManagerLimited } +// Deprecated: RegisterActionManagerLimited is deprecated. Implement GlobalActionProvider instead. type RegisterActionManagerLimited interface { RegisterActionManager(ctx context.Context) (CustomActionManager, error) } @@ -42,20 +103,17 @@ func (b *builder) ListActionSchemas(ctx context.Context, request *v2.ListActionS start := b.nowFunc() tt := tasks.ActionListSchemasType - if b.actionManager == nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: action manager not implemented") - } - actionSchemas, annos, err := b.actionManager.ListActionSchemas(ctx) + resourceTypeID := request.GetResourceTypeId() + + actionSchemas, _, err := b.actionManager.ListActionSchemas(ctx, resourceTypeID) if err != nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, fmt.Errorf("error: listing action schemas failed: %w", err) } rv := v2.ListActionSchemasResponse_builder{ - Schemas: actionSchemas, - Annotations: annos, + Schemas: actionSchemas, }.Build() b.m.RecordTaskSuccess(ctx, tt, b.nowFunc().Sub(start)) @@ -68,22 +126,17 @@ func (b *builder) GetActionSchema(ctx context.Context, request *v2.GetActionSche start := b.nowFunc() tt := tasks.ActionGetSchemaType - if b.actionManager == nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: action manager not implemented") - } actionSchema, annos, err := b.actionManager.GetActionSchema(ctx, request.GetName()) if err != nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: getting action schema failed: %w", err) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, fmt.Errorf("error: action schema %s not found: %w", request.GetName(), err) } rv := v2.GetActionSchemaResponse_builder{ Schema: actionSchema, Annotations: annos, }.Build() - b.m.RecordTaskSuccess(ctx, tt, b.nowFunc().Sub(start)) return rv, nil } @@ -94,21 +147,19 @@ func (b *builder) InvokeAction(ctx context.Context, request *v2.InvokeActionRequ start := b.nowFunc() tt := tasks.ActionInvokeType - if b.actionManager == nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: action manager not implemented") - } - id, status, resp, annos, err := b.actionManager.InvokeAction(ctx, request.GetName(), request.GetArgs()) + resourceTypeID := request.GetResourceTypeId() + + id, actionStatus, resp, annos, err := b.actionManager.InvokeAction(ctx, request.GetName(), resourceTypeID, request.GetArgs()) if err != nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, fmt.Errorf("error: invoking action failed: %w", err) } rv := v2.InvokeActionResponse_builder{ Id: id, Name: request.GetName(), - Status: status, + Status: actionStatus, Annotations: annos, Response: resp, }.Build() @@ -123,49 +174,68 @@ func (b *builder) GetActionStatus(ctx context.Context, request *v2.GetActionStat start := b.nowFunc() tt := tasks.ActionStatusType - if b.actionManager == nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: action manager not implemented") - } - status, name, rv, annos, err := b.actionManager.GetActionStatus(ctx, request.GetId()) + actionStatus, name, rv, annos, err := b.actionManager.GetActionStatus(ctx, request.GetId()) if err != nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: getting action status failed: %w", err) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, fmt.Errorf("error: action status for id %s not found: %w", request.GetId(), err) } resp := v2.GetActionStatusResponse_builder{ Id: request.GetId(), Name: name, - Status: status, + Status: actionStatus, Annotations: annos, Response: rv, }.Build() - b.m.RecordTaskSuccess(ctx, tt, b.nowFunc().Sub(start)) return resp, nil } -func (b *builder) addActionManager(ctx context.Context, in interface{}) error { - if actionManager, ok := in.(CustomActionManager); ok { - if b.actionManager != nil { - return fmt.Errorf("error: cannot set multiple action managers") +// registerLegacyAction wraps a legacy CustomActionManager action as an ActionHandler and registers it. +func registerLegacyAction(ctx context.Context, registry actions.ActionRegistry, schema *v2.BatonActionSchema, legacyManager CustomActionManager) error { + handler := func(ctx context.Context, args *structpb.Struct) (*structpb.Struct, annotations.Annotations, error) { + _, _, resp, annos, err := legacyManager.InvokeAction(ctx, schema.GetName(), "", args) + return resp, annos, err + } + return registry.Register(ctx, schema, handler) +} + +// addActionManager handles deprecated CustomActionManager and RegisterActionManagerLimited interfaces +// by extracting their actions and registering them into the unified ActionManager. +func (b *builder) addActionManager(ctx context.Context, in interface{}, registry actions.ActionRegistry) error { + // Handle deprecated CustomActionManager - extract and re-register actions + if customManager, ok := in.(CustomActionManager); ok { + schemas, _, err := customManager.ListActionSchemas(ctx, "") + if err != nil { + return fmt.Errorf("error listing schemas from custom action manager: %w", err) + } + for _, schema := range schemas { + if err := registerLegacyAction(ctx, registry, schema, customManager); err != nil { + return fmt.Errorf("error registering legacy action %s: %w", schema.GetName(), err) + } } - b.actionManager = actionManager + return nil } - if registerActionManager, ok := in.(RegisterActionManagerLimited); ok { - if b.actionManager != nil { - return fmt.Errorf("error: cannot register multiple action managers") + // Handle deprecated RegisterActionManagerLimited + if registerManager, ok := in.(RegisterActionManagerLimited); ok { + customManager, err := registerManager.RegisterActionManager(ctx) + if err != nil { + return fmt.Errorf("error registering action manager: %w", err) + } + if customManager == nil { + return nil // No action manager provided } - actionManager, err := registerActionManager.RegisterActionManager(ctx) + schemas, _, err := customManager.ListActionSchemas(ctx, "") if err != nil { - return fmt.Errorf("error: registering action manager failed: %w", err) + return fmt.Errorf("error listing schemas from custom action manager: %w", err) } - if actionManager == nil { - return fmt.Errorf("error: action manager is nil") + for _, schema := range schemas { + if err := registerLegacyAction(ctx, registry, schema, customManager); err != nil { + return fmt.Errorf("error registering legacy action %s: %w", schema.GetName(), err) + } } - b.actionManager = actionManager } return nil } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/connectorbuilder.go b/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/connectorbuilder.go index 98a679df..e5fc4f9b 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/connectorbuilder.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/connectorbuilder.go @@ -16,6 +16,7 @@ import ( "google.golang.org/grpc/status" v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" + "github.com/conductorone/baton-sdk/pkg/actions" "github.com/conductorone/baton-sdk/pkg/annotations" "github.com/conductorone/baton-sdk/pkg/crypto" "github.com/conductorone/baton-sdk/pkg/metrics" @@ -67,8 +68,6 @@ type builder struct { metadataProvider MetadataProvider validateProvider ValidateProvider ticketManager TicketManagerLimited - accountManager AccountManagerLimited - actionManager CustomActionManager resourceSyncers map[string]ResourceSyncerV2 resourceProvisioners map[string]ResourceProvisionerV2Limited resourceManagers map[string]ResourceManagerV2Limited @@ -76,7 +75,8 @@ type builder struct { resourceTargetedSyncers map[string]ResourceTargetedSyncerLimited credentialManagers map[string]CredentialManagerLimited eventFeeds map[string]EventFeed - accountManagers map[string]AccountManagerLimited // NOTE(kans): currently unused + accountManagers map[string]AccountManagerLimited + actionManager ActionManager // Unified action manager for all actions } // NewConnector creates a new ConnectorServer for a new resource. @@ -97,12 +97,13 @@ func NewConnector(ctx context.Context, in interface{}, opts ...Opt) (types.Conne clientSecretValue := ctx.Value(crypto.ContextClientSecretKey) clientSecretJWK, _ := clientSecretValue.(*jose.JSONWebKey) + // Create the action manager (concrete type for registration, stored as interface for dispatch) + actionMgr := actions.NewActionManager(ctx) + b := &builder{ metadataProvider: nil, validateProvider: nil, ticketManager: nil, - accountManager: nil, - actionManager: nil, nowFunc: time.Now, clientSecret: clientSecretJWK, resourceSyncers: make(map[string]ResourceSyncerV2), @@ -113,6 +114,7 @@ func NewConnector(ctx context.Context, in interface{}, opts ...Opt) (types.Conne credentialManagers: make(map[string]CredentialManagerLimited), eventFeeds: make(map[string]EventFeed), accountManagers: make(map[string]AccountManagerLimited), + actionManager: actionMgr, } // WithTicketingEnabled checks for the ticketManager @@ -137,10 +139,18 @@ func NewConnector(ctx context.Context, in interface{}, opts ...Opt) (types.Conne return nil, err } - if err := b.addActionManager(ctx, in); err != nil { + // Handle deprecated action manager interfaces (pass concrete type for registration) + if err := b.addActionManager(ctx, in, actionMgr); err != nil { return nil, err } + // Handle the new GlobalActionProvider interface + if globalActionProvider, ok := in.(GlobalActionProvider); ok { + if err := globalActionProvider.GlobalActions(ctx, actionMgr); err != nil { + return nil, fmt.Errorf("error registering global actions: %w", err) + } + } + addResourceType := func(ctx context.Context, rType string, rs interface{}) error { if err := b.addResourceSyncers(ctx, rType, rs); err != nil { return err @@ -253,13 +263,13 @@ func (b *builder) GetMetadata(ctx context.Context, request *v2.ConnectorServiceG tt := tasks.GetMetadataType md, err := b.metadataProvider.Metadata(ctx) if err != nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, err } - md.Capabilities, err = b.getCapabilities(ctx) + md.Capabilities, err = b.GetCapabilities(ctx) if err != nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, err } @@ -322,8 +332,8 @@ func (b *builder) Cleanup(ctx context.Context, request *v2.ConnectorServiceClean return resp, err } -// getCapabilities gets all capabilities for a connector. -func (b *builder) getCapabilities(ctx context.Context) (*v2.ConnectorCapabilities, error) { +// GetCapabilities gets all capabilities for a connector. +func (b *builder) GetCapabilities(ctx context.Context) (*v2.ConnectorCapabilities, error) { connectorCaps := make(map[v2.Capability]struct{}) resourceTypeCapabilities := []*v2.ResourceTypeCapability{} @@ -333,6 +343,7 @@ func (b *builder) getCapabilities(ctx context.Context) (*v2.ConnectorCapabilitie if _, exists := b.resourceTargetedSyncers[resourceTypeID]; exists { caps = append(caps, v2.Capability_CAPABILITY_TARGETED_SYNC) + connectorCaps[v2.Capability_CAPABILITY_SERVICE_MODE_TARGETED_SYNC] = struct{}{} } if _, exists := b.resourceProvisioners[resourceTypeID]; exists { @@ -374,7 +385,7 @@ func (b *builder) getCapabilities(ctx context.Context) (*v2.ConnectorCapabilitie } // Check for account provisioning capability (global, not per resource type) - if b.accountManager != nil { + if len(b.accountManagers) > 0 { connectorCaps[v2.Capability_CAPABILITY_ACCOUNT_PROVISIONING] = struct{}{} } sort.Slice(resourceTypeCapabilities, func(i, j int) bool { @@ -389,7 +400,7 @@ func (b *builder) getCapabilities(ctx context.Context) (*v2.ConnectorCapabilitie connectorCaps[v2.Capability_CAPABILITY_TICKETING] = struct{}{} } - if b.actionManager != nil { + if b.actionManager.HasActions() { connectorCaps[v2.Capability_CAPABILITY_ACTIONS] = struct{}{} } @@ -440,13 +451,14 @@ func getCredentialDetails(ctx context.Context, b *builder) (*v2.CredentialDetail rv := &v2.CredentialDetails{} // Check for account provisioning capability details - if b.accountManager != nil { - accountProvisioningCapabilityDetails, _, err := b.accountManager.CreateAccountCapabilityDetails(ctx) + for _, am := range b.accountManagers { + accountProvisioningCapabilityDetails, _, err := am.CreateAccountCapabilityDetails(ctx) if err != nil { l.Error("error: getting account provisioning details", zap.Error(err)) return nil, fmt.Errorf("error: getting account provisioning details: %w", err) } rv.SetCapabilityAccountProvisioning(accountProvisioningCapabilityDetails) + break // Only need one account manager's details } // Check for credential rotation capability details diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/credentials.go b/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/credentials.go index 4f303e94..ad8ea9af 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/credentials.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/credentials.go @@ -47,28 +47,29 @@ func (b *builder) RotateCredential(ctx context.Context, request *v2.RotateCreden manager, ok := b.credentialManagers[rt] if !ok { l.Error("error: resource type does not have credential manager configured", zap.String("resource_type", rt)) - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, status.Error(codes.Unimplemented, "resource type does not have credential manager configured") + err := status.Error(codes.Unimplemented, "resource type does not have credential manager configured") + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } opts, err := crypto.ConvertCredentialOptions(ctx, b.clientSecret, request.GetCredentialOptions(), request.GetEncryptionConfigs()) if err != nil { l.Error("error: converting credential options failed", zap.Error(err)) - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, fmt.Errorf("error: converting credential options failed: %w", err) } plaintexts, annos, err := manager.Rotate(ctx, request.GetResourceId(), opts) if err != nil { l.Error("error: rotate credentials on resource failed", zap.Error(err)) - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, fmt.Errorf("error: rotate credentials on resource failed: %w", err) } pkem, err := crypto.NewEncryptionManager(request.GetCredentialOptions(), request.GetEncryptionConfigs()) if err != nil { l.Error("error: creating encryption manager failed", zap.Error(err)) - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, fmt.Errorf("error: creating encryption manager failed: %w", err) } @@ -76,7 +77,7 @@ func (b *builder) RotateCredential(ctx context.Context, request *v2.RotateCreden for _, plaintextCredential := range plaintexts { encryptedData, err := pkem.Encrypt(ctx, plaintextCredential) if err != nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, err } encryptedDatas = append(encryptedDatas, encryptedData...) diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/events.go b/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/events.go index c6bf352f..7b5bc745 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/events.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/events.go @@ -122,7 +122,7 @@ func (b *builder) ListEvents(ctx context.Context, request *v2.ListEventsRequest) Cursor: request.GetCursor(), }) if err != nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, fmt.Errorf("error: listing events failed: %w", err) } b.m.RecordTaskSuccess(ctx, tt, b.nowFunc().Sub(start)) diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/resource_manager.go b/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/resource_manager.go index 4c47e653..e9ebbb7f 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/resource_manager.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/resource_manager.go @@ -82,13 +82,14 @@ func (b *builder) CreateResource(ctx context.Context, request *v2.CreateResource manager, ok := b.resourceManagers[rt] if !ok { l.Error("error: resource type does not have resource Create() configured", zap.String("resource_type", rt)) - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, status.Error(codes.Unimplemented, fmt.Sprintf("resource type %s does not have resource Create() configured", rt)) + err := status.Error(codes.Unimplemented, fmt.Sprintf("resource type %s does not have resource Create() configured", rt)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } resource, annos, err := manager.Create(ctx, request.GetResource()) if err != nil { l.Error("error: create resource failed", zap.Error(err)) - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, fmt.Errorf("error: create resource failed: %w", err) } b.m.RecordTaskSuccess(ctx, tt, b.nowFunc().Sub(start)) @@ -114,14 +115,15 @@ func (b *builder) DeleteResource(ctx context.Context, request *v2.DeleteResource if !ok { l.Error("error: resource type does not have resource Delete() configured", zap.String("resource_type", rt)) - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, status.Error(codes.Unimplemented, fmt.Sprintf("resource type %s does not have resource Delete() configured", rt)) + err := status.Error(codes.Unimplemented, fmt.Sprintf("resource type %s does not have resource Delete() configured", rt)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } annos, err := rsDeleter.Delete(ctx, request.GetResourceId(), request.GetParentResourceId()) if err != nil { l.Error("error: deleteV2 resource failed", zap.Error(err)) - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, fmt.Errorf("error: delete resource failed: %w", err) } b.m.RecordTaskSuccess(ctx, tt, b.nowFunc().Sub(start)) @@ -147,14 +149,15 @@ func (b *builder) DeleteResourceV2(ctx context.Context, request *v2.DeleteResour if !ok { l.Error("error: resource type does not have resource Delete() configured", zap.String("resource_type", rt)) - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, status.Error(codes.Unimplemented, fmt.Sprintf("resource type %s does not have resource Delete() configured", rt)) + err := status.Error(codes.Unimplemented, fmt.Sprintf("resource type %s does not have resource Delete() configured", rt)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } annos, err := rsDeleter.Delete(ctx, request.GetResourceId(), request.GetParentResourceId()) if err != nil { l.Error("error: deleteV2 resource failed", zap.Error(err)) - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, fmt.Errorf("error: delete resource failed: %w", err) } b.m.RecordTaskSuccess(ctx, tt, b.nowFunc().Sub(start)) diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/resource_provisioner.go b/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/resource_provisioner.go index d0f8cf2e..6f09907d 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/resource_provisioner.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/resource_provisioner.go @@ -11,6 +11,8 @@ import ( "github.com/conductorone/baton-sdk/pkg/types/tasks" "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" "go.uber.org/zap" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) // ResourceProvisioner extends ResourceSyncer to add capabilities for granting and revoking access. @@ -44,7 +46,7 @@ type GrantProvisioner interface { // This is the recommended interface for implementing provisioning operations in new connectors. // It differs from ResourceProvisioner by returning a list of grants from the Grant method. type ResourceProvisionerV2 interface { - ResourceSyncer + ResourceSyncerV2 ResourceProvisionerV2Limited } @@ -71,8 +73,9 @@ func (b *builder) Grant(ctx context.Context, request *v2.GrantManagerServiceGran if !ok { l.Error("error: resource type does not have provisioner configured", zap.String("resource_type", rt)) - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: resource type does not have provisioner configured") + err := status.Errorf(codes.Unimplemented, "resource type %s does not have provisioner configured", rt) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } retryer := retry.NewRetryer(ctx, retry.RetryConfig{ @@ -90,7 +93,7 @@ func (b *builder) Grant(ctx context.Context, request *v2.GrantManagerServiceGran if retryer.ShouldWaitAndRetry(ctx, err) { continue } - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, fmt.Errorf("grant failed: %w", err) } } @@ -114,8 +117,9 @@ func (b *builder) Revoke(ctx context.Context, request *v2.GrantManagerServiceRev if revokeProvisioner == nil { l.Error("error: resource type does not have provisioner configured", zap.String("resource_type", rt)) - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: resource type does not have provisioner configured") + err := status.Errorf(codes.Unimplemented, "resource type %s does not have provisioner configured", rt) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } retryer := retry.NewRetryer(ctx, retry.RetryConfig{ @@ -133,7 +137,7 @@ func (b *builder) Revoke(ctx context.Context, request *v2.GrantManagerServiceRev if retryer.ShouldWaitAndRetry(ctx, err) { continue } - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, fmt.Errorf("revoke failed: %w", err) } } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/resource_syncer.go b/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/resource_syncer.go index bd95f56f..4378730f 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/resource_syncer.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/resource_syncer.go @@ -89,8 +89,9 @@ func (b *builder) ListResourceTypes( var out []*v2.ResourceType if len(b.resourceSyncers) == 0 { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: no resource builders found") + err := status.Error(codes.FailedPrecondition, "no resource builders found") + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } for _, rb := range b.resourceSyncers { @@ -98,8 +99,9 @@ func (b *builder) ListResourceTypes( } if len(out) == 0 { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: no resource types found") + err := status.Error(codes.FailedPrecondition, "no resource types found") + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } b.m.RecordTaskSuccess(ctx, tt, b.nowFunc().Sub(start)) @@ -115,8 +117,9 @@ func (b *builder) ListResources(ctx context.Context, request *v2.ResourcesServic tt := tasks.ListResourcesType rb, ok := b.resourceSyncers[request.GetResourceTypeId()] if !ok { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: list resources with unknown resource type %s", request.GetResourceTypeId()) + err := fmt.Errorf("error: list resources with unknown resource type %s", request.GetResourceTypeId()) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } token := pagination.Token{ @@ -135,14 +138,15 @@ func (b *builder) ListResources(ctx context.Context, request *v2.ResourcesServic Annotations: retOptions.Annotations, }.Build() if err != nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return resp, fmt.Errorf("error: listing resources failed: %w", err) } if request.GetPageToken() != "" && request.GetPageToken() == retOptions.NextPageToken { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - errMsg := fmt.Sprintf(" with page token %s resource type id %s and resource parent id: %s this is most likely a connector bug", + err := status.Errorf(codes.Internal, + "listing resources failed: next page token unchanged (token=%s, type=%s, parent=%s) - likely a connector bug", request.GetPageToken(), request.GetResourceTypeId(), request.GetParentResourceId()) - return resp, fmt.Errorf("error: listing resources failed: next page token is the same as the current page token %s", errMsg) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return resp, err } b.m.RecordTaskSuccess(ctx, tt, b.nowFunc().Sub(start)) @@ -158,17 +162,19 @@ func (b *builder) GetResource(ctx context.Context, request *v2.ResourceGetterSer resourceType := request.GetResourceId().GetResourceType() rb, ok := b.resourceTargetedSyncers[resourceType] if !ok { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, status.Errorf(codes.Unimplemented, "error: get resource with unknown resource type %s", resourceType) + err := status.Errorf(codes.Unimplemented, "error: get resource with unknown resource type %s", resourceType) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } resource, annos, err := rb.Get(ctx, request.GetResourceId(), request.GetParentResourceId()) if err != nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, fmt.Errorf("error: get resource failed: %w", err) } if resource == nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, status.Error(codes.NotFound, "error: get resource returned nil") + err := status.Error(codes.NotFound, "error: get resource returned nil") + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } b.m.RecordTaskSuccess(ctx, tt, b.nowFunc().Sub(start)) @@ -188,8 +194,9 @@ func (b *builder) ListStaticEntitlements(ctx context.Context, request *v2.Entitl tt := tasks.ListStaticEntitlementsType rb, ok := b.resourceSyncers[request.GetResourceTypeId()] if !ok { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: list static entitlements with unknown resource type %s", request.GetResourceTypeId()) + err := fmt.Errorf("error: list static entitlements with unknown resource type %s", request.GetResourceTypeId()) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } rbse, ok := rb.(StaticEntitlementSyncerV2) if !ok { @@ -217,12 +224,13 @@ func (b *builder) ListStaticEntitlements(ctx context.Context, request *v2.Entitl Annotations: retOptions.Annotations, }.Build() if err != nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, fmt.Errorf("error: listing static entitlements failed: %w", err) } if request.GetPageToken() != "" && request.GetPageToken() == retOptions.NextPageToken { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return resp, fmt.Errorf("error: listing static entitlements failed: next page token is the same as the current page token. this is most likely a connector bug") + err := status.Error(codes.Internal, "listing static entitlements failed: next page token unchanged - likely a connector bug") + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return resp, err } b.m.RecordTaskSuccess(ctx, tt, b.nowFunc().Sub(start)) @@ -238,8 +246,9 @@ func (b *builder) ListEntitlements(ctx context.Context, request *v2.Entitlements tt := tasks.ListEntitlementsType rb, ok := b.resourceSyncers[request.GetResource().GetId().GetResourceType()] if !ok { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: list entitlements with unknown resource type %s", request.GetResource().GetId().GetResourceType()) + err := fmt.Errorf("error: list entitlements with unknown resource type %s", request.GetResource().GetId().GetResourceType()) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } token := pagination.Token{ Size: int(request.GetPageSize()), @@ -257,12 +266,13 @@ func (b *builder) ListEntitlements(ctx context.Context, request *v2.Entitlements Annotations: retOptions.Annotations, }.Build() if err != nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return resp, fmt.Errorf("error: listing entitlements failed: %w", err) } if request.GetPageToken() != "" && request.GetPageToken() == retOptions.NextPageToken { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return resp, fmt.Errorf("error: listing entitlements failed: next page token is the same as the current page token. this is most likely a connector bug") + err := status.Error(codes.Internal, "listing entitlements failed: next page token unchanged - likely a connector bug") + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return resp, err } b.m.RecordTaskSuccess(ctx, tt, b.nowFunc().Sub(start)) @@ -279,8 +289,9 @@ func (b *builder) ListGrants(ctx context.Context, request *v2.GrantsServiceListG rid := request.GetResource().GetId() rb, ok := b.resourceSyncers[rid.GetResourceType()] if !ok { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: list grants with unknown resource type %s", rid.GetResourceType()) + err := fmt.Errorf("error: list grants with unknown resource type %s", rid.GetResourceType()) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } token := pagination.Token{ @@ -300,14 +311,15 @@ func (b *builder) ListGrants(ctx context.Context, request *v2.GrantsServiceListG }.Build() if err != nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return resp, fmt.Errorf("error: listing grants for resource %s/%s failed: %w", rid.GetResourceType(), rid.GetResource(), err) } if request.GetPageToken() != "" && request.GetPageToken() == retOptions.NextPageToken { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return resp, fmt.Errorf("error: listing grants for resource %s/%s failed: next page token is the same as the current page token. this is most likely a connector bug", - rid.GetResourceType(), - rid.GetResource()) + err := status.Errorf(codes.Internal, + "listing grants for resource %s/%s failed: next page token unchanged - likely a connector bug", + rid.GetResourceType(), rid.GetResource()) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return resp, err } b.m.RecordTaskSuccess(ctx, tt, b.nowFunc().Sub(start)) @@ -368,7 +380,7 @@ func (b *builder) addTargetedSyncer(_ context.Context, typeId string, in any) er return nil } -func (b *builder) addResourceSyncers(_ context.Context, typeId string, in any) error { +func (b *builder) addResourceSyncers(ctx context.Context, typeId string, in any) error { // no duplicates if _, ok := b.resourceSyncers[typeId]; ok { return fmt.Errorf("error: duplicate resource type found for resource builder %s", typeId) @@ -387,5 +399,17 @@ func (b *builder) addResourceSyncers(_ context.Context, typeId string, in any) e return fmt.Errorf("error: the resource syncer interface must be implemented for all types (%s)", typeId) } + // Check for resource actions + if actionProvider, ok := in.(ResourceActionProvider); ok { + registry, err := b.actionManager.GetTypeRegistry(ctx, typeId) + if err != nil { + return fmt.Errorf("error getting resource type action registry for %s: %w", typeId, err) + } + err = actionProvider.ResourceActions(ctx, registry) + if err != nil { + return fmt.Errorf("error getting resource actions for %s: %w", typeId, err) + } + } + return nil } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/session_store.go b/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/session_store.go index 1bf097b0..0362404d 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/session_store.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/session_store.go @@ -27,7 +27,7 @@ func (w *SessionStoreWithSyncID) Get(ctx context.Context, key string, opt ...ses return w.ss.Get(ctx, key, opts...) } -func (w *SessionStoreWithSyncID) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string][]byte, error) { +func (w *SessionStoreWithSyncID) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string][]byte, []string, error) { opts := append([]sessions.SessionStoreOption{sessions.WithSyncID(w.syncID)}, opt...) return w.ss.GetMany(ctx, keys, opts...) } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/tickets.go b/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/tickets.go index 740cc3c5..e1ea8bf5 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/tickets.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/tickets.go @@ -10,6 +10,8 @@ import ( "github.com/conductorone/baton-sdk/pkg/pagination" "github.com/conductorone/baton-sdk/pkg/retry" "github.com/conductorone/baton-sdk/pkg/types/tasks" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) // TicketManager extends ConnectorBuilder to add capabilities for ticket management. @@ -37,19 +39,21 @@ func (b *builder) BulkCreateTickets(ctx context.Context, request *v2.TicketsServ start := b.nowFunc() tt := tasks.BulkCreateTicketsType if b.ticketManager == nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: ticket manager not implemented") + err := status.Error(codes.Unimplemented, "ticket manager not implemented") + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } reqBody := request.GetTicketRequests() if len(reqBody) == 0 { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: request body had no items") + err := status.Error(codes.InvalidArgument, "request body had no items") + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } ticketsResponse, err := b.ticketManager.BulkCreateTickets(ctx, request) if err != nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, fmt.Errorf("error: creating tickets failed: %w", err) } @@ -66,19 +70,21 @@ func (b *builder) BulkGetTickets(ctx context.Context, request *v2.TicketsService start := b.nowFunc() tt := tasks.BulkGetTicketsType if b.ticketManager == nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: ticket manager not implemented") + err := status.Error(codes.Unimplemented, "ticket manager not implemented") + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } reqBody := request.GetTicketRequests() if len(reqBody) == 0 { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: request body had no items") + err := status.Error(codes.InvalidArgument, "request body had no items") + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } ticketsResponse, err := b.ticketManager.BulkGetTickets(ctx, request) if err != nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, fmt.Errorf("error: fetching tickets failed: %w", err) } @@ -95,8 +101,9 @@ func (b *builder) ListTicketSchemas(ctx context.Context, request *v2.TicketsServ start := b.nowFunc() tt := tasks.ListTicketSchemasType if b.ticketManager == nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: ticket manager not implemented") + err := status.Error(codes.Unimplemented, "ticket manager not implemented") + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } retryer := retry.NewRetryer(ctx, retry.RetryConfig{ @@ -112,8 +119,9 @@ func (b *builder) ListTicketSchemas(ctx context.Context, request *v2.TicketsServ }) if err == nil { if request.GetPageToken() != "" && request.GetPageToken() == nextPageToken { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: listing ticket schemas failed: next page token is the same as the current page token. this is most likely a connector bug") + err := status.Error(codes.Internal, "listing ticket schemas failed: next page token unchanged - likely a connector bug") + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } b.m.RecordTaskSuccess(ctx, tt, b.nowFunc().Sub(start)) @@ -126,7 +134,7 @@ func (b *builder) ListTicketSchemas(ctx context.Context, request *v2.TicketsServ if retryer.ShouldWaitAndRetry(ctx, err) { continue } - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, fmt.Errorf("error: listing ticket schemas failed: %w", err) } } @@ -138,14 +146,16 @@ func (b *builder) CreateTicket(ctx context.Context, request *v2.TicketsServiceCr start := b.nowFunc() tt := tasks.CreateTicketType if b.ticketManager == nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: ticket manager not implemented") + err := status.Error(codes.Unimplemented, "ticket manager not implemented") + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } reqBody := request.GetRequest() if reqBody == nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: request body is nil") + err := status.Error(codes.InvalidArgument, "request body is nil") + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } cTicket := v2.Ticket_builder{ DisplayName: reqBody.GetDisplayName(), @@ -159,7 +169,7 @@ func (b *builder) CreateTicket(ctx context.Context, request *v2.TicketsServiceCr ticket, annos, err := b.ticketManager.CreateTicket(ctx, cTicket, request.GetSchema()) var resp *v2.TicketsServiceCreateTicketResponse if err != nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) if ticket != nil { resp = v2.TicketsServiceCreateTicketResponse_builder{ Ticket: ticket, @@ -183,14 +193,15 @@ func (b *builder) GetTicket(ctx context.Context, request *v2.TicketsServiceGetTi start := b.nowFunc() tt := tasks.GetTicketType if b.ticketManager == nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: ticket manager not implemented") + err := status.Error(codes.Unimplemented, "ticket manager not implemented") + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } var resp *v2.TicketsServiceGetTicketResponse ticket, annos, err := b.ticketManager.GetTicket(ctx, request.GetId()) if err != nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) if ticket != nil { resp = v2.TicketsServiceGetTicketResponse_builder{ Ticket: ticket, @@ -214,13 +225,14 @@ func (b *builder) GetTicketSchema(ctx context.Context, request *v2.TicketsServic start := b.nowFunc() tt := tasks.GetTicketSchemaType if b.ticketManager == nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) - return nil, fmt.Errorf("error: ticket manager not implemented") + err := status.Error(codes.Unimplemented, "ticket manager not implemented") + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) + return nil, err } ticketSchema, annos, err := b.ticketManager.GetTicketSchema(ctx, request.GetId()) if err != nil { - b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start)) + b.m.RecordTaskFailure(ctx, tt, b.nowFunc().Sub(start), err) return nil, fmt.Errorf("error: getting ticket metadata failed: %w", err) } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/connectorrunner/runner.go b/vendor/github.com/conductorone/baton-sdk/pkg/connectorrunner/runner.go index 1f394597..2690bcdb 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/connectorrunner/runner.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/connectorrunner/runner.go @@ -10,6 +10,9 @@ import ( "strings" "time" + "github.com/conductorone/baton-sdk/pkg/bid" + "github.com/conductorone/baton-sdk/pkg/connectorbuilder" + "github.com/conductorone/baton-sdk/pkg/healthcheck" "github.com/conductorone/baton-sdk/pkg/synccompactor" "golang.org/x/sync/semaphore" "google.golang.org/protobuf/types/known/structpb" @@ -19,6 +22,7 @@ import ( "go.uber.org/zap/zapcore" "google.golang.org/protobuf/types/known/durationpb" + v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" v1 "github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1" ratelimitV1 "github.com/conductorone/baton-sdk/pb/c1/ratelimit/v1" "github.com/conductorone/baton-sdk/pkg/tasks" @@ -35,10 +39,11 @@ const ( ) type connectorRunner struct { - cw types.ClientWrapper - oneShot bool - tasks tasks.Manager - debugFile *os.File + cw types.ClientWrapper + oneShot bool + tasks tasks.Manager + debugFile *os.File + healthServer *healthcheck.Server } var ErrSigTerm = errors.New("context cancelled by process shutdown") @@ -237,6 +242,14 @@ func (c *connectorRunner) run(ctx context.Context) error { func (c *connectorRunner) Close(ctx context.Context) error { var retErr error + // Stop health check server if running + if c.healthServer != nil { + if err := c.healthServer.Stop(ctx); err != nil { + retErr = errors.Join(retErr, err) + } + c.healthServer = nil + } + if err := c.cw.Close(); err != nil { retErr = errors.Join(retErr, err) } @@ -278,14 +291,20 @@ type revokeConfig struct { } type createAccountConfig struct { - login string - email string - profile *structpb.Struct + login string + email string + profile *structpb.Struct + resourceTypeID string // Optional: if set, creates an account for the specified resource type. } type invokeActionConfig struct { - action string - args *structpb.Struct + action string + resourceTypeID string // Optional: if set, invokes a resource-scoped action + args *structpb.Struct +} + +type listActionSchemasConfig struct { + resourceTypeID string // Optional: filter by resource type } type deleteResourceConfig struct { @@ -316,38 +335,44 @@ type syncCompactorConfig struct { } type runnerConfig struct { - rlCfg *ratelimitV1.RateLimiterConfig - rlDescriptors []*ratelimitV1.RateLimitDescriptors_Entry - onDemand bool - c1zPath string - clientAuth bool - clientID string - clientSecret string - provisioningEnabled bool - ticketingEnabled bool - actionsEnabled bool - grantConfig *grantConfig - revokeConfig *revokeConfig - eventFeedConfig *eventStreamConfig - tempDir string - createAccountConfig *createAccountConfig - invokeActionConfig *invokeActionConfig - deleteResourceConfig *deleteResourceConfig - rotateCredentialsConfig *rotateCredentialsConfig - createTicketConfig *createTicketConfig - bulkCreateTicketConfig *bulkCreateTicketConfig - listTicketSchemasConfig *listTicketSchemasConfig - getTicketConfig *getTicketConfig - syncDifferConfig *syncDifferConfig - syncCompactorConfig *syncCompactorConfig - skipFullSync bool - targetedSyncResourceIDs []string - externalResourceC1Z string - externalResourceEntitlementIdFilter string - skipEntitlementsAndGrants bool - skipGrants bool - sessionStoreEnabled bool - syncResourceTypeIDs []string + rlCfg *ratelimitV1.RateLimiterConfig + rlDescriptors []*ratelimitV1.RateLimitDescriptors_Entry + onDemand bool + c1zPath string + clientAuth bool + clientID string + clientSecret string + provisioningEnabled bool + ticketingEnabled bool + actionsEnabled bool + grantConfig *grantConfig + revokeConfig *revokeConfig + eventFeedConfig *eventStreamConfig + tempDir string + createAccountConfig *createAccountConfig + invokeActionConfig *invokeActionConfig + listActionSchemasConfig *listActionSchemasConfig + deleteResourceConfig *deleteResourceConfig + rotateCredentialsConfig *rotateCredentialsConfig + createTicketConfig *createTicketConfig + bulkCreateTicketConfig *bulkCreateTicketConfig + listTicketSchemasConfig *listTicketSchemasConfig + getTicketConfig *getTicketConfig + syncDifferConfig *syncDifferConfig + syncCompactorConfig *syncCompactorConfig + skipFullSync bool + targetedSyncResourceIDs []string + externalResourceC1Z string + externalResourceEntitlementIdFilter string + skipEntitlementsAndGrants bool + skipGrants bool + sessionStoreEnabled bool + syncResourceTypeIDs []string + defaultCapabilitiesConnectorBuilder connectorbuilder.ConnectorBuilder + defaultCapabilitiesConnectorBuilderV2 connectorbuilder.ConnectorBuilderV2 + healthCheckEnabled bool + healthCheckPort int + healthCheckBindAddress string } func WithSessionStoreEnabled() Option { @@ -462,26 +487,43 @@ func WithOnDemandRevoke(c1zPath string, grantID string) Option { } } -func WithOnDemandCreateAccount(c1zPath string, login string, email string, profile *structpb.Struct) Option { +func WithOnDemandCreateAccount(c1zPath string, login string, email string, profile *structpb.Struct, resourceTypeId string) Option { return func(ctx context.Context, cfg *runnerConfig) error { cfg.onDemand = true cfg.c1zPath = c1zPath cfg.createAccountConfig = &createAccountConfig{ - login: login, - email: email, - profile: profile, + login: login, + email: email, + profile: profile, + resourceTypeID: resourceTypeId, } return nil } } -func WithOnDemandInvokeAction(c1zPath string, action string, args *structpb.Struct) Option { +// WithOnDemandInvokeAction creates an option for invoking an action. +// If resourceTypeID is provided, it invokes a resource-scoped action. +func WithOnDemandInvokeAction(c1zPath string, action string, resourceTypeID string, args *structpb.Struct) Option { return func(ctx context.Context, cfg *runnerConfig) error { cfg.onDemand = true cfg.c1zPath = c1zPath cfg.invokeActionConfig = &invokeActionConfig{ - action: action, - args: args, + action: action, + resourceTypeID: resourceTypeID, + args: args, + } + return nil + } +} + +// WithOnDemandListActionSchemas creates an option for listing action schemas. +// If resourceTypeID is provided, it filters schemas for that specific resource type. +func WithOnDemandListActionSchemas(c1zPath string, resourceTypeID string) Option { + return func(ctx context.Context, cfg *runnerConfig) error { + cfg.onDemand = true + cfg.c1zPath = c1zPath + cfg.listActionSchemasConfig = &listActionSchemasConfig{ + resourceTypeID: resourceTypeID, } return nil } @@ -552,7 +594,7 @@ func WithFullSyncDisabled() Option { } } -func WithTargetedSyncResourceIDs(resourceIDs []string) Option { +func WithTargetedSyncResources(resourceIDs []string) Option { return func(ctx context.Context, cfg *runnerConfig) error { cfg.targetedSyncResourceIDs = resourceIDs return nil @@ -675,6 +717,55 @@ func WithSkipGrants(skip bool) Option { } } +// WithDefaultCapabilitiesConnectorBuilder sets the default connector builder for the runner +// This is used by the "capabilities" sub-command to instantiate the connector. +func WithDefaultCapabilitiesConnectorBuilder(t connectorbuilder.ConnectorBuilder) Option { + return func(ctx context.Context, cfg *runnerConfig) error { + cfg.defaultCapabilitiesConnectorBuilder = t + return nil + } +} + +// WithDefaultCapabilitiesConnectorBuilderV2 sets the default connector builder for the runner +// This is used by the "capabilities" sub-command to instantiate the connector. +func WithDefaultCapabilitiesConnectorBuilderV2(t connectorbuilder.ConnectorBuilderV2) Option { + return func(ctx context.Context, cfg *runnerConfig) error { + cfg.defaultCapabilitiesConnectorBuilderV2 = t + return nil + } +} + +// WithHealthCheck enables the HTTP health check server. +func WithHealthCheck(enabled bool, port int, bindAddress string) Option { + return func(ctx context.Context, cfg *runnerConfig) error { + cfg.healthCheckEnabled = enabled + cfg.healthCheckPort = port + cfg.healthCheckBindAddress = bindAddress + return nil + } +} + +func ExtractDefaultConnector(ctx context.Context, options ...Option) (any, error) { + cfg := &runnerConfig{} + + for _, o := range options { + err := o(ctx, cfg) + if err != nil { + return nil, err + } + } + + if cfg.defaultCapabilitiesConnectorBuilder != nil { + return cfg.defaultCapabilitiesConnectorBuilder, nil + } + + if cfg.defaultCapabilitiesConnectorBuilderV2 != nil { + return cfg.defaultCapabilitiesConnectorBuilderV2, nil + } + + return nil, nil +} + func IsSessionStoreEnabled(ctx context.Context, options ...Option) (bool, error) { cfg := &runnerConfig{} @@ -720,7 +811,7 @@ func NewConnectorRunner(ctx context.Context, c types.ConnectorServer, opts ...Op } if len(cfg.targetedSyncResourceIDs) > 0 { - wrapperOpts = append(wrapperOpts, connector.WithTargetedSyncResourceIDs(cfg.targetedSyncResourceIDs)) + wrapperOpts = append(wrapperOpts, connector.WithTargetedSyncResources(cfg.targetedSyncResourceIDs)) } if cfg.sessionStoreEnabled { @@ -736,10 +827,25 @@ func NewConnectorRunner(ctx context.Context, c types.ConnectorServer, opts ...Op return nil, err } + resources := make([]*v2.Resource, 0, len(cfg.targetedSyncResourceIDs)) + for _, resourceId := range cfg.targetedSyncResourceIDs { + r, err := bid.ParseResourceBid(resourceId) + if err != nil { + return nil, err + } + resources = append(resources, r) + } + runner.cw = cw if cfg.onDemand { - if cfg.c1zPath == "" && cfg.eventFeedConfig == nil && cfg.createTicketConfig == nil && cfg.listTicketSchemasConfig == nil && cfg.getTicketConfig == nil && cfg.bulkCreateTicketConfig == nil { + if cfg.c1zPath == "" && + cfg.eventFeedConfig == nil && + cfg.createTicketConfig == nil && + cfg.listTicketSchemasConfig == nil && + cfg.getTicketConfig == nil && + cfg.bulkCreateTicketConfig == nil && + cfg.listActionSchemasConfig == nil { return nil, errors.New("c1zPath must be set when in on-demand mode") } @@ -758,10 +864,13 @@ func NewConnectorRunner(ctx context.Context, c types.ConnectorServer, opts ...Op tm = local.NewRevoker(ctx, cfg.c1zPath, cfg.revokeConfig.grantID) case cfg.createAccountConfig != nil: - tm = local.NewCreateAccountManager(ctx, cfg.c1zPath, cfg.createAccountConfig.login, cfg.createAccountConfig.email, cfg.createAccountConfig.profile) + tm = local.NewCreateAccountManager(ctx, cfg.c1zPath, cfg.createAccountConfig.login, cfg.createAccountConfig.email, cfg.createAccountConfig.profile, cfg.createAccountConfig.resourceTypeID) case cfg.invokeActionConfig != nil: - tm = local.NewActionInvoker(ctx, cfg.c1zPath, cfg.invokeActionConfig.action, cfg.invokeActionConfig.args) + tm = local.NewActionInvoker(ctx, cfg.c1zPath, cfg.invokeActionConfig.action, cfg.invokeActionConfig.resourceTypeID, cfg.invokeActionConfig.args) + + case cfg.listActionSchemasConfig != nil: + tm = local.NewListActionSchemas(ctx, cfg.listActionSchemasConfig.resourceTypeID) case cfg.deleteResourceConfig != nil: tm = local.NewResourceDeleter(ctx, cfg.c1zPath, cfg.deleteResourceConfig.resourceId, cfg.deleteResourceConfig.resourceType) @@ -799,7 +908,7 @@ func NewConnectorRunner(ctx context.Context, c types.ConnectorServer, opts ...Op local.WithTmpDir(cfg.tempDir), local.WithExternalResourceC1Z(cfg.externalResourceC1Z), local.WithExternalResourceEntitlementIdFilter(cfg.externalResourceEntitlementIdFilter), - local.WithTargetedSyncResourceIDs(cfg.targetedSyncResourceIDs), + local.WithTargetedSyncResources(resources), local.WithSkipEntitlementsAndGrants(cfg.skipEntitlementsAndGrants), local.WithSkipGrants(cfg.skipGrants), local.WithSyncResourceTypeIDs(cfg.syncResourceTypeIDs), @@ -822,7 +931,7 @@ func NewConnectorRunner(ctx context.Context, c types.ConnectorServer, opts ...Op cfg.skipFullSync, cfg.externalResourceC1Z, cfg.externalResourceEntitlementIdFilter, - cfg.targetedSyncResourceIDs, + resources, cfg.syncResourceTypeIDs, ) if err != nil { @@ -830,5 +939,20 @@ func NewConnectorRunner(ctx context.Context, c types.ConnectorServer, opts ...Op } runner.tasks = tm + // Start health check server if enabled (only for daemon mode) + if cfg.healthCheckEnabled { + healthCfg := healthcheck.Config{ + Enabled: true, + Port: cfg.healthCheckPort, + BindAddress: cfg.healthCheckBindAddress, + } + healthServer := healthcheck.NewServer(healthCfg, cw.C) + if err := healthServer.Start(ctx); err != nil { + _ = cw.Close() // Clean up connector wrapper on failure + return nil, fmt.Errorf("failed to start health check server: %w", err) + } + runner.healthServer = healthServer + } + return runner, nil } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/connectorstore/connectorstore.go b/vendor/github.com/conductorone/baton-sdk/pkg/connectorstore/connectorstore.go index 64e352ec..65793949 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/connectorstore/connectorstore.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/connectorstore/connectorstore.go @@ -11,10 +11,12 @@ import ( type SyncType string const ( - SyncTypeFull SyncType = "full" - SyncTypePartial SyncType = "partial" - SyncTypeResourcesOnly SyncType = "resources_only" - SyncTypeAny SyncType = "" + SyncTypeFull SyncType = "full" + SyncTypePartial SyncType = "partial" + SyncTypeResourcesOnly SyncType = "resources_only" + SyncTypePartialUpserts SyncType = "partial_upserts" // Diff sync: additions and modifications + SyncTypePartialDeletions SyncType = "partial_deletions" // Diff sync: deletions + SyncTypeAny SyncType = "" ) var AllSyncTypes = []SyncType{ @@ -22,6 +24,8 @@ var AllSyncTypes = []SyncType{ SyncTypeFull, SyncTypePartial, SyncTypeResourcesOnly, + SyncTypePartialUpserts, + SyncTypePartialDeletions, } // ConnectorStoreReader implements the ConnectorV2 API, along with getters for individual objects. @@ -44,7 +48,7 @@ type Reader interface { // the GRPC api, but because this is defined as a streaming RPC, it isn't trivial to implement grpc streaming as part of the c1z format. GetAsset(ctx context.Context, req *v2.AssetServiceGetAssetRequest) (string, io.Reader, error) - Close() error + Close(ctx context.Context) error } // ConnectorStoreWriter defines an implementation for a connector v2 datasource writer. This is used to store sync data from an upstream provider. diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/crypto/client_secret.go b/vendor/github.com/conductorone/baton-sdk/pkg/crypto/client_secret.go index 6126db43..f5fd9e9d 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/crypto/client_secret.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/crypto/client_secret.go @@ -1,4 +1,4 @@ -package crypto +package crypto //nolint:revive,nolintlint // we can't change the package name for backwards compatibility import ( "bytes" diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/crypto/crypto.go b/vendor/github.com/conductorone/baton-sdk/pkg/crypto/crypto.go index 407209db..7a287bce 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/crypto/crypto.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/crypto/crypto.go @@ -1,4 +1,4 @@ -package crypto +package crypto //nolint:revive,nolintlint // we can't change the package name for backwards compatibility import ( "context" diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/crypto/password.go b/vendor/github.com/conductorone/baton-sdk/pkg/crypto/password.go index 98bc11af..cfd16ac0 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/crypto/password.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/crypto/password.go @@ -1,4 +1,4 @@ -package crypto +package crypto //nolint:revive,nolintlint // we can't change the package name for backwards compatibility import ( "context" diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/assets.go b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/assets.go index ea00c14c..e67256f4 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/assets.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/assets.go @@ -58,6 +58,10 @@ func (c *C1File) PutAsset(ctx context.Context, assetRef *v2.AssetRef, contentTyp ctx, span := tracer.Start(ctx, "C1File.PutAsset") defer span.End() + if c.readOnly { + return ErrReadOnly + } + l := ctxzap.Extract(ctx) if len(data) == 0 { diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/c1file.go b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/c1file.go index 3e922ec6..19876916 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/c1file.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/c1file.go @@ -11,6 +11,8 @@ import ( "time" "github.com/doug-martin/goqu/v9" + "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" + "go.uber.org/zap" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -34,39 +36,74 @@ type pragma struct { } type C1File struct { - rawDb *sql.DB - db *goqu.Database - currentSyncID string - viewSyncID string - outputFilePath string - dbFilePath string - dbUpdated bool - tempDir string - pragmas []pragma + rawDb *sql.DB + db *goqu.Database + currentSyncID string + viewSyncID string + outputFilePath string + dbFilePath string + dbUpdated bool + tempDir string + pragmas []pragma + readOnly bool + encoderConcurrency int + closed bool + closedMu sync.Mutex + + // Cached sync run for listConnectorObjects (avoids N+1 queries) + cachedViewSyncRun *syncRun + cachedViewSyncMu sync.Mutex + cachedViewSyncErr error // Slow query tracking slowQueryLogTimes map[string]time.Time slowQueryLogTimesMu sync.Mutex slowQueryThreshold time.Duration slowQueryLogFrequency time.Duration + + // Sync cleanup settings + syncLimit int } var _ connectorstore.Writer = (*C1File)(nil) type C1FOption func(*C1File) +// WithC1FTmpDir sets the temporary directory to use when cloning a sync. +// If not provided, os.TempDir() will be used. func WithC1FTmpDir(tempDir string) C1FOption { return func(o *C1File) { o.tempDir = tempDir } } +// WithC1FPragma sets a sqlite pragma for the c1z file. func WithC1FPragma(name string, value string) C1FOption { return func(o *C1File) { o.pragmas = append(o.pragmas, pragma{name, value}) } } +func WithC1FReadOnly(readOnly bool) C1FOption { + return func(o *C1File) { + o.readOnly = readOnly + } +} + +func WithC1FEncoderConcurrency(concurrency int) C1FOption { + return func(o *C1File) { + o.encoderConcurrency = concurrency + } +} + +// WithC1FSyncCountLimit sets the number of syncs to keep during cleanup. +// If not set, defaults to 2 (or BATON_KEEP_SYNC_COUNT env var if set). +func WithC1FSyncCountLimit(limit int) C1FOption { + return func(o *C1File) { + o.syncLimit = limit + } +} + // Returns a C1File instance for the given db filepath. func NewC1File(ctx context.Context, dbFilePath string, opts ...C1FOption) (*C1File, error) { ctx, span := tracer.Start(ctx, "NewC1File") @@ -87,6 +124,7 @@ func NewC1File(ctx context.Context, dbFilePath string, opts ...C1FOption) (*C1Fi slowQueryLogTimes: make(map[string]time.Time), slowQueryThreshold: 5 * time.Second, slowQueryLogFrequency: 1 * time.Minute, + encoderConcurrency: 1, } for _, opt := range opts { @@ -107,18 +145,25 @@ func NewC1File(ctx context.Context, dbFilePath string, opts ...C1FOption) (*C1Fi } type c1zOptions struct { - tmpDir string - pragmas []pragma - decoderOptions []DecoderOption + tmpDir string + pragmas []pragma + decoderOptions []DecoderOption + readOnly bool + encoderConcurrency int + syncLimit int } + type C1ZOption func(*c1zOptions) +// WithTmpDir sets the temporary directory to extract the c1z file to. +// If not provided, os.TempDir() will be used. func WithTmpDir(tmpDir string) C1ZOption { return func(o *c1zOptions) { o.tmpDir = tmpDir } } +// WithPragma sets a sqlite pragma for the c1z file. func WithPragma(name string, value string) C1ZOption { return func(o *c1zOptions) { o.pragmas = append(o.pragmas, pragma{name, value}) @@ -131,17 +176,43 @@ func WithDecoderOptions(opts ...DecoderOption) C1ZOption { } } +// WithReadOnly opens the c1z file in read only mode. Modifying the c1z will result in an error on close. +func WithReadOnly(readOnly bool) C1ZOption { + return func(o *c1zOptions) { + o.readOnly = readOnly + } +} + +// WithEncoderConcurrency sets the number of created encoders. +// Default is 1, which disables async encoding/concurrency. +// 0 uses GOMAXPROCS. +func WithEncoderConcurrency(concurrency int) C1ZOption { + return func(o *c1zOptions) { + o.encoderConcurrency = concurrency + } +} + +// WithSyncLimit sets the number of syncs to keep during cleanup. +// If not set, defaults to 2 (or BATON_KEEP_SYNC_COUNT env var if set). +func WithSyncLimit(limit int) C1ZOption { + return func(o *c1zOptions) { + o.syncLimit = limit + } +} + // Returns a new C1File instance with its state stored at the provided filename. func NewC1ZFile(ctx context.Context, outputFilePath string, opts ...C1ZOption) (*C1File, error) { ctx, span := tracer.Start(ctx, "NewC1ZFile") defer span.End() - options := &c1zOptions{} + options := &c1zOptions{ + encoderConcurrency: 1, + } for _, opt := range opts { opt(options) } - dbFilePath, err := loadC1z(outputFilePath, options.tmpDir, options.decoderOptions...) + dbFilePath, _, err := decompressC1z(outputFilePath, options.tmpDir, options.decoderOptions...) if err != nil { return nil, err } @@ -150,6 +221,16 @@ func NewC1ZFile(ctx context.Context, outputFilePath string, opts ...C1ZOption) ( for _, pragma := range options.pragmas { c1fopts = append(c1fopts, WithC1FPragma(pragma.name, pragma.value)) } + if options.readOnly { + c1fopts = append(c1fopts, WithC1FReadOnly(true)) + } + if options.encoderConcurrency < 0 { + return nil, fmt.Errorf("encoder concurrency must be greater than 0") + } + c1fopts = append(c1fopts, WithC1FEncoderConcurrency(options.encoderConcurrency)) + if options.syncLimit > 0 { + c1fopts = append(c1fopts, WithC1FSyncCountLimit(options.syncLimit)) + } c1File, err := NewC1File(ctx, dbFilePath, c1fopts...) if err != nil { @@ -169,12 +250,48 @@ func cleanupDbDir(dbFilePath string, err error) error { return err } +var ErrReadOnly = errors.New("c1z: read only mode") + // Close ensures that the sqlite database is flushed to disk, and if any changes were made we update the original database -// with our changes. -func (c *C1File) Close() error { +// with our changes. The provided context is used for the WAL checkpoint operation. +func (c *C1File) Close(ctx context.Context) error { var err error + c.closedMu.Lock() + defer c.closedMu.Unlock() + if c.closed { + l := ctxzap.Extract(ctx) + l.Warn("close called on already-closed c1file", zap.String("db_path", c.dbFilePath)) + return nil + } + if c.rawDb != nil { + // CRITICAL: Force a full WAL checkpoint before closing the database. + // This ensures all WAL data is written back to the main database file + // and the writes are synced to disk. Without this, on filesystems with + // aggressive caching (like ZFS with large ARC), the subsequent saveC1z() + // read could see stale data because the checkpoint writes may still be + // in kernel buffers. + // + // TRUNCATE mode: checkpoint as many frames as possible, then truncate + // the WAL file to zero bytes. This guarantees all data is in the main + // database file before we read it for compression. + if c.dbUpdated && !c.readOnly { + _, err = c.rawDb.ExecContext(ctx, "PRAGMA wal_checkpoint(TRUNCATE)") + if err != nil { + l := ctxzap.Extract(ctx) + // Checkpoint failed - log and continue. The subsequent Close() + // will attempt a passive checkpoint. If that also fails, we'll + // get an error from Close() or saveC1z() will read stale data. + // We log here for debugging but don't fail because: + // 1. Close() will still attempt its own checkpoint + // 2. The error might be transient (busy) + l.Warn("WAL checkpoint failed before close", + zap.Error(err), + zap.String("db_path", c.dbFilePath)) + } + } + err = c.rawDb.Close() if err != nil { return cleanupDbDir(c.dbFilePath, err) @@ -185,13 +302,22 @@ func (c *C1File) Close() error { // We only want to save the file if we've made any changes if c.dbUpdated { - err = saveC1z(c.dbFilePath, c.outputFilePath) + if c.readOnly { + return cleanupDbDir(c.dbFilePath, ErrReadOnly) + } + err = saveC1z(c.dbFilePath, c.outputFilePath, c.encoderConcurrency) if err != nil { return cleanupDbDir(c.dbFilePath, err) } } - return cleanupDbDir(c.dbFilePath, err) + err = cleanupDbDir(c.dbFilePath, err) + if err != nil { + return err + } + c.closed = true + + return nil } // init ensures that the database has all of the required schema. @@ -204,13 +330,19 @@ func (c *C1File) init(ctx context.Context) error { return err } - for _, t := range allTableDescriptors { - query, args := t.Schema() - _, err = c.db.ExecContext(ctx, fmt.Sprintf(query, args...)) + err = c.InitTables(ctx) + if err != nil { + return err + } + + if c.readOnly { + // Disable journaling in read only mode, since we're not writing to the database. + _, err = c.db.ExecContext(ctx, "PRAGMA journal_mode = OFF") if err != nil { return err } - err = t.Migrations(ctx, c.db) + // Disable synchronous writes in read only mode, since we're not writing to the database. + _, err = c.db.ExecContext(ctx, "PRAGMA synchronous = OFF") if err != nil { return err } @@ -226,6 +358,30 @@ func (c *C1File) init(ctx context.Context) error { return nil } +func (c *C1File) InitTables(ctx context.Context) error { + ctx, span := tracer.Start(ctx, "C1File.InitTables") + defer span.End() + + err := c.validateDb(ctx) + if err != nil { + return err + } + + for _, t := range allTableDescriptors { + query, args := t.Schema() + _, err = c.db.ExecContext(ctx, fmt.Sprintf(query, args...)) + if err != nil { + return err + } + err = t.Migrations(ctx, c.db) + if err != nil { + return err + } + } + + return nil +} + // Stats introspects the database and returns the count of objects for the given sync run. // If syncId is empty, it will use the latest sync run of the given type. func (c *C1File) Stats(ctx context.Context, syncType connectorstore.SyncType, syncId string) (map[string]int64, error) { diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/c1file_attached.go b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/c1file_attached.go index 34bf5ea4..54e64f4f 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/c1file_attached.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/c1file_attached.go @@ -2,8 +2,15 @@ package dotc1z import ( "context" + "database/sql" "errors" "fmt" + "time" + + reader_v2 "github.com/conductorone/baton-sdk/pb/c1/reader/v2" + "github.com/conductorone/baton-sdk/pkg/connectorstore" + "github.com/doug-martin/goqu/v9" + "github.com/segmentio/ksuid" ) type C1FileAttached struct { @@ -11,7 +18,7 @@ type C1FileAttached struct { file *C1File } -func (c *C1FileAttached) CompactTable(ctx context.Context, destSyncID string, baseSyncID string, appliedSyncID string, tableName string) error { +func (c *C1FileAttached) CompactTable(ctx context.Context, baseSyncID string, appliedSyncID string, tableName string) error { if !c.safe { return errors.New("database has been detached") } @@ -33,27 +40,14 @@ func (c *C1FileAttached) CompactTable(ctx context.Context, destSyncID string, ba selectList += ", " } columnList += col - if col == "sync_id" { - selectList += "? as sync_id" + if col == "sync_id" { //nolint:goconst,nolintlint // ... + selectList += "? as sync_id" //nolint:goconst,nolintlint // ... } else { selectList += col } } - // Step 1: Insert ALL records from base sync - insertBaseQuery := fmt.Sprintf(` - INSERT INTO main.%s (%s) - SELECT %s - FROM base.%s - WHERE sync_id = ? - `, tableName, columnList, selectList, tableName) - - _, err = c.file.db.ExecContext(ctx, insertBaseQuery, destSyncID, baseSyncID) - if err != nil { - return fmt.Errorf("failed to copy base records: %w", err) - } - - // Step 2: Insert/replace records from applied sync where applied.discovered_at > main.discovered_at + // Insert/replace records from applied sync where applied.discovered_at > main.discovered_at insertOrReplaceAppliedQuery := fmt.Sprintf(` INSERT OR REPLACE INTO main.%s (%s) SELECT %s @@ -73,7 +67,7 @@ func (c *C1FileAttached) CompactTable(ctx context.Context, destSyncID string, ba ) `, tableName, columnList, selectList, tableName, tableName, tableName) - _, err = c.file.db.ExecContext(ctx, insertOrReplaceAppliedQuery, destSyncID, appliedSyncID, destSyncID, destSyncID) + _, err = c.file.db.ExecContext(ctx, insertOrReplaceAppliedQuery, baseSyncID, appliedSyncID, baseSyncID, baseSyncID) return err } @@ -94,7 +88,7 @@ func (c *C1FileAttached) getTableColumns(ctx context.Context, tableName string) var cid int var name, dataType string var notNull, pk int - var defaultValue interface{} + var defaultValue any err := rows.Scan(&cid, &name, &dataType, ¬Null, &defaultValue, &pk) if err != nil { @@ -113,30 +107,293 @@ func (c *C1FileAttached) getTableColumns(ctx context.Context, tableName string) return columns, nil } -func (c *C1FileAttached) CompactResourceTypes(ctx context.Context, destSyncID string, baseSyncID string, appliedSyncID string) error { +func (c *C1FileAttached) CompactResourceTypes(ctx context.Context, baseSyncID string, appliedSyncID string) error { if !c.safe { return errors.New("database has been detached") } - return c.CompactTable(ctx, destSyncID, baseSyncID, appliedSyncID, "v1_resource_types") + return c.CompactTable(ctx, baseSyncID, appliedSyncID, "v1_resource_types") } -func (c *C1FileAttached) CompactResources(ctx context.Context, destSyncID string, baseSyncID string, appliedSyncID string) error { +func (c *C1FileAttached) CompactResources(ctx context.Context, baseSyncID string, appliedSyncID string) error { if !c.safe { return errors.New("database has been detached") } - return c.CompactTable(ctx, destSyncID, baseSyncID, appliedSyncID, "v1_resources") + return c.CompactTable(ctx, baseSyncID, appliedSyncID, "v1_resources") } -func (c *C1FileAttached) CompactEntitlements(ctx context.Context, destSyncID string, baseSyncID string, appliedSyncID string) error { +func (c *C1FileAttached) CompactEntitlements(ctx context.Context, baseSyncID string, appliedSyncID string) error { if !c.safe { return errors.New("database has been detached") } - return c.CompactTable(ctx, destSyncID, baseSyncID, appliedSyncID, "v1_entitlements") + return c.CompactTable(ctx, baseSyncID, appliedSyncID, "v1_entitlements") } -func (c *C1FileAttached) CompactGrants(ctx context.Context, destSyncID string, baseSyncID string, appliedSyncID string) error { +func (c *C1FileAttached) CompactGrants(ctx context.Context, baseSyncID string, appliedSyncID string) error { if !c.safe { return errors.New("database has been detached") } - return c.CompactTable(ctx, destSyncID, baseSyncID, appliedSyncID, "v1_grants") + return c.CompactTable(ctx, baseSyncID, appliedSyncID, "v1_grants") +} + +func unionSyncTypes(a, b connectorstore.SyncType) connectorstore.SyncType { + switch { + case a == connectorstore.SyncTypeFull || b == connectorstore.SyncTypeFull: + return connectorstore.SyncTypeFull + case a == connectorstore.SyncTypeResourcesOnly || b == connectorstore.SyncTypeResourcesOnly: + return connectorstore.SyncTypeResourcesOnly + default: + return connectorstore.SyncTypePartial + } +} + +func (c *C1FileAttached) UpdateSync(ctx context.Context, baseSync *reader_v2.SyncRun, appliedSync *reader_v2.SyncRun) error { + if !c.safe { + return errors.New("database has been detached") + } + syncType := unionSyncTypes(connectorstore.SyncType(baseSync.GetSyncType()), connectorstore.SyncType(appliedSync.GetSyncType())) + + latestEndedAt := baseSync.GetEndedAt().AsTime() + if appliedSync.GetEndedAt().AsTime().After(latestEndedAt) { + latestEndedAt = appliedSync.GetEndedAt().AsTime() + } + + baseSyncID := baseSync.GetId() + q := c.file.db.Update(fmt.Sprintf("main.%s", syncRuns.Name())) + q = q.Set(goqu.Record{ + "ended_at": latestEndedAt.Format("2006-01-02 15:04:05.999999999"), + "sync_type": string(syncType), + }) + q = q.Where(goqu.C("sync_id").Eq(baseSyncID)) + + query, args, err := q.ToSQL() + if err != nil { + return fmt.Errorf("failed to build update sync query: %w", err) + } + + _, err = c.file.db.ExecContext(ctx, query, args...) + if err != nil { + return fmt.Errorf("failed to update sync %s to type %s: %w", baseSyncID, syncType, err) + } + + return nil +} + +// GenerateSyncDiffFromFile compares the old sync (in attached) with the new sync (in main) +// and generates two new syncs in the main database. +// +// IMPORTANT: This assumes main=NEW/compacted and attached=OLD/base: +// - diffTableFromAttached: items in attached (OLD) not in main (NEW) = deletions +// - diffTableFromMain: items in main (NEW) not in attached (OLD) = upserts (additions) +// +// Parameters: +// - oldSyncID: the sync ID in the attached database (OLD/base state) +// - newSyncID: the sync ID in the main database (NEW/compacted state) +// +// Returns (upsertsSyncID, deletionsSyncID, error). +func (c *C1FileAttached) GenerateSyncDiffFromFile(ctx context.Context, oldSyncID string, newSyncID string) (string, string, error) { + if !c.safe { + return "", "", errors.New("database has been detached") + } + + ctx, span := tracer.Start(ctx, "C1FileAttached.GenerateSyncDiffFromFile") + defer span.End() + + // Generate unique IDs for the diff syncs + deletionsSyncID := ksuid.New().String() + upsertsSyncID := ksuid.New().String() + + // Start transaction for atomicity + tx, err := c.file.rawDb.BeginTx(ctx, nil) + if err != nil { + return "", "", fmt.Errorf("failed to begin transaction: %w", err) + } + + // Ensure rollback on error + committed := false + defer func() { + if !committed { + _ = tx.Rollback() + } + }() + + now := time.Now().Format("2006-01-02 15:04:05.999999999") + + // Create the deletions sync first (so upserts is "latest") + // Link it to upserts sync bidirectionally + deletionsInsert := c.file.db.Insert(syncRuns.Name()).Rows(goqu.Record{ + "sync_id": deletionsSyncID, + "started_at": now, + "sync_token": "", + "sync_type": connectorstore.SyncTypePartialDeletions, + "parent_sync_id": oldSyncID, + "linked_sync_id": upsertsSyncID, + }) + query, args, err := deletionsInsert.ToSQL() + if err != nil { + return "", "", fmt.Errorf("failed to build deletions sync insert: %w", err) + } + if _, err = tx.ExecContext(ctx, query, args...); err != nil { + return "", "", fmt.Errorf("failed to create deletions sync: %w", err) + } + + // Create the upserts sync, linked to deletions sync + upsertsInsert := c.file.db.Insert(syncRuns.Name()).Rows(goqu.Record{ + "sync_id": upsertsSyncID, + "started_at": now, + "sync_token": "", + "sync_type": connectorstore.SyncTypePartialUpserts, + "parent_sync_id": oldSyncID, + "linked_sync_id": deletionsSyncID, + }) + query, args, err = upsertsInsert.ToSQL() + if err != nil { + return "", "", fmt.Errorf("failed to build upserts sync insert: %w", err) + } + if _, err = tx.ExecContext(ctx, query, args...); err != nil { + return "", "", fmt.Errorf("failed to create upserts sync: %w", err) + } + + // Process each table + // main=NEW, attached=OLD + // - diffTableFromAttachedTx finds items in OLD not in NEW = deletions + // - diffTableFromMainTx finds items in NEW not in OLD or modified = upserts + tables := []string{"v1_resource_types", "v1_resources", "v1_entitlements", "v1_grants"} + for _, tableName := range tables { + if err := c.diffTableFromAttachedTx(ctx, tx, tableName, oldSyncID, newSyncID, deletionsSyncID); err != nil { + return "", "", fmt.Errorf("failed to generate deletions for %s: %w", tableName, err) + } + if err := c.diffTableFromMainTx(ctx, tx, tableName, oldSyncID, newSyncID, upsertsSyncID); err != nil { + return "", "", fmt.Errorf("failed to generate upserts for %s: %w", tableName, err) + } + } + + // End the syncs (deletions first, then upserts) + endedAt := time.Now().Format("2006-01-02 15:04:05.999999999") + + endDeletions := c.file.db.Update(syncRuns.Name()). + Set(goqu.Record{"ended_at": endedAt}). + Where(goqu.C("sync_id").Eq(deletionsSyncID), goqu.C("ended_at").IsNull()) + query, args, err = endDeletions.ToSQL() + if err != nil { + return "", "", fmt.Errorf("failed to build end deletions sync: %w", err) + } + if _, err = tx.ExecContext(ctx, query, args...); err != nil { + return "", "", fmt.Errorf("failed to end deletions sync: %w", err) + } + + endUpserts := c.file.db.Update(syncRuns.Name()). + Set(goqu.Record{"ended_at": endedAt}). + Where(goqu.C("sync_id").Eq(upsertsSyncID), goqu.C("ended_at").IsNull()) + query, args, err = endUpserts.ToSQL() + if err != nil { + return "", "", fmt.Errorf("failed to build end upserts sync: %w", err) + } + if _, err = tx.ExecContext(ctx, query, args...); err != nil { + return "", "", fmt.Errorf("failed to end upserts sync: %w", err) + } + + // Commit transaction + if err = tx.Commit(); err != nil { + return "", "", fmt.Errorf("failed to commit transaction: %w", err) + } + committed = true + c.file.dbUpdated = true + + return upsertsSyncID, deletionsSyncID, nil +} + +// diffTableFromAttachedTx finds items in attached (OLD) that don't exist in main (NEW). +// These are DELETIONS - items that existed before but no longer exist. +// Uses the provided transaction. +func (c *C1FileAttached) diffTableFromAttachedTx(ctx context.Context, tx *sql.Tx, tableName string, oldSyncID string, newSyncID string, targetSyncID string) error { + columns, err := c.getTableColumns(ctx, tableName) + if err != nil { + return err + } + + // Build column lists + columnList := "" + selectList := "" + for i, col := range columns { + if i > 0 { + columnList += ", " + selectList += ", " + } + columnList += col + if col == "sync_id" { + selectList += "? as sync_id" + } else { + selectList += col + } + } + + // Insert items from attached (OLD) that don't exist in main (NEW) + // oldSyncID is in attached, newSyncID is in main + //nolint:gosec // table names are from hardcoded list, not user input + query := fmt.Sprintf(` + INSERT INTO main.%s (%s) + SELECT %s + FROM attached.%s AS a + WHERE a.sync_id = ? + AND NOT EXISTS ( + SELECT 1 FROM main.%s AS m + WHERE m.external_id = a.external_id AND m.sync_id = ? + ) + `, tableName, columnList, selectList, tableName, tableName) + + _, err = tx.ExecContext(ctx, query, targetSyncID, oldSyncID, newSyncID) + return err +} + +// diffTableFromMainTx finds items in main (NEW) that are new or modified compared to attached (OLD). +// These are UPSERTS - items that are new or have changed. +// Uses the provided transaction. +func (c *C1FileAttached) diffTableFromMainTx(ctx context.Context, tx *sql.Tx, tableName string, oldSyncID string, newSyncID string, targetSyncID string) error { + columns, err := c.getTableColumns(ctx, tableName) + if err != nil { + return err + } + + // Build column lists + columnList := "" + selectList := "" + for i, col := range columns { + if i > 0 { + columnList += ", " + selectList += ", " + } + columnList += col + if col == "sync_id" { + selectList += "? as sync_id" + } else { + selectList += col + } + } + + // Insert items from main (NEW) that are: + // 1. Not in attached (OLD) - additions + // 2. In attached but with different data - modifications + // newSyncID is in main, oldSyncID is in attached + //nolint:gosec // table names are from hardcoded list, not user input + query := fmt.Sprintf(` + INSERT INTO main.%s (%s) + SELECT %s + FROM main.%s AS m + WHERE m.sync_id = ? + AND ( + NOT EXISTS ( + SELECT 1 FROM attached.%s AS a + WHERE a.external_id = m.external_id AND a.sync_id = ? + ) + OR EXISTS ( + SELECT 1 FROM attached.%s AS a + WHERE a.external_id = m.external_id + AND a.sync_id = ? + AND a.data != m.data + ) + ) + `, tableName, columnList, selectList, tableName, tableName, tableName) + + _, err = tx.ExecContext(ctx, query, targetSyncID, newSyncID, oldSyncID, oldSyncID) + return err } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/clone_sync.go b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/clone_sync.go index 0a6050d0..64aad8aa 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/clone_sync.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/clone_sync.go @@ -78,7 +78,7 @@ func (c *C1File) CloneSync(ctx context.Context, outPath string, syncID string) ( if err != nil { return err } - defer out.Close() + defer out.Close(ctx) err = out.init(ctx) if err != nil { @@ -142,7 +142,7 @@ func (c *C1File) CloneSync(ctx context.Context, outPath string, syncID string) ( } outFile.dbUpdated = true outFile.outputFilePath = outPath - err = outFile.Close() + err = outFile.Close(ctx) if err != nil { return err } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/decoder.go b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/decoder.go index 68480acc..5f3a4cd2 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/decoder.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/decoder.go @@ -107,6 +107,7 @@ func WithDecoderMaxDecodedSize(n uint64) DecoderOption { // WithDecoderConcurrency sets the number of created decoders. // Default is 1, which disables async decoding/concurrency. // 0 uses GOMAXPROCS. +// -1 uses GOMAXPROCS or 4, whichever is lower. func WithDecoderConcurrency(n int) DecoderOption { return func(o *decoderOptions) error { o.decoderConcurrency = n diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/diff.go b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/diff.go index 446aad2b..162001e4 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/diff.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/diff.go @@ -11,6 +11,10 @@ import ( ) func (c *C1File) GenerateSyncDiff(ctx context.Context, baseSyncID string, appliedSyncID string) (string, error) { + if c.readOnly { + return "", ErrReadOnly + } + // Validate that both sync runs exist baseSync, err := c.getSync(ctx, baseSyncID) if err != nil { @@ -95,7 +99,7 @@ func (c *C1File) diffTableQuery(table tableDescriptor, baseSyncID, appliedSyncID queryColumns := []interface{}{} for _, col := range columns { - if col == "sync_id" { + if col == "sync_id" { //nolint:goconst,nolintlint // ... queryColumns = append(queryColumns, goqu.L(fmt.Sprintf("'%s' as sync_id", newSyncID))) continue } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/dotc1z.go b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/dotc1z.go index 835a2958..0d64ea4c 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/dotc1z.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/dotc1z.go @@ -50,7 +50,7 @@ func C1ZFileCheckHeader(f io.ReadSeeker) (bool, error) { } func NewExternalC1FileReader(ctx context.Context, tmpDir string, externalResourceC1ZPath string) (connectorstore.Reader, error) { - dbFilePath, err := loadC1z(externalResourceC1ZPath, tmpDir) + dbFilePath, _, err := decompressC1z(externalResourceC1ZPath, tmpDir) if err != nil { return nil, fmt.Errorf("error loading external resource c1z file: %w", err) } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/entitlements.go b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/entitlements.go index af966794..31b1aac6 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/entitlements.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/entitlements.go @@ -5,7 +5,6 @@ import ( "fmt" "github.com/doug-martin/goqu/v9" - "google.golang.org/protobuf/proto" v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" reader_v2 "github.com/conductorone/baton-sdk/pb/c1/reader/v2" @@ -57,23 +56,13 @@ func (c *C1File) ListEntitlements(ctx context.Context, request *v2.EntitlementsS ctx, span := tracer.Start(ctx, "C1File.ListEntitlements") defer span.End() - objs, nextPageToken, err := c.listConnectorObjects(ctx, entitlements.Name(), request) + objs, nextPageToken, err := listConnectorObjects(ctx, c, entitlements.Name(), request, func() *v2.Entitlement { return &v2.Entitlement{} }) if err != nil { return nil, fmt.Errorf("error listing entitlements: %w", err) } - ret := make([]*v2.Entitlement, 0, len(objs)) - for _, o := range objs { - en := &v2.Entitlement{} - err = proto.Unmarshal(o, en) - if err != nil { - return nil, err - } - ret = append(ret, en) - } - return v2.EntitlementsServiceListEntitlementsResponse_builder{ - List: ret, + List: objs, NextPageToken: nextPageToken, }.Build(), nil } @@ -124,6 +113,10 @@ func (c *C1File) PutEntitlementsIfNewer(ctx context.Context, entitlementObjs ... type entitlementPutFunc func(context.Context, *C1File, string, func(m *v2.Entitlement) (goqu.Record, error), ...*v2.Entitlement) error func (c *C1File) putEntitlementsInternal(ctx context.Context, f entitlementPutFunc, entitlementObjs ...*v2.Entitlement) error { + if c.readOnly { + return ErrReadOnly + } + err := f(ctx, c, entitlements.Name(), func(entitlement *v2.Entitlement) (goqu.Record, error) { return goqu.Record{ diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/file.go b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/file.go index de0a62ae..b7096ce6 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/file.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/file.go @@ -6,59 +6,97 @@ import ( "io" "os" "path/filepath" + "runtime" "syscall" "github.com/klauspost/compress/zstd" "go.uber.org/zap" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) -func loadC1z(filePath string, tmpDir string, opts ...DecoderOption) (string, error) { - var err error - workingDir, err := os.MkdirTemp(tmpDir, "c1z") +// Note(kans): decompressC1z is unfortunately called to load or create a c1z file so the error handling is rough. +// It creates its own temporary directory so that it can also do its own cleanup. +// It returns that directory for verification in tests. +func decompressC1z(c1zPath string, workingDir string, opts ...DecoderOption) (string, string, error) { + tmpDir, err := os.MkdirTemp(workingDir, "c1z") if err != nil { - return "", err + return "", tmpDir, err } - defer func() { - if err != nil { - if removeErr := os.RemoveAll(workingDir); removeErr != nil { - err = errors.Join(err, removeErr) + + var dbFile *os.File + var c1zFile *os.File + var decoder *decoder + cleanupDir := func(e error) error { + if decoder != nil { + err := decoder.Close() + if err != nil { + e = errors.Join(e, err) } } - }() - dbFilePath := filepath.Join(workingDir, "db") - dbFile, err := os.Create(dbFilePath) + if c1zFile != nil { + err := c1zFile.Close() + if err != nil { + e = errors.Join(e, err) + } + } + if dbFile != nil { + err := dbFile.Close() + if err != nil { + e = errors.Join(e, err) + } + } + if e != nil { + err := os.RemoveAll(tmpDir) + if err != nil { + e = errors.Join(e, err) + } + } + return e + } + + dbFilePath := filepath.Join(tmpDir, "db") + dbFile, err = os.Create(dbFilePath) if err != nil { - return "", err + return "", tmpDir, cleanupDir(err) } - defer dbFile.Close() - if stat, err := os.Stat(filePath); err == nil && stat.Size() != 0 { - c1zFile, err := os.Open(filePath) - if err != nil { - return "", err - } - defer c1zFile.Close() + stat, err := os.Stat(c1zPath) + if err != nil || stat.Size() == 0 { + // TODO(kans): it would be nice to know more about the error.... + return dbFilePath, tmpDir, cleanupDir(nil) + } - r, err := NewDecoder(c1zFile, opts...) - if err != nil { - return "", err - } - _, err = io.Copy(dbFile, r) - if err != nil { - return "", err - } - err = r.Close() - if err != nil { - return "", err - } + c1zFile, err = os.Open(c1zPath) + if err != nil { + return "", tmpDir, cleanupDir(err) } - return dbFilePath, nil + decoder, err = NewDecoder(c1zFile, opts...) + if err != nil { + return "", tmpDir, cleanupDir(err) + } + + _, err = io.Copy(dbFile, decoder) + if err != nil { + return "", tmpDir, cleanupDir(err) + } + + // CRITICAL: Sync the database file before returning to ensure all + // decompressed data is on disk. On filesystems with aggressive caching + // (like ZFS with large ARC), SQLite might otherwise open the file and + // see incomplete data still in kernel buffers. + err = dbFile.Sync() + if err != nil { + return "", tmpDir, cleanupDir(err) + } + + return dbFilePath, tmpDir, cleanupDir(nil) } -func saveC1z(dbFilePath string, outputFilePath string) error { +func saveC1z(dbFilePath string, outputFilePath string, encoderConcurrency int) error { if outputFilePath == "" { - return errors.New("c1z: output file path not configured") + return status.Errorf(codes.InvalidArgument, "c1z: output file path not configured") } dbFile, err := os.Open(dbFilePath) @@ -93,8 +131,14 @@ func saveC1z(dbFilePath string, outputFilePath string) error { return err } + // zstd.WithEncoderConcurrency does not work the same as WithDecoderConcurrency. + // WithDecoderConcurrency uses GOMAXPROCS if set to 0. + // WithEncoderConcurrency errors if set to 0 (but defaults to GOMAXPROCS). + if encoderConcurrency == 0 { + encoderConcurrency = runtime.GOMAXPROCS(0) + } c1z, err := zstd.NewWriter(outFile, - zstd.WithEncoderConcurrency(1), + zstd.WithEncoderConcurrency(encoderConcurrency), ) if err != nil { return err @@ -107,11 +151,11 @@ func saveC1z(dbFilePath string, outputFilePath string) error { err = c1z.Flush() if err != nil { - return err + return fmt.Errorf("failed to flush c1z: %w", err) } err = c1z.Close() if err != nil { - return err + return fmt.Errorf("failed to close c1z: %w", err) } err = outFile.Sync() diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/grants.go b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/grants.go index c34d49d7..c091d747 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/grants.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/grants.go @@ -5,7 +5,6 @@ import ( "fmt" "github.com/doug-martin/goqu/v9" - "google.golang.org/protobuf/proto" v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" reader_v2 "github.com/conductorone/baton-sdk/pb/c1/reader/v2" @@ -34,6 +33,8 @@ create unique index if not exists %s on %s (external_id, sync_id);` var grants = (*grantsTable)(nil) +var _ tableDescriptor = (*grantsTable)(nil) + type grantsTable struct{} func (r *grantsTable) Version() string { @@ -44,8 +45,8 @@ func (r *grantsTable) Name() string { return fmt.Sprintf("v%s_%s", r.Version(), grantsTableName) } -func (r *grantsTable) Schema() (string, []interface{}) { - return grantsTableSchema, []interface{}{ +func (r *grantsTable) Schema() (string, []any) { + return grantsTableSchema, []any{ r.Name(), fmt.Sprintf("idx_grants_resource_type_id_resource_id_v%s", r.Version()), r.Name(), @@ -66,21 +67,11 @@ func (c *C1File) ListGrants(ctx context.Context, request *v2.GrantsServiceListGr ctx, span := tracer.Start(ctx, "C1File.ListGrants") defer span.End() - objs, nextPageToken, err := c.listConnectorObjects(ctx, grants.Name(), request) + ret, nextPageToken, err := listConnectorObjects(ctx, c, grants.Name(), request, func() *v2.Grant { return &v2.Grant{} }) if err != nil { return nil, fmt.Errorf("error listing grants: %w", err) } - ret := make([]*v2.Grant, 0, len(objs)) - for _, o := range objs { - g := &v2.Grant{} - err = proto.Unmarshal(o, g) - if err != nil { - return nil, err - } - ret = append(ret, g) - } - return v2.GrantsServiceListGrantsResponse_builder{ List: ret, NextPageToken: nextPageToken, @@ -112,22 +103,11 @@ func (c *C1File) ListGrantsForEntitlement( ) (*reader_v2.GrantsReaderServiceListGrantsForEntitlementResponse, error) { ctx, span := tracer.Start(ctx, "C1File.ListGrantsForEntitlement") defer span.End() - - objs, nextPageToken, err := c.listConnectorObjects(ctx, grants.Name(), request) + ret, nextPageToken, err := listConnectorObjects(ctx, c, grants.Name(), request, func() *v2.Grant { return &v2.Grant{} }) if err != nil { return nil, fmt.Errorf("error listing grants for entitlement '%s': %w", request.GetEntitlement().GetId(), err) } - ret := make([]*v2.Grant, 0, len(objs)) - for _, o := range objs { - en := &v2.Grant{} - err = proto.Unmarshal(o, en) - if err != nil { - return nil, err - } - ret = append(ret, en) - } - return reader_v2.GrantsReaderServiceListGrantsForEntitlementResponse_builder{ List: ret, NextPageToken: nextPageToken, @@ -141,21 +121,11 @@ func (c *C1File) ListGrantsForPrincipal( ctx, span := tracer.Start(ctx, "C1File.ListGrantsForPrincipal") defer span.End() - objs, nextPageToken, err := c.listConnectorObjects(ctx, grants.Name(), request) + ret, nextPageToken, err := listConnectorObjects(ctx, c, grants.Name(), request, func() *v2.Grant { return &v2.Grant{} }) if err != nil { return nil, fmt.Errorf("error listing grants for principal '%s': %w", request.GetPrincipalId(), err) } - ret := make([]*v2.Grant, 0, len(objs)) - for _, o := range objs { - en := &v2.Grant{} - err = proto.Unmarshal(o, en) - if err != nil { - return nil, err - } - ret = append(ret, en) - } - return reader_v2.GrantsReaderServiceListGrantsForEntitlementResponse_builder{ List: ret, NextPageToken: nextPageToken, @@ -169,21 +139,11 @@ func (c *C1File) ListGrantsForResourceType( ctx, span := tracer.Start(ctx, "C1File.ListGrantsForResourceType") defer span.End() - objs, nextPageToken, err := c.listConnectorObjects(ctx, grants.Name(), request) + ret, nextPageToken, err := listConnectorObjects(ctx, c, grants.Name(), request, func() *v2.Grant { return &v2.Grant{} }) if err != nil { return nil, fmt.Errorf("error listing grants for resource type '%s': %w", request.GetResourceTypeId(), err) } - ret := make([]*v2.Grant, 0, len(objs)) - for _, o := range objs { - en := &v2.Grant{} - err = proto.Unmarshal(o, en) - if err != nil { - return nil, err - } - ret = append(ret, en) - } - return reader_v2.GrantsReaderServiceListGrantsForResourceTypeResponse_builder{ List: ret, NextPageToken: nextPageToken, @@ -207,6 +167,10 @@ func (c *C1File) PutGrantsIfNewer(ctx context.Context, bulkGrants ...*v2.Grant) type grantPutFunc func(context.Context, *C1File, string, func(m *v2.Grant) (goqu.Record, error), ...*v2.Grant) error func (c *C1File) putGrantsInternal(ctx context.Context, f grantPutFunc, bulkGrants ...*v2.Grant) error { + if c.readOnly { + return ErrReadOnly + } + err := f(ctx, c, grants.Name(), func(grant *v2.Grant) (goqu.Record, error) { return goqu.Record{ diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/manager/local/local.go b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/manager/local/local.go index 6ccbdd9c..3f319079 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/manager/local/local.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/manager/local/local.go @@ -59,10 +59,36 @@ func (l *localManager) copyFileToTmp(ctx context.Context) error { } defer f.Close() - _, err = io.Copy(tmp, f) + // Get source file size for verification + sourceStat, err := f.Stat() + if err != nil { + return fmt.Errorf("failed to stat source file: %w", err) + } + expectedSize := sourceStat.Size() + + written, err := io.Copy(tmp, f) if err != nil { return err } + + // CRITICAL: Sync to ensure all data is written before file is used. + // This is especially important on ZFS ARC where writes may be cached + // and reads can happen before buffers are flushed to disk. + if err := tmp.Sync(); err != nil { + return fmt.Errorf("failed to sync temp file: %w", err) + } + + // Verify file size matches what we wrote (defensive check) + stat, err := tmp.Stat() + if err != nil { + return fmt.Errorf("failed to stat temp file: %w", err) + } + if stat.Size() != written { + return fmt.Errorf("file size mismatch: wrote %d bytes but file is %d bytes", written, stat.Size()) + } + if written != expectedSize { + return fmt.Errorf("copy size mismatch: expected %d bytes from source but copied %d bytes", expectedSize, written) + } } return nil @@ -147,6 +173,12 @@ func (l *localManager) SaveC1Z(ctx context.Context) error { return err } + // CRITICAL: Sync to ensure data is written before function returns. + // This is especially important on ZFS ARC where writes may be cached. + if err := dstFile.Sync(); err != nil { + return fmt.Errorf("failed to sync destination file: %w", err) + } + log.Debug( "successfully saved c1z locally", zap.String("file_path", l.filePath), diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/manager/s3/s3.go b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/manager/s3/s3.go index 385b1bc4..dd9fbd22 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/manager/s3/s3.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/manager/s3/s3.go @@ -53,11 +53,30 @@ func (s *s3Manager) copyToTempFile(ctx context.Context, r io.Reader) error { s.tmpFile = f.Name() if r != nil { - _, err = io.Copy(f, r) + written, err := io.Copy(f, r) if err != nil { _ = f.Close() return err } + + // CRITICAL: Sync to ensure all data is written before file is used. + // This is especially important on ZFS ARC where writes may be cached + // and reads can happen before buffers are flushed to disk. + if err := f.Sync(); err != nil { + _ = f.Close() + return fmt.Errorf("failed to sync temp file: %w", err) + } + + // Verify file size matches what we wrote (defensive check) + stat, err := f.Stat() + if err != nil { + _ = f.Close() + return fmt.Errorf("failed to stat temp file: %w", err) + } + if stat.Size() != written { + _ = f.Close() + return fmt.Errorf("file size mismatch: wrote %d bytes but file is %d bytes", written, stat.Size()) + } } return nil @@ -142,6 +161,7 @@ func (s *s3Manager) SaveC1Z(ctx context.Context) error { if err != nil { return err } + defer f.Close() if s.client == nil { return fmt.Errorf("attempting to save to s3 without a valid client") diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/resouce_types.go b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/resouce_types.go index fd6aa580..ee02a847 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/resouce_types.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/resouce_types.go @@ -4,8 +4,6 @@ import ( "context" "fmt" - "google.golang.org/protobuf/proto" - "github.com/doug-martin/goqu/v9" v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" @@ -53,21 +51,11 @@ func (c *C1File) ListResourceTypes(ctx context.Context, request *v2.ResourceType ctx, span := tracer.Start(ctx, "C1File.ListResourceTypes") defer span.End() - objs, nextPageToken, err := c.listConnectorObjects(ctx, resourceTypes.Name(), request) + ret, nextPageToken, err := listConnectorObjects(ctx, c, resourceTypes.Name(), request, func() *v2.ResourceType { return &v2.ResourceType{} }) if err != nil { return nil, fmt.Errorf("error listing resource types: %w", err) } - ret := make([]*v2.ResourceType, 0, len(objs)) - for _, o := range objs { - rt := &v2.ResourceType{} - err = proto.Unmarshal(o, rt) - if err != nil { - return nil, err - } - ret = append(ret, rt) - } - return v2.ResourceTypesServiceListResourceTypesResponse_builder{ List: ret, NextPageToken: nextPageToken, @@ -110,6 +98,10 @@ func (c *C1File) PutResourceTypesIfNewer(ctx context.Context, resourceTypesObjs type resourceTypePutFunc func(context.Context, *C1File, string, func(m *v2.ResourceType) (goqu.Record, error), ...*v2.ResourceType) error func (c *C1File) putResourceTypesInternal(ctx context.Context, f resourceTypePutFunc, resourceTypesObjs ...*v2.ResourceType) error { + if c.readOnly { + return ErrReadOnly + } + err := f(ctx, c, resourceTypes.Name(), func(resource *v2.ResourceType) (goqu.Record, error) { return nil, nil diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/resources.go b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/resources.go index 6954ac28..7e350562 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/resources.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/resources.go @@ -5,7 +5,6 @@ import ( "fmt" "github.com/doug-martin/goqu/v9" - "google.golang.org/protobuf/proto" "github.com/conductorone/baton-sdk/pkg/annotations" @@ -62,21 +61,11 @@ func (c *C1File) ListResources(ctx context.Context, request *v2.ResourcesService ctx, span := tracer.Start(ctx, "C1File.ListResources") defer span.End() - objs, nextPageToken, err := c.listConnectorObjects(ctx, resources.Name(), request) + ret, nextPageToken, err := listConnectorObjects(ctx, c, resources.Name(), request, func() *v2.Resource { return &v2.Resource{} }) if err != nil { return nil, fmt.Errorf("error listing resources: %w", err) } - ret := make([]*v2.Resource, 0, len(objs)) - for _, o := range objs { - rt := &v2.Resource{} - err = proto.Unmarshal(o, rt) - if err != nil { - return nil, err - } - ret = append(ret, rt) - } - return v2.ResourcesServiceListResourcesResponse_builder{ List: ret, NextPageToken: nextPageToken, @@ -119,6 +108,10 @@ func (c *C1File) PutResourcesIfNewer(ctx context.Context, resourceObjs ...*v2.Re type resourcePutFunc func(context.Context, *C1File, string, func(m *v2.Resource) (goqu.Record, error), ...*v2.Resource) error func (c *C1File) putResourcesInternal(ctx context.Context, f resourcePutFunc, resourceObjs ...*v2.Resource) error { + if c.readOnly { + return ErrReadOnly + } + err := f(ctx, c, resources.Name(), func(resource *v2.Resource) (goqu.Record, error) { fields := goqu.Record{ diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/session_store.go b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/session_store.go index d4507790..c20be9d6 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/session_store.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/session_store.go @@ -3,6 +3,7 @@ package dotc1z import ( "context" "fmt" + "maps" "strings" "github.com/doug-martin/goqu/v9" @@ -215,7 +216,8 @@ func (c *C1File) Clear(ctx context.Context, opt ...sessions.SessionStoreOption) q = q.Where(goqu.C("sync_id").Eq(bag.SyncID)) if bag.Prefix != "" { - q = q.Where(goqu.C("key").Like(escapeLike(bag.Prefix) + "%")) + pattern := escapeLike(bag.Prefix) + "%" + q = q.Where(goqu.L("key LIKE ? ESCAPE '\\'", pattern)) } sql, params, err := q.ToSQL() @@ -232,14 +234,14 @@ func (c *C1File) Clear(ctx context.Context, opt ...sessions.SessionStoreOption) } // GetMany implements types.SessionStore. -func (c *C1File) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string][]byte, error) { +func (c *C1File) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string][]byte, []string, error) { bag, err := applyBag(ctx, opt...) if err != nil { - return nil, fmt.Errorf("error applying session option: %w", err) + return nil, nil, fmt.Errorf("session-get-many: error applying session option: %w", err) } if len(keys) == 0 { - return make(map[string][]byte), nil + return make(map[string][]byte), nil, nil } prefixedKeys := make([]string, len(keys)) if bag.Prefix == "" { @@ -254,98 +256,175 @@ func (c *C1File) GetMany(ctx context.Context, keys []string, opt ...sessions.Ses q = q.Select("key", "value") q = q.Where(goqu.C("sync_id").Eq(bag.SyncID)) q = q.Where(goqu.C("key").In(prefixedKeys)) + q = q.Order(goqu.C("key").Asc()) sql, params, err := q.ToSQL() if err != nil { - return nil, fmt.Errorf("error getting many sessions: %w", err) + return nil, nil, fmt.Errorf("session-get-many: error generating SQL: %w", err) } rows, err := c.db.QueryContext(ctx, sql, params...) if err != nil { - return nil, fmt.Errorf("error getting many sessions: %w", err) + return nil, nil, fmt.Errorf("session-get-many: error executing SQL: %w", err) } defer rows.Close() - result := make(map[string][]byte) + unprocessedKeys := make(map[string]struct{}, len(keys)) + // Initialize unprocessedKeys with all keys - we'll remove them as we process results + // Start by calculating size of all unprocessed keys (they'll be in the return slice) + + type item struct { + key string + value []byte + } + results := make([]item, 0, len(keys)) + messageSize := 0 for rows.Next() { var key string var value []byte err = rows.Scan(&key, &value) if err != nil { - return nil, fmt.Errorf("error scanning session: %w", err) + return nil, nil, fmt.Errorf("session-get-many: error scanning row: %w", err) } // Remove prefix from key to return original key if bag.Prefix != "" && len(key) >= len(bag.Prefix) && key[:len(bag.Prefix)] == bag.Prefix { key = key[len(bag.Prefix):] } - result[key] = value + results = append(results, item{key: key, value: value}) + // 10 is extra padding. The key goes into the response unconditionally. + messageSize += len(key) + 10 } if err := rows.Err(); err != nil { - return nil, fmt.Errorf("error getting data from session: %w", err) + return nil, nil, fmt.Errorf("session-get-many: error getting data from session: %w", err) + } + + ret := make(map[string][]byte) + for _, r := range results { + value := r.value + key := r.key + + netItemSize := len(value) + 10 // 10 is extra padding for overhead. + if messageSize+netItemSize <= sessions.MaxSessionStoreSizeLimit { + messageSize += netItemSize + ret[key] = value + } else { + unprocessedKeys[key] = struct{}{} + } } - return result, nil + unprocessedKeysSlice := make([]string, 0, len(unprocessedKeys)) + for key := range unprocessedKeys { + unprocessedKeysSlice = append(unprocessedKeysSlice, key) + } + return ret, unprocessedKeysSlice, nil } // GetAll implements types.SessionStore. func (c *C1File) GetAll(ctx context.Context, pageToken string, opt ...sessions.SessionStoreOption) (map[string][]byte, string, error) { bag, err := applyBag(ctx, opt...) if err != nil { - return nil, "", fmt.Errorf("error applying session option: %w", err) + return nil, "", fmt.Errorf("session-get-all: error applying session option: %w", err) + } + + result := make(map[string][]byte) + messageSizeRemaining := sessions.MaxSessionStoreSizeLimit + for { + items, nextPageToken, itemsSize, err := c.getAllChunk(ctx, pageToken, messageSizeRemaining, bag) + if err != nil { + return nil, "", fmt.Errorf("session-get-all: error getting all data from session: %w", err) + } + maps.Copy(result, items) + + if len(items) == 0 { + break + } + + if nextPageToken == "" { + pageToken = "" + break + } + + if pageToken == nextPageToken { + return nil, "", fmt.Errorf("page token is the same as the next page token: %s", pageToken) + } + pageToken = nextPageToken + + messageSizeRemaining -= itemsSize + if messageSizeRemaining <= 0 { + break + } } + return result, pageToken, nil +} + +func (c *C1File) getAllChunk(ctx context.Context, pageToken string, sizeLimit int, bag *sessions.SessionStoreBag) (map[string][]byte, string, int, error) { q := c.db.From(sessionStore.Name()).Prepared(true). Select("key", "value"). Where(goqu.C("sync_id").Eq(bag.SyncID)). Order(goqu.C("key").Asc()). - Limit(101) + Limit(100) if bag.Prefix != "" { - q = q.Where(goqu.C("key").Like(escapeLike(bag.Prefix) + "%")) + pattern := escapeLike(bag.Prefix) + "%" + q = q.Where(goqu.L("key LIKE ? ESCAPE '\\'", pattern)) } if pageToken != "" { - q = q.Where(goqu.C("key").Gte(pageToken)) + q = q.Where(goqu.C("key").Gte(bag.Prefix + pageToken)) } sql, params, err := q.ToSQL() - if err != nil { - return nil, "", fmt.Errorf("error getting all sessions: %w", err) + return nil, "", 0, fmt.Errorf("session-get-all: error generating SQL: %w", err) } rows, err := c.db.QueryContext(ctx, sql, params...) if err != nil { - return nil, "", fmt.Errorf("error getting all sessions: %w", err) + return nil, "", 0, fmt.Errorf("session-get-all: error executing SQL: %w", err) } defer rows.Close() result := make(map[string][]byte) nextPageToken := "" - i := 0 + messageSize := 0 + tooBig := false for rows.Next() { var key string var value []byte err = rows.Scan(&key, &value) if err != nil { - return nil, "", fmt.Errorf("error scanning session: %w", err) - } - i++ - if i > 100 { - nextPageToken = key - break + return nil, "", 0, fmt.Errorf("session-get-all: error scanning row: %w", err) } // Remove prefix from key to return original key if bag.Prefix != "" && len(key) >= len(bag.Prefix) && key[:len(bag.Prefix)] == bag.Prefix { key = key[len(bag.Prefix):] } + nextPageToken = key + itemSize := len(key) + len(value) + 20 + if messageSize+itemSize > sizeLimit { + tooBig = true + break + } + if len(result) >= 100 { + break + } result[key] = value + messageSize += itemSize } if err := rows.Err(); err != nil { - return nil, "", fmt.Errorf("error getting data from session: %w", err) + return nil, "", 0, fmt.Errorf("session-get-all: error getting data from session: %w", err) + } + + if tooBig { + return result, nextPageToken, messageSize, nil + } + + if len(result) < 100 { + return result, "", messageSize, nil } - return result, nextPageToken, nil + return result, nextPageToken, messageSize, nil } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/sql_helpers.go b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/sql_helpers.go index 07b04513..296da43f 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/sql_helpers.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/sql_helpers.go @@ -2,9 +2,12 @@ package dotc1z import ( "context" + "database/sql" "errors" "fmt" + "runtime" "strconv" + "sync" "time" "github.com/doug-martin/goqu/v9" @@ -19,8 +22,13 @@ import ( v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" ) +const bulkPutParallelThreshold = 100 +const insertChunkSize = 200 const maxPageSize = 10000 +// Use worker pool to limit goroutines. +var numWorkers = min(max(runtime.GOMAXPROCS(0), 1), 4) + var allTableDescriptors = []tableDescriptor{ resourceTypes, resources, @@ -33,7 +41,7 @@ var allTableDescriptors = []tableDescriptor{ type tableDescriptor interface { Name() string - Schema() (string, []interface{}) + Schema() (string, []any) Version() string Migrations(ctx context.Context, db *goqu.Database) error } @@ -70,6 +78,11 @@ type hasPrincipalIdListRequest interface { GetPrincipalId() *v2.ResourceId } +type hasPrincipalResourceTypeIDsListRequest interface { + listRequest + GetPrincipalResourceTypeIds() []string +} + type protoHasID interface { proto.Message GetId() string @@ -93,8 +106,8 @@ func (c *C1File) throttledWarnSlowQuery(ctx context.Context, query string, durat } // listConnectorObjects uses a connector list request to fetch the corresponding data from the local db. -// It returns the raw bytes that need to be unmarshalled into the correct proto message. -func (c *C1File) listConnectorObjects(ctx context.Context, tableName string, req proto.Message) ([][]byte, string, error) { +// It returns a slice of typed proto messages constructed via the provided factory function. +func listConnectorObjects[T proto.Message](ctx context.Context, c *C1File, tableName string, req listRequest, factory func() T) ([]T, string, error) { ctx, span := tracer.Start(ctx, "C1File.listConnectorObjects") defer span.End() @@ -103,13 +116,7 @@ func (c *C1File) listConnectorObjects(ctx context.Context, tableName string, req return nil, "", err } - // If this doesn't look like a list request, bail - listReq, ok := req.(listRequest) - if !ok { - return nil, "", fmt.Errorf("c1file: invalid list request") - } - - annoSyncID, err := annotations.GetSyncIdFromAnnotations(listReq.GetAnnotations()) + annoSyncID, err := annotations.GetSyncIdFromAnnotations(req.GetAnnotations()) if err != nil { return nil, "", fmt.Errorf("error getting sync id from annotations for list request: %w", err) } @@ -175,37 +182,36 @@ func (c *C1File) listConnectorObjects(ctx context.Context, tableName string, req } } + if principalResourceTypeIDsReq, ok := req.(hasPrincipalResourceTypeIDsListRequest); ok { + p := principalResourceTypeIDsReq.GetPrincipalResourceTypeIds() + if len(p) > 0 { + q = q.Where(goqu.C("principal_resource_type_id").In(p)) + } + } + // If a sync is running, be sure we only select from the current values switch { case reqSyncID != "": q = q.Where(goqu.C("sync_id").Eq(reqSyncID)) default: - var latestSyncRun *syncRun - var err error - latestSyncRun, err = c.getFinishedSync(ctx, 0, connectorstore.SyncTypeFull) + // Use cached sync run to avoid N+1 queries during pagination + latestSyncRun, err := c.getCachedViewSyncRun(ctx) if err != nil { return nil, "", err } - if latestSyncRun == nil { - latestSyncRun, err = c.getLatestUnfinishedSync(ctx, connectorstore.SyncTypeAny) - if err != nil { - return nil, "", err - } - } - if latestSyncRun != nil { q = q.Where(goqu.C("sync_id").Eq(latestSyncRun.ID)) } } // If a page token is provided, begin listing rows greater than or equal to the token - if listReq.GetPageToken() != "" { - q = q.Where(goqu.C("id").Gte(listReq.GetPageToken())) + if req.GetPageToken() != "" { + q = q.Where(goqu.C("id").Gte(req.GetPageToken())) } // Clamp the page size - pageSize := listReq.GetPageSize() + pageSize := req.GetPageSize() if pageSize > maxPageSize || pageSize == 0 { pageSize = maxPageSize } @@ -215,8 +221,6 @@ func (c *C1File) listConnectorObjects(ctx context.Context, tableName string, req // Select 1 more than we asked for so we know if there is another page q = q.Limit(uint(pageSize + 1)) - var ret [][]byte - query, args, err := q.ToSQL() if err != nil { return nil, "", err @@ -240,21 +244,29 @@ func (c *C1File) listConnectorObjects(ctx context.Context, tableName string, req c.throttledWarnSlowQuery(ctx, query, queryDuration) } + var unmarshalerOptions = proto.UnmarshalOptions{ + Merge: true, + DiscardUnknown: true, + } var count uint32 = 0 lastRow := 0 + var data sql.RawBytes + var ret []T for rows.Next() { count++ if count > pageSize { break } - rowId := 0 - data := make([]byte, 0) - err := rows.Scan(&rowId, &data) + err := rows.Scan(&lastRow, &data) if err != nil { return nil, "", err } - lastRow = rowId - ret = append(ret, data) + t := factory() + err = unmarshalerOptions.Unmarshal(data, t) + if err != nil { + return nil, "", err + } + ret = append(ret, t) } if rows.Err() != nil { return nil, "", rows.Err() @@ -264,48 +276,159 @@ func (c *C1File) listConnectorObjects(ctx context.Context, tableName string, req if count > pageSize { nextPageToken = strconv.Itoa(lastRow + 1) } - return ret, nextPageToken, nil } +// This is required for sync diffs to work. Its not much slower. var protoMarshaler = proto.MarshalOptions{Deterministic: true} -// prepareConnectorObjectRows prepares the rows for bulk insertion. -func prepareConnectorObjectRows[T proto.Message]( +// prepareSingleConnectorObjectRow processes a single message and returns the prepared record. +func prepareSingleConnectorObjectRow[T proto.Message]( + c *C1File, + msg T, + extractFields func(m T) (goqu.Record, error), +) (*goqu.Record, error) { + messageBlob, err := protoMarshaler.Marshal(msg) + if err != nil { + return nil, err + } + + fields, err := extractFields(msg) + if err != nil { + return nil, err + } + if fields == nil { + fields = goqu.Record{} + } + + if _, idSet := fields["external_id"]; !idSet { + idGetter, ok := any(msg).(protoHasID) + if !ok { + return nil, fmt.Errorf("unable to get ID for object") + } + fields["external_id"] = idGetter.GetId() + } + fields["data"] = messageBlob + fields["sync_id"] = c.currentSyncID + fields["discovered_at"] = time.Now().Format("2006-01-02 15:04:05.999999999") + + return &fields, nil +} + +// prepareConnectorObjectRowsSerial prepares rows sequentially for bulk insertion. +func prepareConnectorObjectRowsSerial[T proto.Message]( c *C1File, msgs []T, extractFields func(m T) (goqu.Record, error), ) ([]*goqu.Record, error) { rows := make([]*goqu.Record, len(msgs)) for i, m := range msgs { - messageBlob, err := protoMarshaler.Marshal(m) + row, err := prepareSingleConnectorObjectRow(c, m, extractFields) if err != nil { return nil, err } + rows[i] = row + } + return rows, nil +} - fields, err := extractFields(m) - if err != nil { - return nil, err - } - if fields == nil { - fields = goqu.Record{} +// prepareConnectorObjectRowsParallel prepares rows for bulk insertion using parallel processing. +// For batches smaller than bulkPutParallelThreshold, it falls back to sequential processing. +func prepareConnectorObjectRowsParallel[T proto.Message]( + c *C1File, + msgs []T, + extractFields func(m T) (goqu.Record, error), +) ([]*goqu.Record, error) { + if len(msgs) == 0 { + return nil, nil + } + + protoMarshallers := make([]proto.MarshalOptions, numWorkers) + for i := range numWorkers { + // Deterministic marshaling is required for sync diffs to work. Its not much slower. + protoMarshallers[i] = proto.MarshalOptions{Deterministic: true} + } + + rows := make([]*goqu.Record, len(msgs)) + errs := make([]error, len(msgs)) + + // Capture values that are the same for all rows (avoid repeated access) + syncID := c.currentSyncID + discoveredAt := time.Now().Format("2006-01-02 15:04:05.999999999") + + chunkSize := (len(msgs) + numWorkers - 1) / numWorkers + + var wg sync.WaitGroup + + for w := range numWorkers { + start := w * chunkSize + end := min(start+chunkSize, len(msgs)) + if start >= len(msgs) { + break } - if _, idSet := fields["external_id"]; !idSet { - idGetter, ok := any(m).(protoHasID) - if !ok { - return nil, fmt.Errorf("unable to get ID for object") + wg.Add(1) + go func(start, end int, worker int) { + defer wg.Done() + for i := start; i < end; i++ { + m := msgs[i] + + messageBlob, err := protoMarshallers[worker].Marshal(m) + if err != nil { + errs[i] = err + continue + } + + fields, err := extractFields(m) + if err != nil { + errs[i] = err + continue + } + if fields == nil { + fields = goqu.Record{} + } + + if _, idSet := fields["external_id"]; !idSet { + idGetter, ok := any(m).(protoHasID) + if !ok { + errs[i] = fmt.Errorf("unable to get ID for object at index %d", i) + continue + } + fields["external_id"] = idGetter.GetId() + } + fields["data"] = messageBlob + fields["sync_id"] = syncID + fields["discovered_at"] = discoveredAt + rows[i] = &fields } - fields["external_id"] = idGetter.GetId() + }(start, end, w) + } + + wg.Wait() + + // Check for errors (return first error encountered) + for i, err := range errs { + if err != nil { + return nil, fmt.Errorf("error preparing row %d: %w", i, err) } - fields["data"] = messageBlob - fields["sync_id"] = c.currentSyncID - fields["discovered_at"] = time.Now().Format("2006-01-02 15:04:05.999999999") - rows[i] = &fields } + return rows, nil } +// prepareConnectorObjectRows prepares the rows for bulk insertion. +// It uses parallel processing if the row count is greater than bulkPutParallelThreshold. +func prepareConnectorObjectRows[T proto.Message]( + c *C1File, + msgs []T, + extractFields func(m T) (goqu.Record, error), +) ([]*goqu.Record, error) { + if len(msgs) > bulkPutParallelThreshold { + return prepareConnectorObjectRowsParallel(c, msgs, extractFields) + } + return prepareConnectorObjectRowsSerial(c, msgs, extractFields) +} + // executeChunkedInsert executes the insert query in chunks. func executeChunkedInsert( ctx context.Context, @@ -314,7 +437,7 @@ func executeChunkedInsert( rows []*goqu.Record, buildQueryFn func(*goqu.InsertDataset, []*goqu.Record) (*goqu.InsertDataset, error), ) error { - chunkSize := 100 + chunkSize := insertChunkSize chunks := len(rows) / chunkSize if len(rows)%chunkSize != 0 { chunks++ diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/sync_runs.go b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/sync_runs.go index 49fe3f8f..4426a3e5 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/sync_runs.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/dotc1z/sync_runs.go @@ -32,7 +32,8 @@ create table if not exists %s ( ended_at datetime, sync_token text not null, sync_type text not null default 'full', - parent_sync_id text not null default '' + parent_sync_id text not null default '', + linked_sync_id text not null default '' ); create unique index if not exists %s on %s (sync_id);` @@ -83,6 +84,19 @@ func (r *syncRunsTable) Migrations(ctx context.Context, db *goqu.Database) error } } + // Check if linked_sync_id column exists + var linkedSyncIDExists int + err = db.QueryRowContext(ctx, fmt.Sprintf("select count(*) from pragma_table_info('%s') where name='linked_sync_id'", r.Name())).Scan(&linkedSyncIDExists) + if err != nil { + return err + } + if linkedSyncIDExists == 0 { + _, err = db.ExecContext(ctx, fmt.Sprintf("alter table %s add column linked_sync_id text not null default ''", r.Name())) + if err != nil { + return err + } + } + return nil } @@ -93,6 +107,43 @@ type syncRun struct { SyncToken string Type connectorstore.SyncType ParentSyncID string + LinkedSyncID string +} + +// getCachedViewSyncRun returns the cached sync run for read operations. +// This avoids N+1 queries when paginating through listConnectorObjects. +// The cache is invalidated when a sync starts or ends. +func (c *C1File) getCachedViewSyncRun(ctx context.Context) (*syncRun, error) { + ctx, span := tracer.Start(ctx, "C1File.getCachedViewSyncRun") + defer span.End() + + c.cachedViewSyncMu.Lock() + defer c.cachedViewSyncMu.Unlock() + + if c.cachedViewSyncRun != nil || c.cachedViewSyncErr != nil { + return c.cachedViewSyncRun, c.cachedViewSyncErr + } + + // First try to get a finished full sync + c.cachedViewSyncRun, c.cachedViewSyncErr = c.getFinishedSync(ctx, 0, connectorstore.SyncTypeFull) + if c.cachedViewSyncErr != nil { + return c.cachedViewSyncRun, c.cachedViewSyncErr + } + + // If no finished sync, try to get an unfinished one + if c.cachedViewSyncRun == nil { + c.cachedViewSyncRun, c.cachedViewSyncErr = c.getLatestUnfinishedSync(ctx, connectorstore.SyncTypeAny) + } + + return c.cachedViewSyncRun, c.cachedViewSyncErr +} + +// invalidateCachedViewSyncRun clears the cached sync run so it will be recomputed on next access. +func (c *C1File) invalidateCachedViewSyncRun() { + c.cachedViewSyncMu.Lock() + defer c.cachedViewSyncMu.Unlock() + c.cachedViewSyncRun = nil + c.cachedViewSyncErr = nil } func (c *C1File) getLatestUnfinishedSync(ctx context.Context, syncType connectorstore.SyncType) (*syncRun, error) { @@ -108,7 +159,7 @@ func (c *C1File) getLatestUnfinishedSync(ctx context.Context, syncType connector oneWeekAgo := time.Now().AddDate(0, 0, -7) ret := &syncRun{} q := c.db.From(syncRuns.Name()) - q = q.Select("sync_id", "started_at", "ended_at", "sync_token", "sync_type", "parent_sync_id") + q = q.Select("sync_id", "started_at", "ended_at", "sync_token", "sync_type", "parent_sync_id", "linked_sync_id") q = q.Where(goqu.C("ended_at").IsNull()) q = q.Where(goqu.C("started_at").Gte(oneWeekAgo)) q = q.Order(goqu.C("started_at").Desc()) @@ -124,7 +175,7 @@ func (c *C1File) getLatestUnfinishedSync(ctx context.Context, syncType connector row := c.db.QueryRowContext(ctx, query, args...) - err = row.Scan(&ret.ID, &ret.StartedAt, &ret.EndedAt, &ret.SyncToken, &ret.Type, &ret.ParentSyncID) + err = row.Scan(&ret.ID, &ret.StartedAt, &ret.EndedAt, &ret.SyncToken, &ret.Type, &ret.ParentSyncID, &ret.LinkedSyncID) if err != nil { if errors.Is(err, sql.ErrNoRows) { return nil, nil @@ -151,7 +202,7 @@ func (c *C1File) getFinishedSync(ctx context.Context, offset uint, syncType conn ret := &syncRun{} q := c.db.From(syncRuns.Name()) - q = q.Select("sync_id", "started_at", "ended_at", "sync_token", "sync_type", "parent_sync_id") + q = q.Select("sync_id", "started_at", "ended_at", "sync_token", "sync_type", "parent_sync_id", "linked_sync_id") q = q.Where(goqu.C("ended_at").IsNotNull()) if syncType != connectorstore.SyncTypeAny { q = q.Where(goqu.C("sync_type").Eq(syncType)) @@ -170,7 +221,7 @@ func (c *C1File) getFinishedSync(ctx context.Context, offset uint, syncType conn row := c.db.QueryRowContext(ctx, query, args...) - err = row.Scan(&ret.ID, &ret.StartedAt, &ret.EndedAt, &ret.SyncToken, &ret.Type, &ret.ParentSyncID) + err = row.Scan(&ret.ID, &ret.StartedAt, &ret.EndedAt, &ret.SyncToken, &ret.Type, &ret.ParentSyncID, &ret.LinkedSyncID) if err != nil { if errors.Is(err, sql.ErrNoRows) { return nil, nil @@ -191,7 +242,7 @@ func (c *C1File) ListSyncRuns(ctx context.Context, pageToken string, pageSize ui } q := c.db.From(syncRuns.Name()).Prepared(true) - q = q.Select("id", "sync_id", "started_at", "ended_at", "sync_token", "sync_type", "parent_sync_id") + q = q.Select("id", "sync_id", "started_at", "ended_at", "sync_token", "sync_type", "parent_sync_id", "linked_sync_id") if pageToken != "" { q = q.Where(goqu.C("id").Gte(pageToken)) @@ -226,7 +277,7 @@ func (c *C1File) ListSyncRuns(ctx context.Context, pageToken string, pageSize ui } rowId := 0 data := &syncRun{} - err := rows.Scan(&rowId, &data.ID, &data.StartedAt, &data.EndedAt, &data.SyncToken, &data.Type, &data.ParentSyncID) + err := rows.Scan(&rowId, &data.ID, &data.StartedAt, &data.EndedAt, &data.SyncToken, &data.Type, &data.ParentSyncID, &data.LinkedSyncID) if err != nil { return nil, "", err } @@ -315,7 +366,7 @@ func (c *C1File) getSync(ctx context.Context, syncID string) (*syncRun, error) { ret := &syncRun{} q := c.db.From(syncRuns.Name()) - q = q.Select("sync_id", "started_at", "ended_at", "sync_token", "sync_type", "parent_sync_id") + q = q.Select("sync_id", "started_at", "ended_at", "sync_token", "sync_type", "parent_sync_id", "linked_sync_id") q = q.Where(goqu.C("sync_id").Eq(syncID)) query, args, err := q.ToSQL() @@ -323,7 +374,7 @@ func (c *C1File) getSync(ctx context.Context, syncID string) (*syncRun, error) { return nil, err } row := c.db.QueryRowContext(ctx, query, args...) - err = row.Scan(&ret.ID, &ret.StartedAt, &ret.EndedAt, &ret.SyncToken, &ret.Type, &ret.ParentSyncID) + err = row.Scan(&ret.ID, &ret.StartedAt, &ret.EndedAt, &ret.SyncToken, &ret.Type, &ret.ParentSyncID, &ret.LinkedSyncID) if err != nil { return nil, err } @@ -359,6 +410,10 @@ func (c *C1File) CheckpointSync(ctx context.Context, syncToken string) error { ctx, span := tracer.Start(ctx, "C1File.CheckpointSync") defer span.End() + if c.readOnly { + return ErrReadOnly + } + err := c.validateSyncDb(ctx) if err != nil { return err @@ -468,6 +523,12 @@ func (c *C1File) StartOrResumeSync(ctx context.Context, syncType connectorstore. return c.currentSyncID, true, nil } +// SetSyncID sets the current sync ID. This is only intended for testing. +func (c *C1File) SetSyncID(_ context.Context, syncID string) error { + c.currentSyncID = syncID + return nil +} + func (c *C1File) StartNewSync(ctx context.Context, syncType connectorstore.SyncType, parentSyncID string) (string, error) { ctx, span := tracer.Start(ctx, "C1File.StartNewSync") defer span.End() @@ -506,11 +567,20 @@ func (c *C1File) StartNewSync(ctx context.Context, syncType connectorstore.SyncT } c.currentSyncID = syncID + c.invalidateCachedViewSyncRun() return c.currentSyncID, nil } func (c *C1File) insertSyncRun(ctx context.Context, syncID string, syncType connectorstore.SyncType, parentSyncID string) error { + return c.insertSyncRunWithLink(ctx, syncID, syncType, parentSyncID, "") +} + +func (c *C1File) insertSyncRunWithLink(ctx context.Context, syncID string, syncType connectorstore.SyncType, parentSyncID string, linkedSyncID string) error { + if c.readOnly { + return ErrReadOnly + } + q := c.db.Insert(syncRuns.Name()) q = q.Rows(goqu.Record{ "sync_id": syncID, @@ -518,6 +588,7 @@ func (c *C1File) insertSyncRun(ctx context.Context, syncID string, syncType conn "sync_token": "", "sync_type": syncType, "parent_sync_id": parentSyncID, + "linked_sync_id": linkedSyncID, }) query, args, err := q.ToSQL() @@ -560,6 +631,7 @@ func (c *C1File) EndSync(ctx context.Context) error { } c.currentSyncID = "" + c.invalidateCachedViewSyncRun() return nil } @@ -607,8 +679,9 @@ func (c *C1File) Cleanup(ctx context.Context) error { return nil } - var ret []*syncRun + var fullSyncs []*syncRun var partials []*syncRun + var diffSyncs []*syncRun pageToken := "" for { @@ -621,10 +694,13 @@ func (c *C1File) Cleanup(ctx context.Context) error { if sr.EndedAt == nil { continue } - if sr.Type == connectorstore.SyncTypePartial || sr.Type == connectorstore.SyncTypeResourcesOnly { + switch sr.Type { + case connectorstore.SyncTypePartial, connectorstore.SyncTypeResourcesOnly: partials = append(partials, sr) - } else { - ret = append(ret, sr) + case connectorstore.SyncTypePartialUpserts, connectorstore.SyncTypePartialDeletions: + diffSyncs = append(diffSyncs, sr) + default: + fullSyncs = append(fullSyncs, sr) } } @@ -635,27 +711,31 @@ func (c *C1File) Cleanup(ctx context.Context) error { } syncLimit := 2 - if customSyncLimit, err := strconv.ParseInt(os.Getenv("BATON_KEEP_SYNC_COUNT"), 10, 64); err == nil && customSyncLimit > 0 { + if c.syncLimit > 0 { + syncLimit = c.syncLimit + } else if customSyncLimit, err := strconv.ParseInt(os.Getenv("BATON_KEEP_SYNC_COUNT"), 10, 64); err == nil && customSyncLimit > 0 { syncLimit = int(customSyncLimit) } - l.Debug("found syncs", zap.Int("count", len(ret)), zap.Int("sync_limit", syncLimit)) - if len(ret) <= syncLimit { - return nil - } + l.Debug("found syncs", + zap.Int("full_count", len(fullSyncs)), + zap.Int("partial_count", len(partials)), + zap.Int("diff_count", len(diffSyncs)), + zap.Int("sync_limit", syncLimit)) - l.Info("Cleaning up old sync data...") - for i := 0; i < len(ret)-syncLimit; i++ { - err = c.DeleteSyncRun(ctx, ret[i].ID) - if err != nil { - return err + // Clean up old full syncs beyond the limit + if len(fullSyncs) > syncLimit { + l.Info("Cleaning up old sync data...") + for i := 0; i < len(fullSyncs)-syncLimit; i++ { + err = c.DeleteSyncRun(ctx, fullSyncs[i].ID) + if err != nil { + return err + } + l.Info("Removed old sync data.", zap.String("sync_date", fullSyncs[i].EndedAt.Format(time.RFC3339)), zap.String("sync_id", fullSyncs[i].ID)) } - l.Info("Removed old sync data.", zap.String("sync_date", ret[i].EndedAt.Format(time.RFC3339)), zap.String("sync_id", ret[i].ID)) - } - // Delete non-full syncs that ended before the earliest-kept full sync started - if len(ret) > syncLimit { - earliestKeptSync := ret[len(ret)-syncLimit] + // Delete partial syncs that ended before the earliest-kept full sync started + earliestKeptSync := fullSyncs[len(fullSyncs)-syncLimit] l.Debug("Earliest kept sync", zap.String("sync_id", earliestKeptSync.ID), zap.Time("started_at", *earliestKeptSync.StartedAt)) for _, partial := range partials { @@ -672,6 +752,56 @@ func (c *C1File) Cleanup(ctx context.Context) error { } } + // Clean up old diff syncs - keep only the most recent diff sync (upserts or deletions) and its linked pair (if present) + if len(diffSyncs) > 2 { + // Build a map for quick lookup by ID + syncByID := make(map[string]*syncRun) + for _, ds := range diffSyncs { + syncByID[ds.ID] = ds + } + + // Determine which syncs to keep. diffSyncs are ordered by row id (ascending), + // so the last element is the most recently created diff sync. + keepIDs := make(map[string]bool) + latestDiff := diffSyncs[len(diffSyncs)-1] + keepIDs[latestDiff.ID] = true + l.Debug("keeping latest diff sync", + zap.String("sync_id", latestDiff.ID), + zap.String("sync_type", string(latestDiff.Type))) + + // Also keep its linked pair if it exists. + // NOTE: We intentionally do NOT require a bidirectional link; if the latest diff sync exists, + // it's better to keep it and best-effort keep its linked partner (if present). + if latestDiff.LinkedSyncID != "" { + if linkedSync := syncByID[latestDiff.LinkedSyncID]; linkedSync != nil { + keepIDs[linkedSync.ID] = true + l.Debug("keeping linked diff sync", + zap.String("sync_id", linkedSync.ID), + zap.String("sync_type", string(linkedSync.Type))) + if linkedSync.LinkedSyncID != latestDiff.ID { + l.Warn("diff sync link is not bidirectional", + zap.String("sync_id", latestDiff.ID), + zap.String("linked_sync_id", latestDiff.LinkedSyncID), + zap.String("linked_sync_linked_sync_id", linkedSync.LinkedSyncID)) + } + } + } + + // Delete all diff syncs except the ones we're keeping + for _, ds := range diffSyncs { + if keepIDs[ds.ID] { + continue + } + err = c.DeleteSyncRun(ctx, ds.ID) + if err != nil { + return err + } + l.Info("Removed old diff sync.", + zap.String("sync_type", string(ds.Type)), + zap.String("sync_id", ds.ID)) + } + } + l.Debug("vacuuming database") err = c.Vacuum(ctx) if err != nil { diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/field/default_relationships.go b/vendor/github.com/conductorone/baton-sdk/pkg/field/default_relationships.go index bc995d11..6136cc84 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/field/default_relationships.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/field/default_relationships.go @@ -39,6 +39,10 @@ var DefaultRelationships = []SchemaFieldRelationship{ []SchemaField{skipGrants}, []SchemaField{targetedSyncResourceIDs}, ), + FieldsDependentOn( + []SchemaField{healthCheckPortField, healthCheckBindAddressField}, + []SchemaField{healthCheckField}, + ), } func EnsureDefaultRelationships(original []SchemaFieldRelationship) []SchemaFieldRelationship { diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/field/defaults.go b/vendor/github.com/conductorone/baton-sdk/pkg/field/defaults.go index 8a05c793..d08a0c8b 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/field/defaults.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/field/defaults.go @@ -49,6 +49,12 @@ var ( WithHidden(true), WithDescription("JSON-formatted object of map keys and values like '{ 'key': 'value' }'"), WithPersistent(true), WithExportTarget(ExportTargetNone)) + createAccountResourceTypeField = StringField("create-account-resource-type", + WithHidden(true), + WithDescription("The resource type ID of the account to create"), + WithPersistent(true), + WithExportTarget(ExportTargetNone), + ) deleteResourceField = StringField("delete-resource", WithHidden(true), WithDescription("The id of the resource to delete"), WithPersistent(true), WithExportTarget(ExportTargetNone)) deleteResourceTypeField = StringField("delete-resource-type", WithHidden(true), WithDescription("The type of the resource to delete"), WithPersistent(true), WithExportTarget(ExportTargetNone)) eventFeedField = StringField("event-feed", WithHidden(true), WithDescription("Read feed events to stdout"), WithPersistent(true), WithExportTarget(ExportTargetNone)) @@ -109,6 +115,7 @@ var ( WithExportTarget(ExportTargetNone), WithHidden(true), ) + syncResourceTypeIDs = StringSliceField("sync-resource-types", WithDescription("The resource type IDs to sync"), WithPersistent(true), @@ -171,6 +178,52 @@ var ( WithPersistent(true), WithExportTarget(ExportTargetNone), ) + invokeActionResourceTypeField = StringField("invoke-action-resource-type", + WithHidden(true), + WithDescription("The resource type ID for resource-scoped actions"), + WithPersistent(true), + WithExportTarget(ExportTargetNone), + ) + + listActionSchemasField = BoolField("list-action-schemas", + WithHidden(true), + WithDescription("List available action schemas"), + WithPersistent(true), + WithExportTarget(ExportTargetNone), + ) + listActionSchemasResourceTypeField = StringField("list-action-schemas-resource-type", + WithHidden(true), + WithDescription("Filter action schemas by resource type ID"), + WithPersistent(true), + WithExportTarget(ExportTargetNone), + ) + + listResourceActionsField = StringField("list-resource-actions", + WithDescription("The resource type ID to list actions for"), + WithHidden(true), + WithPersistent(true), + WithExportTarget(ExportTargetNone), + ) + + invokeResourceActionField = StringField("invoke-resource-action", + WithDescription("The name of the action to invoke"), + WithHidden(true), + WithPersistent(true), + WithExportTarget(ExportTargetNone), + ) + invokeResourceActionTypeField = StringField("invoke-resource-action-resource-type", + WithDescription("The resource type of the action to invoke"), + WithHidden(true), + WithPersistent(true), + WithExportTarget(ExportTargetNone), + ) + invokeResourceActionArgsField = StringField("invoke-resource-action-args", + WithHidden(true), + WithDescription("JSON-formatted object of map keys and values like '{ 'key': 'value' }'"), + WithDefaultValue("{}"), + WithPersistent(true), + WithExportTarget(ExportTargetNone), + ) otelCollectorEndpoint = StringField(OtelCollectorEndpointFieldName, WithDescription("The endpoint of the OpenTelemetry collector to send observability data to (used for both tracing and logging if specific endpoints are not provided)"), @@ -237,6 +290,25 @@ var ( WithExportTarget(ExportTargetOps), WithHidden(true), WithPersistent(true)) + + healthCheckField = BoolField("health-check", + WithDescription("Enable the HTTP health check endpoint"), + WithDefaultValue(false), + WithPersistent(true), + WithExportTarget(ExportTargetOps)) + + healthCheckPortField = IntField("health-check-port", + WithDescription("Port for the HTTP health check endpoint"), + WithDefaultValue(8081), + WithPersistent(true), + WithExportTarget(ExportTargetOps)) + + healthCheckBindAddressField = StringField("health-check-bind-address", + WithDescription("Bind address for health check server (127.0.0.1 for localhost-only)"), + WithDefaultValue("127.0.0.1"), + WithPersistent(true), + WithHidden(true), + WithExportTarget(ExportTargetOps)) ) func LambdaServerFields() []SchemaField { @@ -268,6 +340,7 @@ var DefaultFields = []SchemaField{ createAccountEmailField, createAccountLoginField, createAccountProfileField, + createAccountResourceTypeField, deleteResourceField, deleteResourceTypeField, eventFeedField, @@ -302,6 +375,13 @@ var DefaultFields = []SchemaField{ compactSyncsField, invokeActionField, invokeActionArgsField, + invokeActionResourceTypeField, + listActionSchemasField, + listActionSchemasResourceTypeField, + listResourceActionsField, + invokeResourceActionField, + invokeResourceActionTypeField, + invokeResourceActionArgsField, ServerSessionStoreMaximumSizeField, otelCollectorEndpoint, @@ -312,6 +392,10 @@ var DefaultFields = []SchemaField{ otelLoggingDisabled, authMethod, + + healthCheckField, + healthCheckPortField, + healthCheckBindAddressField, } func IsFieldAmongDefaultList(f SchemaField) bool { diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/field/rule_builders.go b/vendor/github.com/conductorone/baton-sdk/pkg/field/rule_builders.go index 4e7afef7..9dc2b4de 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/field/rule_builders.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/field/rule_builders.go @@ -238,3 +238,36 @@ func (b *StringSliceRuler) ItemRules(f func(stringer *StringRuler)) *StringSlice f(b.stringer) return b } + +type ResourceIdSliceRuler struct { + rules *v1_conf.RepeatedResourceIdRules +} + +func NewRepeatedResourceIdBuilder(rules *v1_conf.RepeatedResourceIdRules) *ResourceIdSliceRuler { + return &ResourceIdSliceRuler{rules: rules} +} + +func (b *ResourceIdSliceRuler) MinItems(value uint64) *ResourceIdSliceRuler { + b.rules.SetMinItems(value) + return b +} + +func (b *ResourceIdSliceRuler) MaxItems(value uint64) *ResourceIdSliceRuler { + b.rules.SetMaxItems(value) + return b +} + +func (b *ResourceIdSliceRuler) Unique(unique bool) *ResourceIdSliceRuler { + b.rules.SetUnique(unique) + return b +} + +func (b *ResourceIdSliceRuler) ValidateEmpty(value bool) *ResourceIdSliceRuler { + b.rules.SetValidateEmpty(value) + return b +} + +func (b *ResourceIdSliceRuler) AllowedResourceTypeIDs(typeIDs []string) *ResourceIdSliceRuler { + b.rules.SetAllowedResourceTypeIds(typeIDs) + return b +} diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/field/validation.go b/vendor/github.com/conductorone/baton-sdk/pkg/field/validation.go index 9ec1dff3..03c92e77 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/field/validation.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/field/validation.go @@ -306,6 +306,58 @@ func ValidateStringMapRules(r *v1_conf.StringMapRules, v map[string]any, name st return nil } +func ValidateRepeatedResourceIdRules(r *v1_conf.RepeatedResourceIdRules, v []*v1_conf.ResourceId, name string) error { + if r == nil { + return nil + } + if r.GetIsRequired() && len(v) == 0 { + return fmt.Errorf("field %s of type []*ResourceId is marked as required but it has a zero-value", name) + } + + if !r.GetValidateEmpty() && len(v) == 0 { + return nil + } + + if r.HasMinItems() && uint64(len(v)) < r.GetMinItems() { + return fmt.Errorf("field %s: value must have at least %d items but got %d", name, r.GetMinItems(), len(v)) + } + if r.HasMaxItems() && uint64(len(v)) > r.GetMaxItems() { + return fmt.Errorf("field %s: value must have at most %d items but got %d", name, r.GetMaxItems(), len(v)) + } + if r.GetUnique() { + type resourceKey struct { + typeID string + id string + } + uniqueValues := make(map[resourceKey]struct{}) + for _, item := range v { + if item == nil { + continue + } + key := resourceKey{typeID: item.GetResourceTypeId(), id: item.GetResourceId()} + if _, exists := uniqueValues[key]; exists { + return fmt.Errorf("field %s: value must not contain duplicate items but got multiple (%s, %s)", name, key.typeID, key.id) + } + uniqueValues[key] = struct{}{} + } + } + if len(r.GetAllowedResourceTypeIds()) > 0 { + allowedTypes := make(map[string]struct{}) + for _, t := range r.GetAllowedResourceTypeIds() { + allowedTypes[t] = struct{}{} + } + for i, item := range v { + if item == nil { + continue + } + if _, ok := allowedTypes[item.GetResourceTypeId()]; !ok { + return fmt.Errorf("field %s: item at index %d has resource type '%s' which is not in the allowed list %v", name, i, item.GetResourceTypeId(), r.GetAllowedResourceTypeIds()) + } + } + } + return nil +} + func (e *ErrConfigurationMissingFields) Error() string { var messages []string diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/healthcheck/server.go b/vendor/github.com/conductorone/baton-sdk/pkg/healthcheck/server.go new file mode 100644 index 00000000..1ffba6f4 --- /dev/null +++ b/vendor/github.com/conductorone/baton-sdk/pkg/healthcheck/server.go @@ -0,0 +1,214 @@ +package healthcheck + +import ( + "context" + "encoding/json" + "fmt" + "net" + "net/http" + "strconv" + "sync" + "time" + + "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" + "go.uber.org/zap" + + v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" + "github.com/conductorone/baton-sdk/pkg/types" +) + +const ( + defaultHealthCheckTimeout = 30 * time.Second + shutdownTimeout = 5 * time.Second +) + +// Config holds the configuration for the health check server. +type Config struct { + Enabled bool + Port int + BindAddress string +} + +// HealthResponse represents the JSON response for health check endpoints. +type HealthResponse struct { + Status string `json:"status"` + Timestamp string `json:"timestamp"` + Details map[string]string `json:"details,omitempty"` +} + +// ClientFunc is a function that returns a ConnectorClient. +type ClientFunc func(context.Context) (types.ConnectorClient, error) + +// Server manages the HTTP health check server lifecycle. +type Server struct { + cfg Config + clientFunc ClientFunc + server *http.Server + mu sync.Mutex + started bool + ctx context.Context +} + +// NewServer creates a new health check server. +func NewServer(cfg Config, clientFunc ClientFunc) *Server { + return &Server{ + cfg: cfg, + clientFunc: clientFunc, + } +} + +// Start starts the HTTP health check server. +func (s *Server) Start(ctx context.Context) error { + s.mu.Lock() + defer s.mu.Unlock() + + if s.started { + return fmt.Errorf("health check server already started") + } + + s.ctx = ctx + l := ctxzap.Extract(ctx) + + mux := http.NewServeMux() + + // Register health check endpoints + mux.HandleFunc("/health", s.healthHandler) + mux.HandleFunc("/ready", s.readyHandler) + mux.HandleFunc("/live", s.liveHandler) + + addr := net.JoinHostPort(s.cfg.BindAddress, strconv.Itoa(s.cfg.Port)) + lc := &net.ListenConfig{} + listener, err := lc.Listen(ctx, "tcp", addr) + if err != nil { + return fmt.Errorf("failed to create health check listener: %w", err) + } + + s.server = &http.Server{ + Handler: mux, + ReadHeaderTimeout: 10 * time.Second, + } + + s.started = true + + go func() { + l.Info("health check server starting", zap.String("address", addr)) + if err := s.server.Serve(listener); err != nil && err != http.ErrServerClosed { + l.Error("health check server error", zap.Error(err)) + } + }() + + return nil +} + +// Stop gracefully shuts down the health check server. +func (s *Server) Stop(ctx context.Context) error { + s.mu.Lock() + defer s.mu.Unlock() + + if !s.started || s.server == nil { + return nil + } + + l := ctxzap.Extract(ctx) + l.Info("stopping health check server") + + shutdownCtx, cancel := context.WithTimeout(ctx, shutdownTimeout) + defer cancel() + + if err := s.server.Shutdown(shutdownCtx); err != nil { + return fmt.Errorf("failed to shutdown health check server: %w", err) + } + + s.started = false + return nil +} + +// healthHandler handles the /health endpoint. +// It calls Validate() on the connector and returns the health status. +func (s *Server) healthHandler(w http.ResponseWriter, r *http.Request) { + ctx := s.ctx + if ctx == nil { + ctx = r.Context() + } + l := ctxzap.Extract(ctx) + + response := HealthResponse{ + Timestamp: time.Now().UTC().Format(time.RFC3339), + Details: make(map[string]string), + } + + // Get the connector client + client, err := s.clientFunc(ctx) + if err != nil { + l.Warn("health check failed: could not get connector client", zap.Error(err)) + response.Status = "unhealthy" + response.Details["error"] = "failed to get connector client" + s.writeJSON(w, http.StatusServiceUnavailable, response) + return + } + + // Call Validate() on the connector with a timeout + validateCtx, cancel := context.WithTimeout(ctx, defaultHealthCheckTimeout) + defer cancel() + + _, err = client.Validate(validateCtx, &v2.ConnectorServiceValidateRequest{}) + if err != nil { + l.Warn("health check failed: connector validation failed", zap.Error(err)) + response.Status = "unhealthy" + response.Details["error"] = "connector validation failed" + response.Details["validation_error"] = err.Error() + s.writeJSON(w, http.StatusServiceUnavailable, response) + return + } + + response.Status = "healthy" + s.writeJSON(w, http.StatusOK, response) +} + +// readyHandler handles the /ready endpoint. +// It checks if the connector client can be obtained (ready to serve). +func (s *Server) readyHandler(w http.ResponseWriter, r *http.Request) { + ctx := s.ctx + if ctx == nil { + ctx = r.Context() + } + l := ctxzap.Extract(ctx) + + response := HealthResponse{ + Timestamp: time.Now().UTC().Format(time.RFC3339), + Details: make(map[string]string), + } + + // Try to get the connector client + _, err := s.clientFunc(ctx) + if err != nil { + l.Warn("readiness check failed: could not get connector client", zap.Error(err)) + response.Status = "not_ready" + response.Details["error"] = "failed to get connector client" + s.writeJSON(w, http.StatusServiceUnavailable, response) + return + } + + response.Status = "ready" + s.writeJSON(w, http.StatusOK, response) +} + +// liveHandler handles the /live endpoint. +// It always returns HTTP 200 to indicate the process is alive. +func (s *Server) liveHandler(w http.ResponseWriter, _ *http.Request) { + response := HealthResponse{ + Status: "alive", + Timestamp: time.Now().UTC().Format(time.RFC3339), + } + s.writeJSON(w, http.StatusOK, response) +} + +// writeJSON writes a JSON response with the given status code. +func (s *Server) writeJSON(w http.ResponseWriter, statusCode int, data interface{}) { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(statusCode) + if err := json.NewEncoder(w).Encode(data); err != nil { + // If encoding fails, we can't do much about it + return + } +} diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/metrics/instrumentor.go b/vendor/github.com/conductorone/baton-sdk/pkg/metrics/instrumentor.go index 52541d43..dd6e346f 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/metrics/instrumentor.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/metrics/instrumentor.go @@ -2,9 +2,13 @@ package metrics import ( "context" + "strconv" "time" + v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" "github.com/conductorone/baton-sdk/pkg/types/tasks" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) const ( @@ -12,10 +16,41 @@ const ( taskFailureCounterName = "baton_sdk.task_failure" taskDurationHistoName = "baton_sdk.task_latency" taskSuccessCounterDesc = "number of successful tasks by task type" - taskFailureCounterDesc = "number of failed tasks by task type" + taskFailureCounterDesc = "number of failed tasks by task type, grpc code, and rate limit status" taskDurationHistoDesc = "duration of all tasks by task type and status" ) +// FailureReason contains extracted information about why a task failed. +type FailureReason struct { + GrpcCode codes.Code + IsRateLimit bool +} + +// extractFailureReason extracts the gRPC status code and rate limit information from an error. +func extractFailureReason(err error) FailureReason { + if err == nil { + return FailureReason{GrpcCode: codes.Unknown} + } + + reason := FailureReason{ + GrpcCode: status.Code(err), + } + + // Check for rate limit details in gRPC status + if st, ok := status.FromError(err); ok { + for _, detail := range st.Details() { + if rl, ok := detail.(*v2.RateLimitDescription); ok { + if rl.GetStatus() == v2.RateLimitDescription_STATUS_OVERLIMIT { + reason.IsRateLimit = true + break + } + } + } + } + + return reason +} + type M struct { underlying Handler } @@ -27,11 +62,26 @@ func (m *M) RecordTaskSuccess(ctx context.Context, task tasks.TaskType, dur time h.Record(ctx, dur.Milliseconds(), map[string]string{"task_type": task.String(), "task_status": "success"}) } -func (m *M) RecordTaskFailure(ctx context.Context, task tasks.TaskType, dur time.Duration) { +func (m *M) RecordTaskFailure(ctx context.Context, task tasks.TaskType, dur time.Duration, err error) { + reason := extractFailureReason(err) + c := m.underlying.Int64Counter(taskFailureCounterName, taskFailureCounterDesc, Dimensionless) h := m.underlying.Int64Histogram(taskDurationHistoName, taskDurationHistoDesc, Milliseconds) - c.Add(ctx, 1, map[string]string{"task_type": task.String()}) - h.Record(ctx, dur.Milliseconds(), map[string]string{"task_type": task.String(), "task_status": "failure"}) + + counterAttrs := map[string]string{ + "task_type": task.String(), + "grpc_code": reason.GrpcCode.String(), + "is_rate_limit": strconv.FormatBool(reason.IsRateLimit), + } + histoAttrs := map[string]string{ + "task_type": task.String(), + "task_status": "failure", + "grpc_code": reason.GrpcCode.String(), + "is_rate_limit": strconv.FormatBool(reason.IsRateLimit), + } + + c.Add(ctx, 1, counterAttrs) + h.Record(ctx, dur.Milliseconds(), histoAttrs) } func New(handler Handler) *M { diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/provisioner/provisioner.go b/vendor/github.com/conductorone/baton-sdk/pkg/provisioner/provisioner.go index 263f1bad..e69463df 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/provisioner/provisioner.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/provisioner/provisioner.go @@ -34,9 +34,10 @@ type Provisioner struct { revokeGrantID string - createAccountLogin string - createAccountEmail string - createAccountProfile *structpb.Struct + createAccountLogin string + createAccountEmail string + createAccountProfile *structpb.Struct + createAccountResourceType string deleteResourceID string deleteResourceType string @@ -118,7 +119,7 @@ func (p *Provisioner) Close(ctx context.Context) error { var err error if p.store != nil { - storeErr := p.store.Close() + storeErr := p.store.Close(ctx) if storeErr != nil { err = errors.Join(err, storeErr) } @@ -183,7 +184,7 @@ func (p *Provisioner) grant(ctx context.Context) error { DisplayName: principal.GetResource().GetDisplayName(), Annotations: principal.GetResource().GetAnnotations(), Description: principal.GetResource().GetDescription(), - ExternalId: principal.GetResource().GetExternalId(), + ExternalId: principal.GetResource().GetExternalId(), //nolint:staticcheck // Deprecated. // Omit parent resource ID so that behavior is the same as ConductorOne's provisioning mode ParentResourceId: nil, }.Build() @@ -246,7 +247,7 @@ func (p *Provisioner) revoke(ctx context.Context) error { DisplayName: principal.GetResource().GetDisplayName(), Annotations: principal.GetResource().GetAnnotations(), Description: principal.GetResource().GetDescription(), - ExternalId: principal.GetResource().GetExternalId(), + ExternalId: principal.GetResource().GetExternalId(), //nolint:staticcheck // Deprecated. // Omit parent resource ID so that behavior is the same as ConductorOne's provisioning mode ParentResourceId: nil, }.Build() @@ -285,6 +286,7 @@ func (p *Provisioner) createAccount(ctx context.Context) error { } _, err = p.connector.CreateAccount(ctx, v2.CreateAccountRequest_builder{ + ResourceTypeId: p.createAccountResourceType, AccountInfo: v2.AccountInfo_builder{ Emails: emails, Login: p.createAccountLogin, @@ -297,7 +299,11 @@ func (p *Provisioner) createAccount(ctx context.Context) error { return err } - l.Debug("account created", zap.String("login", p.createAccountLogin), zap.String("email", p.createAccountEmail)) + l.Debug("account created", + zap.String("login", p.createAccountLogin), + zap.String("email", p.createAccountEmail), + zap.String("resource_type", p.createAccountResourceType), + ) return nil } @@ -373,13 +379,14 @@ func NewResourceDeleter(c types.ConnectorClient, dbPath string, resourceId strin } } -func NewCreateAccountManager(c types.ConnectorClient, dbPath string, login string, email string, profile *structpb.Struct) *Provisioner { +func NewCreateAccountManager(c types.ConnectorClient, dbPath string, login string, email string, profile *structpb.Struct, resourceType string) *Provisioner { return &Provisioner{ - dbPath: dbPath, - connector: c, - createAccountLogin: login, - createAccountEmail: email, - createAccountProfile: profile, + dbPath: dbPath, + connector: c, + createAccountLogin: login, + createAccountEmail: email, + createAccountProfile: profile, + createAccountResourceType: resourceType, } } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/ratelimit/grpc.go b/vendor/github.com/conductorone/baton-sdk/pkg/ratelimit/grpc.go index 7bc88551..cd6351cb 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/ratelimit/grpc.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/ratelimit/grpc.go @@ -63,19 +63,23 @@ func getRatelimitDescriptors(ctx context.Context, method string, in interface{}, // ListEntitlements, ListGrants if req, ok := in.(hasResource); ok { - ret.SetEntries(append(ret.GetEntries(), ratelimitV1.RateLimitDescriptors_Entry_builder{ - Key: descriptorKeyConnectorResourceType, - Value: req.GetResource().GetId().GetResourceType(), - }.Build())) + if resourceType := req.GetResource().GetId().GetResourceType(); resourceType != "" { + ret.SetEntries(append(ret.GetEntries(), ratelimitV1.RateLimitDescriptors_Entry_builder{ + Key: descriptorKeyConnectorResourceType, + Value: resourceType, + }.Build())) + } return ret } - // ListResources + // ListResources, ListActionSchemas if req, ok := in.(hasResourceType); ok { - ret.SetEntries(append(ret.GetEntries(), ratelimitV1.RateLimitDescriptors_Entry_builder{ - Key: descriptorKeyConnectorResourceType, - Value: req.GetResourceTypeId(), - }.Build())) + if resourceTypeID := req.GetResourceTypeId(); resourceTypeID != "" { + ret.SetEntries(append(ret.GetEntries(), ratelimitV1.RateLimitDescriptors_Entry_builder{ + Key: descriptorKeyConnectorResourceType, + Value: resourceTypeID, + }.Build())) + } return ret } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/sdk/version.go b/vendor/github.com/conductorone/baton-sdk/pkg/sdk/version.go index 84105768..b3cfeeac 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/sdk/version.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/sdk/version.go @@ -1,3 +1,3 @@ package sdk -const Version = "v0.5.24" +const Version = "v0.7.9" diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/session/json_session.go b/vendor/github.com/conductorone/baton-sdk/pkg/session/json_session.go index 9f0f4903..bbd97158 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/session/json_session.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/session/json_session.go @@ -11,7 +11,7 @@ import ( // See GRPC validation rules for eg GetManyRequest. func GetManyJSON[T any](ctx context.Context, ss sessions.SessionStore, keys []string, opt ...sessions.SessionStoreOption) (map[string]T, error) { - allBytes, err := UnrollGetMany(ctx, ss, keys, opt...) + allBytes, err := UnrollGetMany[[]byte](ctx, ss, keys, opt...) if err != nil { return nil, err } @@ -30,17 +30,25 @@ func GetManyJSON[T any](ctx context.Context, ss sessions.SessionStore, keys []st } func SetManyJSON[T any](ctx context.Context, ss sessions.SessionStore, items map[string]T, opt ...sessions.SessionStoreOption) error { - bytesMap := make(map[string][]byte) - - for key, item := range items { - bytes, err := json.Marshal(item) - if err != nil { - return fmt.Errorf("failed to marshal item for key %s: %w", key, err) + // Lazy iterator that marshals items on demand, yielding (item, error) pairs + sizedItems := func(yield func(SizedItem[[]byte], error) bool) { + for key, item := range items { + bytes, err := json.Marshal(item) + if err != nil { + yield(SizedItem[[]byte]{}, fmt.Errorf("failed to marshal item for key %s: %w", key, err)) + return + } + if !yield(SizedItem[[]byte]{ + Key: key, + Value: bytes, + Size: len(key) + len(bytes) + 20, + }, nil) { + return + } } - bytesMap[key] = bytes } - return UnrollSetMany(ctx, ss, bytesMap, opt...) + return UnrollSetMany(ctx, ss, sizedItems, opt...) } func GetJSON[T any](ctx context.Context, ss sessions.SessionStore, key string, opt ...sessions.SessionStoreOption) (T, bool, error) { diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/session/memory_cache.go b/vendor/github.com/conductorone/baton-sdk/pkg/session/memory_cache.go index 3881ded4..b5e70c5a 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/session/memory_cache.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/session/memory_cache.go @@ -153,16 +153,19 @@ func (m *MemorySessionCache) GetAll(ctx context.Context, pageToken string, opt . return values, nextPageToken, nil } -func (m *MemorySessionCache) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string][]byte, error) { +func (m *MemorySessionCache) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string][]byte, []string, error) { bag, err := applyOptions(ctx, opt...) if err != nil { - return nil, err + return nil, nil, err } values, err := m.cache.BulkGet(ctx, cacheKeys(bag, keys), otter.BulkLoaderFunc[string, []byte](func(ctx context.Context, cacheKeys []string) (map[string][]byte, error) { - backingValues, err := m.ss.GetMany(ctx, stripPrefixes(bag, cacheKeys), opt...) + backingValues, unprocessedKeys, err := m.ss.GetMany(ctx, stripPrefixes(bag, cacheKeys), opt...) if err != nil { return nil, err } + if len(unprocessedKeys) > 0 { + return nil, fmt.Errorf("get many returned unprocessed keys") + } cacheKeyValues := make(map[string][]byte, len(backingValues)) for k, v := range backingValues { cacheKeyValues[cacheKey(bag, k)] = v @@ -172,7 +175,7 @@ func (m *MemorySessionCache) GetMany(ctx context.Context, keys []string, opt ... })) if err != nil { - return nil, err + return nil, nil, err } unprefixedValues := make(map[string][]byte) for k, v := range values { @@ -183,7 +186,7 @@ func (m *MemorySessionCache) GetMany(ctx context.Context, keys []string, opt ... } unprefixedValues[stripPrefix(bag, k)] = v } - return unprefixedValues, nil + return unprefixedValues, nil, nil } func (m *MemorySessionCache) Set(ctx context.Context, key string, value []byte, opt ...sessions.SessionStoreOption) error { diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/session/noop_session.go b/vendor/github.com/conductorone/baton-sdk/pkg/session/noop_session.go index 11300026..901c96bc 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/session/noop_session.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/session/noop_session.go @@ -26,8 +26,8 @@ func (n *NoOpSessionStore) Get(ctx context.Context, key string, opt ...sessions. return nil, false, n.logAndError(ctx, "Get") } -func (n *NoOpSessionStore) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string][]byte, error) { - return nil, n.logAndError(ctx, "GetMany") +func (n *NoOpSessionStore) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string][]byte, []string, error) { + return nil, nil, n.logAndError(ctx, "GetMany") } func (n *NoOpSessionStore) Set(ctx context.Context, key string, value []byte, opt ...sessions.SessionStoreOption) error { diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/session/session.go b/vendor/github.com/conductorone/baton-sdk/pkg/session/session.go index 97b05678..e480ebb9 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/session/session.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/session/session.go @@ -9,8 +9,6 @@ import ( "github.com/conductorone/baton-sdk/pkg/types/sessions" ) -const MaxKeysPerRequest = 100 - func Chunk[T any](items []T, chunkSize int) iter.Seq[[]T] { return func(yield func([]T) bool) { for i := 0; i < len(items); i += chunkSize { @@ -23,7 +21,7 @@ func Chunk[T any](items []T, chunkSize int) iter.Seq[[]T] { } type GetManyable[T any] interface { - GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string]T, error) + GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string]T, []string, error) } func UnrollGetMany[T any](ctx context.Context, ss GetManyable[T], keys []string, opt ...sessions.SessionStoreOption) (map[string]T, error) { @@ -33,12 +31,31 @@ func UnrollGetMany[T any](ctx context.Context, ss GetManyable[T], keys []string, } // TODO(Kans): parallelize this? - for keys := range Chunk(keys, MaxKeysPerRequest) { - some, err := ss.GetMany(ctx, keys, opt...) - if err != nil { - return nil, err + for keyChunk := range Chunk(keys, sessions.MaxKeysPerRequest) { + // For each chunk, unroll any unprocessed keys until all are processed + remainingKeys := keyChunk + for { + some, unprocessedKeys, err := ss.GetMany(ctx, remainingKeys, opt...) + if err != nil { + return nil, err + } + + // Accumulate results + maps.Copy(all, some) + + // If no unprocessed keys, we're done with this chunk + if len(unprocessedKeys) == 0 { + break + } + + // Check for infinite loop: if unprocessed keys haven't been reduced, something is wrong + if len(unprocessedKeys) == len(remainingKeys) { + return nil, fmt.Errorf("unprocessed keys not reduced: %d unprocessed out of %d requested", len(unprocessedKeys), len(remainingKeys)) + } + + // Continue with unprocessed keys + remainingKeys = unprocessedKeys } - maps.Copy(all, some) } return all, nil } @@ -47,31 +64,50 @@ type SetManyable[T any] interface { SetMany(ctx context.Context, values map[string]T, opt ...sessions.SessionStoreOption) error } -func UnrollSetMany[T any](ctx context.Context, ss SetManyable[T], items map[string]T, opt ...sessions.SessionStoreOption) error { - if len(items) == 0 { - return nil - } - if len(items) <= MaxKeysPerRequest { - return ss.SetMany(ctx, items, opt...) - } +// SizedItem represents a key-value pair with its size in bytes. +type SizedItem[T any] struct { + Key string + Value T + Size int // size in bytes of key + value +} - keys := make([]string, 0, len(items)) - for key := range items { - keys = append(keys, key) - } +// UnrollSetMany takes an iterator of sized items and batches them into SetMany calls, +// respecting both MaxKeysPerRequest and MaxSessionStoreSizeLimit. +// The iterator yields (item, error) pairs; iteration stops on the first error. +func UnrollSetMany[T any](ctx context.Context, ss SetManyable[T], items iter.Seq2[SizedItem[T], error], opt ...sessions.SessionStoreOption) error { + currentChunk := make(map[string]T) + currentSize := 0 - // TODO(Kans): parallelize this? - for keyChunk := range Chunk(keys, MaxKeysPerRequest) { - some := make(map[string]T) - for _, key := range keyChunk { - some[key] = items[key] + flush := func() error { + if len(currentChunk) == 0 { + return nil } - err := ss.SetMany(ctx, some, opt...) + err := ss.SetMany(ctx, currentChunk, opt...) + if err != nil { + return err + } + currentChunk = make(map[string]T) + currentSize = 0 + return nil + } + + for item, err := range items { if err != nil { return err } + + // Flush if adding this item would exceed either limit + if len(currentChunk) >= sessions.MaxKeysPerRequest || (currentSize+item.Size >= sessions.MaxSessionStoreSizeLimit && len(currentChunk) > 0) { + if err := flush(); err != nil { + return err + } + } + + currentChunk[item.Key] = item.Value + currentSize += item.Size } - return nil + + return flush() } type GetAllable[T any] interface { diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/session/session_client.go b/vendor/github.com/conductorone/baton-sdk/pkg/session/session_client.go index 6b84736e..f75d920a 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/session/session_client.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/session/session_client.go @@ -7,6 +7,7 @@ import ( "fmt" "net" "os" + "slices" "time" v1 "github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1" @@ -171,27 +172,30 @@ func (g *GRPCSessionStoreClient) Get(ctx context.Context, key string, opt ...ses } // GetMany retrieves multiple values from the cache by keys. -func (g *GRPCSessionStoreClient) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string][]byte, error) { +func (g *GRPCSessionStoreClient) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string][]byte, []string, error) { bag, err := applyOptions(ctx, opt...) if err != nil { - return nil, err + return nil, nil, err } - results := make(map[string][]byte) + slices.Sort(keys) + keys = slices.Compact(keys) + resp, err := g.client.GetMany(ctx, v1.GetManyRequest_builder{ SyncId: bag.SyncID, Keys: keys, Prefix: bag.Prefix, }.Build()) if err != nil { - return nil, fmt.Errorf("failed to get many values from gRPC session cache: %w", err) + return nil, nil, fmt.Errorf("failed to get many values from gRPC session cache: %w", err) } + results := make(map[string][]byte, len(resp.Items)) for _, item := range resp.Items { results[item.Key] = item.Value } - return results, nil + return results, resp.UnprocessedKeys, nil } // Set stores a value in the cache with the given key. diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/session/session_server.go b/vendor/github.com/conductorone/baton-sdk/pkg/session/session_server.go index e817808c..622ec1ee 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/session/session_server.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/session/session_server.go @@ -60,7 +60,7 @@ func (s *GRPCSessionServer) GetMany(ctx context.Context, req *v1.GetManyRequest) return nil, err } - values, err := s.store.GetMany( + values, unprocessedKeys, err := s.store.GetMany( ctx, req.GetKeys(), sessions.WithSyncID(req.GetSyncId()), @@ -80,7 +80,8 @@ func (s *GRPCSessionServer) GetMany(ctx context.Context, req *v1.GetManyRequest) } return v1.GetManyResponse_builder{ - Items: items, + Items: items, + UnprocessedKeys: unprocessedKeys, }.Build(), nil } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/session/typed_session.go b/vendor/github.com/conductorone/baton-sdk/pkg/session/typed_session.go index 43a2f4f8..8933b555 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/session/typed_session.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/session/typed_session.go @@ -52,22 +52,22 @@ func (t *TypedSessionCache[T]) Set(ctx context.Context, key string, value T, opt return t.cache.Set(ctx, key, data, opt...) } -func (t *TypedSessionCache[T]) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string]T, error) { - dataMap, err := t.cache.GetMany(ctx, keys, opt...) +func (t *TypedSessionCache[T]) GetMany(ctx context.Context, keys []string, opt ...sessions.SessionStoreOption) (map[string]T, []string, error) { + dataMap, unprocessedKeys, err := t.cache.GetMany(ctx, keys, opt...) if err != nil { - return nil, err + return nil, nil, err } result := make(map[string]T) for key, data := range dataMap { value, err := t.codec.Decode(data) if err != nil { - return nil, fmt.Errorf("failed to decode value for key %s: %w", key, err) + return nil, nil, fmt.Errorf("failed to decode value for key %s: %w", key, err) } result[key] = value } - return result, nil + return result, unprocessedKeys, nil } func (t *TypedSessionCache[T]) SetMany(ctx context.Context, values map[string]T, opt ...sessions.SessionStoreOption) error { diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/sync/expand/expander.go b/vendor/github.com/conductorone/baton-sdk/pkg/sync/expand/expander.go new file mode 100644 index 00000000..45199e62 --- /dev/null +++ b/vendor/github.com/conductorone/baton-sdk/pkg/sync/expand/expander.go @@ -0,0 +1,328 @@ +package expand + +import ( + "context" + "database/sql" + "errors" + "fmt" + "os" + "strconv" + + "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" + "go.uber.org/zap" + + v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" + reader_v2 "github.com/conductorone/baton-sdk/pb/c1/reader/v2" + "github.com/conductorone/baton-sdk/pkg/annotations" +) + +const defaultMaxDepth int64 = 20 + +var maxDepth, _ = strconv.ParseInt(os.Getenv("BATON_GRAPH_EXPAND_MAX_DEPTH"), 10, 64) + +// ErrMaxDepthExceeded is returned when the expansion graph exceeds the maximum allowed depth. +var ErrMaxDepthExceeded = errors.New("max depth exceeded") + +// ExpanderStore defines the minimal store interface needed for grant expansion. +// This interface can be implemented by the connectorstore or by a mock for testing. +type ExpanderStore interface { + GetEntitlement(ctx context.Context, req *reader_v2.EntitlementsReaderServiceGetEntitlementRequest) (*reader_v2.EntitlementsReaderServiceGetEntitlementResponse, error) + ListGrantsForEntitlement(ctx context.Context, req *reader_v2.GrantsReaderServiceListGrantsForEntitlementRequest) (*reader_v2.GrantsReaderServiceListGrantsForEntitlementResponse, error) + PutGrants(ctx context.Context, grants ...*v2.Grant) error +} + +// Expander handles the grant expansion algorithm. +// It can be used standalone for testing or called from the syncer. +type Expander struct { + store ExpanderStore + graph *EntitlementGraph +} + +// NewExpander creates a new Expander with the given store and graph. +func NewExpander(store ExpanderStore, graph *EntitlementGraph) *Expander { + return &Expander{ + store: store, + graph: graph, + } +} + +// Graph returns the entitlement graph. +func (e *Expander) Graph() *EntitlementGraph { + return e.graph +} + +// Run executes the complete expansion algorithm until the graph is fully expanded. +// This is useful for testing where you want to run the entire expansion in one call. +func (e *Expander) Run(ctx context.Context) error { + for { + err := e.RunSingleStep(ctx) + if err != nil { + return err + } + if e.IsDone(ctx) { + return nil + } + } +} + +// RunSingleStep executes one step of the expansion algorithm. +// Returns true when the graph is fully expanded, false if more work is needed. +// This matches the syncer's step-by-step execution model. +func (e *Expander) RunSingleStep(ctx context.Context) error { + l := ctxzap.Extract(ctx) + l = l.With(zap.Int("depth", e.graph.Depth)) + l.Debug("expander: starting step") + + // Process current action if any + if len(e.graph.Actions) > 0 { + action := e.graph.Actions[0] + nextPageToken, err := e.runAction(ctx, action) + if err != nil { + l.Error("expander: error running graph action", zap.Error(err), zap.Any("action", action)) + _ = e.graph.DeleteEdge(ctx, action.SourceEntitlementID, action.DescendantEntitlementID) + if errors.Is(err, sql.ErrNoRows) { + // Skip action and delete the edge that caused the error. + e.graph.Actions = e.graph.Actions[1:] + return nil + } + return err + } + + if nextPageToken != "" { + // More pages to process + action.PageToken = nextPageToken + } else { + // Action is complete - mark edge expanded and remove from queue + e.graph.MarkEdgeExpanded(action.SourceEntitlementID, action.DescendantEntitlementID) + e.graph.Actions = e.graph.Actions[1:] + } + } + + // If there are still actions remaining, continue processing + if len(e.graph.Actions) > 0 { + return nil + } + + // Check max depth + depth := maxDepth + if depth == 0 { + depth = defaultMaxDepth + } + + if int64(e.graph.Depth) > depth { + l.Error("expander: exceeded max depth", zap.Int64("max_depth", depth)) + return fmt.Errorf("expander: %w (%d)", ErrMaxDepthExceeded, depth) + } + + // Generate new actions from expandable entitlements + for sourceEntitlementID := range e.graph.GetExpandableEntitlements(ctx) { + for descendantEntitlementID, grantInfo := range e.graph.GetExpandableDescendantEntitlements(ctx, sourceEntitlementID) { + e.graph.Actions = append(e.graph.Actions, &EntitlementGraphAction{ + SourceEntitlementID: sourceEntitlementID, + DescendantEntitlementID: descendantEntitlementID, + PageToken: "", + Shallow: grantInfo.IsShallow, + ResourceTypeIDs: grantInfo.ResourceTypeIDs, + }) + } + } + + e.graph.Depth++ + l.Debug("expander: graph is not expanded, incrementing depth") + return nil +} + +func (e *Expander) IsDone(ctx context.Context) bool { + return e.graph.IsExpanded() +} + +// runAction processes a single action and returns the next page token. +// If the returned page token is empty, the action is complete. +func (e *Expander) runAction(ctx context.Context, action *EntitlementGraphAction) (string, error) { + l := ctxzap.Extract(ctx) + l = l.With( + zap.Int("depth", e.graph.Depth), + zap.String("source_entitlement_id", action.SourceEntitlementID), + zap.String("descendant_entitlement_id", action.DescendantEntitlementID), + ) + + // Fetch source and descendant entitlement + sourceEntitlement, err := e.store.GetEntitlement(ctx, reader_v2.EntitlementsReaderServiceGetEntitlementRequest_builder{ + EntitlementId: action.SourceEntitlementID, + }.Build()) + if err != nil { + l.Error("runAction: error fetching source entitlement", zap.Error(err)) + return "", fmt.Errorf("runAction: error fetching source entitlement: %w", err) + } + + descendantEntitlement, err := e.store.GetEntitlement(ctx, reader_v2.EntitlementsReaderServiceGetEntitlementRequest_builder{ + EntitlementId: action.DescendantEntitlementID, + }.Build()) + if err != nil { + l.Error("runAction: error fetching descendant entitlement", zap.Error(err)) + return "", fmt.Errorf("runAction: error fetching descendant entitlement: %w", err) + } + + // Fetch a page of source grants + sourceGrants, err := e.store.ListGrantsForEntitlement(ctx, reader_v2.GrantsReaderServiceListGrantsForEntitlementRequest_builder{ + Entitlement: sourceEntitlement.GetEntitlement(), + PageToken: action.PageToken, + PrincipalResourceTypeIds: action.ResourceTypeIDs, + }.Build()) + if err != nil { + l.Error("runAction: error fetching source grants", zap.Error(err)) + return "", fmt.Errorf("runAction: error fetching source grants: %w", err) + } + + var newGrants = make([]*v2.Grant, 0) + for _, sourceGrant := range sourceGrants.GetList() { + // If this is a shallow action, then we only want to expand grants that have no sources + // which indicates that it was directly assigned. + if action.Shallow { + sourcesMap := sourceGrant.GetSources().GetSources() + // If we have no sources, this is a direct grant + foundDirectGrant := len(sourcesMap) == 0 + // If the source grant has sources, then we need to see if any of them are the source entitlement itself + if sourcesMap[action.SourceEntitlementID] != nil { + foundDirectGrant = true + } + + // This is not a direct grant, so skip it since we are a shallow action + if !foundDirectGrant { + continue + } + } + + // Unroll all grants for the principal on the descendant entitlement. + pageToken := "" + for { + req := reader_v2.GrantsReaderServiceListGrantsForEntitlementRequest_builder{ + Entitlement: descendantEntitlement.GetEntitlement(), + PrincipalId: sourceGrant.GetPrincipal().GetId(), + PageToken: pageToken, + Annotations: nil, + }.Build() + + resp, err := e.store.ListGrantsForEntitlement(ctx, req) + if err != nil { + l.Error("runAction: error fetching descendant grants", zap.Error(err)) + return "", fmt.Errorf("runAction: error fetching descendant grants: %w", err) + } + descendantGrants := resp.GetList() + + // If we have no grants for the principal in the descendant entitlement, make one. + if pageToken == "" && resp.GetNextPageToken() == "" && len(descendantGrants) == 0 { + descendantGrant, err := newExpandedGrant(descendantEntitlement.GetEntitlement(), sourceGrant.GetPrincipal(), action.SourceEntitlementID) + if err != nil { + l.Error("runAction: error creating new grant", zap.Error(err)) + return "", fmt.Errorf("runAction: error creating new grant: %w", err) + } + newGrants = append(newGrants, descendantGrant) + newGrants, err = PutGrantsInChunks(ctx, e.store, newGrants, 10000) + if err != nil { + l.Error("runAction: error updating descendant grants", zap.Error(err)) + return "", fmt.Errorf("runAction: error updating descendant grants: %w", err) + } + break + } + + // Add the source entitlement as a source to all descendant grants. + grantsToUpdate := make([]*v2.Grant, 0) + for _, descendantGrant := range descendantGrants { + sourcesMap := descendantGrant.GetSources().GetSources() + if sourcesMap == nil { + sourcesMap = make(map[string]*v2.GrantSources_GrantSource) + } + + updated := false + + if len(sourcesMap) == 0 { + // If we are already granted this entitlement, make sure to add ourselves as a source. + sourcesMap[action.DescendantEntitlementID] = &v2.GrantSources_GrantSource{} + updated = true + } + // Include the source grant as a source. + if sourcesMap[action.SourceEntitlementID] == nil { + sourcesMap[action.SourceEntitlementID] = &v2.GrantSources_GrantSource{} + updated = true + } + + if updated { + sources := v2.GrantSources_builder{Sources: sourcesMap}.Build() + descendantGrant.SetSources(sources) + grantsToUpdate = append(grantsToUpdate, descendantGrant) + } + } + newGrants = append(newGrants, grantsToUpdate...) + + newGrants, err = PutGrantsInChunks(ctx, e.store, newGrants, 10000) + if err != nil { + l.Error("runAction: error updating descendant grants", zap.Error(err)) + return "", fmt.Errorf("runAction: error updating descendant grants: %w", err) + } + + pageToken = resp.GetNextPageToken() + if pageToken == "" { + break + } + } + } + + _, err = PutGrantsInChunks(ctx, e.store, newGrants, 0) + if err != nil { + l.Error("runAction: error updating descendant grants", zap.Error(err)) + return "", fmt.Errorf("runAction: error updating descendant grants: %w", err) + } + + return sourceGrants.GetNextPageToken(), nil +} + +// PutGrantsInChunks accumulates grants until the buffer exceeds minChunkSize, +// then writes all grants to the store at once. +func PutGrantsInChunks(ctx context.Context, store ExpanderStore, grants []*v2.Grant, minChunkSize int) ([]*v2.Grant, error) { + if len(grants) < minChunkSize { + return grants, nil + } + + err := store.PutGrants(ctx, grants...) + if err != nil { + return nil, fmt.Errorf("PutGrantsInChunks: error putting grants: %w", err) + } + + return make([]*v2.Grant, 0), nil +} + +// newExpandedGrant creates a new grant for a principal on a descendant entitlement. +func newExpandedGrant(descEntitlement *v2.Entitlement, principal *v2.Resource, sourceEntitlementID string) (*v2.Grant, error) { + enResource := descEntitlement.GetResource() + if enResource == nil { + return nil, fmt.Errorf("newExpandedGrant: entitlement has no resource") + } + + if principal == nil { + return nil, fmt.Errorf("newExpandedGrant: principal is nil") + } + + // Add immutable annotation since this function is only called if no direct grant exists + var annos annotations.Annotations + annos.Update(&v2.GrantImmutable{}) + + var sources *v2.GrantSources + if sourceEntitlementID != "" { + sources = &v2.GrantSources{ + Sources: map[string]*v2.GrantSources_GrantSource{ + sourceEntitlementID: {}, + }, + } + } + + grant := v2.Grant_builder{ + Id: fmt.Sprintf("%s:%s:%s", descEntitlement.GetId(), principal.GetId().GetResourceType(), principal.GetId().GetResource()), + Entitlement: descEntitlement, + Principal: principal, + Sources: sources, + Annotations: annos, + }.Build() + + return grant, nil +} diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/sync/expand/graph.go b/vendor/github.com/conductorone/baton-sdk/pkg/sync/expand/graph.go index 851c5f77..4dce1baf 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/sync/expand/graph.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/sync/expand/graph.go @@ -2,6 +2,7 @@ package expand import ( "context" + "iter" v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" "github.com/conductorone/baton-sdk/pkg/sync/expand/scc" @@ -138,9 +139,9 @@ func (g *EntitlementGraph) GetDescendantEntitlements(entitlementID string) map[s if destinations, ok := g.SourcesToDestinations[node.Id]; ok { for destinationID, edgeID := range destinations { if destination, ok := g.Nodes[destinationID]; ok { - for _, entitlementID := range destination.EntitlementIDs { + for _, e := range destination.EntitlementIDs { if edge, ok := g.Edges[edgeID]; ok { - entitlementsToEdges[entitlementID] = &edge + entitlementsToEdges[e] = &edge } } } @@ -149,6 +150,31 @@ func (g *EntitlementGraph) GetDescendantEntitlements(entitlementID string) map[s return entitlementsToEdges } +func (g *EntitlementGraph) GetExpandableDescendantEntitlements(ctx context.Context, entitlementID string) iter.Seq2[string, *Edge] { + return func(yield func(string, *Edge) bool) { + node := g.GetNode(entitlementID) + if node == nil { + return + } + if destinations, ok := g.SourcesToDestinations[node.Id]; ok { + for destinationID, edgeID := range destinations { + if destination, ok := g.Nodes[destinationID]; ok { + for _, e := range destination.EntitlementIDs { + if edge, ok := g.Edges[edgeID]; ok { + if edge.IsExpanded { + continue + } + if !yield(e, &edge) { + return + } + } + } + } + } + } + } +} + func (g *EntitlementGraph) HasEntitlement(entitlementID string) bool { return g.GetNode(entitlementID) != nil } @@ -185,6 +211,28 @@ func (g *EntitlementGraph) GetEntitlements() []string { return entitlements } +func (g *EntitlementGraph) GetExpandableEntitlements(ctx context.Context) iter.Seq[string] { + return func(yield func(string) bool) { + l := ctxzap.Extract(ctx) + for _, node := range g.Nodes { + for _, entitlementID := range node.EntitlementIDs { + // We've already expanded this entitlement, so skip it. + if g.IsEntitlementExpanded(entitlementID) { + continue + } + // We have ancestors who have not been expanded yet, so we can't expand ourselves. + if g.HasUnexpandedAncestors(entitlementID) { + l.Debug("expandGrantsForEntitlements: skipping source entitlement because it has unexpanded ancestors", zap.String("source_entitlement_id", entitlementID)) + continue + } + if !yield(entitlementID) { + return + } + } + } + } +} + // MarkEdgeExpanded given source and destination entitlements, mark the edge // between them as "expanded". func (g *EntitlementGraph) MarkEdgeExpanded(sourceEntitlementID string, descendantEntitlementID string) { diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/sync/state.go b/vendor/github.com/conductorone/baton-sdk/pkg/sync/state.go index 71e14911..81eeace7 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/sync/state.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/sync/state.go @@ -36,6 +36,7 @@ type State interface { SetShouldSkipEntitlementsAndGrants() ShouldSkipGrants() bool SetShouldSkipGrants() + GetCompletedActionsCount() uint64 } // ActionOp represents a sync operation. @@ -156,6 +157,7 @@ type state struct { shouldFetchRelatedResources bool shouldSkipEntitlementsAndGrants bool shouldSkipGrants bool + completedActionsCount uint64 } // serializedToken is used to serialize the token to JSON. This separate object is used to avoid having exported fields @@ -169,6 +171,7 @@ type serializedToken struct { ShouldFetchRelatedResources bool `json:"should_fetch_related_resources,omitempty"` ShouldSkipEntitlementsAndGrants bool `json:"should_skip_entitlements_and_grants,omitempty"` ShouldSkipGrants bool `json:"should_skip_grants,omitempty"` + CompletedActionsCount uint64 `json:"completed_actions_count,omitempty"` } // push adds a new action to the stack. If there is no current state, the action is directly set to current, else @@ -196,6 +199,7 @@ func (st *state) pop() *Action { } ret := *st.currentAction + st.completedActionsCount++ if len(st.actions) > 0 { st.currentAction = &st.actions[len(st.actions)-1] @@ -242,10 +246,12 @@ func (st *state) Unmarshal(input string) error { st.shouldSkipEntitlementsAndGrants = token.ShouldSkipEntitlementsAndGrants st.shouldSkipGrants = token.ShouldSkipGrants st.shouldFetchRelatedResources = token.ShouldFetchRelatedResources + st.completedActionsCount = token.CompletedActionsCount } else { st.actions = nil st.entitlementGraph = nil st.currentAction = &Action{Op: InitOp} + st.completedActionsCount = 0 } return nil @@ -265,6 +271,7 @@ func (st *state) Marshal() (string, error) { ShouldFetchRelatedResources: st.shouldFetchRelatedResources, ShouldSkipEntitlementsAndGrants: st.shouldSkipEntitlementsAndGrants, ShouldSkipGrants: st.shouldSkipGrants, + CompletedActionsCount: st.completedActionsCount, }) if err != nil { return "", err @@ -405,3 +412,9 @@ func (st *state) ParentResourceTypeID(ctx context.Context) string { return c.ParentResourceTypeID } + +func (st *state) GetCompletedActionsCount() uint64 { + st.mtx.RLock() + defer st.mtx.RUnlock() + return st.completedActionsCount +} diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/sync/syncer.go b/vendor/github.com/conductorone/baton-sdk/pkg/sync/syncer.go index 48fb33b7..532cc8e4 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/sync/syncer.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/sync/syncer.go @@ -12,6 +12,8 @@ import ( "slices" "strconv" "strings" + native_sync "sync" + "sync/atomic" "time" "github.com/Masterminds/semver/v3" @@ -43,12 +45,42 @@ import ( var tracer = otel.Tracer("baton-sdk/sync") -const defaultMaxDepth int64 = 20 - -var maxDepth, _ = strconv.ParseInt(os.Getenv("BATON_GRAPH_EXPAND_MAX_DEPTH"), 10, 64) var dontFixCycles, _ = strconv.ParseBool(os.Getenv("BATON_DONT_FIX_CYCLES")) var ErrSyncNotComplete = fmt.Errorf("sync exited without finishing") +var ErrTooManyWarnings = fmt.Errorf("too many warnings, exiting sync") +var ErrNoSyncIDFound = fmt.Errorf("no syncID found after starting or resuming sync") + +// IsSyncPreservable returns true if the error returned by Sync() means that the sync artifact is useful. +// This either means that there was no error, or that the error is recoverable (we can resume the sync and possibly succeed next time). +func IsSyncPreservable(err error) bool { + if err == nil { + return true + } + // ErrSyncNotComplete means we hit the run duration timeout. + // ErrTooManyWarnings means we hit too many warnings. + // Both are recoverable errors. + if errors.Is(err, ErrSyncNotComplete) || errors.Is(err, ErrTooManyWarnings) { + return true + } + statusErr, ok := status.FromError(err) + if !ok { + return false + } + switch statusErr.Code() { + case codes.OK, + codes.NotFound, + codes.PermissionDenied, + codes.ResourceExhausted, + codes.FailedPrecondition, + codes.Aborted, + codes.Unavailable, + codes.Unauthenticated: + return true + default: + return false + } +} type Syncer interface { Sync(context.Context) error @@ -210,11 +242,12 @@ type syncer struct { skipFullSync bool lastCheckPointTime time.Time counts *ProgressCounts - targetedSyncResourceIDs []string + targetedSyncResources []*v2.Resource onlyExpandGrants bool dontExpandGrants bool syncID string skipEGForResourceType map[string]bool + skipEntitlementsForResourceType map[string]bool skipEntitlementsAndGrants bool skipGrants bool resourceTypeTraits map[string][]v2.ResourceType_Trait @@ -222,6 +255,8 @@ type syncer struct { injectSyncIDAnnotation bool setSessionStore sessions.SetSessionStore syncResourceTypes []string + previousSyncMu native_sync.Mutex + previousSyncIDPtr atomic.Pointer[string] } const minCheckpointInterval = 10 * time.Second @@ -247,6 +282,33 @@ func (s *syncer) Checkpoint(ctx context.Context, force bool) error { return nil } +func (s *syncer) getPreviousFullSyncID(ctx context.Context) (string, error) { + if ptr := s.previousSyncIDPtr.Load(); ptr != nil { + return *ptr, nil + } + + s.previousSyncMu.Lock() + defer s.previousSyncMu.Unlock() + + if ptr := s.previousSyncIDPtr.Load(); ptr != nil { + return *ptr, nil + } + + psf, ok := s.store.(latestSyncFetcher) + if !ok { + empty := "" + s.previousSyncIDPtr.Store(&empty) + return "", nil + } + + previousSyncID, err := psf.LatestFinishedSync(ctx, connectorstore.SyncTypeFull) + if err == nil { + s.previousSyncIDPtr.Store(&previousSyncID) + } + + return previousSyncID, err +} + func (s *syncer) handleInitialActionForStep(ctx context.Context, a Action) { if s.transitionHandler != nil { s.transitionHandler(a) @@ -276,9 +338,9 @@ func isWarning(ctx context.Context, err error) bool { func (s *syncer) startOrResumeSync(ctx context.Context) (string, bool, error) { // Sync resuming logic: // If we know our sync ID, set it as the current sync and return (resuming that sync). - // If targetedSyncResourceIDs is not set, find the most recent unfinished sync of our desired sync type & resume it (regardless of partial or full). + // If targetedSyncResources is not set, find the most recent unfinished sync of our desired sync type & resume it (regardless of partial or full). // If there are no unfinished syncs of our desired sync type, start a new sync. - // If targetedSyncResourceIDs is set, start a new partial sync. Use the most recent completed sync as the parent sync ID (if it exists). + // If targetedSyncResources is set, start a new partial sync. Use the most recent completed sync as the parent sync ID (if it exists). if s.syncID != "" { err := s.store.SetCurrentSync(ctx, s.syncID) @@ -291,7 +353,7 @@ func (s *syncer) startOrResumeSync(ctx context.Context) (string, bool, error) { var syncID string var newSync bool var err error - if len(s.targetedSyncResourceIDs) == 0 { + if len(s.targetedSyncResources) == 0 { syncID, newSync, err = s.store.StartOrResumeSync(ctx, s.syncType, "") if err != nil { return "", false, err @@ -382,11 +444,7 @@ func (s *syncer) Sync(ctx context.Context) error { // Validate any targeted resource IDs before starting a sync. targetedResources := []*v2.Resource{} - for _, resourceID := range s.targetedSyncResourceIDs { - r, err := bid.ParseResourceBid(resourceID) - if err != nil { - return fmt.Errorf("error parsing resource id %s: %w", resourceID, err) - } + for _, r := range s.targetedSyncResources { if len(s.syncResourceTypes) > 0 { if _, ok := syncResourceTypeMap[r.GetId().GetResourceType()]; !ok { continue @@ -404,7 +462,7 @@ func (s *syncer) Sync(ctx context.Context) error { // Set the syncID on the wrapper after we have it if syncID == "" { - err = errors.New("no syncID found after starting or resuming sync") + err = ErrNoSyncIDFound l.Error("no syncID found after starting or resuming sync", zap.Error(err)) return err } @@ -475,9 +533,12 @@ func (s *syncer) Sync(ctx context.Context) error { return err } - // TODO: count actions divided by warnings and error if warning percentage is too high + // If we have more than 10 warnings and more than 10% of actions ended in a warning, exit the sync. if len(warnings) > 10 { - return fmt.Errorf("too many warnings, exiting sync. warnings: %v", warnings) + completedActionsCount := s.state.GetCompletedActionsCount() + if completedActionsCount > 0 && float64(len(warnings))/float64(completedActionsCount) > 0.1 { + return fmt.Errorf("%w: warnings: %v completed actions: %d", ErrTooManyWarnings, warnings, completedActionsCount) + } } select { case <-runCtx.Done(): @@ -550,7 +611,9 @@ func (s *syncer) Sync(ctx context.Context) error { if !s.state.ShouldSkipGrants() { s.state.PushAction(ctx, Action{Op: SyncGrantsOp}) } + s.state.PushAction(ctx, Action{Op: SyncEntitlementsOp}) + s.state.PushAction(ctx, Action{Op: SyncStaticEntitlementsOp}) } s.state.PushAction(ctx, Action{Op: SyncResourcesOp}) @@ -659,6 +722,7 @@ func (s *syncer) Sync(ctx context.Context) error { // Force a checkpoint to clear completed actions & entitlement graph in sync_token. s.state.ClearEntitlementGraph(ctx) + err = s.Checkpoint(ctx, true) if err != nil { return err @@ -843,11 +907,22 @@ func validateSyncResourceTypesFilter(resourceTypesFilter []string, validResource return nil } +func (s *syncer) hasChildResources(resource *v2.Resource) bool { + annos := annotations.Annotations(resource.GetAnnotations()) + + return annos.Contains((*v2.ChildResourceType)(nil)) +} + // getSubResources fetches the sub resource types from a resources' annotations. func (s *syncer) getSubResources(ctx context.Context, parent *v2.Resource) error { ctx, span := tracer.Start(ctx, "syncer.getSubResources") defer span.End() + syncResourceTypeMap := make(map[string]bool) + for _, rt := range s.syncResourceTypes { + syncResourceTypeMap[rt] = true + } + for _, a := range parent.GetAnnotations() { if a.MessageIs((*v2.ChildResourceType)(nil)) { crt := &v2.ChildResourceType{} @@ -855,7 +930,11 @@ func (s *syncer) getSubResources(ctx context.Context, parent *v2.Resource) error if err != nil { return err } - + if len(s.syncResourceTypes) > 0 { + if shouldSync := syncResourceTypeMap[crt.GetResourceTypeId()]; !shouldSync { + continue + } + } childAction := Action{ Op: SyncResourcesOp, ResourceTypeID: crt.GetResourceTypeId(), @@ -950,7 +1029,7 @@ func (s *syncer) SyncTargetedResource(ctx context.Context) error { }) } - shouldSkipEnts, err := s.shouldSkipEntitlementsAndGrants(ctx, resource) + shouldSkipEnts, err := s.shouldSkipEntitlements(ctx, resource) if err != nil { return err } @@ -1055,25 +1134,39 @@ func (s *syncer) syncResources(ctx context.Context) error { bulkPutResoruces := []*v2.Resource{} for _, r := range resp.GetList() { + validatedResource := false + // Check if we've already synced this resource, skip it if we have _, err = s.store.GetResource(ctx, reader_v2.ResourcesReaderServiceGetResourceRequest_builder{ ResourceId: v2.ResourceId_builder{ResourceType: r.GetId().GetResourceType(), Resource: r.GetId().GetResource()}.Build(), }.Build()) if err == nil { - continue - } + err = s.validateResourceTraits(ctx, r) + if err != nil { + return err + } + validatedResource = true - if !errors.Is(err, sql.ErrNoRows) { - return err + // We must *ALSO* check if we have any child resources. + if !s.hasChildResources(r) { + // Since we only have the resource type IDs of child resources, + // we can't tell if we already have synced those child resources. + // Those children may also have their own child resources, + // so we are conservative here and just re-sync this resource. + continue + } } - err = s.validateResourceTraits(ctx, r) - if err != nil { + if err != nil && !errors.Is(err, sql.ErrNoRows) { return err } - // Set the resource creation source - r.SetCreationSource(v2.Resource_CREATION_SOURCE_CONNECTOR_LIST_RESOURCES) + if !validatedResource { + err = s.validateResourceTraits(ctx, r) + if err != nil { + return err + } + } bulkPutResoruces = append(bulkPutResoruces, r) @@ -1190,6 +1283,43 @@ func (s *syncer) shouldSkipGrants(ctx context.Context, r *v2.Resource) (bool, er return s.shouldSkipEntitlementsAndGrants(ctx, r) } +func (s *syncer) shouldSkipEntitlements(ctx context.Context, r *v2.Resource) (bool, error) { + ctx, span := tracer.Start(ctx, "syncer.shouldSkipEntitlements") + defer span.End() + + ok, err := s.shouldSkipEntitlementsAndGrants(ctx, r) + if err != nil { + return false, err + } + + if ok { + return true, nil + } + + rAnnos := annotations.Annotations(r.GetAnnotations()) + if rAnnos.Contains(&v2.SkipEntitlements{}) || rAnnos.Contains(&v2.SkipEntitlementsAndGrants{}) { + return true, nil + } + + if skip, ok := s.skipEntitlementsForResourceType[r.GetId().GetResourceType()]; ok { + return skip, nil + } + + rt, err := s.store.GetResourceType(ctx, reader_v2.ResourceTypesReaderServiceGetResourceTypeRequest_builder{ + ResourceTypeId: r.GetId().GetResourceType(), + }.Build()) + if err != nil { + return false, err + } + + rtAnnos := annotations.Annotations(rt.GetResourceType().GetAnnotations()) + + skipEntitlements := rtAnnos.Contains(&v2.SkipEntitlements{}) || rtAnnos.Contains(&v2.SkipEntitlementsAndGrants{}) + s.skipEntitlementsForResourceType[r.GetId().GetResourceType()] = skipEntitlements + + return skipEntitlements, nil +} + // SyncEntitlements fetches the entitlements from the connector. It first lists each resource from the datastore, // and pushes an action to fetch the entitlements for each resource. func (s *syncer) SyncEntitlements(ctx context.Context) error { @@ -1220,7 +1350,7 @@ func (s *syncer) SyncEntitlements(ctx context.Context) error { } for _, r := range resp.GetList() { - shouldSkipEntitlements, err := s.shouldSkipEntitlementsAndGrants(ctx, r) + shouldSkipEntitlements, err := s.shouldSkipEntitlements(ctx, r) if err != nil { return err } @@ -1550,141 +1680,206 @@ func (s *syncer) SyncAssets(ctx context.Context) error { return nil } -// SyncGrantExpansion documentation pending. +// SyncGrantExpansion handles the grant expansion phase of sync. +// It first loads the entitlement graph from grants, fixes any cycles, then runs expansion. func (s *syncer) SyncGrantExpansion(ctx context.Context) error { ctx, span := tracer.Start(ctx, "syncer.SyncGrantExpansion") defer span.End() - l := ctxzap.Extract(ctx) entitlementGraph := s.state.EntitlementGraph(ctx) - if !entitlementGraph.Loaded { - pageToken := s.state.PageToken(ctx) - if pageToken == "" { - l.Info("Expanding grants...") - s.handleInitialActionForStep(ctx, *s.state.Current()) - } - resp, err := s.store.ListGrants(ctx, v2.GrantsServiceListGrantsRequest_builder{PageToken: pageToken}.Build()) + // Phase 1: Load the entitlement graph from grants (paginated) + if !entitlementGraph.Loaded { + err := s.loadEntitlementGraph(ctx, entitlementGraph) if err != nil { return err } + return nil + } - // We want to take action on the next page before we push any new actions - if resp.GetNextPageToken() != "" { - err = s.state.NextPage(ctx, resp.GetNextPageToken()) - if err != nil { - return err - } - } else { - l.Debug("Finished loading grants to expand") - entitlementGraph.Loaded = true + // Phase 2: Fix cycles in the graph (only runs once after loading completes) + if !entitlementGraph.HasNoCycles { + err := s.fixEntitlementGraphCycles(ctx, entitlementGraph) + if err != nil { + return err } + } - for _, grant := range resp.GetList() { - annos := annotations.Annotations(grant.GetAnnotations()) - expandable := &v2.GrantExpandable{} - _, err := annos.Pick(expandable) - if err != nil { - return err - } - if len(expandable.GetEntitlementIds()) == 0 { - continue - } + // Phase 3: Run the expansion algorithm + err := s.expandGrantsForEntitlements(ctx) + if err != nil { + return err + } - principalID := grant.GetPrincipal().GetId() - if principalID == nil { - return fmt.Errorf("principal id was nil") - } + return nil +} - // FIXME(morgabra) Log and skip some of the error paths here? - for _, srcEntitlementID := range expandable.GetEntitlementIds() { - l.Debug( - "Expandable entitlement found", - zap.String("src_entitlement_id", srcEntitlementID), - zap.String("dst_entitlement_id", grant.GetEntitlement().GetId()), - ) +// loadEntitlementGraph loads one page of grants and adds expandable relationships to the graph. +// This method handles pagination via the syncer's state machine. +func (s *syncer) loadEntitlementGraph(ctx context.Context, graph *expand.EntitlementGraph) error { + l := ctxzap.Extract(ctx) + pageToken := s.state.PageToken(ctx) - srcEntitlement, err := s.store.GetEntitlement(ctx, reader_v2.EntitlementsReaderServiceGetEntitlementRequest_builder{ - EntitlementId: srcEntitlementID, - }.Build()) - if err != nil { - l.Error("error fetching source entitlement", - zap.String("src_entitlement_id", srcEntitlementID), - zap.String("dst_entitlement_id", grant.GetEntitlement().GetId()), - zap.Error(err), - ) - continue - } + if pageToken == "" { + l.Info("Expanding grants...") + s.handleInitialActionForStep(ctx, *s.state.Current()) + } - // The expand annotation points at entitlements by id. Those entitlements' resource should match - // the current grant's principal, so we don't allow expanding arbitrary entitlements. - sourceEntitlementResourceID := srcEntitlement.GetEntitlement().GetResource().GetId() - if sourceEntitlementResourceID == nil { - return fmt.Errorf("source entitlement resource id was nil") - } - if principalID.GetResourceType() != sourceEntitlementResourceID.GetResourceType() || - principalID.GetResource() != sourceEntitlementResourceID.GetResource() { - l.Error( - "source entitlement resource id did not match grant principal id", - zap.String("grant_principal_id", principalID.String()), - zap.String("source_entitlement_resource_id", sourceEntitlementResourceID.String())) - - return fmt.Errorf("source entitlement resource id did not match grant principal id") - } + resp, err := s.store.ListGrants(ctx, v2.GrantsServiceListGrantsRequest_builder{PageToken: pageToken}.Build()) + if err != nil { + return err + } - entitlementGraph.AddEntitlement(grant.GetEntitlement()) - entitlementGraph.AddEntitlement(srcEntitlement.GetEntitlement()) - err = entitlementGraph.AddEdge(ctx, - srcEntitlement.GetEntitlement().GetId(), - grant.GetEntitlement().GetId(), - expandable.GetShallow(), - expandable.GetResourceTypeIds(), - ) - if err != nil { - return fmt.Errorf("error adding edge to graph: %w", err) - } - } - } - if entitlementGraph.Loaded { - l.Info("Finished loading entitlement graph", zap.Int("edges", len(entitlementGraph.Edges))) + // Handle pagination + if resp.GetNextPageToken() != "" { + err = s.state.NextPage(ctx, resp.GetNextPageToken()) + if err != nil { + return err } - return nil + } else { + l.Debug("Finished loading grants to expand") + graph.Loaded = true } - if entitlementGraph.Loaded { - comps, sccMetrics := entitlementGraph.ComputeCyclicComponents(ctx) - if len(comps) > 0 { - // Log a sample cycle - l.Warn( - "cycle detected in entitlement graph", - zap.Any("cycle", comps[0]), - zap.Any("scc_metrics", sccMetrics), - ) - l.Debug("initial graph stats", - zap.Int("edges", len(entitlementGraph.Edges)), - zap.Int("nodes", len(entitlementGraph.Nodes)), - zap.Int("actions", len(entitlementGraph.Actions)), - zap.Int("depth", entitlementGraph.Depth), - zap.Bool("has_no_cycles", entitlementGraph.HasNoCycles), - ) - if dontFixCycles { - return fmt.Errorf("cycles detected in entitlement graph") - } - err := entitlementGraph.FixCyclesFromComponents(ctx, comps) - if err != nil { - return err + // Process grants and add edges to the graph + updatedGrants := make([]*v2.Grant, 0) + for _, grant := range resp.GetList() { + err := s.processGrantForGraph(ctx, grant, graph) + if err != nil { + return err + } + + // Remove expandable annotation from descendant grant now that we've added it to the graph. + // That way if this sync is part of a compaction, expanding grants at the end of compaction won't redo work. + newAnnos := make(annotations.Annotations, 0) + updated := false + for _, anno := range grant.GetAnnotations() { + if anno.MessageIs(&v2.GrantExpandable{}) { + updated = true + } else { + newAnnos = append(newAnnos, anno) } } + if !updated { + continue + } + + grant.SetAnnotations(newAnnos) + l.Debug("removed expandable annotation from grant", zap.String("grant_id", grant.GetId())) + updatedGrants = append(updatedGrants, grant) + updatedGrants, err = expand.PutGrantsInChunks(ctx, s.store, updatedGrants, 10000) + if err != nil { + return err + } } - err := s.expandGrantsForEntitlements(ctx) + _, err = expand.PutGrantsInChunks(ctx, s.store, updatedGrants, 0) if err != nil { return err } + if graph.Loaded { + l.Info("Finished loading entitlement graph", zap.Int("edges", len(graph.Edges))) + } return nil } +// processGrantForGraph examines a grant for expandable annotations and adds edges to the graph. +func (s *syncer) processGrantForGraph(ctx context.Context, grant *v2.Grant, graph *expand.EntitlementGraph) error { + l := ctxzap.Extract(ctx) + + annos := annotations.Annotations(grant.GetAnnotations()) + expandable := &v2.GrantExpandable{} + _, err := annos.Pick(expandable) + if err != nil { + return err + } + if len(expandable.GetEntitlementIds()) == 0 { + return nil + } + + principalID := grant.GetPrincipal().GetId() + if principalID == nil { + return fmt.Errorf("principal id was nil") + } + + for _, srcEntitlementID := range expandable.GetEntitlementIds() { + l.Debug( + "Expandable entitlement found", + zap.String("src_entitlement_id", srcEntitlementID), + zap.String("dst_entitlement_id", grant.GetEntitlement().GetId()), + ) + + srcEntitlement, err := s.store.GetEntitlement(ctx, reader_v2.EntitlementsReaderServiceGetEntitlementRequest_builder{ + EntitlementId: srcEntitlementID, + }.Build()) + if err != nil { + l.Error("error fetching source entitlement", + zap.String("src_entitlement_id", srcEntitlementID), + zap.String("dst_entitlement_id", grant.GetEntitlement().GetId()), + zap.Error(err), + ) + continue + } + + // The expand annotation points at entitlements by id. Those entitlements' resource should match + // the current grant's principal, so we don't allow expanding arbitrary entitlements. + sourceEntitlementResourceID := srcEntitlement.GetEntitlement().GetResource().GetId() + if sourceEntitlementResourceID == nil { + return fmt.Errorf("source entitlement resource id was nil") + } + if principalID.GetResourceType() != sourceEntitlementResourceID.GetResourceType() || + principalID.GetResource() != sourceEntitlementResourceID.GetResource() { + l.Error( + "source entitlement resource id did not match grant principal id", + zap.String("grant_principal_id", principalID.String()), + zap.String("source_entitlement_resource_id", sourceEntitlementResourceID.String())) + + return fmt.Errorf("source entitlement resource id did not match grant principal id") + } + + graph.AddEntitlement(grant.GetEntitlement()) + graph.AddEntitlement(srcEntitlement.GetEntitlement()) + err = graph.AddEdge(ctx, + srcEntitlement.GetEntitlement().GetId(), + grant.GetEntitlement().GetId(), + expandable.GetShallow(), + expandable.GetResourceTypeIds(), + ) + if err != nil { + return fmt.Errorf("error adding edge to graph: %w", err) + } + } + return nil +} + +// fixEntitlementGraphCycles detects and fixes cycles in the entitlement graph. +func (s *syncer) fixEntitlementGraphCycles(ctx context.Context, graph *expand.EntitlementGraph) error { + l := ctxzap.Extract(ctx) + + comps, sccMetrics := graph.ComputeCyclicComponents(ctx) + if len(comps) == 0 { + graph.HasNoCycles = true + return nil + } + l.Warn( + "cycle detected in entitlement graph", + zap.Any("cycle", comps[0]), + zap.Any("scc_metrics", sccMetrics), + ) + l.Debug("initial graph stats", + zap.Int("edges", len(graph.Edges)), + zap.Int("nodes", len(graph.Nodes)), + zap.Int("actions", len(graph.Actions)), + zap.Int("depth", graph.Depth), + zap.Bool("has_no_cycles", graph.HasNoCycles), + ) + if dontFixCycles { + return fmt.Errorf("cycles detected in entitlement graph") + } + return graph.FixCyclesFromComponents(ctx, comps) +} + // SyncGrants fetches the grants for each resource from the connector. It iterates each resource // from the datastore, and pushes a new action to sync the grants for each individual resource. func (s *syncer) SyncGrants(ctx context.Context) error { @@ -1749,14 +1944,9 @@ func (s *syncer) fetchResourceForPreviousSync(ctx context.Context, resourceID *v l := ctxzap.Extract(ctx) - var previousSyncID string - var err error - - if psf, ok := s.store.(latestSyncFetcher); ok { - previousSyncID, err = psf.LatestFinishedSync(ctx, connectorstore.SyncTypeFull) - if err != nil { - return "", nil, err - } + previousSyncID, err := s.getPreviousFullSyncID(ctx) + if err != nil { + return "", nil, err } if previousSyncID == "" { @@ -1821,6 +2011,7 @@ func (s *syncer) fetchEtaggedGrantsForResource( var ret []*v2.Grant // No previous etag, so an etag match is not possible + // TODO(kans): do the request again to get the grants, but this time don't use the etag match! if prevEtag == nil { return nil, false, errors.New("connector returned an etag match but there is no previous sync generation to use") } @@ -2327,6 +2518,11 @@ func (s *syncer) listExternalEntitlementsForResource(ctx context.Context, resour break } } + for _, ent := range ents { + annos := annotations.Annotations(ent.GetAnnotations()) + annos.Update(&v2.EntitlementImmutable{}) + ent.SetAnnotations(annos) + } return ents, nil } @@ -2344,6 +2540,12 @@ func (s *syncer) listExternalGrantsForEntitlement(ctx context.Context, ent *v2.E } grants := grantsForEntitlementResp.GetList() if len(grants) > 0 { + // Add immutable annotation to external resource grants. + for _, grant := range grants { + annos := annotations.Annotations(grant.GetAnnotations()) + annos.Update(&v2.GrantImmutable{}) + grant.SetAnnotations(annos) + } if !yield(grants, err) { return } @@ -2707,267 +2909,35 @@ func GetExpandableAnnotation(annos annotations.Annotations) (*v2.GrantExpandable return expandableAnno, nil } -func (s *syncer) runGrantExpandActions(ctx context.Context) (bool, error) { - ctx, span := tracer.Start(ctx, "syncer.runGrantExpandActions") - defer span.End() - - l := ctxzap.Extract(ctx) - - graph := s.state.EntitlementGraph(ctx) - l = l.With(zap.Int("depth", graph.Depth)) - - // Peek the next action on the stack - if len(graph.Actions) == 0 { - l.Debug("runGrantExpandActions: no actions") // zap.Any("graph", graph), - - return true, nil - } - action := graph.Actions[0] - - l = l.With(zap.String("source_entitlement_id", action.SourceEntitlementID), zap.String("descendant_entitlement_id", action.DescendantEntitlementID)) - - // Fetch source and descendant entitlement - sourceEntitlement, err := s.store.GetEntitlement(ctx, reader_v2.EntitlementsReaderServiceGetEntitlementRequest_builder{ - EntitlementId: action.SourceEntitlementID, - }.Build()) - if err != nil { - l.Error("runGrantExpandActions: error fetching source entitlement", zap.Error(err)) - return false, fmt.Errorf("runGrantExpandActions: error fetching source entitlement: %w", err) - } - - descendantEntitlement, err := s.store.GetEntitlement(ctx, reader_v2.EntitlementsReaderServiceGetEntitlementRequest_builder{ - EntitlementId: action.DescendantEntitlementID, - }.Build()) - if err != nil { - l.Error("runGrantExpandActions: error fetching descendant entitlement", zap.Error(err)) - return false, fmt.Errorf("runGrantExpandActions: error fetching descendant entitlement: %w", err) - } - - // Fetch a page of source grants - sourceGrants, err := s.store.ListGrantsForEntitlement(ctx, reader_v2.GrantsReaderServiceListGrantsForEntitlementRequest_builder{ - Entitlement: sourceEntitlement.GetEntitlement(), - PageToken: action.PageToken, - }.Build()) - if err != nil { - l.Error("runGrantExpandActions: error fetching source grants", zap.Error(err)) - return false, fmt.Errorf("runGrantExpandActions: error fetching source grants: %w", err) - } - - var newGrants = make([]*v2.Grant, 0) - for _, sourceGrant := range sourceGrants.GetList() { - // Skip this grant if it is not for a resource type we care about - if len(action.ResourceTypeIDs) > 0 { - relevantResourceType := slices.Contains(action.ResourceTypeIDs, sourceGrant.GetPrincipal().GetId().GetResourceType()) - - if !relevantResourceType { - continue - } - } - - // If this is a shallow action, then we only want to expand grants that have no sources which indicates that it was directly assigned. - if action.Shallow { - // If we have no sources, this is a direct grant - foundDirectGrant := len(sourceGrant.GetSources().GetSources()) == 0 - // If the source grant has sources, then we need to see if any of them are the source entitlement itself - for src := range sourceGrant.GetSources().GetSources() { - if src == sourceEntitlement.GetEntitlement().GetId() { - foundDirectGrant = true - break - } - } - - // This is not a direct grant, so skip it since we are a shallow action - if !foundDirectGrant { - continue - } - } - - // Unroll all grants for the principal on the descendant entitlement. This should, on average, be... 1. - descendantGrants := make([]*v2.Grant, 0, 1) - pageToken := "" - for { - req := reader_v2.GrantsReaderServiceListGrantsForEntitlementRequest_builder{ - Entitlement: descendantEntitlement.GetEntitlement(), - PrincipalId: sourceGrant.GetPrincipal().GetId(), - PageToken: pageToken, - Annotations: nil, - }.Build() - - resp, err := s.store.ListGrantsForEntitlement(ctx, req) - if err != nil { - l.Error("runGrantExpandActions: error fetching descendant grants", zap.Error(err)) - return false, fmt.Errorf("runGrantExpandActions: error fetching descendant grants: %w", err) - } - - descendantGrants = append(descendantGrants, resp.GetList()...) - pageToken = resp.GetNextPageToken() - if pageToken == "" { - break - } - } - - // If we have no grants for the principal in the descendant entitlement, make one. - directGrant := true - if len(descendantGrants) == 0 { - directGrant = false - // TODO(morgabra): This is kinda gnarly, grant ID won't have any special meaning. - // FIXME(morgabra): We should probably conflict check with grant id? - descendantGrant, err := s.newExpandedGrant(ctx, descendantEntitlement.GetEntitlement(), sourceGrant.GetPrincipal()) - if err != nil { - l.Error("runGrantExpandActions: error creating new grant", zap.Error(err)) - return false, fmt.Errorf("runGrantExpandActions: error creating new grant: %w", err) - } - descendantGrants = append(descendantGrants, descendantGrant) - l.Debug( - "runGrantExpandActions: created new grant for expansion", - zap.String("grant_id", descendantGrant.GetId()), - ) - } - - // Add the source entitlement as a source to all descendant grants. - for _, descendantGrant := range descendantGrants { - sources := descendantGrant.GetSources() - if sources == nil { - sources = &v2.GrantSources{} - descendantGrant.SetSources(sources) - } - sourcesMap := sources.GetSources() - if sourcesMap == nil { - sourcesMap = make(map[string]*v2.GrantSources_GrantSource) - sources.SetSources(sourcesMap) - } - - if directGrant && len(sources.GetSources()) == 0 { - // If we are already granted this entitlement, make sure to add ourselves as a source. - sourcesMap[descendantGrant.GetEntitlement().GetId()] = &v2.GrantSources_GrantSource{} - } - // Include the source grant as a source. - sourcesMap[sourceGrant.GetEntitlement().GetId()] = &v2.GrantSources_GrantSource{} - } - newGrants = append(newGrants, descendantGrants...) - } - - err = s.store.PutGrants(ctx, newGrants...) - if err != nil { - l.Error("runGrantExpandActions: error updating descendant grants", zap.Error(err)) - return false, fmt.Errorf("runGrantExpandActions: error updating descendant grants: %w", err) - } - - // If we have no more pages of work, pop the action off the stack and mark this edge in the graph as done - action.PageToken = sourceGrants.GetNextPageToken() - if action.PageToken == "" { - graph.MarkEdgeExpanded(action.SourceEntitlementID, action.DescendantEntitlementID) - graph.Actions = graph.Actions[1:] - } - return false, nil -} - -func (s *syncer) newExpandedGrant(_ context.Context, descEntitlement *v2.Entitlement, principal *v2.Resource) (*v2.Grant, error) { - enResource := descEntitlement.GetResource() - if enResource == nil { - return nil, fmt.Errorf("newExpandedGrant: entitlement has no resource") - } - - if principal == nil { - return nil, fmt.Errorf("newExpandedGrant: principal is nil") - } - - // Add immutable annotation since this function is only called if no direct grant exists - var annos annotations.Annotations - annos.Update(&v2.GrantImmutable{}) - - grant := v2.Grant_builder{ - Id: fmt.Sprintf("%s:%s:%s", descEntitlement.GetId(), principal.GetId().GetResourceType(), principal.GetId().GetResource()), - Entitlement: descEntitlement, - Principal: principal, - Annotations: annos, - }.Build() - - return grant, nil -} - // expandGrantsForEntitlements expands grants for the given entitlement. +// This method delegates to the expand.Expander for the actual expansion logic. func (s *syncer) expandGrantsForEntitlements(ctx context.Context) error { ctx, span := tracer.Start(ctx, "syncer.expandGrantsForEntitlements") defer span.End() l := ctxzap.Extract(ctx) - graph := s.state.EntitlementGraph(ctx) - l = l.With(zap.Int("depth", graph.Depth)) - l.Debug("expandGrantsForEntitlements: start") // zap.Any("graph", graph) s.counts.LogExpandProgress(ctx, graph.Actions) - actionsDone, err := s.runGrantExpandActions(ctx) + // Create an expander and run a single step + expander := expand.NewExpander(s.store, graph) + err := expander.RunSingleStep(ctx) if err != nil { - erroredAction := graph.Actions[0] - l.Error("expandGrantsForEntitlements: error running graph action", zap.Error(err), zap.Any("action", erroredAction)) - _ = graph.DeleteEdge(ctx, erroredAction.SourceEntitlementID, erroredAction.DescendantEntitlementID) - if !errors.Is(err, sql.ErrNoRows) { - return err - } - // Skip action and delete the edge that caused the error. - graph.Actions = graph.Actions[1:] - if len(graph.Actions) == 0 { - actionsDone = true - } - // TODO: Return a warning? The connector gave a bad entitlement ID to expand. - } - if !actionsDone { - return nil - } - - if maxDepth == 0 { - maxDepth = defaultMaxDepth - } - - if int64(graph.Depth) > maxDepth { - l.Error( - "expandGrantsForEntitlements: exceeded max depth", - // zap.Any("graph", graph), - zap.Int64("max_depth", maxDepth), - ) - s.state.FinishAction(ctx) - return fmt.Errorf("expandGrantsForEntitlements: exceeded max depth (%d)", maxDepth) - } - - // TODO(morgabra) Yield here after some amount of work? - // traverse edges or call some sort of getEntitlements - for _, sourceEntitlementID := range graph.GetEntitlements() { - // We've already expanded this entitlement, so skip it. - if graph.IsEntitlementExpanded(sourceEntitlementID) { - continue - } - - // We have ancestors who have not been expanded yet, so we can't expand ourselves. - if graph.HasUnexpandedAncestors(sourceEntitlementID) { - l.Debug("expandGrantsForEntitlements: skipping source entitlement because it has unexpanded ancestors", zap.String("source_entitlement_id", sourceEntitlementID)) - continue - } - - for descendantEntitlementID, grantInfo := range graph.GetDescendantEntitlements(sourceEntitlementID) { - if grantInfo.IsExpanded { - continue - } - graph.Actions = append(graph.Actions, &expand.EntitlementGraphAction{ - SourceEntitlementID: sourceEntitlementID, - DescendantEntitlementID: descendantEntitlementID, - PageToken: "", - Shallow: grantInfo.IsShallow, - ResourceTypeIDs: grantInfo.ResourceTypeIDs, - }) + l.Error("expandGrantsForEntitlements: error during expansion", zap.Error(err)) + // If max depth exceeded, finish the action before returning the error + // to prevent the state machine from getting stuck + if errors.Is(err, expand.ErrMaxDepthExceeded) { + s.state.FinishAction(ctx) } + return err } - if graph.IsExpanded() { - l.Debug("expandGrantsForEntitlements: graph is expanded") // zap.Any("graph", graph) + if expander.IsDone(ctx) { + l.Debug("expandGrantsForEntitlements: graph is expanded") s.state.FinishAction(ctx) - return nil } - graph.Depth++ - l.Debug("expandGrantsForEntitlements: graph is not expanded") // zap.Any("graph", graph) return nil } @@ -3007,14 +2977,14 @@ func (s *syncer) Close(ctx context.Context) error { var err error if s.store != nil { - err = s.store.Close() + err = s.store.Close(ctx) if err != nil { return fmt.Errorf("error closing store: %w", err) } } if s.externalResourceReader != nil { - err = s.externalResourceReader.Close() + err = s.externalResourceReader.Close(ctx) if err != nil { return fmt.Errorf("error closing external resource reader: %w", err) } @@ -3101,10 +3071,10 @@ func WithExternalResourceEntitlementIdFilter(entitlementId string) SyncOpt { } } -func WithTargetedSyncResourceIDs(resourceIDs []string) SyncOpt { +func WithTargetedSyncResources(resources []*v2.Resource) SyncOpt { return func(s *syncer) { - s.targetedSyncResourceIDs = resourceIDs - if len(resourceIDs) > 0 { + s.targetedSyncResources = resources + if len(resources) > 0 { s.syncType = connectorstore.SyncTypePartial return } @@ -3166,11 +3136,12 @@ func WithSkipGrants(skip bool) SyncOpt { // NewSyncer returns a new syncer object. func NewSyncer(ctx context.Context, c types.ConnectorClient, opts ...SyncOpt) (Syncer, error) { s := &syncer{ - connector: c, - skipEGForResourceType: make(map[string]bool), - resourceTypeTraits: make(map[string][]v2.ResourceType_Trait), - counts: NewProgressCounts(), - syncType: connectorstore.SyncTypeFull, + connector: c, + skipEGForResourceType: make(map[string]bool), + skipEntitlementsForResourceType: make(map[string]bool), + resourceTypeTraits: make(map[string][]v2.ResourceType_Trait), + counts: NewProgressCounts(), + syncType: connectorstore.SyncTypeFull, } for _, o := range opts { diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/synccompactor/attached/attached.go b/vendor/github.com/conductorone/baton-sdk/pkg/synccompactor/attached/attached.go index e3e9fa4b..4542f26d 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/synccompactor/attached/attached.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/synccompactor/attached/attached.go @@ -4,6 +4,7 @@ import ( "context" "fmt" + reader_v2 "github.com/conductorone/baton-sdk/pb/c1/reader/v2" "github.com/conductorone/baton-sdk/pkg/connectorstore" "github.com/conductorone/baton-sdk/pkg/dotc1z" "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" @@ -13,49 +14,74 @@ import ( type Compactor struct { base *dotc1z.C1File applied *dotc1z.C1File - dest *dotc1z.C1File } -func NewAttachedCompactor(base *dotc1z.C1File, applied *dotc1z.C1File, dest *dotc1z.C1File) *Compactor { +func NewAttachedCompactor(base *dotc1z.C1File, applied *dotc1z.C1File) *Compactor { return &Compactor{ base: base, applied: applied, - dest: dest, } } -func (c *Compactor) CompactWithSyncID(ctx context.Context, destSyncID string) error { - baseSyncID, err := c.base.LatestFinishedSyncID(ctx, connectorstore.SyncTypeAny) - if err != nil { - return fmt.Errorf("failed to get base sync ID: %w", err) +func latestFinishedCompactableSync(ctx context.Context, f *dotc1z.C1File) (*reader_v2.SyncRun, error) { + // Compaction must NOT operate on diff syncs (partial_upserts / partial_deletions). + // We want the latest finished "snapshot-like" sync. + candidates := []connectorstore.SyncType{ + connectorstore.SyncTypeFull, + connectorstore.SyncTypeResourcesOnly, + connectorstore.SyncTypePartial, } - if baseSyncID == "" { - return fmt.Errorf("no finished sync found in base") + + var best *reader_v2.SyncRun + for _, st := range candidates { + resp, err := f.GetLatestFinishedSync(ctx, reader_v2.SyncsReaderServiceGetLatestFinishedSyncRequest_builder{ + SyncType: string(st), + }.Build()) + if err != nil { + return nil, err + } + s := resp.GetSync() + if s == nil { + continue + } + + if best == nil || s.GetEndedAt().AsTime().After(best.GetEndedAt().AsTime()) { + best = s + } } - appliedSyncID, err := c.applied.LatestFinishedSyncID(ctx, connectorstore.SyncTypeAny) + return best, nil +} + +func (c *Compactor) Compact(ctx context.Context) error { + baseSync, err := latestFinishedCompactableSync(ctx, c.base) if err != nil { - return fmt.Errorf("failed to get applied sync ID: %w", err) + return fmt.Errorf("failed to get base sync: %w", err) } - if appliedSyncID == "" { - return fmt.Errorf("no finished sync found in applied") + if baseSync == nil { + return fmt.Errorf( + "no finished compactable sync found in base (diff sync types %q/%q are not compactable)", + string(connectorstore.SyncTypePartialUpserts), + string(connectorstore.SyncTypePartialDeletions), + ) } - // Attach both the base and applied databases to the destination - base, err := c.dest.AttachFile(c.base, "base") + appliedSync, err := latestFinishedCompactableSync(ctx, c.applied) if err != nil { - return fmt.Errorf("failed to attach databases to destination: %w", err) + return fmt.Errorf("failed to get applied sync: %w", err) } + if appliedSync == nil { + return fmt.Errorf( + "no finished compactable sync found in applied (diff sync types %q/%q are not compactable)", + string(connectorstore.SyncTypePartialUpserts), + string(connectorstore.SyncTypePartialDeletions), + ) + } + l := ctxzap.Extract(ctx) - defer func() { - _, err := base.DetachFile("base") - if err != nil { - l.Error("failed to detach file", zap.Error(err)) - } - }() // Attach both the base and applied databases to the destination - attached, err := c.dest.AttachFile(c.applied, "attached") + attached, err := c.base.AttachFile(c.applied, "attached") if err != nil { return fmt.Errorf("failed to attach databases to destination: %w", err) } @@ -66,28 +92,36 @@ func (c *Compactor) CompactWithSyncID(ctx context.Context, destSyncID string) er } }() - if err := c.processRecords(ctx, attached, destSyncID, baseSyncID, appliedSyncID); err != nil { + if err := c.processRecords(ctx, attached, baseSync, appliedSync); err != nil { return fmt.Errorf("failed to process records: %w", err) } return nil } -func (c *Compactor) processRecords(ctx context.Context, attached *dotc1z.C1FileAttached, destSyncID string, baseSyncID string, appliedSyncID string) error { +func (c *Compactor) processRecords(ctx context.Context, attached *dotc1z.C1FileAttached, baseSync *reader_v2.SyncRun, appliedSync *reader_v2.SyncRun) error { + baseSyncID := baseSync.GetId() + appliedSyncID := appliedSync.GetId() + + // Update the base sync type to the union of the base and applied sync types. + if err := attached.UpdateSync(ctx, baseSync, appliedSync); err != nil { + return fmt.Errorf("failed to update sync %s: %w", baseSyncID, err) + } + // Compact all tables: copy base records and merge newer applied records using raw SQL - if err := attached.CompactResourceTypes(ctx, destSyncID, baseSyncID, appliedSyncID); err != nil { + if err := attached.CompactResourceTypes(ctx, baseSyncID, appliedSyncID); err != nil { return fmt.Errorf("failed to compact resource types: %w", err) } - if err := attached.CompactResources(ctx, destSyncID, baseSyncID, appliedSyncID); err != nil { + if err := attached.CompactResources(ctx, baseSyncID, appliedSyncID); err != nil { return fmt.Errorf("failed to compact resources: %w", err) } - if err := attached.CompactEntitlements(ctx, destSyncID, baseSyncID, appliedSyncID); err != nil { + if err := attached.CompactEntitlements(ctx, baseSyncID, appliedSyncID); err != nil { return fmt.Errorf("failed to compact entitlements: %w", err) } - if err := attached.CompactGrants(ctx, destSyncID, baseSyncID, appliedSyncID); err != nil { + if err := attached.CompactGrants(ctx, baseSyncID, appliedSyncID); err != nil { return fmt.Errorf("failed to compact grants: %w", err) } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/synccompactor/compactor.go b/vendor/github.com/conductorone/baton-sdk/pkg/synccompactor/compactor.go index aa588251..3a43622f 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/synccompactor/compactor.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/synccompactor/compactor.go @@ -13,11 +13,9 @@ import ( reader_v2 "github.com/conductorone/baton-sdk/pb/c1/reader/v2" "github.com/conductorone/baton-sdk/pkg/connectorstore" "github.com/conductorone/baton-sdk/pkg/dotc1z" - c1zmanager "github.com/conductorone/baton-sdk/pkg/dotc1z/manager" "github.com/conductorone/baton-sdk/pkg/sdk" "github.com/conductorone/baton-sdk/pkg/sync" "github.com/conductorone/baton-sdk/pkg/synccompactor/attached" - "github.com/conductorone/baton-sdk/pkg/synccompactor/naive" "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" "go.opentelemetry.io/otel" "go.uber.org/zap" @@ -28,17 +26,18 @@ var tracer = otel.Tracer("baton-sdk/pkg.synccompactor") type CompactorType string const ( - CompactorTypeNaive CompactorType = "naive" CompactorTypeAttached CompactorType = "attached" ) type Compactor struct { compactorType CompactorType entries []*CompactableSync + compactedC1z *dotc1z.C1File tmpDir string destDir string runDuration time.Duration + syncLimit int } type CompactableSync struct { @@ -70,6 +69,13 @@ func WithRunDuration(runDuration time.Duration) Option { } } +// WithSyncLimit sets the number of syncs to keep after compaction cleanup. +func WithSyncLimit(limit int) Option { + return func(c *Compactor) { + c.syncLimit = limit + } +} + func NewCompactor(ctx context.Context, outputDir string, compactableSyncs []*CompactableSync, opts ...Option) (*Compactor, func() error, error) { if len(compactableSyncs) < 2 { return nil, nil, ErrNotEnoughFilesToCompact @@ -107,72 +113,128 @@ func NewCompactor(ctx context.Context, outputDir string, compactableSyncs []*Com func (c *Compactor) Compact(ctx context.Context) (*CompactableSync, error) { ctx, span := tracer.Start(ctx, "Compactor.Compact") defer span.End() - now := time.Now() if len(c.entries) < 2 { return nil, nil } + compactionStart := time.Now() + runCtx := ctx + var runCanc context.CancelFunc + if c.runDuration > 0 { + runCtx, runCanc = context.WithTimeout(ctx, c.runDuration) + } + if runCanc != nil { + defer runCanc() + } + + l := ctxzap.Extract(ctx) var err error - // Base sync is c.entries[0], so compact all incrementals first, then apply that onto the base. - applied := c.entries[len(c.entries)-1] - for i := len(c.entries) - 2; i >= 0; i-- { - applied, err = c.doOneCompaction(ctx, c.entries[i], applied) - if err != nil { + select { + case <-runCtx.Done(): + err = context.Cause(runCtx) + switch { + case errors.Is(err, context.DeadlineExceeded): + l.Info("compaction run duration has expired, exiting compaction early") + return nil, fmt.Errorf("compaction run duration has expired: %w", err) + default: + l.Error("compaction context cancelled", zap.Error(err)) return nil, err } + default: } - l := ctxzap.Extract(ctx) - // Grant expansion doesn't use the connector interface at all, so giving syncer an empty connector is safe... for now. - // If that ever changes, we should implement a file connector that is a wrapper around the reader. - emptyConnector, err := sdk.NewEmptyConnector() + opts := []dotc1z.C1ZOption{ + dotc1z.WithTmpDir(c.tmpDir), + // Performance improvements: + // NOTE: We do not close this c1z after compaction, so syncer will have these pragmas when expanding grants. + // We should re-evaluate these pragmas when partial syncs sync grants. + // Disable journaling. + dotc1z.WithPragma("journal_mode", "OFF"), + // Disable synchronous writes + dotc1z.WithPragma("synchronous", "OFF"), + // Use exclusive locking. + dotc1z.WithPragma("main.locking_mode", "EXCLUSIVE"), + // Use parallel decoding. + dotc1z.WithDecoderOptions(dotc1z.WithDecoderConcurrency(-1)), + // Use parallel encoding. + dotc1z.WithEncoderConcurrency(0), + } + if c.syncLimit > 0 { + opts = append(opts, dotc1z.WithSyncLimit(c.syncLimit)) + } + + fileName := fmt.Sprintf("compacted-%s.c1z", c.entries[0].SyncID) + destFilePath := path.Join(c.tmpDir, fileName) + + c.compactedC1z, err = dotc1z.NewC1ZFile(ctx, destFilePath, opts...) if err != nil { - l.Error("error creating empty connector", zap.Error(err)) + l.Error("doOneCompaction failed: could not create c1z file", zap.Error(err)) return nil, err } - - // Use syncer to expand grants. - // TODO: Handle external resources. - syncOpts := []sync.SyncOpt{ - sync.WithC1ZPath(applied.FilePath), - sync.WithTmpDir(c.tmpDir), - sync.WithSyncID(applied.SyncID), - sync.WithOnlyExpandGrants(), + defer func() { + if c.compactedC1z == nil { + return + } + err := c.compactedC1z.Close(ctx) + if err != nil { + l.Error("error closing compacted c1z", zap.Error(err)) + } + }() + // Start new sync of type partial. If we compact syncs of other types, this sync type will be updated by attached.UpdateSync which is called by doOneCompaction(). + newSyncId, err := c.compactedC1z.StartNewSync(ctx, connectorstore.SyncTypePartial, "") + if err != nil { + return nil, fmt.Errorf("failed to start new sync: %w", err) } + err = c.compactedC1z.EndSync(ctx) + if err != nil { + return nil, fmt.Errorf("failed to end sync: %w", err) + } + l.Debug("new empty partial sync created", zap.String("sync_id", newSyncId)) - compactionDuration := time.Since(now) - runDuration := c.runDuration - compactionDuration - l.Debug("finished compaction", zap.Duration("compaction_duration", compactionDuration)) - - switch { - case c.runDuration > 0 && runDuration < 0: - return nil, fmt.Errorf("unable to finish compaction sync in run duration (%s). compactions took %s", c.runDuration, compactionDuration) - case runDuration > 0: - syncOpts = append(syncOpts, sync.WithRunDuration(runDuration)) + // Base sync is c.entries[0], so compact in reverse order. That way we compact the biggest sync last. + for i := len(c.entries) - 1; i >= 0; i-- { + err = c.doOneCompaction(ctx, c.entries[i]) + if err != nil { + return nil, fmt.Errorf("failed to compact sync %s: %w", c.entries[i].SyncID, err) + } } - syncer, err := sync.NewSyncer( - ctx, - emptyConnector, - syncOpts..., - ) + resp, err := c.compactedC1z.GetSync(ctx, reader_v2.SyncsReaderServiceGetSyncRequest_builder{ + SyncId: newSyncId, + }.Build()) if err != nil { - l.Error("error creating syncer", zap.Error(err)) - return nil, err + return nil, fmt.Errorf("failed to get sync: %w", err) + } + newSync := resp.GetSync() + if newSync == nil { + return nil, fmt.Errorf("no sync found") } - if err := syncer.Sync(ctx); err != nil { - l.Error("error syncing with grant expansion", zap.Error(err)) - return nil, err + if newSync.GetId() != newSyncId { + return nil, fmt.Errorf("new sync id does not match expected id: %s != %s", newSync.GetId(), newSyncId) } - if err := syncer.Close(ctx); err != nil { - l.Error("error closing syncer", zap.Error(err)) - return nil, err + + if newSync.GetSyncType() == string(connectorstore.SyncTypePartial) { + err = c.compactedC1z.Cleanup(ctx) + if err != nil { + return nil, fmt.Errorf("failed to cleanup compacted c1z: %w", err) + } + // Close compactedC1z so that the c1z file is written to disk before cpFile() is called. + err = c.compactedC1z.Close(ctx) + if err != nil { + return nil, fmt.Errorf("failed to close compacted c1z: %w", err) + } + c.compactedC1z = nil + } else { + err = c.expandGrants(ctx, newSyncId, compactionStart) + if err != nil { + return nil, fmt.Errorf("failed to expand grants: %w", err) + } } // Move last compacted file to the destination dir - finalPath := path.Join(c.destDir, fmt.Sprintf("compacted-%s.c1z", applied.SyncID)) - if err := cpFile(applied.FilePath, finalPath); err != nil { + finalPath := path.Join(c.destDir, fmt.Sprintf("compacted-%s.c1z", newSyncId)) + if err := cpFile(ctx, destFilePath, finalPath); err != nil { return nil, err } @@ -183,10 +245,18 @@ func (c *Compactor) Compact(ctx context.Context) (*CompactableSync, error) { } finalPath = abs } - return &CompactableSync{FilePath: finalPath, SyncID: applied.SyncID}, nil + return &CompactableSync{FilePath: finalPath, SyncID: newSyncId}, nil } -func cpFile(sourcePath string, destPath string) error { +func cpFile(ctx context.Context, sourcePath string, destPath string) error { + err := os.Rename(sourcePath, destPath) + if err == nil { + return nil + } + + l := ctxzap.Extract(ctx) + l.Warn("compactor: failed to rename final compacted file, falling back to copy", zap.Error(err), zap.String("source_path", sourcePath), zap.String("dest_path", destPath)) + source, err := os.Open(sourcePath) if err != nil { return fmt.Errorf("failed to open source file: %w", err) @@ -207,124 +277,94 @@ func cpFile(sourcePath string, destPath string) error { return nil } -func (c *Compactor) getLatestObjects(ctx context.Context, info *CompactableSync) (*reader_v2.SyncRun, *dotc1z.C1File, c1zmanager.Manager, func(), error) { - cleanup := func() {} - baseC1Z, err := c1zmanager.New(ctx, info.FilePath, c1zmanager.WithTmpDir(c.tmpDir)) - if err != nil { - return nil, nil, nil, cleanup, err - } - - cleanup = func() { - _ = baseC1Z.Close(ctx) - } - - baseFile, err := baseC1Z.LoadC1Z(ctx) - if err != nil { - return nil, nil, nil, cleanup, err - } - - cleanup = func() { - _ = baseFile.Close() - _ = baseC1Z.Close(ctx) - } - - latestAppliedSync, err := baseFile.GetSync(ctx, reader_v2.SyncsReaderServiceGetSyncRequest_builder{ - SyncId: info.SyncID, - Annotations: nil, - }.Build()) - if err != nil { - return nil, nil, nil, cleanup, err - } - - return latestAppliedSync.GetSync(), baseFile, baseC1Z, cleanup, nil -} - -func unionSyncTypes(a, b connectorstore.SyncType) connectorstore.SyncType { - switch { - case a == connectorstore.SyncTypeFull || b == connectorstore.SyncTypeFull: - return connectorstore.SyncTypeFull - case a == connectorstore.SyncTypeResourcesOnly || b == connectorstore.SyncTypeResourcesOnly: - return connectorstore.SyncTypeResourcesOnly - default: - return connectorstore.SyncTypePartial - } -} - -func (c *Compactor) doOneCompaction(ctx context.Context, base *CompactableSync, applied *CompactableSync) (*CompactableSync, error) { +func (c *Compactor) doOneCompaction(ctx context.Context, cs *CompactableSync) error { ctx, span := tracer.Start(ctx, "Compactor.doOneCompaction") defer span.End() l := ctxzap.Extract(ctx) l.Info( "running compaction", - zap.String("base_file", base.FilePath), - zap.String("base_sync", base.SyncID), - zap.String("applied_file", applied.FilePath), - zap.String("applied_sync", applied.SyncID), + zap.String("apply_file", cs.FilePath), + zap.String("apply_sync", cs.SyncID), zap.String("tmp_dir", c.tmpDir), ) - opts := []dotc1z.C1ZOption{ - dotc1z.WithPragma("journal_mode", "WAL"), + applyFile, err := dotc1z.NewC1ZFile( + ctx, + cs.FilePath, dotc1z.WithTmpDir(c.tmpDir), - } - - fileName := fmt.Sprintf("compacted-%s-%s.c1z", base.SyncID, applied.SyncID) - newFile, err := dotc1z.NewC1ZFile(ctx, path.Join(c.tmpDir, fileName), opts...) - if err != nil { - l.Error("doOneCompaction failed: could not create c1z file", zap.Error(err)) - return nil, err - } - defer func() { _ = newFile.Close() }() - - baseSync, baseFile, _, cleanupBase, err := c.getLatestObjects(ctx, base) - defer cleanupBase() + dotc1z.WithDecoderOptions(dotc1z.WithDecoderConcurrency(-1)), + dotc1z.WithReadOnly(true), + // We're only reading, so it's safe to use these pragmas. + dotc1z.WithPragma("synchronous", "OFF"), + dotc1z.WithPragma("journal_mode", "OFF"), + dotc1z.WithPragma("locking_mode", "EXCLUSIVE"), + ) if err != nil { - return nil, err + return err } + defer func() { + err := applyFile.Close(ctx) + if err != nil { + l.Error("error closing apply file", zap.Error(err), zap.String("apply_file", cs.FilePath)) + } + }() - appliedSync, appliedFile, _, cleanupApplied, err := c.getLatestObjects(ctx, applied) - defer cleanupApplied() - if err != nil { - return nil, err + runner := attached.NewAttachedCompactor(c.compactedC1z, applyFile) + if err := runner.Compact(ctx); err != nil { + l.Error("error running compaction", zap.Error(err), zap.String("apply_file", cs.FilePath)) + return err } - syncType := unionSyncTypes(connectorstore.SyncType(baseSync.GetSyncType()), connectorstore.SyncType(appliedSync.GetSyncType())) + return nil +} - newSyncId, err := newFile.StartNewSync(ctx, syncType, "") +func (c *Compactor) expandGrants(ctx context.Context, newSyncId string, compactionStart time.Time) error { + l := ctxzap.Extract(ctx) + // Grant expansion doesn't use the connector interface at all, so giving syncer an empty connector is safe... for now. + // If that ever changes, we should implement a file connector that is a wrapper around the reader. + emptyConnector, err := sdk.NewEmptyConnector() if err != nil { - return nil, err + l.Error("error creating empty connector", zap.Error(err)) + return err } - switch c.compactorType { - case CompactorTypeNaive: - // TODO: Add support for syncID or remove naive compactor. - runner := naive.NewNaiveCompactor(baseFile, appliedFile, newFile) - if err := runner.Compact(ctx); err != nil { - l.Error("error running compaction", zap.Error(err)) - return nil, err - } - case CompactorTypeAttached: - runner := attached.NewAttachedCompactor(baseFile, appliedFile, newFile) - if err := runner.CompactWithSyncID(ctx, newSyncId); err != nil { - l.Error("error running compaction", zap.Error(err)) - return nil, err - } - default: - // c.compactorType defaults to attached, so this should never happen. - return nil, fmt.Errorf("invalid compactor type: %s", c.compactorType) + // Use syncer to expand grants. + // TODO: Handle external resources. + syncOpts := []sync.SyncOpt{ + sync.WithConnectorStore(c.compactedC1z), // Use the existing C1File so we're not wasting time compressing & decompressing it. + sync.WithTmpDir(c.tmpDir), + sync.WithSyncID(newSyncId), + sync.WithOnlyExpandGrants(), } - if err := newFile.EndSync(ctx); err != nil { - return nil, err + compactionDuration := time.Since(compactionStart) + runDuration := c.runDuration - compactionDuration + l.Debug("finished compaction", zap.Duration("compaction_duration", compactionDuration)) + + switch { + case c.runDuration > 0 && runDuration <= 0: + return fmt.Errorf("unable to finish compaction sync in run duration (%s). compactions took %s", c.runDuration, compactionDuration) + case runDuration > 0: + syncOpts = append(syncOpts, sync.WithRunDuration(runDuration)) } - outputFilepath, err := newFile.OutputFilepath() + syncer, err := sync.NewSyncer( + ctx, + emptyConnector, + syncOpts..., + ) if err != nil { - return nil, err + l.Error("error creating syncer", zap.Error(err)) + return err } - return &CompactableSync{ - FilePath: outputFilepath, - SyncID: newSyncId, - }, nil + if err := syncer.Sync(ctx); err != nil { + l.Error("error syncing with grant expansion", zap.Error(err)) + return err + } + if err := syncer.Close(ctx); err != nil { + l.Error("error closing syncer", zap.Error(err)) + return err + } + return nil } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/synccompactor/naive/naive.go b/vendor/github.com/conductorone/baton-sdk/pkg/synccompactor/naive/naive.go deleted file mode 100644 index 7e4ae6e9..00000000 --- a/vendor/github.com/conductorone/baton-sdk/pkg/synccompactor/naive/naive.go +++ /dev/null @@ -1,88 +0,0 @@ -package naive - -import ( - "context" - - "github.com/conductorone/baton-sdk/pkg/dotc1z" - "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" - "go.uber.org/zap" - "google.golang.org/protobuf/proto" -) - -func NewNaiveCompactor(base *dotc1z.C1File, applied *dotc1z.C1File, dest *dotc1z.C1File) *Compactor { - return &Compactor{ - base: base, - applied: applied, - dest: dest, - } -} - -type Compactor struct { - base *dotc1z.C1File - applied *dotc1z.C1File - dest *dotc1z.C1File -} - -func (n *Compactor) Compact(ctx context.Context) error { - if err := n.processResourceTypes(ctx); err != nil { - return err - } - if err := n.processResources(ctx); err != nil { - return err - } - if err := n.processEntitlements(ctx); err != nil { - return err - } - if err := n.processGrants(ctx); err != nil { - return err - } - return nil -} - -func naiveCompact[T proto.Message, REQ listRequest, RESP listResponse[T]]( - ctx context.Context, - base listFunc[T, REQ, RESP], - applied listFunc[T, REQ, RESP], - save func(context.Context, ...T) error, -) error { - var t T - l := ctxzap.Extract(ctx) - l.Info("naive compaction: compacting objects", zap.String("object_type", string(t.ProtoReflect().Descriptor().FullName()))) - // List all objects from the base file and save them in the destination file - if err := listAllObjects(ctx, base, func(items []T) (bool, error) { - if err := save(ctx, items...); err != nil { - return false, err - } - return true, nil - }); err != nil { - return err - } - - // Then list all objects from the applied file and save them in the destination file, overwriting ones with the same external_id - if err := listAllObjects(ctx, applied, func(items []T) (bool, error) { - if err := save(ctx, items...); err != nil { - return false, err - } - return true, nil - }); err != nil { - return err - } - - return nil -} - -func (n *Compactor) processResourceTypes(ctx context.Context) error { - return naiveCompact(ctx, n.base.ListResourceTypes, n.applied.ListResourceTypes, n.dest.PutResourceTypesIfNewer) -} - -func (n *Compactor) processResources(ctx context.Context) error { - return naiveCompact(ctx, n.base.ListResources, n.applied.ListResources, n.dest.PutResourcesIfNewer) -} - -func (n *Compactor) processGrants(ctx context.Context) error { - return naiveCompact(ctx, n.base.ListGrants, n.applied.ListGrants, n.dest.PutGrantsIfNewer) -} - -func (n *Compactor) processEntitlements(ctx context.Context) error { - return naiveCompact(ctx, n.base.ListEntitlements, n.applied.ListEntitlements, n.dest.PutEntitlementsIfNewer) -} diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/synccompactor/naive/naive_unroll.go b/vendor/github.com/conductorone/baton-sdk/pkg/synccompactor/naive/naive_unroll.go deleted file mode 100644 index cc4f8064..00000000 --- a/vendor/github.com/conductorone/baton-sdk/pkg/synccompactor/naive/naive_unroll.go +++ /dev/null @@ -1,98 +0,0 @@ -package naive - -import ( - "context" - "reflect" - - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/types/known/anypb" -) - -type listRequest interface { - proto.Message - GetPageSize() uint32 - GetPageToken() string - GetAnnotations() []*anypb.Any -} - -type listResponse[T proto.Message] interface { - GetNextPageToken() string - GetAnnotations() []*anypb.Any - GetList() []T -} - -// createRequest creates a new request object of type REQ using reflection. -func createRequest[REQ listRequest]() REQ { - var r REQ - baseType := reflect.TypeOf(r).Elem() - pointerToInitializedVal := reflect.New(baseType) - return pointerToInitializedVal.Interface().(REQ) -} - -// setFieldIfValid sets a field in a struct if it exists and can be set. -func setFieldIfValid(obj interface{}, fieldName string, setValue func(reflect.Value)) { - val := reflect.ValueOf(obj) - if val.Kind() != reflect.Ptr || val.IsNil() { - return - } - - field := val.Elem().FieldByName(fieldName) - if field.IsValid() && field.CanSet() { - setValue(field) - } -} - -// setPageSize sets the PageSize field in a request to the specified value. -func setPageSize(req listRequest, size uint64) { - setFieldIfValid(req, "PageSize", func(field reflect.Value) { - field.SetUint(size) - }) -} - -// setPageToken sets the PageToken field in a request to the specified token. -func setPageToken(req listRequest, token string) { - setFieldIfValid(req, "PageToken", func(field reflect.Value) { - field.SetString(token) - }) -} - -type listFunc[T proto.Message, REQ listRequest, RESP listResponse[T]] func(context.Context, REQ) (RESP, error) - -func listAllObjects[T proto.Message, REQ listRequest, RESP listResponse[T]](ctx context.Context, list listFunc[T, REQ, RESP], cb func(items []T) (bool, error)) error { - // Create a new request using reflection - req := createRequest[REQ]() - - // Set initial page size - setPageSize(req, 100) // Set a reasonable default page size - - var nextPageToken string - for { - // Set the page token for the current request if needed - if nextPageToken != "" { - setPageToken(req, nextPageToken) - } - - // Call the list function with the current request - resp, err := list(ctx, req) - if err != nil { - return err - } - - // Collect the results - shouldContinue, err := cb(resp.GetList()) - if err != nil { - return err - } - if !shouldContinue { - return nil - } - - // Check if there are more pages - nextPageToken = resp.GetNextPageToken() - if nextPageToken == "" || len(resp.GetList()) == 0 { - break // No more pages - } - } - - return nil -} diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/tasks/c1api/actions.go b/vendor/github.com/conductorone/baton-sdk/pkg/tasks/c1api/actions.go index 91219a2a..323b5665 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/tasks/c1api/actions.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/tasks/c1api/actions.go @@ -3,6 +3,7 @@ package c1api import ( "context" "errors" + "fmt" "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" "go.uber.org/zap" @@ -36,9 +37,13 @@ func (c *actionListSchemasTaskHandler) HandleTask(ctx context.Context) error { if t == nil { return c.helpers.FinishTask(ctx, nil, nil, errors.New("action list schemas task is nil")) } - resp, err := cc.ListActionSchemas(ctx, v2.ListActionSchemasRequest_builder{ + reqBuilder := v2.ListActionSchemasRequest_builder{ Annotations: t.GetAnnotations(), - }.Build()) + } + if resourceTypeID := t.GetResourceTypeId(); resourceTypeID != "" { + reqBuilder.ResourceTypeId = resourceTypeID + } + resp, err := cc.ListActionSchemas(ctx, reqBuilder.Build()) if err != nil { return c.helpers.FinishTask(ctx, nil, nil, err) } @@ -120,21 +125,39 @@ func (c *actionInvokeTaskHandler) HandleTask(ctx context.Context) error { if t == nil || t.GetName() == "" { return c.helpers.FinishTask(ctx, nil, nil, errors.New("action name required")) } - if t.GetArgs() == nil { - return c.helpers.FinishTask(ctx, nil, nil, errors.New("args required")) - } - resp, err := cc.InvokeAction(ctx, v2.InvokeActionRequest_builder{ + reqBuilder := v2.InvokeActionRequest_builder{ Name: t.GetName(), Args: t.GetArgs(), Annotations: t.GetAnnotations(), - }.Build()) + } + if resourceTypeID := t.GetResourceTypeId(); resourceTypeID != "" { + reqBuilder.ResourceTypeId = resourceTypeID + } + resp, err := cc.InvokeAction(ctx, reqBuilder.Build()) if err != nil { return c.helpers.FinishTask(ctx, nil, nil, err) } l.Debug("ActionInvoke response", zap.Any("resp", resp)) + // Check if the action itself failed and propagate the error + if resp.GetStatus() == v2.BatonActionStatus_BATON_ACTION_STATUS_FAILED { + errMsg := "action failed" + if resp.GetResponse() != nil && resp.GetResponse().GetFields() != nil { + if errField, ok := resp.GetResponse().GetFields()["error"]; ok { + errMsg = errField.GetStringValue() + } + } + l.Error("ActionInvoke failed", + zap.String("error", errMsg), + zap.String("action_id", resp.GetId()), + zap.String("action_name", resp.GetName()), + zap.Stringer("status", resp.GetStatus()), + ) + return c.helpers.FinishTask(ctx, resp, nil, fmt.Errorf("%s", errMsg)) + } + return c.helpers.FinishTask(ctx, resp, nil, nil) } @@ -177,7 +200,7 @@ func (c *actionStatusTaskHandler) HandleTask(ctx context.Context) error { return c.helpers.FinishTask(ctx, nil, nil, err) } - l.Debug("ActionInvoke response", zap.Any("resp", resp)) + l.Debug("ActionStatus response", zap.Any("resp", resp)) return c.helpers.FinishTask(ctx, resp, nil, nil) } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/tasks/c1api/create_account.go b/vendor/github.com/conductorone/baton-sdk/pkg/tasks/c1api/create_account.go index eb45b3c4..f9e5255f 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/tasks/c1api/create_account.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/tasks/c1api/create_account.go @@ -45,6 +45,7 @@ func (g *createAccountTaskHandler) HandleTask(ctx context.Context) error { AccountInfo: t.GetAccountInfo(), CredentialOptions: t.GetCredentialOptions(), EncryptionConfigs: t.GetEncryptionConfigs(), + ResourceTypeId: t.GetResourceTypeId(), }.Build()) if err != nil { l.Error("failed creating account", zap.Error(err)) diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/tasks/c1api/full_sync.go b/vendor/github.com/conductorone/baton-sdk/pkg/tasks/c1api/full_sync.go index 24266a6f..4171ecc2 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/tasks/c1api/full_sync.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/tasks/c1api/full_sync.go @@ -11,6 +11,7 @@ import ( "go.uber.org/zap" "google.golang.org/protobuf/proto" + v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" v1 "github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1" "github.com/conductorone/baton-sdk/pkg/annotations" "github.com/conductorone/baton-sdk/pkg/session" @@ -33,7 +34,7 @@ type fullSyncTaskHandler struct { skipFullSync bool externalResourceC1ZPath string externalResourceEntitlementIdFilter string - targetedSyncResourceIDs []string + targetedSyncResources []*v2.Resource syncResourceTypeIDs []string } @@ -57,6 +58,10 @@ func (c *fullSyncTaskHandler) sync(ctx context.Context, c1zPath string) error { syncOpts = append(syncOpts, sdkSync.WithDontExpandGrants()) } + if resources := c.task.GetSyncFull().GetTargetedSyncResources(); len(resources) > 0 { + syncOpts = append(syncOpts, sdkSync.WithTargetedSyncResources(resources)) + } + if c.task.GetSyncFull().GetSkipEntitlementsAndGrants() { // Sync only resources. This is meant to be used for a first sync so initial data gets into the UI faster. syncOpts = append(syncOpts, sdkSync.WithSkipEntitlementsAndGrants(true)) @@ -74,8 +79,8 @@ func (c *fullSyncTaskHandler) sync(ctx context.Context, c1zPath string) error { syncOpts = append(syncOpts, sdkSync.WithSkipFullSync()) } - if len(c.targetedSyncResourceIDs) > 0 { - syncOpts = append(syncOpts, sdkSync.WithTargetedSyncResourceIDs(c.targetedSyncResourceIDs)) + if len(c.targetedSyncResources) > 0 { + syncOpts = append(syncOpts, sdkSync.WithTargetedSyncResources(c.targetedSyncResources)) } cc := c.helpers.ConnectorClient() @@ -192,7 +197,7 @@ func newFullSyncTaskHandler( skipFullSync bool, externalResourceC1ZPath string, externalResourceEntitlementIdFilter string, - targetedSyncResourceIDs []string, + targetedSyncResources []*v2.Resource, syncResourceTypeIDs []string, ) tasks.TaskHandler { return &fullSyncTaskHandler{ @@ -201,7 +206,7 @@ func newFullSyncTaskHandler( skipFullSync: skipFullSync, externalResourceC1ZPath: externalResourceC1ZPath, externalResourceEntitlementIdFilter: externalResourceEntitlementIdFilter, - targetedSyncResourceIDs: targetedSyncResourceIDs, + targetedSyncResources: targetedSyncResources, syncResourceTypeIDs: syncResourceTypeIDs, } } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/tasks/c1api/hello.go b/vendor/github.com/conductorone/baton-sdk/pkg/tasks/c1api/hello.go index 0990cf48..dee82c7b 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/tasks/c1api/hello.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/tasks/c1api/hello.go @@ -38,6 +38,10 @@ func (c *helloTaskHandler) osInfo(ctx context.Context) (*v1.BatonServiceHelloReq info.VirtualizationSystem = "none" } + if info.PlatformVersion == "" { + info.PlatformVersion = info.KernelVersion + } + return v1.BatonServiceHelloRequest_OSInfo_builder{ Hostname: info.Hostname, Os: info.OS, diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/tasks/c1api/manager.go b/vendor/github.com/conductorone/baton-sdk/pkg/tasks/c1api/manager.go index 97a036a1..7b6aec9d 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/tasks/c1api/manager.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/tasks/c1api/manager.go @@ -18,6 +18,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" v1 "github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1" "github.com/conductorone/baton-sdk/pkg/tasks" "github.com/conductorone/baton-sdk/pkg/types" @@ -52,7 +53,7 @@ type c1ApiTaskManager struct { runnerShouldDebug bool externalResourceC1Z string externalResourceEntitlementIdFilter string - targetedSyncResourceIDs []string + targetedSyncResources []*v2.Resource syncResourceTypeIDs []string } @@ -248,7 +249,7 @@ func (c *c1ApiTaskManager) Process(ctx context.Context, task *v1.Task, cc types. c.skipFullSync, c.externalResourceC1Z, c.externalResourceEntitlementIdFilter, - c.targetedSyncResourceIDs, + c.targetedSyncResources, c.syncResourceTypeIDs, ) case taskTypes.HelloType: @@ -300,7 +301,7 @@ func (c *c1ApiTaskManager) Process(ctx context.Context, task *v1.Task, cc types. func NewC1TaskManager( ctx context.Context, clientID string, clientSecret string, tempDir string, skipFullSync bool, - externalC1Z string, externalResourceEntitlementIdFilter string, targetedSyncResourceIDs []string, + externalC1Z string, externalResourceEntitlementIdFilter string, targetedSyncResources []*v2.Resource, syncResourceTypeIDs []string, ) (tasks.Manager, error) { serviceClient, err := newServiceClient(ctx, clientID, clientSecret) @@ -314,7 +315,7 @@ func NewC1TaskManager( skipFullSync: skipFullSync, externalResourceC1Z: externalC1Z, externalResourceEntitlementIdFilter: externalResourceEntitlementIdFilter, - targetedSyncResourceIDs: targetedSyncResourceIDs, + targetedSyncResources: targetedSyncResources, syncResourceTypeIDs: syncResourceTypeIDs, }, nil } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/tasks/local/accounter.go b/vendor/github.com/conductorone/baton-sdk/pkg/tasks/local/accounter.go index 7d507117..bb581b9b 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/tasks/local/accounter.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/tasks/local/accounter.go @@ -18,9 +18,10 @@ type localAccountManager struct { dbPath string o sync.Once - login string - email string - profile *structpb.Struct + login string + email string + profile *structpb.Struct + resourceTypeId string } func (m *localAccountManager) GetTempDir() string { @@ -35,7 +36,9 @@ func (m *localAccountManager) Next(ctx context.Context) (*v1.Task, time.Duration var task *v1.Task m.o.Do(func() { task = v1.Task_builder{ - CreateAccount: &v1.Task_CreateAccountTask{}, + CreateAccount: &v1.Task_CreateAccountTask{ + ResourceTypeId: m.resourceTypeId, + }, }.Build() }) return task, 0, nil @@ -45,7 +48,7 @@ func (m *localAccountManager) Process(ctx context.Context, task *v1.Task, cc typ ctx, span := tracer.Start(ctx, "localAccountManager.Process", trace.WithNewRoot()) defer span.End() - accountManager := provisioner.NewCreateAccountManager(cc, m.dbPath, m.login, m.email, m.profile) + accountManager := provisioner.NewCreateAccountManager(cc, m.dbPath, m.login, m.email, m.profile, m.resourceTypeId) err := accountManager.Run(ctx) if err != nil { @@ -60,12 +63,13 @@ func (m *localAccountManager) Process(ctx context.Context, task *v1.Task, cc typ return nil } -// NewGranter returns a task manager that queues a sync task. -func NewCreateAccountManager(ctx context.Context, dbPath string, login string, email string, profile *structpb.Struct) tasks.Manager { +// NewCreateAccountManager returns a task manager that queues a create account task. +func NewCreateAccountManager(ctx context.Context, dbPath string, login string, email string, profile *structpb.Struct, resourceTypeId string) tasks.Manager { return &localAccountManager{ - dbPath: dbPath, - login: login, - email: email, - profile: profile, + dbPath: dbPath, + login: login, + email: email, + profile: profile, + resourceTypeId: resourceTypeId, } } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/tasks/local/action_invoker.go b/vendor/github.com/conductorone/baton-sdk/pkg/tasks/local/action_invoker.go index ef143f80..eb38605a 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/tasks/local/action_invoker.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/tasks/local/action_invoker.go @@ -21,8 +21,9 @@ type localActionInvoker struct { dbPath string o sync.Once - action string - args *structpb.Struct + action string + resourceTypeID string // Optional: if set, invokes a resource-scoped action + args *structpb.Struct } func (m *localActionInvoker) GetTempDir() string { @@ -38,8 +39,9 @@ func (m *localActionInvoker) Next(ctx context.Context) (*v1.Task, time.Duration, m.o.Do(func() { task = v1.Task_builder{ ActionInvoke: v1.Task_ActionInvokeTask_builder{ - Name: m.action, - Args: m.args, + Name: m.action, + Args: m.args, + ResourceTypeId: m.resourceTypeID, }.Build(), }.Build() }) @@ -52,29 +54,63 @@ func (m *localActionInvoker) Process(ctx context.Context, task *v1.Task, cc type defer span.End() t := task.GetActionInvoke() - resp, err := cc.InvokeAction(ctx, v2.InvokeActionRequest_builder{ + reqBuilder := v2.InvokeActionRequest_builder{ Name: t.GetName(), Args: t.GetArgs(), Annotations: t.GetAnnotations(), - }.Build()) + } + if resourceTypeID := t.GetResourceTypeId(); resourceTypeID != "" { + reqBuilder.ResourceTypeId = resourceTypeID + } + resp, err := cc.InvokeAction(ctx, reqBuilder.Build()) if err != nil { return err } - l.Info("ActionInvoke response", zap.Any("resp", resp)) + status := resp.GetStatus() + finalResp := resp.GetResponse() + l.Info("ActionInvoke response", + zap.String("action_id", resp.GetId()), + zap.String("name", resp.GetName()), + zap.String("status", resp.GetStatus().String()), + zap.Any("response", resp.GetResponse()), + ) + + ticker := time.NewTicker(1 * time.Second) + defer ticker.Stop() + + for status == v2.BatonActionStatus_BATON_ACTION_STATUS_PENDING || status == v2.BatonActionStatus_BATON_ACTION_STATUS_RUNNING { + select { + case <-ctx.Done(): + return ctx.Err() + case <-ticker.C: + r, err := cc.GetActionStatus(ctx, &v2.GetActionStatusRequest{ + Id: resp.GetId(), + }) + if err != nil { + return fmt.Errorf("failed to poll action status: %w", err) + } + status = r.GetStatus() + finalResp = r.GetResponse() + } + } + + l.Info("ActionInvoke response", zap.Any("resp", finalResp)) - if resp.GetStatus() == v2.BatonActionStatus_BATON_ACTION_STATUS_FAILED { - return fmt.Errorf("action invoke failed: %v", resp.GetResponse()) + if status == v2.BatonActionStatus_BATON_ACTION_STATUS_FAILED { + return fmt.Errorf("action invoke failed: %v", finalResp) } return nil } // NewActionInvoker returns a task manager that queues an action invoke task. -func NewActionInvoker(ctx context.Context, dbPath string, action string, args *structpb.Struct) tasks.Manager { +// If resourceTypeID is provided, it invokes a resource-scoped action. +func NewActionInvoker(ctx context.Context, dbPath string, action string, resourceTypeID string, args *structpb.Struct) tasks.Manager { return &localActionInvoker{ - dbPath: dbPath, - action: action, - args: args, + dbPath: dbPath, + action: action, + resourceTypeID: resourceTypeID, + args: args, } } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/tasks/local/action_schema_list.go b/vendor/github.com/conductorone/baton-sdk/pkg/tasks/local/action_schema_list.go new file mode 100644 index 00000000..5e4a261d --- /dev/null +++ b/vendor/github.com/conductorone/baton-sdk/pkg/tasks/local/action_schema_list.go @@ -0,0 +1,77 @@ +package local + +import ( + "context" + "sync" + "time" + + "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" + "go.uber.org/zap" + + v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" + v1 "github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1" + "github.com/conductorone/baton-sdk/pkg/tasks" + "github.com/conductorone/baton-sdk/pkg/types" +) + +type localListActionSchemas struct { + o sync.Once + resourceTypeID string // Optional: filter by resource type +} + +func (m *localListActionSchemas) GetTempDir() string { + return "" +} + +func (m *localListActionSchemas) ShouldDebug() bool { + return false +} + +func (m *localListActionSchemas) Next(ctx context.Context) (*v1.Task, time.Duration, error) { + var task *v1.Task + m.o.Do(func() { + task = v1.Task_builder{ + ActionListSchemas: v1.Task_ActionListSchemasTask_builder{ + ResourceTypeId: m.resourceTypeID, + }.Build(), + }.Build() + }) + return task, 0, nil +} + +func (m *localListActionSchemas) Process(ctx context.Context, task *v1.Task, cc types.ConnectorClient) error { + l := ctxzap.Extract(ctx) + + reqBuilder := v2.ListActionSchemasRequest_builder{} + if m.resourceTypeID != "" { + reqBuilder.ResourceTypeId = m.resourceTypeID + } + + resp, err := cc.ListActionSchemas(ctx, reqBuilder.Build()) + if err != nil { + return err + } + + if m.resourceTypeID != "" { + l.Info("Action Schemas", + zap.String("resource_type_id", m.resourceTypeID), + zap.Int("count", len(resp.GetSchemas())), + zap.Any("schemas", resp.GetSchemas()), + ) + } else { + l.Info("Action Schemas", + zap.Int("count", len(resp.GetSchemas())), + zap.Any("schemas", resp.GetSchemas()), + ) + } + + return nil +} + +// NewListActionSchemas returns a task manager that queues a list action schemas task. +// If resourceTypeID is provided, it filters schemas for that specific resource type. +func NewListActionSchemas(ctx context.Context, resourceTypeID string) tasks.Manager { + return &localListActionSchemas{ + resourceTypeID: resourceTypeID, + } +} diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/tasks/local/deleter.go b/vendor/github.com/conductorone/baton-sdk/pkg/tasks/local/deleter.go index 400c88b2..c94c0c27 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/tasks/local/deleter.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/tasks/local/deleter.go @@ -58,7 +58,7 @@ func (m *localResourceDeleter) Process(ctx context.Context, task *v1.Task, cc ty return nil } -// NewGranter returns a task manager that queues a sync task. +// NewResourceDeleter returns a task manager that queues a delete resource task. func NewResourceDeleter(ctx context.Context, dbPath string, resourceId string, resourceType string) tasks.Manager { return &localResourceDeleter{ dbPath: dbPath, diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/tasks/local/differ.go b/vendor/github.com/conductorone/baton-sdk/pkg/tasks/local/differ.go index 856f2690..94c39b1e 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/tasks/local/differ.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/tasks/local/differ.go @@ -64,7 +64,7 @@ func (m *localDiffer) Process(ctx context.Context, task *v1.Task, cc types.Conne return err } - if err := file.Close(); err != nil { + if err := file.Close(ctx); err != nil { return err } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/tasks/local/syncer.go b/vendor/github.com/conductorone/baton-sdk/pkg/tasks/local/syncer.go index 15148c48..b502f464 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/tasks/local/syncer.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/tasks/local/syncer.go @@ -8,6 +8,7 @@ import ( "go.opentelemetry.io/otel/trace" + v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" v1 "github.com/conductorone/baton-sdk/pb/c1/connectorapi/baton/v1" "github.com/conductorone/baton-sdk/pkg/session" sdkSync "github.com/conductorone/baton-sdk/pkg/sync" @@ -21,7 +22,7 @@ type localSyncer struct { tmpDir string externalResourceC1Z string externalResourceEntitlementIdFilter string - targetedSyncResourceIDs []string + targetedSyncResources []*v2.Resource skipEntitlementsAndGrants bool skipGrants bool syncResourceTypeIDs []string @@ -47,9 +48,9 @@ func WithExternalResourceEntitlementIdFilter(entitlementId string) Option { } } -func WithTargetedSyncResourceIDs(resourceIDs []string) Option { +func WithTargetedSyncResources(resources []*v2.Resource) Option { return func(m *localSyncer) { - m.targetedSyncResourceIDs = resourceIDs + m.targetedSyncResources = resources } } @@ -102,7 +103,7 @@ func (m *localSyncer) Process(ctx context.Context, task *v1.Task, cc types.Conne sdkSync.WithTmpDir(m.tmpDir), sdkSync.WithExternalResourceC1ZPath(m.externalResourceC1Z), sdkSync.WithExternalResourceEntitlementIdFilter(m.externalResourceEntitlementIdFilter), - sdkSync.WithTargetedSyncResourceIDs(m.targetedSyncResourceIDs), + sdkSync.WithTargetedSyncResources(m.targetedSyncResources), sdkSync.WithSkipEntitlementsAndGrants(m.skipEntitlementsAndGrants), sdkSync.WithSkipGrants(m.skipGrants), sdkSync.WithSessionStore(setSessionStore), diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/test/configSchema.go b/vendor/github.com/conductorone/baton-sdk/pkg/test/configSchema.go deleted file mode 100644 index fe101d14..00000000 --- a/vendor/github.com/conductorone/baton-sdk/pkg/test/configSchema.go +++ /dev/null @@ -1,102 +0,0 @@ -package test - -import ( - "testing" - - "github.com/conductorone/baton-sdk/pkg/field" - "github.com/spf13/viper" -) - -type TestCase = struct { - Configs map[string]string - IsValid bool - Message string -} - -type TestCaseFromExpression = struct { - Expression string - IsValid bool - Message string -} - -func MakeViper(input map[string]string) *viper.Viper { - output := viper.New() - for key, value := range input { - output.Set(key, value) - } - return output -} - -func ExerciseTestCase( - t *testing.T, - configurationSchema field.Configuration, - extraValidationFunction func(*viper.Viper) error, - configs map[string]string, - isValid bool, -) { - AssertValidation( - t, - func() error { - v := MakeViper(configs) - err := field.Validate(configurationSchema, v) - if err != nil { - return err - } - if extraValidationFunction != nil { - return extraValidationFunction(v) - } - return nil - }, - isValid, - ) -} - -// ExerciseTestCases - this helper function is meant to be called by each -// connector to make sure that the every `Field` and `Relationship` do what we -// expect. Some connectors need to run custom validations, and they can be added -// as the `extraValidationFunction` parameter. -func ExerciseTestCases( - t *testing.T, - configurationSchema field.Configuration, - extraValidationFunction func(*viper.Viper) error, - testCases []TestCase, -) { - for _, testCase := range testCases { - t.Run(testCase.Message, func(t *testing.T) { - ExerciseTestCase( - t, - configurationSchema, - extraValidationFunction, - testCase.Configs, - testCase.IsValid, - ) - }) - } -} - -// ExerciseTestCasesFromExpressions - Like ExerciseTestCases, but instead of -// passing a `map[string]string` to each test case, pass a function that parses -// configs from strings and pass each test case an expression as a string. -func ExerciseTestCasesFromExpressions( - t *testing.T, - configurationSchema field.Configuration, - extraValidationFunction func(*viper.Viper) error, - expressionParser func(string) (map[string]string, error), - testCases []TestCaseFromExpression, -) { - for _, testCase := range testCases { - t.Run(testCase.Message, func(t *testing.T) { - values, err := expressionParser(testCase.Expression) - if err != nil { - t.Fatal("could not parse flags:", err) - } - ExerciseTestCase( - t, - configurationSchema, - extraValidationFunction, - values, - testCase.IsValid, - ) - }) - } -} diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/test/integration.go b/vendor/github.com/conductorone/baton-sdk/pkg/test/integration.go deleted file mode 100644 index 375c87a2..00000000 --- a/vendor/github.com/conductorone/baton-sdk/pkg/test/integration.go +++ /dev/null @@ -1,58 +0,0 @@ -package test - -import ( - "context" - "testing" - - v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" - "github.com/conductorone/baton-sdk/pkg/connectorbuilder" - "github.com/stretchr/testify/require" -) - -type builder interface { - connectorbuilder.ResourceProvisionerLimited - connectorbuilder.ResourceSyncerLimited -} - -func assertGrants(ctx context.Context, - t *testing.T, - c builder, - resource *v2.Resource, -) []*v2.Grant { - grants, annotations, err := ExhaustGrantPagination(ctx, c, resource) - require.Nil(t, err) - AssertNoRatelimitAnnotations(t, annotations) - return grants -} - -// GrantsIntegrationTest - create a grant and then revoke it. Any connector that -// implements provisioning should be able to successfully run this test. -func GrantsIntegrationTest( - ctx context.Context, - t *testing.T, - c builder, - principal *v2.Resource, - entitlement *v2.Entitlement, -) { - grant := v2.Grant_builder{ - Entitlement: entitlement, - Principal: principal, - }.Build() - - grantsBefore := assertGrants(ctx, t, c, entitlement.GetResource()) - grantCount := len(grantsBefore) - - annotations, err := c.Grant(ctx, principal, entitlement) - require.Nil(t, err) - AssertNoRatelimitAnnotations(t, annotations) - - grantsDuring := assertGrants(ctx, t, c, entitlement.GetResource()) - require.Len(t, grantsDuring, grantCount+1) - - annotations, err = c.Revoke(ctx, grant) - require.Nil(t, err) - AssertNoRatelimitAnnotations(t, annotations) - - grantsAfter := assertGrants(ctx, t, c, entitlement.GetResource()) - require.Len(t, grantsAfter, grantCount) -} diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/test/pagination.go b/vendor/github.com/conductorone/baton-sdk/pkg/test/pagination.go deleted file mode 100644 index 1b9cb883..00000000 --- a/vendor/github.com/conductorone/baton-sdk/pkg/test/pagination.go +++ /dev/null @@ -1,91 +0,0 @@ -package test - -import ( - "context" - "fmt" - - v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" - "github.com/conductorone/baton-sdk/pkg/annotations" - "github.com/conductorone/baton-sdk/pkg/connectorbuilder" - "github.com/conductorone/baton-sdk/pkg/pagination" -) - -// exhaustPagination - some integration tests don't care about how pagination -// works and just want to get the full list of resources. -func exhaustPagination[T any, R any]( - ctx context.Context, - resource *R, - f func( - ctx context.Context, - resource *R, - pToken *pagination.Token, - ) ( - []*T, - string, - annotations.Annotations, - error, - ), -) ( - []*T, - annotations.Annotations, - error, -) { - var outputAnnotations annotations.Annotations - pToken := pagination.Token{} - objects := make([]*T, 0) - for { - nextObjects, nextToken, listAnnotations, err := f(ctx, resource, &pToken) - if err != nil { - return nil, nil, err - } - objects = append(objects, nextObjects...) - - if IsRatelimited(listAnnotations) { - return nil, - listAnnotations, - fmt.Errorf("request was ratelimited, expected not to be ratelimited") - } - if nextToken == "" { - // Just return the final set of annotations. - outputAnnotations = listAnnotations - break - } - pToken.Token = nextToken - } - return objects, outputAnnotations, nil -} - -func ExhaustResourcePagination( - ctx context.Context, - c connectorbuilder.ResourceSyncerLimited, -) ( - []*v2.Resource, - annotations.Annotations, - error, -) { - return exhaustPagination(ctx, nil, c.List) -} - -func ExhaustEntitlementPagination( - ctx context.Context, - c connectorbuilder.ResourceSyncerLimited, - resource *v2.Resource, -) ( - []*v2.Entitlement, - annotations.Annotations, - error, -) { - return exhaustPagination(ctx, resource, c.Entitlements) -} - -func ExhaustGrantPagination( - ctx context.Context, - c connectorbuilder.ResourceSyncerLimited, - resource *v2.Resource, -) ( - []*v2.Grant, - annotations.Annotations, - error, -) { - return exhaustPagination(ctx, resource, c.Grants) -} diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/test/ratelimit.go b/vendor/github.com/conductorone/baton-sdk/pkg/test/ratelimit.go deleted file mode 100644 index 6f58d4a0..00000000 --- a/vendor/github.com/conductorone/baton-sdk/pkg/test/ratelimit.go +++ /dev/null @@ -1,58 +0,0 @@ -package test - -import ( - "slices" - "testing" - - v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" - "github.com/conductorone/baton-sdk/pkg/annotations" - "google.golang.org/protobuf/types/known/anypb" -) - -func isRatelimitingAnnotation(annotation *anypb.Any) bool { - var ratelimitDescription v2.RateLimitDescription - err := annotation.UnmarshalTo(&ratelimitDescription) - if err != nil { - // Some other kind of annotation. - return false - } - return slices.Contains( - []v2.RateLimitDescription_Status{ - v2.RateLimitDescription_STATUS_ERROR, - v2.RateLimitDescription_STATUS_OVERLIMIT, - }, - ratelimitDescription.GetStatus(), - ) -} - -func IsRatelimited(actualAnnotations annotations.Annotations) bool { - for _, annotation := range actualAnnotations { - if isRatelimitingAnnotation(annotation) { - return true - } - } - return false -} - -func AssertWasRatelimited( - t *testing.T, - actualAnnotations annotations.Annotations, -) { - if !IsRatelimited(actualAnnotations) { - t.Fatal("request was _not_ ratelimited, expected to be ratelimited") - } -} - -// AssertNoRatelimitAnnotations - the annotations that ResourceSyncers return -// can contain "informational" ratelimit annotations that let the caller know -// how much quota they have left and that their request was _not_ rejected. This -// helper just asserts that there are no "your request was ratelimited" -// annotations. -func AssertNoRatelimitAnnotations( - t *testing.T, - actualAnnotations annotations.Annotations, -) { - if IsRatelimited(actualAnnotations) { - t.Fatal("request was ratelimited, expected not to be ratelimited") - } -} diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/test/validation.go b/vendor/github.com/conductorone/baton-sdk/pkg/test/validation.go deleted file mode 100644 index 373ace07..00000000 --- a/vendor/github.com/conductorone/baton-sdk/pkg/test/validation.go +++ /dev/null @@ -1,22 +0,0 @@ -package test - -import "testing" - -// AssertValidation - call an arbitrary validation function and assert the result -// matches the expected result. -func AssertValidation( - t *testing.T, - validate func() error, - expectedSuccess bool, -) { - err := validate() - if err != nil { - if expectedSuccess { - t.Fatal("expected function to succeed, but", err.Error()) - } - } else { - if !expectedSuccess { - t.Fatal("expected function to fail, but it succeeded") - } - } -} diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/types/entitlement/entitlement.go b/vendor/github.com/conductorone/baton-sdk/pkg/types/entitlement/entitlement.go index 8715c825..7a441a12 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/types/entitlement/entitlement.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/types/entitlement/entitlement.go @@ -32,6 +32,12 @@ func WithDisplayName(displayName string) EntitlementOption { } } +func WithSlug(slug string) EntitlementOption { + return func(g *v2.Entitlement) { + g.SetSlug(slug) + } +} + func WithDescription(description string) EntitlementOption { return func(g *v2.Entitlement) { g.SetDescription(description) @@ -72,6 +78,21 @@ func NewAssignmentEntitlement(resource *v2.Resource, name string, entitlementOpt return entitlement } +func NewOwnershipEntitlement(resource *v2.Resource, name string, entitlementOptions ...EntitlementOption) *v2.Entitlement { + entitlement := v2.Entitlement_builder{ + Id: NewEntitlementID(resource, name), + DisplayName: name, + Slug: name, + Purpose: v2.Entitlement_PURPOSE_VALUE_OWNERSHIP, + Resource: resource, + }.Build() + + for _, entitlementOption := range entitlementOptions { + entitlementOption(entitlement) + } + return entitlement +} + func NewEntitlement(resource *v2.Resource, name, purposeStr string, entitlementOptions ...EntitlementOption) *v2.Entitlement { var purpose v2.Entitlement_PurposeValue switch purposeStr { @@ -79,6 +100,8 @@ func NewEntitlement(resource *v2.Resource, name, purposeStr string, entitlementO purpose = v2.Entitlement_PURPOSE_VALUE_PERMISSION case "assignment": purpose = v2.Entitlement_PURPOSE_VALUE_ASSIGNMENT + case "ownership": + purpose = v2.Entitlement_PURPOSE_VALUE_OWNERSHIP default: purpose = v2.Entitlement_PURPOSE_VALUE_UNSPECIFIED } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/types/grant/grant.go b/vendor/github.com/conductorone/baton-sdk/pkg/types/grant/grant.go index 972c6344..b472ca99 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/types/grant/grant.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/types/grant/grant.go @@ -36,9 +36,10 @@ func WithGrantMetadata(metadata map[string]interface{}) GrantOption { } } +// WithExternalPrincipalID: Deprecated. This field is no longer used. func WithExternalPrincipalID(externalID *v2.ExternalId) GrantOption { return func(g *v2.Grant) error { - g.GetPrincipal().SetExternalId(externalID) + g.GetPrincipal().SetExternalId(externalID) //nolint:staticcheck // Deprecated. return nil } } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/types/resource/resource.go b/vendor/github.com/conductorone/baton-sdk/pkg/types/resource/resource.go index 33d3f132..b7dae67e 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/types/resource/resource.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/types/resource/resource.go @@ -9,6 +9,8 @@ import ( "github.com/conductorone/baton-sdk/pkg/annotations" "github.com/conductorone/baton-sdk/pkg/pagination" "github.com/conductorone/baton-sdk/pkg/types/sessions" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" ) @@ -29,9 +31,10 @@ func WithAnnotation(msgs ...proto.Message) ResourceOption { } } +// WithExternalID: Deprecated. This field is no longer used. func WithExternalID(externalID *v2.ExternalId) ResourceOption { return func(r *v2.Resource) error { - r.SetExternalId(externalID) + r.SetExternalId(externalID) //nolint:staticcheck // Deprecated. return nil } } @@ -132,6 +135,39 @@ func WithRoleTrait(opts ...RoleTraitOption) ResourceOption { } } +func WithScopeBindingTrait(opts ...ScopeBindingTraitOption) ResourceOption { + return func(r *v2.Resource) error { + rt := &v2.ScopeBindingTrait{} + + annos := annotations.Annotations(r.GetAnnotations()) + _, err := annos.Pick(rt) + if err != nil { + return err + } + + for _, o := range opts { + err := o(rt) + if err != nil { + return err + } + } + + roleId := rt.GetRoleId() + scopeResourceId := rt.GetScopeResourceId() + if roleId == nil { + return status.Errorf(codes.InvalidArgument, "role ID is required for scope binding trait") + } + if scopeResourceId == nil { + return status.Errorf(codes.InvalidArgument, "scope resource ID is required for scope binding trait") + } + + annos.Update(rt) + r.SetAnnotations(annos) + + return nil + } +} + func WithAppTrait(opts ...AppTraitOption) ResourceOption { return func(r *v2.Resource) error { at := &v2.AppTrait{} @@ -304,6 +340,24 @@ func NewRoleResource( return ret, nil } +// NewScopeBindingResource returns a new resource instance with a configured scope binding trait. +func NewScopeBindingResource( + name string, + resourceType *v2.ResourceType, + objectID any, + scopeBindingOpts []ScopeBindingTraitOption, + opts ...ResourceOption, +) (*v2.Resource, error) { + opts = append(opts, WithScopeBindingTrait(scopeBindingOpts...)) + + ret, err := NewResource(name, resourceType, objectID, opts...) + if err != nil { + return nil, err + } + + return ret, nil +} + // NewAppResource returns a new resource instance with a configured app trait. // The trait is configured with the provided helpURL and profile. func NewAppResource( diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/types/resource/role_scope_trait.go b/vendor/github.com/conductorone/baton-sdk/pkg/types/resource/role_scope_trait.go new file mode 100644 index 00000000..0624f9ee --- /dev/null +++ b/vendor/github.com/conductorone/baton-sdk/pkg/types/resource/role_scope_trait.go @@ -0,0 +1,41 @@ +package resource + +import ( + v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" + "github.com/conductorone/baton-sdk/pkg/annotations" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type ScopeBindingTraitOption func(rs *v2.ScopeBindingTrait) error + +// WithRoleScopeRoleId sets the role of role scope. +func WithRoleScopeRoleId(resourceId *v2.ResourceId) ScopeBindingTraitOption { + return func(rs *v2.ScopeBindingTrait) error { + rs.RoleId = resourceId + return nil + } +} + +// WithRoleScopeResourceId sets the resource scope of role scope. +func WithRoleScopeResourceId(resourceId *v2.ResourceId) ScopeBindingTraitOption { + return func(rs *v2.ScopeBindingTrait) error { + rs.ScopeResourceId = resourceId + return nil + } +} + +// GetScopeBindingTrait attempts to return the ScopeBindingTrait instance on a resource. +func GetScopeBindingTrait(resource *v2.Resource) (*v2.ScopeBindingTrait, error) { + ret := &v2.ScopeBindingTrait{} + annos := annotations.Annotations(resource.GetAnnotations()) + ok, err := annos.Pick(ret) + if err != nil { + return nil, err + } + if !ok { + return nil, status.Errorf(codes.NotFound, "scope binding trait was not found on resource") + } + + return ret, nil +} diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/types/resource/role_trait.go b/vendor/github.com/conductorone/baton-sdk/pkg/types/resource/role_trait.go index bc534133..80b75a6d 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/types/resource/role_trait.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/types/resource/role_trait.go @@ -1,10 +1,10 @@ package resource import ( - "fmt" - v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" "github.com/conductorone/baton-sdk/pkg/annotations" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/structpb" ) @@ -23,6 +23,22 @@ func WithRoleProfile(profile map[string]interface{}) RoleTraitOption { } } +func WithRoleScopeConditions(typ string, conditions []string) RoleTraitOption { + return func(rt *v2.RoleTrait) error { + rt.RoleScopeConditions = &v2.RoleScopeConditions{ + Type: typ, + Conditions: make([]*v2.RoleScopeCondition, len(conditions)), + } + for i, condition := range conditions { + rt.RoleScopeConditions.Conditions[i] = &v2.RoleScopeCondition{ + Expression: condition, + } + } + + return nil + } +} + // NewRoleTrait creates a new `RoleTrait` with the provided profile. func NewRoleTrait(opts ...RoleTraitOption) (*v2.RoleTrait, error) { groupTrait := &v2.RoleTrait{} @@ -46,7 +62,7 @@ func GetRoleTrait(resource *v2.Resource) (*v2.RoleTrait, error) { return nil, err } if !ok { - return nil, fmt.Errorf("role trait was not found on resource") + return nil, status.Errorf(codes.NotFound, "role trait was not found on resource") } return ret, nil diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/types/resource/security_insight_trait.go b/vendor/github.com/conductorone/baton-sdk/pkg/types/resource/security_insight_trait.go new file mode 100644 index 00000000..4aec02f7 --- /dev/null +++ b/vendor/github.com/conductorone/baton-sdk/pkg/types/resource/security_insight_trait.go @@ -0,0 +1,356 @@ +package resource + +import ( + "fmt" + "time" + + "google.golang.org/protobuf/types/known/timestamppb" + + v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" + "github.com/conductorone/baton-sdk/pkg/annotations" +) + +// SecurityInsightTraitOption is a functional option for configuring a SecurityInsightTrait. +type SecurityInsightTraitOption func(*v2.SecurityInsightTrait) error + +// WithRiskScore sets the insight type to risk score with the given value. +func WithRiskScore(value string) SecurityInsightTraitOption { + return func(t *v2.SecurityInsightTrait) error { + if value == "" { + return fmt.Errorf("risk score value cannot be empty") + } + t.SetRiskScore(&v2.RiskScore{ + Value: value, + }) + return nil + } +} + +// WithIssue sets the insight type to issue with the given value. +func WithIssue(value string) SecurityInsightTraitOption { + return func(t *v2.SecurityInsightTrait) error { + if value == "" { + return fmt.Errorf("issue value cannot be empty") + } + issue := &v2.Issue{ + Value: value, + } + t.SetIssue(issue) + return nil + } +} + +// WithIssueSeverity sets or updates the severity on an issue insight. +// This should be used after WithIssue or on an existing issue insight. +func WithIssueSeverity(severity string) SecurityInsightTraitOption { + return func(t *v2.SecurityInsightTrait) error { + issue := t.GetIssue() + if issue == nil { + return fmt.Errorf("cannot set severity: insight is not an issue type (use WithIssue first)") + } + issue.SetSeverity(severity) + return nil + } +} + +// WithInsightObservedAt sets the observation timestamp for the insight. +func WithInsightObservedAt(observedAt time.Time) SecurityInsightTraitOption { + return func(t *v2.SecurityInsightTrait) error { + t.SetObservedAt(timestamppb.New(observedAt)) + return nil + } +} + +// WithInsightUserTarget sets the user target (by email) for the insight. +// Use this when the insight should be resolved to a C1 User by Uplift. +func WithInsightUserTarget(email string) SecurityInsightTraitOption { + return func(t *v2.SecurityInsightTrait) error { + t.SetUser(v2.SecurityInsightTrait_UserTarget_builder{ + Email: email, + }.Build()) + return nil + } +} + +// WithInsightResourceTarget sets a direct resource reference for the insight. +// Use this when the connector knows the actual resource (synced by this connector). +func WithInsightResourceTarget(resourceId *v2.ResourceId) SecurityInsightTraitOption { + return func(t *v2.SecurityInsightTrait) error { + t.SetResourceId(resourceId) + return nil + } +} + +// WithInsightExternalResourceTarget sets the external resource target for the insight. +// Use this when the connector only has an external ID (e.g., ARN) and needs Uplift to resolve it. +func WithInsightExternalResourceTarget(externalId string, appHint string) SecurityInsightTraitOption { + return func(t *v2.SecurityInsightTrait) error { + t.SetExternalResource(v2.SecurityInsightTrait_ExternalResourceTarget_builder{ + ExternalId: externalId, + AppHint: appHint, + }.Build()) + return nil + } +} + +// WithInsightAppUserTarget sets the app user target for the insight. +// Use this when the insight should be resolved to an AppUser by email and external ID. +func WithInsightAppUserTarget(email string, externalId string) SecurityInsightTraitOption { + return func(t *v2.SecurityInsightTrait) error { + t.SetAppUser(v2.SecurityInsightTrait_AppUserTarget_builder{ + Email: email, + ExternalId: externalId, + }.Build()) + return nil + } +} + +// NewSecurityInsightTrait creates a new SecurityInsightTrait with the given options. +// You must provide either WithRiskScore or WithIssue to set the insight type. +// +// Example usage: +// +// trait, err := NewSecurityInsightTrait( +// WithIssue("CVE-2024-1234", "Critical"), +// WithInsightUserTarget("user@example.com")) +// +// trait, err := NewSecurityInsightTrait( +// WithRiskScore("85"), +// WithInsightResourceTarget(resourceId)) +func NewSecurityInsightTrait(opts ...SecurityInsightTraitOption) (*v2.SecurityInsightTrait, error) { + trait := &v2.SecurityInsightTrait{ + ObservedAt: timestamppb.Now(), + } + + for _, opt := range opts { + if err := opt(trait); err != nil { + return nil, err + } + } + + // Validate that an insight type was set + if trait.GetRiskScore() == nil && trait.GetIssue() == nil { + return nil, fmt.Errorf("insight type must be set (use WithRiskScore or WithIssue)") + } + + if trait.GetTarget() == nil { + return nil, fmt.Errorf("target must be set (use WithInsightUserTarget, WithInsightResourceTarget, WithInsightExternalResourceTarget, or WithInsightAppUserTarget)") + } + + return trait, nil +} + +// GetSecurityInsightTrait attempts to return the SecurityInsightTrait from a resource's annotations. +func GetSecurityInsightTrait(resource *v2.Resource) (*v2.SecurityInsightTrait, error) { + ret := &v2.SecurityInsightTrait{} + annos := annotations.Annotations(resource.GetAnnotations()) + ok, err := annos.Pick(ret) + if err != nil { + return nil, err + } + if !ok { + return nil, fmt.Errorf("security insight trait was not found on resource") + } + + return ret, nil +} + +// WithSecurityInsightTrait adds or updates a SecurityInsightTrait annotation on a resource. +// The insight type (risk score or issue) must be set via the provided options. +// If the resource already has a SecurityInsightTrait, it will be updated with the provided options. +// If not, a new trait will be created. +// +// Example usage: +// +// resource, err := NewResource( +// "Security Finding", +// resourceType, +// objectID, +// WithSecurityInsightTrait( +// WithIssue("CVE-2024-1234", "Critical"), +// WithInsightUserTarget("user@example.com"))) +func WithSecurityInsightTrait(opts ...SecurityInsightTraitOption) ResourceOption { + return func(r *v2.Resource) error { + t := &v2.SecurityInsightTrait{} + annos := annotations.Annotations(r.GetAnnotations()) + existing, err := annos.Pick(t) + if err != nil { + return err + } + + if !existing { + // Creating a new trait - set default observation time + t.SetObservedAt(timestamppb.Now()) + } + + for _, o := range opts { + if err := o(t); err != nil { + return err + } + } + + // Validate that an insight type was set + if t.GetRiskScore() == nil && t.GetIssue() == nil { + return fmt.Errorf("insight type must be set (use WithRiskScore or WithIssue)") + } + + annos.Update(t) + r.SetAnnotations(annos) + + return nil + } +} + +// NewSecurityInsightResource creates a security insight resource with the given trait options. +// This is a flexible constructor that uses the options pattern to configure all aspects of the insight. +// +// Example usage: +// +// // Risk score for a user +// resource, err := NewSecurityInsightResource( +// "User Risk Score", +// securityInsightResourceType, +// "user-123", +// WithRiskScore("85"), +// WithInsightUserTarget("user@example.com")) +// +// // Issue with severity for a resource +// resource, err := NewSecurityInsightResource( +// "Critical Vulnerability", +// securityInsightResourceType, +// "vuln-456", +// WithIssue("CVE-2024-1234", "Critical"), +// WithInsightResourceTarget(resourceId)) +// +// // Issue for external resource with custom observation time +// resource, err := NewSecurityInsightResource( +// "AWS Security Finding", +// securityInsightResourceType, +// "finding-789", +// WithIssue("S3 bucket publicly accessible"), +// WithIssueSeverity("High"), +// WithInsightExternalResourceTarget("arn:aws:s3:::my-bucket", "aws"), +// WithInsightObservedAt(time.Now())) +func NewSecurityInsightResource( + name string, + resourceType *v2.ResourceType, + objectID interface{}, + traitOpts ...SecurityInsightTraitOption, +) (*v2.Resource, error) { + trait, err := NewSecurityInsightTrait(traitOpts...) + if err != nil { + return nil, err + } + + return NewResource(name, resourceType, objectID, WithAnnotation(trait)) +} + +// IsSecurityInsightResource checks if a resource type has the TRAIT_SECURITY_INSIGHT trait. +func IsSecurityInsightResource(resourceType *v2.ResourceType) bool { + for _, trait := range resourceType.GetTraits() { + if trait == v2.ResourceType_TRAIT_SECURITY_INSIGHT { + return true + } + } + return false +} + +// --- Insight type checkers --- + +// IsRiskScore returns true if the insight is a risk score. +func IsRiskScore(trait *v2.SecurityInsightTrait) bool { + return trait.GetRiskScore() != nil +} + +// IsIssue returns true if the insight is an issue. +func IsIssue(trait *v2.SecurityInsightTrait) bool { + return trait.GetIssue() != nil +} + +// GetInsightValue returns the value of the insight (either risk score or issue). +func GetInsightValue(trait *v2.SecurityInsightTrait) string { + if rs := trait.GetRiskScore(); rs != nil { + return rs.GetValue() + } + if issue := trait.GetIssue(); issue != nil { + return issue.GetValue() + } + return "" +} + +// GetIssueSeverity returns the severity of an issue insight, or empty string if not set or not an issue. +func GetIssueSeverity(trait *v2.SecurityInsightTrait) string { + if issue := trait.GetIssue(); issue != nil { + return issue.GetSeverity() + } + return "" +} + +// --- Target type checkers --- + +// IsUserTarget returns true if the insight targets a user. +func IsUserTarget(trait *v2.SecurityInsightTrait) bool { + return trait.GetUser() != nil +} + +// IsResourceTarget returns true if the insight has a direct resource reference. +func IsResourceTarget(trait *v2.SecurityInsightTrait) bool { + return trait.GetResourceId() != nil +} + +// IsExternalResourceTarget returns true if the insight targets an external resource. +func IsExternalResourceTarget(trait *v2.SecurityInsightTrait) bool { + return trait.GetExternalResource() != nil +} + +// IsAppUserTarget returns true if the insight targets an app user. +func IsAppUserTarget(trait *v2.SecurityInsightTrait) bool { + return trait.GetAppUser() != nil +} + +// --- Target data extractors --- + +// GetUserTargetEmail returns the user email from a SecurityInsightTrait, or empty string if not a user target. +func GetUserTargetEmail(trait *v2.SecurityInsightTrait) string { + if user := trait.GetUser(); user != nil { + return user.GetEmail() + } + return "" +} + +// GetResourceTarget returns the ResourceId from a SecurityInsightTrait, or nil if not a resource target. +func GetResourceTarget(trait *v2.SecurityInsightTrait) *v2.ResourceId { + return trait.GetResourceId() +} + +// GetExternalResourceTargetId returns the external ID from a SecurityInsightTrait, or empty string if not an external resource target. +func GetExternalResourceTargetId(trait *v2.SecurityInsightTrait) string { + if ext := trait.GetExternalResource(); ext != nil { + return ext.GetExternalId() + } + return "" +} + +// GetExternalResourceTargetAppHint returns the app hint from a SecurityInsightTrait, or empty string if not an external resource target. +func GetExternalResourceTargetAppHint(trait *v2.SecurityInsightTrait) string { + if ext := trait.GetExternalResource(); ext != nil { + return ext.GetAppHint() + } + return "" +} + +// GetAppUserTargetEmail returns the email from a SecurityInsightTrait, or empty string if not an app user target. +func GetAppUserTargetEmail(trait *v2.SecurityInsightTrait) string { + if appUser := trait.GetAppUser(); appUser != nil { + return appUser.GetEmail() + } + return "" +} + +// GetAppUserTargetExternalId returns the external ID from a SecurityInsightTrait, or empty string if not an app user target. +func GetAppUserTargetExternalId(trait *v2.SecurityInsightTrait) string { + if appUser := trait.GetAppUser(); appUser != nil { + return appUser.GetExternalId() + } + return "" +} diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/types/sessions/sessions.go b/vendor/github.com/conductorone/baton-sdk/pkg/types/sessions/sessions.go index 7b5ca3ca..38315a71 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/types/sessions/sessions.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/types/sessions/sessions.go @@ -4,11 +4,18 @@ import ( "context" ) +const MaxKeysPerRequest = 100 + +// The default gRPC message size limit is 4MB (we subtract 30KB for general overhead, which is overkill). +// Unfortunately, this layer has to be aware of the size limit to avoid exceeding the size limit +// because the client does not know the size of the items it requests. +const MaxSessionStoreSizeLimit = 4163584 + type SessionStoreKey struct{} type SessionStore interface { Get(ctx context.Context, key string, opt ...SessionStoreOption) ([]byte, bool, error) - GetMany(ctx context.Context, keys []string, opt ...SessionStoreOption) (map[string][]byte, error) + GetMany(ctx context.Context, keys []string, opt ...SessionStoreOption) (map[string][]byte, []string, error) Set(ctx context.Context, key string, value []byte, opt ...SessionStoreOption) error SetMany(ctx context.Context, values map[string][]byte, opt ...SessionStoreOption) error Delete(ctx context.Context, key string, opt ...SessionStoreOption) error diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/uhttp/transport.go b/vendor/github.com/conductorone/baton-sdk/pkg/uhttp/transport.go index cae9b483..7066921b 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/uhttp/transport.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/uhttp/transport.go @@ -137,24 +137,32 @@ func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) { if err != nil { return nil, fmt.Errorf("uhttp: cycle failed: %w", err) } - if t.log { - t.l(ctx).Debug("Request started", - zap.String("http.method", req.Method), - zap.String("http.url_details.host", req.URL.Host), - zap.String("http.url_details.path", req.URL.Path), - zap.String("http.url_details.query", req.URL.RawQuery), - ) - } + start := time.Now() + defer func() { + if r := recover(); r != nil { + if t.log { + duration := time.Since(start) + t.l(ctx).Error("HTTP request panic", + zap.String("http.method", req.Method), + zap.String("http.url_details.host", req.URL.Host), + zap.String("http.url_details.path", req.URL.Path), + zap.String("http.url_details.query", req.URL.RawQuery), + zap.Duration("duration", duration), + zap.Any("panic", r), + ) + } + panic(r) + } + }() resp, err := rt.RoundTrip(req) if t.log { - fields := []zap.Field{zap.String("http.method", req.Method), + duration := time.Since(start) + fields := []zap.Field{ + zap.String("http.method", req.Method), zap.String("http.url_details.host", req.URL.Host), zap.String("http.url_details.path", req.URL.Path), zap.String("http.url_details.query", req.URL.RawQuery), - } - - if err != nil { - fields = append(fields, zap.Error(err)) + zap.Duration("duration", duration), } if resp != nil { @@ -170,7 +178,22 @@ func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) { fields = append(fields, zap.Any("http.headers", headers)) } - t.l(ctx).Debug("Request complete", fields...) + l := t.l(ctx) + switch { + case err != nil: + // Always log errors - request failed to complete + fields = append(fields, zap.Error(err)) + l.Error("HTTP request failed", fields...) + case resp != nil && resp.StatusCode >= 500: + // Server errors are noteworthy + l.Warn("HTTP request server error", fields...) + case resp != nil && resp.StatusCode >= 400: + // Client errors at debug - usually expected (404s, etc) + l.Debug("HTTP request client error", fields...) + default: + // Success + l.Debug("HTTP request complete", fields...) + } } return resp, err } diff --git a/vendor/github.com/conductorone/baton-sdk/pkg/uhttp/wrapper.go b/vendor/github.com/conductorone/baton-sdk/pkg/uhttp/wrapper.go index 6befc8bb..3a8d4d27 100644 --- a/vendor/github.com/conductorone/baton-sdk/pkg/uhttp/wrapper.go +++ b/vendor/github.com/conductorone/baton-sdk/pkg/uhttp/wrapper.go @@ -476,6 +476,16 @@ func (c *BaseHttpClient) Do(req *http.Request, options ...DoOption) (*http.Respo return resp, errors.Join(optErrs...) } +var sensitiveStrings = []string{ + "api-key", + "auth", + "cookie", + "proxy-authorization", + "set-cookie", + "x-forwarded-for", + "x-forwarded-proto", +} + func RedactSensitiveHeaders(h http.Header) http.Header { if h == nil { return nil @@ -484,12 +494,10 @@ func RedactSensitiveHeaders(h http.Header) http.Header { for k, v := range h { sensitive := false headerKey := strings.ToLower(k) - if strings.HasPrefix(headerKey, "auth") { - sensitive = true - } else { - switch headerKey { - case "set-cookie", "cookie", "x-auth-token", "x-api-key", "x-auth-user", "proxy-authorization": + for _, sensitiveString := range sensitiveStrings { + if strings.Contains(headerKey, sensitiveString) { sensitive = true + break } } diff --git a/vendor/github.com/davecgh/go-spew/LICENSE b/vendor/github.com/davecgh/go-spew/LICENSE deleted file mode 100644 index bc52e96f..00000000 --- a/vendor/github.com/davecgh/go-spew/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -ISC License - -Copyright (c) 2012-2016 Dave Collins - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/vendor/github.com/davecgh/go-spew/spew/bypass.go b/vendor/github.com/davecgh/go-spew/spew/bypass.go deleted file mode 100644 index 79299478..00000000 --- a/vendor/github.com/davecgh/go-spew/spew/bypass.go +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright (c) 2015-2016 Dave Collins -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// NOTE: Due to the following build constraints, this file will only be compiled -// when the code is not running on Google App Engine, compiled by GopherJS, and -// "-tags safe" is not added to the go build command line. The "disableunsafe" -// tag is deprecated and thus should not be used. -// Go versions prior to 1.4 are disabled because they use a different layout -// for interfaces which make the implementation of unsafeReflectValue more complex. -// +build !js,!appengine,!safe,!disableunsafe,go1.4 - -package spew - -import ( - "reflect" - "unsafe" -) - -const ( - // UnsafeDisabled is a build-time constant which specifies whether or - // not access to the unsafe package is available. - UnsafeDisabled = false - - // ptrSize is the size of a pointer on the current arch. - ptrSize = unsafe.Sizeof((*byte)(nil)) -) - -type flag uintptr - -var ( - // flagRO indicates whether the value field of a reflect.Value - // is read-only. - flagRO flag - - // flagAddr indicates whether the address of the reflect.Value's - // value may be taken. - flagAddr flag -) - -// flagKindMask holds the bits that make up the kind -// part of the flags field. In all the supported versions, -// it is in the lower 5 bits. -const flagKindMask = flag(0x1f) - -// Different versions of Go have used different -// bit layouts for the flags type. This table -// records the known combinations. -var okFlags = []struct { - ro, addr flag -}{{ - // From Go 1.4 to 1.5 - ro: 1 << 5, - addr: 1 << 7, -}, { - // Up to Go tip. - ro: 1<<5 | 1<<6, - addr: 1 << 8, -}} - -var flagValOffset = func() uintptr { - field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag") - if !ok { - panic("reflect.Value has no flag field") - } - return field.Offset -}() - -// flagField returns a pointer to the flag field of a reflect.Value. -func flagField(v *reflect.Value) *flag { - return (*flag)(unsafe.Pointer(uintptr(unsafe.Pointer(v)) + flagValOffset)) -} - -// unsafeReflectValue converts the passed reflect.Value into a one that bypasses -// the typical safety restrictions preventing access to unaddressable and -// unexported data. It works by digging the raw pointer to the underlying -// value out of the protected value and generating a new unprotected (unsafe) -// reflect.Value to it. -// -// This allows us to check for implementations of the Stringer and error -// interfaces to be used for pretty printing ordinarily unaddressable and -// inaccessible values such as unexported struct fields. -func unsafeReflectValue(v reflect.Value) reflect.Value { - if !v.IsValid() || (v.CanInterface() && v.CanAddr()) { - return v - } - flagFieldPtr := flagField(&v) - *flagFieldPtr &^= flagRO - *flagFieldPtr |= flagAddr - return v -} - -// Sanity checks against future reflect package changes -// to the type or semantics of the Value.flag field. -func init() { - field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag") - if !ok { - panic("reflect.Value has no flag field") - } - if field.Type.Kind() != reflect.TypeOf(flag(0)).Kind() { - panic("reflect.Value flag field has changed kind") - } - type t0 int - var t struct { - A t0 - // t0 will have flagEmbedRO set. - t0 - // a will have flagStickyRO set - a t0 - } - vA := reflect.ValueOf(t).FieldByName("A") - va := reflect.ValueOf(t).FieldByName("a") - vt0 := reflect.ValueOf(t).FieldByName("t0") - - // Infer flagRO from the difference between the flags - // for the (otherwise identical) fields in t. - flagPublic := *flagField(&vA) - flagWithRO := *flagField(&va) | *flagField(&vt0) - flagRO = flagPublic ^ flagWithRO - - // Infer flagAddr from the difference between a value - // taken from a pointer and not. - vPtrA := reflect.ValueOf(&t).Elem().FieldByName("A") - flagNoPtr := *flagField(&vA) - flagPtr := *flagField(&vPtrA) - flagAddr = flagNoPtr ^ flagPtr - - // Check that the inferred flags tally with one of the known versions. - for _, f := range okFlags { - if flagRO == f.ro && flagAddr == f.addr { - return - } - } - panic("reflect.Value read-only flag has changed semantics") -} diff --git a/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go b/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go deleted file mode 100644 index 205c28d6..00000000 --- a/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2015-2016 Dave Collins -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// NOTE: Due to the following build constraints, this file will only be compiled -// when the code is running on Google App Engine, compiled by GopherJS, or -// "-tags safe" is added to the go build command line. The "disableunsafe" -// tag is deprecated and thus should not be used. -// +build js appengine safe disableunsafe !go1.4 - -package spew - -import "reflect" - -const ( - // UnsafeDisabled is a build-time constant which specifies whether or - // not access to the unsafe package is available. - UnsafeDisabled = true -) - -// unsafeReflectValue typically converts the passed reflect.Value into a one -// that bypasses the typical safety restrictions preventing access to -// unaddressable and unexported data. However, doing this relies on access to -// the unsafe package. This is a stub version which simply returns the passed -// reflect.Value when the unsafe package is not available. -func unsafeReflectValue(v reflect.Value) reflect.Value { - return v -} diff --git a/vendor/github.com/davecgh/go-spew/spew/common.go b/vendor/github.com/davecgh/go-spew/spew/common.go deleted file mode 100644 index 1be8ce94..00000000 --- a/vendor/github.com/davecgh/go-spew/spew/common.go +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "bytes" - "fmt" - "io" - "reflect" - "sort" - "strconv" -) - -// Some constants in the form of bytes to avoid string overhead. This mirrors -// the technique used in the fmt package. -var ( - panicBytes = []byte("(PANIC=") - plusBytes = []byte("+") - iBytes = []byte("i") - trueBytes = []byte("true") - falseBytes = []byte("false") - interfaceBytes = []byte("(interface {})") - commaNewlineBytes = []byte(",\n") - newlineBytes = []byte("\n") - openBraceBytes = []byte("{") - openBraceNewlineBytes = []byte("{\n") - closeBraceBytes = []byte("}") - asteriskBytes = []byte("*") - colonBytes = []byte(":") - colonSpaceBytes = []byte(": ") - openParenBytes = []byte("(") - closeParenBytes = []byte(")") - spaceBytes = []byte(" ") - pointerChainBytes = []byte("->") - nilAngleBytes = []byte("") - maxNewlineBytes = []byte("\n") - maxShortBytes = []byte("") - circularBytes = []byte("") - circularShortBytes = []byte("") - invalidAngleBytes = []byte("") - openBracketBytes = []byte("[") - closeBracketBytes = []byte("]") - percentBytes = []byte("%") - precisionBytes = []byte(".") - openAngleBytes = []byte("<") - closeAngleBytes = []byte(">") - openMapBytes = []byte("map[") - closeMapBytes = []byte("]") - lenEqualsBytes = []byte("len=") - capEqualsBytes = []byte("cap=") -) - -// hexDigits is used to map a decimal value to a hex digit. -var hexDigits = "0123456789abcdef" - -// catchPanic handles any panics that might occur during the handleMethods -// calls. -func catchPanic(w io.Writer, v reflect.Value) { - if err := recover(); err != nil { - w.Write(panicBytes) - fmt.Fprintf(w, "%v", err) - w.Write(closeParenBytes) - } -} - -// handleMethods attempts to call the Error and String methods on the underlying -// type the passed reflect.Value represents and outputes the result to Writer w. -// -// It handles panics in any called methods by catching and displaying the error -// as the formatted value. -func handleMethods(cs *ConfigState, w io.Writer, v reflect.Value) (handled bool) { - // We need an interface to check if the type implements the error or - // Stringer interface. However, the reflect package won't give us an - // interface on certain things like unexported struct fields in order - // to enforce visibility rules. We use unsafe, when it's available, - // to bypass these restrictions since this package does not mutate the - // values. - if !v.CanInterface() { - if UnsafeDisabled { - return false - } - - v = unsafeReflectValue(v) - } - - // Choose whether or not to do error and Stringer interface lookups against - // the base type or a pointer to the base type depending on settings. - // Technically calling one of these methods with a pointer receiver can - // mutate the value, however, types which choose to satisify an error or - // Stringer interface with a pointer receiver should not be mutating their - // state inside these interface methods. - if !cs.DisablePointerMethods && !UnsafeDisabled && !v.CanAddr() { - v = unsafeReflectValue(v) - } - if v.CanAddr() { - v = v.Addr() - } - - // Is it an error or Stringer? - switch iface := v.Interface().(type) { - case error: - defer catchPanic(w, v) - if cs.ContinueOnMethod { - w.Write(openParenBytes) - w.Write([]byte(iface.Error())) - w.Write(closeParenBytes) - w.Write(spaceBytes) - return false - } - - w.Write([]byte(iface.Error())) - return true - - case fmt.Stringer: - defer catchPanic(w, v) - if cs.ContinueOnMethod { - w.Write(openParenBytes) - w.Write([]byte(iface.String())) - w.Write(closeParenBytes) - w.Write(spaceBytes) - return false - } - w.Write([]byte(iface.String())) - return true - } - return false -} - -// printBool outputs a boolean value as true or false to Writer w. -func printBool(w io.Writer, val bool) { - if val { - w.Write(trueBytes) - } else { - w.Write(falseBytes) - } -} - -// printInt outputs a signed integer value to Writer w. -func printInt(w io.Writer, val int64, base int) { - w.Write([]byte(strconv.FormatInt(val, base))) -} - -// printUint outputs an unsigned integer value to Writer w. -func printUint(w io.Writer, val uint64, base int) { - w.Write([]byte(strconv.FormatUint(val, base))) -} - -// printFloat outputs a floating point value using the specified precision, -// which is expected to be 32 or 64bit, to Writer w. -func printFloat(w io.Writer, val float64, precision int) { - w.Write([]byte(strconv.FormatFloat(val, 'g', -1, precision))) -} - -// printComplex outputs a complex value using the specified float precision -// for the real and imaginary parts to Writer w. -func printComplex(w io.Writer, c complex128, floatPrecision int) { - r := real(c) - w.Write(openParenBytes) - w.Write([]byte(strconv.FormatFloat(r, 'g', -1, floatPrecision))) - i := imag(c) - if i >= 0 { - w.Write(plusBytes) - } - w.Write([]byte(strconv.FormatFloat(i, 'g', -1, floatPrecision))) - w.Write(iBytes) - w.Write(closeParenBytes) -} - -// printHexPtr outputs a uintptr formatted as hexadecimal with a leading '0x' -// prefix to Writer w. -func printHexPtr(w io.Writer, p uintptr) { - // Null pointer. - num := uint64(p) - if num == 0 { - w.Write(nilAngleBytes) - return - } - - // Max uint64 is 16 bytes in hex + 2 bytes for '0x' prefix - buf := make([]byte, 18) - - // It's simpler to construct the hex string right to left. - base := uint64(16) - i := len(buf) - 1 - for num >= base { - buf[i] = hexDigits[num%base] - num /= base - i-- - } - buf[i] = hexDigits[num] - - // Add '0x' prefix. - i-- - buf[i] = 'x' - i-- - buf[i] = '0' - - // Strip unused leading bytes. - buf = buf[i:] - w.Write(buf) -} - -// valuesSorter implements sort.Interface to allow a slice of reflect.Value -// elements to be sorted. -type valuesSorter struct { - values []reflect.Value - strings []string // either nil or same len and values - cs *ConfigState -} - -// newValuesSorter initializes a valuesSorter instance, which holds a set of -// surrogate keys on which the data should be sorted. It uses flags in -// ConfigState to decide if and how to populate those surrogate keys. -func newValuesSorter(values []reflect.Value, cs *ConfigState) sort.Interface { - vs := &valuesSorter{values: values, cs: cs} - if canSortSimply(vs.values[0].Kind()) { - return vs - } - if !cs.DisableMethods { - vs.strings = make([]string, len(values)) - for i := range vs.values { - b := bytes.Buffer{} - if !handleMethods(cs, &b, vs.values[i]) { - vs.strings = nil - break - } - vs.strings[i] = b.String() - } - } - if vs.strings == nil && cs.SpewKeys { - vs.strings = make([]string, len(values)) - for i := range vs.values { - vs.strings[i] = Sprintf("%#v", vs.values[i].Interface()) - } - } - return vs -} - -// canSortSimply tests whether a reflect.Kind is a primitive that can be sorted -// directly, or whether it should be considered for sorting by surrogate keys -// (if the ConfigState allows it). -func canSortSimply(kind reflect.Kind) bool { - // This switch parallels valueSortLess, except for the default case. - switch kind { - case reflect.Bool: - return true - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - return true - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: - return true - case reflect.Float32, reflect.Float64: - return true - case reflect.String: - return true - case reflect.Uintptr: - return true - case reflect.Array: - return true - } - return false -} - -// Len returns the number of values in the slice. It is part of the -// sort.Interface implementation. -func (s *valuesSorter) Len() int { - return len(s.values) -} - -// Swap swaps the values at the passed indices. It is part of the -// sort.Interface implementation. -func (s *valuesSorter) Swap(i, j int) { - s.values[i], s.values[j] = s.values[j], s.values[i] - if s.strings != nil { - s.strings[i], s.strings[j] = s.strings[j], s.strings[i] - } -} - -// valueSortLess returns whether the first value should sort before the second -// value. It is used by valueSorter.Less as part of the sort.Interface -// implementation. -func valueSortLess(a, b reflect.Value) bool { - switch a.Kind() { - case reflect.Bool: - return !a.Bool() && b.Bool() - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - return a.Int() < b.Int() - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: - return a.Uint() < b.Uint() - case reflect.Float32, reflect.Float64: - return a.Float() < b.Float() - case reflect.String: - return a.String() < b.String() - case reflect.Uintptr: - return a.Uint() < b.Uint() - case reflect.Array: - // Compare the contents of both arrays. - l := a.Len() - for i := 0; i < l; i++ { - av := a.Index(i) - bv := b.Index(i) - if av.Interface() == bv.Interface() { - continue - } - return valueSortLess(av, bv) - } - } - return a.String() < b.String() -} - -// Less returns whether the value at index i should sort before the -// value at index j. It is part of the sort.Interface implementation. -func (s *valuesSorter) Less(i, j int) bool { - if s.strings == nil { - return valueSortLess(s.values[i], s.values[j]) - } - return s.strings[i] < s.strings[j] -} - -// sortValues is a sort function that handles both native types and any type that -// can be converted to error or Stringer. Other inputs are sorted according to -// their Value.String() value to ensure display stability. -func sortValues(values []reflect.Value, cs *ConfigState) { - if len(values) == 0 { - return - } - sort.Sort(newValuesSorter(values, cs)) -} diff --git a/vendor/github.com/davecgh/go-spew/spew/config.go b/vendor/github.com/davecgh/go-spew/spew/config.go deleted file mode 100644 index 2e3d22f3..00000000 --- a/vendor/github.com/davecgh/go-spew/spew/config.go +++ /dev/null @@ -1,306 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "bytes" - "fmt" - "io" - "os" -) - -// ConfigState houses the configuration options used by spew to format and -// display values. There is a global instance, Config, that is used to control -// all top-level Formatter and Dump functionality. Each ConfigState instance -// provides methods equivalent to the top-level functions. -// -// The zero value for ConfigState provides no indentation. You would typically -// want to set it to a space or a tab. -// -// Alternatively, you can use NewDefaultConfig to get a ConfigState instance -// with default settings. See the documentation of NewDefaultConfig for default -// values. -type ConfigState struct { - // Indent specifies the string to use for each indentation level. The - // global config instance that all top-level functions use set this to a - // single space by default. If you would like more indentation, you might - // set this to a tab with "\t" or perhaps two spaces with " ". - Indent string - - // MaxDepth controls the maximum number of levels to descend into nested - // data structures. The default, 0, means there is no limit. - // - // NOTE: Circular data structures are properly detected, so it is not - // necessary to set this value unless you specifically want to limit deeply - // nested data structures. - MaxDepth int - - // DisableMethods specifies whether or not error and Stringer interfaces are - // invoked for types that implement them. - DisableMethods bool - - // DisablePointerMethods specifies whether or not to check for and invoke - // error and Stringer interfaces on types which only accept a pointer - // receiver when the current type is not a pointer. - // - // NOTE: This might be an unsafe action since calling one of these methods - // with a pointer receiver could technically mutate the value, however, - // in practice, types which choose to satisify an error or Stringer - // interface with a pointer receiver should not be mutating their state - // inside these interface methods. As a result, this option relies on - // access to the unsafe package, so it will not have any effect when - // running in environments without access to the unsafe package such as - // Google App Engine or with the "safe" build tag specified. - DisablePointerMethods bool - - // DisablePointerAddresses specifies whether to disable the printing of - // pointer addresses. This is useful when diffing data structures in tests. - DisablePointerAddresses bool - - // DisableCapacities specifies whether to disable the printing of capacities - // for arrays, slices, maps and channels. This is useful when diffing - // data structures in tests. - DisableCapacities bool - - // ContinueOnMethod specifies whether or not recursion should continue once - // a custom error or Stringer interface is invoked. The default, false, - // means it will print the results of invoking the custom error or Stringer - // interface and return immediately instead of continuing to recurse into - // the internals of the data type. - // - // NOTE: This flag does not have any effect if method invocation is disabled - // via the DisableMethods or DisablePointerMethods options. - ContinueOnMethod bool - - // SortKeys specifies map keys should be sorted before being printed. Use - // this to have a more deterministic, diffable output. Note that only - // native types (bool, int, uint, floats, uintptr and string) and types - // that support the error or Stringer interfaces (if methods are - // enabled) are supported, with other types sorted according to the - // reflect.Value.String() output which guarantees display stability. - SortKeys bool - - // SpewKeys specifies that, as a last resort attempt, map keys should - // be spewed to strings and sorted by those strings. This is only - // considered if SortKeys is true. - SpewKeys bool -} - -// Config is the active configuration of the top-level functions. -// The configuration can be changed by modifying the contents of spew.Config. -var Config = ConfigState{Indent: " "} - -// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the formatted string as a value that satisfies error. See NewFormatter -// for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Errorf(format, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Errorf(format string, a ...interface{}) (err error) { - return fmt.Errorf(format, c.convertArgs(a)...) -} - -// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprint(w, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Fprint(w io.Writer, a ...interface{}) (n int, err error) { - return fmt.Fprint(w, c.convertArgs(a)...) -} - -// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprintf(w, format, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) { - return fmt.Fprintf(w, format, c.convertArgs(a)...) -} - -// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it -// passed with a Formatter interface returned by c.NewFormatter. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprintln(w, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Fprintln(w io.Writer, a ...interface{}) (n int, err error) { - return fmt.Fprintln(w, c.convertArgs(a)...) -} - -// Print is a wrapper for fmt.Print that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Print(c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Print(a ...interface{}) (n int, err error) { - return fmt.Print(c.convertArgs(a)...) -} - -// Printf is a wrapper for fmt.Printf that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Printf(format, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Printf(format string, a ...interface{}) (n int, err error) { - return fmt.Printf(format, c.convertArgs(a)...) -} - -// Println is a wrapper for fmt.Println that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Println(c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Println(a ...interface{}) (n int, err error) { - return fmt.Println(c.convertArgs(a)...) -} - -// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprint(c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Sprint(a ...interface{}) string { - return fmt.Sprint(c.convertArgs(a)...) -} - -// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprintf(format, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Sprintf(format string, a ...interface{}) string { - return fmt.Sprintf(format, c.convertArgs(a)...) -} - -// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it -// were passed with a Formatter interface returned by c.NewFormatter. It -// returns the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprintln(c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Sprintln(a ...interface{}) string { - return fmt.Sprintln(c.convertArgs(a)...) -} - -/* -NewFormatter returns a custom formatter that satisfies the fmt.Formatter -interface. As a result, it integrates cleanly with standard fmt package -printing functions. The formatter is useful for inline printing of smaller data -types similar to the standard %v format specifier. - -The custom formatter only responds to the %v (most compact), %+v (adds pointer -addresses), %#v (adds types), and %#+v (adds types and pointer addresses) verb -combinations. Any other verbs such as %x and %q will be sent to the the -standard fmt package for formatting. In addition, the custom formatter ignores -the width and precision arguments (however they will still work on the format -specifiers not handled by the custom formatter). - -Typically this function shouldn't be called directly. It is much easier to make -use of the custom formatter by calling one of the convenience functions such as -c.Printf, c.Println, or c.Printf. -*/ -func (c *ConfigState) NewFormatter(v interface{}) fmt.Formatter { - return newFormatter(c, v) -} - -// Fdump formats and displays the passed arguments to io.Writer w. It formats -// exactly the same as Dump. -func (c *ConfigState) Fdump(w io.Writer, a ...interface{}) { - fdump(c, w, a...) -} - -/* -Dump displays the passed parameters to standard out with newlines, customizable -indentation, and additional debug information such as complete types and all -pointer addresses used to indirect to the final value. It provides the -following features over the built-in printing facilities provided by the fmt -package: - - * Pointers are dereferenced and followed - * Circular data structures are detected and handled properly - * Custom Stringer/error interfaces are optionally invoked, including - on unexported types - * Custom types which only implement the Stringer/error interfaces via - a pointer receiver are optionally invoked when passing non-pointer - variables - * Byte arrays and slices are dumped like the hexdump -C command which - includes offsets, byte values in hex, and ASCII output - -The configuration options are controlled by modifying the public members -of c. See ConfigState for options documentation. - -See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to -get the formatted result as a string. -*/ -func (c *ConfigState) Dump(a ...interface{}) { - fdump(c, os.Stdout, a...) -} - -// Sdump returns a string with the passed arguments formatted exactly the same -// as Dump. -func (c *ConfigState) Sdump(a ...interface{}) string { - var buf bytes.Buffer - fdump(c, &buf, a...) - return buf.String() -} - -// convertArgs accepts a slice of arguments and returns a slice of the same -// length with each argument converted to a spew Formatter interface using -// the ConfigState associated with s. -func (c *ConfigState) convertArgs(args []interface{}) (formatters []interface{}) { - formatters = make([]interface{}, len(args)) - for index, arg := range args { - formatters[index] = newFormatter(c, arg) - } - return formatters -} - -// NewDefaultConfig returns a ConfigState with the following default settings. -// -// Indent: " " -// MaxDepth: 0 -// DisableMethods: false -// DisablePointerMethods: false -// ContinueOnMethod: false -// SortKeys: false -func NewDefaultConfig() *ConfigState { - return &ConfigState{Indent: " "} -} diff --git a/vendor/github.com/davecgh/go-spew/spew/doc.go b/vendor/github.com/davecgh/go-spew/spew/doc.go deleted file mode 100644 index aacaac6f..00000000 --- a/vendor/github.com/davecgh/go-spew/spew/doc.go +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* -Package spew implements a deep pretty printer for Go data structures to aid in -debugging. - -A quick overview of the additional features spew provides over the built-in -printing facilities for Go data types are as follows: - - * Pointers are dereferenced and followed - * Circular data structures are detected and handled properly - * Custom Stringer/error interfaces are optionally invoked, including - on unexported types - * Custom types which only implement the Stringer/error interfaces via - a pointer receiver are optionally invoked when passing non-pointer - variables - * Byte arrays and slices are dumped like the hexdump -C command which - includes offsets, byte values in hex, and ASCII output (only when using - Dump style) - -There are two different approaches spew allows for dumping Go data structures: - - * Dump style which prints with newlines, customizable indentation, - and additional debug information such as types and all pointer addresses - used to indirect to the final value - * A custom Formatter interface that integrates cleanly with the standard fmt - package and replaces %v, %+v, %#v, and %#+v to provide inline printing - similar to the default %v while providing the additional functionality - outlined above and passing unsupported format verbs such as %x and %q - along to fmt - -Quick Start - -This section demonstrates how to quickly get started with spew. See the -sections below for further details on formatting and configuration options. - -To dump a variable with full newlines, indentation, type, and pointer -information use Dump, Fdump, or Sdump: - spew.Dump(myVar1, myVar2, ...) - spew.Fdump(someWriter, myVar1, myVar2, ...) - str := spew.Sdump(myVar1, myVar2, ...) - -Alternatively, if you would prefer to use format strings with a compacted inline -printing style, use the convenience wrappers Printf, Fprintf, etc with -%v (most compact), %+v (adds pointer addresses), %#v (adds types), or -%#+v (adds types and pointer addresses): - spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2) - spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) - spew.Fprintf(someWriter, "myVar1: %v -- myVar2: %+v", myVar1, myVar2) - spew.Fprintf(someWriter, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) - -Configuration Options - -Configuration of spew is handled by fields in the ConfigState type. For -convenience, all of the top-level functions use a global state available -via the spew.Config global. - -It is also possible to create a ConfigState instance that provides methods -equivalent to the top-level functions. This allows concurrent configuration -options. See the ConfigState documentation for more details. - -The following configuration options are available: - * Indent - String to use for each indentation level for Dump functions. - It is a single space by default. A popular alternative is "\t". - - * MaxDepth - Maximum number of levels to descend into nested data structures. - There is no limit by default. - - * DisableMethods - Disables invocation of error and Stringer interface methods. - Method invocation is enabled by default. - - * DisablePointerMethods - Disables invocation of error and Stringer interface methods on types - which only accept pointer receivers from non-pointer variables. - Pointer method invocation is enabled by default. - - * DisablePointerAddresses - DisablePointerAddresses specifies whether to disable the printing of - pointer addresses. This is useful when diffing data structures in tests. - - * DisableCapacities - DisableCapacities specifies whether to disable the printing of - capacities for arrays, slices, maps and channels. This is useful when - diffing data structures in tests. - - * ContinueOnMethod - Enables recursion into types after invoking error and Stringer interface - methods. Recursion after method invocation is disabled by default. - - * SortKeys - Specifies map keys should be sorted before being printed. Use - this to have a more deterministic, diffable output. Note that - only native types (bool, int, uint, floats, uintptr and string) - and types which implement error or Stringer interfaces are - supported with other types sorted according to the - reflect.Value.String() output which guarantees display - stability. Natural map order is used by default. - - * SpewKeys - Specifies that, as a last resort attempt, map keys should be - spewed to strings and sorted by those strings. This is only - considered if SortKeys is true. - -Dump Usage - -Simply call spew.Dump with a list of variables you want to dump: - - spew.Dump(myVar1, myVar2, ...) - -You may also call spew.Fdump if you would prefer to output to an arbitrary -io.Writer. For example, to dump to standard error: - - spew.Fdump(os.Stderr, myVar1, myVar2, ...) - -A third option is to call spew.Sdump to get the formatted output as a string: - - str := spew.Sdump(myVar1, myVar2, ...) - -Sample Dump Output - -See the Dump example for details on the setup of the types and variables being -shown here. - - (main.Foo) { - unexportedField: (*main.Bar)(0xf84002e210)({ - flag: (main.Flag) flagTwo, - data: (uintptr) - }), - ExportedField: (map[interface {}]interface {}) (len=1) { - (string) (len=3) "one": (bool) true - } - } - -Byte (and uint8) arrays and slices are displayed uniquely like the hexdump -C -command as shown. - ([]uint8) (len=32 cap=32) { - 00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 |............... | - 00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 |!"#$%&'()*+,-./0| - 00000020 31 32 |12| - } - -Custom Formatter - -Spew provides a custom formatter that implements the fmt.Formatter interface -so that it integrates cleanly with standard fmt package printing functions. The -formatter is useful for inline printing of smaller data types similar to the -standard %v format specifier. - -The custom formatter only responds to the %v (most compact), %+v (adds pointer -addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb -combinations. Any other verbs such as %x and %q will be sent to the the -standard fmt package for formatting. In addition, the custom formatter ignores -the width and precision arguments (however they will still work on the format -specifiers not handled by the custom formatter). - -Custom Formatter Usage - -The simplest way to make use of the spew custom formatter is to call one of the -convenience functions such as spew.Printf, spew.Println, or spew.Printf. The -functions have syntax you are most likely already familiar with: - - spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2) - spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) - spew.Println(myVar, myVar2) - spew.Fprintf(os.Stderr, "myVar1: %v -- myVar2: %+v", myVar1, myVar2) - spew.Fprintf(os.Stderr, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) - -See the Index for the full list convenience functions. - -Sample Formatter Output - -Double pointer to a uint8: - %v: <**>5 - %+v: <**>(0xf8400420d0->0xf8400420c8)5 - %#v: (**uint8)5 - %#+v: (**uint8)(0xf8400420d0->0xf8400420c8)5 - -Pointer to circular struct with a uint8 field and a pointer to itself: - %v: <*>{1 <*>} - %+v: <*>(0xf84003e260){ui8:1 c:<*>(0xf84003e260)} - %#v: (*main.circular){ui8:(uint8)1 c:(*main.circular)} - %#+v: (*main.circular)(0xf84003e260){ui8:(uint8)1 c:(*main.circular)(0xf84003e260)} - -See the Printf example for details on the setup of variables being shown -here. - -Errors - -Since it is possible for custom Stringer/error interfaces to panic, spew -detects them and handles them internally by printing the panic information -inline with the output. Since spew is intended to provide deep pretty printing -capabilities on structures, it intentionally does not return any errors. -*/ -package spew diff --git a/vendor/github.com/davecgh/go-spew/spew/dump.go b/vendor/github.com/davecgh/go-spew/spew/dump.go deleted file mode 100644 index f78d89fc..00000000 --- a/vendor/github.com/davecgh/go-spew/spew/dump.go +++ /dev/null @@ -1,509 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "bytes" - "encoding/hex" - "fmt" - "io" - "os" - "reflect" - "regexp" - "strconv" - "strings" -) - -var ( - // uint8Type is a reflect.Type representing a uint8. It is used to - // convert cgo types to uint8 slices for hexdumping. - uint8Type = reflect.TypeOf(uint8(0)) - - // cCharRE is a regular expression that matches a cgo char. - // It is used to detect character arrays to hexdump them. - cCharRE = regexp.MustCompile(`^.*\._Ctype_char$`) - - // cUnsignedCharRE is a regular expression that matches a cgo unsigned - // char. It is used to detect unsigned character arrays to hexdump - // them. - cUnsignedCharRE = regexp.MustCompile(`^.*\._Ctype_unsignedchar$`) - - // cUint8tCharRE is a regular expression that matches a cgo uint8_t. - // It is used to detect uint8_t arrays to hexdump them. - cUint8tCharRE = regexp.MustCompile(`^.*\._Ctype_uint8_t$`) -) - -// dumpState contains information about the state of a dump operation. -type dumpState struct { - w io.Writer - depth int - pointers map[uintptr]int - ignoreNextType bool - ignoreNextIndent bool - cs *ConfigState -} - -// indent performs indentation according to the depth level and cs.Indent -// option. -func (d *dumpState) indent() { - if d.ignoreNextIndent { - d.ignoreNextIndent = false - return - } - d.w.Write(bytes.Repeat([]byte(d.cs.Indent), d.depth)) -} - -// unpackValue returns values inside of non-nil interfaces when possible. -// This is useful for data types like structs, arrays, slices, and maps which -// can contain varying types packed inside an interface. -func (d *dumpState) unpackValue(v reflect.Value) reflect.Value { - if v.Kind() == reflect.Interface && !v.IsNil() { - v = v.Elem() - } - return v -} - -// dumpPtr handles formatting of pointers by indirecting them as necessary. -func (d *dumpState) dumpPtr(v reflect.Value) { - // Remove pointers at or below the current depth from map used to detect - // circular refs. - for k, depth := range d.pointers { - if depth >= d.depth { - delete(d.pointers, k) - } - } - - // Keep list of all dereferenced pointers to show later. - pointerChain := make([]uintptr, 0) - - // Figure out how many levels of indirection there are by dereferencing - // pointers and unpacking interfaces down the chain while detecting circular - // references. - nilFound := false - cycleFound := false - indirects := 0 - ve := v - for ve.Kind() == reflect.Ptr { - if ve.IsNil() { - nilFound = true - break - } - indirects++ - addr := ve.Pointer() - pointerChain = append(pointerChain, addr) - if pd, ok := d.pointers[addr]; ok && pd < d.depth { - cycleFound = true - indirects-- - break - } - d.pointers[addr] = d.depth - - ve = ve.Elem() - if ve.Kind() == reflect.Interface { - if ve.IsNil() { - nilFound = true - break - } - ve = ve.Elem() - } - } - - // Display type information. - d.w.Write(openParenBytes) - d.w.Write(bytes.Repeat(asteriskBytes, indirects)) - d.w.Write([]byte(ve.Type().String())) - d.w.Write(closeParenBytes) - - // Display pointer information. - if !d.cs.DisablePointerAddresses && len(pointerChain) > 0 { - d.w.Write(openParenBytes) - for i, addr := range pointerChain { - if i > 0 { - d.w.Write(pointerChainBytes) - } - printHexPtr(d.w, addr) - } - d.w.Write(closeParenBytes) - } - - // Display dereferenced value. - d.w.Write(openParenBytes) - switch { - case nilFound: - d.w.Write(nilAngleBytes) - - case cycleFound: - d.w.Write(circularBytes) - - default: - d.ignoreNextType = true - d.dump(ve) - } - d.w.Write(closeParenBytes) -} - -// dumpSlice handles formatting of arrays and slices. Byte (uint8 under -// reflection) arrays and slices are dumped in hexdump -C fashion. -func (d *dumpState) dumpSlice(v reflect.Value) { - // Determine whether this type should be hex dumped or not. Also, - // for types which should be hexdumped, try to use the underlying data - // first, then fall back to trying to convert them to a uint8 slice. - var buf []uint8 - doConvert := false - doHexDump := false - numEntries := v.Len() - if numEntries > 0 { - vt := v.Index(0).Type() - vts := vt.String() - switch { - // C types that need to be converted. - case cCharRE.MatchString(vts): - fallthrough - case cUnsignedCharRE.MatchString(vts): - fallthrough - case cUint8tCharRE.MatchString(vts): - doConvert = true - - // Try to use existing uint8 slices and fall back to converting - // and copying if that fails. - case vt.Kind() == reflect.Uint8: - // We need an addressable interface to convert the type - // to a byte slice. However, the reflect package won't - // give us an interface on certain things like - // unexported struct fields in order to enforce - // visibility rules. We use unsafe, when available, to - // bypass these restrictions since this package does not - // mutate the values. - vs := v - if !vs.CanInterface() || !vs.CanAddr() { - vs = unsafeReflectValue(vs) - } - if !UnsafeDisabled { - vs = vs.Slice(0, numEntries) - - // Use the existing uint8 slice if it can be - // type asserted. - iface := vs.Interface() - if slice, ok := iface.([]uint8); ok { - buf = slice - doHexDump = true - break - } - } - - // The underlying data needs to be converted if it can't - // be type asserted to a uint8 slice. - doConvert = true - } - - // Copy and convert the underlying type if needed. - if doConvert && vt.ConvertibleTo(uint8Type) { - // Convert and copy each element into a uint8 byte - // slice. - buf = make([]uint8, numEntries) - for i := 0; i < numEntries; i++ { - vv := v.Index(i) - buf[i] = uint8(vv.Convert(uint8Type).Uint()) - } - doHexDump = true - } - } - - // Hexdump the entire slice as needed. - if doHexDump { - indent := strings.Repeat(d.cs.Indent, d.depth) - str := indent + hex.Dump(buf) - str = strings.Replace(str, "\n", "\n"+indent, -1) - str = strings.TrimRight(str, d.cs.Indent) - d.w.Write([]byte(str)) - return - } - - // Recursively call dump for each item. - for i := 0; i < numEntries; i++ { - d.dump(d.unpackValue(v.Index(i))) - if i < (numEntries - 1) { - d.w.Write(commaNewlineBytes) - } else { - d.w.Write(newlineBytes) - } - } -} - -// dump is the main workhorse for dumping a value. It uses the passed reflect -// value to figure out what kind of object we are dealing with and formats it -// appropriately. It is a recursive function, however circular data structures -// are detected and handled properly. -func (d *dumpState) dump(v reflect.Value) { - // Handle invalid reflect values immediately. - kind := v.Kind() - if kind == reflect.Invalid { - d.w.Write(invalidAngleBytes) - return - } - - // Handle pointers specially. - if kind == reflect.Ptr { - d.indent() - d.dumpPtr(v) - return - } - - // Print type information unless already handled elsewhere. - if !d.ignoreNextType { - d.indent() - d.w.Write(openParenBytes) - d.w.Write([]byte(v.Type().String())) - d.w.Write(closeParenBytes) - d.w.Write(spaceBytes) - } - d.ignoreNextType = false - - // Display length and capacity if the built-in len and cap functions - // work with the value's kind and the len/cap itself is non-zero. - valueLen, valueCap := 0, 0 - switch v.Kind() { - case reflect.Array, reflect.Slice, reflect.Chan: - valueLen, valueCap = v.Len(), v.Cap() - case reflect.Map, reflect.String: - valueLen = v.Len() - } - if valueLen != 0 || !d.cs.DisableCapacities && valueCap != 0 { - d.w.Write(openParenBytes) - if valueLen != 0 { - d.w.Write(lenEqualsBytes) - printInt(d.w, int64(valueLen), 10) - } - if !d.cs.DisableCapacities && valueCap != 0 { - if valueLen != 0 { - d.w.Write(spaceBytes) - } - d.w.Write(capEqualsBytes) - printInt(d.w, int64(valueCap), 10) - } - d.w.Write(closeParenBytes) - d.w.Write(spaceBytes) - } - - // Call Stringer/error interfaces if they exist and the handle methods flag - // is enabled - if !d.cs.DisableMethods { - if (kind != reflect.Invalid) && (kind != reflect.Interface) { - if handled := handleMethods(d.cs, d.w, v); handled { - return - } - } - } - - switch kind { - case reflect.Invalid: - // Do nothing. We should never get here since invalid has already - // been handled above. - - case reflect.Bool: - printBool(d.w, v.Bool()) - - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - printInt(d.w, v.Int(), 10) - - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: - printUint(d.w, v.Uint(), 10) - - case reflect.Float32: - printFloat(d.w, v.Float(), 32) - - case reflect.Float64: - printFloat(d.w, v.Float(), 64) - - case reflect.Complex64: - printComplex(d.w, v.Complex(), 32) - - case reflect.Complex128: - printComplex(d.w, v.Complex(), 64) - - case reflect.Slice: - if v.IsNil() { - d.w.Write(nilAngleBytes) - break - } - fallthrough - - case reflect.Array: - d.w.Write(openBraceNewlineBytes) - d.depth++ - if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { - d.indent() - d.w.Write(maxNewlineBytes) - } else { - d.dumpSlice(v) - } - d.depth-- - d.indent() - d.w.Write(closeBraceBytes) - - case reflect.String: - d.w.Write([]byte(strconv.Quote(v.String()))) - - case reflect.Interface: - // The only time we should get here is for nil interfaces due to - // unpackValue calls. - if v.IsNil() { - d.w.Write(nilAngleBytes) - } - - case reflect.Ptr: - // Do nothing. We should never get here since pointers have already - // been handled above. - - case reflect.Map: - // nil maps should be indicated as different than empty maps - if v.IsNil() { - d.w.Write(nilAngleBytes) - break - } - - d.w.Write(openBraceNewlineBytes) - d.depth++ - if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { - d.indent() - d.w.Write(maxNewlineBytes) - } else { - numEntries := v.Len() - keys := v.MapKeys() - if d.cs.SortKeys { - sortValues(keys, d.cs) - } - for i, key := range keys { - d.dump(d.unpackValue(key)) - d.w.Write(colonSpaceBytes) - d.ignoreNextIndent = true - d.dump(d.unpackValue(v.MapIndex(key))) - if i < (numEntries - 1) { - d.w.Write(commaNewlineBytes) - } else { - d.w.Write(newlineBytes) - } - } - } - d.depth-- - d.indent() - d.w.Write(closeBraceBytes) - - case reflect.Struct: - d.w.Write(openBraceNewlineBytes) - d.depth++ - if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { - d.indent() - d.w.Write(maxNewlineBytes) - } else { - vt := v.Type() - numFields := v.NumField() - for i := 0; i < numFields; i++ { - d.indent() - vtf := vt.Field(i) - d.w.Write([]byte(vtf.Name)) - d.w.Write(colonSpaceBytes) - d.ignoreNextIndent = true - d.dump(d.unpackValue(v.Field(i))) - if i < (numFields - 1) { - d.w.Write(commaNewlineBytes) - } else { - d.w.Write(newlineBytes) - } - } - } - d.depth-- - d.indent() - d.w.Write(closeBraceBytes) - - case reflect.Uintptr: - printHexPtr(d.w, uintptr(v.Uint())) - - case reflect.UnsafePointer, reflect.Chan, reflect.Func: - printHexPtr(d.w, v.Pointer()) - - // There were not any other types at the time this code was written, but - // fall back to letting the default fmt package handle it in case any new - // types are added. - default: - if v.CanInterface() { - fmt.Fprintf(d.w, "%v", v.Interface()) - } else { - fmt.Fprintf(d.w, "%v", v.String()) - } - } -} - -// fdump is a helper function to consolidate the logic from the various public -// methods which take varying writers and config states. -func fdump(cs *ConfigState, w io.Writer, a ...interface{}) { - for _, arg := range a { - if arg == nil { - w.Write(interfaceBytes) - w.Write(spaceBytes) - w.Write(nilAngleBytes) - w.Write(newlineBytes) - continue - } - - d := dumpState{w: w, cs: cs} - d.pointers = make(map[uintptr]int) - d.dump(reflect.ValueOf(arg)) - d.w.Write(newlineBytes) - } -} - -// Fdump formats and displays the passed arguments to io.Writer w. It formats -// exactly the same as Dump. -func Fdump(w io.Writer, a ...interface{}) { - fdump(&Config, w, a...) -} - -// Sdump returns a string with the passed arguments formatted exactly the same -// as Dump. -func Sdump(a ...interface{}) string { - var buf bytes.Buffer - fdump(&Config, &buf, a...) - return buf.String() -} - -/* -Dump displays the passed parameters to standard out with newlines, customizable -indentation, and additional debug information such as complete types and all -pointer addresses used to indirect to the final value. It provides the -following features over the built-in printing facilities provided by the fmt -package: - - * Pointers are dereferenced and followed - * Circular data structures are detected and handled properly - * Custom Stringer/error interfaces are optionally invoked, including - on unexported types - * Custom types which only implement the Stringer/error interfaces via - a pointer receiver are optionally invoked when passing non-pointer - variables - * Byte arrays and slices are dumped like the hexdump -C command which - includes offsets, byte values in hex, and ASCII output - -The configuration options are controlled by an exported package global, -spew.Config. See ConfigState for options documentation. - -See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to -get the formatted result as a string. -*/ -func Dump(a ...interface{}) { - fdump(&Config, os.Stdout, a...) -} diff --git a/vendor/github.com/davecgh/go-spew/spew/format.go b/vendor/github.com/davecgh/go-spew/spew/format.go deleted file mode 100644 index b04edb7d..00000000 --- a/vendor/github.com/davecgh/go-spew/spew/format.go +++ /dev/null @@ -1,419 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "bytes" - "fmt" - "reflect" - "strconv" - "strings" -) - -// supportedFlags is a list of all the character flags supported by fmt package. -const supportedFlags = "0-+# " - -// formatState implements the fmt.Formatter interface and contains information -// about the state of a formatting operation. The NewFormatter function can -// be used to get a new Formatter which can be used directly as arguments -// in standard fmt package printing calls. -type formatState struct { - value interface{} - fs fmt.State - depth int - pointers map[uintptr]int - ignoreNextType bool - cs *ConfigState -} - -// buildDefaultFormat recreates the original format string without precision -// and width information to pass in to fmt.Sprintf in the case of an -// unrecognized type. Unless new types are added to the language, this -// function won't ever be called. -func (f *formatState) buildDefaultFormat() (format string) { - buf := bytes.NewBuffer(percentBytes) - - for _, flag := range supportedFlags { - if f.fs.Flag(int(flag)) { - buf.WriteRune(flag) - } - } - - buf.WriteRune('v') - - format = buf.String() - return format -} - -// constructOrigFormat recreates the original format string including precision -// and width information to pass along to the standard fmt package. This allows -// automatic deferral of all format strings this package doesn't support. -func (f *formatState) constructOrigFormat(verb rune) (format string) { - buf := bytes.NewBuffer(percentBytes) - - for _, flag := range supportedFlags { - if f.fs.Flag(int(flag)) { - buf.WriteRune(flag) - } - } - - if width, ok := f.fs.Width(); ok { - buf.WriteString(strconv.Itoa(width)) - } - - if precision, ok := f.fs.Precision(); ok { - buf.Write(precisionBytes) - buf.WriteString(strconv.Itoa(precision)) - } - - buf.WriteRune(verb) - - format = buf.String() - return format -} - -// unpackValue returns values inside of non-nil interfaces when possible and -// ensures that types for values which have been unpacked from an interface -// are displayed when the show types flag is also set. -// This is useful for data types like structs, arrays, slices, and maps which -// can contain varying types packed inside an interface. -func (f *formatState) unpackValue(v reflect.Value) reflect.Value { - if v.Kind() == reflect.Interface { - f.ignoreNextType = false - if !v.IsNil() { - v = v.Elem() - } - } - return v -} - -// formatPtr handles formatting of pointers by indirecting them as necessary. -func (f *formatState) formatPtr(v reflect.Value) { - // Display nil if top level pointer is nil. - showTypes := f.fs.Flag('#') - if v.IsNil() && (!showTypes || f.ignoreNextType) { - f.fs.Write(nilAngleBytes) - return - } - - // Remove pointers at or below the current depth from map used to detect - // circular refs. - for k, depth := range f.pointers { - if depth >= f.depth { - delete(f.pointers, k) - } - } - - // Keep list of all dereferenced pointers to possibly show later. - pointerChain := make([]uintptr, 0) - - // Figure out how many levels of indirection there are by derferencing - // pointers and unpacking interfaces down the chain while detecting circular - // references. - nilFound := false - cycleFound := false - indirects := 0 - ve := v - for ve.Kind() == reflect.Ptr { - if ve.IsNil() { - nilFound = true - break - } - indirects++ - addr := ve.Pointer() - pointerChain = append(pointerChain, addr) - if pd, ok := f.pointers[addr]; ok && pd < f.depth { - cycleFound = true - indirects-- - break - } - f.pointers[addr] = f.depth - - ve = ve.Elem() - if ve.Kind() == reflect.Interface { - if ve.IsNil() { - nilFound = true - break - } - ve = ve.Elem() - } - } - - // Display type or indirection level depending on flags. - if showTypes && !f.ignoreNextType { - f.fs.Write(openParenBytes) - f.fs.Write(bytes.Repeat(asteriskBytes, indirects)) - f.fs.Write([]byte(ve.Type().String())) - f.fs.Write(closeParenBytes) - } else { - if nilFound || cycleFound { - indirects += strings.Count(ve.Type().String(), "*") - } - f.fs.Write(openAngleBytes) - f.fs.Write([]byte(strings.Repeat("*", indirects))) - f.fs.Write(closeAngleBytes) - } - - // Display pointer information depending on flags. - if f.fs.Flag('+') && (len(pointerChain) > 0) { - f.fs.Write(openParenBytes) - for i, addr := range pointerChain { - if i > 0 { - f.fs.Write(pointerChainBytes) - } - printHexPtr(f.fs, addr) - } - f.fs.Write(closeParenBytes) - } - - // Display dereferenced value. - switch { - case nilFound: - f.fs.Write(nilAngleBytes) - - case cycleFound: - f.fs.Write(circularShortBytes) - - default: - f.ignoreNextType = true - f.format(ve) - } -} - -// format is the main workhorse for providing the Formatter interface. It -// uses the passed reflect value to figure out what kind of object we are -// dealing with and formats it appropriately. It is a recursive function, -// however circular data structures are detected and handled properly. -func (f *formatState) format(v reflect.Value) { - // Handle invalid reflect values immediately. - kind := v.Kind() - if kind == reflect.Invalid { - f.fs.Write(invalidAngleBytes) - return - } - - // Handle pointers specially. - if kind == reflect.Ptr { - f.formatPtr(v) - return - } - - // Print type information unless already handled elsewhere. - if !f.ignoreNextType && f.fs.Flag('#') { - f.fs.Write(openParenBytes) - f.fs.Write([]byte(v.Type().String())) - f.fs.Write(closeParenBytes) - } - f.ignoreNextType = false - - // Call Stringer/error interfaces if they exist and the handle methods - // flag is enabled. - if !f.cs.DisableMethods { - if (kind != reflect.Invalid) && (kind != reflect.Interface) { - if handled := handleMethods(f.cs, f.fs, v); handled { - return - } - } - } - - switch kind { - case reflect.Invalid: - // Do nothing. We should never get here since invalid has already - // been handled above. - - case reflect.Bool: - printBool(f.fs, v.Bool()) - - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - printInt(f.fs, v.Int(), 10) - - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: - printUint(f.fs, v.Uint(), 10) - - case reflect.Float32: - printFloat(f.fs, v.Float(), 32) - - case reflect.Float64: - printFloat(f.fs, v.Float(), 64) - - case reflect.Complex64: - printComplex(f.fs, v.Complex(), 32) - - case reflect.Complex128: - printComplex(f.fs, v.Complex(), 64) - - case reflect.Slice: - if v.IsNil() { - f.fs.Write(nilAngleBytes) - break - } - fallthrough - - case reflect.Array: - f.fs.Write(openBracketBytes) - f.depth++ - if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { - f.fs.Write(maxShortBytes) - } else { - numEntries := v.Len() - for i := 0; i < numEntries; i++ { - if i > 0 { - f.fs.Write(spaceBytes) - } - f.ignoreNextType = true - f.format(f.unpackValue(v.Index(i))) - } - } - f.depth-- - f.fs.Write(closeBracketBytes) - - case reflect.String: - f.fs.Write([]byte(v.String())) - - case reflect.Interface: - // The only time we should get here is for nil interfaces due to - // unpackValue calls. - if v.IsNil() { - f.fs.Write(nilAngleBytes) - } - - case reflect.Ptr: - // Do nothing. We should never get here since pointers have already - // been handled above. - - case reflect.Map: - // nil maps should be indicated as different than empty maps - if v.IsNil() { - f.fs.Write(nilAngleBytes) - break - } - - f.fs.Write(openMapBytes) - f.depth++ - if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { - f.fs.Write(maxShortBytes) - } else { - keys := v.MapKeys() - if f.cs.SortKeys { - sortValues(keys, f.cs) - } - for i, key := range keys { - if i > 0 { - f.fs.Write(spaceBytes) - } - f.ignoreNextType = true - f.format(f.unpackValue(key)) - f.fs.Write(colonBytes) - f.ignoreNextType = true - f.format(f.unpackValue(v.MapIndex(key))) - } - } - f.depth-- - f.fs.Write(closeMapBytes) - - case reflect.Struct: - numFields := v.NumField() - f.fs.Write(openBraceBytes) - f.depth++ - if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { - f.fs.Write(maxShortBytes) - } else { - vt := v.Type() - for i := 0; i < numFields; i++ { - if i > 0 { - f.fs.Write(spaceBytes) - } - vtf := vt.Field(i) - if f.fs.Flag('+') || f.fs.Flag('#') { - f.fs.Write([]byte(vtf.Name)) - f.fs.Write(colonBytes) - } - f.format(f.unpackValue(v.Field(i))) - } - } - f.depth-- - f.fs.Write(closeBraceBytes) - - case reflect.Uintptr: - printHexPtr(f.fs, uintptr(v.Uint())) - - case reflect.UnsafePointer, reflect.Chan, reflect.Func: - printHexPtr(f.fs, v.Pointer()) - - // There were not any other types at the time this code was written, but - // fall back to letting the default fmt package handle it if any get added. - default: - format := f.buildDefaultFormat() - if v.CanInterface() { - fmt.Fprintf(f.fs, format, v.Interface()) - } else { - fmt.Fprintf(f.fs, format, v.String()) - } - } -} - -// Format satisfies the fmt.Formatter interface. See NewFormatter for usage -// details. -func (f *formatState) Format(fs fmt.State, verb rune) { - f.fs = fs - - // Use standard formatting for verbs that are not v. - if verb != 'v' { - format := f.constructOrigFormat(verb) - fmt.Fprintf(fs, format, f.value) - return - } - - if f.value == nil { - if fs.Flag('#') { - fs.Write(interfaceBytes) - } - fs.Write(nilAngleBytes) - return - } - - f.format(reflect.ValueOf(f.value)) -} - -// newFormatter is a helper function to consolidate the logic from the various -// public methods which take varying config states. -func newFormatter(cs *ConfigState, v interface{}) fmt.Formatter { - fs := &formatState{value: v, cs: cs} - fs.pointers = make(map[uintptr]int) - return fs -} - -/* -NewFormatter returns a custom formatter that satisfies the fmt.Formatter -interface. As a result, it integrates cleanly with standard fmt package -printing functions. The formatter is useful for inline printing of smaller data -types similar to the standard %v format specifier. - -The custom formatter only responds to the %v (most compact), %+v (adds pointer -addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb -combinations. Any other verbs such as %x and %q will be sent to the the -standard fmt package for formatting. In addition, the custom formatter ignores -the width and precision arguments (however they will still work on the format -specifiers not handled by the custom formatter). - -Typically this function shouldn't be called directly. It is much easier to make -use of the custom formatter by calling one of the convenience functions such as -Printf, Println, or Fprintf. -*/ -func NewFormatter(v interface{}) fmt.Formatter { - return newFormatter(&Config, v) -} diff --git a/vendor/github.com/davecgh/go-spew/spew/spew.go b/vendor/github.com/davecgh/go-spew/spew/spew.go deleted file mode 100644 index 32c0e338..00000000 --- a/vendor/github.com/davecgh/go-spew/spew/spew.go +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "fmt" - "io" -) - -// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the formatted string as a value that satisfies error. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Errorf(format, spew.NewFormatter(a), spew.NewFormatter(b)) -func Errorf(format string, a ...interface{}) (err error) { - return fmt.Errorf(format, convertArgs(a)...) -} - -// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprint(w, spew.NewFormatter(a), spew.NewFormatter(b)) -func Fprint(w io.Writer, a ...interface{}) (n int, err error) { - return fmt.Fprint(w, convertArgs(a)...) -} - -// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprintf(w, format, spew.NewFormatter(a), spew.NewFormatter(b)) -func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) { - return fmt.Fprintf(w, format, convertArgs(a)...) -} - -// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it -// passed with a default Formatter interface returned by NewFormatter. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprintln(w, spew.NewFormatter(a), spew.NewFormatter(b)) -func Fprintln(w io.Writer, a ...interface{}) (n int, err error) { - return fmt.Fprintln(w, convertArgs(a)...) -} - -// Print is a wrapper for fmt.Print that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Print(spew.NewFormatter(a), spew.NewFormatter(b)) -func Print(a ...interface{}) (n int, err error) { - return fmt.Print(convertArgs(a)...) -} - -// Printf is a wrapper for fmt.Printf that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Printf(format, spew.NewFormatter(a), spew.NewFormatter(b)) -func Printf(format string, a ...interface{}) (n int, err error) { - return fmt.Printf(format, convertArgs(a)...) -} - -// Println is a wrapper for fmt.Println that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Println(spew.NewFormatter(a), spew.NewFormatter(b)) -func Println(a ...interface{}) (n int, err error) { - return fmt.Println(convertArgs(a)...) -} - -// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprint(spew.NewFormatter(a), spew.NewFormatter(b)) -func Sprint(a ...interface{}) string { - return fmt.Sprint(convertArgs(a)...) -} - -// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprintf(format, spew.NewFormatter(a), spew.NewFormatter(b)) -func Sprintf(format string, a ...interface{}) string { - return fmt.Sprintf(format, convertArgs(a)...) -} - -// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it -// were passed with a default Formatter interface returned by NewFormatter. It -// returns the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprintln(spew.NewFormatter(a), spew.NewFormatter(b)) -func Sprintln(a ...interface{}) string { - return fmt.Sprintln(convertArgs(a)...) -} - -// convertArgs accepts a slice of arguments and returns a slice of the same -// length with each argument converted to a default spew Formatter interface. -func convertArgs(args []interface{}) (formatters []interface{}) { - formatters = make([]interface{}, len(args)) - for index, arg := range args { - formatters[index] = NewFormatter(arg) - } - return formatters -} diff --git a/vendor/github.com/ebitengine/purego/README.md b/vendor/github.com/ebitengine/purego/README.md index f1ff9053..523e9118 100644 --- a/vendor/github.com/ebitengine/purego/README.md +++ b/vendor/github.com/ebitengine/purego/README.md @@ -26,17 +26,31 @@ except for float arguments and return values. ## Supported Platforms -- **FreeBSD**: amd64, arm64 +### Tier 1 + +Tier 1 platforms are the primary targets officially supported by PureGo. When a new version of PureGo is released, any critical bugs found on Tier 1 platforms are treated as release blockers. The release will be postponed until such issues are resolved. + +- **Android**: amd64, arm64 +- **iOS**: amd64, arm64 - **Linux**: amd64, arm64 -- **macOS / iOS**: amd64, arm64 -- **Windows**: 386*, amd64, arm*, arm64 +- **macOS**: amd64, arm64 +- **Windows**: amd64, arm64 + +### Tier 2 + +Tier 2 platforms are supported by PureGo on a best-effort basis. Critical bugs on Tier 2 platforms do not block new PureGo releases. However, fixes contributed by external contributors are very welcome and encouraged. + +- **Android**: 386, arm +- **FreeBSD**: amd64, arm64 +- **Linux**: 386, arm, loong64 +- **Windows**: 386*, arm* -`*` These architectures only support SyscallN and NewCallback +`*` These architectures only support `SyscallN` and `NewCallback` ## Example The example below only showcases purego use for macOS and Linux. The other platforms require special handling which can -be seen in the complete example at [examples/libc](https://github.com/ebitengine/purego/tree/main/examples/libc) which supports Windows and FreeBSD. +be seen in the complete example at [examples/libc](https://github.com/ebitengine/purego/tree/main/examples/libc) which supports FreeBSD and Windows. ```go package main @@ -84,6 +98,7 @@ License that can be found [in the Go Source](https://github.com/golang/go/blob/m This is a list of the copied files: * `abi_*.h` from package `runtime/cgo` +* `wincallback.go` from package `runtime` * `zcallback_darwin_*.s` from package `runtime` * `internal/fakecgo/abi_*.h` from package `runtime/cgo` * `internal/fakecgo/asm_GOARCH.s` from package `runtime/cgo` @@ -92,6 +107,7 @@ This is a list of the copied files: * `internal/fakecgo/iscgo.go` from package `runtime/cgo` * `internal/fakecgo/setenv.go` from package `runtime/cgo` * `internal/fakecgo/freebsd.go` from package `runtime/cgo` +* `internal/fakecgo/netbsd.go` from package `runtime/cgo` The files `abi_*.h` and `internal/fakecgo/abi_*.h` are the same because Bazel does not support cross-package use of `#include` so we need each one once per package. (cf. [issue](https://github.com/bazelbuild/rules_go/issues/3636)) diff --git a/vendor/github.com/ebitengine/purego/abi_loong64.h b/vendor/github.com/ebitengine/purego/abi_loong64.h new file mode 100644 index 00000000..b10d8373 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/abi_loong64.h @@ -0,0 +1,60 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Macros for transitioning from the host ABI to Go ABI0. +// +// These macros save and restore the callee-saved registers +// from the stack, but they don't adjust stack pointer, so +// the user should prepare stack space in advance. +// SAVE_R22_TO_R31(offset) saves R22 ~ R31 to the stack space +// of ((offset)+0*8)(R3) ~ ((offset)+9*8)(R3). +// +// SAVE_F24_TO_F31(offset) saves F24 ~ F31 to the stack space +// of ((offset)+0*8)(R3) ~ ((offset)+7*8)(R3). +// +// Note: g is R22 + +#define SAVE_R22_TO_R31(offset) \ + MOVV g, ((offset)+(0*8))(R3) \ + MOVV R23, ((offset)+(1*8))(R3) \ + MOVV R24, ((offset)+(2*8))(R3) \ + MOVV R25, ((offset)+(3*8))(R3) \ + MOVV R26, ((offset)+(4*8))(R3) \ + MOVV R27, ((offset)+(5*8))(R3) \ + MOVV R28, ((offset)+(6*8))(R3) \ + MOVV R29, ((offset)+(7*8))(R3) \ + MOVV R30, ((offset)+(8*8))(R3) \ + MOVV R31, ((offset)+(9*8))(R3) + +#define SAVE_F24_TO_F31(offset) \ + MOVD F24, ((offset)+(0*8))(R3) \ + MOVD F25, ((offset)+(1*8))(R3) \ + MOVD F26, ((offset)+(2*8))(R3) \ + MOVD F27, ((offset)+(3*8))(R3) \ + MOVD F28, ((offset)+(4*8))(R3) \ + MOVD F29, ((offset)+(5*8))(R3) \ + MOVD F30, ((offset)+(6*8))(R3) \ + MOVD F31, ((offset)+(7*8))(R3) + +#define RESTORE_R22_TO_R31(offset) \ + MOVV ((offset)+(0*8))(R3), g \ + MOVV ((offset)+(1*8))(R3), R23 \ + MOVV ((offset)+(2*8))(R3), R24 \ + MOVV ((offset)+(3*8))(R3), R25 \ + MOVV ((offset)+(4*8))(R3), R26 \ + MOVV ((offset)+(5*8))(R3), R27 \ + MOVV ((offset)+(6*8))(R3), R28 \ + MOVV ((offset)+(7*8))(R3), R29 \ + MOVV ((offset)+(8*8))(R3), R30 \ + MOVV ((offset)+(9*8))(R3), R31 + +#define RESTORE_F24_TO_F31(offset) \ + MOVD ((offset)+(0*8))(R3), F24 \ + MOVD ((offset)+(1*8))(R3), F25 \ + MOVD ((offset)+(2*8))(R3), F26 \ + MOVD ((offset)+(3*8))(R3), F27 \ + MOVD ((offset)+(4*8))(R3), F28 \ + MOVD ((offset)+(5*8))(R3), F29 \ + MOVD ((offset)+(6*8))(R3), F30 \ + MOVD ((offset)+(7*8))(R3), F31 diff --git a/vendor/github.com/ebitengine/purego/cgo.go b/vendor/github.com/ebitengine/purego/cgo.go index 7d5abef3..32bb256a 100644 --- a/vendor/github.com/ebitengine/purego/cgo.go +++ b/vendor/github.com/ebitengine/purego/cgo.go @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -//go:build cgo && (darwin || freebsd || linux) +//go:build cgo && (darwin || freebsd || linux || netbsd) package purego diff --git a/vendor/github.com/ebitengine/purego/dlerror.go b/vendor/github.com/ebitengine/purego/dlerror.go index 95cdfe16..ad52b436 100644 --- a/vendor/github.com/ebitengine/purego/dlerror.go +++ b/vendor/github.com/ebitengine/purego/dlerror.go @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2023 The Ebitengine Authors -//go:build darwin || freebsd || linux +//go:build darwin || freebsd || linux || netbsd package purego diff --git a/vendor/github.com/ebitengine/purego/dlfcn.go b/vendor/github.com/ebitengine/purego/dlfcn.go index cd1bf293..2730d82c 100644 --- a/vendor/github.com/ebitengine/purego/dlfcn.go +++ b/vendor/github.com/ebitengine/purego/dlfcn.go @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -//go:build (darwin || freebsd || linux) && !android && !faketime +//go:build (darwin || freebsd || linux || netbsd) && !android && !faketime package purego diff --git a/vendor/github.com/ebitengine/purego/dlfcn_netbsd.go b/vendor/github.com/ebitengine/purego/dlfcn_netbsd.go new file mode 100644 index 00000000..220c7367 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/dlfcn_netbsd.go @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2025 The Ebitengine Authors + +package purego + +// Source for constants: https://github.com/NetBSD/src/blob/trunk/include/dlfcn.h + +const ( + intSize = 32 << (^uint(0) >> 63) // 32 or 64 + RTLD_DEFAULT = 1< 0 { - if variadic, ok := args[len(args)-1].Interface().([]interface{}); ok { - // subtract one from args bc the last argument in args is []interface{} - // which we are currently expanding - tmp := make([]reflect.Value, len(args)-1+len(variadic)) - n := copy(tmp, args[:len(args)-1]) - for i, v := range variadic { - tmp[n+i] = reflect.ValueOf(v) - } - args = tmp - } - } var sysargs [maxArgs]uintptr - stack := sysargs[numOfIntegerRegisters():] - var floats [numOfFloats]uintptr + var floats [numOfFloatRegisters]uintptr var numInts int var numFloats int var numStack int @@ -222,7 +215,7 @@ func RegisterFunc(fptr interface{}, cfn uintptr) { if runtime.GOARCH == "arm64" || runtime.GOOS != "windows" { // Windows arm64 uses the same calling convention as macOS and Linux addStack = func(x uintptr) { - stack[numStack] = x + sysargs[numOfIntegerRegisters()+numStack] = x numStack++ } addInt = func(x uintptr) { @@ -255,15 +248,16 @@ func RegisterFunc(fptr interface{}, cfn uintptr) { addFloat = addStack } - var keepAlive []interface{} + var keepAlive []any defer func() { runtime.KeepAlive(keepAlive) runtime.KeepAlive(args) }() - var syscall syscall15Args + + var arm64_r8 uintptr if ty.NumOut() == 1 && ty.Out(0).Kind() == reflect.Struct { outType := ty.Out(0) - if runtime.GOARCH == "amd64" && outType.Size() > maxRegAllocStructSize { + if (runtime.GOARCH == "amd64" || runtime.GOARCH == "loong64") && outType.Size() > maxRegAllocStructSize { val := reflect.New(outType) keepAlive = append(keepAlive, val) addInt(val.Pointer()) @@ -272,53 +266,73 @@ func RegisterFunc(fptr interface{}, cfn uintptr) { if !isAllFloats || numFields > 4 { val := reflect.New(outType) keepAlive = append(keepAlive, val) - syscall.arm64_r8 = val.Pointer() + arm64_r8 = val.Pointer() } } } - for _, v := range args { - switch v.Kind() { - case reflect.String: - ptr := strings.CString(v.String()) - keepAlive = append(keepAlive, ptr) - addInt(uintptr(unsafe.Pointer(ptr))) - case reflect.Uintptr, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - addInt(uintptr(v.Uint())) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - addInt(uintptr(v.Int())) - case reflect.Ptr, reflect.UnsafePointer, reflect.Slice: - // There is no need to keepAlive this pointer separately because it is kept alive in the args variable - addInt(v.Pointer()) - case reflect.Func: - addInt(NewCallback(v.Interface())) - case reflect.Bool: - if v.Bool() { - addInt(1) - } else { - addInt(0) + for i, v := range args { + if variadic, ok := args[i].Interface().([]any); ok { + if i != len(args)-1 { + panic("purego: can only expand last parameter") } - case reflect.Float32: - addFloat(uintptr(math.Float32bits(float32(v.Float())))) - case reflect.Float64: - addFloat(uintptr(math.Float64bits(v.Float()))) - case reflect.Struct: - keepAlive = addStruct(v, &numInts, &numFloats, &numStack, addInt, addFloat, addStack, keepAlive) - default: - panic("purego: unsupported kind: " + v.Kind().String()) + for _, x := range variadic { + keepAlive = addValue(reflect.ValueOf(x), keepAlive, addInt, addFloat, addStack, &numInts, &numFloats, &numStack) + } + continue + } + if runtime.GOARCH == "arm64" && runtime.GOOS == "darwin" && + (numInts >= numOfIntegerRegisters() || numFloats >= numOfFloatRegisters) && v.Kind() != reflect.Struct { // hit the stack + fields := make([]reflect.StructField, len(args[i:])) + + for j, val := range args[i:] { + if val.Kind() == reflect.String { + ptr := strings.CString(val.String()) + keepAlive = append(keepAlive, ptr) + val = reflect.ValueOf(ptr) + args[i+j] = val + } + fields[j] = reflect.StructField{ + Name: "X" + strconv.Itoa(j), + Type: val.Type(), + } + } + structType := reflect.StructOf(fields) + structInstance := reflect.New(structType).Elem() + for j, val := range args[i:] { + structInstance.Field(j).Set(val) + } + placeRegisters(structInstance, addFloat, addInt) + break } + keepAlive = addValue(v, keepAlive, addInt, addFloat, addStack, &numInts, &numFloats, &numStack) } - if runtime.GOARCH == "arm64" || runtime.GOOS != "windows" { + + syscall := thePool.Get().(*syscall15Args) + defer thePool.Put(syscall) + + if runtime.GOARCH == "loong64" { + *syscall = syscall15Args{ + cfn, + sysargs[0], sysargs[1], sysargs[2], sysargs[3], sysargs[4], sysargs[5], + sysargs[6], sysargs[7], sysargs[8], sysargs[9], sysargs[10], sysargs[11], + sysargs[12], sysargs[13], sysargs[14], + floats[0], floats[1], floats[2], floats[3], floats[4], floats[5], floats[6], floats[7], + 0, + } + runtime_cgocall(syscall15XABI0, unsafe.Pointer(syscall)) + } else if runtime.GOARCH == "arm64" || runtime.GOOS != "windows" { // Use the normal arm64 calling convention even on Windows - syscall = syscall15Args{ + *syscall = syscall15Args{ cfn, sysargs[0], sysargs[1], sysargs[2], sysargs[3], sysargs[4], sysargs[5], sysargs[6], sysargs[7], sysargs[8], sysargs[9], sysargs[10], sysargs[11], sysargs[12], sysargs[13], sysargs[14], floats[0], floats[1], floats[2], floats[3], floats[4], floats[5], floats[6], floats[7], - syscall.arm64_r8, + arm64_r8, } - runtime_cgocall(syscall15XABI0, unsafe.Pointer(&syscall)) + runtime_cgocall(syscall15XABI0, unsafe.Pointer(syscall)) } else { + *syscall = syscall15Args{} // This is a fallback for Windows amd64, 386, and arm. Note this may not support floats syscall.a1, syscall.a2, _ = syscall_syscall15X(cfn, sysargs[0], sysargs[1], sysargs[2], sysargs[3], sysargs[4], sysargs[5], sysargs[6], sysargs[7], sysargs[8], sysargs[9], sysargs[10], sysargs[11], @@ -357,15 +371,54 @@ func RegisterFunc(fptr interface{}, cfn uintptr) { // On 32bit platforms syscall.r2 is the upper part of a 64bit return. v.SetFloat(math.Float64frombits(uint64(syscall.f1))) case reflect.Struct: - v = getStruct(outType, syscall) + v = getStruct(outType, *syscall) default: panic("purego: unsupported return kind: " + outType.Kind().String()) } - return []reflect.Value{v} + if len(args) > 0 { + // reuse args slice instead of allocating one when possible + args[0] = v + return args[:1] + } else { + return []reflect.Value{v} + } }) fn.Set(v) } +func addValue(v reflect.Value, keepAlive []any, addInt func(x uintptr), addFloat func(x uintptr), addStack func(x uintptr), numInts *int, numFloats *int, numStack *int) []any { + switch v.Kind() { + case reflect.String: + ptr := strings.CString(v.String()) + keepAlive = append(keepAlive, ptr) + addInt(uintptr(unsafe.Pointer(ptr))) + case reflect.Uintptr, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + addInt(uintptr(v.Uint())) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + addInt(uintptr(v.Int())) + case reflect.Ptr, reflect.UnsafePointer, reflect.Slice: + // There is no need to keepAlive this pointer separately because it is kept alive in the args variable + addInt(v.Pointer()) + case reflect.Func: + addInt(NewCallback(v.Interface())) + case reflect.Bool: + if v.Bool() { + addInt(1) + } else { + addInt(0) + } + case reflect.Float32: + addFloat(uintptr(math.Float32bits(float32(v.Float())))) + case reflect.Float64: + addFloat(uintptr(math.Float64bits(v.Float()))) + case reflect.Struct: + keepAlive = addStruct(v, numInts, numFloats, numStack, addInt, addFloat, addStack, keepAlive) + default: + panic("purego: unsupported kind: " + v.Kind().String()) + } + return keepAlive +} + // maxRegAllocStructSize is the biggest a struct can be while still fitting in registers. // if it is bigger than this than enough space must be allocated on the heap and then passed into // the function as the first parameter on amd64 or in R8 on arm64. @@ -424,7 +477,7 @@ func roundUpTo8(val uintptr) uintptr { func numOfIntegerRegisters() int { switch runtime.GOARCH { - case "arm64": + case "arm64", "loong64": return 8 case "amd64": return 6 diff --git a/vendor/github.com/ebitengine/purego/gen.go b/vendor/github.com/ebitengine/purego/gen.go new file mode 100644 index 00000000..9cb7c453 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/gen.go @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2025 The Ebitengine Authors + +package purego + +//go:generate go run wincallback.go diff --git a/vendor/github.com/ebitengine/purego/go_runtime.go b/vendor/github.com/ebitengine/purego/go_runtime.go index 13671ff2..b327f786 100644 --- a/vendor/github.com/ebitengine/purego/go_runtime.go +++ b/vendor/github.com/ebitengine/purego/go_runtime.go @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -//go:build darwin || freebsd || linux || windows +//go:build darwin || freebsd || linux || netbsd || windows package purego diff --git a/vendor/github.com/ebitengine/purego/internal/cgo/dlfcn_cgo_unix.go b/vendor/github.com/ebitengine/purego/internal/cgo/dlfcn_cgo_unix.go index b09ecac1..6d0571ab 100644 --- a/vendor/github.com/ebitengine/purego/internal/cgo/dlfcn_cgo_unix.go +++ b/vendor/github.com/ebitengine/purego/internal/cgo/dlfcn_cgo_unix.go @@ -1,12 +1,12 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2024 The Ebitengine Authors -//go:build freebsd || linux +//go:build freebsd || linux || netbsd package cgo /* - #cgo LDFLAGS: -ldl +#cgo !netbsd LDFLAGS: -ldl #include #include diff --git a/vendor/github.com/ebitengine/purego/internal/cgo/syscall_cgo_unix.go b/vendor/github.com/ebitengine/purego/internal/cgo/syscall_cgo_unix.go index 37ff24d5..10393fec 100644 --- a/vendor/github.com/ebitengine/purego/internal/cgo/syscall_cgo_unix.go +++ b/vendor/github.com/ebitengine/purego/internal/cgo/syscall_cgo_unix.go @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -//go:build freebsd || (linux && !(arm64 || amd64)) +//go:build freebsd || (linux && !(arm64 || amd64 || loong64)) || netbsd package cgo @@ -9,7 +9,7 @@ package cgo // because Cgo and assembly files can't be in the same package. /* - #cgo LDFLAGS: -ldl +#cgo !netbsd LDFLAGS: -ldl #include #include diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/abi_loong64.h b/vendor/github.com/ebitengine/purego/internal/fakecgo/abi_loong64.h new file mode 100644 index 00000000..b10d8373 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/abi_loong64.h @@ -0,0 +1,60 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Macros for transitioning from the host ABI to Go ABI0. +// +// These macros save and restore the callee-saved registers +// from the stack, but they don't adjust stack pointer, so +// the user should prepare stack space in advance. +// SAVE_R22_TO_R31(offset) saves R22 ~ R31 to the stack space +// of ((offset)+0*8)(R3) ~ ((offset)+9*8)(R3). +// +// SAVE_F24_TO_F31(offset) saves F24 ~ F31 to the stack space +// of ((offset)+0*8)(R3) ~ ((offset)+7*8)(R3). +// +// Note: g is R22 + +#define SAVE_R22_TO_R31(offset) \ + MOVV g, ((offset)+(0*8))(R3) \ + MOVV R23, ((offset)+(1*8))(R3) \ + MOVV R24, ((offset)+(2*8))(R3) \ + MOVV R25, ((offset)+(3*8))(R3) \ + MOVV R26, ((offset)+(4*8))(R3) \ + MOVV R27, ((offset)+(5*8))(R3) \ + MOVV R28, ((offset)+(6*8))(R3) \ + MOVV R29, ((offset)+(7*8))(R3) \ + MOVV R30, ((offset)+(8*8))(R3) \ + MOVV R31, ((offset)+(9*8))(R3) + +#define SAVE_F24_TO_F31(offset) \ + MOVD F24, ((offset)+(0*8))(R3) \ + MOVD F25, ((offset)+(1*8))(R3) \ + MOVD F26, ((offset)+(2*8))(R3) \ + MOVD F27, ((offset)+(3*8))(R3) \ + MOVD F28, ((offset)+(4*8))(R3) \ + MOVD F29, ((offset)+(5*8))(R3) \ + MOVD F30, ((offset)+(6*8))(R3) \ + MOVD F31, ((offset)+(7*8))(R3) + +#define RESTORE_R22_TO_R31(offset) \ + MOVV ((offset)+(0*8))(R3), g \ + MOVV ((offset)+(1*8))(R3), R23 \ + MOVV ((offset)+(2*8))(R3), R24 \ + MOVV ((offset)+(3*8))(R3), R25 \ + MOVV ((offset)+(4*8))(R3), R26 \ + MOVV ((offset)+(5*8))(R3), R27 \ + MOVV ((offset)+(6*8))(R3), R28 \ + MOVV ((offset)+(7*8))(R3), R29 \ + MOVV ((offset)+(8*8))(R3), R30 \ + MOVV ((offset)+(9*8))(R3), R31 + +#define RESTORE_F24_TO_F31(offset) \ + MOVD ((offset)+(0*8))(R3), F24 \ + MOVD ((offset)+(1*8))(R3), F25 \ + MOVD ((offset)+(2*8))(R3), F26 \ + MOVD ((offset)+(3*8))(R3), F27 \ + MOVD ((offset)+(4*8))(R3), F28 \ + MOVD ((offset)+(5*8))(R3), F29 \ + MOVD ((offset)+(6*8))(R3), F30 \ + MOVD ((offset)+(7*8))(R3), F31 diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_loong64.s b/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_loong64.s new file mode 100644 index 00000000..aea4f8e6 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_loong64.s @@ -0,0 +1,40 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "textflag.h" +#include "abi_loong64.h" + +// Called by C code generated by cmd/cgo. +// func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr) +// Saves C callee-saved registers and calls cgocallback with three arguments. +// fn is the PC of a func(a unsafe.Pointer) function. +TEXT crosscall2(SB),NOSPLIT|NOFRAME,$0 + /* + * We still need to save all callee save register as before, and then + * push 3 args for fn (R4, R5, R7), skipping R6. + * Also note that at procedure entry in gc world, 8(R29) will be the + * first arg. + */ + + ADDV $(-23*8), R3 + MOVV R4, (1*8)(R3) // fn unsafe.Pointer + MOVV R5, (2*8)(R3) // a unsafe.Pointer + MOVV R7, (3*8)(R3) // ctxt uintptr + + SAVE_R22_TO_R31((4*8)) + SAVE_F24_TO_F31((14*8)) + MOVV R1, (22*8)(R3) + + // Initialize Go ABI environment + JAL runtime·load_g(SB) + + JAL runtime·cgocallback(SB) + + RESTORE_R22_TO_R31((4*8)) + RESTORE_F24_TO_F31((14*8)) + MOVV (22*8)(R3), R1 + + ADDV $(23*8), R3 + + RET diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/callbacks.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/callbacks.go index f29e690c..27d4c98c 100644 --- a/vendor/github.com/ebitengine/purego/internal/fakecgo/callbacks.go +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/callbacks.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !cgo && (darwin || freebsd || linux) +//go:build !cgo && (darwin || freebsd || linux || netbsd) package fakecgo diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/doc.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/doc.go index be82f7df..e482c120 100644 --- a/vendor/github.com/ebitengine/purego/internal/fakecgo/doc.go +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/doc.go @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -//go:build !cgo && (darwin || freebsd || linux) +//go:build !cgo && (darwin || freebsd || linux || netbsd) // Package fakecgo implements the Cgo runtime (runtime/cgo) entirely in Go. // This allows code that calls into C to function properly when CGO_ENABLED=0. diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/go_libinit.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_libinit.go index e5a66f39..0c463066 100644 --- a/vendor/github.com/ebitengine/purego/internal/fakecgo/go_libinit.go +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_libinit.go @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -//go:build !cgo && (darwin || freebsd || linux) +//go:build !cgo && (darwin || freebsd || linux || netbsd) package fakecgo diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/go_linux_loong64.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_linux_loong64.go new file mode 100644 index 00000000..65293914 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_linux_loong64.go @@ -0,0 +1,92 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !cgo + +package fakecgo + +import "unsafe" + +//go:nosplit +func _cgo_sys_thread_start(ts *ThreadStart) { + var attr pthread_attr_t + var ign, oset sigset_t + var p pthread_t + var size size_t + var err int + + sigfillset(&ign) + pthread_sigmask(SIG_SETMASK, &ign, &oset) + + pthread_attr_init(&attr) + pthread_attr_getstacksize(&attr, &size) + // Leave stacklo=0 and set stackhi=size; mstart will do the rest. + ts.g.stackhi = uintptr(size) + + err = _cgo_try_pthread_create(&p, &attr, unsafe.Pointer(threadentry_trampolineABI0), ts) + + pthread_sigmask(SIG_SETMASK, &oset, nil) + + if err != 0 { + print("fakecgo: pthread_create failed: ") + println(err) + abort() + } +} + +// threadentry_trampolineABI0 maps the C ABI to Go ABI then calls the Go function +// +//go:linkname x_threadentry_trampoline threadentry_trampoline +var x_threadentry_trampoline byte +var threadentry_trampolineABI0 = &x_threadentry_trampoline + +//go:nosplit +func threadentry(v unsafe.Pointer) unsafe.Pointer { + ts := *(*ThreadStart)(v) + free(v) + + setg_trampoline(setg_func, uintptr(unsafe.Pointer(ts.g))) + + // faking funcs in go is a bit a... involved - but the following works :) + fn := uintptr(unsafe.Pointer(&ts.fn)) + (*(*func())(unsafe.Pointer(&fn)))() + + return nil +} + +// here we will store a pointer to the provided setg func +var setg_func uintptr + +//go:nosplit +func x_cgo_init(g *G, setg uintptr) { + var size size_t + var attr *pthread_attr_t + + /* The memory sanitizer distributed with versions of clang + before 3.8 has a bug: if you call mmap before malloc, mmap + may return an address that is later overwritten by the msan + library. Avoid this problem by forcing a call to malloc + here, before we ever call malloc. + + This is only required for the memory sanitizer, so it's + unfortunate that we always run it. It should be possible + to remove this when we no longer care about versions of + clang before 3.8. The test for this is + misc/cgo/testsanitizers. + + GCC works hard to eliminate a seemingly unnecessary call to + malloc, so we actually use the memory we allocate. */ + + setg_func = setg + attr = (*pthread_attr_t)(malloc(unsafe.Sizeof(*attr))) + if attr == nil { + println("fakecgo: malloc failed") + abort() + } + pthread_attr_init(attr) + pthread_attr_getstacksize(attr, &size) + g.stacklo = uintptr(unsafe.Pointer(&size)) - uintptr(size) + 4096 + pthread_attr_destroy(attr) + free(unsafe.Pointer(attr)) +} diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/go_netbsd.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_netbsd.go new file mode 100644 index 00000000..935a334f --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_netbsd.go @@ -0,0 +1,106 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !cgo && (amd64 || arm64) + +package fakecgo + +import "unsafe" + +//go:nosplit +func _cgo_sys_thread_start(ts *ThreadStart) { + var attr pthread_attr_t + var ign, oset sigset_t + var p pthread_t + var size size_t + var err int + + // fprintf(stderr, "runtime/cgo: _cgo_sys_thread_start: fn=%p, g=%p\n", ts->fn, ts->g); // debug + sigfillset(&ign) + pthread_sigmask(SIG_SETMASK, &ign, &oset) + + pthread_attr_init(&attr) + pthread_attr_getstacksize(&attr, &size) + // Leave stacklo=0 and set stackhi=size; mstart will do the rest. + ts.g.stackhi = uintptr(size) + + err = _cgo_try_pthread_create(&p, &attr, unsafe.Pointer(threadentry_trampolineABI0), ts) + + pthread_sigmask(SIG_SETMASK, &oset, nil) + + if err != 0 { + print("fakecgo: pthread_create failed: ") + println(err) + abort() + } +} + +// threadentry_trampolineABI0 maps the C ABI to Go ABI then calls the Go function +// +//go:linkname x_threadentry_trampoline threadentry_trampoline +var x_threadentry_trampoline byte +var threadentry_trampolineABI0 = &x_threadentry_trampoline + +//go:nosplit +func threadentry(v unsafe.Pointer) unsafe.Pointer { + var ss stack_t + ts := *(*ThreadStart)(v) + free(v) + + // On NetBSD, a new thread inherits the signal stack of the + // creating thread. That confuses minit, so we remove that + // signal stack here before calling the regular mstart. It's + // a bit baroque to remove a signal stack here only to add one + // in minit, but it's a simple change that keeps NetBSD + // working like other OS's. At this point all signals are + // blocked, so there is no race. + ss.ss_flags = SS_DISABLE + sigaltstack(&ss, nil) + + setg_trampoline(setg_func, uintptr(unsafe.Pointer(ts.g))) + + // faking funcs in go is a bit a... involved - but the following works :) + fn := uintptr(unsafe.Pointer(&ts.fn)) + (*(*func())(unsafe.Pointer(&fn)))() + + return nil +} + +// here we will store a pointer to the provided setg func +var setg_func uintptr + +//go:nosplit +func x_cgo_init(g *G, setg uintptr) { + var size size_t + var attr *pthread_attr_t + + /* The memory sanitizer distributed with versions of clang + before 3.8 has a bug: if you call mmap before malloc, mmap + may return an address that is later overwritten by the msan + library. Avoid this problem by forcing a call to malloc + here, before we ever call malloc. + + This is only required for the memory sanitizer, so it's + unfortunate that we always run it. It should be possible + to remove this when we no longer care about versions of + clang before 3.8. The test for this is + misc/cgo/testsanitizers. + + GCC works hard to eliminate a seemingly unnecessary call to + malloc, so we actually use the memory we allocate. */ + + setg_func = setg + attr = (*pthread_attr_t)(malloc(unsafe.Sizeof(*attr))) + if attr == nil { + println("fakecgo: malloc failed") + abort() + } + pthread_attr_init(attr) + pthread_attr_getstacksize(attr, &size) + // runtime/cgo uses __builtin_frame_address(0) instead of `uintptr(unsafe.Pointer(&size))` + // but this should be OK since we are taking the address of the first variable in this function. + g.stacklo = uintptr(unsafe.Pointer(&size)) - uintptr(size) + 4096 + pthread_attr_destroy(attr) + free(unsafe.Pointer(attr)) +} diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/go_setenv.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_setenv.go index e42d84f0..dfc6629e 100644 --- a/vendor/github.com/ebitengine/purego/internal/fakecgo/go_setenv.go +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_setenv.go @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -//go:build !cgo && (darwin || freebsd || linux) +//go:build !cgo && (darwin || freebsd || linux || netbsd) package fakecgo diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/go_util.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_util.go index 0ac10d1f..771cb525 100644 --- a/vendor/github.com/ebitengine/purego/internal/fakecgo/go_util.go +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/go_util.go @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -//go:build !cgo && (darwin || freebsd || linux) +//go:build !cgo && (darwin || freebsd || linux || netbsd) package fakecgo diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/iscgo.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/iscgo.go index 28af41cc..12e52147 100644 --- a/vendor/github.com/ebitengine/purego/internal/fakecgo/iscgo.go +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/iscgo.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !cgo && (darwin || freebsd || linux) +//go:build !cgo && (darwin || freebsd || linux || netbsd) // The runtime package contains an uninitialized definition // for runtime·iscgo. Override it to tell the runtime we're here. diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo.go index 38f94419..94fd8bea 100644 --- a/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo.go +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo.go @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -//go:build !cgo && (darwin || freebsd || linux) +//go:build !cgo && (darwin || freebsd || linux || netbsd) package fakecgo diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_darwin.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_darwin.go index af148333..ecdcb2e7 100644 --- a/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_darwin.go +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_darwin.go @@ -20,3 +20,7 @@ var ( PTHREAD_COND_INITIALIZER = pthread_cond_t{sig: 0x3CB0B1BB} PTHREAD_MUTEX_INITIALIZER = pthread_mutex_t{sig: 0x32AAABA7} ) + +type stack_t struct { + /* not implemented */ +} diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_freebsd.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_freebsd.go index ca1f722c..4bfb70c3 100644 --- a/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_freebsd.go +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_freebsd.go @@ -14,3 +14,7 @@ var ( PTHREAD_COND_INITIALIZER = pthread_cond_t(0) PTHREAD_MUTEX_INITIALIZER = pthread_mutex_t(0) ) + +type stack_t struct { + /* not implemented */ +} diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_linux.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_linux.go index c4b6e9ea..b08a44a1 100644 --- a/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_linux.go +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_linux.go @@ -14,3 +14,7 @@ var ( PTHREAD_COND_INITIALIZER = pthread_cond_t{} PTHREAD_MUTEX_INITIALIZER = pthread_mutex_t{} ) + +type stack_t struct { + /* not implemented */ +} diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_netbsd.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_netbsd.go new file mode 100644 index 00000000..650f6953 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_netbsd.go @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2025 The Ebitengine Authors + +//go:build !cgo + +package fakecgo + +type ( + pthread_cond_t uintptr + pthread_mutex_t uintptr +) + +var ( + PTHREAD_COND_INITIALIZER = pthread_cond_t(0) + PTHREAD_MUTEX_INITIALIZER = pthread_mutex_t(0) +) + +// Source: https://github.com/NetBSD/src/blob/613e27c65223fd2283b6ed679da1197e12f50e27/sys/compat/linux/arch/m68k/linux_signal.h#L133 +type stack_t struct { + ss_sp uintptr + ss_flags int32 + ss_size uintptr +} + +// Source: https://github.com/NetBSD/src/blob/613e27c65223fd2283b6ed679da1197e12f50e27/sys/sys/signal.h#L261 +const SS_DISABLE = 0x004 diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/netbsd.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/netbsd.go new file mode 100644 index 00000000..2d499814 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/netbsd.go @@ -0,0 +1,23 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build netbsd + +package fakecgo + +import _ "unsafe" // for go:linkname + +// Supply environ and __progname, because we don't +// link against the standard NetBSD crt0.o and the +// libc dynamic library needs them. + +//go:linkname _environ environ +//go:linkname _progname __progname +//go:linkname ___ps_strings __ps_strings + +var ( + _environ uintptr + _progname uintptr + ___ps_strings uintptr +) diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/setenv.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/setenv.go index f30af0e1..82308b8c 100644 --- a/vendor/github.com/ebitengine/purego/internal/fakecgo/setenv.go +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/setenv.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !cgo && (darwin || freebsd || linux) +//go:build !cgo && (darwin || freebsd || linux || netbsd) package fakecgo diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols.go index d5170240..135f6d21 100644 --- a/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols.go +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols.go @@ -3,7 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -//go:build !cgo && (darwin || freebsd || linux) +//go:build !cgo && (darwin || freebsd || linux || netbsd) package fakecgo @@ -62,6 +62,12 @@ func abort() { call5(abortABI0, 0, 0, 0, 0, 0) } +//go:nosplit +//go:norace +func sigaltstack(ss *stack_t, old_ss *stack_t) int32 { + return int32(call5(sigaltstackABI0, uintptr(unsafe.Pointer(ss)), uintptr(unsafe.Pointer(old_ss)), 0, 0, 0)) +} + //go:nosplit //go:norace func pthread_attr_init(attr *pthread_attr_t) int32 { @@ -168,6 +174,10 @@ var nanosleepABI0 = uintptr(unsafe.Pointer(&_nanosleep)) var _abort uint8 var abortABI0 = uintptr(unsafe.Pointer(&_abort)) +//go:linkname _sigaltstack _sigaltstack +var _sigaltstack uint8 +var sigaltstackABI0 = uintptr(unsafe.Pointer(&_sigaltstack)) + //go:linkname _pthread_attr_init _pthread_attr_init var _pthread_attr_init uint8 var pthread_attr_initABI0 = uintptr(unsafe.Pointer(&_pthread_attr_init)) diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_darwin.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_darwin.go index 54aaa462..8c4489f0 100644 --- a/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_darwin.go +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_darwin.go @@ -14,6 +14,7 @@ package fakecgo //go:cgo_import_dynamic purego_sigfillset sigfillset "/usr/lib/libSystem.B.dylib" //go:cgo_import_dynamic purego_nanosleep nanosleep "/usr/lib/libSystem.B.dylib" //go:cgo_import_dynamic purego_abort abort "/usr/lib/libSystem.B.dylib" +//go:cgo_import_dynamic purego_sigaltstack sigaltstack "/usr/lib/libSystem.B.dylib" //go:cgo_import_dynamic purego_pthread_attr_init pthread_attr_init "/usr/lib/libSystem.B.dylib" //go:cgo_import_dynamic purego_pthread_create pthread_create "/usr/lib/libSystem.B.dylib" //go:cgo_import_dynamic purego_pthread_detach pthread_detach "/usr/lib/libSystem.B.dylib" diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_freebsd.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_freebsd.go index 81538119..bbe1bd57 100644 --- a/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_freebsd.go +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_freebsd.go @@ -14,6 +14,7 @@ package fakecgo //go:cgo_import_dynamic purego_sigfillset sigfillset "libc.so.7" //go:cgo_import_dynamic purego_nanosleep nanosleep "libc.so.7" //go:cgo_import_dynamic purego_abort abort "libc.so.7" +//go:cgo_import_dynamic purego_sigaltstack sigaltstack "libc.so.7" //go:cgo_import_dynamic purego_pthread_attr_init pthread_attr_init "libpthread.so" //go:cgo_import_dynamic purego_pthread_create pthread_create "libpthread.so" //go:cgo_import_dynamic purego_pthread_detach pthread_detach "libpthread.so" diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_linux.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_linux.go index 180057d0..21652650 100644 --- a/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_linux.go +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_linux.go @@ -14,6 +14,7 @@ package fakecgo //go:cgo_import_dynamic purego_sigfillset sigfillset "libc.so.6" //go:cgo_import_dynamic purego_nanosleep nanosleep "libc.so.6" //go:cgo_import_dynamic purego_abort abort "libc.so.6" +//go:cgo_import_dynamic purego_sigaltstack sigaltstack "libc.so.6" //go:cgo_import_dynamic purego_pthread_attr_init pthread_attr_init "libpthread.so.0" //go:cgo_import_dynamic purego_pthread_create pthread_create "libpthread.so.0" //go:cgo_import_dynamic purego_pthread_detach pthread_detach "libpthread.so.0" diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_netbsd.go b/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_netbsd.go new file mode 100644 index 00000000..7c92bb0b --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_netbsd.go @@ -0,0 +1,30 @@ +// Code generated by 'go generate' with gen.go. DO NOT EDIT. + +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 The Ebitengine Authors + +//go:build !cgo + +package fakecgo + +//go:cgo_import_dynamic purego_malloc malloc "libc.so" +//go:cgo_import_dynamic purego_free free "libc.so" +//go:cgo_import_dynamic purego_setenv setenv "libc.so" +//go:cgo_import_dynamic purego_unsetenv unsetenv "libc.so" +//go:cgo_import_dynamic purego_sigfillset sigfillset "libc.so" +//go:cgo_import_dynamic purego_nanosleep nanosleep "libc.so" +//go:cgo_import_dynamic purego_abort abort "libc.so" +//go:cgo_import_dynamic purego_sigaltstack sigaltstack "libc.so" +//go:cgo_import_dynamic purego_pthread_attr_init pthread_attr_init "libpthread.so" +//go:cgo_import_dynamic purego_pthread_create pthread_create "libpthread.so" +//go:cgo_import_dynamic purego_pthread_detach pthread_detach "libpthread.so" +//go:cgo_import_dynamic purego_pthread_sigmask pthread_sigmask "libpthread.so" +//go:cgo_import_dynamic purego_pthread_self pthread_self "libpthread.so" +//go:cgo_import_dynamic purego_pthread_get_stacksize_np pthread_get_stacksize_np "libpthread.so" +//go:cgo_import_dynamic purego_pthread_attr_getstacksize pthread_attr_getstacksize "libpthread.so" +//go:cgo_import_dynamic purego_pthread_attr_setstacksize pthread_attr_setstacksize "libpthread.so" +//go:cgo_import_dynamic purego_pthread_attr_destroy pthread_attr_destroy "libpthread.so" +//go:cgo_import_dynamic purego_pthread_mutex_lock pthread_mutex_lock "libpthread.so" +//go:cgo_import_dynamic purego_pthread_mutex_unlock pthread_mutex_unlock "libpthread.so" +//go:cgo_import_dynamic purego_pthread_cond_broadcast pthread_cond_broadcast "libpthread.so" +//go:cgo_import_dynamic purego_pthread_setspecific pthread_setspecific "libpthread.so" diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_loong64.s b/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_loong64.s new file mode 100644 index 00000000..15b33543 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_loong64.s @@ -0,0 +1,71 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2025 The Ebitengine Authors + +//go:build !cgo && linux + +#include "textflag.h" +#include "go_asm.h" + +// these trampolines map the gcc ABI to Go ABI and then calls into the Go equivalent functions. + +TEXT x_cgo_init_trampoline(SB), NOSPLIT, $16 + MOVV R4, 8(R3) + MOVV R5, 16(R3) + MOVV ·x_cgo_init_call(SB), R6 + MOVV (R6), R7 + CALL (R7) + RET + +TEXT x_cgo_thread_start_trampoline(SB), NOSPLIT, $8 + MOVV R4, 8(R3) + MOVV ·x_cgo_thread_start_call(SB), R5 + MOVV (R5), R6 + CALL (R6) + RET + +TEXT x_cgo_setenv_trampoline(SB), NOSPLIT, $8 + MOVV R4, 8(R3) + MOVV ·x_cgo_setenv_call(SB), R5 + MOVV (R5), R6 + CALL (R6) + RET + +TEXT x_cgo_unsetenv_trampoline(SB), NOSPLIT, $8 + MOVV R4, 8(R3) + MOVV ·x_cgo_unsetenv_call(SB), R5 + MOVV (R5), R6 + CALL (R6) + RET + +TEXT x_cgo_notify_runtime_init_done_trampoline(SB), NOSPLIT, $0 + CALL ·x_cgo_notify_runtime_init_done(SB) + RET + +TEXT x_cgo_bindm_trampoline(SB), NOSPLIT, $0 + CALL ·x_cgo_bindm(SB) + RET + +// func setg_trampoline(setg uintptr, g uintptr) +TEXT ·setg_trampoline(SB), NOSPLIT, $0 + MOVV G+8(FP), R4 + MOVV setg+0(FP), R5 + CALL (R5) + RET + +TEXT threadentry_trampoline(SB), NOSPLIT, $16 + MOVV R4, 8(R3) + MOVV ·threadentry_call(SB), R5 + MOVV (R5), R6 + CALL (R6) + RET + +TEXT ·call5(SB), NOSPLIT, $0-0 + MOVV fn+0(FP), R9 + MOVV a1+8(FP), R4 + MOVV a2+16(FP), R5 + MOVV a3+24(FP), R6 + MOVV a4+32(FP), R7 + MOVV a5+40(FP), R8 + CALL (R9) + MOVV R4, ret+48(FP) + RET diff --git a/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_stubs.s b/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_stubs.s index a65b2012..c93d783d 100644 --- a/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_stubs.s +++ b/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_stubs.s @@ -3,7 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -//go:build !cgo && (darwin || freebsd || linux) +//go:build !cgo && (darwin || freebsd || linux || netbsd) #include "textflag.h" @@ -37,6 +37,10 @@ TEXT _abort(SB), NOSPLIT|NOFRAME, $0-0 JMP purego_abort(SB) RET +TEXT _sigaltstack(SB), NOSPLIT|NOFRAME, $0-0 + JMP purego_sigaltstack(SB) + RET + TEXT _pthread_attr_init(SB), NOSPLIT|NOFRAME, $0-0 JMP purego_pthread_attr_init(SB) RET diff --git a/vendor/github.com/ebitengine/purego/nocgo.go b/vendor/github.com/ebitengine/purego/nocgo.go index 5b989ea8..b91b9796 100644 --- a/vendor/github.com/ebitengine/purego/nocgo.go +++ b/vendor/github.com/ebitengine/purego/nocgo.go @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -//go:build !cgo && (darwin || freebsd || linux) +//go:build !cgo && (darwin || freebsd || linux || netbsd) package purego diff --git a/vendor/github.com/ebitengine/purego/struct_amd64.go b/vendor/github.com/ebitengine/purego/struct_amd64.go index f3514c98..c4c2ad8f 100644 --- a/vendor/github.com/ebitengine/purego/struct_amd64.go +++ b/vendor/github.com/ebitengine/purego/struct_amd64.go @@ -85,7 +85,7 @@ const ( _MEMORY = 0b1111 ) -func addStruct(v reflect.Value, numInts, numFloats, numStack *int, addInt, addFloat, addStack func(uintptr), keepAlive []interface{}) []interface{} { +func addStruct(v reflect.Value, numInts, numFloats, numStack *int, addInt, addFloat, addStack func(uintptr), keepAlive []any) []any { if v.Type().Size() == 0 { return keepAlive } @@ -120,7 +120,7 @@ func postMerger(t reflect.Type) (passInMemory bool) { if t.Size() <= 2*8 { return false } - return true // Go does not have an SSE/SEEUP type so this is always true + return true // Go does not have an SSE/SSEUP type so this is always true } func tryPlaceRegister(v reflect.Value, addFloat func(uintptr), addInt func(uintptr)) (ok bool) { @@ -165,7 +165,7 @@ func tryPlaceRegister(v reflect.Value, addFloat func(uintptr), addInt func(uintp place(f) case reflect.Bool: if f.Bool() { - val |= 1 + val |= 1 << shift } shift += 8 class |= _INTEGER @@ -200,7 +200,7 @@ func tryPlaceRegister(v reflect.Value, addFloat func(uintptr), addInt func(uintp val |= f.Uint() << shift shift += 32 class |= _INTEGER - case reflect.Uint64, reflect.Uint: + case reflect.Uint64, reflect.Uint, reflect.Uintptr: val = f.Uint() shift = 64 class = _INTEGER @@ -245,7 +245,7 @@ func placeStack(v reflect.Value, addStack func(uintptr)) { addStack(f.Pointer()) case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: addStack(uintptr(f.Int())) - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: addStack(uintptr(f.Uint())) case reflect.Float32: addStack(uintptr(math.Float32bits(float32(f.Float())))) @@ -258,3 +258,7 @@ func placeStack(v reflect.Value, addStack func(uintptr)) { } } } + +func placeRegisters(v reflect.Value, addFloat func(uintptr), addInt func(uintptr)) { + panic("purego: not needed on amd64") +} diff --git a/vendor/github.com/ebitengine/purego/struct_arm64.go b/vendor/github.com/ebitengine/purego/struct_arm64.go index 11c36bd6..8605e77b 100644 --- a/vendor/github.com/ebitengine/purego/struct_arm64.go +++ b/vendor/github.com/ebitengine/purego/struct_arm64.go @@ -65,7 +65,7 @@ const ( _INT = 0b11 ) -func addStruct(v reflect.Value, numInts, numFloats, numStack *int, addInt, addFloat, addStack func(uintptr), keepAlive []interface{}) []interface{} { +func addStruct(v reflect.Value, numInts, numFloats, numStack *int, addInt, addFloat, addStack func(uintptr), keepAlive []any) []any { if v.Type().Size() == 0 { return keepAlive } @@ -73,8 +73,8 @@ func addStruct(v reflect.Value, numInts, numFloats, numStack *int, addInt, addFl if hva, hfa, size := isHVA(v.Type()), isHFA(v.Type()), v.Type().Size(); hva || hfa || size <= 16 { // if this doesn't fit entirely in registers then // each element goes onto the stack - if hfa && *numFloats+v.NumField() > numOfFloats { - *numFloats = numOfFloats + if hfa && *numFloats+v.NumField() > numOfFloatRegisters { + *numFloats = numOfFloatRegisters } else if hva && *numInts+v.NumField() > numOfIntegerRegisters() { *numInts = numOfIntegerRegisters() } @@ -107,6 +107,8 @@ func placeRegisters(v reflect.Value, addFloat func(uintptr), addInt func(uintptr } else { f = v.Index(k) } + align := byte(f.Type().Align()*8 - 1) + shift = (shift + align) &^ align if shift >= 64 { shift = 0 flushed = true @@ -115,13 +117,15 @@ func placeRegisters(v reflect.Value, addFloat func(uintptr), addInt func(uintptr } else { addInt(uintptr(val)) } + val = 0 + class = _NO_CLASS } switch f.Type().Kind() { case reflect.Struct: place(f) case reflect.Bool: if f.Bool() { - val |= 1 + val |= 1 << shift } shift += 8 class |= _INT @@ -137,10 +141,11 @@ func placeRegisters(v reflect.Value, addFloat func(uintptr), addInt func(uintptr val |= f.Uint() << shift shift += 32 class |= _INT - case reflect.Uint64: + case reflect.Uint64, reflect.Uint, reflect.Uintptr: addInt(uintptr(f.Uint())) shift = 0 flushed = true + class = _NO_CLASS case reflect.Int8: val |= uint64(f.Int()&0xFF) << shift shift += 8 @@ -153,10 +158,11 @@ func placeRegisters(v reflect.Value, addFloat func(uintptr), addInt func(uintptr val |= uint64(f.Int()&0xFFFF_FFFF) << shift shift += 32 class |= _INT - case reflect.Int64: + case reflect.Int64, reflect.Int: addInt(uintptr(f.Int())) shift = 0 flushed = true + class = _NO_CLASS case reflect.Float32: if class == _FLOAT { addFloat(uintptr(val)) @@ -170,6 +176,12 @@ func placeRegisters(v reflect.Value, addFloat func(uintptr), addInt func(uintptr addFloat(uintptr(math.Float64bits(float64(f.Float())))) shift = 0 flushed = true + class = _NO_CLASS + case reflect.Ptr: + addInt(f.Pointer()) + shift = 0 + flushed = true + class = _NO_CLASS case reflect.Array: place(f) default: @@ -187,7 +199,7 @@ func placeRegisters(v reflect.Value, addFloat func(uintptr), addInt func(uintptr } } -func placeStack(v reflect.Value, keepAlive []interface{}, addInt func(uintptr)) []interface{} { +func placeStack(v reflect.Value, keepAlive []any, addInt func(uintptr)) []any { // Struct is too big to be placed in registers. // Copy to heap and place the pointer in register ptrStruct := reflect.New(v.Type()) diff --git a/vendor/github.com/ebitengine/purego/struct_loong64.go b/vendor/github.com/ebitengine/purego/struct_loong64.go new file mode 100644 index 00000000..da7f1a15 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/struct_loong64.go @@ -0,0 +1,190 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2025 The Ebitengine Authors + +package purego + +import ( + "math" + "reflect" + "unsafe" +) + +func getStruct(outType reflect.Type, syscall syscall15Args) (v reflect.Value) { + outSize := outType.Size() + switch { + case outSize == 0: + return reflect.New(outType).Elem() + case outSize <= 8: + r1 := syscall.a1 + if isAllFloats, numFields := isAllSameFloat(outType); isAllFloats { + r1 = syscall.f1 + if numFields == 2 { + r1 = syscall.f2<<32 | syscall.f1 + } + } + return reflect.NewAt(outType, unsafe.Pointer(&struct{ a uintptr }{r1})).Elem() + case outSize <= 16: + r1, r2 := syscall.a1, syscall.a2 + if isAllFloats, numFields := isAllSameFloat(outType); isAllFloats { + switch numFields { + case 4: + r1 = syscall.f2<<32 | syscall.f1 + r2 = syscall.f4<<32 | syscall.f3 + case 3: + r1 = syscall.f2<<32 | syscall.f1 + r2 = syscall.f3 + case 2: + r1 = syscall.f1 + r2 = syscall.f2 + default: + panic("unreachable") + } + } + return reflect.NewAt(outType, unsafe.Pointer(&struct{ a, b uintptr }{r1, r2})).Elem() + default: + // create struct from the Go pointer created above + // weird pointer dereference to circumvent go vet + return reflect.NewAt(outType, *(*unsafe.Pointer)(unsafe.Pointer(&syscall.a1))).Elem() + } +} + +const ( + _NO_CLASS = 0b00 + _FLOAT = 0b01 + _INT = 0b11 +) + +func addStruct(v reflect.Value, numInts, numFloats, numStack *int, addInt, addFloat, addStack func(uintptr), keepAlive []any) []any { + if v.Type().Size() == 0 { + return keepAlive + } + + if size := v.Type().Size(); size <= 16 { + placeRegisters(v, addFloat, addInt) + } else { + keepAlive = placeStack(v, keepAlive, addInt) + } + return keepAlive // the struct was allocated so don't panic +} + +func placeRegisters(v reflect.Value, addFloat func(uintptr), addInt func(uintptr)) { + var val uint64 + var shift byte + var flushed bool + class := _NO_CLASS + var place func(v reflect.Value) + place = func(v reflect.Value) { + var numFields int + if v.Kind() == reflect.Struct { + numFields = v.Type().NumField() + } else { + numFields = v.Type().Len() + } + for k := 0; k < numFields; k++ { + flushed = false + var f reflect.Value + if v.Kind() == reflect.Struct { + f = v.Field(k) + } else { + f = v.Index(k) + } + align := byte(f.Type().Align()*8 - 1) + shift = (shift + align) &^ align + if shift >= 64 { + shift = 0 + flushed = true + if class == _FLOAT { + addFloat(uintptr(val)) + } else { + addInt(uintptr(val)) + } + } + switch f.Type().Kind() { + case reflect.Struct: + place(f) + case reflect.Bool: + if f.Bool() { + val |= 1 << shift + } + shift += 8 + class |= _INT + case reflect.Uint8: + val |= f.Uint() << shift + shift += 8 + class |= _INT + case reflect.Uint16: + val |= f.Uint() << shift + shift += 16 + class |= _INT + case reflect.Uint32: + val |= f.Uint() << shift + shift += 32 + class |= _INT + case reflect.Uint64, reflect.Uint, reflect.Uintptr: + addInt(uintptr(f.Uint())) + shift = 0 + flushed = true + class = _NO_CLASS + case reflect.Int8: + val |= uint64(f.Int()&0xFF) << shift + shift += 8 + class |= _INT + case reflect.Int16: + val |= uint64(f.Int()&0xFFFF) << shift + shift += 16 + class |= _INT + case reflect.Int32: + val |= uint64(f.Int()&0xFFFF_FFFF) << shift + shift += 32 + class |= _INT + case reflect.Int64, reflect.Int: + addInt(uintptr(f.Int())) + shift = 0 + flushed = true + class = _NO_CLASS + case reflect.Float32: + if class == _FLOAT { + addFloat(uintptr(val)) + val = 0 + shift = 0 + } + val |= uint64(math.Float32bits(float32(f.Float()))) << shift + shift += 32 + class |= _FLOAT + case reflect.Float64: + addFloat(uintptr(math.Float64bits(float64(f.Float())))) + shift = 0 + flushed = true + class = _NO_CLASS + case reflect.Ptr: + addInt(f.Pointer()) + shift = 0 + flushed = true + class = _NO_CLASS + case reflect.Array: + place(f) + default: + panic("purego: unsupported kind " + f.Kind().String()) + } + } + } + place(v) + if !flushed { + if class == _FLOAT { + addFloat(uintptr(val)) + } else { + addInt(uintptr(val)) + } + } +} + +func placeStack(v reflect.Value, keepAlive []any, addInt func(uintptr)) []any { + // Struct is too big to be placed in registers. + // Copy to heap and place the pointer in register + ptrStruct := reflect.New(v.Type()) + ptrStruct.Elem().Set(v) + ptr := ptrStruct.Elem().Addr().UnsafePointer() + keepAlive = append(keepAlive, ptr) + addInt(uintptr(ptr)) + return keepAlive +} diff --git a/vendor/github.com/ebitengine/purego/struct_other.go b/vendor/github.com/ebitengine/purego/struct_other.go index 9d42adac..58ccc973 100644 --- a/vendor/github.com/ebitengine/purego/struct_other.go +++ b/vendor/github.com/ebitengine/purego/struct_other.go @@ -1,16 +1,20 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2024 The Ebitengine Authors -//go:build !amd64 && !arm64 +//go:build !amd64 && !arm64 && !loong64 package purego import "reflect" -func addStruct(v reflect.Value, numInts, numFloats, numStack *int, addInt, addFloat, addStack func(uintptr), keepAlive []interface{}) []interface{} { +func addStruct(v reflect.Value, numInts, numFloats, numStack *int, addInt, addFloat, addStack func(uintptr), keepAlive []any) []any { panic("purego: struct arguments are not supported") } func getStruct(outType reflect.Type, syscall syscall15Args) (v reflect.Value) { panic("purego: struct returns are not supported") } + +func placeRegisters(v reflect.Value, addFloat func(uintptr), addInt func(uintptr)) { + panic("purego: not needed on other platforms") +} diff --git a/vendor/github.com/ebitengine/purego/sys_amd64.s b/vendor/github.com/ebitengine/purego/sys_amd64.s index cabde1a5..a364dd0c 100644 --- a/vendor/github.com/ebitengine/purego/sys_amd64.s +++ b/vendor/github.com/ebitengine/purego/sys_amd64.s @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -//go:build darwin || freebsd || linux +//go:build darwin || freebsd || linux || netbsd #include "textflag.h" #include "abi_amd64.h" diff --git a/vendor/github.com/ebitengine/purego/sys_arm64.s b/vendor/github.com/ebitengine/purego/sys_arm64.s index a68fdb99..a4f5be72 100644 --- a/vendor/github.com/ebitengine/purego/sys_arm64.s +++ b/vendor/github.com/ebitengine/purego/sys_arm64.s @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -//go:build darwin || freebsd || linux || windows +//go:build darwin || freebsd || linux || netbsd || windows #include "textflag.h" #include "go_asm.h" diff --git a/vendor/github.com/ebitengine/purego/sys_loong64.s b/vendor/github.com/ebitengine/purego/sys_loong64.s new file mode 100644 index 00000000..0f34eaee --- /dev/null +++ b/vendor/github.com/ebitengine/purego/sys_loong64.s @@ -0,0 +1,96 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2025 The Ebitengine Authors + +//go:build linux + +#include "textflag.h" +#include "go_asm.h" +#include "funcdata.h" + +#define STACK_SIZE 64 +#define PTR_ADDRESS (STACK_SIZE - 8) + +// syscall15X calls a function in libc on behalf of the syscall package. +// syscall15X takes a pointer to a struct like: +// struct { +// fn uintptr +// a1 uintptr +// a2 uintptr +// a3 uintptr +// a4 uintptr +// a5 uintptr +// a6 uintptr +// a7 uintptr +// a8 uintptr +// a9 uintptr +// a10 uintptr +// a11 uintptr +// a12 uintptr +// a13 uintptr +// a14 uintptr +// a15 uintptr +// r1 uintptr +// r2 uintptr +// err uintptr +// } +// syscall15X must be called on the g0 stack with the +// C calling convention (use libcCall). +GLOBL ·syscall15XABI0(SB), NOPTR|RODATA, $8 +DATA ·syscall15XABI0(SB)/8, $syscall15X(SB) +TEXT syscall15X(SB), NOSPLIT, $0 + // push structure pointer + SUBV $STACK_SIZE, R3 + MOVV R4, PTR_ADDRESS(R3) + MOVV R4, R13 + + MOVD syscall15Args_f1(R13), F0 // f1 + MOVD syscall15Args_f2(R13), F1 // f2 + MOVD syscall15Args_f3(R13), F2 // f3 + MOVD syscall15Args_f4(R13), F3 // f4 + MOVD syscall15Args_f5(R13), F4 // f5 + MOVD syscall15Args_f6(R13), F5 // f6 + MOVD syscall15Args_f7(R13), F6 // f7 + MOVD syscall15Args_f8(R13), F7 // f8 + + MOVV syscall15Args_a1(R13), R4 // a1 + MOVV syscall15Args_a2(R13), R5 // a2 + MOVV syscall15Args_a3(R13), R6 // a3 + MOVV syscall15Args_a4(R13), R7 // a4 + MOVV syscall15Args_a5(R13), R8 // a5 + MOVV syscall15Args_a6(R13), R9 // a6 + MOVV syscall15Args_a7(R13), R10 // a7 + MOVV syscall15Args_a8(R13), R11 // a8 + + // push a9-a15 onto stack + MOVV syscall15Args_a9(R13), R12 + MOVV R12, 0(R3) + MOVV syscall15Args_a10(R13), R12 + MOVV R12, 8(R3) + MOVV syscall15Args_a11(R13), R12 + MOVV R12, 16(R3) + MOVV syscall15Args_a12(R13), R12 + MOVV R12, 24(R3) + MOVV syscall15Args_a13(R13), R12 + MOVV R12, 32(R3) + MOVV syscall15Args_a14(R13), R12 + MOVV R12, 40(R3) + MOVV syscall15Args_a15(R13), R12 + MOVV R12, 48(R3) + + MOVV syscall15Args_fn(R13), R12 + JAL (R12) + + // pop structure pointer + MOVV PTR_ADDRESS(R3), R13 + ADDV $STACK_SIZE, R3 + + // save R4, R5 + MOVV R4, syscall15Args_a1(R13) + MOVV R5, syscall15Args_a2(R13) + + // save f0-f3 + MOVD F0, syscall15Args_f1(R13) + MOVD F1, syscall15Args_f2(R13) + MOVD F2, syscall15Args_f3(R13) + MOVD F3, syscall15Args_f4(R13) + RET diff --git a/vendor/github.com/ebitengine/purego/sys_unix_arm64.s b/vendor/github.com/ebitengine/purego/sys_unix_arm64.s index 6da06b4d..cea803ef 100644 --- a/vendor/github.com/ebitengine/purego/sys_unix_arm64.s +++ b/vendor/github.com/ebitengine/purego/sys_unix_arm64.s @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2023 The Ebitengine Authors -//go:build darwin || freebsd || linux +//go:build darwin || freebsd || linux || netbsd #include "textflag.h" #include "go_asm.h" diff --git a/vendor/github.com/ebitengine/purego/sys_unix_loong64.s b/vendor/github.com/ebitengine/purego/sys_unix_loong64.s new file mode 100644 index 00000000..89dbd7d1 --- /dev/null +++ b/vendor/github.com/ebitengine/purego/sys_unix_loong64.s @@ -0,0 +1,75 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2025 The Ebitengine Authors + +//go:build linux + +#include "textflag.h" +#include "go_asm.h" +#include "funcdata.h" +#include "abi_loong64.h" + +TEXT callbackasm1(SB), NOSPLIT|NOFRAME, $0 + NO_LOCAL_POINTERS + + SUBV $(16*8), R3, R14 + MOVD F0, 0(R14) + MOVD F1, 8(R14) + MOVD F2, 16(R14) + MOVD F3, 24(R14) + MOVD F4, 32(R14) + MOVD F5, 40(R14) + MOVD F6, 48(R14) + MOVD F7, 56(R14) + MOVV R4, 64(R14) + MOVV R5, 72(R14) + MOVV R6, 80(R14) + MOVV R7, 88(R14) + MOVV R8, 96(R14) + MOVV R9, 104(R14) + MOVV R10, 112(R14) + MOVV R11, 120(R14) + + // Adjust SP by frame size. + SUBV $(22*8), R3 + + // It is important to save R30 because the go assembler + // uses it for move instructions for a variable. + // This line: + // MOVV ·callbackWrap_call(SB), R4 + // Creates the instructions: + // PCALAU12I off1(PC), R30 + // MOVV off2(R30), R4 + // R30 is a callee saved register so we are responsible + // for ensuring its value doesn't change. So save it and + // restore it at the end of this function. + // R1 is the link register. crosscall2 doesn't save it + // so it's saved here. + MOVV R1, 0(R3) + MOVV R30, 8(R3) + + // Create a struct callbackArgs on our stack. + MOVV $(callbackArgs__size)(R3), R13 + MOVV R12, callbackArgs_index(R13) // callback index + MOVV R14, callbackArgs_args(R13) // address of args vector + MOVV $0, callbackArgs_result(R13) // result + + // Move parameters into registers + // Get the ABIInternal function pointer + // without by using a closure. + MOVV ·callbackWrap_call(SB), R4 + MOVV (R4), R4 // fn unsafe.Pointer + MOVV R13, R5 // frame (&callbackArgs{...}) + MOVV $0, R7 // ctxt uintptr + + JAL crosscall2(SB) + + // Get callback result. + MOVV $(callbackArgs__size)(R3), R13 + MOVV callbackArgs_result(R13), R4 + + // Restore LR and R30 + MOVV 0(R3), R1 + MOVV 8(R3), R30 + ADDV $(22*8), R3 + + RET diff --git a/vendor/github.com/ebitengine/purego/syscall.go b/vendor/github.com/ebitengine/purego/syscall.go index c30688dd..ccfc4982 100644 --- a/vendor/github.com/ebitengine/purego/syscall.go +++ b/vendor/github.com/ebitengine/purego/syscall.go @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -//go:build darwin || freebsd || linux || windows +//go:build darwin || freebsd || linux || netbsd || windows package purego @@ -13,8 +13,8 @@ package purego type CDecl struct{} const ( - maxArgs = 15 - numOfFloats = 8 // arm64 and amd64 both have 8 float registers + maxArgs = 15 + numOfFloatRegisters = 8 // arm64 and amd64 both have 8 float registers ) type syscall15Args struct { @@ -27,6 +27,9 @@ type syscall15Args struct { // There is an internal maximum number of arguments that SyscallN can take. It panics // when the maximum is exceeded. It returns the result and the libc error code if there is one. // +// In order to call this function properly make sure to follow all the rules specified in [unsafe.Pointer] +// especially point 4. +// // NOTE: SyscallN does not properly call functions that have both integer and float parameters. // See discussion comment https://github.com/ebiten/purego/pull/1#issuecomment-1128057607 // for an explanation of why that is. diff --git a/vendor/github.com/ebitengine/purego/syscall_cgo_linux.go b/vendor/github.com/ebitengine/purego/syscall_cgo_linux.go index 36ee14e3..7794c263 100644 --- a/vendor/github.com/ebitengine/purego/syscall_cgo_linux.go +++ b/vendor/github.com/ebitengine/purego/syscall_cgo_linux.go @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -//go:build cgo && !(amd64 || arm64) +//go:build cgo && !(amd64 || arm64 || loong64) package purego @@ -16,6 +16,6 @@ func syscall_syscall15X(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a return cgo.Syscall15X(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) } -func NewCallback(_ interface{}) uintptr { - panic("purego: NewCallback on Linux is only supported on amd64/arm64") +func NewCallback(_ any) uintptr { + panic("purego: NewCallback on Linux is only supported on amd64/arm64/loong64") } diff --git a/vendor/github.com/ebitengine/purego/syscall_sysv.go b/vendor/github.com/ebitengine/purego/syscall_sysv.go index cce171c8..d794bc38 100644 --- a/vendor/github.com/ebitengine/purego/syscall_sysv.go +++ b/vendor/github.com/ebitengine/purego/syscall_sysv.go @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -//go:build darwin || freebsd || (linux && (amd64 || arm64)) +//go:build darwin || freebsd || (linux && (amd64 || arm64 || loong64)) || netbsd package purego @@ -14,14 +14,17 @@ import ( var syscall15XABI0 uintptr -//go:nosplit func syscall_syscall15X(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 uintptr) (r1, r2, err uintptr) { - args := syscall15Args{ + args := thePool.Get().(*syscall15Args) + defer thePool.Put(args) + + *args = syscall15Args{ fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a1, a2, a3, a4, a5, a6, a7, a8, 0, } - runtime_cgocall(syscall15XABI0, unsafe.Pointer(&args)) + + runtime_cgocall(syscall15XABI0, unsafe.Pointer(args)) return args.a1, args.a2, 0 } @@ -31,7 +34,7 @@ func syscall_syscall15X(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a // of uintptr. Only a limited number of callbacks may be created in a single Go process, and any memory allocated // for these callbacks is never released. At least 2000 callbacks can always be created. Although this function // provides similar functionality to windows.NewCallback it is distinct. -func NewCallback(fn interface{}) uintptr { +func NewCallback(fn any) uintptr { ty := reflect.TypeOf(fn) for i := 0; i < ty.NumIn(); i++ { in := ty.In(i) @@ -71,7 +74,7 @@ type callbackArgs struct { result uintptr } -func compileCallback(fn interface{}) uintptr { +func compileCallback(fn any) uintptr { val := reflect.ValueOf(fn) if val.Kind() != reflect.Func { panic("purego: the type must be a function but was not") @@ -146,12 +149,12 @@ func callbackWrap(a *callbackArgs) { var intsN int // intsN represents the number of integer arguments processed // stack points to the index into frame of the current stack element. // The stack begins after the float and integer registers. - stack := numOfIntegerRegisters() + numOfFloats + stack := numOfIntegerRegisters() + numOfFloatRegisters for i := range args { var pos int switch fnType.In(i).Kind() { case reflect.Float32, reflect.Float64: - if floatsN >= numOfFloats { + if floatsN >= numOfFloatRegisters { pos = stack stack++ } else { @@ -169,7 +172,7 @@ func callbackWrap(a *callbackArgs) { stack++ } else { // the integers begin after the floats in frame - pos = intsN + numOfFloats + pos = intsN + numOfFloatRegisters } intsN++ } @@ -214,7 +217,7 @@ func callbackasmAddr(i int) uintptr { panic("purego: unsupported architecture") case "386", "amd64": entrySize = 5 - case "arm", "arm64": + case "arm", "arm64", "loong64": // On ARM and ARM64, each entry is a MOV instruction // followed by a branch instruction entrySize = 8 diff --git a/vendor/github.com/ebitengine/purego/syscall_windows.go b/vendor/github.com/ebitengine/purego/syscall_windows.go index 5fbfcabf..5afd8d83 100644 --- a/vendor/github.com/ebitengine/purego/syscall_windows.go +++ b/vendor/github.com/ebitengine/purego/syscall_windows.go @@ -22,7 +22,7 @@ func syscall_syscall15X(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a // allocated for these callbacks is never released. Between NewCallback and NewCallbackCDecl, at least 1024 // callbacks can always be created. Although this function is similiar to the darwin version it may act // differently. -func NewCallback(fn interface{}) uintptr { +func NewCallback(fn any) uintptr { isCDecl := false ty := reflect.TypeOf(fn) for i := 0; i < ty.NumIn(); i++ { diff --git a/vendor/github.com/ebitengine/purego/zcallback_amd64.s b/vendor/github.com/ebitengine/purego/zcallback_amd64.s index 6a778bfc..42b54c48 100644 --- a/vendor/github.com/ebitengine/purego/zcallback_amd64.s +++ b/vendor/github.com/ebitengine/purego/zcallback_amd64.s @@ -1,6 +1,6 @@ // Code generated by wincallback.go using 'go generate'. DO NOT EDIT. -//go:build darwin || freebsd || linux +//go:build darwin || freebsd || linux || netbsd // runtime·callbackasm is called by external code to // execute Go implemented callback function. It is not @@ -11,2004 +11,2004 @@ // which Go callback function is executed later on. #include "textflag.h" -TEXT callbackasm(SB), NOSPLIT|NOFRAME, $0 - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) - CALL callbackasm1(SB) +TEXT callbackasm(SB),NOSPLIT|NOFRAME,$0 + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) + CALL callbackasm1(SB) diff --git a/vendor/github.com/ebitengine/purego/zcallback_arm64.s b/vendor/github.com/ebitengine/purego/zcallback_arm64.s index c079b803..087c2d4f 100644 --- a/vendor/github.com/ebitengine/purego/zcallback_arm64.s +++ b/vendor/github.com/ebitengine/purego/zcallback_arm64.s @@ -1,6 +1,6 @@ // Code generated by wincallback.go using 'go generate'. DO NOT EDIT. -//go:build darwin || freebsd || linux +//go:build darwin || freebsd || linux || netbsd // External code calls into callbackasm at an offset corresponding // to the callback index. Callbackasm is a table of MOV and B instructions. @@ -11,4004 +11,4004 @@ // It then calls the Go implementation for that callback. #include "textflag.h" -TEXT callbackasm(SB), NOSPLIT|NOFRAME, $0 - MOVD $0, R12 - B callbackasm1(SB) - MOVD $1, R12 - B callbackasm1(SB) - MOVD $2, R12 - B callbackasm1(SB) - MOVD $3, R12 - B callbackasm1(SB) - MOVD $4, R12 - B callbackasm1(SB) - MOVD $5, R12 - B callbackasm1(SB) - MOVD $6, R12 - B callbackasm1(SB) - MOVD $7, R12 - B callbackasm1(SB) - MOVD $8, R12 - B callbackasm1(SB) - MOVD $9, R12 - B callbackasm1(SB) - MOVD $10, R12 - B callbackasm1(SB) - MOVD $11, R12 - B callbackasm1(SB) - MOVD $12, R12 - B callbackasm1(SB) - MOVD $13, R12 - B callbackasm1(SB) - MOVD $14, R12 - B callbackasm1(SB) - MOVD $15, R12 - B callbackasm1(SB) - MOVD $16, R12 - B callbackasm1(SB) - MOVD $17, R12 - B callbackasm1(SB) - MOVD $18, R12 - B callbackasm1(SB) - MOVD $19, R12 - B callbackasm1(SB) - MOVD $20, R12 - B callbackasm1(SB) - MOVD $21, R12 - B callbackasm1(SB) - MOVD $22, R12 - B callbackasm1(SB) - MOVD $23, R12 - B callbackasm1(SB) - MOVD $24, R12 - B callbackasm1(SB) - MOVD $25, R12 - B callbackasm1(SB) - MOVD $26, R12 - B callbackasm1(SB) - MOVD $27, R12 - B callbackasm1(SB) - MOVD $28, R12 - B callbackasm1(SB) - MOVD $29, R12 - B callbackasm1(SB) - MOVD $30, R12 - B callbackasm1(SB) - MOVD $31, R12 - B callbackasm1(SB) - MOVD $32, R12 - B callbackasm1(SB) - MOVD $33, R12 - B callbackasm1(SB) - MOVD $34, R12 - B callbackasm1(SB) - MOVD $35, R12 - B callbackasm1(SB) - MOVD $36, R12 - B callbackasm1(SB) - MOVD $37, R12 - B callbackasm1(SB) - MOVD $38, R12 - B callbackasm1(SB) - MOVD $39, R12 - B callbackasm1(SB) - MOVD $40, R12 - B callbackasm1(SB) - MOVD $41, R12 - B callbackasm1(SB) - MOVD $42, R12 - B callbackasm1(SB) - MOVD $43, R12 - B callbackasm1(SB) - MOVD $44, R12 - B callbackasm1(SB) - MOVD $45, R12 - B callbackasm1(SB) - MOVD $46, R12 - B callbackasm1(SB) - MOVD $47, R12 - B callbackasm1(SB) - MOVD $48, R12 - B callbackasm1(SB) - MOVD $49, R12 - B callbackasm1(SB) - MOVD $50, R12 - B callbackasm1(SB) - MOVD $51, R12 - B callbackasm1(SB) - MOVD $52, R12 - B callbackasm1(SB) - MOVD $53, R12 - B callbackasm1(SB) - MOVD $54, R12 - B callbackasm1(SB) - MOVD $55, R12 - B callbackasm1(SB) - MOVD $56, R12 - B callbackasm1(SB) - MOVD $57, R12 - B callbackasm1(SB) - MOVD $58, R12 - B callbackasm1(SB) - MOVD $59, R12 - B callbackasm1(SB) - MOVD $60, R12 - B callbackasm1(SB) - MOVD $61, R12 - B callbackasm1(SB) - MOVD $62, R12 - B callbackasm1(SB) - MOVD $63, R12 - B callbackasm1(SB) - MOVD $64, R12 - B callbackasm1(SB) - MOVD $65, R12 - B callbackasm1(SB) - MOVD $66, R12 - B callbackasm1(SB) - MOVD $67, R12 - B callbackasm1(SB) - MOVD $68, R12 - B callbackasm1(SB) - MOVD $69, R12 - B callbackasm1(SB) - MOVD $70, R12 - B callbackasm1(SB) - MOVD $71, R12 - B callbackasm1(SB) - MOVD $72, R12 - B callbackasm1(SB) - MOVD $73, R12 - B callbackasm1(SB) - MOVD $74, R12 - B callbackasm1(SB) - MOVD $75, R12 - B callbackasm1(SB) - MOVD $76, R12 - B callbackasm1(SB) - MOVD $77, R12 - B callbackasm1(SB) - MOVD $78, R12 - B callbackasm1(SB) - MOVD $79, R12 - B callbackasm1(SB) - MOVD $80, R12 - B callbackasm1(SB) - MOVD $81, R12 - B callbackasm1(SB) - MOVD $82, R12 - B callbackasm1(SB) - MOVD $83, R12 - B callbackasm1(SB) - MOVD $84, R12 - B callbackasm1(SB) - MOVD $85, R12 - B callbackasm1(SB) - MOVD $86, R12 - B callbackasm1(SB) - MOVD $87, R12 - B callbackasm1(SB) - MOVD $88, R12 - B callbackasm1(SB) - MOVD $89, R12 - B callbackasm1(SB) - MOVD $90, R12 - B callbackasm1(SB) - MOVD $91, R12 - B callbackasm1(SB) - MOVD $92, R12 - B callbackasm1(SB) - MOVD $93, R12 - B callbackasm1(SB) - MOVD $94, R12 - B callbackasm1(SB) - MOVD $95, R12 - B callbackasm1(SB) - MOVD $96, R12 - B callbackasm1(SB) - MOVD $97, R12 - B callbackasm1(SB) - MOVD $98, R12 - B callbackasm1(SB) - MOVD $99, R12 - B callbackasm1(SB) - MOVD $100, R12 - B callbackasm1(SB) - MOVD $101, R12 - B callbackasm1(SB) - MOVD $102, R12 - B callbackasm1(SB) - MOVD $103, R12 - B callbackasm1(SB) - MOVD $104, R12 - B callbackasm1(SB) - MOVD $105, R12 - B callbackasm1(SB) - MOVD $106, R12 - B callbackasm1(SB) - MOVD $107, R12 - B callbackasm1(SB) - MOVD $108, R12 - B callbackasm1(SB) - MOVD $109, R12 - B callbackasm1(SB) - MOVD $110, R12 - B callbackasm1(SB) - MOVD $111, R12 - B callbackasm1(SB) - MOVD $112, R12 - B callbackasm1(SB) - MOVD $113, R12 - B callbackasm1(SB) - MOVD $114, R12 - B callbackasm1(SB) - MOVD $115, R12 - B callbackasm1(SB) - MOVD $116, R12 - B callbackasm1(SB) - MOVD $117, R12 - B callbackasm1(SB) - MOVD $118, R12 - B callbackasm1(SB) - MOVD $119, R12 - B callbackasm1(SB) - MOVD $120, R12 - B callbackasm1(SB) - MOVD $121, R12 - B callbackasm1(SB) - MOVD $122, R12 - B callbackasm1(SB) - MOVD $123, R12 - B callbackasm1(SB) - MOVD $124, R12 - B callbackasm1(SB) - MOVD $125, R12 - B callbackasm1(SB) - MOVD $126, R12 - B callbackasm1(SB) - MOVD $127, R12 - B callbackasm1(SB) - MOVD $128, R12 - B callbackasm1(SB) - MOVD $129, R12 - B callbackasm1(SB) - MOVD $130, R12 - B callbackasm1(SB) - MOVD $131, R12 - B callbackasm1(SB) - MOVD $132, R12 - B callbackasm1(SB) - MOVD $133, R12 - B callbackasm1(SB) - MOVD $134, R12 - B callbackasm1(SB) - MOVD $135, R12 - B callbackasm1(SB) - MOVD $136, R12 - B callbackasm1(SB) - MOVD $137, R12 - B callbackasm1(SB) - MOVD $138, R12 - B callbackasm1(SB) - MOVD $139, R12 - B callbackasm1(SB) - MOVD $140, R12 - B callbackasm1(SB) - MOVD $141, R12 - B callbackasm1(SB) - MOVD $142, R12 - B callbackasm1(SB) - MOVD $143, R12 - B callbackasm1(SB) - MOVD $144, R12 - B callbackasm1(SB) - MOVD $145, R12 - B callbackasm1(SB) - MOVD $146, R12 - B callbackasm1(SB) - MOVD $147, R12 - B callbackasm1(SB) - MOVD $148, R12 - B callbackasm1(SB) - MOVD $149, R12 - B callbackasm1(SB) - MOVD $150, R12 - B callbackasm1(SB) - MOVD $151, R12 - B callbackasm1(SB) - MOVD $152, R12 - B callbackasm1(SB) - MOVD $153, R12 - B callbackasm1(SB) - MOVD $154, R12 - B callbackasm1(SB) - MOVD $155, R12 - B callbackasm1(SB) - MOVD $156, R12 - B callbackasm1(SB) - MOVD $157, R12 - B callbackasm1(SB) - MOVD $158, R12 - B callbackasm1(SB) - MOVD $159, R12 - B callbackasm1(SB) - MOVD $160, R12 - B callbackasm1(SB) - MOVD $161, R12 - B callbackasm1(SB) - MOVD $162, R12 - B callbackasm1(SB) - MOVD $163, R12 - B callbackasm1(SB) - MOVD $164, R12 - B callbackasm1(SB) - MOVD $165, R12 - B callbackasm1(SB) - MOVD $166, R12 - B callbackasm1(SB) - MOVD $167, R12 - B callbackasm1(SB) - MOVD $168, R12 - B callbackasm1(SB) - MOVD $169, R12 - B callbackasm1(SB) - MOVD $170, R12 - B callbackasm1(SB) - MOVD $171, R12 - B callbackasm1(SB) - MOVD $172, R12 - B callbackasm1(SB) - MOVD $173, R12 - B callbackasm1(SB) - MOVD $174, R12 - B callbackasm1(SB) - MOVD $175, R12 - B callbackasm1(SB) - MOVD $176, R12 - B callbackasm1(SB) - MOVD $177, R12 - B callbackasm1(SB) - MOVD $178, R12 - B callbackasm1(SB) - MOVD $179, R12 - B callbackasm1(SB) - MOVD $180, R12 - B callbackasm1(SB) - MOVD $181, R12 - B callbackasm1(SB) - MOVD $182, R12 - B callbackasm1(SB) - MOVD $183, R12 - B callbackasm1(SB) - MOVD $184, R12 - B callbackasm1(SB) - MOVD $185, R12 - B callbackasm1(SB) - MOVD $186, R12 - B callbackasm1(SB) - MOVD $187, R12 - B callbackasm1(SB) - MOVD $188, R12 - B callbackasm1(SB) - MOVD $189, R12 - B callbackasm1(SB) - MOVD $190, R12 - B callbackasm1(SB) - MOVD $191, R12 - B callbackasm1(SB) - MOVD $192, R12 - B callbackasm1(SB) - MOVD $193, R12 - B callbackasm1(SB) - MOVD $194, R12 - B callbackasm1(SB) - MOVD $195, R12 - B callbackasm1(SB) - MOVD $196, R12 - B callbackasm1(SB) - MOVD $197, R12 - B callbackasm1(SB) - MOVD $198, R12 - B callbackasm1(SB) - MOVD $199, R12 - B callbackasm1(SB) - MOVD $200, R12 - B callbackasm1(SB) - MOVD $201, R12 - B callbackasm1(SB) - MOVD $202, R12 - B callbackasm1(SB) - MOVD $203, R12 - B callbackasm1(SB) - MOVD $204, R12 - B callbackasm1(SB) - MOVD $205, R12 - B callbackasm1(SB) - MOVD $206, R12 - B callbackasm1(SB) - MOVD $207, R12 - B callbackasm1(SB) - MOVD $208, R12 - B callbackasm1(SB) - MOVD $209, R12 - B callbackasm1(SB) - MOVD $210, R12 - B callbackasm1(SB) - MOVD $211, R12 - B callbackasm1(SB) - MOVD $212, R12 - B callbackasm1(SB) - MOVD $213, R12 - B callbackasm1(SB) - MOVD $214, R12 - B callbackasm1(SB) - MOVD $215, R12 - B callbackasm1(SB) - MOVD $216, R12 - B callbackasm1(SB) - MOVD $217, R12 - B callbackasm1(SB) - MOVD $218, R12 - B callbackasm1(SB) - MOVD $219, R12 - B callbackasm1(SB) - MOVD $220, R12 - B callbackasm1(SB) - MOVD $221, R12 - B callbackasm1(SB) - MOVD $222, R12 - B callbackasm1(SB) - MOVD $223, R12 - B callbackasm1(SB) - MOVD $224, R12 - B callbackasm1(SB) - MOVD $225, R12 - B callbackasm1(SB) - MOVD $226, R12 - B callbackasm1(SB) - MOVD $227, R12 - B callbackasm1(SB) - MOVD $228, R12 - B callbackasm1(SB) - MOVD $229, R12 - B callbackasm1(SB) - MOVD $230, R12 - B callbackasm1(SB) - MOVD $231, R12 - B callbackasm1(SB) - MOVD $232, R12 - B callbackasm1(SB) - MOVD $233, R12 - B callbackasm1(SB) - MOVD $234, R12 - B callbackasm1(SB) - MOVD $235, R12 - B callbackasm1(SB) - MOVD $236, R12 - B callbackasm1(SB) - MOVD $237, R12 - B callbackasm1(SB) - MOVD $238, R12 - B callbackasm1(SB) - MOVD $239, R12 - B callbackasm1(SB) - MOVD $240, R12 - B callbackasm1(SB) - MOVD $241, R12 - B callbackasm1(SB) - MOVD $242, R12 - B callbackasm1(SB) - MOVD $243, R12 - B callbackasm1(SB) - MOVD $244, R12 - B callbackasm1(SB) - MOVD $245, R12 - B callbackasm1(SB) - MOVD $246, R12 - B callbackasm1(SB) - MOVD $247, R12 - B callbackasm1(SB) - MOVD $248, R12 - B callbackasm1(SB) - MOVD $249, R12 - B callbackasm1(SB) - MOVD $250, R12 - B callbackasm1(SB) - MOVD $251, R12 - B callbackasm1(SB) - MOVD $252, R12 - B callbackasm1(SB) - MOVD $253, R12 - B callbackasm1(SB) - MOVD $254, R12 - B callbackasm1(SB) - MOVD $255, R12 - B callbackasm1(SB) - MOVD $256, R12 - B callbackasm1(SB) - MOVD $257, R12 - B callbackasm1(SB) - MOVD $258, R12 - B callbackasm1(SB) - MOVD $259, R12 - B callbackasm1(SB) - MOVD $260, R12 - B callbackasm1(SB) - MOVD $261, R12 - B callbackasm1(SB) - MOVD $262, R12 - B callbackasm1(SB) - MOVD $263, R12 - B callbackasm1(SB) - MOVD $264, R12 - B callbackasm1(SB) - MOVD $265, R12 - B callbackasm1(SB) - MOVD $266, R12 - B callbackasm1(SB) - MOVD $267, R12 - B callbackasm1(SB) - MOVD $268, R12 - B callbackasm1(SB) - MOVD $269, R12 - B callbackasm1(SB) - MOVD $270, R12 - B callbackasm1(SB) - MOVD $271, R12 - B callbackasm1(SB) - MOVD $272, R12 - B callbackasm1(SB) - MOVD $273, R12 - B callbackasm1(SB) - MOVD $274, R12 - B callbackasm1(SB) - MOVD $275, R12 - B callbackasm1(SB) - MOVD $276, R12 - B callbackasm1(SB) - MOVD $277, R12 - B callbackasm1(SB) - MOVD $278, R12 - B callbackasm1(SB) - MOVD $279, R12 - B callbackasm1(SB) - MOVD $280, R12 - B callbackasm1(SB) - MOVD $281, R12 - B callbackasm1(SB) - MOVD $282, R12 - B callbackasm1(SB) - MOVD $283, R12 - B callbackasm1(SB) - MOVD $284, R12 - B callbackasm1(SB) - MOVD $285, R12 - B callbackasm1(SB) - MOVD $286, R12 - B callbackasm1(SB) - MOVD $287, R12 - B callbackasm1(SB) - MOVD $288, R12 - B callbackasm1(SB) - MOVD $289, R12 - B callbackasm1(SB) - MOVD $290, R12 - B callbackasm1(SB) - MOVD $291, R12 - B callbackasm1(SB) - MOVD $292, R12 - B callbackasm1(SB) - MOVD $293, R12 - B callbackasm1(SB) - MOVD $294, R12 - B callbackasm1(SB) - MOVD $295, R12 - B callbackasm1(SB) - MOVD $296, R12 - B callbackasm1(SB) - MOVD $297, R12 - B callbackasm1(SB) - MOVD $298, R12 - B callbackasm1(SB) - MOVD $299, R12 - B callbackasm1(SB) - MOVD $300, R12 - B callbackasm1(SB) - MOVD $301, R12 - B callbackasm1(SB) - MOVD $302, R12 - B callbackasm1(SB) - MOVD $303, R12 - B callbackasm1(SB) - MOVD $304, R12 - B callbackasm1(SB) - MOVD $305, R12 - B callbackasm1(SB) - MOVD $306, R12 - B callbackasm1(SB) - MOVD $307, R12 - B callbackasm1(SB) - MOVD $308, R12 - B callbackasm1(SB) - MOVD $309, R12 - B callbackasm1(SB) - MOVD $310, R12 - B callbackasm1(SB) - MOVD $311, R12 - B callbackasm1(SB) - MOVD $312, R12 - B callbackasm1(SB) - MOVD $313, R12 - B callbackasm1(SB) - MOVD $314, R12 - B callbackasm1(SB) - MOVD $315, R12 - B callbackasm1(SB) - MOVD $316, R12 - B callbackasm1(SB) - MOVD $317, R12 - B callbackasm1(SB) - MOVD $318, R12 - B callbackasm1(SB) - MOVD $319, R12 - B callbackasm1(SB) - MOVD $320, R12 - B callbackasm1(SB) - MOVD $321, R12 - B callbackasm1(SB) - MOVD $322, R12 - B callbackasm1(SB) - MOVD $323, R12 - B callbackasm1(SB) - MOVD $324, R12 - B callbackasm1(SB) - MOVD $325, R12 - B callbackasm1(SB) - MOVD $326, R12 - B callbackasm1(SB) - MOVD $327, R12 - B callbackasm1(SB) - MOVD $328, R12 - B callbackasm1(SB) - MOVD $329, R12 - B callbackasm1(SB) - MOVD $330, R12 - B callbackasm1(SB) - MOVD $331, R12 - B callbackasm1(SB) - MOVD $332, R12 - B callbackasm1(SB) - MOVD $333, R12 - B callbackasm1(SB) - MOVD $334, R12 - B callbackasm1(SB) - MOVD $335, R12 - B callbackasm1(SB) - MOVD $336, R12 - B callbackasm1(SB) - MOVD $337, R12 - B callbackasm1(SB) - MOVD $338, R12 - B callbackasm1(SB) - MOVD $339, R12 - B callbackasm1(SB) - MOVD $340, R12 - B callbackasm1(SB) - MOVD $341, R12 - B callbackasm1(SB) - MOVD $342, R12 - B callbackasm1(SB) - MOVD $343, R12 - B callbackasm1(SB) - MOVD $344, R12 - B callbackasm1(SB) - MOVD $345, R12 - B callbackasm1(SB) - MOVD $346, R12 - B callbackasm1(SB) - MOVD $347, R12 - B callbackasm1(SB) - MOVD $348, R12 - B callbackasm1(SB) - MOVD $349, R12 - B callbackasm1(SB) - MOVD $350, R12 - B callbackasm1(SB) - MOVD $351, R12 - B callbackasm1(SB) - MOVD $352, R12 - B callbackasm1(SB) - MOVD $353, R12 - B callbackasm1(SB) - MOVD $354, R12 - B callbackasm1(SB) - MOVD $355, R12 - B callbackasm1(SB) - MOVD $356, R12 - B callbackasm1(SB) - MOVD $357, R12 - B callbackasm1(SB) - MOVD $358, R12 - B callbackasm1(SB) - MOVD $359, R12 - B callbackasm1(SB) - MOVD $360, R12 - B callbackasm1(SB) - MOVD $361, R12 - B callbackasm1(SB) - MOVD $362, R12 - B callbackasm1(SB) - MOVD $363, R12 - B callbackasm1(SB) - MOVD $364, R12 - B callbackasm1(SB) - MOVD $365, R12 - B callbackasm1(SB) - MOVD $366, R12 - B callbackasm1(SB) - MOVD $367, R12 - B callbackasm1(SB) - MOVD $368, R12 - B callbackasm1(SB) - MOVD $369, R12 - B callbackasm1(SB) - MOVD $370, R12 - B callbackasm1(SB) - MOVD $371, R12 - B callbackasm1(SB) - MOVD $372, R12 - B callbackasm1(SB) - MOVD $373, R12 - B callbackasm1(SB) - MOVD $374, R12 - B callbackasm1(SB) - MOVD $375, R12 - B callbackasm1(SB) - MOVD $376, R12 - B callbackasm1(SB) - MOVD $377, R12 - B callbackasm1(SB) - MOVD $378, R12 - B callbackasm1(SB) - MOVD $379, R12 - B callbackasm1(SB) - MOVD $380, R12 - B callbackasm1(SB) - MOVD $381, R12 - B callbackasm1(SB) - MOVD $382, R12 - B callbackasm1(SB) - MOVD $383, R12 - B callbackasm1(SB) - MOVD $384, R12 - B callbackasm1(SB) - MOVD $385, R12 - B callbackasm1(SB) - MOVD $386, R12 - B callbackasm1(SB) - MOVD $387, R12 - B callbackasm1(SB) - MOVD $388, R12 - B callbackasm1(SB) - MOVD $389, R12 - B callbackasm1(SB) - MOVD $390, R12 - B callbackasm1(SB) - MOVD $391, R12 - B callbackasm1(SB) - MOVD $392, R12 - B callbackasm1(SB) - MOVD $393, R12 - B callbackasm1(SB) - MOVD $394, R12 - B callbackasm1(SB) - MOVD $395, R12 - B callbackasm1(SB) - MOVD $396, R12 - B callbackasm1(SB) - MOVD $397, R12 - B callbackasm1(SB) - MOVD $398, R12 - B callbackasm1(SB) - MOVD $399, R12 - B callbackasm1(SB) - MOVD $400, R12 - B callbackasm1(SB) - MOVD $401, R12 - B callbackasm1(SB) - MOVD $402, R12 - B callbackasm1(SB) - MOVD $403, R12 - B callbackasm1(SB) - MOVD $404, R12 - B callbackasm1(SB) - MOVD $405, R12 - B callbackasm1(SB) - MOVD $406, R12 - B callbackasm1(SB) - MOVD $407, R12 - B callbackasm1(SB) - MOVD $408, R12 - B callbackasm1(SB) - MOVD $409, R12 - B callbackasm1(SB) - MOVD $410, R12 - B callbackasm1(SB) - MOVD $411, R12 - B callbackasm1(SB) - MOVD $412, R12 - B callbackasm1(SB) - MOVD $413, R12 - B callbackasm1(SB) - MOVD $414, R12 - B callbackasm1(SB) - MOVD $415, R12 - B callbackasm1(SB) - MOVD $416, R12 - B callbackasm1(SB) - MOVD $417, R12 - B callbackasm1(SB) - MOVD $418, R12 - B callbackasm1(SB) - MOVD $419, R12 - B callbackasm1(SB) - MOVD $420, R12 - B callbackasm1(SB) - MOVD $421, R12 - B callbackasm1(SB) - MOVD $422, R12 - B callbackasm1(SB) - MOVD $423, R12 - B callbackasm1(SB) - MOVD $424, R12 - B callbackasm1(SB) - MOVD $425, R12 - B callbackasm1(SB) - MOVD $426, R12 - B callbackasm1(SB) - MOVD $427, R12 - B callbackasm1(SB) - MOVD $428, R12 - B callbackasm1(SB) - MOVD $429, R12 - B callbackasm1(SB) - MOVD $430, R12 - B callbackasm1(SB) - MOVD $431, R12 - B callbackasm1(SB) - MOVD $432, R12 - B callbackasm1(SB) - MOVD $433, R12 - B callbackasm1(SB) - MOVD $434, R12 - B callbackasm1(SB) - MOVD $435, R12 - B callbackasm1(SB) - MOVD $436, R12 - B callbackasm1(SB) - MOVD $437, R12 - B callbackasm1(SB) - MOVD $438, R12 - B callbackasm1(SB) - MOVD $439, R12 - B callbackasm1(SB) - MOVD $440, R12 - B callbackasm1(SB) - MOVD $441, R12 - B callbackasm1(SB) - MOVD $442, R12 - B callbackasm1(SB) - MOVD $443, R12 - B callbackasm1(SB) - MOVD $444, R12 - B callbackasm1(SB) - MOVD $445, R12 - B callbackasm1(SB) - MOVD $446, R12 - B callbackasm1(SB) - MOVD $447, R12 - B callbackasm1(SB) - MOVD $448, R12 - B callbackasm1(SB) - MOVD $449, R12 - B callbackasm1(SB) - MOVD $450, R12 - B callbackasm1(SB) - MOVD $451, R12 - B callbackasm1(SB) - MOVD $452, R12 - B callbackasm1(SB) - MOVD $453, R12 - B callbackasm1(SB) - MOVD $454, R12 - B callbackasm1(SB) - MOVD $455, R12 - B callbackasm1(SB) - MOVD $456, R12 - B callbackasm1(SB) - MOVD $457, R12 - B callbackasm1(SB) - MOVD $458, R12 - B callbackasm1(SB) - MOVD $459, R12 - B callbackasm1(SB) - MOVD $460, R12 - B callbackasm1(SB) - MOVD $461, R12 - B callbackasm1(SB) - MOVD $462, R12 - B callbackasm1(SB) - MOVD $463, R12 - B callbackasm1(SB) - MOVD $464, R12 - B callbackasm1(SB) - MOVD $465, R12 - B callbackasm1(SB) - MOVD $466, R12 - B callbackasm1(SB) - MOVD $467, R12 - B callbackasm1(SB) - MOVD $468, R12 - B callbackasm1(SB) - MOVD $469, R12 - B callbackasm1(SB) - MOVD $470, R12 - B callbackasm1(SB) - MOVD $471, R12 - B callbackasm1(SB) - MOVD $472, R12 - B callbackasm1(SB) - MOVD $473, R12 - B callbackasm1(SB) - MOVD $474, R12 - B callbackasm1(SB) - MOVD $475, R12 - B callbackasm1(SB) - MOVD $476, R12 - B callbackasm1(SB) - MOVD $477, R12 - B callbackasm1(SB) - MOVD $478, R12 - B callbackasm1(SB) - MOVD $479, R12 - B callbackasm1(SB) - MOVD $480, R12 - B callbackasm1(SB) - MOVD $481, R12 - B callbackasm1(SB) - MOVD $482, R12 - B callbackasm1(SB) - MOVD $483, R12 - B callbackasm1(SB) - MOVD $484, R12 - B callbackasm1(SB) - MOVD $485, R12 - B callbackasm1(SB) - MOVD $486, R12 - B callbackasm1(SB) - MOVD $487, R12 - B callbackasm1(SB) - MOVD $488, R12 - B callbackasm1(SB) - MOVD $489, R12 - B callbackasm1(SB) - MOVD $490, R12 - B callbackasm1(SB) - MOVD $491, R12 - B callbackasm1(SB) - MOVD $492, R12 - B callbackasm1(SB) - MOVD $493, R12 - B callbackasm1(SB) - MOVD $494, R12 - B callbackasm1(SB) - MOVD $495, R12 - B callbackasm1(SB) - MOVD $496, R12 - B callbackasm1(SB) - MOVD $497, R12 - B callbackasm1(SB) - MOVD $498, R12 - B callbackasm1(SB) - MOVD $499, R12 - B callbackasm1(SB) - MOVD $500, R12 - B callbackasm1(SB) - MOVD $501, R12 - B callbackasm1(SB) - MOVD $502, R12 - B callbackasm1(SB) - MOVD $503, R12 - B callbackasm1(SB) - MOVD $504, R12 - B callbackasm1(SB) - MOVD $505, R12 - B callbackasm1(SB) - MOVD $506, R12 - B callbackasm1(SB) - MOVD $507, R12 - B callbackasm1(SB) - MOVD $508, R12 - B callbackasm1(SB) - MOVD $509, R12 - B callbackasm1(SB) - MOVD $510, R12 - B callbackasm1(SB) - MOVD $511, R12 - B callbackasm1(SB) - MOVD $512, R12 - B callbackasm1(SB) - MOVD $513, R12 - B callbackasm1(SB) - MOVD $514, R12 - B callbackasm1(SB) - MOVD $515, R12 - B callbackasm1(SB) - MOVD $516, R12 - B callbackasm1(SB) - MOVD $517, R12 - B callbackasm1(SB) - MOVD $518, R12 - B callbackasm1(SB) - MOVD $519, R12 - B callbackasm1(SB) - MOVD $520, R12 - B callbackasm1(SB) - MOVD $521, R12 - B callbackasm1(SB) - MOVD $522, R12 - B callbackasm1(SB) - MOVD $523, R12 - B callbackasm1(SB) - MOVD $524, R12 - B callbackasm1(SB) - MOVD $525, R12 - B callbackasm1(SB) - MOVD $526, R12 - B callbackasm1(SB) - MOVD $527, R12 - B callbackasm1(SB) - MOVD $528, R12 - B callbackasm1(SB) - MOVD $529, R12 - B callbackasm1(SB) - MOVD $530, R12 - B callbackasm1(SB) - MOVD $531, R12 - B callbackasm1(SB) - MOVD $532, R12 - B callbackasm1(SB) - MOVD $533, R12 - B callbackasm1(SB) - MOVD $534, R12 - B callbackasm1(SB) - MOVD $535, R12 - B callbackasm1(SB) - MOVD $536, R12 - B callbackasm1(SB) - MOVD $537, R12 - B callbackasm1(SB) - MOVD $538, R12 - B callbackasm1(SB) - MOVD $539, R12 - B callbackasm1(SB) - MOVD $540, R12 - B callbackasm1(SB) - MOVD $541, R12 - B callbackasm1(SB) - MOVD $542, R12 - B callbackasm1(SB) - MOVD $543, R12 - B callbackasm1(SB) - MOVD $544, R12 - B callbackasm1(SB) - MOVD $545, R12 - B callbackasm1(SB) - MOVD $546, R12 - B callbackasm1(SB) - MOVD $547, R12 - B callbackasm1(SB) - MOVD $548, R12 - B callbackasm1(SB) - MOVD $549, R12 - B callbackasm1(SB) - MOVD $550, R12 - B callbackasm1(SB) - MOVD $551, R12 - B callbackasm1(SB) - MOVD $552, R12 - B callbackasm1(SB) - MOVD $553, R12 - B callbackasm1(SB) - MOVD $554, R12 - B callbackasm1(SB) - MOVD $555, R12 - B callbackasm1(SB) - MOVD $556, R12 - B callbackasm1(SB) - MOVD $557, R12 - B callbackasm1(SB) - MOVD $558, R12 - B callbackasm1(SB) - MOVD $559, R12 - B callbackasm1(SB) - MOVD $560, R12 - B callbackasm1(SB) - MOVD $561, R12 - B callbackasm1(SB) - MOVD $562, R12 - B callbackasm1(SB) - MOVD $563, R12 - B callbackasm1(SB) - MOVD $564, R12 - B callbackasm1(SB) - MOVD $565, R12 - B callbackasm1(SB) - MOVD $566, R12 - B callbackasm1(SB) - MOVD $567, R12 - B callbackasm1(SB) - MOVD $568, R12 - B callbackasm1(SB) - MOVD $569, R12 - B callbackasm1(SB) - MOVD $570, R12 - B callbackasm1(SB) - MOVD $571, R12 - B callbackasm1(SB) - MOVD $572, R12 - B callbackasm1(SB) - MOVD $573, R12 - B callbackasm1(SB) - MOVD $574, R12 - B callbackasm1(SB) - MOVD $575, R12 - B callbackasm1(SB) - MOVD $576, R12 - B callbackasm1(SB) - MOVD $577, R12 - B callbackasm1(SB) - MOVD $578, R12 - B callbackasm1(SB) - MOVD $579, R12 - B callbackasm1(SB) - MOVD $580, R12 - B callbackasm1(SB) - MOVD $581, R12 - B callbackasm1(SB) - MOVD $582, R12 - B callbackasm1(SB) - MOVD $583, R12 - B callbackasm1(SB) - MOVD $584, R12 - B callbackasm1(SB) - MOVD $585, R12 - B callbackasm1(SB) - MOVD $586, R12 - B callbackasm1(SB) - MOVD $587, R12 - B callbackasm1(SB) - MOVD $588, R12 - B callbackasm1(SB) - MOVD $589, R12 - B callbackasm1(SB) - MOVD $590, R12 - B callbackasm1(SB) - MOVD $591, R12 - B callbackasm1(SB) - MOVD $592, R12 - B callbackasm1(SB) - MOVD $593, R12 - B callbackasm1(SB) - MOVD $594, R12 - B callbackasm1(SB) - MOVD $595, R12 - B callbackasm1(SB) - MOVD $596, R12 - B callbackasm1(SB) - MOVD $597, R12 - B callbackasm1(SB) - MOVD $598, R12 - B callbackasm1(SB) - MOVD $599, R12 - B callbackasm1(SB) - MOVD $600, R12 - B callbackasm1(SB) - MOVD $601, R12 - B callbackasm1(SB) - MOVD $602, R12 - B callbackasm1(SB) - MOVD $603, R12 - B callbackasm1(SB) - MOVD $604, R12 - B callbackasm1(SB) - MOVD $605, R12 - B callbackasm1(SB) - MOVD $606, R12 - B callbackasm1(SB) - MOVD $607, R12 - B callbackasm1(SB) - MOVD $608, R12 - B callbackasm1(SB) - MOVD $609, R12 - B callbackasm1(SB) - MOVD $610, R12 - B callbackasm1(SB) - MOVD $611, R12 - B callbackasm1(SB) - MOVD $612, R12 - B callbackasm1(SB) - MOVD $613, R12 - B callbackasm1(SB) - MOVD $614, R12 - B callbackasm1(SB) - MOVD $615, R12 - B callbackasm1(SB) - MOVD $616, R12 - B callbackasm1(SB) - MOVD $617, R12 - B callbackasm1(SB) - MOVD $618, R12 - B callbackasm1(SB) - MOVD $619, R12 - B callbackasm1(SB) - MOVD $620, R12 - B callbackasm1(SB) - MOVD $621, R12 - B callbackasm1(SB) - MOVD $622, R12 - B callbackasm1(SB) - MOVD $623, R12 - B callbackasm1(SB) - MOVD $624, R12 - B callbackasm1(SB) - MOVD $625, R12 - B callbackasm1(SB) - MOVD $626, R12 - B callbackasm1(SB) - MOVD $627, R12 - B callbackasm1(SB) - MOVD $628, R12 - B callbackasm1(SB) - MOVD $629, R12 - B callbackasm1(SB) - MOVD $630, R12 - B callbackasm1(SB) - MOVD $631, R12 - B callbackasm1(SB) - MOVD $632, R12 - B callbackasm1(SB) - MOVD $633, R12 - B callbackasm1(SB) - MOVD $634, R12 - B callbackasm1(SB) - MOVD $635, R12 - B callbackasm1(SB) - MOVD $636, R12 - B callbackasm1(SB) - MOVD $637, R12 - B callbackasm1(SB) - MOVD $638, R12 - B callbackasm1(SB) - MOVD $639, R12 - B callbackasm1(SB) - MOVD $640, R12 - B callbackasm1(SB) - MOVD $641, R12 - B callbackasm1(SB) - MOVD $642, R12 - B callbackasm1(SB) - MOVD $643, R12 - B callbackasm1(SB) - MOVD $644, R12 - B callbackasm1(SB) - MOVD $645, R12 - B callbackasm1(SB) - MOVD $646, R12 - B callbackasm1(SB) - MOVD $647, R12 - B callbackasm1(SB) - MOVD $648, R12 - B callbackasm1(SB) - MOVD $649, R12 - B callbackasm1(SB) - MOVD $650, R12 - B callbackasm1(SB) - MOVD $651, R12 - B callbackasm1(SB) - MOVD $652, R12 - B callbackasm1(SB) - MOVD $653, R12 - B callbackasm1(SB) - MOVD $654, R12 - B callbackasm1(SB) - MOVD $655, R12 - B callbackasm1(SB) - MOVD $656, R12 - B callbackasm1(SB) - MOVD $657, R12 - B callbackasm1(SB) - MOVD $658, R12 - B callbackasm1(SB) - MOVD $659, R12 - B callbackasm1(SB) - MOVD $660, R12 - B callbackasm1(SB) - MOVD $661, R12 - B callbackasm1(SB) - MOVD $662, R12 - B callbackasm1(SB) - MOVD $663, R12 - B callbackasm1(SB) - MOVD $664, R12 - B callbackasm1(SB) - MOVD $665, R12 - B callbackasm1(SB) - MOVD $666, R12 - B callbackasm1(SB) - MOVD $667, R12 - B callbackasm1(SB) - MOVD $668, R12 - B callbackasm1(SB) - MOVD $669, R12 - B callbackasm1(SB) - MOVD $670, R12 - B callbackasm1(SB) - MOVD $671, R12 - B callbackasm1(SB) - MOVD $672, R12 - B callbackasm1(SB) - MOVD $673, R12 - B callbackasm1(SB) - MOVD $674, R12 - B callbackasm1(SB) - MOVD $675, R12 - B callbackasm1(SB) - MOVD $676, R12 - B callbackasm1(SB) - MOVD $677, R12 - B callbackasm1(SB) - MOVD $678, R12 - B callbackasm1(SB) - MOVD $679, R12 - B callbackasm1(SB) - MOVD $680, R12 - B callbackasm1(SB) - MOVD $681, R12 - B callbackasm1(SB) - MOVD $682, R12 - B callbackasm1(SB) - MOVD $683, R12 - B callbackasm1(SB) - MOVD $684, R12 - B callbackasm1(SB) - MOVD $685, R12 - B callbackasm1(SB) - MOVD $686, R12 - B callbackasm1(SB) - MOVD $687, R12 - B callbackasm1(SB) - MOVD $688, R12 - B callbackasm1(SB) - MOVD $689, R12 - B callbackasm1(SB) - MOVD $690, R12 - B callbackasm1(SB) - MOVD $691, R12 - B callbackasm1(SB) - MOVD $692, R12 - B callbackasm1(SB) - MOVD $693, R12 - B callbackasm1(SB) - MOVD $694, R12 - B callbackasm1(SB) - MOVD $695, R12 - B callbackasm1(SB) - MOVD $696, R12 - B callbackasm1(SB) - MOVD $697, R12 - B callbackasm1(SB) - MOVD $698, R12 - B callbackasm1(SB) - MOVD $699, R12 - B callbackasm1(SB) - MOVD $700, R12 - B callbackasm1(SB) - MOVD $701, R12 - B callbackasm1(SB) - MOVD $702, R12 - B callbackasm1(SB) - MOVD $703, R12 - B callbackasm1(SB) - MOVD $704, R12 - B callbackasm1(SB) - MOVD $705, R12 - B callbackasm1(SB) - MOVD $706, R12 - B callbackasm1(SB) - MOVD $707, R12 - B callbackasm1(SB) - MOVD $708, R12 - B callbackasm1(SB) - MOVD $709, R12 - B callbackasm1(SB) - MOVD $710, R12 - B callbackasm1(SB) - MOVD $711, R12 - B callbackasm1(SB) - MOVD $712, R12 - B callbackasm1(SB) - MOVD $713, R12 - B callbackasm1(SB) - MOVD $714, R12 - B callbackasm1(SB) - MOVD $715, R12 - B callbackasm1(SB) - MOVD $716, R12 - B callbackasm1(SB) - MOVD $717, R12 - B callbackasm1(SB) - MOVD $718, R12 - B callbackasm1(SB) - MOVD $719, R12 - B callbackasm1(SB) - MOVD $720, R12 - B callbackasm1(SB) - MOVD $721, R12 - B callbackasm1(SB) - MOVD $722, R12 - B callbackasm1(SB) - MOVD $723, R12 - B callbackasm1(SB) - MOVD $724, R12 - B callbackasm1(SB) - MOVD $725, R12 - B callbackasm1(SB) - MOVD $726, R12 - B callbackasm1(SB) - MOVD $727, R12 - B callbackasm1(SB) - MOVD $728, R12 - B callbackasm1(SB) - MOVD $729, R12 - B callbackasm1(SB) - MOVD $730, R12 - B callbackasm1(SB) - MOVD $731, R12 - B callbackasm1(SB) - MOVD $732, R12 - B callbackasm1(SB) - MOVD $733, R12 - B callbackasm1(SB) - MOVD $734, R12 - B callbackasm1(SB) - MOVD $735, R12 - B callbackasm1(SB) - MOVD $736, R12 - B callbackasm1(SB) - MOVD $737, R12 - B callbackasm1(SB) - MOVD $738, R12 - B callbackasm1(SB) - MOVD $739, R12 - B callbackasm1(SB) - MOVD $740, R12 - B callbackasm1(SB) - MOVD $741, R12 - B callbackasm1(SB) - MOVD $742, R12 - B callbackasm1(SB) - MOVD $743, R12 - B callbackasm1(SB) - MOVD $744, R12 - B callbackasm1(SB) - MOVD $745, R12 - B callbackasm1(SB) - MOVD $746, R12 - B callbackasm1(SB) - MOVD $747, R12 - B callbackasm1(SB) - MOVD $748, R12 - B callbackasm1(SB) - MOVD $749, R12 - B callbackasm1(SB) - MOVD $750, R12 - B callbackasm1(SB) - MOVD $751, R12 - B callbackasm1(SB) - MOVD $752, R12 - B callbackasm1(SB) - MOVD $753, R12 - B callbackasm1(SB) - MOVD $754, R12 - B callbackasm1(SB) - MOVD $755, R12 - B callbackasm1(SB) - MOVD $756, R12 - B callbackasm1(SB) - MOVD $757, R12 - B callbackasm1(SB) - MOVD $758, R12 - B callbackasm1(SB) - MOVD $759, R12 - B callbackasm1(SB) - MOVD $760, R12 - B callbackasm1(SB) - MOVD $761, R12 - B callbackasm1(SB) - MOVD $762, R12 - B callbackasm1(SB) - MOVD $763, R12 - B callbackasm1(SB) - MOVD $764, R12 - B callbackasm1(SB) - MOVD $765, R12 - B callbackasm1(SB) - MOVD $766, R12 - B callbackasm1(SB) - MOVD $767, R12 - B callbackasm1(SB) - MOVD $768, R12 - B callbackasm1(SB) - MOVD $769, R12 - B callbackasm1(SB) - MOVD $770, R12 - B callbackasm1(SB) - MOVD $771, R12 - B callbackasm1(SB) - MOVD $772, R12 - B callbackasm1(SB) - MOVD $773, R12 - B callbackasm1(SB) - MOVD $774, R12 - B callbackasm1(SB) - MOVD $775, R12 - B callbackasm1(SB) - MOVD $776, R12 - B callbackasm1(SB) - MOVD $777, R12 - B callbackasm1(SB) - MOVD $778, R12 - B callbackasm1(SB) - MOVD $779, R12 - B callbackasm1(SB) - MOVD $780, R12 - B callbackasm1(SB) - MOVD $781, R12 - B callbackasm1(SB) - MOVD $782, R12 - B callbackasm1(SB) - MOVD $783, R12 - B callbackasm1(SB) - MOVD $784, R12 - B callbackasm1(SB) - MOVD $785, R12 - B callbackasm1(SB) - MOVD $786, R12 - B callbackasm1(SB) - MOVD $787, R12 - B callbackasm1(SB) - MOVD $788, R12 - B callbackasm1(SB) - MOVD $789, R12 - B callbackasm1(SB) - MOVD $790, R12 - B callbackasm1(SB) - MOVD $791, R12 - B callbackasm1(SB) - MOVD $792, R12 - B callbackasm1(SB) - MOVD $793, R12 - B callbackasm1(SB) - MOVD $794, R12 - B callbackasm1(SB) - MOVD $795, R12 - B callbackasm1(SB) - MOVD $796, R12 - B callbackasm1(SB) - MOVD $797, R12 - B callbackasm1(SB) - MOVD $798, R12 - B callbackasm1(SB) - MOVD $799, R12 - B callbackasm1(SB) - MOVD $800, R12 - B callbackasm1(SB) - MOVD $801, R12 - B callbackasm1(SB) - MOVD $802, R12 - B callbackasm1(SB) - MOVD $803, R12 - B callbackasm1(SB) - MOVD $804, R12 - B callbackasm1(SB) - MOVD $805, R12 - B callbackasm1(SB) - MOVD $806, R12 - B callbackasm1(SB) - MOVD $807, R12 - B callbackasm1(SB) - MOVD $808, R12 - B callbackasm1(SB) - MOVD $809, R12 - B callbackasm1(SB) - MOVD $810, R12 - B callbackasm1(SB) - MOVD $811, R12 - B callbackasm1(SB) - MOVD $812, R12 - B callbackasm1(SB) - MOVD $813, R12 - B callbackasm1(SB) - MOVD $814, R12 - B callbackasm1(SB) - MOVD $815, R12 - B callbackasm1(SB) - MOVD $816, R12 - B callbackasm1(SB) - MOVD $817, R12 - B callbackasm1(SB) - MOVD $818, R12 - B callbackasm1(SB) - MOVD $819, R12 - B callbackasm1(SB) - MOVD $820, R12 - B callbackasm1(SB) - MOVD $821, R12 - B callbackasm1(SB) - MOVD $822, R12 - B callbackasm1(SB) - MOVD $823, R12 - B callbackasm1(SB) - MOVD $824, R12 - B callbackasm1(SB) - MOVD $825, R12 - B callbackasm1(SB) - MOVD $826, R12 - B callbackasm1(SB) - MOVD $827, R12 - B callbackasm1(SB) - MOVD $828, R12 - B callbackasm1(SB) - MOVD $829, R12 - B callbackasm1(SB) - MOVD $830, R12 - B callbackasm1(SB) - MOVD $831, R12 - B callbackasm1(SB) - MOVD $832, R12 - B callbackasm1(SB) - MOVD $833, R12 - B callbackasm1(SB) - MOVD $834, R12 - B callbackasm1(SB) - MOVD $835, R12 - B callbackasm1(SB) - MOVD $836, R12 - B callbackasm1(SB) - MOVD $837, R12 - B callbackasm1(SB) - MOVD $838, R12 - B callbackasm1(SB) - MOVD $839, R12 - B callbackasm1(SB) - MOVD $840, R12 - B callbackasm1(SB) - MOVD $841, R12 - B callbackasm1(SB) - MOVD $842, R12 - B callbackasm1(SB) - MOVD $843, R12 - B callbackasm1(SB) - MOVD $844, R12 - B callbackasm1(SB) - MOVD $845, R12 - B callbackasm1(SB) - MOVD $846, R12 - B callbackasm1(SB) - MOVD $847, R12 - B callbackasm1(SB) - MOVD $848, R12 - B callbackasm1(SB) - MOVD $849, R12 - B callbackasm1(SB) - MOVD $850, R12 - B callbackasm1(SB) - MOVD $851, R12 - B callbackasm1(SB) - MOVD $852, R12 - B callbackasm1(SB) - MOVD $853, R12 - B callbackasm1(SB) - MOVD $854, R12 - B callbackasm1(SB) - MOVD $855, R12 - B callbackasm1(SB) - MOVD $856, R12 - B callbackasm1(SB) - MOVD $857, R12 - B callbackasm1(SB) - MOVD $858, R12 - B callbackasm1(SB) - MOVD $859, R12 - B callbackasm1(SB) - MOVD $860, R12 - B callbackasm1(SB) - MOVD $861, R12 - B callbackasm1(SB) - MOVD $862, R12 - B callbackasm1(SB) - MOVD $863, R12 - B callbackasm1(SB) - MOVD $864, R12 - B callbackasm1(SB) - MOVD $865, R12 - B callbackasm1(SB) - MOVD $866, R12 - B callbackasm1(SB) - MOVD $867, R12 - B callbackasm1(SB) - MOVD $868, R12 - B callbackasm1(SB) - MOVD $869, R12 - B callbackasm1(SB) - MOVD $870, R12 - B callbackasm1(SB) - MOVD $871, R12 - B callbackasm1(SB) - MOVD $872, R12 - B callbackasm1(SB) - MOVD $873, R12 - B callbackasm1(SB) - MOVD $874, R12 - B callbackasm1(SB) - MOVD $875, R12 - B callbackasm1(SB) - MOVD $876, R12 - B callbackasm1(SB) - MOVD $877, R12 - B callbackasm1(SB) - MOVD $878, R12 - B callbackasm1(SB) - MOVD $879, R12 - B callbackasm1(SB) - MOVD $880, R12 - B callbackasm1(SB) - MOVD $881, R12 - B callbackasm1(SB) - MOVD $882, R12 - B callbackasm1(SB) - MOVD $883, R12 - B callbackasm1(SB) - MOVD $884, R12 - B callbackasm1(SB) - MOVD $885, R12 - B callbackasm1(SB) - MOVD $886, R12 - B callbackasm1(SB) - MOVD $887, R12 - B callbackasm1(SB) - MOVD $888, R12 - B callbackasm1(SB) - MOVD $889, R12 - B callbackasm1(SB) - MOVD $890, R12 - B callbackasm1(SB) - MOVD $891, R12 - B callbackasm1(SB) - MOVD $892, R12 - B callbackasm1(SB) - MOVD $893, R12 - B callbackasm1(SB) - MOVD $894, R12 - B callbackasm1(SB) - MOVD $895, R12 - B callbackasm1(SB) - MOVD $896, R12 - B callbackasm1(SB) - MOVD $897, R12 - B callbackasm1(SB) - MOVD $898, R12 - B callbackasm1(SB) - MOVD $899, R12 - B callbackasm1(SB) - MOVD $900, R12 - B callbackasm1(SB) - MOVD $901, R12 - B callbackasm1(SB) - MOVD $902, R12 - B callbackasm1(SB) - MOVD $903, R12 - B callbackasm1(SB) - MOVD $904, R12 - B callbackasm1(SB) - MOVD $905, R12 - B callbackasm1(SB) - MOVD $906, R12 - B callbackasm1(SB) - MOVD $907, R12 - B callbackasm1(SB) - MOVD $908, R12 - B callbackasm1(SB) - MOVD $909, R12 - B callbackasm1(SB) - MOVD $910, R12 - B callbackasm1(SB) - MOVD $911, R12 - B callbackasm1(SB) - MOVD $912, R12 - B callbackasm1(SB) - MOVD $913, R12 - B callbackasm1(SB) - MOVD $914, R12 - B callbackasm1(SB) - MOVD $915, R12 - B callbackasm1(SB) - MOVD $916, R12 - B callbackasm1(SB) - MOVD $917, R12 - B callbackasm1(SB) - MOVD $918, R12 - B callbackasm1(SB) - MOVD $919, R12 - B callbackasm1(SB) - MOVD $920, R12 - B callbackasm1(SB) - MOVD $921, R12 - B callbackasm1(SB) - MOVD $922, R12 - B callbackasm1(SB) - MOVD $923, R12 - B callbackasm1(SB) - MOVD $924, R12 - B callbackasm1(SB) - MOVD $925, R12 - B callbackasm1(SB) - MOVD $926, R12 - B callbackasm1(SB) - MOVD $927, R12 - B callbackasm1(SB) - MOVD $928, R12 - B callbackasm1(SB) - MOVD $929, R12 - B callbackasm1(SB) - MOVD $930, R12 - B callbackasm1(SB) - MOVD $931, R12 - B callbackasm1(SB) - MOVD $932, R12 - B callbackasm1(SB) - MOVD $933, R12 - B callbackasm1(SB) - MOVD $934, R12 - B callbackasm1(SB) - MOVD $935, R12 - B callbackasm1(SB) - MOVD $936, R12 - B callbackasm1(SB) - MOVD $937, R12 - B callbackasm1(SB) - MOVD $938, R12 - B callbackasm1(SB) - MOVD $939, R12 - B callbackasm1(SB) - MOVD $940, R12 - B callbackasm1(SB) - MOVD $941, R12 - B callbackasm1(SB) - MOVD $942, R12 - B callbackasm1(SB) - MOVD $943, R12 - B callbackasm1(SB) - MOVD $944, R12 - B callbackasm1(SB) - MOVD $945, R12 - B callbackasm1(SB) - MOVD $946, R12 - B callbackasm1(SB) - MOVD $947, R12 - B callbackasm1(SB) - MOVD $948, R12 - B callbackasm1(SB) - MOVD $949, R12 - B callbackasm1(SB) - MOVD $950, R12 - B callbackasm1(SB) - MOVD $951, R12 - B callbackasm1(SB) - MOVD $952, R12 - B callbackasm1(SB) - MOVD $953, R12 - B callbackasm1(SB) - MOVD $954, R12 - B callbackasm1(SB) - MOVD $955, R12 - B callbackasm1(SB) - MOVD $956, R12 - B callbackasm1(SB) - MOVD $957, R12 - B callbackasm1(SB) - MOVD $958, R12 - B callbackasm1(SB) - MOVD $959, R12 - B callbackasm1(SB) - MOVD $960, R12 - B callbackasm1(SB) - MOVD $961, R12 - B callbackasm1(SB) - MOVD $962, R12 - B callbackasm1(SB) - MOVD $963, R12 - B callbackasm1(SB) - MOVD $964, R12 - B callbackasm1(SB) - MOVD $965, R12 - B callbackasm1(SB) - MOVD $966, R12 - B callbackasm1(SB) - MOVD $967, R12 - B callbackasm1(SB) - MOVD $968, R12 - B callbackasm1(SB) - MOVD $969, R12 - B callbackasm1(SB) - MOVD $970, R12 - B callbackasm1(SB) - MOVD $971, R12 - B callbackasm1(SB) - MOVD $972, R12 - B callbackasm1(SB) - MOVD $973, R12 - B callbackasm1(SB) - MOVD $974, R12 - B callbackasm1(SB) - MOVD $975, R12 - B callbackasm1(SB) - MOVD $976, R12 - B callbackasm1(SB) - MOVD $977, R12 - B callbackasm1(SB) - MOVD $978, R12 - B callbackasm1(SB) - MOVD $979, R12 - B callbackasm1(SB) - MOVD $980, R12 - B callbackasm1(SB) - MOVD $981, R12 - B callbackasm1(SB) - MOVD $982, R12 - B callbackasm1(SB) - MOVD $983, R12 - B callbackasm1(SB) - MOVD $984, R12 - B callbackasm1(SB) - MOVD $985, R12 - B callbackasm1(SB) - MOVD $986, R12 - B callbackasm1(SB) - MOVD $987, R12 - B callbackasm1(SB) - MOVD $988, R12 - B callbackasm1(SB) - MOVD $989, R12 - B callbackasm1(SB) - MOVD $990, R12 - B callbackasm1(SB) - MOVD $991, R12 - B callbackasm1(SB) - MOVD $992, R12 - B callbackasm1(SB) - MOVD $993, R12 - B callbackasm1(SB) - MOVD $994, R12 - B callbackasm1(SB) - MOVD $995, R12 - B callbackasm1(SB) - MOVD $996, R12 - B callbackasm1(SB) - MOVD $997, R12 - B callbackasm1(SB) - MOVD $998, R12 - B callbackasm1(SB) - MOVD $999, R12 - B callbackasm1(SB) - MOVD $1000, R12 - B callbackasm1(SB) - MOVD $1001, R12 - B callbackasm1(SB) - MOVD $1002, R12 - B callbackasm1(SB) - MOVD $1003, R12 - B callbackasm1(SB) - MOVD $1004, R12 - B callbackasm1(SB) - MOVD $1005, R12 - B callbackasm1(SB) - MOVD $1006, R12 - B callbackasm1(SB) - MOVD $1007, R12 - B callbackasm1(SB) - MOVD $1008, R12 - B callbackasm1(SB) - MOVD $1009, R12 - B callbackasm1(SB) - MOVD $1010, R12 - B callbackasm1(SB) - MOVD $1011, R12 - B callbackasm1(SB) - MOVD $1012, R12 - B callbackasm1(SB) - MOVD $1013, R12 - B callbackasm1(SB) - MOVD $1014, R12 - B callbackasm1(SB) - MOVD $1015, R12 - B callbackasm1(SB) - MOVD $1016, R12 - B callbackasm1(SB) - MOVD $1017, R12 - B callbackasm1(SB) - MOVD $1018, R12 - B callbackasm1(SB) - MOVD $1019, R12 - B callbackasm1(SB) - MOVD $1020, R12 - B callbackasm1(SB) - MOVD $1021, R12 - B callbackasm1(SB) - MOVD $1022, R12 - B callbackasm1(SB) - MOVD $1023, R12 - B callbackasm1(SB) - MOVD $1024, R12 - B callbackasm1(SB) - MOVD $1025, R12 - B callbackasm1(SB) - MOVD $1026, R12 - B callbackasm1(SB) - MOVD $1027, R12 - B callbackasm1(SB) - MOVD $1028, R12 - B callbackasm1(SB) - MOVD $1029, R12 - B callbackasm1(SB) - MOVD $1030, R12 - B callbackasm1(SB) - MOVD $1031, R12 - B callbackasm1(SB) - MOVD $1032, R12 - B callbackasm1(SB) - MOVD $1033, R12 - B callbackasm1(SB) - MOVD $1034, R12 - B callbackasm1(SB) - MOVD $1035, R12 - B callbackasm1(SB) - MOVD $1036, R12 - B callbackasm1(SB) - MOVD $1037, R12 - B callbackasm1(SB) - MOVD $1038, R12 - B callbackasm1(SB) - MOVD $1039, R12 - B callbackasm1(SB) - MOVD $1040, R12 - B callbackasm1(SB) - MOVD $1041, R12 - B callbackasm1(SB) - MOVD $1042, R12 - B callbackasm1(SB) - MOVD $1043, R12 - B callbackasm1(SB) - MOVD $1044, R12 - B callbackasm1(SB) - MOVD $1045, R12 - B callbackasm1(SB) - MOVD $1046, R12 - B callbackasm1(SB) - MOVD $1047, R12 - B callbackasm1(SB) - MOVD $1048, R12 - B callbackasm1(SB) - MOVD $1049, R12 - B callbackasm1(SB) - MOVD $1050, R12 - B callbackasm1(SB) - MOVD $1051, R12 - B callbackasm1(SB) - MOVD $1052, R12 - B callbackasm1(SB) - MOVD $1053, R12 - B callbackasm1(SB) - MOVD $1054, R12 - B callbackasm1(SB) - MOVD $1055, R12 - B callbackasm1(SB) - MOVD $1056, R12 - B callbackasm1(SB) - MOVD $1057, R12 - B callbackasm1(SB) - MOVD $1058, R12 - B callbackasm1(SB) - MOVD $1059, R12 - B callbackasm1(SB) - MOVD $1060, R12 - B callbackasm1(SB) - MOVD $1061, R12 - B callbackasm1(SB) - MOVD $1062, R12 - B callbackasm1(SB) - MOVD $1063, R12 - B callbackasm1(SB) - MOVD $1064, R12 - B callbackasm1(SB) - MOVD $1065, R12 - B callbackasm1(SB) - MOVD $1066, R12 - B callbackasm1(SB) - MOVD $1067, R12 - B callbackasm1(SB) - MOVD $1068, R12 - B callbackasm1(SB) - MOVD $1069, R12 - B callbackasm1(SB) - MOVD $1070, R12 - B callbackasm1(SB) - MOVD $1071, R12 - B callbackasm1(SB) - MOVD $1072, R12 - B callbackasm1(SB) - MOVD $1073, R12 - B callbackasm1(SB) - MOVD $1074, R12 - B callbackasm1(SB) - MOVD $1075, R12 - B callbackasm1(SB) - MOVD $1076, R12 - B callbackasm1(SB) - MOVD $1077, R12 - B callbackasm1(SB) - MOVD $1078, R12 - B callbackasm1(SB) - MOVD $1079, R12 - B callbackasm1(SB) - MOVD $1080, R12 - B callbackasm1(SB) - MOVD $1081, R12 - B callbackasm1(SB) - MOVD $1082, R12 - B callbackasm1(SB) - MOVD $1083, R12 - B callbackasm1(SB) - MOVD $1084, R12 - B callbackasm1(SB) - MOVD $1085, R12 - B callbackasm1(SB) - MOVD $1086, R12 - B callbackasm1(SB) - MOVD $1087, R12 - B callbackasm1(SB) - MOVD $1088, R12 - B callbackasm1(SB) - MOVD $1089, R12 - B callbackasm1(SB) - MOVD $1090, R12 - B callbackasm1(SB) - MOVD $1091, R12 - B callbackasm1(SB) - MOVD $1092, R12 - B callbackasm1(SB) - MOVD $1093, R12 - B callbackasm1(SB) - MOVD $1094, R12 - B callbackasm1(SB) - MOVD $1095, R12 - B callbackasm1(SB) - MOVD $1096, R12 - B callbackasm1(SB) - MOVD $1097, R12 - B callbackasm1(SB) - MOVD $1098, R12 - B callbackasm1(SB) - MOVD $1099, R12 - B callbackasm1(SB) - MOVD $1100, R12 - B callbackasm1(SB) - MOVD $1101, R12 - B callbackasm1(SB) - MOVD $1102, R12 - B callbackasm1(SB) - MOVD $1103, R12 - B callbackasm1(SB) - MOVD $1104, R12 - B callbackasm1(SB) - MOVD $1105, R12 - B callbackasm1(SB) - MOVD $1106, R12 - B callbackasm1(SB) - MOVD $1107, R12 - B callbackasm1(SB) - MOVD $1108, R12 - B callbackasm1(SB) - MOVD $1109, R12 - B callbackasm1(SB) - MOVD $1110, R12 - B callbackasm1(SB) - MOVD $1111, R12 - B callbackasm1(SB) - MOVD $1112, R12 - B callbackasm1(SB) - MOVD $1113, R12 - B callbackasm1(SB) - MOVD $1114, R12 - B callbackasm1(SB) - MOVD $1115, R12 - B callbackasm1(SB) - MOVD $1116, R12 - B callbackasm1(SB) - MOVD $1117, R12 - B callbackasm1(SB) - MOVD $1118, R12 - B callbackasm1(SB) - MOVD $1119, R12 - B callbackasm1(SB) - MOVD $1120, R12 - B callbackasm1(SB) - MOVD $1121, R12 - B callbackasm1(SB) - MOVD $1122, R12 - B callbackasm1(SB) - MOVD $1123, R12 - B callbackasm1(SB) - MOVD $1124, R12 - B callbackasm1(SB) - MOVD $1125, R12 - B callbackasm1(SB) - MOVD $1126, R12 - B callbackasm1(SB) - MOVD $1127, R12 - B callbackasm1(SB) - MOVD $1128, R12 - B callbackasm1(SB) - MOVD $1129, R12 - B callbackasm1(SB) - MOVD $1130, R12 - B callbackasm1(SB) - MOVD $1131, R12 - B callbackasm1(SB) - MOVD $1132, R12 - B callbackasm1(SB) - MOVD $1133, R12 - B callbackasm1(SB) - MOVD $1134, R12 - B callbackasm1(SB) - MOVD $1135, R12 - B callbackasm1(SB) - MOVD $1136, R12 - B callbackasm1(SB) - MOVD $1137, R12 - B callbackasm1(SB) - MOVD $1138, R12 - B callbackasm1(SB) - MOVD $1139, R12 - B callbackasm1(SB) - MOVD $1140, R12 - B callbackasm1(SB) - MOVD $1141, R12 - B callbackasm1(SB) - MOVD $1142, R12 - B callbackasm1(SB) - MOVD $1143, R12 - B callbackasm1(SB) - MOVD $1144, R12 - B callbackasm1(SB) - MOVD $1145, R12 - B callbackasm1(SB) - MOVD $1146, R12 - B callbackasm1(SB) - MOVD $1147, R12 - B callbackasm1(SB) - MOVD $1148, R12 - B callbackasm1(SB) - MOVD $1149, R12 - B callbackasm1(SB) - MOVD $1150, R12 - B callbackasm1(SB) - MOVD $1151, R12 - B callbackasm1(SB) - MOVD $1152, R12 - B callbackasm1(SB) - MOVD $1153, R12 - B callbackasm1(SB) - MOVD $1154, R12 - B callbackasm1(SB) - MOVD $1155, R12 - B callbackasm1(SB) - MOVD $1156, R12 - B callbackasm1(SB) - MOVD $1157, R12 - B callbackasm1(SB) - MOVD $1158, R12 - B callbackasm1(SB) - MOVD $1159, R12 - B callbackasm1(SB) - MOVD $1160, R12 - B callbackasm1(SB) - MOVD $1161, R12 - B callbackasm1(SB) - MOVD $1162, R12 - B callbackasm1(SB) - MOVD $1163, R12 - B callbackasm1(SB) - MOVD $1164, R12 - B callbackasm1(SB) - MOVD $1165, R12 - B callbackasm1(SB) - MOVD $1166, R12 - B callbackasm1(SB) - MOVD $1167, R12 - B callbackasm1(SB) - MOVD $1168, R12 - B callbackasm1(SB) - MOVD $1169, R12 - B callbackasm1(SB) - MOVD $1170, R12 - B callbackasm1(SB) - MOVD $1171, R12 - B callbackasm1(SB) - MOVD $1172, R12 - B callbackasm1(SB) - MOVD $1173, R12 - B callbackasm1(SB) - MOVD $1174, R12 - B callbackasm1(SB) - MOVD $1175, R12 - B callbackasm1(SB) - MOVD $1176, R12 - B callbackasm1(SB) - MOVD $1177, R12 - B callbackasm1(SB) - MOVD $1178, R12 - B callbackasm1(SB) - MOVD $1179, R12 - B callbackasm1(SB) - MOVD $1180, R12 - B callbackasm1(SB) - MOVD $1181, R12 - B callbackasm1(SB) - MOVD $1182, R12 - B callbackasm1(SB) - MOVD $1183, R12 - B callbackasm1(SB) - MOVD $1184, R12 - B callbackasm1(SB) - MOVD $1185, R12 - B callbackasm1(SB) - MOVD $1186, R12 - B callbackasm1(SB) - MOVD $1187, R12 - B callbackasm1(SB) - MOVD $1188, R12 - B callbackasm1(SB) - MOVD $1189, R12 - B callbackasm1(SB) - MOVD $1190, R12 - B callbackasm1(SB) - MOVD $1191, R12 - B callbackasm1(SB) - MOVD $1192, R12 - B callbackasm1(SB) - MOVD $1193, R12 - B callbackasm1(SB) - MOVD $1194, R12 - B callbackasm1(SB) - MOVD $1195, R12 - B callbackasm1(SB) - MOVD $1196, R12 - B callbackasm1(SB) - MOVD $1197, R12 - B callbackasm1(SB) - MOVD $1198, R12 - B callbackasm1(SB) - MOVD $1199, R12 - B callbackasm1(SB) - MOVD $1200, R12 - B callbackasm1(SB) - MOVD $1201, R12 - B callbackasm1(SB) - MOVD $1202, R12 - B callbackasm1(SB) - MOVD $1203, R12 - B callbackasm1(SB) - MOVD $1204, R12 - B callbackasm1(SB) - MOVD $1205, R12 - B callbackasm1(SB) - MOVD $1206, R12 - B callbackasm1(SB) - MOVD $1207, R12 - B callbackasm1(SB) - MOVD $1208, R12 - B callbackasm1(SB) - MOVD $1209, R12 - B callbackasm1(SB) - MOVD $1210, R12 - B callbackasm1(SB) - MOVD $1211, R12 - B callbackasm1(SB) - MOVD $1212, R12 - B callbackasm1(SB) - MOVD $1213, R12 - B callbackasm1(SB) - MOVD $1214, R12 - B callbackasm1(SB) - MOVD $1215, R12 - B callbackasm1(SB) - MOVD $1216, R12 - B callbackasm1(SB) - MOVD $1217, R12 - B callbackasm1(SB) - MOVD $1218, R12 - B callbackasm1(SB) - MOVD $1219, R12 - B callbackasm1(SB) - MOVD $1220, R12 - B callbackasm1(SB) - MOVD $1221, R12 - B callbackasm1(SB) - MOVD $1222, R12 - B callbackasm1(SB) - MOVD $1223, R12 - B callbackasm1(SB) - MOVD $1224, R12 - B callbackasm1(SB) - MOVD $1225, R12 - B callbackasm1(SB) - MOVD $1226, R12 - B callbackasm1(SB) - MOVD $1227, R12 - B callbackasm1(SB) - MOVD $1228, R12 - B callbackasm1(SB) - MOVD $1229, R12 - B callbackasm1(SB) - MOVD $1230, R12 - B callbackasm1(SB) - MOVD $1231, R12 - B callbackasm1(SB) - MOVD $1232, R12 - B callbackasm1(SB) - MOVD $1233, R12 - B callbackasm1(SB) - MOVD $1234, R12 - B callbackasm1(SB) - MOVD $1235, R12 - B callbackasm1(SB) - MOVD $1236, R12 - B callbackasm1(SB) - MOVD $1237, R12 - B callbackasm1(SB) - MOVD $1238, R12 - B callbackasm1(SB) - MOVD $1239, R12 - B callbackasm1(SB) - MOVD $1240, R12 - B callbackasm1(SB) - MOVD $1241, R12 - B callbackasm1(SB) - MOVD $1242, R12 - B callbackasm1(SB) - MOVD $1243, R12 - B callbackasm1(SB) - MOVD $1244, R12 - B callbackasm1(SB) - MOVD $1245, R12 - B callbackasm1(SB) - MOVD $1246, R12 - B callbackasm1(SB) - MOVD $1247, R12 - B callbackasm1(SB) - MOVD $1248, R12 - B callbackasm1(SB) - MOVD $1249, R12 - B callbackasm1(SB) - MOVD $1250, R12 - B callbackasm1(SB) - MOVD $1251, R12 - B callbackasm1(SB) - MOVD $1252, R12 - B callbackasm1(SB) - MOVD $1253, R12 - B callbackasm1(SB) - MOVD $1254, R12 - B callbackasm1(SB) - MOVD $1255, R12 - B callbackasm1(SB) - MOVD $1256, R12 - B callbackasm1(SB) - MOVD $1257, R12 - B callbackasm1(SB) - MOVD $1258, R12 - B callbackasm1(SB) - MOVD $1259, R12 - B callbackasm1(SB) - MOVD $1260, R12 - B callbackasm1(SB) - MOVD $1261, R12 - B callbackasm1(SB) - MOVD $1262, R12 - B callbackasm1(SB) - MOVD $1263, R12 - B callbackasm1(SB) - MOVD $1264, R12 - B callbackasm1(SB) - MOVD $1265, R12 - B callbackasm1(SB) - MOVD $1266, R12 - B callbackasm1(SB) - MOVD $1267, R12 - B callbackasm1(SB) - MOVD $1268, R12 - B callbackasm1(SB) - MOVD $1269, R12 - B callbackasm1(SB) - MOVD $1270, R12 - B callbackasm1(SB) - MOVD $1271, R12 - B callbackasm1(SB) - MOVD $1272, R12 - B callbackasm1(SB) - MOVD $1273, R12 - B callbackasm1(SB) - MOVD $1274, R12 - B callbackasm1(SB) - MOVD $1275, R12 - B callbackasm1(SB) - MOVD $1276, R12 - B callbackasm1(SB) - MOVD $1277, R12 - B callbackasm1(SB) - MOVD $1278, R12 - B callbackasm1(SB) - MOVD $1279, R12 - B callbackasm1(SB) - MOVD $1280, R12 - B callbackasm1(SB) - MOVD $1281, R12 - B callbackasm1(SB) - MOVD $1282, R12 - B callbackasm1(SB) - MOVD $1283, R12 - B callbackasm1(SB) - MOVD $1284, R12 - B callbackasm1(SB) - MOVD $1285, R12 - B callbackasm1(SB) - MOVD $1286, R12 - B callbackasm1(SB) - MOVD $1287, R12 - B callbackasm1(SB) - MOVD $1288, R12 - B callbackasm1(SB) - MOVD $1289, R12 - B callbackasm1(SB) - MOVD $1290, R12 - B callbackasm1(SB) - MOVD $1291, R12 - B callbackasm1(SB) - MOVD $1292, R12 - B callbackasm1(SB) - MOVD $1293, R12 - B callbackasm1(SB) - MOVD $1294, R12 - B callbackasm1(SB) - MOVD $1295, R12 - B callbackasm1(SB) - MOVD $1296, R12 - B callbackasm1(SB) - MOVD $1297, R12 - B callbackasm1(SB) - MOVD $1298, R12 - B callbackasm1(SB) - MOVD $1299, R12 - B callbackasm1(SB) - MOVD $1300, R12 - B callbackasm1(SB) - MOVD $1301, R12 - B callbackasm1(SB) - MOVD $1302, R12 - B callbackasm1(SB) - MOVD $1303, R12 - B callbackasm1(SB) - MOVD $1304, R12 - B callbackasm1(SB) - MOVD $1305, R12 - B callbackasm1(SB) - MOVD $1306, R12 - B callbackasm1(SB) - MOVD $1307, R12 - B callbackasm1(SB) - MOVD $1308, R12 - B callbackasm1(SB) - MOVD $1309, R12 - B callbackasm1(SB) - MOVD $1310, R12 - B callbackasm1(SB) - MOVD $1311, R12 - B callbackasm1(SB) - MOVD $1312, R12 - B callbackasm1(SB) - MOVD $1313, R12 - B callbackasm1(SB) - MOVD $1314, R12 - B callbackasm1(SB) - MOVD $1315, R12 - B callbackasm1(SB) - MOVD $1316, R12 - B callbackasm1(SB) - MOVD $1317, R12 - B callbackasm1(SB) - MOVD $1318, R12 - B callbackasm1(SB) - MOVD $1319, R12 - B callbackasm1(SB) - MOVD $1320, R12 - B callbackasm1(SB) - MOVD $1321, R12 - B callbackasm1(SB) - MOVD $1322, R12 - B callbackasm1(SB) - MOVD $1323, R12 - B callbackasm1(SB) - MOVD $1324, R12 - B callbackasm1(SB) - MOVD $1325, R12 - B callbackasm1(SB) - MOVD $1326, R12 - B callbackasm1(SB) - MOVD $1327, R12 - B callbackasm1(SB) - MOVD $1328, R12 - B callbackasm1(SB) - MOVD $1329, R12 - B callbackasm1(SB) - MOVD $1330, R12 - B callbackasm1(SB) - MOVD $1331, R12 - B callbackasm1(SB) - MOVD $1332, R12 - B callbackasm1(SB) - MOVD $1333, R12 - B callbackasm1(SB) - MOVD $1334, R12 - B callbackasm1(SB) - MOVD $1335, R12 - B callbackasm1(SB) - MOVD $1336, R12 - B callbackasm1(SB) - MOVD $1337, R12 - B callbackasm1(SB) - MOVD $1338, R12 - B callbackasm1(SB) - MOVD $1339, R12 - B callbackasm1(SB) - MOVD $1340, R12 - B callbackasm1(SB) - MOVD $1341, R12 - B callbackasm1(SB) - MOVD $1342, R12 - B callbackasm1(SB) - MOVD $1343, R12 - B callbackasm1(SB) - MOVD $1344, R12 - B callbackasm1(SB) - MOVD $1345, R12 - B callbackasm1(SB) - MOVD $1346, R12 - B callbackasm1(SB) - MOVD $1347, R12 - B callbackasm1(SB) - MOVD $1348, R12 - B callbackasm1(SB) - MOVD $1349, R12 - B callbackasm1(SB) - MOVD $1350, R12 - B callbackasm1(SB) - MOVD $1351, R12 - B callbackasm1(SB) - MOVD $1352, R12 - B callbackasm1(SB) - MOVD $1353, R12 - B callbackasm1(SB) - MOVD $1354, R12 - B callbackasm1(SB) - MOVD $1355, R12 - B callbackasm1(SB) - MOVD $1356, R12 - B callbackasm1(SB) - MOVD $1357, R12 - B callbackasm1(SB) - MOVD $1358, R12 - B callbackasm1(SB) - MOVD $1359, R12 - B callbackasm1(SB) - MOVD $1360, R12 - B callbackasm1(SB) - MOVD $1361, R12 - B callbackasm1(SB) - MOVD $1362, R12 - B callbackasm1(SB) - MOVD $1363, R12 - B callbackasm1(SB) - MOVD $1364, R12 - B callbackasm1(SB) - MOVD $1365, R12 - B callbackasm1(SB) - MOVD $1366, R12 - B callbackasm1(SB) - MOVD $1367, R12 - B callbackasm1(SB) - MOVD $1368, R12 - B callbackasm1(SB) - MOVD $1369, R12 - B callbackasm1(SB) - MOVD $1370, R12 - B callbackasm1(SB) - MOVD $1371, R12 - B callbackasm1(SB) - MOVD $1372, R12 - B callbackasm1(SB) - MOVD $1373, R12 - B callbackasm1(SB) - MOVD $1374, R12 - B callbackasm1(SB) - MOVD $1375, R12 - B callbackasm1(SB) - MOVD $1376, R12 - B callbackasm1(SB) - MOVD $1377, R12 - B callbackasm1(SB) - MOVD $1378, R12 - B callbackasm1(SB) - MOVD $1379, R12 - B callbackasm1(SB) - MOVD $1380, R12 - B callbackasm1(SB) - MOVD $1381, R12 - B callbackasm1(SB) - MOVD $1382, R12 - B callbackasm1(SB) - MOVD $1383, R12 - B callbackasm1(SB) - MOVD $1384, R12 - B callbackasm1(SB) - MOVD $1385, R12 - B callbackasm1(SB) - MOVD $1386, R12 - B callbackasm1(SB) - MOVD $1387, R12 - B callbackasm1(SB) - MOVD $1388, R12 - B callbackasm1(SB) - MOVD $1389, R12 - B callbackasm1(SB) - MOVD $1390, R12 - B callbackasm1(SB) - MOVD $1391, R12 - B callbackasm1(SB) - MOVD $1392, R12 - B callbackasm1(SB) - MOVD $1393, R12 - B callbackasm1(SB) - MOVD $1394, R12 - B callbackasm1(SB) - MOVD $1395, R12 - B callbackasm1(SB) - MOVD $1396, R12 - B callbackasm1(SB) - MOVD $1397, R12 - B callbackasm1(SB) - MOVD $1398, R12 - B callbackasm1(SB) - MOVD $1399, R12 - B callbackasm1(SB) - MOVD $1400, R12 - B callbackasm1(SB) - MOVD $1401, R12 - B callbackasm1(SB) - MOVD $1402, R12 - B callbackasm1(SB) - MOVD $1403, R12 - B callbackasm1(SB) - MOVD $1404, R12 - B callbackasm1(SB) - MOVD $1405, R12 - B callbackasm1(SB) - MOVD $1406, R12 - B callbackasm1(SB) - MOVD $1407, R12 - B callbackasm1(SB) - MOVD $1408, R12 - B callbackasm1(SB) - MOVD $1409, R12 - B callbackasm1(SB) - MOVD $1410, R12 - B callbackasm1(SB) - MOVD $1411, R12 - B callbackasm1(SB) - MOVD $1412, R12 - B callbackasm1(SB) - MOVD $1413, R12 - B callbackasm1(SB) - MOVD $1414, R12 - B callbackasm1(SB) - MOVD $1415, R12 - B callbackasm1(SB) - MOVD $1416, R12 - B callbackasm1(SB) - MOVD $1417, R12 - B callbackasm1(SB) - MOVD $1418, R12 - B callbackasm1(SB) - MOVD $1419, R12 - B callbackasm1(SB) - MOVD $1420, R12 - B callbackasm1(SB) - MOVD $1421, R12 - B callbackasm1(SB) - MOVD $1422, R12 - B callbackasm1(SB) - MOVD $1423, R12 - B callbackasm1(SB) - MOVD $1424, R12 - B callbackasm1(SB) - MOVD $1425, R12 - B callbackasm1(SB) - MOVD $1426, R12 - B callbackasm1(SB) - MOVD $1427, R12 - B callbackasm1(SB) - MOVD $1428, R12 - B callbackasm1(SB) - MOVD $1429, R12 - B callbackasm1(SB) - MOVD $1430, R12 - B callbackasm1(SB) - MOVD $1431, R12 - B callbackasm1(SB) - MOVD $1432, R12 - B callbackasm1(SB) - MOVD $1433, R12 - B callbackasm1(SB) - MOVD $1434, R12 - B callbackasm1(SB) - MOVD $1435, R12 - B callbackasm1(SB) - MOVD $1436, R12 - B callbackasm1(SB) - MOVD $1437, R12 - B callbackasm1(SB) - MOVD $1438, R12 - B callbackasm1(SB) - MOVD $1439, R12 - B callbackasm1(SB) - MOVD $1440, R12 - B callbackasm1(SB) - MOVD $1441, R12 - B callbackasm1(SB) - MOVD $1442, R12 - B callbackasm1(SB) - MOVD $1443, R12 - B callbackasm1(SB) - MOVD $1444, R12 - B callbackasm1(SB) - MOVD $1445, R12 - B callbackasm1(SB) - MOVD $1446, R12 - B callbackasm1(SB) - MOVD $1447, R12 - B callbackasm1(SB) - MOVD $1448, R12 - B callbackasm1(SB) - MOVD $1449, R12 - B callbackasm1(SB) - MOVD $1450, R12 - B callbackasm1(SB) - MOVD $1451, R12 - B callbackasm1(SB) - MOVD $1452, R12 - B callbackasm1(SB) - MOVD $1453, R12 - B callbackasm1(SB) - MOVD $1454, R12 - B callbackasm1(SB) - MOVD $1455, R12 - B callbackasm1(SB) - MOVD $1456, R12 - B callbackasm1(SB) - MOVD $1457, R12 - B callbackasm1(SB) - MOVD $1458, R12 - B callbackasm1(SB) - MOVD $1459, R12 - B callbackasm1(SB) - MOVD $1460, R12 - B callbackasm1(SB) - MOVD $1461, R12 - B callbackasm1(SB) - MOVD $1462, R12 - B callbackasm1(SB) - MOVD $1463, R12 - B callbackasm1(SB) - MOVD $1464, R12 - B callbackasm1(SB) - MOVD $1465, R12 - B callbackasm1(SB) - MOVD $1466, R12 - B callbackasm1(SB) - MOVD $1467, R12 - B callbackasm1(SB) - MOVD $1468, R12 - B callbackasm1(SB) - MOVD $1469, R12 - B callbackasm1(SB) - MOVD $1470, R12 - B callbackasm1(SB) - MOVD $1471, R12 - B callbackasm1(SB) - MOVD $1472, R12 - B callbackasm1(SB) - MOVD $1473, R12 - B callbackasm1(SB) - MOVD $1474, R12 - B callbackasm1(SB) - MOVD $1475, R12 - B callbackasm1(SB) - MOVD $1476, R12 - B callbackasm1(SB) - MOVD $1477, R12 - B callbackasm1(SB) - MOVD $1478, R12 - B callbackasm1(SB) - MOVD $1479, R12 - B callbackasm1(SB) - MOVD $1480, R12 - B callbackasm1(SB) - MOVD $1481, R12 - B callbackasm1(SB) - MOVD $1482, R12 - B callbackasm1(SB) - MOVD $1483, R12 - B callbackasm1(SB) - MOVD $1484, R12 - B callbackasm1(SB) - MOVD $1485, R12 - B callbackasm1(SB) - MOVD $1486, R12 - B callbackasm1(SB) - MOVD $1487, R12 - B callbackasm1(SB) - MOVD $1488, R12 - B callbackasm1(SB) - MOVD $1489, R12 - B callbackasm1(SB) - MOVD $1490, R12 - B callbackasm1(SB) - MOVD $1491, R12 - B callbackasm1(SB) - MOVD $1492, R12 - B callbackasm1(SB) - MOVD $1493, R12 - B callbackasm1(SB) - MOVD $1494, R12 - B callbackasm1(SB) - MOVD $1495, R12 - B callbackasm1(SB) - MOVD $1496, R12 - B callbackasm1(SB) - MOVD $1497, R12 - B callbackasm1(SB) - MOVD $1498, R12 - B callbackasm1(SB) - MOVD $1499, R12 - B callbackasm1(SB) - MOVD $1500, R12 - B callbackasm1(SB) - MOVD $1501, R12 - B callbackasm1(SB) - MOVD $1502, R12 - B callbackasm1(SB) - MOVD $1503, R12 - B callbackasm1(SB) - MOVD $1504, R12 - B callbackasm1(SB) - MOVD $1505, R12 - B callbackasm1(SB) - MOVD $1506, R12 - B callbackasm1(SB) - MOVD $1507, R12 - B callbackasm1(SB) - MOVD $1508, R12 - B callbackasm1(SB) - MOVD $1509, R12 - B callbackasm1(SB) - MOVD $1510, R12 - B callbackasm1(SB) - MOVD $1511, R12 - B callbackasm1(SB) - MOVD $1512, R12 - B callbackasm1(SB) - MOVD $1513, R12 - B callbackasm1(SB) - MOVD $1514, R12 - B callbackasm1(SB) - MOVD $1515, R12 - B callbackasm1(SB) - MOVD $1516, R12 - B callbackasm1(SB) - MOVD $1517, R12 - B callbackasm1(SB) - MOVD $1518, R12 - B callbackasm1(SB) - MOVD $1519, R12 - B callbackasm1(SB) - MOVD $1520, R12 - B callbackasm1(SB) - MOVD $1521, R12 - B callbackasm1(SB) - MOVD $1522, R12 - B callbackasm1(SB) - MOVD $1523, R12 - B callbackasm1(SB) - MOVD $1524, R12 - B callbackasm1(SB) - MOVD $1525, R12 - B callbackasm1(SB) - MOVD $1526, R12 - B callbackasm1(SB) - MOVD $1527, R12 - B callbackasm1(SB) - MOVD $1528, R12 - B callbackasm1(SB) - MOVD $1529, R12 - B callbackasm1(SB) - MOVD $1530, R12 - B callbackasm1(SB) - MOVD $1531, R12 - B callbackasm1(SB) - MOVD $1532, R12 - B callbackasm1(SB) - MOVD $1533, R12 - B callbackasm1(SB) - MOVD $1534, R12 - B callbackasm1(SB) - MOVD $1535, R12 - B callbackasm1(SB) - MOVD $1536, R12 - B callbackasm1(SB) - MOVD $1537, R12 - B callbackasm1(SB) - MOVD $1538, R12 - B callbackasm1(SB) - MOVD $1539, R12 - B callbackasm1(SB) - MOVD $1540, R12 - B callbackasm1(SB) - MOVD $1541, R12 - B callbackasm1(SB) - MOVD $1542, R12 - B callbackasm1(SB) - MOVD $1543, R12 - B callbackasm1(SB) - MOVD $1544, R12 - B callbackasm1(SB) - MOVD $1545, R12 - B callbackasm1(SB) - MOVD $1546, R12 - B callbackasm1(SB) - MOVD $1547, R12 - B callbackasm1(SB) - MOVD $1548, R12 - B callbackasm1(SB) - MOVD $1549, R12 - B callbackasm1(SB) - MOVD $1550, R12 - B callbackasm1(SB) - MOVD $1551, R12 - B callbackasm1(SB) - MOVD $1552, R12 - B callbackasm1(SB) - MOVD $1553, R12 - B callbackasm1(SB) - MOVD $1554, R12 - B callbackasm1(SB) - MOVD $1555, R12 - B callbackasm1(SB) - MOVD $1556, R12 - B callbackasm1(SB) - MOVD $1557, R12 - B callbackasm1(SB) - MOVD $1558, R12 - B callbackasm1(SB) - MOVD $1559, R12 - B callbackasm1(SB) - MOVD $1560, R12 - B callbackasm1(SB) - MOVD $1561, R12 - B callbackasm1(SB) - MOVD $1562, R12 - B callbackasm1(SB) - MOVD $1563, R12 - B callbackasm1(SB) - MOVD $1564, R12 - B callbackasm1(SB) - MOVD $1565, R12 - B callbackasm1(SB) - MOVD $1566, R12 - B callbackasm1(SB) - MOVD $1567, R12 - B callbackasm1(SB) - MOVD $1568, R12 - B callbackasm1(SB) - MOVD $1569, R12 - B callbackasm1(SB) - MOVD $1570, R12 - B callbackasm1(SB) - MOVD $1571, R12 - B callbackasm1(SB) - MOVD $1572, R12 - B callbackasm1(SB) - MOVD $1573, R12 - B callbackasm1(SB) - MOVD $1574, R12 - B callbackasm1(SB) - MOVD $1575, R12 - B callbackasm1(SB) - MOVD $1576, R12 - B callbackasm1(SB) - MOVD $1577, R12 - B callbackasm1(SB) - MOVD $1578, R12 - B callbackasm1(SB) - MOVD $1579, R12 - B callbackasm1(SB) - MOVD $1580, R12 - B callbackasm1(SB) - MOVD $1581, R12 - B callbackasm1(SB) - MOVD $1582, R12 - B callbackasm1(SB) - MOVD $1583, R12 - B callbackasm1(SB) - MOVD $1584, R12 - B callbackasm1(SB) - MOVD $1585, R12 - B callbackasm1(SB) - MOVD $1586, R12 - B callbackasm1(SB) - MOVD $1587, R12 - B callbackasm1(SB) - MOVD $1588, R12 - B callbackasm1(SB) - MOVD $1589, R12 - B callbackasm1(SB) - MOVD $1590, R12 - B callbackasm1(SB) - MOVD $1591, R12 - B callbackasm1(SB) - MOVD $1592, R12 - B callbackasm1(SB) - MOVD $1593, R12 - B callbackasm1(SB) - MOVD $1594, R12 - B callbackasm1(SB) - MOVD $1595, R12 - B callbackasm1(SB) - MOVD $1596, R12 - B callbackasm1(SB) - MOVD $1597, R12 - B callbackasm1(SB) - MOVD $1598, R12 - B callbackasm1(SB) - MOVD $1599, R12 - B callbackasm1(SB) - MOVD $1600, R12 - B callbackasm1(SB) - MOVD $1601, R12 - B callbackasm1(SB) - MOVD $1602, R12 - B callbackasm1(SB) - MOVD $1603, R12 - B callbackasm1(SB) - MOVD $1604, R12 - B callbackasm1(SB) - MOVD $1605, R12 - B callbackasm1(SB) - MOVD $1606, R12 - B callbackasm1(SB) - MOVD $1607, R12 - B callbackasm1(SB) - MOVD $1608, R12 - B callbackasm1(SB) - MOVD $1609, R12 - B callbackasm1(SB) - MOVD $1610, R12 - B callbackasm1(SB) - MOVD $1611, R12 - B callbackasm1(SB) - MOVD $1612, R12 - B callbackasm1(SB) - MOVD $1613, R12 - B callbackasm1(SB) - MOVD $1614, R12 - B callbackasm1(SB) - MOVD $1615, R12 - B callbackasm1(SB) - MOVD $1616, R12 - B callbackasm1(SB) - MOVD $1617, R12 - B callbackasm1(SB) - MOVD $1618, R12 - B callbackasm1(SB) - MOVD $1619, R12 - B callbackasm1(SB) - MOVD $1620, R12 - B callbackasm1(SB) - MOVD $1621, R12 - B callbackasm1(SB) - MOVD $1622, R12 - B callbackasm1(SB) - MOVD $1623, R12 - B callbackasm1(SB) - MOVD $1624, R12 - B callbackasm1(SB) - MOVD $1625, R12 - B callbackasm1(SB) - MOVD $1626, R12 - B callbackasm1(SB) - MOVD $1627, R12 - B callbackasm1(SB) - MOVD $1628, R12 - B callbackasm1(SB) - MOVD $1629, R12 - B callbackasm1(SB) - MOVD $1630, R12 - B callbackasm1(SB) - MOVD $1631, R12 - B callbackasm1(SB) - MOVD $1632, R12 - B callbackasm1(SB) - MOVD $1633, R12 - B callbackasm1(SB) - MOVD $1634, R12 - B callbackasm1(SB) - MOVD $1635, R12 - B callbackasm1(SB) - MOVD $1636, R12 - B callbackasm1(SB) - MOVD $1637, R12 - B callbackasm1(SB) - MOVD $1638, R12 - B callbackasm1(SB) - MOVD $1639, R12 - B callbackasm1(SB) - MOVD $1640, R12 - B callbackasm1(SB) - MOVD $1641, R12 - B callbackasm1(SB) - MOVD $1642, R12 - B callbackasm1(SB) - MOVD $1643, R12 - B callbackasm1(SB) - MOVD $1644, R12 - B callbackasm1(SB) - MOVD $1645, R12 - B callbackasm1(SB) - MOVD $1646, R12 - B callbackasm1(SB) - MOVD $1647, R12 - B callbackasm1(SB) - MOVD $1648, R12 - B callbackasm1(SB) - MOVD $1649, R12 - B callbackasm1(SB) - MOVD $1650, R12 - B callbackasm1(SB) - MOVD $1651, R12 - B callbackasm1(SB) - MOVD $1652, R12 - B callbackasm1(SB) - MOVD $1653, R12 - B callbackasm1(SB) - MOVD $1654, R12 - B callbackasm1(SB) - MOVD $1655, R12 - B callbackasm1(SB) - MOVD $1656, R12 - B callbackasm1(SB) - MOVD $1657, R12 - B callbackasm1(SB) - MOVD $1658, R12 - B callbackasm1(SB) - MOVD $1659, R12 - B callbackasm1(SB) - MOVD $1660, R12 - B callbackasm1(SB) - MOVD $1661, R12 - B callbackasm1(SB) - MOVD $1662, R12 - B callbackasm1(SB) - MOVD $1663, R12 - B callbackasm1(SB) - MOVD $1664, R12 - B callbackasm1(SB) - MOVD $1665, R12 - B callbackasm1(SB) - MOVD $1666, R12 - B callbackasm1(SB) - MOVD $1667, R12 - B callbackasm1(SB) - MOVD $1668, R12 - B callbackasm1(SB) - MOVD $1669, R12 - B callbackasm1(SB) - MOVD $1670, R12 - B callbackasm1(SB) - MOVD $1671, R12 - B callbackasm1(SB) - MOVD $1672, R12 - B callbackasm1(SB) - MOVD $1673, R12 - B callbackasm1(SB) - MOVD $1674, R12 - B callbackasm1(SB) - MOVD $1675, R12 - B callbackasm1(SB) - MOVD $1676, R12 - B callbackasm1(SB) - MOVD $1677, R12 - B callbackasm1(SB) - MOVD $1678, R12 - B callbackasm1(SB) - MOVD $1679, R12 - B callbackasm1(SB) - MOVD $1680, R12 - B callbackasm1(SB) - MOVD $1681, R12 - B callbackasm1(SB) - MOVD $1682, R12 - B callbackasm1(SB) - MOVD $1683, R12 - B callbackasm1(SB) - MOVD $1684, R12 - B callbackasm1(SB) - MOVD $1685, R12 - B callbackasm1(SB) - MOVD $1686, R12 - B callbackasm1(SB) - MOVD $1687, R12 - B callbackasm1(SB) - MOVD $1688, R12 - B callbackasm1(SB) - MOVD $1689, R12 - B callbackasm1(SB) - MOVD $1690, R12 - B callbackasm1(SB) - MOVD $1691, R12 - B callbackasm1(SB) - MOVD $1692, R12 - B callbackasm1(SB) - MOVD $1693, R12 - B callbackasm1(SB) - MOVD $1694, R12 - B callbackasm1(SB) - MOVD $1695, R12 - B callbackasm1(SB) - MOVD $1696, R12 - B callbackasm1(SB) - MOVD $1697, R12 - B callbackasm1(SB) - MOVD $1698, R12 - B callbackasm1(SB) - MOVD $1699, R12 - B callbackasm1(SB) - MOVD $1700, R12 - B callbackasm1(SB) - MOVD $1701, R12 - B callbackasm1(SB) - MOVD $1702, R12 - B callbackasm1(SB) - MOVD $1703, R12 - B callbackasm1(SB) - MOVD $1704, R12 - B callbackasm1(SB) - MOVD $1705, R12 - B callbackasm1(SB) - MOVD $1706, R12 - B callbackasm1(SB) - MOVD $1707, R12 - B callbackasm1(SB) - MOVD $1708, R12 - B callbackasm1(SB) - MOVD $1709, R12 - B callbackasm1(SB) - MOVD $1710, R12 - B callbackasm1(SB) - MOVD $1711, R12 - B callbackasm1(SB) - MOVD $1712, R12 - B callbackasm1(SB) - MOVD $1713, R12 - B callbackasm1(SB) - MOVD $1714, R12 - B callbackasm1(SB) - MOVD $1715, R12 - B callbackasm1(SB) - MOVD $1716, R12 - B callbackasm1(SB) - MOVD $1717, R12 - B callbackasm1(SB) - MOVD $1718, R12 - B callbackasm1(SB) - MOVD $1719, R12 - B callbackasm1(SB) - MOVD $1720, R12 - B callbackasm1(SB) - MOVD $1721, R12 - B callbackasm1(SB) - MOVD $1722, R12 - B callbackasm1(SB) - MOVD $1723, R12 - B callbackasm1(SB) - MOVD $1724, R12 - B callbackasm1(SB) - MOVD $1725, R12 - B callbackasm1(SB) - MOVD $1726, R12 - B callbackasm1(SB) - MOVD $1727, R12 - B callbackasm1(SB) - MOVD $1728, R12 - B callbackasm1(SB) - MOVD $1729, R12 - B callbackasm1(SB) - MOVD $1730, R12 - B callbackasm1(SB) - MOVD $1731, R12 - B callbackasm1(SB) - MOVD $1732, R12 - B callbackasm1(SB) - MOVD $1733, R12 - B callbackasm1(SB) - MOVD $1734, R12 - B callbackasm1(SB) - MOVD $1735, R12 - B callbackasm1(SB) - MOVD $1736, R12 - B callbackasm1(SB) - MOVD $1737, R12 - B callbackasm1(SB) - MOVD $1738, R12 - B callbackasm1(SB) - MOVD $1739, R12 - B callbackasm1(SB) - MOVD $1740, R12 - B callbackasm1(SB) - MOVD $1741, R12 - B callbackasm1(SB) - MOVD $1742, R12 - B callbackasm1(SB) - MOVD $1743, R12 - B callbackasm1(SB) - MOVD $1744, R12 - B callbackasm1(SB) - MOVD $1745, R12 - B callbackasm1(SB) - MOVD $1746, R12 - B callbackasm1(SB) - MOVD $1747, R12 - B callbackasm1(SB) - MOVD $1748, R12 - B callbackasm1(SB) - MOVD $1749, R12 - B callbackasm1(SB) - MOVD $1750, R12 - B callbackasm1(SB) - MOVD $1751, R12 - B callbackasm1(SB) - MOVD $1752, R12 - B callbackasm1(SB) - MOVD $1753, R12 - B callbackasm1(SB) - MOVD $1754, R12 - B callbackasm1(SB) - MOVD $1755, R12 - B callbackasm1(SB) - MOVD $1756, R12 - B callbackasm1(SB) - MOVD $1757, R12 - B callbackasm1(SB) - MOVD $1758, R12 - B callbackasm1(SB) - MOVD $1759, R12 - B callbackasm1(SB) - MOVD $1760, R12 - B callbackasm1(SB) - MOVD $1761, R12 - B callbackasm1(SB) - MOVD $1762, R12 - B callbackasm1(SB) - MOVD $1763, R12 - B callbackasm1(SB) - MOVD $1764, R12 - B callbackasm1(SB) - MOVD $1765, R12 - B callbackasm1(SB) - MOVD $1766, R12 - B callbackasm1(SB) - MOVD $1767, R12 - B callbackasm1(SB) - MOVD $1768, R12 - B callbackasm1(SB) - MOVD $1769, R12 - B callbackasm1(SB) - MOVD $1770, R12 - B callbackasm1(SB) - MOVD $1771, R12 - B callbackasm1(SB) - MOVD $1772, R12 - B callbackasm1(SB) - MOVD $1773, R12 - B callbackasm1(SB) - MOVD $1774, R12 - B callbackasm1(SB) - MOVD $1775, R12 - B callbackasm1(SB) - MOVD $1776, R12 - B callbackasm1(SB) - MOVD $1777, R12 - B callbackasm1(SB) - MOVD $1778, R12 - B callbackasm1(SB) - MOVD $1779, R12 - B callbackasm1(SB) - MOVD $1780, R12 - B callbackasm1(SB) - MOVD $1781, R12 - B callbackasm1(SB) - MOVD $1782, R12 - B callbackasm1(SB) - MOVD $1783, R12 - B callbackasm1(SB) - MOVD $1784, R12 - B callbackasm1(SB) - MOVD $1785, R12 - B callbackasm1(SB) - MOVD $1786, R12 - B callbackasm1(SB) - MOVD $1787, R12 - B callbackasm1(SB) - MOVD $1788, R12 - B callbackasm1(SB) - MOVD $1789, R12 - B callbackasm1(SB) - MOVD $1790, R12 - B callbackasm1(SB) - MOVD $1791, R12 - B callbackasm1(SB) - MOVD $1792, R12 - B callbackasm1(SB) - MOVD $1793, R12 - B callbackasm1(SB) - MOVD $1794, R12 - B callbackasm1(SB) - MOVD $1795, R12 - B callbackasm1(SB) - MOVD $1796, R12 - B callbackasm1(SB) - MOVD $1797, R12 - B callbackasm1(SB) - MOVD $1798, R12 - B callbackasm1(SB) - MOVD $1799, R12 - B callbackasm1(SB) - MOVD $1800, R12 - B callbackasm1(SB) - MOVD $1801, R12 - B callbackasm1(SB) - MOVD $1802, R12 - B callbackasm1(SB) - MOVD $1803, R12 - B callbackasm1(SB) - MOVD $1804, R12 - B callbackasm1(SB) - MOVD $1805, R12 - B callbackasm1(SB) - MOVD $1806, R12 - B callbackasm1(SB) - MOVD $1807, R12 - B callbackasm1(SB) - MOVD $1808, R12 - B callbackasm1(SB) - MOVD $1809, R12 - B callbackasm1(SB) - MOVD $1810, R12 - B callbackasm1(SB) - MOVD $1811, R12 - B callbackasm1(SB) - MOVD $1812, R12 - B callbackasm1(SB) - MOVD $1813, R12 - B callbackasm1(SB) - MOVD $1814, R12 - B callbackasm1(SB) - MOVD $1815, R12 - B callbackasm1(SB) - MOVD $1816, R12 - B callbackasm1(SB) - MOVD $1817, R12 - B callbackasm1(SB) - MOVD $1818, R12 - B callbackasm1(SB) - MOVD $1819, R12 - B callbackasm1(SB) - MOVD $1820, R12 - B callbackasm1(SB) - MOVD $1821, R12 - B callbackasm1(SB) - MOVD $1822, R12 - B callbackasm1(SB) - MOVD $1823, R12 - B callbackasm1(SB) - MOVD $1824, R12 - B callbackasm1(SB) - MOVD $1825, R12 - B callbackasm1(SB) - MOVD $1826, R12 - B callbackasm1(SB) - MOVD $1827, R12 - B callbackasm1(SB) - MOVD $1828, R12 - B callbackasm1(SB) - MOVD $1829, R12 - B callbackasm1(SB) - MOVD $1830, R12 - B callbackasm1(SB) - MOVD $1831, R12 - B callbackasm1(SB) - MOVD $1832, R12 - B callbackasm1(SB) - MOVD $1833, R12 - B callbackasm1(SB) - MOVD $1834, R12 - B callbackasm1(SB) - MOVD $1835, R12 - B callbackasm1(SB) - MOVD $1836, R12 - B callbackasm1(SB) - MOVD $1837, R12 - B callbackasm1(SB) - MOVD $1838, R12 - B callbackasm1(SB) - MOVD $1839, R12 - B callbackasm1(SB) - MOVD $1840, R12 - B callbackasm1(SB) - MOVD $1841, R12 - B callbackasm1(SB) - MOVD $1842, R12 - B callbackasm1(SB) - MOVD $1843, R12 - B callbackasm1(SB) - MOVD $1844, R12 - B callbackasm1(SB) - MOVD $1845, R12 - B callbackasm1(SB) - MOVD $1846, R12 - B callbackasm1(SB) - MOVD $1847, R12 - B callbackasm1(SB) - MOVD $1848, R12 - B callbackasm1(SB) - MOVD $1849, R12 - B callbackasm1(SB) - MOVD $1850, R12 - B callbackasm1(SB) - MOVD $1851, R12 - B callbackasm1(SB) - MOVD $1852, R12 - B callbackasm1(SB) - MOVD $1853, R12 - B callbackasm1(SB) - MOVD $1854, R12 - B callbackasm1(SB) - MOVD $1855, R12 - B callbackasm1(SB) - MOVD $1856, R12 - B callbackasm1(SB) - MOVD $1857, R12 - B callbackasm1(SB) - MOVD $1858, R12 - B callbackasm1(SB) - MOVD $1859, R12 - B callbackasm1(SB) - MOVD $1860, R12 - B callbackasm1(SB) - MOVD $1861, R12 - B callbackasm1(SB) - MOVD $1862, R12 - B callbackasm1(SB) - MOVD $1863, R12 - B callbackasm1(SB) - MOVD $1864, R12 - B callbackasm1(SB) - MOVD $1865, R12 - B callbackasm1(SB) - MOVD $1866, R12 - B callbackasm1(SB) - MOVD $1867, R12 - B callbackasm1(SB) - MOVD $1868, R12 - B callbackasm1(SB) - MOVD $1869, R12 - B callbackasm1(SB) - MOVD $1870, R12 - B callbackasm1(SB) - MOVD $1871, R12 - B callbackasm1(SB) - MOVD $1872, R12 - B callbackasm1(SB) - MOVD $1873, R12 - B callbackasm1(SB) - MOVD $1874, R12 - B callbackasm1(SB) - MOVD $1875, R12 - B callbackasm1(SB) - MOVD $1876, R12 - B callbackasm1(SB) - MOVD $1877, R12 - B callbackasm1(SB) - MOVD $1878, R12 - B callbackasm1(SB) - MOVD $1879, R12 - B callbackasm1(SB) - MOVD $1880, R12 - B callbackasm1(SB) - MOVD $1881, R12 - B callbackasm1(SB) - MOVD $1882, R12 - B callbackasm1(SB) - MOVD $1883, R12 - B callbackasm1(SB) - MOVD $1884, R12 - B callbackasm1(SB) - MOVD $1885, R12 - B callbackasm1(SB) - MOVD $1886, R12 - B callbackasm1(SB) - MOVD $1887, R12 - B callbackasm1(SB) - MOVD $1888, R12 - B callbackasm1(SB) - MOVD $1889, R12 - B callbackasm1(SB) - MOVD $1890, R12 - B callbackasm1(SB) - MOVD $1891, R12 - B callbackasm1(SB) - MOVD $1892, R12 - B callbackasm1(SB) - MOVD $1893, R12 - B callbackasm1(SB) - MOVD $1894, R12 - B callbackasm1(SB) - MOVD $1895, R12 - B callbackasm1(SB) - MOVD $1896, R12 - B callbackasm1(SB) - MOVD $1897, R12 - B callbackasm1(SB) - MOVD $1898, R12 - B callbackasm1(SB) - MOVD $1899, R12 - B callbackasm1(SB) - MOVD $1900, R12 - B callbackasm1(SB) - MOVD $1901, R12 - B callbackasm1(SB) - MOVD $1902, R12 - B callbackasm1(SB) - MOVD $1903, R12 - B callbackasm1(SB) - MOVD $1904, R12 - B callbackasm1(SB) - MOVD $1905, R12 - B callbackasm1(SB) - MOVD $1906, R12 - B callbackasm1(SB) - MOVD $1907, R12 - B callbackasm1(SB) - MOVD $1908, R12 - B callbackasm1(SB) - MOVD $1909, R12 - B callbackasm1(SB) - MOVD $1910, R12 - B callbackasm1(SB) - MOVD $1911, R12 - B callbackasm1(SB) - MOVD $1912, R12 - B callbackasm1(SB) - MOVD $1913, R12 - B callbackasm1(SB) - MOVD $1914, R12 - B callbackasm1(SB) - MOVD $1915, R12 - B callbackasm1(SB) - MOVD $1916, R12 - B callbackasm1(SB) - MOVD $1917, R12 - B callbackasm1(SB) - MOVD $1918, R12 - B callbackasm1(SB) - MOVD $1919, R12 - B callbackasm1(SB) - MOVD $1920, R12 - B callbackasm1(SB) - MOVD $1921, R12 - B callbackasm1(SB) - MOVD $1922, R12 - B callbackasm1(SB) - MOVD $1923, R12 - B callbackasm1(SB) - MOVD $1924, R12 - B callbackasm1(SB) - MOVD $1925, R12 - B callbackasm1(SB) - MOVD $1926, R12 - B callbackasm1(SB) - MOVD $1927, R12 - B callbackasm1(SB) - MOVD $1928, R12 - B callbackasm1(SB) - MOVD $1929, R12 - B callbackasm1(SB) - MOVD $1930, R12 - B callbackasm1(SB) - MOVD $1931, R12 - B callbackasm1(SB) - MOVD $1932, R12 - B callbackasm1(SB) - MOVD $1933, R12 - B callbackasm1(SB) - MOVD $1934, R12 - B callbackasm1(SB) - MOVD $1935, R12 - B callbackasm1(SB) - MOVD $1936, R12 - B callbackasm1(SB) - MOVD $1937, R12 - B callbackasm1(SB) - MOVD $1938, R12 - B callbackasm1(SB) - MOVD $1939, R12 - B callbackasm1(SB) - MOVD $1940, R12 - B callbackasm1(SB) - MOVD $1941, R12 - B callbackasm1(SB) - MOVD $1942, R12 - B callbackasm1(SB) - MOVD $1943, R12 - B callbackasm1(SB) - MOVD $1944, R12 - B callbackasm1(SB) - MOVD $1945, R12 - B callbackasm1(SB) - MOVD $1946, R12 - B callbackasm1(SB) - MOVD $1947, R12 - B callbackasm1(SB) - MOVD $1948, R12 - B callbackasm1(SB) - MOVD $1949, R12 - B callbackasm1(SB) - MOVD $1950, R12 - B callbackasm1(SB) - MOVD $1951, R12 - B callbackasm1(SB) - MOVD $1952, R12 - B callbackasm1(SB) - MOVD $1953, R12 - B callbackasm1(SB) - MOVD $1954, R12 - B callbackasm1(SB) - MOVD $1955, R12 - B callbackasm1(SB) - MOVD $1956, R12 - B callbackasm1(SB) - MOVD $1957, R12 - B callbackasm1(SB) - MOVD $1958, R12 - B callbackasm1(SB) - MOVD $1959, R12 - B callbackasm1(SB) - MOVD $1960, R12 - B callbackasm1(SB) - MOVD $1961, R12 - B callbackasm1(SB) - MOVD $1962, R12 - B callbackasm1(SB) - MOVD $1963, R12 - B callbackasm1(SB) - MOVD $1964, R12 - B callbackasm1(SB) - MOVD $1965, R12 - B callbackasm1(SB) - MOVD $1966, R12 - B callbackasm1(SB) - MOVD $1967, R12 - B callbackasm1(SB) - MOVD $1968, R12 - B callbackasm1(SB) - MOVD $1969, R12 - B callbackasm1(SB) - MOVD $1970, R12 - B callbackasm1(SB) - MOVD $1971, R12 - B callbackasm1(SB) - MOVD $1972, R12 - B callbackasm1(SB) - MOVD $1973, R12 - B callbackasm1(SB) - MOVD $1974, R12 - B callbackasm1(SB) - MOVD $1975, R12 - B callbackasm1(SB) - MOVD $1976, R12 - B callbackasm1(SB) - MOVD $1977, R12 - B callbackasm1(SB) - MOVD $1978, R12 - B callbackasm1(SB) - MOVD $1979, R12 - B callbackasm1(SB) - MOVD $1980, R12 - B callbackasm1(SB) - MOVD $1981, R12 - B callbackasm1(SB) - MOVD $1982, R12 - B callbackasm1(SB) - MOVD $1983, R12 - B callbackasm1(SB) - MOVD $1984, R12 - B callbackasm1(SB) - MOVD $1985, R12 - B callbackasm1(SB) - MOVD $1986, R12 - B callbackasm1(SB) - MOVD $1987, R12 - B callbackasm1(SB) - MOVD $1988, R12 - B callbackasm1(SB) - MOVD $1989, R12 - B callbackasm1(SB) - MOVD $1990, R12 - B callbackasm1(SB) - MOVD $1991, R12 - B callbackasm1(SB) - MOVD $1992, R12 - B callbackasm1(SB) - MOVD $1993, R12 - B callbackasm1(SB) - MOVD $1994, R12 - B callbackasm1(SB) - MOVD $1995, R12 - B callbackasm1(SB) - MOVD $1996, R12 - B callbackasm1(SB) - MOVD $1997, R12 - B callbackasm1(SB) - MOVD $1998, R12 - B callbackasm1(SB) - MOVD $1999, R12 - B callbackasm1(SB) +TEXT callbackasm(SB),NOSPLIT|NOFRAME,$0 + MOVD $0, R12 + B callbackasm1(SB) + MOVD $1, R12 + B callbackasm1(SB) + MOVD $2, R12 + B callbackasm1(SB) + MOVD $3, R12 + B callbackasm1(SB) + MOVD $4, R12 + B callbackasm1(SB) + MOVD $5, R12 + B callbackasm1(SB) + MOVD $6, R12 + B callbackasm1(SB) + MOVD $7, R12 + B callbackasm1(SB) + MOVD $8, R12 + B callbackasm1(SB) + MOVD $9, R12 + B callbackasm1(SB) + MOVD $10, R12 + B callbackasm1(SB) + MOVD $11, R12 + B callbackasm1(SB) + MOVD $12, R12 + B callbackasm1(SB) + MOVD $13, R12 + B callbackasm1(SB) + MOVD $14, R12 + B callbackasm1(SB) + MOVD $15, R12 + B callbackasm1(SB) + MOVD $16, R12 + B callbackasm1(SB) + MOVD $17, R12 + B callbackasm1(SB) + MOVD $18, R12 + B callbackasm1(SB) + MOVD $19, R12 + B callbackasm1(SB) + MOVD $20, R12 + B callbackasm1(SB) + MOVD $21, R12 + B callbackasm1(SB) + MOVD $22, R12 + B callbackasm1(SB) + MOVD $23, R12 + B callbackasm1(SB) + MOVD $24, R12 + B callbackasm1(SB) + MOVD $25, R12 + B callbackasm1(SB) + MOVD $26, R12 + B callbackasm1(SB) + MOVD $27, R12 + B callbackasm1(SB) + MOVD $28, R12 + B callbackasm1(SB) + MOVD $29, R12 + B callbackasm1(SB) + MOVD $30, R12 + B callbackasm1(SB) + MOVD $31, R12 + B callbackasm1(SB) + MOVD $32, R12 + B callbackasm1(SB) + MOVD $33, R12 + B callbackasm1(SB) + MOVD $34, R12 + B callbackasm1(SB) + MOVD $35, R12 + B callbackasm1(SB) + MOVD $36, R12 + B callbackasm1(SB) + MOVD $37, R12 + B callbackasm1(SB) + MOVD $38, R12 + B callbackasm1(SB) + MOVD $39, R12 + B callbackasm1(SB) + MOVD $40, R12 + B callbackasm1(SB) + MOVD $41, R12 + B callbackasm1(SB) + MOVD $42, R12 + B callbackasm1(SB) + MOVD $43, R12 + B callbackasm1(SB) + MOVD $44, R12 + B callbackasm1(SB) + MOVD $45, R12 + B callbackasm1(SB) + MOVD $46, R12 + B callbackasm1(SB) + MOVD $47, R12 + B callbackasm1(SB) + MOVD $48, R12 + B callbackasm1(SB) + MOVD $49, R12 + B callbackasm1(SB) + MOVD $50, R12 + B callbackasm1(SB) + MOVD $51, R12 + B callbackasm1(SB) + MOVD $52, R12 + B callbackasm1(SB) + MOVD $53, R12 + B callbackasm1(SB) + MOVD $54, R12 + B callbackasm1(SB) + MOVD $55, R12 + B callbackasm1(SB) + MOVD $56, R12 + B callbackasm1(SB) + MOVD $57, R12 + B callbackasm1(SB) + MOVD $58, R12 + B callbackasm1(SB) + MOVD $59, R12 + B callbackasm1(SB) + MOVD $60, R12 + B callbackasm1(SB) + MOVD $61, R12 + B callbackasm1(SB) + MOVD $62, R12 + B callbackasm1(SB) + MOVD $63, R12 + B callbackasm1(SB) + MOVD $64, R12 + B callbackasm1(SB) + MOVD $65, R12 + B callbackasm1(SB) + MOVD $66, R12 + B callbackasm1(SB) + MOVD $67, R12 + B callbackasm1(SB) + MOVD $68, R12 + B callbackasm1(SB) + MOVD $69, R12 + B callbackasm1(SB) + MOVD $70, R12 + B callbackasm1(SB) + MOVD $71, R12 + B callbackasm1(SB) + MOVD $72, R12 + B callbackasm1(SB) + MOVD $73, R12 + B callbackasm1(SB) + MOVD $74, R12 + B callbackasm1(SB) + MOVD $75, R12 + B callbackasm1(SB) + MOVD $76, R12 + B callbackasm1(SB) + MOVD $77, R12 + B callbackasm1(SB) + MOVD $78, R12 + B callbackasm1(SB) + MOVD $79, R12 + B callbackasm1(SB) + MOVD $80, R12 + B callbackasm1(SB) + MOVD $81, R12 + B callbackasm1(SB) + MOVD $82, R12 + B callbackasm1(SB) + MOVD $83, R12 + B callbackasm1(SB) + MOVD $84, R12 + B callbackasm1(SB) + MOVD $85, R12 + B callbackasm1(SB) + MOVD $86, R12 + B callbackasm1(SB) + MOVD $87, R12 + B callbackasm1(SB) + MOVD $88, R12 + B callbackasm1(SB) + MOVD $89, R12 + B callbackasm1(SB) + MOVD $90, R12 + B callbackasm1(SB) + MOVD $91, R12 + B callbackasm1(SB) + MOVD $92, R12 + B callbackasm1(SB) + MOVD $93, R12 + B callbackasm1(SB) + MOVD $94, R12 + B callbackasm1(SB) + MOVD $95, R12 + B callbackasm1(SB) + MOVD $96, R12 + B callbackasm1(SB) + MOVD $97, R12 + B callbackasm1(SB) + MOVD $98, R12 + B callbackasm1(SB) + MOVD $99, R12 + B callbackasm1(SB) + MOVD $100, R12 + B callbackasm1(SB) + MOVD $101, R12 + B callbackasm1(SB) + MOVD $102, R12 + B callbackasm1(SB) + MOVD $103, R12 + B callbackasm1(SB) + MOVD $104, R12 + B callbackasm1(SB) + MOVD $105, R12 + B callbackasm1(SB) + MOVD $106, R12 + B callbackasm1(SB) + MOVD $107, R12 + B callbackasm1(SB) + MOVD $108, R12 + B callbackasm1(SB) + MOVD $109, R12 + B callbackasm1(SB) + MOVD $110, R12 + B callbackasm1(SB) + MOVD $111, R12 + B callbackasm1(SB) + MOVD $112, R12 + B callbackasm1(SB) + MOVD $113, R12 + B callbackasm1(SB) + MOVD $114, R12 + B callbackasm1(SB) + MOVD $115, R12 + B callbackasm1(SB) + MOVD $116, R12 + B callbackasm1(SB) + MOVD $117, R12 + B callbackasm1(SB) + MOVD $118, R12 + B callbackasm1(SB) + MOVD $119, R12 + B callbackasm1(SB) + MOVD $120, R12 + B callbackasm1(SB) + MOVD $121, R12 + B callbackasm1(SB) + MOVD $122, R12 + B callbackasm1(SB) + MOVD $123, R12 + B callbackasm1(SB) + MOVD $124, R12 + B callbackasm1(SB) + MOVD $125, R12 + B callbackasm1(SB) + MOVD $126, R12 + B callbackasm1(SB) + MOVD $127, R12 + B callbackasm1(SB) + MOVD $128, R12 + B callbackasm1(SB) + MOVD $129, R12 + B callbackasm1(SB) + MOVD $130, R12 + B callbackasm1(SB) + MOVD $131, R12 + B callbackasm1(SB) + MOVD $132, R12 + B callbackasm1(SB) + MOVD $133, R12 + B callbackasm1(SB) + MOVD $134, R12 + B callbackasm1(SB) + MOVD $135, R12 + B callbackasm1(SB) + MOVD $136, R12 + B callbackasm1(SB) + MOVD $137, R12 + B callbackasm1(SB) + MOVD $138, R12 + B callbackasm1(SB) + MOVD $139, R12 + B callbackasm1(SB) + MOVD $140, R12 + B callbackasm1(SB) + MOVD $141, R12 + B callbackasm1(SB) + MOVD $142, R12 + B callbackasm1(SB) + MOVD $143, R12 + B callbackasm1(SB) + MOVD $144, R12 + B callbackasm1(SB) + MOVD $145, R12 + B callbackasm1(SB) + MOVD $146, R12 + B callbackasm1(SB) + MOVD $147, R12 + B callbackasm1(SB) + MOVD $148, R12 + B callbackasm1(SB) + MOVD $149, R12 + B callbackasm1(SB) + MOVD $150, R12 + B callbackasm1(SB) + MOVD $151, R12 + B callbackasm1(SB) + MOVD $152, R12 + B callbackasm1(SB) + MOVD $153, R12 + B callbackasm1(SB) + MOVD $154, R12 + B callbackasm1(SB) + MOVD $155, R12 + B callbackasm1(SB) + MOVD $156, R12 + B callbackasm1(SB) + MOVD $157, R12 + B callbackasm1(SB) + MOVD $158, R12 + B callbackasm1(SB) + MOVD $159, R12 + B callbackasm1(SB) + MOVD $160, R12 + B callbackasm1(SB) + MOVD $161, R12 + B callbackasm1(SB) + MOVD $162, R12 + B callbackasm1(SB) + MOVD $163, R12 + B callbackasm1(SB) + MOVD $164, R12 + B callbackasm1(SB) + MOVD $165, R12 + B callbackasm1(SB) + MOVD $166, R12 + B callbackasm1(SB) + MOVD $167, R12 + B callbackasm1(SB) + MOVD $168, R12 + B callbackasm1(SB) + MOVD $169, R12 + B callbackasm1(SB) + MOVD $170, R12 + B callbackasm1(SB) + MOVD $171, R12 + B callbackasm1(SB) + MOVD $172, R12 + B callbackasm1(SB) + MOVD $173, R12 + B callbackasm1(SB) + MOVD $174, R12 + B callbackasm1(SB) + MOVD $175, R12 + B callbackasm1(SB) + MOVD $176, R12 + B callbackasm1(SB) + MOVD $177, R12 + B callbackasm1(SB) + MOVD $178, R12 + B callbackasm1(SB) + MOVD $179, R12 + B callbackasm1(SB) + MOVD $180, R12 + B callbackasm1(SB) + MOVD $181, R12 + B callbackasm1(SB) + MOVD $182, R12 + B callbackasm1(SB) + MOVD $183, R12 + B callbackasm1(SB) + MOVD $184, R12 + B callbackasm1(SB) + MOVD $185, R12 + B callbackasm1(SB) + MOVD $186, R12 + B callbackasm1(SB) + MOVD $187, R12 + B callbackasm1(SB) + MOVD $188, R12 + B callbackasm1(SB) + MOVD $189, R12 + B callbackasm1(SB) + MOVD $190, R12 + B callbackasm1(SB) + MOVD $191, R12 + B callbackasm1(SB) + MOVD $192, R12 + B callbackasm1(SB) + MOVD $193, R12 + B callbackasm1(SB) + MOVD $194, R12 + B callbackasm1(SB) + MOVD $195, R12 + B callbackasm1(SB) + MOVD $196, R12 + B callbackasm1(SB) + MOVD $197, R12 + B callbackasm1(SB) + MOVD $198, R12 + B callbackasm1(SB) + MOVD $199, R12 + B callbackasm1(SB) + MOVD $200, R12 + B callbackasm1(SB) + MOVD $201, R12 + B callbackasm1(SB) + MOVD $202, R12 + B callbackasm1(SB) + MOVD $203, R12 + B callbackasm1(SB) + MOVD $204, R12 + B callbackasm1(SB) + MOVD $205, R12 + B callbackasm1(SB) + MOVD $206, R12 + B callbackasm1(SB) + MOVD $207, R12 + B callbackasm1(SB) + MOVD $208, R12 + B callbackasm1(SB) + MOVD $209, R12 + B callbackasm1(SB) + MOVD $210, R12 + B callbackasm1(SB) + MOVD $211, R12 + B callbackasm1(SB) + MOVD $212, R12 + B callbackasm1(SB) + MOVD $213, R12 + B callbackasm1(SB) + MOVD $214, R12 + B callbackasm1(SB) + MOVD $215, R12 + B callbackasm1(SB) + MOVD $216, R12 + B callbackasm1(SB) + MOVD $217, R12 + B callbackasm1(SB) + MOVD $218, R12 + B callbackasm1(SB) + MOVD $219, R12 + B callbackasm1(SB) + MOVD $220, R12 + B callbackasm1(SB) + MOVD $221, R12 + B callbackasm1(SB) + MOVD $222, R12 + B callbackasm1(SB) + MOVD $223, R12 + B callbackasm1(SB) + MOVD $224, R12 + B callbackasm1(SB) + MOVD $225, R12 + B callbackasm1(SB) + MOVD $226, R12 + B callbackasm1(SB) + MOVD $227, R12 + B callbackasm1(SB) + MOVD $228, R12 + B callbackasm1(SB) + MOVD $229, R12 + B callbackasm1(SB) + MOVD $230, R12 + B callbackasm1(SB) + MOVD $231, R12 + B callbackasm1(SB) + MOVD $232, R12 + B callbackasm1(SB) + MOVD $233, R12 + B callbackasm1(SB) + MOVD $234, R12 + B callbackasm1(SB) + MOVD $235, R12 + B callbackasm1(SB) + MOVD $236, R12 + B callbackasm1(SB) + MOVD $237, R12 + B callbackasm1(SB) + MOVD $238, R12 + B callbackasm1(SB) + MOVD $239, R12 + B callbackasm1(SB) + MOVD $240, R12 + B callbackasm1(SB) + MOVD $241, R12 + B callbackasm1(SB) + MOVD $242, R12 + B callbackasm1(SB) + MOVD $243, R12 + B callbackasm1(SB) + MOVD $244, R12 + B callbackasm1(SB) + MOVD $245, R12 + B callbackasm1(SB) + MOVD $246, R12 + B callbackasm1(SB) + MOVD $247, R12 + B callbackasm1(SB) + MOVD $248, R12 + B callbackasm1(SB) + MOVD $249, R12 + B callbackasm1(SB) + MOVD $250, R12 + B callbackasm1(SB) + MOVD $251, R12 + B callbackasm1(SB) + MOVD $252, R12 + B callbackasm1(SB) + MOVD $253, R12 + B callbackasm1(SB) + MOVD $254, R12 + B callbackasm1(SB) + MOVD $255, R12 + B callbackasm1(SB) + MOVD $256, R12 + B callbackasm1(SB) + MOVD $257, R12 + B callbackasm1(SB) + MOVD $258, R12 + B callbackasm1(SB) + MOVD $259, R12 + B callbackasm1(SB) + MOVD $260, R12 + B callbackasm1(SB) + MOVD $261, R12 + B callbackasm1(SB) + MOVD $262, R12 + B callbackasm1(SB) + MOVD $263, R12 + B callbackasm1(SB) + MOVD $264, R12 + B callbackasm1(SB) + MOVD $265, R12 + B callbackasm1(SB) + MOVD $266, R12 + B callbackasm1(SB) + MOVD $267, R12 + B callbackasm1(SB) + MOVD $268, R12 + B callbackasm1(SB) + MOVD $269, R12 + B callbackasm1(SB) + MOVD $270, R12 + B callbackasm1(SB) + MOVD $271, R12 + B callbackasm1(SB) + MOVD $272, R12 + B callbackasm1(SB) + MOVD $273, R12 + B callbackasm1(SB) + MOVD $274, R12 + B callbackasm1(SB) + MOVD $275, R12 + B callbackasm1(SB) + MOVD $276, R12 + B callbackasm1(SB) + MOVD $277, R12 + B callbackasm1(SB) + MOVD $278, R12 + B callbackasm1(SB) + MOVD $279, R12 + B callbackasm1(SB) + MOVD $280, R12 + B callbackasm1(SB) + MOVD $281, R12 + B callbackasm1(SB) + MOVD $282, R12 + B callbackasm1(SB) + MOVD $283, R12 + B callbackasm1(SB) + MOVD $284, R12 + B callbackasm1(SB) + MOVD $285, R12 + B callbackasm1(SB) + MOVD $286, R12 + B callbackasm1(SB) + MOVD $287, R12 + B callbackasm1(SB) + MOVD $288, R12 + B callbackasm1(SB) + MOVD $289, R12 + B callbackasm1(SB) + MOVD $290, R12 + B callbackasm1(SB) + MOVD $291, R12 + B callbackasm1(SB) + MOVD $292, R12 + B callbackasm1(SB) + MOVD $293, R12 + B callbackasm1(SB) + MOVD $294, R12 + B callbackasm1(SB) + MOVD $295, R12 + B callbackasm1(SB) + MOVD $296, R12 + B callbackasm1(SB) + MOVD $297, R12 + B callbackasm1(SB) + MOVD $298, R12 + B callbackasm1(SB) + MOVD $299, R12 + B callbackasm1(SB) + MOVD $300, R12 + B callbackasm1(SB) + MOVD $301, R12 + B callbackasm1(SB) + MOVD $302, R12 + B callbackasm1(SB) + MOVD $303, R12 + B callbackasm1(SB) + MOVD $304, R12 + B callbackasm1(SB) + MOVD $305, R12 + B callbackasm1(SB) + MOVD $306, R12 + B callbackasm1(SB) + MOVD $307, R12 + B callbackasm1(SB) + MOVD $308, R12 + B callbackasm1(SB) + MOVD $309, R12 + B callbackasm1(SB) + MOVD $310, R12 + B callbackasm1(SB) + MOVD $311, R12 + B callbackasm1(SB) + MOVD $312, R12 + B callbackasm1(SB) + MOVD $313, R12 + B callbackasm1(SB) + MOVD $314, R12 + B callbackasm1(SB) + MOVD $315, R12 + B callbackasm1(SB) + MOVD $316, R12 + B callbackasm1(SB) + MOVD $317, R12 + B callbackasm1(SB) + MOVD $318, R12 + B callbackasm1(SB) + MOVD $319, R12 + B callbackasm1(SB) + MOVD $320, R12 + B callbackasm1(SB) + MOVD $321, R12 + B callbackasm1(SB) + MOVD $322, R12 + B callbackasm1(SB) + MOVD $323, R12 + B callbackasm1(SB) + MOVD $324, R12 + B callbackasm1(SB) + MOVD $325, R12 + B callbackasm1(SB) + MOVD $326, R12 + B callbackasm1(SB) + MOVD $327, R12 + B callbackasm1(SB) + MOVD $328, R12 + B callbackasm1(SB) + MOVD $329, R12 + B callbackasm1(SB) + MOVD $330, R12 + B callbackasm1(SB) + MOVD $331, R12 + B callbackasm1(SB) + MOVD $332, R12 + B callbackasm1(SB) + MOVD $333, R12 + B callbackasm1(SB) + MOVD $334, R12 + B callbackasm1(SB) + MOVD $335, R12 + B callbackasm1(SB) + MOVD $336, R12 + B callbackasm1(SB) + MOVD $337, R12 + B callbackasm1(SB) + MOVD $338, R12 + B callbackasm1(SB) + MOVD $339, R12 + B callbackasm1(SB) + MOVD $340, R12 + B callbackasm1(SB) + MOVD $341, R12 + B callbackasm1(SB) + MOVD $342, R12 + B callbackasm1(SB) + MOVD $343, R12 + B callbackasm1(SB) + MOVD $344, R12 + B callbackasm1(SB) + MOVD $345, R12 + B callbackasm1(SB) + MOVD $346, R12 + B callbackasm1(SB) + MOVD $347, R12 + B callbackasm1(SB) + MOVD $348, R12 + B callbackasm1(SB) + MOVD $349, R12 + B callbackasm1(SB) + MOVD $350, R12 + B callbackasm1(SB) + MOVD $351, R12 + B callbackasm1(SB) + MOVD $352, R12 + B callbackasm1(SB) + MOVD $353, R12 + B callbackasm1(SB) + MOVD $354, R12 + B callbackasm1(SB) + MOVD $355, R12 + B callbackasm1(SB) + MOVD $356, R12 + B callbackasm1(SB) + MOVD $357, R12 + B callbackasm1(SB) + MOVD $358, R12 + B callbackasm1(SB) + MOVD $359, R12 + B callbackasm1(SB) + MOVD $360, R12 + B callbackasm1(SB) + MOVD $361, R12 + B callbackasm1(SB) + MOVD $362, R12 + B callbackasm1(SB) + MOVD $363, R12 + B callbackasm1(SB) + MOVD $364, R12 + B callbackasm1(SB) + MOVD $365, R12 + B callbackasm1(SB) + MOVD $366, R12 + B callbackasm1(SB) + MOVD $367, R12 + B callbackasm1(SB) + MOVD $368, R12 + B callbackasm1(SB) + MOVD $369, R12 + B callbackasm1(SB) + MOVD $370, R12 + B callbackasm1(SB) + MOVD $371, R12 + B callbackasm1(SB) + MOVD $372, R12 + B callbackasm1(SB) + MOVD $373, R12 + B callbackasm1(SB) + MOVD $374, R12 + B callbackasm1(SB) + MOVD $375, R12 + B callbackasm1(SB) + MOVD $376, R12 + B callbackasm1(SB) + MOVD $377, R12 + B callbackasm1(SB) + MOVD $378, R12 + B callbackasm1(SB) + MOVD $379, R12 + B callbackasm1(SB) + MOVD $380, R12 + B callbackasm1(SB) + MOVD $381, R12 + B callbackasm1(SB) + MOVD $382, R12 + B callbackasm1(SB) + MOVD $383, R12 + B callbackasm1(SB) + MOVD $384, R12 + B callbackasm1(SB) + MOVD $385, R12 + B callbackasm1(SB) + MOVD $386, R12 + B callbackasm1(SB) + MOVD $387, R12 + B callbackasm1(SB) + MOVD $388, R12 + B callbackasm1(SB) + MOVD $389, R12 + B callbackasm1(SB) + MOVD $390, R12 + B callbackasm1(SB) + MOVD $391, R12 + B callbackasm1(SB) + MOVD $392, R12 + B callbackasm1(SB) + MOVD $393, R12 + B callbackasm1(SB) + MOVD $394, R12 + B callbackasm1(SB) + MOVD $395, R12 + B callbackasm1(SB) + MOVD $396, R12 + B callbackasm1(SB) + MOVD $397, R12 + B callbackasm1(SB) + MOVD $398, R12 + B callbackasm1(SB) + MOVD $399, R12 + B callbackasm1(SB) + MOVD $400, R12 + B callbackasm1(SB) + MOVD $401, R12 + B callbackasm1(SB) + MOVD $402, R12 + B callbackasm1(SB) + MOVD $403, R12 + B callbackasm1(SB) + MOVD $404, R12 + B callbackasm1(SB) + MOVD $405, R12 + B callbackasm1(SB) + MOVD $406, R12 + B callbackasm1(SB) + MOVD $407, R12 + B callbackasm1(SB) + MOVD $408, R12 + B callbackasm1(SB) + MOVD $409, R12 + B callbackasm1(SB) + MOVD $410, R12 + B callbackasm1(SB) + MOVD $411, R12 + B callbackasm1(SB) + MOVD $412, R12 + B callbackasm1(SB) + MOVD $413, R12 + B callbackasm1(SB) + MOVD $414, R12 + B callbackasm1(SB) + MOVD $415, R12 + B callbackasm1(SB) + MOVD $416, R12 + B callbackasm1(SB) + MOVD $417, R12 + B callbackasm1(SB) + MOVD $418, R12 + B callbackasm1(SB) + MOVD $419, R12 + B callbackasm1(SB) + MOVD $420, R12 + B callbackasm1(SB) + MOVD $421, R12 + B callbackasm1(SB) + MOVD $422, R12 + B callbackasm1(SB) + MOVD $423, R12 + B callbackasm1(SB) + MOVD $424, R12 + B callbackasm1(SB) + MOVD $425, R12 + B callbackasm1(SB) + MOVD $426, R12 + B callbackasm1(SB) + MOVD $427, R12 + B callbackasm1(SB) + MOVD $428, R12 + B callbackasm1(SB) + MOVD $429, R12 + B callbackasm1(SB) + MOVD $430, R12 + B callbackasm1(SB) + MOVD $431, R12 + B callbackasm1(SB) + MOVD $432, R12 + B callbackasm1(SB) + MOVD $433, R12 + B callbackasm1(SB) + MOVD $434, R12 + B callbackasm1(SB) + MOVD $435, R12 + B callbackasm1(SB) + MOVD $436, R12 + B callbackasm1(SB) + MOVD $437, R12 + B callbackasm1(SB) + MOVD $438, R12 + B callbackasm1(SB) + MOVD $439, R12 + B callbackasm1(SB) + MOVD $440, R12 + B callbackasm1(SB) + MOVD $441, R12 + B callbackasm1(SB) + MOVD $442, R12 + B callbackasm1(SB) + MOVD $443, R12 + B callbackasm1(SB) + MOVD $444, R12 + B callbackasm1(SB) + MOVD $445, R12 + B callbackasm1(SB) + MOVD $446, R12 + B callbackasm1(SB) + MOVD $447, R12 + B callbackasm1(SB) + MOVD $448, R12 + B callbackasm1(SB) + MOVD $449, R12 + B callbackasm1(SB) + MOVD $450, R12 + B callbackasm1(SB) + MOVD $451, R12 + B callbackasm1(SB) + MOVD $452, R12 + B callbackasm1(SB) + MOVD $453, R12 + B callbackasm1(SB) + MOVD $454, R12 + B callbackasm1(SB) + MOVD $455, R12 + B callbackasm1(SB) + MOVD $456, R12 + B callbackasm1(SB) + MOVD $457, R12 + B callbackasm1(SB) + MOVD $458, R12 + B callbackasm1(SB) + MOVD $459, R12 + B callbackasm1(SB) + MOVD $460, R12 + B callbackasm1(SB) + MOVD $461, R12 + B callbackasm1(SB) + MOVD $462, R12 + B callbackasm1(SB) + MOVD $463, R12 + B callbackasm1(SB) + MOVD $464, R12 + B callbackasm1(SB) + MOVD $465, R12 + B callbackasm1(SB) + MOVD $466, R12 + B callbackasm1(SB) + MOVD $467, R12 + B callbackasm1(SB) + MOVD $468, R12 + B callbackasm1(SB) + MOVD $469, R12 + B callbackasm1(SB) + MOVD $470, R12 + B callbackasm1(SB) + MOVD $471, R12 + B callbackasm1(SB) + MOVD $472, R12 + B callbackasm1(SB) + MOVD $473, R12 + B callbackasm1(SB) + MOVD $474, R12 + B callbackasm1(SB) + MOVD $475, R12 + B callbackasm1(SB) + MOVD $476, R12 + B callbackasm1(SB) + MOVD $477, R12 + B callbackasm1(SB) + MOVD $478, R12 + B callbackasm1(SB) + MOVD $479, R12 + B callbackasm1(SB) + MOVD $480, R12 + B callbackasm1(SB) + MOVD $481, R12 + B callbackasm1(SB) + MOVD $482, R12 + B callbackasm1(SB) + MOVD $483, R12 + B callbackasm1(SB) + MOVD $484, R12 + B callbackasm1(SB) + MOVD $485, R12 + B callbackasm1(SB) + MOVD $486, R12 + B callbackasm1(SB) + MOVD $487, R12 + B callbackasm1(SB) + MOVD $488, R12 + B callbackasm1(SB) + MOVD $489, R12 + B callbackasm1(SB) + MOVD $490, R12 + B callbackasm1(SB) + MOVD $491, R12 + B callbackasm1(SB) + MOVD $492, R12 + B callbackasm1(SB) + MOVD $493, R12 + B callbackasm1(SB) + MOVD $494, R12 + B callbackasm1(SB) + MOVD $495, R12 + B callbackasm1(SB) + MOVD $496, R12 + B callbackasm1(SB) + MOVD $497, R12 + B callbackasm1(SB) + MOVD $498, R12 + B callbackasm1(SB) + MOVD $499, R12 + B callbackasm1(SB) + MOVD $500, R12 + B callbackasm1(SB) + MOVD $501, R12 + B callbackasm1(SB) + MOVD $502, R12 + B callbackasm1(SB) + MOVD $503, R12 + B callbackasm1(SB) + MOVD $504, R12 + B callbackasm1(SB) + MOVD $505, R12 + B callbackasm1(SB) + MOVD $506, R12 + B callbackasm1(SB) + MOVD $507, R12 + B callbackasm1(SB) + MOVD $508, R12 + B callbackasm1(SB) + MOVD $509, R12 + B callbackasm1(SB) + MOVD $510, R12 + B callbackasm1(SB) + MOVD $511, R12 + B callbackasm1(SB) + MOVD $512, R12 + B callbackasm1(SB) + MOVD $513, R12 + B callbackasm1(SB) + MOVD $514, R12 + B callbackasm1(SB) + MOVD $515, R12 + B callbackasm1(SB) + MOVD $516, R12 + B callbackasm1(SB) + MOVD $517, R12 + B callbackasm1(SB) + MOVD $518, R12 + B callbackasm1(SB) + MOVD $519, R12 + B callbackasm1(SB) + MOVD $520, R12 + B callbackasm1(SB) + MOVD $521, R12 + B callbackasm1(SB) + MOVD $522, R12 + B callbackasm1(SB) + MOVD $523, R12 + B callbackasm1(SB) + MOVD $524, R12 + B callbackasm1(SB) + MOVD $525, R12 + B callbackasm1(SB) + MOVD $526, R12 + B callbackasm1(SB) + MOVD $527, R12 + B callbackasm1(SB) + MOVD $528, R12 + B callbackasm1(SB) + MOVD $529, R12 + B callbackasm1(SB) + MOVD $530, R12 + B callbackasm1(SB) + MOVD $531, R12 + B callbackasm1(SB) + MOVD $532, R12 + B callbackasm1(SB) + MOVD $533, R12 + B callbackasm1(SB) + MOVD $534, R12 + B callbackasm1(SB) + MOVD $535, R12 + B callbackasm1(SB) + MOVD $536, R12 + B callbackasm1(SB) + MOVD $537, R12 + B callbackasm1(SB) + MOVD $538, R12 + B callbackasm1(SB) + MOVD $539, R12 + B callbackasm1(SB) + MOVD $540, R12 + B callbackasm1(SB) + MOVD $541, R12 + B callbackasm1(SB) + MOVD $542, R12 + B callbackasm1(SB) + MOVD $543, R12 + B callbackasm1(SB) + MOVD $544, R12 + B callbackasm1(SB) + MOVD $545, R12 + B callbackasm1(SB) + MOVD $546, R12 + B callbackasm1(SB) + MOVD $547, R12 + B callbackasm1(SB) + MOVD $548, R12 + B callbackasm1(SB) + MOVD $549, R12 + B callbackasm1(SB) + MOVD $550, R12 + B callbackasm1(SB) + MOVD $551, R12 + B callbackasm1(SB) + MOVD $552, R12 + B callbackasm1(SB) + MOVD $553, R12 + B callbackasm1(SB) + MOVD $554, R12 + B callbackasm1(SB) + MOVD $555, R12 + B callbackasm1(SB) + MOVD $556, R12 + B callbackasm1(SB) + MOVD $557, R12 + B callbackasm1(SB) + MOVD $558, R12 + B callbackasm1(SB) + MOVD $559, R12 + B callbackasm1(SB) + MOVD $560, R12 + B callbackasm1(SB) + MOVD $561, R12 + B callbackasm1(SB) + MOVD $562, R12 + B callbackasm1(SB) + MOVD $563, R12 + B callbackasm1(SB) + MOVD $564, R12 + B callbackasm1(SB) + MOVD $565, R12 + B callbackasm1(SB) + MOVD $566, R12 + B callbackasm1(SB) + MOVD $567, R12 + B callbackasm1(SB) + MOVD $568, R12 + B callbackasm1(SB) + MOVD $569, R12 + B callbackasm1(SB) + MOVD $570, R12 + B callbackasm1(SB) + MOVD $571, R12 + B callbackasm1(SB) + MOVD $572, R12 + B callbackasm1(SB) + MOVD $573, R12 + B callbackasm1(SB) + MOVD $574, R12 + B callbackasm1(SB) + MOVD $575, R12 + B callbackasm1(SB) + MOVD $576, R12 + B callbackasm1(SB) + MOVD $577, R12 + B callbackasm1(SB) + MOVD $578, R12 + B callbackasm1(SB) + MOVD $579, R12 + B callbackasm1(SB) + MOVD $580, R12 + B callbackasm1(SB) + MOVD $581, R12 + B callbackasm1(SB) + MOVD $582, R12 + B callbackasm1(SB) + MOVD $583, R12 + B callbackasm1(SB) + MOVD $584, R12 + B callbackasm1(SB) + MOVD $585, R12 + B callbackasm1(SB) + MOVD $586, R12 + B callbackasm1(SB) + MOVD $587, R12 + B callbackasm1(SB) + MOVD $588, R12 + B callbackasm1(SB) + MOVD $589, R12 + B callbackasm1(SB) + MOVD $590, R12 + B callbackasm1(SB) + MOVD $591, R12 + B callbackasm1(SB) + MOVD $592, R12 + B callbackasm1(SB) + MOVD $593, R12 + B callbackasm1(SB) + MOVD $594, R12 + B callbackasm1(SB) + MOVD $595, R12 + B callbackasm1(SB) + MOVD $596, R12 + B callbackasm1(SB) + MOVD $597, R12 + B callbackasm1(SB) + MOVD $598, R12 + B callbackasm1(SB) + MOVD $599, R12 + B callbackasm1(SB) + MOVD $600, R12 + B callbackasm1(SB) + MOVD $601, R12 + B callbackasm1(SB) + MOVD $602, R12 + B callbackasm1(SB) + MOVD $603, R12 + B callbackasm1(SB) + MOVD $604, R12 + B callbackasm1(SB) + MOVD $605, R12 + B callbackasm1(SB) + MOVD $606, R12 + B callbackasm1(SB) + MOVD $607, R12 + B callbackasm1(SB) + MOVD $608, R12 + B callbackasm1(SB) + MOVD $609, R12 + B callbackasm1(SB) + MOVD $610, R12 + B callbackasm1(SB) + MOVD $611, R12 + B callbackasm1(SB) + MOVD $612, R12 + B callbackasm1(SB) + MOVD $613, R12 + B callbackasm1(SB) + MOVD $614, R12 + B callbackasm1(SB) + MOVD $615, R12 + B callbackasm1(SB) + MOVD $616, R12 + B callbackasm1(SB) + MOVD $617, R12 + B callbackasm1(SB) + MOVD $618, R12 + B callbackasm1(SB) + MOVD $619, R12 + B callbackasm1(SB) + MOVD $620, R12 + B callbackasm1(SB) + MOVD $621, R12 + B callbackasm1(SB) + MOVD $622, R12 + B callbackasm1(SB) + MOVD $623, R12 + B callbackasm1(SB) + MOVD $624, R12 + B callbackasm1(SB) + MOVD $625, R12 + B callbackasm1(SB) + MOVD $626, R12 + B callbackasm1(SB) + MOVD $627, R12 + B callbackasm1(SB) + MOVD $628, R12 + B callbackasm1(SB) + MOVD $629, R12 + B callbackasm1(SB) + MOVD $630, R12 + B callbackasm1(SB) + MOVD $631, R12 + B callbackasm1(SB) + MOVD $632, R12 + B callbackasm1(SB) + MOVD $633, R12 + B callbackasm1(SB) + MOVD $634, R12 + B callbackasm1(SB) + MOVD $635, R12 + B callbackasm1(SB) + MOVD $636, R12 + B callbackasm1(SB) + MOVD $637, R12 + B callbackasm1(SB) + MOVD $638, R12 + B callbackasm1(SB) + MOVD $639, R12 + B callbackasm1(SB) + MOVD $640, R12 + B callbackasm1(SB) + MOVD $641, R12 + B callbackasm1(SB) + MOVD $642, R12 + B callbackasm1(SB) + MOVD $643, R12 + B callbackasm1(SB) + MOVD $644, R12 + B callbackasm1(SB) + MOVD $645, R12 + B callbackasm1(SB) + MOVD $646, R12 + B callbackasm1(SB) + MOVD $647, R12 + B callbackasm1(SB) + MOVD $648, R12 + B callbackasm1(SB) + MOVD $649, R12 + B callbackasm1(SB) + MOVD $650, R12 + B callbackasm1(SB) + MOVD $651, R12 + B callbackasm1(SB) + MOVD $652, R12 + B callbackasm1(SB) + MOVD $653, R12 + B callbackasm1(SB) + MOVD $654, R12 + B callbackasm1(SB) + MOVD $655, R12 + B callbackasm1(SB) + MOVD $656, R12 + B callbackasm1(SB) + MOVD $657, R12 + B callbackasm1(SB) + MOVD $658, R12 + B callbackasm1(SB) + MOVD $659, R12 + B callbackasm1(SB) + MOVD $660, R12 + B callbackasm1(SB) + MOVD $661, R12 + B callbackasm1(SB) + MOVD $662, R12 + B callbackasm1(SB) + MOVD $663, R12 + B callbackasm1(SB) + MOVD $664, R12 + B callbackasm1(SB) + MOVD $665, R12 + B callbackasm1(SB) + MOVD $666, R12 + B callbackasm1(SB) + MOVD $667, R12 + B callbackasm1(SB) + MOVD $668, R12 + B callbackasm1(SB) + MOVD $669, R12 + B callbackasm1(SB) + MOVD $670, R12 + B callbackasm1(SB) + MOVD $671, R12 + B callbackasm1(SB) + MOVD $672, R12 + B callbackasm1(SB) + MOVD $673, R12 + B callbackasm1(SB) + MOVD $674, R12 + B callbackasm1(SB) + MOVD $675, R12 + B callbackasm1(SB) + MOVD $676, R12 + B callbackasm1(SB) + MOVD $677, R12 + B callbackasm1(SB) + MOVD $678, R12 + B callbackasm1(SB) + MOVD $679, R12 + B callbackasm1(SB) + MOVD $680, R12 + B callbackasm1(SB) + MOVD $681, R12 + B callbackasm1(SB) + MOVD $682, R12 + B callbackasm1(SB) + MOVD $683, R12 + B callbackasm1(SB) + MOVD $684, R12 + B callbackasm1(SB) + MOVD $685, R12 + B callbackasm1(SB) + MOVD $686, R12 + B callbackasm1(SB) + MOVD $687, R12 + B callbackasm1(SB) + MOVD $688, R12 + B callbackasm1(SB) + MOVD $689, R12 + B callbackasm1(SB) + MOVD $690, R12 + B callbackasm1(SB) + MOVD $691, R12 + B callbackasm1(SB) + MOVD $692, R12 + B callbackasm1(SB) + MOVD $693, R12 + B callbackasm1(SB) + MOVD $694, R12 + B callbackasm1(SB) + MOVD $695, R12 + B callbackasm1(SB) + MOVD $696, R12 + B callbackasm1(SB) + MOVD $697, R12 + B callbackasm1(SB) + MOVD $698, R12 + B callbackasm1(SB) + MOVD $699, R12 + B callbackasm1(SB) + MOVD $700, R12 + B callbackasm1(SB) + MOVD $701, R12 + B callbackasm1(SB) + MOVD $702, R12 + B callbackasm1(SB) + MOVD $703, R12 + B callbackasm1(SB) + MOVD $704, R12 + B callbackasm1(SB) + MOVD $705, R12 + B callbackasm1(SB) + MOVD $706, R12 + B callbackasm1(SB) + MOVD $707, R12 + B callbackasm1(SB) + MOVD $708, R12 + B callbackasm1(SB) + MOVD $709, R12 + B callbackasm1(SB) + MOVD $710, R12 + B callbackasm1(SB) + MOVD $711, R12 + B callbackasm1(SB) + MOVD $712, R12 + B callbackasm1(SB) + MOVD $713, R12 + B callbackasm1(SB) + MOVD $714, R12 + B callbackasm1(SB) + MOVD $715, R12 + B callbackasm1(SB) + MOVD $716, R12 + B callbackasm1(SB) + MOVD $717, R12 + B callbackasm1(SB) + MOVD $718, R12 + B callbackasm1(SB) + MOVD $719, R12 + B callbackasm1(SB) + MOVD $720, R12 + B callbackasm1(SB) + MOVD $721, R12 + B callbackasm1(SB) + MOVD $722, R12 + B callbackasm1(SB) + MOVD $723, R12 + B callbackasm1(SB) + MOVD $724, R12 + B callbackasm1(SB) + MOVD $725, R12 + B callbackasm1(SB) + MOVD $726, R12 + B callbackasm1(SB) + MOVD $727, R12 + B callbackasm1(SB) + MOVD $728, R12 + B callbackasm1(SB) + MOVD $729, R12 + B callbackasm1(SB) + MOVD $730, R12 + B callbackasm1(SB) + MOVD $731, R12 + B callbackasm1(SB) + MOVD $732, R12 + B callbackasm1(SB) + MOVD $733, R12 + B callbackasm1(SB) + MOVD $734, R12 + B callbackasm1(SB) + MOVD $735, R12 + B callbackasm1(SB) + MOVD $736, R12 + B callbackasm1(SB) + MOVD $737, R12 + B callbackasm1(SB) + MOVD $738, R12 + B callbackasm1(SB) + MOVD $739, R12 + B callbackasm1(SB) + MOVD $740, R12 + B callbackasm1(SB) + MOVD $741, R12 + B callbackasm1(SB) + MOVD $742, R12 + B callbackasm1(SB) + MOVD $743, R12 + B callbackasm1(SB) + MOVD $744, R12 + B callbackasm1(SB) + MOVD $745, R12 + B callbackasm1(SB) + MOVD $746, R12 + B callbackasm1(SB) + MOVD $747, R12 + B callbackasm1(SB) + MOVD $748, R12 + B callbackasm1(SB) + MOVD $749, R12 + B callbackasm1(SB) + MOVD $750, R12 + B callbackasm1(SB) + MOVD $751, R12 + B callbackasm1(SB) + MOVD $752, R12 + B callbackasm1(SB) + MOVD $753, R12 + B callbackasm1(SB) + MOVD $754, R12 + B callbackasm1(SB) + MOVD $755, R12 + B callbackasm1(SB) + MOVD $756, R12 + B callbackasm1(SB) + MOVD $757, R12 + B callbackasm1(SB) + MOVD $758, R12 + B callbackasm1(SB) + MOVD $759, R12 + B callbackasm1(SB) + MOVD $760, R12 + B callbackasm1(SB) + MOVD $761, R12 + B callbackasm1(SB) + MOVD $762, R12 + B callbackasm1(SB) + MOVD $763, R12 + B callbackasm1(SB) + MOVD $764, R12 + B callbackasm1(SB) + MOVD $765, R12 + B callbackasm1(SB) + MOVD $766, R12 + B callbackasm1(SB) + MOVD $767, R12 + B callbackasm1(SB) + MOVD $768, R12 + B callbackasm1(SB) + MOVD $769, R12 + B callbackasm1(SB) + MOVD $770, R12 + B callbackasm1(SB) + MOVD $771, R12 + B callbackasm1(SB) + MOVD $772, R12 + B callbackasm1(SB) + MOVD $773, R12 + B callbackasm1(SB) + MOVD $774, R12 + B callbackasm1(SB) + MOVD $775, R12 + B callbackasm1(SB) + MOVD $776, R12 + B callbackasm1(SB) + MOVD $777, R12 + B callbackasm1(SB) + MOVD $778, R12 + B callbackasm1(SB) + MOVD $779, R12 + B callbackasm1(SB) + MOVD $780, R12 + B callbackasm1(SB) + MOVD $781, R12 + B callbackasm1(SB) + MOVD $782, R12 + B callbackasm1(SB) + MOVD $783, R12 + B callbackasm1(SB) + MOVD $784, R12 + B callbackasm1(SB) + MOVD $785, R12 + B callbackasm1(SB) + MOVD $786, R12 + B callbackasm1(SB) + MOVD $787, R12 + B callbackasm1(SB) + MOVD $788, R12 + B callbackasm1(SB) + MOVD $789, R12 + B callbackasm1(SB) + MOVD $790, R12 + B callbackasm1(SB) + MOVD $791, R12 + B callbackasm1(SB) + MOVD $792, R12 + B callbackasm1(SB) + MOVD $793, R12 + B callbackasm1(SB) + MOVD $794, R12 + B callbackasm1(SB) + MOVD $795, R12 + B callbackasm1(SB) + MOVD $796, R12 + B callbackasm1(SB) + MOVD $797, R12 + B callbackasm1(SB) + MOVD $798, R12 + B callbackasm1(SB) + MOVD $799, R12 + B callbackasm1(SB) + MOVD $800, R12 + B callbackasm1(SB) + MOVD $801, R12 + B callbackasm1(SB) + MOVD $802, R12 + B callbackasm1(SB) + MOVD $803, R12 + B callbackasm1(SB) + MOVD $804, R12 + B callbackasm1(SB) + MOVD $805, R12 + B callbackasm1(SB) + MOVD $806, R12 + B callbackasm1(SB) + MOVD $807, R12 + B callbackasm1(SB) + MOVD $808, R12 + B callbackasm1(SB) + MOVD $809, R12 + B callbackasm1(SB) + MOVD $810, R12 + B callbackasm1(SB) + MOVD $811, R12 + B callbackasm1(SB) + MOVD $812, R12 + B callbackasm1(SB) + MOVD $813, R12 + B callbackasm1(SB) + MOVD $814, R12 + B callbackasm1(SB) + MOVD $815, R12 + B callbackasm1(SB) + MOVD $816, R12 + B callbackasm1(SB) + MOVD $817, R12 + B callbackasm1(SB) + MOVD $818, R12 + B callbackasm1(SB) + MOVD $819, R12 + B callbackasm1(SB) + MOVD $820, R12 + B callbackasm1(SB) + MOVD $821, R12 + B callbackasm1(SB) + MOVD $822, R12 + B callbackasm1(SB) + MOVD $823, R12 + B callbackasm1(SB) + MOVD $824, R12 + B callbackasm1(SB) + MOVD $825, R12 + B callbackasm1(SB) + MOVD $826, R12 + B callbackasm1(SB) + MOVD $827, R12 + B callbackasm1(SB) + MOVD $828, R12 + B callbackasm1(SB) + MOVD $829, R12 + B callbackasm1(SB) + MOVD $830, R12 + B callbackasm1(SB) + MOVD $831, R12 + B callbackasm1(SB) + MOVD $832, R12 + B callbackasm1(SB) + MOVD $833, R12 + B callbackasm1(SB) + MOVD $834, R12 + B callbackasm1(SB) + MOVD $835, R12 + B callbackasm1(SB) + MOVD $836, R12 + B callbackasm1(SB) + MOVD $837, R12 + B callbackasm1(SB) + MOVD $838, R12 + B callbackasm1(SB) + MOVD $839, R12 + B callbackasm1(SB) + MOVD $840, R12 + B callbackasm1(SB) + MOVD $841, R12 + B callbackasm1(SB) + MOVD $842, R12 + B callbackasm1(SB) + MOVD $843, R12 + B callbackasm1(SB) + MOVD $844, R12 + B callbackasm1(SB) + MOVD $845, R12 + B callbackasm1(SB) + MOVD $846, R12 + B callbackasm1(SB) + MOVD $847, R12 + B callbackasm1(SB) + MOVD $848, R12 + B callbackasm1(SB) + MOVD $849, R12 + B callbackasm1(SB) + MOVD $850, R12 + B callbackasm1(SB) + MOVD $851, R12 + B callbackasm1(SB) + MOVD $852, R12 + B callbackasm1(SB) + MOVD $853, R12 + B callbackasm1(SB) + MOVD $854, R12 + B callbackasm1(SB) + MOVD $855, R12 + B callbackasm1(SB) + MOVD $856, R12 + B callbackasm1(SB) + MOVD $857, R12 + B callbackasm1(SB) + MOVD $858, R12 + B callbackasm1(SB) + MOVD $859, R12 + B callbackasm1(SB) + MOVD $860, R12 + B callbackasm1(SB) + MOVD $861, R12 + B callbackasm1(SB) + MOVD $862, R12 + B callbackasm1(SB) + MOVD $863, R12 + B callbackasm1(SB) + MOVD $864, R12 + B callbackasm1(SB) + MOVD $865, R12 + B callbackasm1(SB) + MOVD $866, R12 + B callbackasm1(SB) + MOVD $867, R12 + B callbackasm1(SB) + MOVD $868, R12 + B callbackasm1(SB) + MOVD $869, R12 + B callbackasm1(SB) + MOVD $870, R12 + B callbackasm1(SB) + MOVD $871, R12 + B callbackasm1(SB) + MOVD $872, R12 + B callbackasm1(SB) + MOVD $873, R12 + B callbackasm1(SB) + MOVD $874, R12 + B callbackasm1(SB) + MOVD $875, R12 + B callbackasm1(SB) + MOVD $876, R12 + B callbackasm1(SB) + MOVD $877, R12 + B callbackasm1(SB) + MOVD $878, R12 + B callbackasm1(SB) + MOVD $879, R12 + B callbackasm1(SB) + MOVD $880, R12 + B callbackasm1(SB) + MOVD $881, R12 + B callbackasm1(SB) + MOVD $882, R12 + B callbackasm1(SB) + MOVD $883, R12 + B callbackasm1(SB) + MOVD $884, R12 + B callbackasm1(SB) + MOVD $885, R12 + B callbackasm1(SB) + MOVD $886, R12 + B callbackasm1(SB) + MOVD $887, R12 + B callbackasm1(SB) + MOVD $888, R12 + B callbackasm1(SB) + MOVD $889, R12 + B callbackasm1(SB) + MOVD $890, R12 + B callbackasm1(SB) + MOVD $891, R12 + B callbackasm1(SB) + MOVD $892, R12 + B callbackasm1(SB) + MOVD $893, R12 + B callbackasm1(SB) + MOVD $894, R12 + B callbackasm1(SB) + MOVD $895, R12 + B callbackasm1(SB) + MOVD $896, R12 + B callbackasm1(SB) + MOVD $897, R12 + B callbackasm1(SB) + MOVD $898, R12 + B callbackasm1(SB) + MOVD $899, R12 + B callbackasm1(SB) + MOVD $900, R12 + B callbackasm1(SB) + MOVD $901, R12 + B callbackasm1(SB) + MOVD $902, R12 + B callbackasm1(SB) + MOVD $903, R12 + B callbackasm1(SB) + MOVD $904, R12 + B callbackasm1(SB) + MOVD $905, R12 + B callbackasm1(SB) + MOVD $906, R12 + B callbackasm1(SB) + MOVD $907, R12 + B callbackasm1(SB) + MOVD $908, R12 + B callbackasm1(SB) + MOVD $909, R12 + B callbackasm1(SB) + MOVD $910, R12 + B callbackasm1(SB) + MOVD $911, R12 + B callbackasm1(SB) + MOVD $912, R12 + B callbackasm1(SB) + MOVD $913, R12 + B callbackasm1(SB) + MOVD $914, R12 + B callbackasm1(SB) + MOVD $915, R12 + B callbackasm1(SB) + MOVD $916, R12 + B callbackasm1(SB) + MOVD $917, R12 + B callbackasm1(SB) + MOVD $918, R12 + B callbackasm1(SB) + MOVD $919, R12 + B callbackasm1(SB) + MOVD $920, R12 + B callbackasm1(SB) + MOVD $921, R12 + B callbackasm1(SB) + MOVD $922, R12 + B callbackasm1(SB) + MOVD $923, R12 + B callbackasm1(SB) + MOVD $924, R12 + B callbackasm1(SB) + MOVD $925, R12 + B callbackasm1(SB) + MOVD $926, R12 + B callbackasm1(SB) + MOVD $927, R12 + B callbackasm1(SB) + MOVD $928, R12 + B callbackasm1(SB) + MOVD $929, R12 + B callbackasm1(SB) + MOVD $930, R12 + B callbackasm1(SB) + MOVD $931, R12 + B callbackasm1(SB) + MOVD $932, R12 + B callbackasm1(SB) + MOVD $933, R12 + B callbackasm1(SB) + MOVD $934, R12 + B callbackasm1(SB) + MOVD $935, R12 + B callbackasm1(SB) + MOVD $936, R12 + B callbackasm1(SB) + MOVD $937, R12 + B callbackasm1(SB) + MOVD $938, R12 + B callbackasm1(SB) + MOVD $939, R12 + B callbackasm1(SB) + MOVD $940, R12 + B callbackasm1(SB) + MOVD $941, R12 + B callbackasm1(SB) + MOVD $942, R12 + B callbackasm1(SB) + MOVD $943, R12 + B callbackasm1(SB) + MOVD $944, R12 + B callbackasm1(SB) + MOVD $945, R12 + B callbackasm1(SB) + MOVD $946, R12 + B callbackasm1(SB) + MOVD $947, R12 + B callbackasm1(SB) + MOVD $948, R12 + B callbackasm1(SB) + MOVD $949, R12 + B callbackasm1(SB) + MOVD $950, R12 + B callbackasm1(SB) + MOVD $951, R12 + B callbackasm1(SB) + MOVD $952, R12 + B callbackasm1(SB) + MOVD $953, R12 + B callbackasm1(SB) + MOVD $954, R12 + B callbackasm1(SB) + MOVD $955, R12 + B callbackasm1(SB) + MOVD $956, R12 + B callbackasm1(SB) + MOVD $957, R12 + B callbackasm1(SB) + MOVD $958, R12 + B callbackasm1(SB) + MOVD $959, R12 + B callbackasm1(SB) + MOVD $960, R12 + B callbackasm1(SB) + MOVD $961, R12 + B callbackasm1(SB) + MOVD $962, R12 + B callbackasm1(SB) + MOVD $963, R12 + B callbackasm1(SB) + MOVD $964, R12 + B callbackasm1(SB) + MOVD $965, R12 + B callbackasm1(SB) + MOVD $966, R12 + B callbackasm1(SB) + MOVD $967, R12 + B callbackasm1(SB) + MOVD $968, R12 + B callbackasm1(SB) + MOVD $969, R12 + B callbackasm1(SB) + MOVD $970, R12 + B callbackasm1(SB) + MOVD $971, R12 + B callbackasm1(SB) + MOVD $972, R12 + B callbackasm1(SB) + MOVD $973, R12 + B callbackasm1(SB) + MOVD $974, R12 + B callbackasm1(SB) + MOVD $975, R12 + B callbackasm1(SB) + MOVD $976, R12 + B callbackasm1(SB) + MOVD $977, R12 + B callbackasm1(SB) + MOVD $978, R12 + B callbackasm1(SB) + MOVD $979, R12 + B callbackasm1(SB) + MOVD $980, R12 + B callbackasm1(SB) + MOVD $981, R12 + B callbackasm1(SB) + MOVD $982, R12 + B callbackasm1(SB) + MOVD $983, R12 + B callbackasm1(SB) + MOVD $984, R12 + B callbackasm1(SB) + MOVD $985, R12 + B callbackasm1(SB) + MOVD $986, R12 + B callbackasm1(SB) + MOVD $987, R12 + B callbackasm1(SB) + MOVD $988, R12 + B callbackasm1(SB) + MOVD $989, R12 + B callbackasm1(SB) + MOVD $990, R12 + B callbackasm1(SB) + MOVD $991, R12 + B callbackasm1(SB) + MOVD $992, R12 + B callbackasm1(SB) + MOVD $993, R12 + B callbackasm1(SB) + MOVD $994, R12 + B callbackasm1(SB) + MOVD $995, R12 + B callbackasm1(SB) + MOVD $996, R12 + B callbackasm1(SB) + MOVD $997, R12 + B callbackasm1(SB) + MOVD $998, R12 + B callbackasm1(SB) + MOVD $999, R12 + B callbackasm1(SB) + MOVD $1000, R12 + B callbackasm1(SB) + MOVD $1001, R12 + B callbackasm1(SB) + MOVD $1002, R12 + B callbackasm1(SB) + MOVD $1003, R12 + B callbackasm1(SB) + MOVD $1004, R12 + B callbackasm1(SB) + MOVD $1005, R12 + B callbackasm1(SB) + MOVD $1006, R12 + B callbackasm1(SB) + MOVD $1007, R12 + B callbackasm1(SB) + MOVD $1008, R12 + B callbackasm1(SB) + MOVD $1009, R12 + B callbackasm1(SB) + MOVD $1010, R12 + B callbackasm1(SB) + MOVD $1011, R12 + B callbackasm1(SB) + MOVD $1012, R12 + B callbackasm1(SB) + MOVD $1013, R12 + B callbackasm1(SB) + MOVD $1014, R12 + B callbackasm1(SB) + MOVD $1015, R12 + B callbackasm1(SB) + MOVD $1016, R12 + B callbackasm1(SB) + MOVD $1017, R12 + B callbackasm1(SB) + MOVD $1018, R12 + B callbackasm1(SB) + MOVD $1019, R12 + B callbackasm1(SB) + MOVD $1020, R12 + B callbackasm1(SB) + MOVD $1021, R12 + B callbackasm1(SB) + MOVD $1022, R12 + B callbackasm1(SB) + MOVD $1023, R12 + B callbackasm1(SB) + MOVD $1024, R12 + B callbackasm1(SB) + MOVD $1025, R12 + B callbackasm1(SB) + MOVD $1026, R12 + B callbackasm1(SB) + MOVD $1027, R12 + B callbackasm1(SB) + MOVD $1028, R12 + B callbackasm1(SB) + MOVD $1029, R12 + B callbackasm1(SB) + MOVD $1030, R12 + B callbackasm1(SB) + MOVD $1031, R12 + B callbackasm1(SB) + MOVD $1032, R12 + B callbackasm1(SB) + MOVD $1033, R12 + B callbackasm1(SB) + MOVD $1034, R12 + B callbackasm1(SB) + MOVD $1035, R12 + B callbackasm1(SB) + MOVD $1036, R12 + B callbackasm1(SB) + MOVD $1037, R12 + B callbackasm1(SB) + MOVD $1038, R12 + B callbackasm1(SB) + MOVD $1039, R12 + B callbackasm1(SB) + MOVD $1040, R12 + B callbackasm1(SB) + MOVD $1041, R12 + B callbackasm1(SB) + MOVD $1042, R12 + B callbackasm1(SB) + MOVD $1043, R12 + B callbackasm1(SB) + MOVD $1044, R12 + B callbackasm1(SB) + MOVD $1045, R12 + B callbackasm1(SB) + MOVD $1046, R12 + B callbackasm1(SB) + MOVD $1047, R12 + B callbackasm1(SB) + MOVD $1048, R12 + B callbackasm1(SB) + MOVD $1049, R12 + B callbackasm1(SB) + MOVD $1050, R12 + B callbackasm1(SB) + MOVD $1051, R12 + B callbackasm1(SB) + MOVD $1052, R12 + B callbackasm1(SB) + MOVD $1053, R12 + B callbackasm1(SB) + MOVD $1054, R12 + B callbackasm1(SB) + MOVD $1055, R12 + B callbackasm1(SB) + MOVD $1056, R12 + B callbackasm1(SB) + MOVD $1057, R12 + B callbackasm1(SB) + MOVD $1058, R12 + B callbackasm1(SB) + MOVD $1059, R12 + B callbackasm1(SB) + MOVD $1060, R12 + B callbackasm1(SB) + MOVD $1061, R12 + B callbackasm1(SB) + MOVD $1062, R12 + B callbackasm1(SB) + MOVD $1063, R12 + B callbackasm1(SB) + MOVD $1064, R12 + B callbackasm1(SB) + MOVD $1065, R12 + B callbackasm1(SB) + MOVD $1066, R12 + B callbackasm1(SB) + MOVD $1067, R12 + B callbackasm1(SB) + MOVD $1068, R12 + B callbackasm1(SB) + MOVD $1069, R12 + B callbackasm1(SB) + MOVD $1070, R12 + B callbackasm1(SB) + MOVD $1071, R12 + B callbackasm1(SB) + MOVD $1072, R12 + B callbackasm1(SB) + MOVD $1073, R12 + B callbackasm1(SB) + MOVD $1074, R12 + B callbackasm1(SB) + MOVD $1075, R12 + B callbackasm1(SB) + MOVD $1076, R12 + B callbackasm1(SB) + MOVD $1077, R12 + B callbackasm1(SB) + MOVD $1078, R12 + B callbackasm1(SB) + MOVD $1079, R12 + B callbackasm1(SB) + MOVD $1080, R12 + B callbackasm1(SB) + MOVD $1081, R12 + B callbackasm1(SB) + MOVD $1082, R12 + B callbackasm1(SB) + MOVD $1083, R12 + B callbackasm1(SB) + MOVD $1084, R12 + B callbackasm1(SB) + MOVD $1085, R12 + B callbackasm1(SB) + MOVD $1086, R12 + B callbackasm1(SB) + MOVD $1087, R12 + B callbackasm1(SB) + MOVD $1088, R12 + B callbackasm1(SB) + MOVD $1089, R12 + B callbackasm1(SB) + MOVD $1090, R12 + B callbackasm1(SB) + MOVD $1091, R12 + B callbackasm1(SB) + MOVD $1092, R12 + B callbackasm1(SB) + MOVD $1093, R12 + B callbackasm1(SB) + MOVD $1094, R12 + B callbackasm1(SB) + MOVD $1095, R12 + B callbackasm1(SB) + MOVD $1096, R12 + B callbackasm1(SB) + MOVD $1097, R12 + B callbackasm1(SB) + MOVD $1098, R12 + B callbackasm1(SB) + MOVD $1099, R12 + B callbackasm1(SB) + MOVD $1100, R12 + B callbackasm1(SB) + MOVD $1101, R12 + B callbackasm1(SB) + MOVD $1102, R12 + B callbackasm1(SB) + MOVD $1103, R12 + B callbackasm1(SB) + MOVD $1104, R12 + B callbackasm1(SB) + MOVD $1105, R12 + B callbackasm1(SB) + MOVD $1106, R12 + B callbackasm1(SB) + MOVD $1107, R12 + B callbackasm1(SB) + MOVD $1108, R12 + B callbackasm1(SB) + MOVD $1109, R12 + B callbackasm1(SB) + MOVD $1110, R12 + B callbackasm1(SB) + MOVD $1111, R12 + B callbackasm1(SB) + MOVD $1112, R12 + B callbackasm1(SB) + MOVD $1113, R12 + B callbackasm1(SB) + MOVD $1114, R12 + B callbackasm1(SB) + MOVD $1115, R12 + B callbackasm1(SB) + MOVD $1116, R12 + B callbackasm1(SB) + MOVD $1117, R12 + B callbackasm1(SB) + MOVD $1118, R12 + B callbackasm1(SB) + MOVD $1119, R12 + B callbackasm1(SB) + MOVD $1120, R12 + B callbackasm1(SB) + MOVD $1121, R12 + B callbackasm1(SB) + MOVD $1122, R12 + B callbackasm1(SB) + MOVD $1123, R12 + B callbackasm1(SB) + MOVD $1124, R12 + B callbackasm1(SB) + MOVD $1125, R12 + B callbackasm1(SB) + MOVD $1126, R12 + B callbackasm1(SB) + MOVD $1127, R12 + B callbackasm1(SB) + MOVD $1128, R12 + B callbackasm1(SB) + MOVD $1129, R12 + B callbackasm1(SB) + MOVD $1130, R12 + B callbackasm1(SB) + MOVD $1131, R12 + B callbackasm1(SB) + MOVD $1132, R12 + B callbackasm1(SB) + MOVD $1133, R12 + B callbackasm1(SB) + MOVD $1134, R12 + B callbackasm1(SB) + MOVD $1135, R12 + B callbackasm1(SB) + MOVD $1136, R12 + B callbackasm1(SB) + MOVD $1137, R12 + B callbackasm1(SB) + MOVD $1138, R12 + B callbackasm1(SB) + MOVD $1139, R12 + B callbackasm1(SB) + MOVD $1140, R12 + B callbackasm1(SB) + MOVD $1141, R12 + B callbackasm1(SB) + MOVD $1142, R12 + B callbackasm1(SB) + MOVD $1143, R12 + B callbackasm1(SB) + MOVD $1144, R12 + B callbackasm1(SB) + MOVD $1145, R12 + B callbackasm1(SB) + MOVD $1146, R12 + B callbackasm1(SB) + MOVD $1147, R12 + B callbackasm1(SB) + MOVD $1148, R12 + B callbackasm1(SB) + MOVD $1149, R12 + B callbackasm1(SB) + MOVD $1150, R12 + B callbackasm1(SB) + MOVD $1151, R12 + B callbackasm1(SB) + MOVD $1152, R12 + B callbackasm1(SB) + MOVD $1153, R12 + B callbackasm1(SB) + MOVD $1154, R12 + B callbackasm1(SB) + MOVD $1155, R12 + B callbackasm1(SB) + MOVD $1156, R12 + B callbackasm1(SB) + MOVD $1157, R12 + B callbackasm1(SB) + MOVD $1158, R12 + B callbackasm1(SB) + MOVD $1159, R12 + B callbackasm1(SB) + MOVD $1160, R12 + B callbackasm1(SB) + MOVD $1161, R12 + B callbackasm1(SB) + MOVD $1162, R12 + B callbackasm1(SB) + MOVD $1163, R12 + B callbackasm1(SB) + MOVD $1164, R12 + B callbackasm1(SB) + MOVD $1165, R12 + B callbackasm1(SB) + MOVD $1166, R12 + B callbackasm1(SB) + MOVD $1167, R12 + B callbackasm1(SB) + MOVD $1168, R12 + B callbackasm1(SB) + MOVD $1169, R12 + B callbackasm1(SB) + MOVD $1170, R12 + B callbackasm1(SB) + MOVD $1171, R12 + B callbackasm1(SB) + MOVD $1172, R12 + B callbackasm1(SB) + MOVD $1173, R12 + B callbackasm1(SB) + MOVD $1174, R12 + B callbackasm1(SB) + MOVD $1175, R12 + B callbackasm1(SB) + MOVD $1176, R12 + B callbackasm1(SB) + MOVD $1177, R12 + B callbackasm1(SB) + MOVD $1178, R12 + B callbackasm1(SB) + MOVD $1179, R12 + B callbackasm1(SB) + MOVD $1180, R12 + B callbackasm1(SB) + MOVD $1181, R12 + B callbackasm1(SB) + MOVD $1182, R12 + B callbackasm1(SB) + MOVD $1183, R12 + B callbackasm1(SB) + MOVD $1184, R12 + B callbackasm1(SB) + MOVD $1185, R12 + B callbackasm1(SB) + MOVD $1186, R12 + B callbackasm1(SB) + MOVD $1187, R12 + B callbackasm1(SB) + MOVD $1188, R12 + B callbackasm1(SB) + MOVD $1189, R12 + B callbackasm1(SB) + MOVD $1190, R12 + B callbackasm1(SB) + MOVD $1191, R12 + B callbackasm1(SB) + MOVD $1192, R12 + B callbackasm1(SB) + MOVD $1193, R12 + B callbackasm1(SB) + MOVD $1194, R12 + B callbackasm1(SB) + MOVD $1195, R12 + B callbackasm1(SB) + MOVD $1196, R12 + B callbackasm1(SB) + MOVD $1197, R12 + B callbackasm1(SB) + MOVD $1198, R12 + B callbackasm1(SB) + MOVD $1199, R12 + B callbackasm1(SB) + MOVD $1200, R12 + B callbackasm1(SB) + MOVD $1201, R12 + B callbackasm1(SB) + MOVD $1202, R12 + B callbackasm1(SB) + MOVD $1203, R12 + B callbackasm1(SB) + MOVD $1204, R12 + B callbackasm1(SB) + MOVD $1205, R12 + B callbackasm1(SB) + MOVD $1206, R12 + B callbackasm1(SB) + MOVD $1207, R12 + B callbackasm1(SB) + MOVD $1208, R12 + B callbackasm1(SB) + MOVD $1209, R12 + B callbackasm1(SB) + MOVD $1210, R12 + B callbackasm1(SB) + MOVD $1211, R12 + B callbackasm1(SB) + MOVD $1212, R12 + B callbackasm1(SB) + MOVD $1213, R12 + B callbackasm1(SB) + MOVD $1214, R12 + B callbackasm1(SB) + MOVD $1215, R12 + B callbackasm1(SB) + MOVD $1216, R12 + B callbackasm1(SB) + MOVD $1217, R12 + B callbackasm1(SB) + MOVD $1218, R12 + B callbackasm1(SB) + MOVD $1219, R12 + B callbackasm1(SB) + MOVD $1220, R12 + B callbackasm1(SB) + MOVD $1221, R12 + B callbackasm1(SB) + MOVD $1222, R12 + B callbackasm1(SB) + MOVD $1223, R12 + B callbackasm1(SB) + MOVD $1224, R12 + B callbackasm1(SB) + MOVD $1225, R12 + B callbackasm1(SB) + MOVD $1226, R12 + B callbackasm1(SB) + MOVD $1227, R12 + B callbackasm1(SB) + MOVD $1228, R12 + B callbackasm1(SB) + MOVD $1229, R12 + B callbackasm1(SB) + MOVD $1230, R12 + B callbackasm1(SB) + MOVD $1231, R12 + B callbackasm1(SB) + MOVD $1232, R12 + B callbackasm1(SB) + MOVD $1233, R12 + B callbackasm1(SB) + MOVD $1234, R12 + B callbackasm1(SB) + MOVD $1235, R12 + B callbackasm1(SB) + MOVD $1236, R12 + B callbackasm1(SB) + MOVD $1237, R12 + B callbackasm1(SB) + MOVD $1238, R12 + B callbackasm1(SB) + MOVD $1239, R12 + B callbackasm1(SB) + MOVD $1240, R12 + B callbackasm1(SB) + MOVD $1241, R12 + B callbackasm1(SB) + MOVD $1242, R12 + B callbackasm1(SB) + MOVD $1243, R12 + B callbackasm1(SB) + MOVD $1244, R12 + B callbackasm1(SB) + MOVD $1245, R12 + B callbackasm1(SB) + MOVD $1246, R12 + B callbackasm1(SB) + MOVD $1247, R12 + B callbackasm1(SB) + MOVD $1248, R12 + B callbackasm1(SB) + MOVD $1249, R12 + B callbackasm1(SB) + MOVD $1250, R12 + B callbackasm1(SB) + MOVD $1251, R12 + B callbackasm1(SB) + MOVD $1252, R12 + B callbackasm1(SB) + MOVD $1253, R12 + B callbackasm1(SB) + MOVD $1254, R12 + B callbackasm1(SB) + MOVD $1255, R12 + B callbackasm1(SB) + MOVD $1256, R12 + B callbackasm1(SB) + MOVD $1257, R12 + B callbackasm1(SB) + MOVD $1258, R12 + B callbackasm1(SB) + MOVD $1259, R12 + B callbackasm1(SB) + MOVD $1260, R12 + B callbackasm1(SB) + MOVD $1261, R12 + B callbackasm1(SB) + MOVD $1262, R12 + B callbackasm1(SB) + MOVD $1263, R12 + B callbackasm1(SB) + MOVD $1264, R12 + B callbackasm1(SB) + MOVD $1265, R12 + B callbackasm1(SB) + MOVD $1266, R12 + B callbackasm1(SB) + MOVD $1267, R12 + B callbackasm1(SB) + MOVD $1268, R12 + B callbackasm1(SB) + MOVD $1269, R12 + B callbackasm1(SB) + MOVD $1270, R12 + B callbackasm1(SB) + MOVD $1271, R12 + B callbackasm1(SB) + MOVD $1272, R12 + B callbackasm1(SB) + MOVD $1273, R12 + B callbackasm1(SB) + MOVD $1274, R12 + B callbackasm1(SB) + MOVD $1275, R12 + B callbackasm1(SB) + MOVD $1276, R12 + B callbackasm1(SB) + MOVD $1277, R12 + B callbackasm1(SB) + MOVD $1278, R12 + B callbackasm1(SB) + MOVD $1279, R12 + B callbackasm1(SB) + MOVD $1280, R12 + B callbackasm1(SB) + MOVD $1281, R12 + B callbackasm1(SB) + MOVD $1282, R12 + B callbackasm1(SB) + MOVD $1283, R12 + B callbackasm1(SB) + MOVD $1284, R12 + B callbackasm1(SB) + MOVD $1285, R12 + B callbackasm1(SB) + MOVD $1286, R12 + B callbackasm1(SB) + MOVD $1287, R12 + B callbackasm1(SB) + MOVD $1288, R12 + B callbackasm1(SB) + MOVD $1289, R12 + B callbackasm1(SB) + MOVD $1290, R12 + B callbackasm1(SB) + MOVD $1291, R12 + B callbackasm1(SB) + MOVD $1292, R12 + B callbackasm1(SB) + MOVD $1293, R12 + B callbackasm1(SB) + MOVD $1294, R12 + B callbackasm1(SB) + MOVD $1295, R12 + B callbackasm1(SB) + MOVD $1296, R12 + B callbackasm1(SB) + MOVD $1297, R12 + B callbackasm1(SB) + MOVD $1298, R12 + B callbackasm1(SB) + MOVD $1299, R12 + B callbackasm1(SB) + MOVD $1300, R12 + B callbackasm1(SB) + MOVD $1301, R12 + B callbackasm1(SB) + MOVD $1302, R12 + B callbackasm1(SB) + MOVD $1303, R12 + B callbackasm1(SB) + MOVD $1304, R12 + B callbackasm1(SB) + MOVD $1305, R12 + B callbackasm1(SB) + MOVD $1306, R12 + B callbackasm1(SB) + MOVD $1307, R12 + B callbackasm1(SB) + MOVD $1308, R12 + B callbackasm1(SB) + MOVD $1309, R12 + B callbackasm1(SB) + MOVD $1310, R12 + B callbackasm1(SB) + MOVD $1311, R12 + B callbackasm1(SB) + MOVD $1312, R12 + B callbackasm1(SB) + MOVD $1313, R12 + B callbackasm1(SB) + MOVD $1314, R12 + B callbackasm1(SB) + MOVD $1315, R12 + B callbackasm1(SB) + MOVD $1316, R12 + B callbackasm1(SB) + MOVD $1317, R12 + B callbackasm1(SB) + MOVD $1318, R12 + B callbackasm1(SB) + MOVD $1319, R12 + B callbackasm1(SB) + MOVD $1320, R12 + B callbackasm1(SB) + MOVD $1321, R12 + B callbackasm1(SB) + MOVD $1322, R12 + B callbackasm1(SB) + MOVD $1323, R12 + B callbackasm1(SB) + MOVD $1324, R12 + B callbackasm1(SB) + MOVD $1325, R12 + B callbackasm1(SB) + MOVD $1326, R12 + B callbackasm1(SB) + MOVD $1327, R12 + B callbackasm1(SB) + MOVD $1328, R12 + B callbackasm1(SB) + MOVD $1329, R12 + B callbackasm1(SB) + MOVD $1330, R12 + B callbackasm1(SB) + MOVD $1331, R12 + B callbackasm1(SB) + MOVD $1332, R12 + B callbackasm1(SB) + MOVD $1333, R12 + B callbackasm1(SB) + MOVD $1334, R12 + B callbackasm1(SB) + MOVD $1335, R12 + B callbackasm1(SB) + MOVD $1336, R12 + B callbackasm1(SB) + MOVD $1337, R12 + B callbackasm1(SB) + MOVD $1338, R12 + B callbackasm1(SB) + MOVD $1339, R12 + B callbackasm1(SB) + MOVD $1340, R12 + B callbackasm1(SB) + MOVD $1341, R12 + B callbackasm1(SB) + MOVD $1342, R12 + B callbackasm1(SB) + MOVD $1343, R12 + B callbackasm1(SB) + MOVD $1344, R12 + B callbackasm1(SB) + MOVD $1345, R12 + B callbackasm1(SB) + MOVD $1346, R12 + B callbackasm1(SB) + MOVD $1347, R12 + B callbackasm1(SB) + MOVD $1348, R12 + B callbackasm1(SB) + MOVD $1349, R12 + B callbackasm1(SB) + MOVD $1350, R12 + B callbackasm1(SB) + MOVD $1351, R12 + B callbackasm1(SB) + MOVD $1352, R12 + B callbackasm1(SB) + MOVD $1353, R12 + B callbackasm1(SB) + MOVD $1354, R12 + B callbackasm1(SB) + MOVD $1355, R12 + B callbackasm1(SB) + MOVD $1356, R12 + B callbackasm1(SB) + MOVD $1357, R12 + B callbackasm1(SB) + MOVD $1358, R12 + B callbackasm1(SB) + MOVD $1359, R12 + B callbackasm1(SB) + MOVD $1360, R12 + B callbackasm1(SB) + MOVD $1361, R12 + B callbackasm1(SB) + MOVD $1362, R12 + B callbackasm1(SB) + MOVD $1363, R12 + B callbackasm1(SB) + MOVD $1364, R12 + B callbackasm1(SB) + MOVD $1365, R12 + B callbackasm1(SB) + MOVD $1366, R12 + B callbackasm1(SB) + MOVD $1367, R12 + B callbackasm1(SB) + MOVD $1368, R12 + B callbackasm1(SB) + MOVD $1369, R12 + B callbackasm1(SB) + MOVD $1370, R12 + B callbackasm1(SB) + MOVD $1371, R12 + B callbackasm1(SB) + MOVD $1372, R12 + B callbackasm1(SB) + MOVD $1373, R12 + B callbackasm1(SB) + MOVD $1374, R12 + B callbackasm1(SB) + MOVD $1375, R12 + B callbackasm1(SB) + MOVD $1376, R12 + B callbackasm1(SB) + MOVD $1377, R12 + B callbackasm1(SB) + MOVD $1378, R12 + B callbackasm1(SB) + MOVD $1379, R12 + B callbackasm1(SB) + MOVD $1380, R12 + B callbackasm1(SB) + MOVD $1381, R12 + B callbackasm1(SB) + MOVD $1382, R12 + B callbackasm1(SB) + MOVD $1383, R12 + B callbackasm1(SB) + MOVD $1384, R12 + B callbackasm1(SB) + MOVD $1385, R12 + B callbackasm1(SB) + MOVD $1386, R12 + B callbackasm1(SB) + MOVD $1387, R12 + B callbackasm1(SB) + MOVD $1388, R12 + B callbackasm1(SB) + MOVD $1389, R12 + B callbackasm1(SB) + MOVD $1390, R12 + B callbackasm1(SB) + MOVD $1391, R12 + B callbackasm1(SB) + MOVD $1392, R12 + B callbackasm1(SB) + MOVD $1393, R12 + B callbackasm1(SB) + MOVD $1394, R12 + B callbackasm1(SB) + MOVD $1395, R12 + B callbackasm1(SB) + MOVD $1396, R12 + B callbackasm1(SB) + MOVD $1397, R12 + B callbackasm1(SB) + MOVD $1398, R12 + B callbackasm1(SB) + MOVD $1399, R12 + B callbackasm1(SB) + MOVD $1400, R12 + B callbackasm1(SB) + MOVD $1401, R12 + B callbackasm1(SB) + MOVD $1402, R12 + B callbackasm1(SB) + MOVD $1403, R12 + B callbackasm1(SB) + MOVD $1404, R12 + B callbackasm1(SB) + MOVD $1405, R12 + B callbackasm1(SB) + MOVD $1406, R12 + B callbackasm1(SB) + MOVD $1407, R12 + B callbackasm1(SB) + MOVD $1408, R12 + B callbackasm1(SB) + MOVD $1409, R12 + B callbackasm1(SB) + MOVD $1410, R12 + B callbackasm1(SB) + MOVD $1411, R12 + B callbackasm1(SB) + MOVD $1412, R12 + B callbackasm1(SB) + MOVD $1413, R12 + B callbackasm1(SB) + MOVD $1414, R12 + B callbackasm1(SB) + MOVD $1415, R12 + B callbackasm1(SB) + MOVD $1416, R12 + B callbackasm1(SB) + MOVD $1417, R12 + B callbackasm1(SB) + MOVD $1418, R12 + B callbackasm1(SB) + MOVD $1419, R12 + B callbackasm1(SB) + MOVD $1420, R12 + B callbackasm1(SB) + MOVD $1421, R12 + B callbackasm1(SB) + MOVD $1422, R12 + B callbackasm1(SB) + MOVD $1423, R12 + B callbackasm1(SB) + MOVD $1424, R12 + B callbackasm1(SB) + MOVD $1425, R12 + B callbackasm1(SB) + MOVD $1426, R12 + B callbackasm1(SB) + MOVD $1427, R12 + B callbackasm1(SB) + MOVD $1428, R12 + B callbackasm1(SB) + MOVD $1429, R12 + B callbackasm1(SB) + MOVD $1430, R12 + B callbackasm1(SB) + MOVD $1431, R12 + B callbackasm1(SB) + MOVD $1432, R12 + B callbackasm1(SB) + MOVD $1433, R12 + B callbackasm1(SB) + MOVD $1434, R12 + B callbackasm1(SB) + MOVD $1435, R12 + B callbackasm1(SB) + MOVD $1436, R12 + B callbackasm1(SB) + MOVD $1437, R12 + B callbackasm1(SB) + MOVD $1438, R12 + B callbackasm1(SB) + MOVD $1439, R12 + B callbackasm1(SB) + MOVD $1440, R12 + B callbackasm1(SB) + MOVD $1441, R12 + B callbackasm1(SB) + MOVD $1442, R12 + B callbackasm1(SB) + MOVD $1443, R12 + B callbackasm1(SB) + MOVD $1444, R12 + B callbackasm1(SB) + MOVD $1445, R12 + B callbackasm1(SB) + MOVD $1446, R12 + B callbackasm1(SB) + MOVD $1447, R12 + B callbackasm1(SB) + MOVD $1448, R12 + B callbackasm1(SB) + MOVD $1449, R12 + B callbackasm1(SB) + MOVD $1450, R12 + B callbackasm1(SB) + MOVD $1451, R12 + B callbackasm1(SB) + MOVD $1452, R12 + B callbackasm1(SB) + MOVD $1453, R12 + B callbackasm1(SB) + MOVD $1454, R12 + B callbackasm1(SB) + MOVD $1455, R12 + B callbackasm1(SB) + MOVD $1456, R12 + B callbackasm1(SB) + MOVD $1457, R12 + B callbackasm1(SB) + MOVD $1458, R12 + B callbackasm1(SB) + MOVD $1459, R12 + B callbackasm1(SB) + MOVD $1460, R12 + B callbackasm1(SB) + MOVD $1461, R12 + B callbackasm1(SB) + MOVD $1462, R12 + B callbackasm1(SB) + MOVD $1463, R12 + B callbackasm1(SB) + MOVD $1464, R12 + B callbackasm1(SB) + MOVD $1465, R12 + B callbackasm1(SB) + MOVD $1466, R12 + B callbackasm1(SB) + MOVD $1467, R12 + B callbackasm1(SB) + MOVD $1468, R12 + B callbackasm1(SB) + MOVD $1469, R12 + B callbackasm1(SB) + MOVD $1470, R12 + B callbackasm1(SB) + MOVD $1471, R12 + B callbackasm1(SB) + MOVD $1472, R12 + B callbackasm1(SB) + MOVD $1473, R12 + B callbackasm1(SB) + MOVD $1474, R12 + B callbackasm1(SB) + MOVD $1475, R12 + B callbackasm1(SB) + MOVD $1476, R12 + B callbackasm1(SB) + MOVD $1477, R12 + B callbackasm1(SB) + MOVD $1478, R12 + B callbackasm1(SB) + MOVD $1479, R12 + B callbackasm1(SB) + MOVD $1480, R12 + B callbackasm1(SB) + MOVD $1481, R12 + B callbackasm1(SB) + MOVD $1482, R12 + B callbackasm1(SB) + MOVD $1483, R12 + B callbackasm1(SB) + MOVD $1484, R12 + B callbackasm1(SB) + MOVD $1485, R12 + B callbackasm1(SB) + MOVD $1486, R12 + B callbackasm1(SB) + MOVD $1487, R12 + B callbackasm1(SB) + MOVD $1488, R12 + B callbackasm1(SB) + MOVD $1489, R12 + B callbackasm1(SB) + MOVD $1490, R12 + B callbackasm1(SB) + MOVD $1491, R12 + B callbackasm1(SB) + MOVD $1492, R12 + B callbackasm1(SB) + MOVD $1493, R12 + B callbackasm1(SB) + MOVD $1494, R12 + B callbackasm1(SB) + MOVD $1495, R12 + B callbackasm1(SB) + MOVD $1496, R12 + B callbackasm1(SB) + MOVD $1497, R12 + B callbackasm1(SB) + MOVD $1498, R12 + B callbackasm1(SB) + MOVD $1499, R12 + B callbackasm1(SB) + MOVD $1500, R12 + B callbackasm1(SB) + MOVD $1501, R12 + B callbackasm1(SB) + MOVD $1502, R12 + B callbackasm1(SB) + MOVD $1503, R12 + B callbackasm1(SB) + MOVD $1504, R12 + B callbackasm1(SB) + MOVD $1505, R12 + B callbackasm1(SB) + MOVD $1506, R12 + B callbackasm1(SB) + MOVD $1507, R12 + B callbackasm1(SB) + MOVD $1508, R12 + B callbackasm1(SB) + MOVD $1509, R12 + B callbackasm1(SB) + MOVD $1510, R12 + B callbackasm1(SB) + MOVD $1511, R12 + B callbackasm1(SB) + MOVD $1512, R12 + B callbackasm1(SB) + MOVD $1513, R12 + B callbackasm1(SB) + MOVD $1514, R12 + B callbackasm1(SB) + MOVD $1515, R12 + B callbackasm1(SB) + MOVD $1516, R12 + B callbackasm1(SB) + MOVD $1517, R12 + B callbackasm1(SB) + MOVD $1518, R12 + B callbackasm1(SB) + MOVD $1519, R12 + B callbackasm1(SB) + MOVD $1520, R12 + B callbackasm1(SB) + MOVD $1521, R12 + B callbackasm1(SB) + MOVD $1522, R12 + B callbackasm1(SB) + MOVD $1523, R12 + B callbackasm1(SB) + MOVD $1524, R12 + B callbackasm1(SB) + MOVD $1525, R12 + B callbackasm1(SB) + MOVD $1526, R12 + B callbackasm1(SB) + MOVD $1527, R12 + B callbackasm1(SB) + MOVD $1528, R12 + B callbackasm1(SB) + MOVD $1529, R12 + B callbackasm1(SB) + MOVD $1530, R12 + B callbackasm1(SB) + MOVD $1531, R12 + B callbackasm1(SB) + MOVD $1532, R12 + B callbackasm1(SB) + MOVD $1533, R12 + B callbackasm1(SB) + MOVD $1534, R12 + B callbackasm1(SB) + MOVD $1535, R12 + B callbackasm1(SB) + MOVD $1536, R12 + B callbackasm1(SB) + MOVD $1537, R12 + B callbackasm1(SB) + MOVD $1538, R12 + B callbackasm1(SB) + MOVD $1539, R12 + B callbackasm1(SB) + MOVD $1540, R12 + B callbackasm1(SB) + MOVD $1541, R12 + B callbackasm1(SB) + MOVD $1542, R12 + B callbackasm1(SB) + MOVD $1543, R12 + B callbackasm1(SB) + MOVD $1544, R12 + B callbackasm1(SB) + MOVD $1545, R12 + B callbackasm1(SB) + MOVD $1546, R12 + B callbackasm1(SB) + MOVD $1547, R12 + B callbackasm1(SB) + MOVD $1548, R12 + B callbackasm1(SB) + MOVD $1549, R12 + B callbackasm1(SB) + MOVD $1550, R12 + B callbackasm1(SB) + MOVD $1551, R12 + B callbackasm1(SB) + MOVD $1552, R12 + B callbackasm1(SB) + MOVD $1553, R12 + B callbackasm1(SB) + MOVD $1554, R12 + B callbackasm1(SB) + MOVD $1555, R12 + B callbackasm1(SB) + MOVD $1556, R12 + B callbackasm1(SB) + MOVD $1557, R12 + B callbackasm1(SB) + MOVD $1558, R12 + B callbackasm1(SB) + MOVD $1559, R12 + B callbackasm1(SB) + MOVD $1560, R12 + B callbackasm1(SB) + MOVD $1561, R12 + B callbackasm1(SB) + MOVD $1562, R12 + B callbackasm1(SB) + MOVD $1563, R12 + B callbackasm1(SB) + MOVD $1564, R12 + B callbackasm1(SB) + MOVD $1565, R12 + B callbackasm1(SB) + MOVD $1566, R12 + B callbackasm1(SB) + MOVD $1567, R12 + B callbackasm1(SB) + MOVD $1568, R12 + B callbackasm1(SB) + MOVD $1569, R12 + B callbackasm1(SB) + MOVD $1570, R12 + B callbackasm1(SB) + MOVD $1571, R12 + B callbackasm1(SB) + MOVD $1572, R12 + B callbackasm1(SB) + MOVD $1573, R12 + B callbackasm1(SB) + MOVD $1574, R12 + B callbackasm1(SB) + MOVD $1575, R12 + B callbackasm1(SB) + MOVD $1576, R12 + B callbackasm1(SB) + MOVD $1577, R12 + B callbackasm1(SB) + MOVD $1578, R12 + B callbackasm1(SB) + MOVD $1579, R12 + B callbackasm1(SB) + MOVD $1580, R12 + B callbackasm1(SB) + MOVD $1581, R12 + B callbackasm1(SB) + MOVD $1582, R12 + B callbackasm1(SB) + MOVD $1583, R12 + B callbackasm1(SB) + MOVD $1584, R12 + B callbackasm1(SB) + MOVD $1585, R12 + B callbackasm1(SB) + MOVD $1586, R12 + B callbackasm1(SB) + MOVD $1587, R12 + B callbackasm1(SB) + MOVD $1588, R12 + B callbackasm1(SB) + MOVD $1589, R12 + B callbackasm1(SB) + MOVD $1590, R12 + B callbackasm1(SB) + MOVD $1591, R12 + B callbackasm1(SB) + MOVD $1592, R12 + B callbackasm1(SB) + MOVD $1593, R12 + B callbackasm1(SB) + MOVD $1594, R12 + B callbackasm1(SB) + MOVD $1595, R12 + B callbackasm1(SB) + MOVD $1596, R12 + B callbackasm1(SB) + MOVD $1597, R12 + B callbackasm1(SB) + MOVD $1598, R12 + B callbackasm1(SB) + MOVD $1599, R12 + B callbackasm1(SB) + MOVD $1600, R12 + B callbackasm1(SB) + MOVD $1601, R12 + B callbackasm1(SB) + MOVD $1602, R12 + B callbackasm1(SB) + MOVD $1603, R12 + B callbackasm1(SB) + MOVD $1604, R12 + B callbackasm1(SB) + MOVD $1605, R12 + B callbackasm1(SB) + MOVD $1606, R12 + B callbackasm1(SB) + MOVD $1607, R12 + B callbackasm1(SB) + MOVD $1608, R12 + B callbackasm1(SB) + MOVD $1609, R12 + B callbackasm1(SB) + MOVD $1610, R12 + B callbackasm1(SB) + MOVD $1611, R12 + B callbackasm1(SB) + MOVD $1612, R12 + B callbackasm1(SB) + MOVD $1613, R12 + B callbackasm1(SB) + MOVD $1614, R12 + B callbackasm1(SB) + MOVD $1615, R12 + B callbackasm1(SB) + MOVD $1616, R12 + B callbackasm1(SB) + MOVD $1617, R12 + B callbackasm1(SB) + MOVD $1618, R12 + B callbackasm1(SB) + MOVD $1619, R12 + B callbackasm1(SB) + MOVD $1620, R12 + B callbackasm1(SB) + MOVD $1621, R12 + B callbackasm1(SB) + MOVD $1622, R12 + B callbackasm1(SB) + MOVD $1623, R12 + B callbackasm1(SB) + MOVD $1624, R12 + B callbackasm1(SB) + MOVD $1625, R12 + B callbackasm1(SB) + MOVD $1626, R12 + B callbackasm1(SB) + MOVD $1627, R12 + B callbackasm1(SB) + MOVD $1628, R12 + B callbackasm1(SB) + MOVD $1629, R12 + B callbackasm1(SB) + MOVD $1630, R12 + B callbackasm1(SB) + MOVD $1631, R12 + B callbackasm1(SB) + MOVD $1632, R12 + B callbackasm1(SB) + MOVD $1633, R12 + B callbackasm1(SB) + MOVD $1634, R12 + B callbackasm1(SB) + MOVD $1635, R12 + B callbackasm1(SB) + MOVD $1636, R12 + B callbackasm1(SB) + MOVD $1637, R12 + B callbackasm1(SB) + MOVD $1638, R12 + B callbackasm1(SB) + MOVD $1639, R12 + B callbackasm1(SB) + MOVD $1640, R12 + B callbackasm1(SB) + MOVD $1641, R12 + B callbackasm1(SB) + MOVD $1642, R12 + B callbackasm1(SB) + MOVD $1643, R12 + B callbackasm1(SB) + MOVD $1644, R12 + B callbackasm1(SB) + MOVD $1645, R12 + B callbackasm1(SB) + MOVD $1646, R12 + B callbackasm1(SB) + MOVD $1647, R12 + B callbackasm1(SB) + MOVD $1648, R12 + B callbackasm1(SB) + MOVD $1649, R12 + B callbackasm1(SB) + MOVD $1650, R12 + B callbackasm1(SB) + MOVD $1651, R12 + B callbackasm1(SB) + MOVD $1652, R12 + B callbackasm1(SB) + MOVD $1653, R12 + B callbackasm1(SB) + MOVD $1654, R12 + B callbackasm1(SB) + MOVD $1655, R12 + B callbackasm1(SB) + MOVD $1656, R12 + B callbackasm1(SB) + MOVD $1657, R12 + B callbackasm1(SB) + MOVD $1658, R12 + B callbackasm1(SB) + MOVD $1659, R12 + B callbackasm1(SB) + MOVD $1660, R12 + B callbackasm1(SB) + MOVD $1661, R12 + B callbackasm1(SB) + MOVD $1662, R12 + B callbackasm1(SB) + MOVD $1663, R12 + B callbackasm1(SB) + MOVD $1664, R12 + B callbackasm1(SB) + MOVD $1665, R12 + B callbackasm1(SB) + MOVD $1666, R12 + B callbackasm1(SB) + MOVD $1667, R12 + B callbackasm1(SB) + MOVD $1668, R12 + B callbackasm1(SB) + MOVD $1669, R12 + B callbackasm1(SB) + MOVD $1670, R12 + B callbackasm1(SB) + MOVD $1671, R12 + B callbackasm1(SB) + MOVD $1672, R12 + B callbackasm1(SB) + MOVD $1673, R12 + B callbackasm1(SB) + MOVD $1674, R12 + B callbackasm1(SB) + MOVD $1675, R12 + B callbackasm1(SB) + MOVD $1676, R12 + B callbackasm1(SB) + MOVD $1677, R12 + B callbackasm1(SB) + MOVD $1678, R12 + B callbackasm1(SB) + MOVD $1679, R12 + B callbackasm1(SB) + MOVD $1680, R12 + B callbackasm1(SB) + MOVD $1681, R12 + B callbackasm1(SB) + MOVD $1682, R12 + B callbackasm1(SB) + MOVD $1683, R12 + B callbackasm1(SB) + MOVD $1684, R12 + B callbackasm1(SB) + MOVD $1685, R12 + B callbackasm1(SB) + MOVD $1686, R12 + B callbackasm1(SB) + MOVD $1687, R12 + B callbackasm1(SB) + MOVD $1688, R12 + B callbackasm1(SB) + MOVD $1689, R12 + B callbackasm1(SB) + MOVD $1690, R12 + B callbackasm1(SB) + MOVD $1691, R12 + B callbackasm1(SB) + MOVD $1692, R12 + B callbackasm1(SB) + MOVD $1693, R12 + B callbackasm1(SB) + MOVD $1694, R12 + B callbackasm1(SB) + MOVD $1695, R12 + B callbackasm1(SB) + MOVD $1696, R12 + B callbackasm1(SB) + MOVD $1697, R12 + B callbackasm1(SB) + MOVD $1698, R12 + B callbackasm1(SB) + MOVD $1699, R12 + B callbackasm1(SB) + MOVD $1700, R12 + B callbackasm1(SB) + MOVD $1701, R12 + B callbackasm1(SB) + MOVD $1702, R12 + B callbackasm1(SB) + MOVD $1703, R12 + B callbackasm1(SB) + MOVD $1704, R12 + B callbackasm1(SB) + MOVD $1705, R12 + B callbackasm1(SB) + MOVD $1706, R12 + B callbackasm1(SB) + MOVD $1707, R12 + B callbackasm1(SB) + MOVD $1708, R12 + B callbackasm1(SB) + MOVD $1709, R12 + B callbackasm1(SB) + MOVD $1710, R12 + B callbackasm1(SB) + MOVD $1711, R12 + B callbackasm1(SB) + MOVD $1712, R12 + B callbackasm1(SB) + MOVD $1713, R12 + B callbackasm1(SB) + MOVD $1714, R12 + B callbackasm1(SB) + MOVD $1715, R12 + B callbackasm1(SB) + MOVD $1716, R12 + B callbackasm1(SB) + MOVD $1717, R12 + B callbackasm1(SB) + MOVD $1718, R12 + B callbackasm1(SB) + MOVD $1719, R12 + B callbackasm1(SB) + MOVD $1720, R12 + B callbackasm1(SB) + MOVD $1721, R12 + B callbackasm1(SB) + MOVD $1722, R12 + B callbackasm1(SB) + MOVD $1723, R12 + B callbackasm1(SB) + MOVD $1724, R12 + B callbackasm1(SB) + MOVD $1725, R12 + B callbackasm1(SB) + MOVD $1726, R12 + B callbackasm1(SB) + MOVD $1727, R12 + B callbackasm1(SB) + MOVD $1728, R12 + B callbackasm1(SB) + MOVD $1729, R12 + B callbackasm1(SB) + MOVD $1730, R12 + B callbackasm1(SB) + MOVD $1731, R12 + B callbackasm1(SB) + MOVD $1732, R12 + B callbackasm1(SB) + MOVD $1733, R12 + B callbackasm1(SB) + MOVD $1734, R12 + B callbackasm1(SB) + MOVD $1735, R12 + B callbackasm1(SB) + MOVD $1736, R12 + B callbackasm1(SB) + MOVD $1737, R12 + B callbackasm1(SB) + MOVD $1738, R12 + B callbackasm1(SB) + MOVD $1739, R12 + B callbackasm1(SB) + MOVD $1740, R12 + B callbackasm1(SB) + MOVD $1741, R12 + B callbackasm1(SB) + MOVD $1742, R12 + B callbackasm1(SB) + MOVD $1743, R12 + B callbackasm1(SB) + MOVD $1744, R12 + B callbackasm1(SB) + MOVD $1745, R12 + B callbackasm1(SB) + MOVD $1746, R12 + B callbackasm1(SB) + MOVD $1747, R12 + B callbackasm1(SB) + MOVD $1748, R12 + B callbackasm1(SB) + MOVD $1749, R12 + B callbackasm1(SB) + MOVD $1750, R12 + B callbackasm1(SB) + MOVD $1751, R12 + B callbackasm1(SB) + MOVD $1752, R12 + B callbackasm1(SB) + MOVD $1753, R12 + B callbackasm1(SB) + MOVD $1754, R12 + B callbackasm1(SB) + MOVD $1755, R12 + B callbackasm1(SB) + MOVD $1756, R12 + B callbackasm1(SB) + MOVD $1757, R12 + B callbackasm1(SB) + MOVD $1758, R12 + B callbackasm1(SB) + MOVD $1759, R12 + B callbackasm1(SB) + MOVD $1760, R12 + B callbackasm1(SB) + MOVD $1761, R12 + B callbackasm1(SB) + MOVD $1762, R12 + B callbackasm1(SB) + MOVD $1763, R12 + B callbackasm1(SB) + MOVD $1764, R12 + B callbackasm1(SB) + MOVD $1765, R12 + B callbackasm1(SB) + MOVD $1766, R12 + B callbackasm1(SB) + MOVD $1767, R12 + B callbackasm1(SB) + MOVD $1768, R12 + B callbackasm1(SB) + MOVD $1769, R12 + B callbackasm1(SB) + MOVD $1770, R12 + B callbackasm1(SB) + MOVD $1771, R12 + B callbackasm1(SB) + MOVD $1772, R12 + B callbackasm1(SB) + MOVD $1773, R12 + B callbackasm1(SB) + MOVD $1774, R12 + B callbackasm1(SB) + MOVD $1775, R12 + B callbackasm1(SB) + MOVD $1776, R12 + B callbackasm1(SB) + MOVD $1777, R12 + B callbackasm1(SB) + MOVD $1778, R12 + B callbackasm1(SB) + MOVD $1779, R12 + B callbackasm1(SB) + MOVD $1780, R12 + B callbackasm1(SB) + MOVD $1781, R12 + B callbackasm1(SB) + MOVD $1782, R12 + B callbackasm1(SB) + MOVD $1783, R12 + B callbackasm1(SB) + MOVD $1784, R12 + B callbackasm1(SB) + MOVD $1785, R12 + B callbackasm1(SB) + MOVD $1786, R12 + B callbackasm1(SB) + MOVD $1787, R12 + B callbackasm1(SB) + MOVD $1788, R12 + B callbackasm1(SB) + MOVD $1789, R12 + B callbackasm1(SB) + MOVD $1790, R12 + B callbackasm1(SB) + MOVD $1791, R12 + B callbackasm1(SB) + MOVD $1792, R12 + B callbackasm1(SB) + MOVD $1793, R12 + B callbackasm1(SB) + MOVD $1794, R12 + B callbackasm1(SB) + MOVD $1795, R12 + B callbackasm1(SB) + MOVD $1796, R12 + B callbackasm1(SB) + MOVD $1797, R12 + B callbackasm1(SB) + MOVD $1798, R12 + B callbackasm1(SB) + MOVD $1799, R12 + B callbackasm1(SB) + MOVD $1800, R12 + B callbackasm1(SB) + MOVD $1801, R12 + B callbackasm1(SB) + MOVD $1802, R12 + B callbackasm1(SB) + MOVD $1803, R12 + B callbackasm1(SB) + MOVD $1804, R12 + B callbackasm1(SB) + MOVD $1805, R12 + B callbackasm1(SB) + MOVD $1806, R12 + B callbackasm1(SB) + MOVD $1807, R12 + B callbackasm1(SB) + MOVD $1808, R12 + B callbackasm1(SB) + MOVD $1809, R12 + B callbackasm1(SB) + MOVD $1810, R12 + B callbackasm1(SB) + MOVD $1811, R12 + B callbackasm1(SB) + MOVD $1812, R12 + B callbackasm1(SB) + MOVD $1813, R12 + B callbackasm1(SB) + MOVD $1814, R12 + B callbackasm1(SB) + MOVD $1815, R12 + B callbackasm1(SB) + MOVD $1816, R12 + B callbackasm1(SB) + MOVD $1817, R12 + B callbackasm1(SB) + MOVD $1818, R12 + B callbackasm1(SB) + MOVD $1819, R12 + B callbackasm1(SB) + MOVD $1820, R12 + B callbackasm1(SB) + MOVD $1821, R12 + B callbackasm1(SB) + MOVD $1822, R12 + B callbackasm1(SB) + MOVD $1823, R12 + B callbackasm1(SB) + MOVD $1824, R12 + B callbackasm1(SB) + MOVD $1825, R12 + B callbackasm1(SB) + MOVD $1826, R12 + B callbackasm1(SB) + MOVD $1827, R12 + B callbackasm1(SB) + MOVD $1828, R12 + B callbackasm1(SB) + MOVD $1829, R12 + B callbackasm1(SB) + MOVD $1830, R12 + B callbackasm1(SB) + MOVD $1831, R12 + B callbackasm1(SB) + MOVD $1832, R12 + B callbackasm1(SB) + MOVD $1833, R12 + B callbackasm1(SB) + MOVD $1834, R12 + B callbackasm1(SB) + MOVD $1835, R12 + B callbackasm1(SB) + MOVD $1836, R12 + B callbackasm1(SB) + MOVD $1837, R12 + B callbackasm1(SB) + MOVD $1838, R12 + B callbackasm1(SB) + MOVD $1839, R12 + B callbackasm1(SB) + MOVD $1840, R12 + B callbackasm1(SB) + MOVD $1841, R12 + B callbackasm1(SB) + MOVD $1842, R12 + B callbackasm1(SB) + MOVD $1843, R12 + B callbackasm1(SB) + MOVD $1844, R12 + B callbackasm1(SB) + MOVD $1845, R12 + B callbackasm1(SB) + MOVD $1846, R12 + B callbackasm1(SB) + MOVD $1847, R12 + B callbackasm1(SB) + MOVD $1848, R12 + B callbackasm1(SB) + MOVD $1849, R12 + B callbackasm1(SB) + MOVD $1850, R12 + B callbackasm1(SB) + MOVD $1851, R12 + B callbackasm1(SB) + MOVD $1852, R12 + B callbackasm1(SB) + MOVD $1853, R12 + B callbackasm1(SB) + MOVD $1854, R12 + B callbackasm1(SB) + MOVD $1855, R12 + B callbackasm1(SB) + MOVD $1856, R12 + B callbackasm1(SB) + MOVD $1857, R12 + B callbackasm1(SB) + MOVD $1858, R12 + B callbackasm1(SB) + MOVD $1859, R12 + B callbackasm1(SB) + MOVD $1860, R12 + B callbackasm1(SB) + MOVD $1861, R12 + B callbackasm1(SB) + MOVD $1862, R12 + B callbackasm1(SB) + MOVD $1863, R12 + B callbackasm1(SB) + MOVD $1864, R12 + B callbackasm1(SB) + MOVD $1865, R12 + B callbackasm1(SB) + MOVD $1866, R12 + B callbackasm1(SB) + MOVD $1867, R12 + B callbackasm1(SB) + MOVD $1868, R12 + B callbackasm1(SB) + MOVD $1869, R12 + B callbackasm1(SB) + MOVD $1870, R12 + B callbackasm1(SB) + MOVD $1871, R12 + B callbackasm1(SB) + MOVD $1872, R12 + B callbackasm1(SB) + MOVD $1873, R12 + B callbackasm1(SB) + MOVD $1874, R12 + B callbackasm1(SB) + MOVD $1875, R12 + B callbackasm1(SB) + MOVD $1876, R12 + B callbackasm1(SB) + MOVD $1877, R12 + B callbackasm1(SB) + MOVD $1878, R12 + B callbackasm1(SB) + MOVD $1879, R12 + B callbackasm1(SB) + MOVD $1880, R12 + B callbackasm1(SB) + MOVD $1881, R12 + B callbackasm1(SB) + MOVD $1882, R12 + B callbackasm1(SB) + MOVD $1883, R12 + B callbackasm1(SB) + MOVD $1884, R12 + B callbackasm1(SB) + MOVD $1885, R12 + B callbackasm1(SB) + MOVD $1886, R12 + B callbackasm1(SB) + MOVD $1887, R12 + B callbackasm1(SB) + MOVD $1888, R12 + B callbackasm1(SB) + MOVD $1889, R12 + B callbackasm1(SB) + MOVD $1890, R12 + B callbackasm1(SB) + MOVD $1891, R12 + B callbackasm1(SB) + MOVD $1892, R12 + B callbackasm1(SB) + MOVD $1893, R12 + B callbackasm1(SB) + MOVD $1894, R12 + B callbackasm1(SB) + MOVD $1895, R12 + B callbackasm1(SB) + MOVD $1896, R12 + B callbackasm1(SB) + MOVD $1897, R12 + B callbackasm1(SB) + MOVD $1898, R12 + B callbackasm1(SB) + MOVD $1899, R12 + B callbackasm1(SB) + MOVD $1900, R12 + B callbackasm1(SB) + MOVD $1901, R12 + B callbackasm1(SB) + MOVD $1902, R12 + B callbackasm1(SB) + MOVD $1903, R12 + B callbackasm1(SB) + MOVD $1904, R12 + B callbackasm1(SB) + MOVD $1905, R12 + B callbackasm1(SB) + MOVD $1906, R12 + B callbackasm1(SB) + MOVD $1907, R12 + B callbackasm1(SB) + MOVD $1908, R12 + B callbackasm1(SB) + MOVD $1909, R12 + B callbackasm1(SB) + MOVD $1910, R12 + B callbackasm1(SB) + MOVD $1911, R12 + B callbackasm1(SB) + MOVD $1912, R12 + B callbackasm1(SB) + MOVD $1913, R12 + B callbackasm1(SB) + MOVD $1914, R12 + B callbackasm1(SB) + MOVD $1915, R12 + B callbackasm1(SB) + MOVD $1916, R12 + B callbackasm1(SB) + MOVD $1917, R12 + B callbackasm1(SB) + MOVD $1918, R12 + B callbackasm1(SB) + MOVD $1919, R12 + B callbackasm1(SB) + MOVD $1920, R12 + B callbackasm1(SB) + MOVD $1921, R12 + B callbackasm1(SB) + MOVD $1922, R12 + B callbackasm1(SB) + MOVD $1923, R12 + B callbackasm1(SB) + MOVD $1924, R12 + B callbackasm1(SB) + MOVD $1925, R12 + B callbackasm1(SB) + MOVD $1926, R12 + B callbackasm1(SB) + MOVD $1927, R12 + B callbackasm1(SB) + MOVD $1928, R12 + B callbackasm1(SB) + MOVD $1929, R12 + B callbackasm1(SB) + MOVD $1930, R12 + B callbackasm1(SB) + MOVD $1931, R12 + B callbackasm1(SB) + MOVD $1932, R12 + B callbackasm1(SB) + MOVD $1933, R12 + B callbackasm1(SB) + MOVD $1934, R12 + B callbackasm1(SB) + MOVD $1935, R12 + B callbackasm1(SB) + MOVD $1936, R12 + B callbackasm1(SB) + MOVD $1937, R12 + B callbackasm1(SB) + MOVD $1938, R12 + B callbackasm1(SB) + MOVD $1939, R12 + B callbackasm1(SB) + MOVD $1940, R12 + B callbackasm1(SB) + MOVD $1941, R12 + B callbackasm1(SB) + MOVD $1942, R12 + B callbackasm1(SB) + MOVD $1943, R12 + B callbackasm1(SB) + MOVD $1944, R12 + B callbackasm1(SB) + MOVD $1945, R12 + B callbackasm1(SB) + MOVD $1946, R12 + B callbackasm1(SB) + MOVD $1947, R12 + B callbackasm1(SB) + MOVD $1948, R12 + B callbackasm1(SB) + MOVD $1949, R12 + B callbackasm1(SB) + MOVD $1950, R12 + B callbackasm1(SB) + MOVD $1951, R12 + B callbackasm1(SB) + MOVD $1952, R12 + B callbackasm1(SB) + MOVD $1953, R12 + B callbackasm1(SB) + MOVD $1954, R12 + B callbackasm1(SB) + MOVD $1955, R12 + B callbackasm1(SB) + MOVD $1956, R12 + B callbackasm1(SB) + MOVD $1957, R12 + B callbackasm1(SB) + MOVD $1958, R12 + B callbackasm1(SB) + MOVD $1959, R12 + B callbackasm1(SB) + MOVD $1960, R12 + B callbackasm1(SB) + MOVD $1961, R12 + B callbackasm1(SB) + MOVD $1962, R12 + B callbackasm1(SB) + MOVD $1963, R12 + B callbackasm1(SB) + MOVD $1964, R12 + B callbackasm1(SB) + MOVD $1965, R12 + B callbackasm1(SB) + MOVD $1966, R12 + B callbackasm1(SB) + MOVD $1967, R12 + B callbackasm1(SB) + MOVD $1968, R12 + B callbackasm1(SB) + MOVD $1969, R12 + B callbackasm1(SB) + MOVD $1970, R12 + B callbackasm1(SB) + MOVD $1971, R12 + B callbackasm1(SB) + MOVD $1972, R12 + B callbackasm1(SB) + MOVD $1973, R12 + B callbackasm1(SB) + MOVD $1974, R12 + B callbackasm1(SB) + MOVD $1975, R12 + B callbackasm1(SB) + MOVD $1976, R12 + B callbackasm1(SB) + MOVD $1977, R12 + B callbackasm1(SB) + MOVD $1978, R12 + B callbackasm1(SB) + MOVD $1979, R12 + B callbackasm1(SB) + MOVD $1980, R12 + B callbackasm1(SB) + MOVD $1981, R12 + B callbackasm1(SB) + MOVD $1982, R12 + B callbackasm1(SB) + MOVD $1983, R12 + B callbackasm1(SB) + MOVD $1984, R12 + B callbackasm1(SB) + MOVD $1985, R12 + B callbackasm1(SB) + MOVD $1986, R12 + B callbackasm1(SB) + MOVD $1987, R12 + B callbackasm1(SB) + MOVD $1988, R12 + B callbackasm1(SB) + MOVD $1989, R12 + B callbackasm1(SB) + MOVD $1990, R12 + B callbackasm1(SB) + MOVD $1991, R12 + B callbackasm1(SB) + MOVD $1992, R12 + B callbackasm1(SB) + MOVD $1993, R12 + B callbackasm1(SB) + MOVD $1994, R12 + B callbackasm1(SB) + MOVD $1995, R12 + B callbackasm1(SB) + MOVD $1996, R12 + B callbackasm1(SB) + MOVD $1997, R12 + B callbackasm1(SB) + MOVD $1998, R12 + B callbackasm1(SB) + MOVD $1999, R12 + B callbackasm1(SB) diff --git a/vendor/github.com/ebitengine/purego/zcallback_loong64.s b/vendor/github.com/ebitengine/purego/zcallback_loong64.s new file mode 100644 index 00000000..e20c598a --- /dev/null +++ b/vendor/github.com/ebitengine/purego/zcallback_loong64.s @@ -0,0 +1,4014 @@ +// Code generated by wincallback.go using 'go generate'. DO NOT EDIT. + +//go:build darwin || freebsd || linux || netbsd + +// External code calls into callbackasm at an offset corresponding +// to the callback index. Callbackasm is a table of MOVV and JMP instructions. +// The MOVV instruction loads R12 with the callback index, and the +// JMP instruction branches to callbackasm1. +// callbackasm1 takes the callback index from R12 and +// indexes into an array that stores information about each callback. +// It then calls the Go implementation for that callback. +#include "textflag.h" + +TEXT callbackasm(SB),NOSPLIT|NOFRAME,$0 + MOVV $0, R12 + JMP callbackasm1(SB) + MOVV $1, R12 + JMP callbackasm1(SB) + MOVV $2, R12 + JMP callbackasm1(SB) + MOVV $3, R12 + JMP callbackasm1(SB) + MOVV $4, R12 + JMP callbackasm1(SB) + MOVV $5, R12 + JMP callbackasm1(SB) + MOVV $6, R12 + JMP callbackasm1(SB) + MOVV $7, R12 + JMP callbackasm1(SB) + MOVV $8, R12 + JMP callbackasm1(SB) + MOVV $9, R12 + JMP callbackasm1(SB) + MOVV $10, R12 + JMP callbackasm1(SB) + MOVV $11, R12 + JMP callbackasm1(SB) + MOVV $12, R12 + JMP callbackasm1(SB) + MOVV $13, R12 + JMP callbackasm1(SB) + MOVV $14, R12 + JMP callbackasm1(SB) + MOVV $15, R12 + JMP callbackasm1(SB) + MOVV $16, R12 + JMP callbackasm1(SB) + MOVV $17, R12 + JMP callbackasm1(SB) + MOVV $18, R12 + JMP callbackasm1(SB) + MOVV $19, R12 + JMP callbackasm1(SB) + MOVV $20, R12 + JMP callbackasm1(SB) + MOVV $21, R12 + JMP callbackasm1(SB) + MOVV $22, R12 + JMP callbackasm1(SB) + MOVV $23, R12 + JMP callbackasm1(SB) + MOVV $24, R12 + JMP callbackasm1(SB) + MOVV $25, R12 + JMP callbackasm1(SB) + MOVV $26, R12 + JMP callbackasm1(SB) + MOVV $27, R12 + JMP callbackasm1(SB) + MOVV $28, R12 + JMP callbackasm1(SB) + MOVV $29, R12 + JMP callbackasm1(SB) + MOVV $30, R12 + JMP callbackasm1(SB) + MOVV $31, R12 + JMP callbackasm1(SB) + MOVV $32, R12 + JMP callbackasm1(SB) + MOVV $33, R12 + JMP callbackasm1(SB) + MOVV $34, R12 + JMP callbackasm1(SB) + MOVV $35, R12 + JMP callbackasm1(SB) + MOVV $36, R12 + JMP callbackasm1(SB) + MOVV $37, R12 + JMP callbackasm1(SB) + MOVV $38, R12 + JMP callbackasm1(SB) + MOVV $39, R12 + JMP callbackasm1(SB) + MOVV $40, R12 + JMP callbackasm1(SB) + MOVV $41, R12 + JMP callbackasm1(SB) + MOVV $42, R12 + JMP callbackasm1(SB) + MOVV $43, R12 + JMP callbackasm1(SB) + MOVV $44, R12 + JMP callbackasm1(SB) + MOVV $45, R12 + JMP callbackasm1(SB) + MOVV $46, R12 + JMP callbackasm1(SB) + MOVV $47, R12 + JMP callbackasm1(SB) + MOVV $48, R12 + JMP callbackasm1(SB) + MOVV $49, R12 + JMP callbackasm1(SB) + MOVV $50, R12 + JMP callbackasm1(SB) + MOVV $51, R12 + JMP callbackasm1(SB) + MOVV $52, R12 + JMP callbackasm1(SB) + MOVV $53, R12 + JMP callbackasm1(SB) + MOVV $54, R12 + JMP callbackasm1(SB) + MOVV $55, R12 + JMP callbackasm1(SB) + MOVV $56, R12 + JMP callbackasm1(SB) + MOVV $57, R12 + JMP callbackasm1(SB) + MOVV $58, R12 + JMP callbackasm1(SB) + MOVV $59, R12 + JMP callbackasm1(SB) + MOVV $60, R12 + JMP callbackasm1(SB) + MOVV $61, R12 + JMP callbackasm1(SB) + MOVV $62, R12 + JMP callbackasm1(SB) + MOVV $63, R12 + JMP callbackasm1(SB) + MOVV $64, R12 + JMP callbackasm1(SB) + MOVV $65, R12 + JMP callbackasm1(SB) + MOVV $66, R12 + JMP callbackasm1(SB) + MOVV $67, R12 + JMP callbackasm1(SB) + MOVV $68, R12 + JMP callbackasm1(SB) + MOVV $69, R12 + JMP callbackasm1(SB) + MOVV $70, R12 + JMP callbackasm1(SB) + MOVV $71, R12 + JMP callbackasm1(SB) + MOVV $72, R12 + JMP callbackasm1(SB) + MOVV $73, R12 + JMP callbackasm1(SB) + MOVV $74, R12 + JMP callbackasm1(SB) + MOVV $75, R12 + JMP callbackasm1(SB) + MOVV $76, R12 + JMP callbackasm1(SB) + MOVV $77, R12 + JMP callbackasm1(SB) + MOVV $78, R12 + JMP callbackasm1(SB) + MOVV $79, R12 + JMP callbackasm1(SB) + MOVV $80, R12 + JMP callbackasm1(SB) + MOVV $81, R12 + JMP callbackasm1(SB) + MOVV $82, R12 + JMP callbackasm1(SB) + MOVV $83, R12 + JMP callbackasm1(SB) + MOVV $84, R12 + JMP callbackasm1(SB) + MOVV $85, R12 + JMP callbackasm1(SB) + MOVV $86, R12 + JMP callbackasm1(SB) + MOVV $87, R12 + JMP callbackasm1(SB) + MOVV $88, R12 + JMP callbackasm1(SB) + MOVV $89, R12 + JMP callbackasm1(SB) + MOVV $90, R12 + JMP callbackasm1(SB) + MOVV $91, R12 + JMP callbackasm1(SB) + MOVV $92, R12 + JMP callbackasm1(SB) + MOVV $93, R12 + JMP callbackasm1(SB) + MOVV $94, R12 + JMP callbackasm1(SB) + MOVV $95, R12 + JMP callbackasm1(SB) + MOVV $96, R12 + JMP callbackasm1(SB) + MOVV $97, R12 + JMP callbackasm1(SB) + MOVV $98, R12 + JMP callbackasm1(SB) + MOVV $99, R12 + JMP callbackasm1(SB) + MOVV $100, R12 + JMP callbackasm1(SB) + MOVV $101, R12 + JMP callbackasm1(SB) + MOVV $102, R12 + JMP callbackasm1(SB) + MOVV $103, R12 + JMP callbackasm1(SB) + MOVV $104, R12 + JMP callbackasm1(SB) + MOVV $105, R12 + JMP callbackasm1(SB) + MOVV $106, R12 + JMP callbackasm1(SB) + MOVV $107, R12 + JMP callbackasm1(SB) + MOVV $108, R12 + JMP callbackasm1(SB) + MOVV $109, R12 + JMP callbackasm1(SB) + MOVV $110, R12 + JMP callbackasm1(SB) + MOVV $111, R12 + JMP callbackasm1(SB) + MOVV $112, R12 + JMP callbackasm1(SB) + MOVV $113, R12 + JMP callbackasm1(SB) + MOVV $114, R12 + JMP callbackasm1(SB) + MOVV $115, R12 + JMP callbackasm1(SB) + MOVV $116, R12 + JMP callbackasm1(SB) + MOVV $117, R12 + JMP callbackasm1(SB) + MOVV $118, R12 + JMP callbackasm1(SB) + MOVV $119, R12 + JMP callbackasm1(SB) + MOVV $120, R12 + JMP callbackasm1(SB) + MOVV $121, R12 + JMP callbackasm1(SB) + MOVV $122, R12 + JMP callbackasm1(SB) + MOVV $123, R12 + JMP callbackasm1(SB) + MOVV $124, R12 + JMP callbackasm1(SB) + MOVV $125, R12 + JMP callbackasm1(SB) + MOVV $126, R12 + JMP callbackasm1(SB) + MOVV $127, R12 + JMP callbackasm1(SB) + MOVV $128, R12 + JMP callbackasm1(SB) + MOVV $129, R12 + JMP callbackasm1(SB) + MOVV $130, R12 + JMP callbackasm1(SB) + MOVV $131, R12 + JMP callbackasm1(SB) + MOVV $132, R12 + JMP callbackasm1(SB) + MOVV $133, R12 + JMP callbackasm1(SB) + MOVV $134, R12 + JMP callbackasm1(SB) + MOVV $135, R12 + JMP callbackasm1(SB) + MOVV $136, R12 + JMP callbackasm1(SB) + MOVV $137, R12 + JMP callbackasm1(SB) + MOVV $138, R12 + JMP callbackasm1(SB) + MOVV $139, R12 + JMP callbackasm1(SB) + MOVV $140, R12 + JMP callbackasm1(SB) + MOVV $141, R12 + JMP callbackasm1(SB) + MOVV $142, R12 + JMP callbackasm1(SB) + MOVV $143, R12 + JMP callbackasm1(SB) + MOVV $144, R12 + JMP callbackasm1(SB) + MOVV $145, R12 + JMP callbackasm1(SB) + MOVV $146, R12 + JMP callbackasm1(SB) + MOVV $147, R12 + JMP callbackasm1(SB) + MOVV $148, R12 + JMP callbackasm1(SB) + MOVV $149, R12 + JMP callbackasm1(SB) + MOVV $150, R12 + JMP callbackasm1(SB) + MOVV $151, R12 + JMP callbackasm1(SB) + MOVV $152, R12 + JMP callbackasm1(SB) + MOVV $153, R12 + JMP callbackasm1(SB) + MOVV $154, R12 + JMP callbackasm1(SB) + MOVV $155, R12 + JMP callbackasm1(SB) + MOVV $156, R12 + JMP callbackasm1(SB) + MOVV $157, R12 + JMP callbackasm1(SB) + MOVV $158, R12 + JMP callbackasm1(SB) + MOVV $159, R12 + JMP callbackasm1(SB) + MOVV $160, R12 + JMP callbackasm1(SB) + MOVV $161, R12 + JMP callbackasm1(SB) + MOVV $162, R12 + JMP callbackasm1(SB) + MOVV $163, R12 + JMP callbackasm1(SB) + MOVV $164, R12 + JMP callbackasm1(SB) + MOVV $165, R12 + JMP callbackasm1(SB) + MOVV $166, R12 + JMP callbackasm1(SB) + MOVV $167, R12 + JMP callbackasm1(SB) + MOVV $168, R12 + JMP callbackasm1(SB) + MOVV $169, R12 + JMP callbackasm1(SB) + MOVV $170, R12 + JMP callbackasm1(SB) + MOVV $171, R12 + JMP callbackasm1(SB) + MOVV $172, R12 + JMP callbackasm1(SB) + MOVV $173, R12 + JMP callbackasm1(SB) + MOVV $174, R12 + JMP callbackasm1(SB) + MOVV $175, R12 + JMP callbackasm1(SB) + MOVV $176, R12 + JMP callbackasm1(SB) + MOVV $177, R12 + JMP callbackasm1(SB) + MOVV $178, R12 + JMP callbackasm1(SB) + MOVV $179, R12 + JMP callbackasm1(SB) + MOVV $180, R12 + JMP callbackasm1(SB) + MOVV $181, R12 + JMP callbackasm1(SB) + MOVV $182, R12 + JMP callbackasm1(SB) + MOVV $183, R12 + JMP callbackasm1(SB) + MOVV $184, R12 + JMP callbackasm1(SB) + MOVV $185, R12 + JMP callbackasm1(SB) + MOVV $186, R12 + JMP callbackasm1(SB) + MOVV $187, R12 + JMP callbackasm1(SB) + MOVV $188, R12 + JMP callbackasm1(SB) + MOVV $189, R12 + JMP callbackasm1(SB) + MOVV $190, R12 + JMP callbackasm1(SB) + MOVV $191, R12 + JMP callbackasm1(SB) + MOVV $192, R12 + JMP callbackasm1(SB) + MOVV $193, R12 + JMP callbackasm1(SB) + MOVV $194, R12 + JMP callbackasm1(SB) + MOVV $195, R12 + JMP callbackasm1(SB) + MOVV $196, R12 + JMP callbackasm1(SB) + MOVV $197, R12 + JMP callbackasm1(SB) + MOVV $198, R12 + JMP callbackasm1(SB) + MOVV $199, R12 + JMP callbackasm1(SB) + MOVV $200, R12 + JMP callbackasm1(SB) + MOVV $201, R12 + JMP callbackasm1(SB) + MOVV $202, R12 + JMP callbackasm1(SB) + MOVV $203, R12 + JMP callbackasm1(SB) + MOVV $204, R12 + JMP callbackasm1(SB) + MOVV $205, R12 + JMP callbackasm1(SB) + MOVV $206, R12 + JMP callbackasm1(SB) + MOVV $207, R12 + JMP callbackasm1(SB) + MOVV $208, R12 + JMP callbackasm1(SB) + MOVV $209, R12 + JMP callbackasm1(SB) + MOVV $210, R12 + JMP callbackasm1(SB) + MOVV $211, R12 + JMP callbackasm1(SB) + MOVV $212, R12 + JMP callbackasm1(SB) + MOVV $213, R12 + JMP callbackasm1(SB) + MOVV $214, R12 + JMP callbackasm1(SB) + MOVV $215, R12 + JMP callbackasm1(SB) + MOVV $216, R12 + JMP callbackasm1(SB) + MOVV $217, R12 + JMP callbackasm1(SB) + MOVV $218, R12 + JMP callbackasm1(SB) + MOVV $219, R12 + JMP callbackasm1(SB) + MOVV $220, R12 + JMP callbackasm1(SB) + MOVV $221, R12 + JMP callbackasm1(SB) + MOVV $222, R12 + JMP callbackasm1(SB) + MOVV $223, R12 + JMP callbackasm1(SB) + MOVV $224, R12 + JMP callbackasm1(SB) + MOVV $225, R12 + JMP callbackasm1(SB) + MOVV $226, R12 + JMP callbackasm1(SB) + MOVV $227, R12 + JMP callbackasm1(SB) + MOVV $228, R12 + JMP callbackasm1(SB) + MOVV $229, R12 + JMP callbackasm1(SB) + MOVV $230, R12 + JMP callbackasm1(SB) + MOVV $231, R12 + JMP callbackasm1(SB) + MOVV $232, R12 + JMP callbackasm1(SB) + MOVV $233, R12 + JMP callbackasm1(SB) + MOVV $234, R12 + JMP callbackasm1(SB) + MOVV $235, R12 + JMP callbackasm1(SB) + MOVV $236, R12 + JMP callbackasm1(SB) + MOVV $237, R12 + JMP callbackasm1(SB) + MOVV $238, R12 + JMP callbackasm1(SB) + MOVV $239, R12 + JMP callbackasm1(SB) + MOVV $240, R12 + JMP callbackasm1(SB) + MOVV $241, R12 + JMP callbackasm1(SB) + MOVV $242, R12 + JMP callbackasm1(SB) + MOVV $243, R12 + JMP callbackasm1(SB) + MOVV $244, R12 + JMP callbackasm1(SB) + MOVV $245, R12 + JMP callbackasm1(SB) + MOVV $246, R12 + JMP callbackasm1(SB) + MOVV $247, R12 + JMP callbackasm1(SB) + MOVV $248, R12 + JMP callbackasm1(SB) + MOVV $249, R12 + JMP callbackasm1(SB) + MOVV $250, R12 + JMP callbackasm1(SB) + MOVV $251, R12 + JMP callbackasm1(SB) + MOVV $252, R12 + JMP callbackasm1(SB) + MOVV $253, R12 + JMP callbackasm1(SB) + MOVV $254, R12 + JMP callbackasm1(SB) + MOVV $255, R12 + JMP callbackasm1(SB) + MOVV $256, R12 + JMP callbackasm1(SB) + MOVV $257, R12 + JMP callbackasm1(SB) + MOVV $258, R12 + JMP callbackasm1(SB) + MOVV $259, R12 + JMP callbackasm1(SB) + MOVV $260, R12 + JMP callbackasm1(SB) + MOVV $261, R12 + JMP callbackasm1(SB) + MOVV $262, R12 + JMP callbackasm1(SB) + MOVV $263, R12 + JMP callbackasm1(SB) + MOVV $264, R12 + JMP callbackasm1(SB) + MOVV $265, R12 + JMP callbackasm1(SB) + MOVV $266, R12 + JMP callbackasm1(SB) + MOVV $267, R12 + JMP callbackasm1(SB) + MOVV $268, R12 + JMP callbackasm1(SB) + MOVV $269, R12 + JMP callbackasm1(SB) + MOVV $270, R12 + JMP callbackasm1(SB) + MOVV $271, R12 + JMP callbackasm1(SB) + MOVV $272, R12 + JMP callbackasm1(SB) + MOVV $273, R12 + JMP callbackasm1(SB) + MOVV $274, R12 + JMP callbackasm1(SB) + MOVV $275, R12 + JMP callbackasm1(SB) + MOVV $276, R12 + JMP callbackasm1(SB) + MOVV $277, R12 + JMP callbackasm1(SB) + MOVV $278, R12 + JMP callbackasm1(SB) + MOVV $279, R12 + JMP callbackasm1(SB) + MOVV $280, R12 + JMP callbackasm1(SB) + MOVV $281, R12 + JMP callbackasm1(SB) + MOVV $282, R12 + JMP callbackasm1(SB) + MOVV $283, R12 + JMP callbackasm1(SB) + MOVV $284, R12 + JMP callbackasm1(SB) + MOVV $285, R12 + JMP callbackasm1(SB) + MOVV $286, R12 + JMP callbackasm1(SB) + MOVV $287, R12 + JMP callbackasm1(SB) + MOVV $288, R12 + JMP callbackasm1(SB) + MOVV $289, R12 + JMP callbackasm1(SB) + MOVV $290, R12 + JMP callbackasm1(SB) + MOVV $291, R12 + JMP callbackasm1(SB) + MOVV $292, R12 + JMP callbackasm1(SB) + MOVV $293, R12 + JMP callbackasm1(SB) + MOVV $294, R12 + JMP callbackasm1(SB) + MOVV $295, R12 + JMP callbackasm1(SB) + MOVV $296, R12 + JMP callbackasm1(SB) + MOVV $297, R12 + JMP callbackasm1(SB) + MOVV $298, R12 + JMP callbackasm1(SB) + MOVV $299, R12 + JMP callbackasm1(SB) + MOVV $300, R12 + JMP callbackasm1(SB) + MOVV $301, R12 + JMP callbackasm1(SB) + MOVV $302, R12 + JMP callbackasm1(SB) + MOVV $303, R12 + JMP callbackasm1(SB) + MOVV $304, R12 + JMP callbackasm1(SB) + MOVV $305, R12 + JMP callbackasm1(SB) + MOVV $306, R12 + JMP callbackasm1(SB) + MOVV $307, R12 + JMP callbackasm1(SB) + MOVV $308, R12 + JMP callbackasm1(SB) + MOVV $309, R12 + JMP callbackasm1(SB) + MOVV $310, R12 + JMP callbackasm1(SB) + MOVV $311, R12 + JMP callbackasm1(SB) + MOVV $312, R12 + JMP callbackasm1(SB) + MOVV $313, R12 + JMP callbackasm1(SB) + MOVV $314, R12 + JMP callbackasm1(SB) + MOVV $315, R12 + JMP callbackasm1(SB) + MOVV $316, R12 + JMP callbackasm1(SB) + MOVV $317, R12 + JMP callbackasm1(SB) + MOVV $318, R12 + JMP callbackasm1(SB) + MOVV $319, R12 + JMP callbackasm1(SB) + MOVV $320, R12 + JMP callbackasm1(SB) + MOVV $321, R12 + JMP callbackasm1(SB) + MOVV $322, R12 + JMP callbackasm1(SB) + MOVV $323, R12 + JMP callbackasm1(SB) + MOVV $324, R12 + JMP callbackasm1(SB) + MOVV $325, R12 + JMP callbackasm1(SB) + MOVV $326, R12 + JMP callbackasm1(SB) + MOVV $327, R12 + JMP callbackasm1(SB) + MOVV $328, R12 + JMP callbackasm1(SB) + MOVV $329, R12 + JMP callbackasm1(SB) + MOVV $330, R12 + JMP callbackasm1(SB) + MOVV $331, R12 + JMP callbackasm1(SB) + MOVV $332, R12 + JMP callbackasm1(SB) + MOVV $333, R12 + JMP callbackasm1(SB) + MOVV $334, R12 + JMP callbackasm1(SB) + MOVV $335, R12 + JMP callbackasm1(SB) + MOVV $336, R12 + JMP callbackasm1(SB) + MOVV $337, R12 + JMP callbackasm1(SB) + MOVV $338, R12 + JMP callbackasm1(SB) + MOVV $339, R12 + JMP callbackasm1(SB) + MOVV $340, R12 + JMP callbackasm1(SB) + MOVV $341, R12 + JMP callbackasm1(SB) + MOVV $342, R12 + JMP callbackasm1(SB) + MOVV $343, R12 + JMP callbackasm1(SB) + MOVV $344, R12 + JMP callbackasm1(SB) + MOVV $345, R12 + JMP callbackasm1(SB) + MOVV $346, R12 + JMP callbackasm1(SB) + MOVV $347, R12 + JMP callbackasm1(SB) + MOVV $348, R12 + JMP callbackasm1(SB) + MOVV $349, R12 + JMP callbackasm1(SB) + MOVV $350, R12 + JMP callbackasm1(SB) + MOVV $351, R12 + JMP callbackasm1(SB) + MOVV $352, R12 + JMP callbackasm1(SB) + MOVV $353, R12 + JMP callbackasm1(SB) + MOVV $354, R12 + JMP callbackasm1(SB) + MOVV $355, R12 + JMP callbackasm1(SB) + MOVV $356, R12 + JMP callbackasm1(SB) + MOVV $357, R12 + JMP callbackasm1(SB) + MOVV $358, R12 + JMP callbackasm1(SB) + MOVV $359, R12 + JMP callbackasm1(SB) + MOVV $360, R12 + JMP callbackasm1(SB) + MOVV $361, R12 + JMP callbackasm1(SB) + MOVV $362, R12 + JMP callbackasm1(SB) + MOVV $363, R12 + JMP callbackasm1(SB) + MOVV $364, R12 + JMP callbackasm1(SB) + MOVV $365, R12 + JMP callbackasm1(SB) + MOVV $366, R12 + JMP callbackasm1(SB) + MOVV $367, R12 + JMP callbackasm1(SB) + MOVV $368, R12 + JMP callbackasm1(SB) + MOVV $369, R12 + JMP callbackasm1(SB) + MOVV $370, R12 + JMP callbackasm1(SB) + MOVV $371, R12 + JMP callbackasm1(SB) + MOVV $372, R12 + JMP callbackasm1(SB) + MOVV $373, R12 + JMP callbackasm1(SB) + MOVV $374, R12 + JMP callbackasm1(SB) + MOVV $375, R12 + JMP callbackasm1(SB) + MOVV $376, R12 + JMP callbackasm1(SB) + MOVV $377, R12 + JMP callbackasm1(SB) + MOVV $378, R12 + JMP callbackasm1(SB) + MOVV $379, R12 + JMP callbackasm1(SB) + MOVV $380, R12 + JMP callbackasm1(SB) + MOVV $381, R12 + JMP callbackasm1(SB) + MOVV $382, R12 + JMP callbackasm1(SB) + MOVV $383, R12 + JMP callbackasm1(SB) + MOVV $384, R12 + JMP callbackasm1(SB) + MOVV $385, R12 + JMP callbackasm1(SB) + MOVV $386, R12 + JMP callbackasm1(SB) + MOVV $387, R12 + JMP callbackasm1(SB) + MOVV $388, R12 + JMP callbackasm1(SB) + MOVV $389, R12 + JMP callbackasm1(SB) + MOVV $390, R12 + JMP callbackasm1(SB) + MOVV $391, R12 + JMP callbackasm1(SB) + MOVV $392, R12 + JMP callbackasm1(SB) + MOVV $393, R12 + JMP callbackasm1(SB) + MOVV $394, R12 + JMP callbackasm1(SB) + MOVV $395, R12 + JMP callbackasm1(SB) + MOVV $396, R12 + JMP callbackasm1(SB) + MOVV $397, R12 + JMP callbackasm1(SB) + MOVV $398, R12 + JMP callbackasm1(SB) + MOVV $399, R12 + JMP callbackasm1(SB) + MOVV $400, R12 + JMP callbackasm1(SB) + MOVV $401, R12 + JMP callbackasm1(SB) + MOVV $402, R12 + JMP callbackasm1(SB) + MOVV $403, R12 + JMP callbackasm1(SB) + MOVV $404, R12 + JMP callbackasm1(SB) + MOVV $405, R12 + JMP callbackasm1(SB) + MOVV $406, R12 + JMP callbackasm1(SB) + MOVV $407, R12 + JMP callbackasm1(SB) + MOVV $408, R12 + JMP callbackasm1(SB) + MOVV $409, R12 + JMP callbackasm1(SB) + MOVV $410, R12 + JMP callbackasm1(SB) + MOVV $411, R12 + JMP callbackasm1(SB) + MOVV $412, R12 + JMP callbackasm1(SB) + MOVV $413, R12 + JMP callbackasm1(SB) + MOVV $414, R12 + JMP callbackasm1(SB) + MOVV $415, R12 + JMP callbackasm1(SB) + MOVV $416, R12 + JMP callbackasm1(SB) + MOVV $417, R12 + JMP callbackasm1(SB) + MOVV $418, R12 + JMP callbackasm1(SB) + MOVV $419, R12 + JMP callbackasm1(SB) + MOVV $420, R12 + JMP callbackasm1(SB) + MOVV $421, R12 + JMP callbackasm1(SB) + MOVV $422, R12 + JMP callbackasm1(SB) + MOVV $423, R12 + JMP callbackasm1(SB) + MOVV $424, R12 + JMP callbackasm1(SB) + MOVV $425, R12 + JMP callbackasm1(SB) + MOVV $426, R12 + JMP callbackasm1(SB) + MOVV $427, R12 + JMP callbackasm1(SB) + MOVV $428, R12 + JMP callbackasm1(SB) + MOVV $429, R12 + JMP callbackasm1(SB) + MOVV $430, R12 + JMP callbackasm1(SB) + MOVV $431, R12 + JMP callbackasm1(SB) + MOVV $432, R12 + JMP callbackasm1(SB) + MOVV $433, R12 + JMP callbackasm1(SB) + MOVV $434, R12 + JMP callbackasm1(SB) + MOVV $435, R12 + JMP callbackasm1(SB) + MOVV $436, R12 + JMP callbackasm1(SB) + MOVV $437, R12 + JMP callbackasm1(SB) + MOVV $438, R12 + JMP callbackasm1(SB) + MOVV $439, R12 + JMP callbackasm1(SB) + MOVV $440, R12 + JMP callbackasm1(SB) + MOVV $441, R12 + JMP callbackasm1(SB) + MOVV $442, R12 + JMP callbackasm1(SB) + MOVV $443, R12 + JMP callbackasm1(SB) + MOVV $444, R12 + JMP callbackasm1(SB) + MOVV $445, R12 + JMP callbackasm1(SB) + MOVV $446, R12 + JMP callbackasm1(SB) + MOVV $447, R12 + JMP callbackasm1(SB) + MOVV $448, R12 + JMP callbackasm1(SB) + MOVV $449, R12 + JMP callbackasm1(SB) + MOVV $450, R12 + JMP callbackasm1(SB) + MOVV $451, R12 + JMP callbackasm1(SB) + MOVV $452, R12 + JMP callbackasm1(SB) + MOVV $453, R12 + JMP callbackasm1(SB) + MOVV $454, R12 + JMP callbackasm1(SB) + MOVV $455, R12 + JMP callbackasm1(SB) + MOVV $456, R12 + JMP callbackasm1(SB) + MOVV $457, R12 + JMP callbackasm1(SB) + MOVV $458, R12 + JMP callbackasm1(SB) + MOVV $459, R12 + JMP callbackasm1(SB) + MOVV $460, R12 + JMP callbackasm1(SB) + MOVV $461, R12 + JMP callbackasm1(SB) + MOVV $462, R12 + JMP callbackasm1(SB) + MOVV $463, R12 + JMP callbackasm1(SB) + MOVV $464, R12 + JMP callbackasm1(SB) + MOVV $465, R12 + JMP callbackasm1(SB) + MOVV $466, R12 + JMP callbackasm1(SB) + MOVV $467, R12 + JMP callbackasm1(SB) + MOVV $468, R12 + JMP callbackasm1(SB) + MOVV $469, R12 + JMP callbackasm1(SB) + MOVV $470, R12 + JMP callbackasm1(SB) + MOVV $471, R12 + JMP callbackasm1(SB) + MOVV $472, R12 + JMP callbackasm1(SB) + MOVV $473, R12 + JMP callbackasm1(SB) + MOVV $474, R12 + JMP callbackasm1(SB) + MOVV $475, R12 + JMP callbackasm1(SB) + MOVV $476, R12 + JMP callbackasm1(SB) + MOVV $477, R12 + JMP callbackasm1(SB) + MOVV $478, R12 + JMP callbackasm1(SB) + MOVV $479, R12 + JMP callbackasm1(SB) + MOVV $480, R12 + JMP callbackasm1(SB) + MOVV $481, R12 + JMP callbackasm1(SB) + MOVV $482, R12 + JMP callbackasm1(SB) + MOVV $483, R12 + JMP callbackasm1(SB) + MOVV $484, R12 + JMP callbackasm1(SB) + MOVV $485, R12 + JMP callbackasm1(SB) + MOVV $486, R12 + JMP callbackasm1(SB) + MOVV $487, R12 + JMP callbackasm1(SB) + MOVV $488, R12 + JMP callbackasm1(SB) + MOVV $489, R12 + JMP callbackasm1(SB) + MOVV $490, R12 + JMP callbackasm1(SB) + MOVV $491, R12 + JMP callbackasm1(SB) + MOVV $492, R12 + JMP callbackasm1(SB) + MOVV $493, R12 + JMP callbackasm1(SB) + MOVV $494, R12 + JMP callbackasm1(SB) + MOVV $495, R12 + JMP callbackasm1(SB) + MOVV $496, R12 + JMP callbackasm1(SB) + MOVV $497, R12 + JMP callbackasm1(SB) + MOVV $498, R12 + JMP callbackasm1(SB) + MOVV $499, R12 + JMP callbackasm1(SB) + MOVV $500, R12 + JMP callbackasm1(SB) + MOVV $501, R12 + JMP callbackasm1(SB) + MOVV $502, R12 + JMP callbackasm1(SB) + MOVV $503, R12 + JMP callbackasm1(SB) + MOVV $504, R12 + JMP callbackasm1(SB) + MOVV $505, R12 + JMP callbackasm1(SB) + MOVV $506, R12 + JMP callbackasm1(SB) + MOVV $507, R12 + JMP callbackasm1(SB) + MOVV $508, R12 + JMP callbackasm1(SB) + MOVV $509, R12 + JMP callbackasm1(SB) + MOVV $510, R12 + JMP callbackasm1(SB) + MOVV $511, R12 + JMP callbackasm1(SB) + MOVV $512, R12 + JMP callbackasm1(SB) + MOVV $513, R12 + JMP callbackasm1(SB) + MOVV $514, R12 + JMP callbackasm1(SB) + MOVV $515, R12 + JMP callbackasm1(SB) + MOVV $516, R12 + JMP callbackasm1(SB) + MOVV $517, R12 + JMP callbackasm1(SB) + MOVV $518, R12 + JMP callbackasm1(SB) + MOVV $519, R12 + JMP callbackasm1(SB) + MOVV $520, R12 + JMP callbackasm1(SB) + MOVV $521, R12 + JMP callbackasm1(SB) + MOVV $522, R12 + JMP callbackasm1(SB) + MOVV $523, R12 + JMP callbackasm1(SB) + MOVV $524, R12 + JMP callbackasm1(SB) + MOVV $525, R12 + JMP callbackasm1(SB) + MOVV $526, R12 + JMP callbackasm1(SB) + MOVV $527, R12 + JMP callbackasm1(SB) + MOVV $528, R12 + JMP callbackasm1(SB) + MOVV $529, R12 + JMP callbackasm1(SB) + MOVV $530, R12 + JMP callbackasm1(SB) + MOVV $531, R12 + JMP callbackasm1(SB) + MOVV $532, R12 + JMP callbackasm1(SB) + MOVV $533, R12 + JMP callbackasm1(SB) + MOVV $534, R12 + JMP callbackasm1(SB) + MOVV $535, R12 + JMP callbackasm1(SB) + MOVV $536, R12 + JMP callbackasm1(SB) + MOVV $537, R12 + JMP callbackasm1(SB) + MOVV $538, R12 + JMP callbackasm1(SB) + MOVV $539, R12 + JMP callbackasm1(SB) + MOVV $540, R12 + JMP callbackasm1(SB) + MOVV $541, R12 + JMP callbackasm1(SB) + MOVV $542, R12 + JMP callbackasm1(SB) + MOVV $543, R12 + JMP callbackasm1(SB) + MOVV $544, R12 + JMP callbackasm1(SB) + MOVV $545, R12 + JMP callbackasm1(SB) + MOVV $546, R12 + JMP callbackasm1(SB) + MOVV $547, R12 + JMP callbackasm1(SB) + MOVV $548, R12 + JMP callbackasm1(SB) + MOVV $549, R12 + JMP callbackasm1(SB) + MOVV $550, R12 + JMP callbackasm1(SB) + MOVV $551, R12 + JMP callbackasm1(SB) + MOVV $552, R12 + JMP callbackasm1(SB) + MOVV $553, R12 + JMP callbackasm1(SB) + MOVV $554, R12 + JMP callbackasm1(SB) + MOVV $555, R12 + JMP callbackasm1(SB) + MOVV $556, R12 + JMP callbackasm1(SB) + MOVV $557, R12 + JMP callbackasm1(SB) + MOVV $558, R12 + JMP callbackasm1(SB) + MOVV $559, R12 + JMP callbackasm1(SB) + MOVV $560, R12 + JMP callbackasm1(SB) + MOVV $561, R12 + JMP callbackasm1(SB) + MOVV $562, R12 + JMP callbackasm1(SB) + MOVV $563, R12 + JMP callbackasm1(SB) + MOVV $564, R12 + JMP callbackasm1(SB) + MOVV $565, R12 + JMP callbackasm1(SB) + MOVV $566, R12 + JMP callbackasm1(SB) + MOVV $567, R12 + JMP callbackasm1(SB) + MOVV $568, R12 + JMP callbackasm1(SB) + MOVV $569, R12 + JMP callbackasm1(SB) + MOVV $570, R12 + JMP callbackasm1(SB) + MOVV $571, R12 + JMP callbackasm1(SB) + MOVV $572, R12 + JMP callbackasm1(SB) + MOVV $573, R12 + JMP callbackasm1(SB) + MOVV $574, R12 + JMP callbackasm1(SB) + MOVV $575, R12 + JMP callbackasm1(SB) + MOVV $576, R12 + JMP callbackasm1(SB) + MOVV $577, R12 + JMP callbackasm1(SB) + MOVV $578, R12 + JMP callbackasm1(SB) + MOVV $579, R12 + JMP callbackasm1(SB) + MOVV $580, R12 + JMP callbackasm1(SB) + MOVV $581, R12 + JMP callbackasm1(SB) + MOVV $582, R12 + JMP callbackasm1(SB) + MOVV $583, R12 + JMP callbackasm1(SB) + MOVV $584, R12 + JMP callbackasm1(SB) + MOVV $585, R12 + JMP callbackasm1(SB) + MOVV $586, R12 + JMP callbackasm1(SB) + MOVV $587, R12 + JMP callbackasm1(SB) + MOVV $588, R12 + JMP callbackasm1(SB) + MOVV $589, R12 + JMP callbackasm1(SB) + MOVV $590, R12 + JMP callbackasm1(SB) + MOVV $591, R12 + JMP callbackasm1(SB) + MOVV $592, R12 + JMP callbackasm1(SB) + MOVV $593, R12 + JMP callbackasm1(SB) + MOVV $594, R12 + JMP callbackasm1(SB) + MOVV $595, R12 + JMP callbackasm1(SB) + MOVV $596, R12 + JMP callbackasm1(SB) + MOVV $597, R12 + JMP callbackasm1(SB) + MOVV $598, R12 + JMP callbackasm1(SB) + MOVV $599, R12 + JMP callbackasm1(SB) + MOVV $600, R12 + JMP callbackasm1(SB) + MOVV $601, R12 + JMP callbackasm1(SB) + MOVV $602, R12 + JMP callbackasm1(SB) + MOVV $603, R12 + JMP callbackasm1(SB) + MOVV $604, R12 + JMP callbackasm1(SB) + MOVV $605, R12 + JMP callbackasm1(SB) + MOVV $606, R12 + JMP callbackasm1(SB) + MOVV $607, R12 + JMP callbackasm1(SB) + MOVV $608, R12 + JMP callbackasm1(SB) + MOVV $609, R12 + JMP callbackasm1(SB) + MOVV $610, R12 + JMP callbackasm1(SB) + MOVV $611, R12 + JMP callbackasm1(SB) + MOVV $612, R12 + JMP callbackasm1(SB) + MOVV $613, R12 + JMP callbackasm1(SB) + MOVV $614, R12 + JMP callbackasm1(SB) + MOVV $615, R12 + JMP callbackasm1(SB) + MOVV $616, R12 + JMP callbackasm1(SB) + MOVV $617, R12 + JMP callbackasm1(SB) + MOVV $618, R12 + JMP callbackasm1(SB) + MOVV $619, R12 + JMP callbackasm1(SB) + MOVV $620, R12 + JMP callbackasm1(SB) + MOVV $621, R12 + JMP callbackasm1(SB) + MOVV $622, R12 + JMP callbackasm1(SB) + MOVV $623, R12 + JMP callbackasm1(SB) + MOVV $624, R12 + JMP callbackasm1(SB) + MOVV $625, R12 + JMP callbackasm1(SB) + MOVV $626, R12 + JMP callbackasm1(SB) + MOVV $627, R12 + JMP callbackasm1(SB) + MOVV $628, R12 + JMP callbackasm1(SB) + MOVV $629, R12 + JMP callbackasm1(SB) + MOVV $630, R12 + JMP callbackasm1(SB) + MOVV $631, R12 + JMP callbackasm1(SB) + MOVV $632, R12 + JMP callbackasm1(SB) + MOVV $633, R12 + JMP callbackasm1(SB) + MOVV $634, R12 + JMP callbackasm1(SB) + MOVV $635, R12 + JMP callbackasm1(SB) + MOVV $636, R12 + JMP callbackasm1(SB) + MOVV $637, R12 + JMP callbackasm1(SB) + MOVV $638, R12 + JMP callbackasm1(SB) + MOVV $639, R12 + JMP callbackasm1(SB) + MOVV $640, R12 + JMP callbackasm1(SB) + MOVV $641, R12 + JMP callbackasm1(SB) + MOVV $642, R12 + JMP callbackasm1(SB) + MOVV $643, R12 + JMP callbackasm1(SB) + MOVV $644, R12 + JMP callbackasm1(SB) + MOVV $645, R12 + JMP callbackasm1(SB) + MOVV $646, R12 + JMP callbackasm1(SB) + MOVV $647, R12 + JMP callbackasm1(SB) + MOVV $648, R12 + JMP callbackasm1(SB) + MOVV $649, R12 + JMP callbackasm1(SB) + MOVV $650, R12 + JMP callbackasm1(SB) + MOVV $651, R12 + JMP callbackasm1(SB) + MOVV $652, R12 + JMP callbackasm1(SB) + MOVV $653, R12 + JMP callbackasm1(SB) + MOVV $654, R12 + JMP callbackasm1(SB) + MOVV $655, R12 + JMP callbackasm1(SB) + MOVV $656, R12 + JMP callbackasm1(SB) + MOVV $657, R12 + JMP callbackasm1(SB) + MOVV $658, R12 + JMP callbackasm1(SB) + MOVV $659, R12 + JMP callbackasm1(SB) + MOVV $660, R12 + JMP callbackasm1(SB) + MOVV $661, R12 + JMP callbackasm1(SB) + MOVV $662, R12 + JMP callbackasm1(SB) + MOVV $663, R12 + JMP callbackasm1(SB) + MOVV $664, R12 + JMP callbackasm1(SB) + MOVV $665, R12 + JMP callbackasm1(SB) + MOVV $666, R12 + JMP callbackasm1(SB) + MOVV $667, R12 + JMP callbackasm1(SB) + MOVV $668, R12 + JMP callbackasm1(SB) + MOVV $669, R12 + JMP callbackasm1(SB) + MOVV $670, R12 + JMP callbackasm1(SB) + MOVV $671, R12 + JMP callbackasm1(SB) + MOVV $672, R12 + JMP callbackasm1(SB) + MOVV $673, R12 + JMP callbackasm1(SB) + MOVV $674, R12 + JMP callbackasm1(SB) + MOVV $675, R12 + JMP callbackasm1(SB) + MOVV $676, R12 + JMP callbackasm1(SB) + MOVV $677, R12 + JMP callbackasm1(SB) + MOVV $678, R12 + JMP callbackasm1(SB) + MOVV $679, R12 + JMP callbackasm1(SB) + MOVV $680, R12 + JMP callbackasm1(SB) + MOVV $681, R12 + JMP callbackasm1(SB) + MOVV $682, R12 + JMP callbackasm1(SB) + MOVV $683, R12 + JMP callbackasm1(SB) + MOVV $684, R12 + JMP callbackasm1(SB) + MOVV $685, R12 + JMP callbackasm1(SB) + MOVV $686, R12 + JMP callbackasm1(SB) + MOVV $687, R12 + JMP callbackasm1(SB) + MOVV $688, R12 + JMP callbackasm1(SB) + MOVV $689, R12 + JMP callbackasm1(SB) + MOVV $690, R12 + JMP callbackasm1(SB) + MOVV $691, R12 + JMP callbackasm1(SB) + MOVV $692, R12 + JMP callbackasm1(SB) + MOVV $693, R12 + JMP callbackasm1(SB) + MOVV $694, R12 + JMP callbackasm1(SB) + MOVV $695, R12 + JMP callbackasm1(SB) + MOVV $696, R12 + JMP callbackasm1(SB) + MOVV $697, R12 + JMP callbackasm1(SB) + MOVV $698, R12 + JMP callbackasm1(SB) + MOVV $699, R12 + JMP callbackasm1(SB) + MOVV $700, R12 + JMP callbackasm1(SB) + MOVV $701, R12 + JMP callbackasm1(SB) + MOVV $702, R12 + JMP callbackasm1(SB) + MOVV $703, R12 + JMP callbackasm1(SB) + MOVV $704, R12 + JMP callbackasm1(SB) + MOVV $705, R12 + JMP callbackasm1(SB) + MOVV $706, R12 + JMP callbackasm1(SB) + MOVV $707, R12 + JMP callbackasm1(SB) + MOVV $708, R12 + JMP callbackasm1(SB) + MOVV $709, R12 + JMP callbackasm1(SB) + MOVV $710, R12 + JMP callbackasm1(SB) + MOVV $711, R12 + JMP callbackasm1(SB) + MOVV $712, R12 + JMP callbackasm1(SB) + MOVV $713, R12 + JMP callbackasm1(SB) + MOVV $714, R12 + JMP callbackasm1(SB) + MOVV $715, R12 + JMP callbackasm1(SB) + MOVV $716, R12 + JMP callbackasm1(SB) + MOVV $717, R12 + JMP callbackasm1(SB) + MOVV $718, R12 + JMP callbackasm1(SB) + MOVV $719, R12 + JMP callbackasm1(SB) + MOVV $720, R12 + JMP callbackasm1(SB) + MOVV $721, R12 + JMP callbackasm1(SB) + MOVV $722, R12 + JMP callbackasm1(SB) + MOVV $723, R12 + JMP callbackasm1(SB) + MOVV $724, R12 + JMP callbackasm1(SB) + MOVV $725, R12 + JMP callbackasm1(SB) + MOVV $726, R12 + JMP callbackasm1(SB) + MOVV $727, R12 + JMP callbackasm1(SB) + MOVV $728, R12 + JMP callbackasm1(SB) + MOVV $729, R12 + JMP callbackasm1(SB) + MOVV $730, R12 + JMP callbackasm1(SB) + MOVV $731, R12 + JMP callbackasm1(SB) + MOVV $732, R12 + JMP callbackasm1(SB) + MOVV $733, R12 + JMP callbackasm1(SB) + MOVV $734, R12 + JMP callbackasm1(SB) + MOVV $735, R12 + JMP callbackasm1(SB) + MOVV $736, R12 + JMP callbackasm1(SB) + MOVV $737, R12 + JMP callbackasm1(SB) + MOVV $738, R12 + JMP callbackasm1(SB) + MOVV $739, R12 + JMP callbackasm1(SB) + MOVV $740, R12 + JMP callbackasm1(SB) + MOVV $741, R12 + JMP callbackasm1(SB) + MOVV $742, R12 + JMP callbackasm1(SB) + MOVV $743, R12 + JMP callbackasm1(SB) + MOVV $744, R12 + JMP callbackasm1(SB) + MOVV $745, R12 + JMP callbackasm1(SB) + MOVV $746, R12 + JMP callbackasm1(SB) + MOVV $747, R12 + JMP callbackasm1(SB) + MOVV $748, R12 + JMP callbackasm1(SB) + MOVV $749, R12 + JMP callbackasm1(SB) + MOVV $750, R12 + JMP callbackasm1(SB) + MOVV $751, R12 + JMP callbackasm1(SB) + MOVV $752, R12 + JMP callbackasm1(SB) + MOVV $753, R12 + JMP callbackasm1(SB) + MOVV $754, R12 + JMP callbackasm1(SB) + MOVV $755, R12 + JMP callbackasm1(SB) + MOVV $756, R12 + JMP callbackasm1(SB) + MOVV $757, R12 + JMP callbackasm1(SB) + MOVV $758, R12 + JMP callbackasm1(SB) + MOVV $759, R12 + JMP callbackasm1(SB) + MOVV $760, R12 + JMP callbackasm1(SB) + MOVV $761, R12 + JMP callbackasm1(SB) + MOVV $762, R12 + JMP callbackasm1(SB) + MOVV $763, R12 + JMP callbackasm1(SB) + MOVV $764, R12 + JMP callbackasm1(SB) + MOVV $765, R12 + JMP callbackasm1(SB) + MOVV $766, R12 + JMP callbackasm1(SB) + MOVV $767, R12 + JMP callbackasm1(SB) + MOVV $768, R12 + JMP callbackasm1(SB) + MOVV $769, R12 + JMP callbackasm1(SB) + MOVV $770, R12 + JMP callbackasm1(SB) + MOVV $771, R12 + JMP callbackasm1(SB) + MOVV $772, R12 + JMP callbackasm1(SB) + MOVV $773, R12 + JMP callbackasm1(SB) + MOVV $774, R12 + JMP callbackasm1(SB) + MOVV $775, R12 + JMP callbackasm1(SB) + MOVV $776, R12 + JMP callbackasm1(SB) + MOVV $777, R12 + JMP callbackasm1(SB) + MOVV $778, R12 + JMP callbackasm1(SB) + MOVV $779, R12 + JMP callbackasm1(SB) + MOVV $780, R12 + JMP callbackasm1(SB) + MOVV $781, R12 + JMP callbackasm1(SB) + MOVV $782, R12 + JMP callbackasm1(SB) + MOVV $783, R12 + JMP callbackasm1(SB) + MOVV $784, R12 + JMP callbackasm1(SB) + MOVV $785, R12 + JMP callbackasm1(SB) + MOVV $786, R12 + JMP callbackasm1(SB) + MOVV $787, R12 + JMP callbackasm1(SB) + MOVV $788, R12 + JMP callbackasm1(SB) + MOVV $789, R12 + JMP callbackasm1(SB) + MOVV $790, R12 + JMP callbackasm1(SB) + MOVV $791, R12 + JMP callbackasm1(SB) + MOVV $792, R12 + JMP callbackasm1(SB) + MOVV $793, R12 + JMP callbackasm1(SB) + MOVV $794, R12 + JMP callbackasm1(SB) + MOVV $795, R12 + JMP callbackasm1(SB) + MOVV $796, R12 + JMP callbackasm1(SB) + MOVV $797, R12 + JMP callbackasm1(SB) + MOVV $798, R12 + JMP callbackasm1(SB) + MOVV $799, R12 + JMP callbackasm1(SB) + MOVV $800, R12 + JMP callbackasm1(SB) + MOVV $801, R12 + JMP callbackasm1(SB) + MOVV $802, R12 + JMP callbackasm1(SB) + MOVV $803, R12 + JMP callbackasm1(SB) + MOVV $804, R12 + JMP callbackasm1(SB) + MOVV $805, R12 + JMP callbackasm1(SB) + MOVV $806, R12 + JMP callbackasm1(SB) + MOVV $807, R12 + JMP callbackasm1(SB) + MOVV $808, R12 + JMP callbackasm1(SB) + MOVV $809, R12 + JMP callbackasm1(SB) + MOVV $810, R12 + JMP callbackasm1(SB) + MOVV $811, R12 + JMP callbackasm1(SB) + MOVV $812, R12 + JMP callbackasm1(SB) + MOVV $813, R12 + JMP callbackasm1(SB) + MOVV $814, R12 + JMP callbackasm1(SB) + MOVV $815, R12 + JMP callbackasm1(SB) + MOVV $816, R12 + JMP callbackasm1(SB) + MOVV $817, R12 + JMP callbackasm1(SB) + MOVV $818, R12 + JMP callbackasm1(SB) + MOVV $819, R12 + JMP callbackasm1(SB) + MOVV $820, R12 + JMP callbackasm1(SB) + MOVV $821, R12 + JMP callbackasm1(SB) + MOVV $822, R12 + JMP callbackasm1(SB) + MOVV $823, R12 + JMP callbackasm1(SB) + MOVV $824, R12 + JMP callbackasm1(SB) + MOVV $825, R12 + JMP callbackasm1(SB) + MOVV $826, R12 + JMP callbackasm1(SB) + MOVV $827, R12 + JMP callbackasm1(SB) + MOVV $828, R12 + JMP callbackasm1(SB) + MOVV $829, R12 + JMP callbackasm1(SB) + MOVV $830, R12 + JMP callbackasm1(SB) + MOVV $831, R12 + JMP callbackasm1(SB) + MOVV $832, R12 + JMP callbackasm1(SB) + MOVV $833, R12 + JMP callbackasm1(SB) + MOVV $834, R12 + JMP callbackasm1(SB) + MOVV $835, R12 + JMP callbackasm1(SB) + MOVV $836, R12 + JMP callbackasm1(SB) + MOVV $837, R12 + JMP callbackasm1(SB) + MOVV $838, R12 + JMP callbackasm1(SB) + MOVV $839, R12 + JMP callbackasm1(SB) + MOVV $840, R12 + JMP callbackasm1(SB) + MOVV $841, R12 + JMP callbackasm1(SB) + MOVV $842, R12 + JMP callbackasm1(SB) + MOVV $843, R12 + JMP callbackasm1(SB) + MOVV $844, R12 + JMP callbackasm1(SB) + MOVV $845, R12 + JMP callbackasm1(SB) + MOVV $846, R12 + JMP callbackasm1(SB) + MOVV $847, R12 + JMP callbackasm1(SB) + MOVV $848, R12 + JMP callbackasm1(SB) + MOVV $849, R12 + JMP callbackasm1(SB) + MOVV $850, R12 + JMP callbackasm1(SB) + MOVV $851, R12 + JMP callbackasm1(SB) + MOVV $852, R12 + JMP callbackasm1(SB) + MOVV $853, R12 + JMP callbackasm1(SB) + MOVV $854, R12 + JMP callbackasm1(SB) + MOVV $855, R12 + JMP callbackasm1(SB) + MOVV $856, R12 + JMP callbackasm1(SB) + MOVV $857, R12 + JMP callbackasm1(SB) + MOVV $858, R12 + JMP callbackasm1(SB) + MOVV $859, R12 + JMP callbackasm1(SB) + MOVV $860, R12 + JMP callbackasm1(SB) + MOVV $861, R12 + JMP callbackasm1(SB) + MOVV $862, R12 + JMP callbackasm1(SB) + MOVV $863, R12 + JMP callbackasm1(SB) + MOVV $864, R12 + JMP callbackasm1(SB) + MOVV $865, R12 + JMP callbackasm1(SB) + MOVV $866, R12 + JMP callbackasm1(SB) + MOVV $867, R12 + JMP callbackasm1(SB) + MOVV $868, R12 + JMP callbackasm1(SB) + MOVV $869, R12 + JMP callbackasm1(SB) + MOVV $870, R12 + JMP callbackasm1(SB) + MOVV $871, R12 + JMP callbackasm1(SB) + MOVV $872, R12 + JMP callbackasm1(SB) + MOVV $873, R12 + JMP callbackasm1(SB) + MOVV $874, R12 + JMP callbackasm1(SB) + MOVV $875, R12 + JMP callbackasm1(SB) + MOVV $876, R12 + JMP callbackasm1(SB) + MOVV $877, R12 + JMP callbackasm1(SB) + MOVV $878, R12 + JMP callbackasm1(SB) + MOVV $879, R12 + JMP callbackasm1(SB) + MOVV $880, R12 + JMP callbackasm1(SB) + MOVV $881, R12 + JMP callbackasm1(SB) + MOVV $882, R12 + JMP callbackasm1(SB) + MOVV $883, R12 + JMP callbackasm1(SB) + MOVV $884, R12 + JMP callbackasm1(SB) + MOVV $885, R12 + JMP callbackasm1(SB) + MOVV $886, R12 + JMP callbackasm1(SB) + MOVV $887, R12 + JMP callbackasm1(SB) + MOVV $888, R12 + JMP callbackasm1(SB) + MOVV $889, R12 + JMP callbackasm1(SB) + MOVV $890, R12 + JMP callbackasm1(SB) + MOVV $891, R12 + JMP callbackasm1(SB) + MOVV $892, R12 + JMP callbackasm1(SB) + MOVV $893, R12 + JMP callbackasm1(SB) + MOVV $894, R12 + JMP callbackasm1(SB) + MOVV $895, R12 + JMP callbackasm1(SB) + MOVV $896, R12 + JMP callbackasm1(SB) + MOVV $897, R12 + JMP callbackasm1(SB) + MOVV $898, R12 + JMP callbackasm1(SB) + MOVV $899, R12 + JMP callbackasm1(SB) + MOVV $900, R12 + JMP callbackasm1(SB) + MOVV $901, R12 + JMP callbackasm1(SB) + MOVV $902, R12 + JMP callbackasm1(SB) + MOVV $903, R12 + JMP callbackasm1(SB) + MOVV $904, R12 + JMP callbackasm1(SB) + MOVV $905, R12 + JMP callbackasm1(SB) + MOVV $906, R12 + JMP callbackasm1(SB) + MOVV $907, R12 + JMP callbackasm1(SB) + MOVV $908, R12 + JMP callbackasm1(SB) + MOVV $909, R12 + JMP callbackasm1(SB) + MOVV $910, R12 + JMP callbackasm1(SB) + MOVV $911, R12 + JMP callbackasm1(SB) + MOVV $912, R12 + JMP callbackasm1(SB) + MOVV $913, R12 + JMP callbackasm1(SB) + MOVV $914, R12 + JMP callbackasm1(SB) + MOVV $915, R12 + JMP callbackasm1(SB) + MOVV $916, R12 + JMP callbackasm1(SB) + MOVV $917, R12 + JMP callbackasm1(SB) + MOVV $918, R12 + JMP callbackasm1(SB) + MOVV $919, R12 + JMP callbackasm1(SB) + MOVV $920, R12 + JMP callbackasm1(SB) + MOVV $921, R12 + JMP callbackasm1(SB) + MOVV $922, R12 + JMP callbackasm1(SB) + MOVV $923, R12 + JMP callbackasm1(SB) + MOVV $924, R12 + JMP callbackasm1(SB) + MOVV $925, R12 + JMP callbackasm1(SB) + MOVV $926, R12 + JMP callbackasm1(SB) + MOVV $927, R12 + JMP callbackasm1(SB) + MOVV $928, R12 + JMP callbackasm1(SB) + MOVV $929, R12 + JMP callbackasm1(SB) + MOVV $930, R12 + JMP callbackasm1(SB) + MOVV $931, R12 + JMP callbackasm1(SB) + MOVV $932, R12 + JMP callbackasm1(SB) + MOVV $933, R12 + JMP callbackasm1(SB) + MOVV $934, R12 + JMP callbackasm1(SB) + MOVV $935, R12 + JMP callbackasm1(SB) + MOVV $936, R12 + JMP callbackasm1(SB) + MOVV $937, R12 + JMP callbackasm1(SB) + MOVV $938, R12 + JMP callbackasm1(SB) + MOVV $939, R12 + JMP callbackasm1(SB) + MOVV $940, R12 + JMP callbackasm1(SB) + MOVV $941, R12 + JMP callbackasm1(SB) + MOVV $942, R12 + JMP callbackasm1(SB) + MOVV $943, R12 + JMP callbackasm1(SB) + MOVV $944, R12 + JMP callbackasm1(SB) + MOVV $945, R12 + JMP callbackasm1(SB) + MOVV $946, R12 + JMP callbackasm1(SB) + MOVV $947, R12 + JMP callbackasm1(SB) + MOVV $948, R12 + JMP callbackasm1(SB) + MOVV $949, R12 + JMP callbackasm1(SB) + MOVV $950, R12 + JMP callbackasm1(SB) + MOVV $951, R12 + JMP callbackasm1(SB) + MOVV $952, R12 + JMP callbackasm1(SB) + MOVV $953, R12 + JMP callbackasm1(SB) + MOVV $954, R12 + JMP callbackasm1(SB) + MOVV $955, R12 + JMP callbackasm1(SB) + MOVV $956, R12 + JMP callbackasm1(SB) + MOVV $957, R12 + JMP callbackasm1(SB) + MOVV $958, R12 + JMP callbackasm1(SB) + MOVV $959, R12 + JMP callbackasm1(SB) + MOVV $960, R12 + JMP callbackasm1(SB) + MOVV $961, R12 + JMP callbackasm1(SB) + MOVV $962, R12 + JMP callbackasm1(SB) + MOVV $963, R12 + JMP callbackasm1(SB) + MOVV $964, R12 + JMP callbackasm1(SB) + MOVV $965, R12 + JMP callbackasm1(SB) + MOVV $966, R12 + JMP callbackasm1(SB) + MOVV $967, R12 + JMP callbackasm1(SB) + MOVV $968, R12 + JMP callbackasm1(SB) + MOVV $969, R12 + JMP callbackasm1(SB) + MOVV $970, R12 + JMP callbackasm1(SB) + MOVV $971, R12 + JMP callbackasm1(SB) + MOVV $972, R12 + JMP callbackasm1(SB) + MOVV $973, R12 + JMP callbackasm1(SB) + MOVV $974, R12 + JMP callbackasm1(SB) + MOVV $975, R12 + JMP callbackasm1(SB) + MOVV $976, R12 + JMP callbackasm1(SB) + MOVV $977, R12 + JMP callbackasm1(SB) + MOVV $978, R12 + JMP callbackasm1(SB) + MOVV $979, R12 + JMP callbackasm1(SB) + MOVV $980, R12 + JMP callbackasm1(SB) + MOVV $981, R12 + JMP callbackasm1(SB) + MOVV $982, R12 + JMP callbackasm1(SB) + MOVV $983, R12 + JMP callbackasm1(SB) + MOVV $984, R12 + JMP callbackasm1(SB) + MOVV $985, R12 + JMP callbackasm1(SB) + MOVV $986, R12 + JMP callbackasm1(SB) + MOVV $987, R12 + JMP callbackasm1(SB) + MOVV $988, R12 + JMP callbackasm1(SB) + MOVV $989, R12 + JMP callbackasm1(SB) + MOVV $990, R12 + JMP callbackasm1(SB) + MOVV $991, R12 + JMP callbackasm1(SB) + MOVV $992, R12 + JMP callbackasm1(SB) + MOVV $993, R12 + JMP callbackasm1(SB) + MOVV $994, R12 + JMP callbackasm1(SB) + MOVV $995, R12 + JMP callbackasm1(SB) + MOVV $996, R12 + JMP callbackasm1(SB) + MOVV $997, R12 + JMP callbackasm1(SB) + MOVV $998, R12 + JMP callbackasm1(SB) + MOVV $999, R12 + JMP callbackasm1(SB) + MOVV $1000, R12 + JMP callbackasm1(SB) + MOVV $1001, R12 + JMP callbackasm1(SB) + MOVV $1002, R12 + JMP callbackasm1(SB) + MOVV $1003, R12 + JMP callbackasm1(SB) + MOVV $1004, R12 + JMP callbackasm1(SB) + MOVV $1005, R12 + JMP callbackasm1(SB) + MOVV $1006, R12 + JMP callbackasm1(SB) + MOVV $1007, R12 + JMP callbackasm1(SB) + MOVV $1008, R12 + JMP callbackasm1(SB) + MOVV $1009, R12 + JMP callbackasm1(SB) + MOVV $1010, R12 + JMP callbackasm1(SB) + MOVV $1011, R12 + JMP callbackasm1(SB) + MOVV $1012, R12 + JMP callbackasm1(SB) + MOVV $1013, R12 + JMP callbackasm1(SB) + MOVV $1014, R12 + JMP callbackasm1(SB) + MOVV $1015, R12 + JMP callbackasm1(SB) + MOVV $1016, R12 + JMP callbackasm1(SB) + MOVV $1017, R12 + JMP callbackasm1(SB) + MOVV $1018, R12 + JMP callbackasm1(SB) + MOVV $1019, R12 + JMP callbackasm1(SB) + MOVV $1020, R12 + JMP callbackasm1(SB) + MOVV $1021, R12 + JMP callbackasm1(SB) + MOVV $1022, R12 + JMP callbackasm1(SB) + MOVV $1023, R12 + JMP callbackasm1(SB) + MOVV $1024, R12 + JMP callbackasm1(SB) + MOVV $1025, R12 + JMP callbackasm1(SB) + MOVV $1026, R12 + JMP callbackasm1(SB) + MOVV $1027, R12 + JMP callbackasm1(SB) + MOVV $1028, R12 + JMP callbackasm1(SB) + MOVV $1029, R12 + JMP callbackasm1(SB) + MOVV $1030, R12 + JMP callbackasm1(SB) + MOVV $1031, R12 + JMP callbackasm1(SB) + MOVV $1032, R12 + JMP callbackasm1(SB) + MOVV $1033, R12 + JMP callbackasm1(SB) + MOVV $1034, R12 + JMP callbackasm1(SB) + MOVV $1035, R12 + JMP callbackasm1(SB) + MOVV $1036, R12 + JMP callbackasm1(SB) + MOVV $1037, R12 + JMP callbackasm1(SB) + MOVV $1038, R12 + JMP callbackasm1(SB) + MOVV $1039, R12 + JMP callbackasm1(SB) + MOVV $1040, R12 + JMP callbackasm1(SB) + MOVV $1041, R12 + JMP callbackasm1(SB) + MOVV $1042, R12 + JMP callbackasm1(SB) + MOVV $1043, R12 + JMP callbackasm1(SB) + MOVV $1044, R12 + JMP callbackasm1(SB) + MOVV $1045, R12 + JMP callbackasm1(SB) + MOVV $1046, R12 + JMP callbackasm1(SB) + MOVV $1047, R12 + JMP callbackasm1(SB) + MOVV $1048, R12 + JMP callbackasm1(SB) + MOVV $1049, R12 + JMP callbackasm1(SB) + MOVV $1050, R12 + JMP callbackasm1(SB) + MOVV $1051, R12 + JMP callbackasm1(SB) + MOVV $1052, R12 + JMP callbackasm1(SB) + MOVV $1053, R12 + JMP callbackasm1(SB) + MOVV $1054, R12 + JMP callbackasm1(SB) + MOVV $1055, R12 + JMP callbackasm1(SB) + MOVV $1056, R12 + JMP callbackasm1(SB) + MOVV $1057, R12 + JMP callbackasm1(SB) + MOVV $1058, R12 + JMP callbackasm1(SB) + MOVV $1059, R12 + JMP callbackasm1(SB) + MOVV $1060, R12 + JMP callbackasm1(SB) + MOVV $1061, R12 + JMP callbackasm1(SB) + MOVV $1062, R12 + JMP callbackasm1(SB) + MOVV $1063, R12 + JMP callbackasm1(SB) + MOVV $1064, R12 + JMP callbackasm1(SB) + MOVV $1065, R12 + JMP callbackasm1(SB) + MOVV $1066, R12 + JMP callbackasm1(SB) + MOVV $1067, R12 + JMP callbackasm1(SB) + MOVV $1068, R12 + JMP callbackasm1(SB) + MOVV $1069, R12 + JMP callbackasm1(SB) + MOVV $1070, R12 + JMP callbackasm1(SB) + MOVV $1071, R12 + JMP callbackasm1(SB) + MOVV $1072, R12 + JMP callbackasm1(SB) + MOVV $1073, R12 + JMP callbackasm1(SB) + MOVV $1074, R12 + JMP callbackasm1(SB) + MOVV $1075, R12 + JMP callbackasm1(SB) + MOVV $1076, R12 + JMP callbackasm1(SB) + MOVV $1077, R12 + JMP callbackasm1(SB) + MOVV $1078, R12 + JMP callbackasm1(SB) + MOVV $1079, R12 + JMP callbackasm1(SB) + MOVV $1080, R12 + JMP callbackasm1(SB) + MOVV $1081, R12 + JMP callbackasm1(SB) + MOVV $1082, R12 + JMP callbackasm1(SB) + MOVV $1083, R12 + JMP callbackasm1(SB) + MOVV $1084, R12 + JMP callbackasm1(SB) + MOVV $1085, R12 + JMP callbackasm1(SB) + MOVV $1086, R12 + JMP callbackasm1(SB) + MOVV $1087, R12 + JMP callbackasm1(SB) + MOVV $1088, R12 + JMP callbackasm1(SB) + MOVV $1089, R12 + JMP callbackasm1(SB) + MOVV $1090, R12 + JMP callbackasm1(SB) + MOVV $1091, R12 + JMP callbackasm1(SB) + MOVV $1092, R12 + JMP callbackasm1(SB) + MOVV $1093, R12 + JMP callbackasm1(SB) + MOVV $1094, R12 + JMP callbackasm1(SB) + MOVV $1095, R12 + JMP callbackasm1(SB) + MOVV $1096, R12 + JMP callbackasm1(SB) + MOVV $1097, R12 + JMP callbackasm1(SB) + MOVV $1098, R12 + JMP callbackasm1(SB) + MOVV $1099, R12 + JMP callbackasm1(SB) + MOVV $1100, R12 + JMP callbackasm1(SB) + MOVV $1101, R12 + JMP callbackasm1(SB) + MOVV $1102, R12 + JMP callbackasm1(SB) + MOVV $1103, R12 + JMP callbackasm1(SB) + MOVV $1104, R12 + JMP callbackasm1(SB) + MOVV $1105, R12 + JMP callbackasm1(SB) + MOVV $1106, R12 + JMP callbackasm1(SB) + MOVV $1107, R12 + JMP callbackasm1(SB) + MOVV $1108, R12 + JMP callbackasm1(SB) + MOVV $1109, R12 + JMP callbackasm1(SB) + MOVV $1110, R12 + JMP callbackasm1(SB) + MOVV $1111, R12 + JMP callbackasm1(SB) + MOVV $1112, R12 + JMP callbackasm1(SB) + MOVV $1113, R12 + JMP callbackasm1(SB) + MOVV $1114, R12 + JMP callbackasm1(SB) + MOVV $1115, R12 + JMP callbackasm1(SB) + MOVV $1116, R12 + JMP callbackasm1(SB) + MOVV $1117, R12 + JMP callbackasm1(SB) + MOVV $1118, R12 + JMP callbackasm1(SB) + MOVV $1119, R12 + JMP callbackasm1(SB) + MOVV $1120, R12 + JMP callbackasm1(SB) + MOVV $1121, R12 + JMP callbackasm1(SB) + MOVV $1122, R12 + JMP callbackasm1(SB) + MOVV $1123, R12 + JMP callbackasm1(SB) + MOVV $1124, R12 + JMP callbackasm1(SB) + MOVV $1125, R12 + JMP callbackasm1(SB) + MOVV $1126, R12 + JMP callbackasm1(SB) + MOVV $1127, R12 + JMP callbackasm1(SB) + MOVV $1128, R12 + JMP callbackasm1(SB) + MOVV $1129, R12 + JMP callbackasm1(SB) + MOVV $1130, R12 + JMP callbackasm1(SB) + MOVV $1131, R12 + JMP callbackasm1(SB) + MOVV $1132, R12 + JMP callbackasm1(SB) + MOVV $1133, R12 + JMP callbackasm1(SB) + MOVV $1134, R12 + JMP callbackasm1(SB) + MOVV $1135, R12 + JMP callbackasm1(SB) + MOVV $1136, R12 + JMP callbackasm1(SB) + MOVV $1137, R12 + JMP callbackasm1(SB) + MOVV $1138, R12 + JMP callbackasm1(SB) + MOVV $1139, R12 + JMP callbackasm1(SB) + MOVV $1140, R12 + JMP callbackasm1(SB) + MOVV $1141, R12 + JMP callbackasm1(SB) + MOVV $1142, R12 + JMP callbackasm1(SB) + MOVV $1143, R12 + JMP callbackasm1(SB) + MOVV $1144, R12 + JMP callbackasm1(SB) + MOVV $1145, R12 + JMP callbackasm1(SB) + MOVV $1146, R12 + JMP callbackasm1(SB) + MOVV $1147, R12 + JMP callbackasm1(SB) + MOVV $1148, R12 + JMP callbackasm1(SB) + MOVV $1149, R12 + JMP callbackasm1(SB) + MOVV $1150, R12 + JMP callbackasm1(SB) + MOVV $1151, R12 + JMP callbackasm1(SB) + MOVV $1152, R12 + JMP callbackasm1(SB) + MOVV $1153, R12 + JMP callbackasm1(SB) + MOVV $1154, R12 + JMP callbackasm1(SB) + MOVV $1155, R12 + JMP callbackasm1(SB) + MOVV $1156, R12 + JMP callbackasm1(SB) + MOVV $1157, R12 + JMP callbackasm1(SB) + MOVV $1158, R12 + JMP callbackasm1(SB) + MOVV $1159, R12 + JMP callbackasm1(SB) + MOVV $1160, R12 + JMP callbackasm1(SB) + MOVV $1161, R12 + JMP callbackasm1(SB) + MOVV $1162, R12 + JMP callbackasm1(SB) + MOVV $1163, R12 + JMP callbackasm1(SB) + MOVV $1164, R12 + JMP callbackasm1(SB) + MOVV $1165, R12 + JMP callbackasm1(SB) + MOVV $1166, R12 + JMP callbackasm1(SB) + MOVV $1167, R12 + JMP callbackasm1(SB) + MOVV $1168, R12 + JMP callbackasm1(SB) + MOVV $1169, R12 + JMP callbackasm1(SB) + MOVV $1170, R12 + JMP callbackasm1(SB) + MOVV $1171, R12 + JMP callbackasm1(SB) + MOVV $1172, R12 + JMP callbackasm1(SB) + MOVV $1173, R12 + JMP callbackasm1(SB) + MOVV $1174, R12 + JMP callbackasm1(SB) + MOVV $1175, R12 + JMP callbackasm1(SB) + MOVV $1176, R12 + JMP callbackasm1(SB) + MOVV $1177, R12 + JMP callbackasm1(SB) + MOVV $1178, R12 + JMP callbackasm1(SB) + MOVV $1179, R12 + JMP callbackasm1(SB) + MOVV $1180, R12 + JMP callbackasm1(SB) + MOVV $1181, R12 + JMP callbackasm1(SB) + MOVV $1182, R12 + JMP callbackasm1(SB) + MOVV $1183, R12 + JMP callbackasm1(SB) + MOVV $1184, R12 + JMP callbackasm1(SB) + MOVV $1185, R12 + JMP callbackasm1(SB) + MOVV $1186, R12 + JMP callbackasm1(SB) + MOVV $1187, R12 + JMP callbackasm1(SB) + MOVV $1188, R12 + JMP callbackasm1(SB) + MOVV $1189, R12 + JMP callbackasm1(SB) + MOVV $1190, R12 + JMP callbackasm1(SB) + MOVV $1191, R12 + JMP callbackasm1(SB) + MOVV $1192, R12 + JMP callbackasm1(SB) + MOVV $1193, R12 + JMP callbackasm1(SB) + MOVV $1194, R12 + JMP callbackasm1(SB) + MOVV $1195, R12 + JMP callbackasm1(SB) + MOVV $1196, R12 + JMP callbackasm1(SB) + MOVV $1197, R12 + JMP callbackasm1(SB) + MOVV $1198, R12 + JMP callbackasm1(SB) + MOVV $1199, R12 + JMP callbackasm1(SB) + MOVV $1200, R12 + JMP callbackasm1(SB) + MOVV $1201, R12 + JMP callbackasm1(SB) + MOVV $1202, R12 + JMP callbackasm1(SB) + MOVV $1203, R12 + JMP callbackasm1(SB) + MOVV $1204, R12 + JMP callbackasm1(SB) + MOVV $1205, R12 + JMP callbackasm1(SB) + MOVV $1206, R12 + JMP callbackasm1(SB) + MOVV $1207, R12 + JMP callbackasm1(SB) + MOVV $1208, R12 + JMP callbackasm1(SB) + MOVV $1209, R12 + JMP callbackasm1(SB) + MOVV $1210, R12 + JMP callbackasm1(SB) + MOVV $1211, R12 + JMP callbackasm1(SB) + MOVV $1212, R12 + JMP callbackasm1(SB) + MOVV $1213, R12 + JMP callbackasm1(SB) + MOVV $1214, R12 + JMP callbackasm1(SB) + MOVV $1215, R12 + JMP callbackasm1(SB) + MOVV $1216, R12 + JMP callbackasm1(SB) + MOVV $1217, R12 + JMP callbackasm1(SB) + MOVV $1218, R12 + JMP callbackasm1(SB) + MOVV $1219, R12 + JMP callbackasm1(SB) + MOVV $1220, R12 + JMP callbackasm1(SB) + MOVV $1221, R12 + JMP callbackasm1(SB) + MOVV $1222, R12 + JMP callbackasm1(SB) + MOVV $1223, R12 + JMP callbackasm1(SB) + MOVV $1224, R12 + JMP callbackasm1(SB) + MOVV $1225, R12 + JMP callbackasm1(SB) + MOVV $1226, R12 + JMP callbackasm1(SB) + MOVV $1227, R12 + JMP callbackasm1(SB) + MOVV $1228, R12 + JMP callbackasm1(SB) + MOVV $1229, R12 + JMP callbackasm1(SB) + MOVV $1230, R12 + JMP callbackasm1(SB) + MOVV $1231, R12 + JMP callbackasm1(SB) + MOVV $1232, R12 + JMP callbackasm1(SB) + MOVV $1233, R12 + JMP callbackasm1(SB) + MOVV $1234, R12 + JMP callbackasm1(SB) + MOVV $1235, R12 + JMP callbackasm1(SB) + MOVV $1236, R12 + JMP callbackasm1(SB) + MOVV $1237, R12 + JMP callbackasm1(SB) + MOVV $1238, R12 + JMP callbackasm1(SB) + MOVV $1239, R12 + JMP callbackasm1(SB) + MOVV $1240, R12 + JMP callbackasm1(SB) + MOVV $1241, R12 + JMP callbackasm1(SB) + MOVV $1242, R12 + JMP callbackasm1(SB) + MOVV $1243, R12 + JMP callbackasm1(SB) + MOVV $1244, R12 + JMP callbackasm1(SB) + MOVV $1245, R12 + JMP callbackasm1(SB) + MOVV $1246, R12 + JMP callbackasm1(SB) + MOVV $1247, R12 + JMP callbackasm1(SB) + MOVV $1248, R12 + JMP callbackasm1(SB) + MOVV $1249, R12 + JMP callbackasm1(SB) + MOVV $1250, R12 + JMP callbackasm1(SB) + MOVV $1251, R12 + JMP callbackasm1(SB) + MOVV $1252, R12 + JMP callbackasm1(SB) + MOVV $1253, R12 + JMP callbackasm1(SB) + MOVV $1254, R12 + JMP callbackasm1(SB) + MOVV $1255, R12 + JMP callbackasm1(SB) + MOVV $1256, R12 + JMP callbackasm1(SB) + MOVV $1257, R12 + JMP callbackasm1(SB) + MOVV $1258, R12 + JMP callbackasm1(SB) + MOVV $1259, R12 + JMP callbackasm1(SB) + MOVV $1260, R12 + JMP callbackasm1(SB) + MOVV $1261, R12 + JMP callbackasm1(SB) + MOVV $1262, R12 + JMP callbackasm1(SB) + MOVV $1263, R12 + JMP callbackasm1(SB) + MOVV $1264, R12 + JMP callbackasm1(SB) + MOVV $1265, R12 + JMP callbackasm1(SB) + MOVV $1266, R12 + JMP callbackasm1(SB) + MOVV $1267, R12 + JMP callbackasm1(SB) + MOVV $1268, R12 + JMP callbackasm1(SB) + MOVV $1269, R12 + JMP callbackasm1(SB) + MOVV $1270, R12 + JMP callbackasm1(SB) + MOVV $1271, R12 + JMP callbackasm1(SB) + MOVV $1272, R12 + JMP callbackasm1(SB) + MOVV $1273, R12 + JMP callbackasm1(SB) + MOVV $1274, R12 + JMP callbackasm1(SB) + MOVV $1275, R12 + JMP callbackasm1(SB) + MOVV $1276, R12 + JMP callbackasm1(SB) + MOVV $1277, R12 + JMP callbackasm1(SB) + MOVV $1278, R12 + JMP callbackasm1(SB) + MOVV $1279, R12 + JMP callbackasm1(SB) + MOVV $1280, R12 + JMP callbackasm1(SB) + MOVV $1281, R12 + JMP callbackasm1(SB) + MOVV $1282, R12 + JMP callbackasm1(SB) + MOVV $1283, R12 + JMP callbackasm1(SB) + MOVV $1284, R12 + JMP callbackasm1(SB) + MOVV $1285, R12 + JMP callbackasm1(SB) + MOVV $1286, R12 + JMP callbackasm1(SB) + MOVV $1287, R12 + JMP callbackasm1(SB) + MOVV $1288, R12 + JMP callbackasm1(SB) + MOVV $1289, R12 + JMP callbackasm1(SB) + MOVV $1290, R12 + JMP callbackasm1(SB) + MOVV $1291, R12 + JMP callbackasm1(SB) + MOVV $1292, R12 + JMP callbackasm1(SB) + MOVV $1293, R12 + JMP callbackasm1(SB) + MOVV $1294, R12 + JMP callbackasm1(SB) + MOVV $1295, R12 + JMP callbackasm1(SB) + MOVV $1296, R12 + JMP callbackasm1(SB) + MOVV $1297, R12 + JMP callbackasm1(SB) + MOVV $1298, R12 + JMP callbackasm1(SB) + MOVV $1299, R12 + JMP callbackasm1(SB) + MOVV $1300, R12 + JMP callbackasm1(SB) + MOVV $1301, R12 + JMP callbackasm1(SB) + MOVV $1302, R12 + JMP callbackasm1(SB) + MOVV $1303, R12 + JMP callbackasm1(SB) + MOVV $1304, R12 + JMP callbackasm1(SB) + MOVV $1305, R12 + JMP callbackasm1(SB) + MOVV $1306, R12 + JMP callbackasm1(SB) + MOVV $1307, R12 + JMP callbackasm1(SB) + MOVV $1308, R12 + JMP callbackasm1(SB) + MOVV $1309, R12 + JMP callbackasm1(SB) + MOVV $1310, R12 + JMP callbackasm1(SB) + MOVV $1311, R12 + JMP callbackasm1(SB) + MOVV $1312, R12 + JMP callbackasm1(SB) + MOVV $1313, R12 + JMP callbackasm1(SB) + MOVV $1314, R12 + JMP callbackasm1(SB) + MOVV $1315, R12 + JMP callbackasm1(SB) + MOVV $1316, R12 + JMP callbackasm1(SB) + MOVV $1317, R12 + JMP callbackasm1(SB) + MOVV $1318, R12 + JMP callbackasm1(SB) + MOVV $1319, R12 + JMP callbackasm1(SB) + MOVV $1320, R12 + JMP callbackasm1(SB) + MOVV $1321, R12 + JMP callbackasm1(SB) + MOVV $1322, R12 + JMP callbackasm1(SB) + MOVV $1323, R12 + JMP callbackasm1(SB) + MOVV $1324, R12 + JMP callbackasm1(SB) + MOVV $1325, R12 + JMP callbackasm1(SB) + MOVV $1326, R12 + JMP callbackasm1(SB) + MOVV $1327, R12 + JMP callbackasm1(SB) + MOVV $1328, R12 + JMP callbackasm1(SB) + MOVV $1329, R12 + JMP callbackasm1(SB) + MOVV $1330, R12 + JMP callbackasm1(SB) + MOVV $1331, R12 + JMP callbackasm1(SB) + MOVV $1332, R12 + JMP callbackasm1(SB) + MOVV $1333, R12 + JMP callbackasm1(SB) + MOVV $1334, R12 + JMP callbackasm1(SB) + MOVV $1335, R12 + JMP callbackasm1(SB) + MOVV $1336, R12 + JMP callbackasm1(SB) + MOVV $1337, R12 + JMP callbackasm1(SB) + MOVV $1338, R12 + JMP callbackasm1(SB) + MOVV $1339, R12 + JMP callbackasm1(SB) + MOVV $1340, R12 + JMP callbackasm1(SB) + MOVV $1341, R12 + JMP callbackasm1(SB) + MOVV $1342, R12 + JMP callbackasm1(SB) + MOVV $1343, R12 + JMP callbackasm1(SB) + MOVV $1344, R12 + JMP callbackasm1(SB) + MOVV $1345, R12 + JMP callbackasm1(SB) + MOVV $1346, R12 + JMP callbackasm1(SB) + MOVV $1347, R12 + JMP callbackasm1(SB) + MOVV $1348, R12 + JMP callbackasm1(SB) + MOVV $1349, R12 + JMP callbackasm1(SB) + MOVV $1350, R12 + JMP callbackasm1(SB) + MOVV $1351, R12 + JMP callbackasm1(SB) + MOVV $1352, R12 + JMP callbackasm1(SB) + MOVV $1353, R12 + JMP callbackasm1(SB) + MOVV $1354, R12 + JMP callbackasm1(SB) + MOVV $1355, R12 + JMP callbackasm1(SB) + MOVV $1356, R12 + JMP callbackasm1(SB) + MOVV $1357, R12 + JMP callbackasm1(SB) + MOVV $1358, R12 + JMP callbackasm1(SB) + MOVV $1359, R12 + JMP callbackasm1(SB) + MOVV $1360, R12 + JMP callbackasm1(SB) + MOVV $1361, R12 + JMP callbackasm1(SB) + MOVV $1362, R12 + JMP callbackasm1(SB) + MOVV $1363, R12 + JMP callbackasm1(SB) + MOVV $1364, R12 + JMP callbackasm1(SB) + MOVV $1365, R12 + JMP callbackasm1(SB) + MOVV $1366, R12 + JMP callbackasm1(SB) + MOVV $1367, R12 + JMP callbackasm1(SB) + MOVV $1368, R12 + JMP callbackasm1(SB) + MOVV $1369, R12 + JMP callbackasm1(SB) + MOVV $1370, R12 + JMP callbackasm1(SB) + MOVV $1371, R12 + JMP callbackasm1(SB) + MOVV $1372, R12 + JMP callbackasm1(SB) + MOVV $1373, R12 + JMP callbackasm1(SB) + MOVV $1374, R12 + JMP callbackasm1(SB) + MOVV $1375, R12 + JMP callbackasm1(SB) + MOVV $1376, R12 + JMP callbackasm1(SB) + MOVV $1377, R12 + JMP callbackasm1(SB) + MOVV $1378, R12 + JMP callbackasm1(SB) + MOVV $1379, R12 + JMP callbackasm1(SB) + MOVV $1380, R12 + JMP callbackasm1(SB) + MOVV $1381, R12 + JMP callbackasm1(SB) + MOVV $1382, R12 + JMP callbackasm1(SB) + MOVV $1383, R12 + JMP callbackasm1(SB) + MOVV $1384, R12 + JMP callbackasm1(SB) + MOVV $1385, R12 + JMP callbackasm1(SB) + MOVV $1386, R12 + JMP callbackasm1(SB) + MOVV $1387, R12 + JMP callbackasm1(SB) + MOVV $1388, R12 + JMP callbackasm1(SB) + MOVV $1389, R12 + JMP callbackasm1(SB) + MOVV $1390, R12 + JMP callbackasm1(SB) + MOVV $1391, R12 + JMP callbackasm1(SB) + MOVV $1392, R12 + JMP callbackasm1(SB) + MOVV $1393, R12 + JMP callbackasm1(SB) + MOVV $1394, R12 + JMP callbackasm1(SB) + MOVV $1395, R12 + JMP callbackasm1(SB) + MOVV $1396, R12 + JMP callbackasm1(SB) + MOVV $1397, R12 + JMP callbackasm1(SB) + MOVV $1398, R12 + JMP callbackasm1(SB) + MOVV $1399, R12 + JMP callbackasm1(SB) + MOVV $1400, R12 + JMP callbackasm1(SB) + MOVV $1401, R12 + JMP callbackasm1(SB) + MOVV $1402, R12 + JMP callbackasm1(SB) + MOVV $1403, R12 + JMP callbackasm1(SB) + MOVV $1404, R12 + JMP callbackasm1(SB) + MOVV $1405, R12 + JMP callbackasm1(SB) + MOVV $1406, R12 + JMP callbackasm1(SB) + MOVV $1407, R12 + JMP callbackasm1(SB) + MOVV $1408, R12 + JMP callbackasm1(SB) + MOVV $1409, R12 + JMP callbackasm1(SB) + MOVV $1410, R12 + JMP callbackasm1(SB) + MOVV $1411, R12 + JMP callbackasm1(SB) + MOVV $1412, R12 + JMP callbackasm1(SB) + MOVV $1413, R12 + JMP callbackasm1(SB) + MOVV $1414, R12 + JMP callbackasm1(SB) + MOVV $1415, R12 + JMP callbackasm1(SB) + MOVV $1416, R12 + JMP callbackasm1(SB) + MOVV $1417, R12 + JMP callbackasm1(SB) + MOVV $1418, R12 + JMP callbackasm1(SB) + MOVV $1419, R12 + JMP callbackasm1(SB) + MOVV $1420, R12 + JMP callbackasm1(SB) + MOVV $1421, R12 + JMP callbackasm1(SB) + MOVV $1422, R12 + JMP callbackasm1(SB) + MOVV $1423, R12 + JMP callbackasm1(SB) + MOVV $1424, R12 + JMP callbackasm1(SB) + MOVV $1425, R12 + JMP callbackasm1(SB) + MOVV $1426, R12 + JMP callbackasm1(SB) + MOVV $1427, R12 + JMP callbackasm1(SB) + MOVV $1428, R12 + JMP callbackasm1(SB) + MOVV $1429, R12 + JMP callbackasm1(SB) + MOVV $1430, R12 + JMP callbackasm1(SB) + MOVV $1431, R12 + JMP callbackasm1(SB) + MOVV $1432, R12 + JMP callbackasm1(SB) + MOVV $1433, R12 + JMP callbackasm1(SB) + MOVV $1434, R12 + JMP callbackasm1(SB) + MOVV $1435, R12 + JMP callbackasm1(SB) + MOVV $1436, R12 + JMP callbackasm1(SB) + MOVV $1437, R12 + JMP callbackasm1(SB) + MOVV $1438, R12 + JMP callbackasm1(SB) + MOVV $1439, R12 + JMP callbackasm1(SB) + MOVV $1440, R12 + JMP callbackasm1(SB) + MOVV $1441, R12 + JMP callbackasm1(SB) + MOVV $1442, R12 + JMP callbackasm1(SB) + MOVV $1443, R12 + JMP callbackasm1(SB) + MOVV $1444, R12 + JMP callbackasm1(SB) + MOVV $1445, R12 + JMP callbackasm1(SB) + MOVV $1446, R12 + JMP callbackasm1(SB) + MOVV $1447, R12 + JMP callbackasm1(SB) + MOVV $1448, R12 + JMP callbackasm1(SB) + MOVV $1449, R12 + JMP callbackasm1(SB) + MOVV $1450, R12 + JMP callbackasm1(SB) + MOVV $1451, R12 + JMP callbackasm1(SB) + MOVV $1452, R12 + JMP callbackasm1(SB) + MOVV $1453, R12 + JMP callbackasm1(SB) + MOVV $1454, R12 + JMP callbackasm1(SB) + MOVV $1455, R12 + JMP callbackasm1(SB) + MOVV $1456, R12 + JMP callbackasm1(SB) + MOVV $1457, R12 + JMP callbackasm1(SB) + MOVV $1458, R12 + JMP callbackasm1(SB) + MOVV $1459, R12 + JMP callbackasm1(SB) + MOVV $1460, R12 + JMP callbackasm1(SB) + MOVV $1461, R12 + JMP callbackasm1(SB) + MOVV $1462, R12 + JMP callbackasm1(SB) + MOVV $1463, R12 + JMP callbackasm1(SB) + MOVV $1464, R12 + JMP callbackasm1(SB) + MOVV $1465, R12 + JMP callbackasm1(SB) + MOVV $1466, R12 + JMP callbackasm1(SB) + MOVV $1467, R12 + JMP callbackasm1(SB) + MOVV $1468, R12 + JMP callbackasm1(SB) + MOVV $1469, R12 + JMP callbackasm1(SB) + MOVV $1470, R12 + JMP callbackasm1(SB) + MOVV $1471, R12 + JMP callbackasm1(SB) + MOVV $1472, R12 + JMP callbackasm1(SB) + MOVV $1473, R12 + JMP callbackasm1(SB) + MOVV $1474, R12 + JMP callbackasm1(SB) + MOVV $1475, R12 + JMP callbackasm1(SB) + MOVV $1476, R12 + JMP callbackasm1(SB) + MOVV $1477, R12 + JMP callbackasm1(SB) + MOVV $1478, R12 + JMP callbackasm1(SB) + MOVV $1479, R12 + JMP callbackasm1(SB) + MOVV $1480, R12 + JMP callbackasm1(SB) + MOVV $1481, R12 + JMP callbackasm1(SB) + MOVV $1482, R12 + JMP callbackasm1(SB) + MOVV $1483, R12 + JMP callbackasm1(SB) + MOVV $1484, R12 + JMP callbackasm1(SB) + MOVV $1485, R12 + JMP callbackasm1(SB) + MOVV $1486, R12 + JMP callbackasm1(SB) + MOVV $1487, R12 + JMP callbackasm1(SB) + MOVV $1488, R12 + JMP callbackasm1(SB) + MOVV $1489, R12 + JMP callbackasm1(SB) + MOVV $1490, R12 + JMP callbackasm1(SB) + MOVV $1491, R12 + JMP callbackasm1(SB) + MOVV $1492, R12 + JMP callbackasm1(SB) + MOVV $1493, R12 + JMP callbackasm1(SB) + MOVV $1494, R12 + JMP callbackasm1(SB) + MOVV $1495, R12 + JMP callbackasm1(SB) + MOVV $1496, R12 + JMP callbackasm1(SB) + MOVV $1497, R12 + JMP callbackasm1(SB) + MOVV $1498, R12 + JMP callbackasm1(SB) + MOVV $1499, R12 + JMP callbackasm1(SB) + MOVV $1500, R12 + JMP callbackasm1(SB) + MOVV $1501, R12 + JMP callbackasm1(SB) + MOVV $1502, R12 + JMP callbackasm1(SB) + MOVV $1503, R12 + JMP callbackasm1(SB) + MOVV $1504, R12 + JMP callbackasm1(SB) + MOVV $1505, R12 + JMP callbackasm1(SB) + MOVV $1506, R12 + JMP callbackasm1(SB) + MOVV $1507, R12 + JMP callbackasm1(SB) + MOVV $1508, R12 + JMP callbackasm1(SB) + MOVV $1509, R12 + JMP callbackasm1(SB) + MOVV $1510, R12 + JMP callbackasm1(SB) + MOVV $1511, R12 + JMP callbackasm1(SB) + MOVV $1512, R12 + JMP callbackasm1(SB) + MOVV $1513, R12 + JMP callbackasm1(SB) + MOVV $1514, R12 + JMP callbackasm1(SB) + MOVV $1515, R12 + JMP callbackasm1(SB) + MOVV $1516, R12 + JMP callbackasm1(SB) + MOVV $1517, R12 + JMP callbackasm1(SB) + MOVV $1518, R12 + JMP callbackasm1(SB) + MOVV $1519, R12 + JMP callbackasm1(SB) + MOVV $1520, R12 + JMP callbackasm1(SB) + MOVV $1521, R12 + JMP callbackasm1(SB) + MOVV $1522, R12 + JMP callbackasm1(SB) + MOVV $1523, R12 + JMP callbackasm1(SB) + MOVV $1524, R12 + JMP callbackasm1(SB) + MOVV $1525, R12 + JMP callbackasm1(SB) + MOVV $1526, R12 + JMP callbackasm1(SB) + MOVV $1527, R12 + JMP callbackasm1(SB) + MOVV $1528, R12 + JMP callbackasm1(SB) + MOVV $1529, R12 + JMP callbackasm1(SB) + MOVV $1530, R12 + JMP callbackasm1(SB) + MOVV $1531, R12 + JMP callbackasm1(SB) + MOVV $1532, R12 + JMP callbackasm1(SB) + MOVV $1533, R12 + JMP callbackasm1(SB) + MOVV $1534, R12 + JMP callbackasm1(SB) + MOVV $1535, R12 + JMP callbackasm1(SB) + MOVV $1536, R12 + JMP callbackasm1(SB) + MOVV $1537, R12 + JMP callbackasm1(SB) + MOVV $1538, R12 + JMP callbackasm1(SB) + MOVV $1539, R12 + JMP callbackasm1(SB) + MOVV $1540, R12 + JMP callbackasm1(SB) + MOVV $1541, R12 + JMP callbackasm1(SB) + MOVV $1542, R12 + JMP callbackasm1(SB) + MOVV $1543, R12 + JMP callbackasm1(SB) + MOVV $1544, R12 + JMP callbackasm1(SB) + MOVV $1545, R12 + JMP callbackasm1(SB) + MOVV $1546, R12 + JMP callbackasm1(SB) + MOVV $1547, R12 + JMP callbackasm1(SB) + MOVV $1548, R12 + JMP callbackasm1(SB) + MOVV $1549, R12 + JMP callbackasm1(SB) + MOVV $1550, R12 + JMP callbackasm1(SB) + MOVV $1551, R12 + JMP callbackasm1(SB) + MOVV $1552, R12 + JMP callbackasm1(SB) + MOVV $1553, R12 + JMP callbackasm1(SB) + MOVV $1554, R12 + JMP callbackasm1(SB) + MOVV $1555, R12 + JMP callbackasm1(SB) + MOVV $1556, R12 + JMP callbackasm1(SB) + MOVV $1557, R12 + JMP callbackasm1(SB) + MOVV $1558, R12 + JMP callbackasm1(SB) + MOVV $1559, R12 + JMP callbackasm1(SB) + MOVV $1560, R12 + JMP callbackasm1(SB) + MOVV $1561, R12 + JMP callbackasm1(SB) + MOVV $1562, R12 + JMP callbackasm1(SB) + MOVV $1563, R12 + JMP callbackasm1(SB) + MOVV $1564, R12 + JMP callbackasm1(SB) + MOVV $1565, R12 + JMP callbackasm1(SB) + MOVV $1566, R12 + JMP callbackasm1(SB) + MOVV $1567, R12 + JMP callbackasm1(SB) + MOVV $1568, R12 + JMP callbackasm1(SB) + MOVV $1569, R12 + JMP callbackasm1(SB) + MOVV $1570, R12 + JMP callbackasm1(SB) + MOVV $1571, R12 + JMP callbackasm1(SB) + MOVV $1572, R12 + JMP callbackasm1(SB) + MOVV $1573, R12 + JMP callbackasm1(SB) + MOVV $1574, R12 + JMP callbackasm1(SB) + MOVV $1575, R12 + JMP callbackasm1(SB) + MOVV $1576, R12 + JMP callbackasm1(SB) + MOVV $1577, R12 + JMP callbackasm1(SB) + MOVV $1578, R12 + JMP callbackasm1(SB) + MOVV $1579, R12 + JMP callbackasm1(SB) + MOVV $1580, R12 + JMP callbackasm1(SB) + MOVV $1581, R12 + JMP callbackasm1(SB) + MOVV $1582, R12 + JMP callbackasm1(SB) + MOVV $1583, R12 + JMP callbackasm1(SB) + MOVV $1584, R12 + JMP callbackasm1(SB) + MOVV $1585, R12 + JMP callbackasm1(SB) + MOVV $1586, R12 + JMP callbackasm1(SB) + MOVV $1587, R12 + JMP callbackasm1(SB) + MOVV $1588, R12 + JMP callbackasm1(SB) + MOVV $1589, R12 + JMP callbackasm1(SB) + MOVV $1590, R12 + JMP callbackasm1(SB) + MOVV $1591, R12 + JMP callbackasm1(SB) + MOVV $1592, R12 + JMP callbackasm1(SB) + MOVV $1593, R12 + JMP callbackasm1(SB) + MOVV $1594, R12 + JMP callbackasm1(SB) + MOVV $1595, R12 + JMP callbackasm1(SB) + MOVV $1596, R12 + JMP callbackasm1(SB) + MOVV $1597, R12 + JMP callbackasm1(SB) + MOVV $1598, R12 + JMP callbackasm1(SB) + MOVV $1599, R12 + JMP callbackasm1(SB) + MOVV $1600, R12 + JMP callbackasm1(SB) + MOVV $1601, R12 + JMP callbackasm1(SB) + MOVV $1602, R12 + JMP callbackasm1(SB) + MOVV $1603, R12 + JMP callbackasm1(SB) + MOVV $1604, R12 + JMP callbackasm1(SB) + MOVV $1605, R12 + JMP callbackasm1(SB) + MOVV $1606, R12 + JMP callbackasm1(SB) + MOVV $1607, R12 + JMP callbackasm1(SB) + MOVV $1608, R12 + JMP callbackasm1(SB) + MOVV $1609, R12 + JMP callbackasm1(SB) + MOVV $1610, R12 + JMP callbackasm1(SB) + MOVV $1611, R12 + JMP callbackasm1(SB) + MOVV $1612, R12 + JMP callbackasm1(SB) + MOVV $1613, R12 + JMP callbackasm1(SB) + MOVV $1614, R12 + JMP callbackasm1(SB) + MOVV $1615, R12 + JMP callbackasm1(SB) + MOVV $1616, R12 + JMP callbackasm1(SB) + MOVV $1617, R12 + JMP callbackasm1(SB) + MOVV $1618, R12 + JMP callbackasm1(SB) + MOVV $1619, R12 + JMP callbackasm1(SB) + MOVV $1620, R12 + JMP callbackasm1(SB) + MOVV $1621, R12 + JMP callbackasm1(SB) + MOVV $1622, R12 + JMP callbackasm1(SB) + MOVV $1623, R12 + JMP callbackasm1(SB) + MOVV $1624, R12 + JMP callbackasm1(SB) + MOVV $1625, R12 + JMP callbackasm1(SB) + MOVV $1626, R12 + JMP callbackasm1(SB) + MOVV $1627, R12 + JMP callbackasm1(SB) + MOVV $1628, R12 + JMP callbackasm1(SB) + MOVV $1629, R12 + JMP callbackasm1(SB) + MOVV $1630, R12 + JMP callbackasm1(SB) + MOVV $1631, R12 + JMP callbackasm1(SB) + MOVV $1632, R12 + JMP callbackasm1(SB) + MOVV $1633, R12 + JMP callbackasm1(SB) + MOVV $1634, R12 + JMP callbackasm1(SB) + MOVV $1635, R12 + JMP callbackasm1(SB) + MOVV $1636, R12 + JMP callbackasm1(SB) + MOVV $1637, R12 + JMP callbackasm1(SB) + MOVV $1638, R12 + JMP callbackasm1(SB) + MOVV $1639, R12 + JMP callbackasm1(SB) + MOVV $1640, R12 + JMP callbackasm1(SB) + MOVV $1641, R12 + JMP callbackasm1(SB) + MOVV $1642, R12 + JMP callbackasm1(SB) + MOVV $1643, R12 + JMP callbackasm1(SB) + MOVV $1644, R12 + JMP callbackasm1(SB) + MOVV $1645, R12 + JMP callbackasm1(SB) + MOVV $1646, R12 + JMP callbackasm1(SB) + MOVV $1647, R12 + JMP callbackasm1(SB) + MOVV $1648, R12 + JMP callbackasm1(SB) + MOVV $1649, R12 + JMP callbackasm1(SB) + MOVV $1650, R12 + JMP callbackasm1(SB) + MOVV $1651, R12 + JMP callbackasm1(SB) + MOVV $1652, R12 + JMP callbackasm1(SB) + MOVV $1653, R12 + JMP callbackasm1(SB) + MOVV $1654, R12 + JMP callbackasm1(SB) + MOVV $1655, R12 + JMP callbackasm1(SB) + MOVV $1656, R12 + JMP callbackasm1(SB) + MOVV $1657, R12 + JMP callbackasm1(SB) + MOVV $1658, R12 + JMP callbackasm1(SB) + MOVV $1659, R12 + JMP callbackasm1(SB) + MOVV $1660, R12 + JMP callbackasm1(SB) + MOVV $1661, R12 + JMP callbackasm1(SB) + MOVV $1662, R12 + JMP callbackasm1(SB) + MOVV $1663, R12 + JMP callbackasm1(SB) + MOVV $1664, R12 + JMP callbackasm1(SB) + MOVV $1665, R12 + JMP callbackasm1(SB) + MOVV $1666, R12 + JMP callbackasm1(SB) + MOVV $1667, R12 + JMP callbackasm1(SB) + MOVV $1668, R12 + JMP callbackasm1(SB) + MOVV $1669, R12 + JMP callbackasm1(SB) + MOVV $1670, R12 + JMP callbackasm1(SB) + MOVV $1671, R12 + JMP callbackasm1(SB) + MOVV $1672, R12 + JMP callbackasm1(SB) + MOVV $1673, R12 + JMP callbackasm1(SB) + MOVV $1674, R12 + JMP callbackasm1(SB) + MOVV $1675, R12 + JMP callbackasm1(SB) + MOVV $1676, R12 + JMP callbackasm1(SB) + MOVV $1677, R12 + JMP callbackasm1(SB) + MOVV $1678, R12 + JMP callbackasm1(SB) + MOVV $1679, R12 + JMP callbackasm1(SB) + MOVV $1680, R12 + JMP callbackasm1(SB) + MOVV $1681, R12 + JMP callbackasm1(SB) + MOVV $1682, R12 + JMP callbackasm1(SB) + MOVV $1683, R12 + JMP callbackasm1(SB) + MOVV $1684, R12 + JMP callbackasm1(SB) + MOVV $1685, R12 + JMP callbackasm1(SB) + MOVV $1686, R12 + JMP callbackasm1(SB) + MOVV $1687, R12 + JMP callbackasm1(SB) + MOVV $1688, R12 + JMP callbackasm1(SB) + MOVV $1689, R12 + JMP callbackasm1(SB) + MOVV $1690, R12 + JMP callbackasm1(SB) + MOVV $1691, R12 + JMP callbackasm1(SB) + MOVV $1692, R12 + JMP callbackasm1(SB) + MOVV $1693, R12 + JMP callbackasm1(SB) + MOVV $1694, R12 + JMP callbackasm1(SB) + MOVV $1695, R12 + JMP callbackasm1(SB) + MOVV $1696, R12 + JMP callbackasm1(SB) + MOVV $1697, R12 + JMP callbackasm1(SB) + MOVV $1698, R12 + JMP callbackasm1(SB) + MOVV $1699, R12 + JMP callbackasm1(SB) + MOVV $1700, R12 + JMP callbackasm1(SB) + MOVV $1701, R12 + JMP callbackasm1(SB) + MOVV $1702, R12 + JMP callbackasm1(SB) + MOVV $1703, R12 + JMP callbackasm1(SB) + MOVV $1704, R12 + JMP callbackasm1(SB) + MOVV $1705, R12 + JMP callbackasm1(SB) + MOVV $1706, R12 + JMP callbackasm1(SB) + MOVV $1707, R12 + JMP callbackasm1(SB) + MOVV $1708, R12 + JMP callbackasm1(SB) + MOVV $1709, R12 + JMP callbackasm1(SB) + MOVV $1710, R12 + JMP callbackasm1(SB) + MOVV $1711, R12 + JMP callbackasm1(SB) + MOVV $1712, R12 + JMP callbackasm1(SB) + MOVV $1713, R12 + JMP callbackasm1(SB) + MOVV $1714, R12 + JMP callbackasm1(SB) + MOVV $1715, R12 + JMP callbackasm1(SB) + MOVV $1716, R12 + JMP callbackasm1(SB) + MOVV $1717, R12 + JMP callbackasm1(SB) + MOVV $1718, R12 + JMP callbackasm1(SB) + MOVV $1719, R12 + JMP callbackasm1(SB) + MOVV $1720, R12 + JMP callbackasm1(SB) + MOVV $1721, R12 + JMP callbackasm1(SB) + MOVV $1722, R12 + JMP callbackasm1(SB) + MOVV $1723, R12 + JMP callbackasm1(SB) + MOVV $1724, R12 + JMP callbackasm1(SB) + MOVV $1725, R12 + JMP callbackasm1(SB) + MOVV $1726, R12 + JMP callbackasm1(SB) + MOVV $1727, R12 + JMP callbackasm1(SB) + MOVV $1728, R12 + JMP callbackasm1(SB) + MOVV $1729, R12 + JMP callbackasm1(SB) + MOVV $1730, R12 + JMP callbackasm1(SB) + MOVV $1731, R12 + JMP callbackasm1(SB) + MOVV $1732, R12 + JMP callbackasm1(SB) + MOVV $1733, R12 + JMP callbackasm1(SB) + MOVV $1734, R12 + JMP callbackasm1(SB) + MOVV $1735, R12 + JMP callbackasm1(SB) + MOVV $1736, R12 + JMP callbackasm1(SB) + MOVV $1737, R12 + JMP callbackasm1(SB) + MOVV $1738, R12 + JMP callbackasm1(SB) + MOVV $1739, R12 + JMP callbackasm1(SB) + MOVV $1740, R12 + JMP callbackasm1(SB) + MOVV $1741, R12 + JMP callbackasm1(SB) + MOVV $1742, R12 + JMP callbackasm1(SB) + MOVV $1743, R12 + JMP callbackasm1(SB) + MOVV $1744, R12 + JMP callbackasm1(SB) + MOVV $1745, R12 + JMP callbackasm1(SB) + MOVV $1746, R12 + JMP callbackasm1(SB) + MOVV $1747, R12 + JMP callbackasm1(SB) + MOVV $1748, R12 + JMP callbackasm1(SB) + MOVV $1749, R12 + JMP callbackasm1(SB) + MOVV $1750, R12 + JMP callbackasm1(SB) + MOVV $1751, R12 + JMP callbackasm1(SB) + MOVV $1752, R12 + JMP callbackasm1(SB) + MOVV $1753, R12 + JMP callbackasm1(SB) + MOVV $1754, R12 + JMP callbackasm1(SB) + MOVV $1755, R12 + JMP callbackasm1(SB) + MOVV $1756, R12 + JMP callbackasm1(SB) + MOVV $1757, R12 + JMP callbackasm1(SB) + MOVV $1758, R12 + JMP callbackasm1(SB) + MOVV $1759, R12 + JMP callbackasm1(SB) + MOVV $1760, R12 + JMP callbackasm1(SB) + MOVV $1761, R12 + JMP callbackasm1(SB) + MOVV $1762, R12 + JMP callbackasm1(SB) + MOVV $1763, R12 + JMP callbackasm1(SB) + MOVV $1764, R12 + JMP callbackasm1(SB) + MOVV $1765, R12 + JMP callbackasm1(SB) + MOVV $1766, R12 + JMP callbackasm1(SB) + MOVV $1767, R12 + JMP callbackasm1(SB) + MOVV $1768, R12 + JMP callbackasm1(SB) + MOVV $1769, R12 + JMP callbackasm1(SB) + MOVV $1770, R12 + JMP callbackasm1(SB) + MOVV $1771, R12 + JMP callbackasm1(SB) + MOVV $1772, R12 + JMP callbackasm1(SB) + MOVV $1773, R12 + JMP callbackasm1(SB) + MOVV $1774, R12 + JMP callbackasm1(SB) + MOVV $1775, R12 + JMP callbackasm1(SB) + MOVV $1776, R12 + JMP callbackasm1(SB) + MOVV $1777, R12 + JMP callbackasm1(SB) + MOVV $1778, R12 + JMP callbackasm1(SB) + MOVV $1779, R12 + JMP callbackasm1(SB) + MOVV $1780, R12 + JMP callbackasm1(SB) + MOVV $1781, R12 + JMP callbackasm1(SB) + MOVV $1782, R12 + JMP callbackasm1(SB) + MOVV $1783, R12 + JMP callbackasm1(SB) + MOVV $1784, R12 + JMP callbackasm1(SB) + MOVV $1785, R12 + JMP callbackasm1(SB) + MOVV $1786, R12 + JMP callbackasm1(SB) + MOVV $1787, R12 + JMP callbackasm1(SB) + MOVV $1788, R12 + JMP callbackasm1(SB) + MOVV $1789, R12 + JMP callbackasm1(SB) + MOVV $1790, R12 + JMP callbackasm1(SB) + MOVV $1791, R12 + JMP callbackasm1(SB) + MOVV $1792, R12 + JMP callbackasm1(SB) + MOVV $1793, R12 + JMP callbackasm1(SB) + MOVV $1794, R12 + JMP callbackasm1(SB) + MOVV $1795, R12 + JMP callbackasm1(SB) + MOVV $1796, R12 + JMP callbackasm1(SB) + MOVV $1797, R12 + JMP callbackasm1(SB) + MOVV $1798, R12 + JMP callbackasm1(SB) + MOVV $1799, R12 + JMP callbackasm1(SB) + MOVV $1800, R12 + JMP callbackasm1(SB) + MOVV $1801, R12 + JMP callbackasm1(SB) + MOVV $1802, R12 + JMP callbackasm1(SB) + MOVV $1803, R12 + JMP callbackasm1(SB) + MOVV $1804, R12 + JMP callbackasm1(SB) + MOVV $1805, R12 + JMP callbackasm1(SB) + MOVV $1806, R12 + JMP callbackasm1(SB) + MOVV $1807, R12 + JMP callbackasm1(SB) + MOVV $1808, R12 + JMP callbackasm1(SB) + MOVV $1809, R12 + JMP callbackasm1(SB) + MOVV $1810, R12 + JMP callbackasm1(SB) + MOVV $1811, R12 + JMP callbackasm1(SB) + MOVV $1812, R12 + JMP callbackasm1(SB) + MOVV $1813, R12 + JMP callbackasm1(SB) + MOVV $1814, R12 + JMP callbackasm1(SB) + MOVV $1815, R12 + JMP callbackasm1(SB) + MOVV $1816, R12 + JMP callbackasm1(SB) + MOVV $1817, R12 + JMP callbackasm1(SB) + MOVV $1818, R12 + JMP callbackasm1(SB) + MOVV $1819, R12 + JMP callbackasm1(SB) + MOVV $1820, R12 + JMP callbackasm1(SB) + MOVV $1821, R12 + JMP callbackasm1(SB) + MOVV $1822, R12 + JMP callbackasm1(SB) + MOVV $1823, R12 + JMP callbackasm1(SB) + MOVV $1824, R12 + JMP callbackasm1(SB) + MOVV $1825, R12 + JMP callbackasm1(SB) + MOVV $1826, R12 + JMP callbackasm1(SB) + MOVV $1827, R12 + JMP callbackasm1(SB) + MOVV $1828, R12 + JMP callbackasm1(SB) + MOVV $1829, R12 + JMP callbackasm1(SB) + MOVV $1830, R12 + JMP callbackasm1(SB) + MOVV $1831, R12 + JMP callbackasm1(SB) + MOVV $1832, R12 + JMP callbackasm1(SB) + MOVV $1833, R12 + JMP callbackasm1(SB) + MOVV $1834, R12 + JMP callbackasm1(SB) + MOVV $1835, R12 + JMP callbackasm1(SB) + MOVV $1836, R12 + JMP callbackasm1(SB) + MOVV $1837, R12 + JMP callbackasm1(SB) + MOVV $1838, R12 + JMP callbackasm1(SB) + MOVV $1839, R12 + JMP callbackasm1(SB) + MOVV $1840, R12 + JMP callbackasm1(SB) + MOVV $1841, R12 + JMP callbackasm1(SB) + MOVV $1842, R12 + JMP callbackasm1(SB) + MOVV $1843, R12 + JMP callbackasm1(SB) + MOVV $1844, R12 + JMP callbackasm1(SB) + MOVV $1845, R12 + JMP callbackasm1(SB) + MOVV $1846, R12 + JMP callbackasm1(SB) + MOVV $1847, R12 + JMP callbackasm1(SB) + MOVV $1848, R12 + JMP callbackasm1(SB) + MOVV $1849, R12 + JMP callbackasm1(SB) + MOVV $1850, R12 + JMP callbackasm1(SB) + MOVV $1851, R12 + JMP callbackasm1(SB) + MOVV $1852, R12 + JMP callbackasm1(SB) + MOVV $1853, R12 + JMP callbackasm1(SB) + MOVV $1854, R12 + JMP callbackasm1(SB) + MOVV $1855, R12 + JMP callbackasm1(SB) + MOVV $1856, R12 + JMP callbackasm1(SB) + MOVV $1857, R12 + JMP callbackasm1(SB) + MOVV $1858, R12 + JMP callbackasm1(SB) + MOVV $1859, R12 + JMP callbackasm1(SB) + MOVV $1860, R12 + JMP callbackasm1(SB) + MOVV $1861, R12 + JMP callbackasm1(SB) + MOVV $1862, R12 + JMP callbackasm1(SB) + MOVV $1863, R12 + JMP callbackasm1(SB) + MOVV $1864, R12 + JMP callbackasm1(SB) + MOVV $1865, R12 + JMP callbackasm1(SB) + MOVV $1866, R12 + JMP callbackasm1(SB) + MOVV $1867, R12 + JMP callbackasm1(SB) + MOVV $1868, R12 + JMP callbackasm1(SB) + MOVV $1869, R12 + JMP callbackasm1(SB) + MOVV $1870, R12 + JMP callbackasm1(SB) + MOVV $1871, R12 + JMP callbackasm1(SB) + MOVV $1872, R12 + JMP callbackasm1(SB) + MOVV $1873, R12 + JMP callbackasm1(SB) + MOVV $1874, R12 + JMP callbackasm1(SB) + MOVV $1875, R12 + JMP callbackasm1(SB) + MOVV $1876, R12 + JMP callbackasm1(SB) + MOVV $1877, R12 + JMP callbackasm1(SB) + MOVV $1878, R12 + JMP callbackasm1(SB) + MOVV $1879, R12 + JMP callbackasm1(SB) + MOVV $1880, R12 + JMP callbackasm1(SB) + MOVV $1881, R12 + JMP callbackasm1(SB) + MOVV $1882, R12 + JMP callbackasm1(SB) + MOVV $1883, R12 + JMP callbackasm1(SB) + MOVV $1884, R12 + JMP callbackasm1(SB) + MOVV $1885, R12 + JMP callbackasm1(SB) + MOVV $1886, R12 + JMP callbackasm1(SB) + MOVV $1887, R12 + JMP callbackasm1(SB) + MOVV $1888, R12 + JMP callbackasm1(SB) + MOVV $1889, R12 + JMP callbackasm1(SB) + MOVV $1890, R12 + JMP callbackasm1(SB) + MOVV $1891, R12 + JMP callbackasm1(SB) + MOVV $1892, R12 + JMP callbackasm1(SB) + MOVV $1893, R12 + JMP callbackasm1(SB) + MOVV $1894, R12 + JMP callbackasm1(SB) + MOVV $1895, R12 + JMP callbackasm1(SB) + MOVV $1896, R12 + JMP callbackasm1(SB) + MOVV $1897, R12 + JMP callbackasm1(SB) + MOVV $1898, R12 + JMP callbackasm1(SB) + MOVV $1899, R12 + JMP callbackasm1(SB) + MOVV $1900, R12 + JMP callbackasm1(SB) + MOVV $1901, R12 + JMP callbackasm1(SB) + MOVV $1902, R12 + JMP callbackasm1(SB) + MOVV $1903, R12 + JMP callbackasm1(SB) + MOVV $1904, R12 + JMP callbackasm1(SB) + MOVV $1905, R12 + JMP callbackasm1(SB) + MOVV $1906, R12 + JMP callbackasm1(SB) + MOVV $1907, R12 + JMP callbackasm1(SB) + MOVV $1908, R12 + JMP callbackasm1(SB) + MOVV $1909, R12 + JMP callbackasm1(SB) + MOVV $1910, R12 + JMP callbackasm1(SB) + MOVV $1911, R12 + JMP callbackasm1(SB) + MOVV $1912, R12 + JMP callbackasm1(SB) + MOVV $1913, R12 + JMP callbackasm1(SB) + MOVV $1914, R12 + JMP callbackasm1(SB) + MOVV $1915, R12 + JMP callbackasm1(SB) + MOVV $1916, R12 + JMP callbackasm1(SB) + MOVV $1917, R12 + JMP callbackasm1(SB) + MOVV $1918, R12 + JMP callbackasm1(SB) + MOVV $1919, R12 + JMP callbackasm1(SB) + MOVV $1920, R12 + JMP callbackasm1(SB) + MOVV $1921, R12 + JMP callbackasm1(SB) + MOVV $1922, R12 + JMP callbackasm1(SB) + MOVV $1923, R12 + JMP callbackasm1(SB) + MOVV $1924, R12 + JMP callbackasm1(SB) + MOVV $1925, R12 + JMP callbackasm1(SB) + MOVV $1926, R12 + JMP callbackasm1(SB) + MOVV $1927, R12 + JMP callbackasm1(SB) + MOVV $1928, R12 + JMP callbackasm1(SB) + MOVV $1929, R12 + JMP callbackasm1(SB) + MOVV $1930, R12 + JMP callbackasm1(SB) + MOVV $1931, R12 + JMP callbackasm1(SB) + MOVV $1932, R12 + JMP callbackasm1(SB) + MOVV $1933, R12 + JMP callbackasm1(SB) + MOVV $1934, R12 + JMP callbackasm1(SB) + MOVV $1935, R12 + JMP callbackasm1(SB) + MOVV $1936, R12 + JMP callbackasm1(SB) + MOVV $1937, R12 + JMP callbackasm1(SB) + MOVV $1938, R12 + JMP callbackasm1(SB) + MOVV $1939, R12 + JMP callbackasm1(SB) + MOVV $1940, R12 + JMP callbackasm1(SB) + MOVV $1941, R12 + JMP callbackasm1(SB) + MOVV $1942, R12 + JMP callbackasm1(SB) + MOVV $1943, R12 + JMP callbackasm1(SB) + MOVV $1944, R12 + JMP callbackasm1(SB) + MOVV $1945, R12 + JMP callbackasm1(SB) + MOVV $1946, R12 + JMP callbackasm1(SB) + MOVV $1947, R12 + JMP callbackasm1(SB) + MOVV $1948, R12 + JMP callbackasm1(SB) + MOVV $1949, R12 + JMP callbackasm1(SB) + MOVV $1950, R12 + JMP callbackasm1(SB) + MOVV $1951, R12 + JMP callbackasm1(SB) + MOVV $1952, R12 + JMP callbackasm1(SB) + MOVV $1953, R12 + JMP callbackasm1(SB) + MOVV $1954, R12 + JMP callbackasm1(SB) + MOVV $1955, R12 + JMP callbackasm1(SB) + MOVV $1956, R12 + JMP callbackasm1(SB) + MOVV $1957, R12 + JMP callbackasm1(SB) + MOVV $1958, R12 + JMP callbackasm1(SB) + MOVV $1959, R12 + JMP callbackasm1(SB) + MOVV $1960, R12 + JMP callbackasm1(SB) + MOVV $1961, R12 + JMP callbackasm1(SB) + MOVV $1962, R12 + JMP callbackasm1(SB) + MOVV $1963, R12 + JMP callbackasm1(SB) + MOVV $1964, R12 + JMP callbackasm1(SB) + MOVV $1965, R12 + JMP callbackasm1(SB) + MOVV $1966, R12 + JMP callbackasm1(SB) + MOVV $1967, R12 + JMP callbackasm1(SB) + MOVV $1968, R12 + JMP callbackasm1(SB) + MOVV $1969, R12 + JMP callbackasm1(SB) + MOVV $1970, R12 + JMP callbackasm1(SB) + MOVV $1971, R12 + JMP callbackasm1(SB) + MOVV $1972, R12 + JMP callbackasm1(SB) + MOVV $1973, R12 + JMP callbackasm1(SB) + MOVV $1974, R12 + JMP callbackasm1(SB) + MOVV $1975, R12 + JMP callbackasm1(SB) + MOVV $1976, R12 + JMP callbackasm1(SB) + MOVV $1977, R12 + JMP callbackasm1(SB) + MOVV $1978, R12 + JMP callbackasm1(SB) + MOVV $1979, R12 + JMP callbackasm1(SB) + MOVV $1980, R12 + JMP callbackasm1(SB) + MOVV $1981, R12 + JMP callbackasm1(SB) + MOVV $1982, R12 + JMP callbackasm1(SB) + MOVV $1983, R12 + JMP callbackasm1(SB) + MOVV $1984, R12 + JMP callbackasm1(SB) + MOVV $1985, R12 + JMP callbackasm1(SB) + MOVV $1986, R12 + JMP callbackasm1(SB) + MOVV $1987, R12 + JMP callbackasm1(SB) + MOVV $1988, R12 + JMP callbackasm1(SB) + MOVV $1989, R12 + JMP callbackasm1(SB) + MOVV $1990, R12 + JMP callbackasm1(SB) + MOVV $1991, R12 + JMP callbackasm1(SB) + MOVV $1992, R12 + JMP callbackasm1(SB) + MOVV $1993, R12 + JMP callbackasm1(SB) + MOVV $1994, R12 + JMP callbackasm1(SB) + MOVV $1995, R12 + JMP callbackasm1(SB) + MOVV $1996, R12 + JMP callbackasm1(SB) + MOVV $1997, R12 + JMP callbackasm1(SB) + MOVV $1998, R12 + JMP callbackasm1(SB) + MOVV $1999, R12 + JMP callbackasm1(SB) diff --git a/vendor/github.com/pmezard/go-difflib/LICENSE b/vendor/github.com/pmezard/go-difflib/LICENSE deleted file mode 100644 index c67dad61..00000000 --- a/vendor/github.com/pmezard/go-difflib/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2013, Patrick Mezard -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - The names of its contributors may not be used to endorse or promote -products derived from this software without specific prior written -permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/pmezard/go-difflib/difflib/difflib.go b/vendor/github.com/pmezard/go-difflib/difflib/difflib.go deleted file mode 100644 index 003e99fa..00000000 --- a/vendor/github.com/pmezard/go-difflib/difflib/difflib.go +++ /dev/null @@ -1,772 +0,0 @@ -// Package difflib is a partial port of Python difflib module. -// -// It provides tools to compare sequences of strings and generate textual diffs. -// -// The following class and functions have been ported: -// -// - SequenceMatcher -// -// - unified_diff -// -// - context_diff -// -// Getting unified diffs was the main goal of the port. Keep in mind this code -// is mostly suitable to output text differences in a human friendly way, there -// are no guarantees generated diffs are consumable by patch(1). -package difflib - -import ( - "bufio" - "bytes" - "fmt" - "io" - "strings" -) - -func min(a, b int) int { - if a < b { - return a - } - return b -} - -func max(a, b int) int { - if a > b { - return a - } - return b -} - -func calculateRatio(matches, length int) float64 { - if length > 0 { - return 2.0 * float64(matches) / float64(length) - } - return 1.0 -} - -type Match struct { - A int - B int - Size int -} - -type OpCode struct { - Tag byte - I1 int - I2 int - J1 int - J2 int -} - -// SequenceMatcher compares sequence of strings. The basic -// algorithm predates, and is a little fancier than, an algorithm -// published in the late 1980's by Ratcliff and Obershelp under the -// hyperbolic name "gestalt pattern matching". The basic idea is to find -// the longest contiguous matching subsequence that contains no "junk" -// elements (R-O doesn't address junk). The same idea is then applied -// recursively to the pieces of the sequences to the left and to the right -// of the matching subsequence. This does not yield minimal edit -// sequences, but does tend to yield matches that "look right" to people. -// -// SequenceMatcher tries to compute a "human-friendly diff" between two -// sequences. Unlike e.g. UNIX(tm) diff, the fundamental notion is the -// longest *contiguous* & junk-free matching subsequence. That's what -// catches peoples' eyes. The Windows(tm) windiff has another interesting -// notion, pairing up elements that appear uniquely in each sequence. -// That, and the method here, appear to yield more intuitive difference -// reports than does diff. This method appears to be the least vulnerable -// to synching up on blocks of "junk lines", though (like blank lines in -// ordinary text files, or maybe "

" lines in HTML files). That may be -// because this is the only method of the 3 that has a *concept* of -// "junk" . -// -// Timing: Basic R-O is cubic time worst case and quadratic time expected -// case. SequenceMatcher is quadratic time for the worst case and has -// expected-case behavior dependent in a complicated way on how many -// elements the sequences have in common; best case time is linear. -type SequenceMatcher struct { - a []string - b []string - b2j map[string][]int - IsJunk func(string) bool - autoJunk bool - bJunk map[string]struct{} - matchingBlocks []Match - fullBCount map[string]int - bPopular map[string]struct{} - opCodes []OpCode -} - -func NewMatcher(a, b []string) *SequenceMatcher { - m := SequenceMatcher{autoJunk: true} - m.SetSeqs(a, b) - return &m -} - -func NewMatcherWithJunk(a, b []string, autoJunk bool, - isJunk func(string) bool) *SequenceMatcher { - - m := SequenceMatcher{IsJunk: isJunk, autoJunk: autoJunk} - m.SetSeqs(a, b) - return &m -} - -// Set two sequences to be compared. -func (m *SequenceMatcher) SetSeqs(a, b []string) { - m.SetSeq1(a) - m.SetSeq2(b) -} - -// Set the first sequence to be compared. The second sequence to be compared is -// not changed. -// -// SequenceMatcher computes and caches detailed information about the second -// sequence, so if you want to compare one sequence S against many sequences, -// use .SetSeq2(s) once and call .SetSeq1(x) repeatedly for each of the other -// sequences. -// -// See also SetSeqs() and SetSeq2(). -func (m *SequenceMatcher) SetSeq1(a []string) { - if &a == &m.a { - return - } - m.a = a - m.matchingBlocks = nil - m.opCodes = nil -} - -// Set the second sequence to be compared. The first sequence to be compared is -// not changed. -func (m *SequenceMatcher) SetSeq2(b []string) { - if &b == &m.b { - return - } - m.b = b - m.matchingBlocks = nil - m.opCodes = nil - m.fullBCount = nil - m.chainB() -} - -func (m *SequenceMatcher) chainB() { - // Populate line -> index mapping - b2j := map[string][]int{} - for i, s := range m.b { - indices := b2j[s] - indices = append(indices, i) - b2j[s] = indices - } - - // Purge junk elements - m.bJunk = map[string]struct{}{} - if m.IsJunk != nil { - junk := m.bJunk - for s, _ := range b2j { - if m.IsJunk(s) { - junk[s] = struct{}{} - } - } - for s, _ := range junk { - delete(b2j, s) - } - } - - // Purge remaining popular elements - popular := map[string]struct{}{} - n := len(m.b) - if m.autoJunk && n >= 200 { - ntest := n/100 + 1 - for s, indices := range b2j { - if len(indices) > ntest { - popular[s] = struct{}{} - } - } - for s, _ := range popular { - delete(b2j, s) - } - } - m.bPopular = popular - m.b2j = b2j -} - -func (m *SequenceMatcher) isBJunk(s string) bool { - _, ok := m.bJunk[s] - return ok -} - -// Find longest matching block in a[alo:ahi] and b[blo:bhi]. -// -// If IsJunk is not defined: -// -// Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where -// alo <= i <= i+k <= ahi -// blo <= j <= j+k <= bhi -// and for all (i',j',k') meeting those conditions, -// k >= k' -// i <= i' -// and if i == i', j <= j' -// -// In other words, of all maximal matching blocks, return one that -// starts earliest in a, and of all those maximal matching blocks that -// start earliest in a, return the one that starts earliest in b. -// -// If IsJunk is defined, first the longest matching block is -// determined as above, but with the additional restriction that no -// junk element appears in the block. Then that block is extended as -// far as possible by matching (only) junk elements on both sides. So -// the resulting block never matches on junk except as identical junk -// happens to be adjacent to an "interesting" match. -// -// If no blocks match, return (alo, blo, 0). -func (m *SequenceMatcher) findLongestMatch(alo, ahi, blo, bhi int) Match { - // CAUTION: stripping common prefix or suffix would be incorrect. - // E.g., - // ab - // acab - // Longest matching block is "ab", but if common prefix is - // stripped, it's "a" (tied with "b"). UNIX(tm) diff does so - // strip, so ends up claiming that ab is changed to acab by - // inserting "ca" in the middle. That's minimal but unintuitive: - // "it's obvious" that someone inserted "ac" at the front. - // Windiff ends up at the same place as diff, but by pairing up - // the unique 'b's and then matching the first two 'a's. - besti, bestj, bestsize := alo, blo, 0 - - // find longest junk-free match - // during an iteration of the loop, j2len[j] = length of longest - // junk-free match ending with a[i-1] and b[j] - j2len := map[int]int{} - for i := alo; i != ahi; i++ { - // look at all instances of a[i] in b; note that because - // b2j has no junk keys, the loop is skipped if a[i] is junk - newj2len := map[int]int{} - for _, j := range m.b2j[m.a[i]] { - // a[i] matches b[j] - if j < blo { - continue - } - if j >= bhi { - break - } - k := j2len[j-1] + 1 - newj2len[j] = k - if k > bestsize { - besti, bestj, bestsize = i-k+1, j-k+1, k - } - } - j2len = newj2len - } - - // Extend the best by non-junk elements on each end. In particular, - // "popular" non-junk elements aren't in b2j, which greatly speeds - // the inner loop above, but also means "the best" match so far - // doesn't contain any junk *or* popular non-junk elements. - for besti > alo && bestj > blo && !m.isBJunk(m.b[bestj-1]) && - m.a[besti-1] == m.b[bestj-1] { - besti, bestj, bestsize = besti-1, bestj-1, bestsize+1 - } - for besti+bestsize < ahi && bestj+bestsize < bhi && - !m.isBJunk(m.b[bestj+bestsize]) && - m.a[besti+bestsize] == m.b[bestj+bestsize] { - bestsize += 1 - } - - // Now that we have a wholly interesting match (albeit possibly - // empty!), we may as well suck up the matching junk on each - // side of it too. Can't think of a good reason not to, and it - // saves post-processing the (possibly considerable) expense of - // figuring out what to do with it. In the case of an empty - // interesting match, this is clearly the right thing to do, - // because no other kind of match is possible in the regions. - for besti > alo && bestj > blo && m.isBJunk(m.b[bestj-1]) && - m.a[besti-1] == m.b[bestj-1] { - besti, bestj, bestsize = besti-1, bestj-1, bestsize+1 - } - for besti+bestsize < ahi && bestj+bestsize < bhi && - m.isBJunk(m.b[bestj+bestsize]) && - m.a[besti+bestsize] == m.b[bestj+bestsize] { - bestsize += 1 - } - - return Match{A: besti, B: bestj, Size: bestsize} -} - -// Return list of triples describing matching subsequences. -// -// Each triple is of the form (i, j, n), and means that -// a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in -// i and in j. It's also guaranteed that if (i, j, n) and (i', j', n') are -// adjacent triples in the list, and the second is not the last triple in the -// list, then i+n != i' or j+n != j'. IOW, adjacent triples never describe -// adjacent equal blocks. -// -// The last triple is a dummy, (len(a), len(b), 0), and is the only -// triple with n==0. -func (m *SequenceMatcher) GetMatchingBlocks() []Match { - if m.matchingBlocks != nil { - return m.matchingBlocks - } - - var matchBlocks func(alo, ahi, blo, bhi int, matched []Match) []Match - matchBlocks = func(alo, ahi, blo, bhi int, matched []Match) []Match { - match := m.findLongestMatch(alo, ahi, blo, bhi) - i, j, k := match.A, match.B, match.Size - if match.Size > 0 { - if alo < i && blo < j { - matched = matchBlocks(alo, i, blo, j, matched) - } - matched = append(matched, match) - if i+k < ahi && j+k < bhi { - matched = matchBlocks(i+k, ahi, j+k, bhi, matched) - } - } - return matched - } - matched := matchBlocks(0, len(m.a), 0, len(m.b), nil) - - // It's possible that we have adjacent equal blocks in the - // matching_blocks list now. - nonAdjacent := []Match{} - i1, j1, k1 := 0, 0, 0 - for _, b := range matched { - // Is this block adjacent to i1, j1, k1? - i2, j2, k2 := b.A, b.B, b.Size - if i1+k1 == i2 && j1+k1 == j2 { - // Yes, so collapse them -- this just increases the length of - // the first block by the length of the second, and the first - // block so lengthened remains the block to compare against. - k1 += k2 - } else { - // Not adjacent. Remember the first block (k1==0 means it's - // the dummy we started with), and make the second block the - // new block to compare against. - if k1 > 0 { - nonAdjacent = append(nonAdjacent, Match{i1, j1, k1}) - } - i1, j1, k1 = i2, j2, k2 - } - } - if k1 > 0 { - nonAdjacent = append(nonAdjacent, Match{i1, j1, k1}) - } - - nonAdjacent = append(nonAdjacent, Match{len(m.a), len(m.b), 0}) - m.matchingBlocks = nonAdjacent - return m.matchingBlocks -} - -// Return list of 5-tuples describing how to turn a into b. -// -// Each tuple is of the form (tag, i1, i2, j1, j2). The first tuple -// has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the -// tuple preceding it, and likewise for j1 == the previous j2. -// -// The tags are characters, with these meanings: -// -// 'r' (replace): a[i1:i2] should be replaced by b[j1:j2] -// -// 'd' (delete): a[i1:i2] should be deleted, j1==j2 in this case. -// -// 'i' (insert): b[j1:j2] should be inserted at a[i1:i1], i1==i2 in this case. -// -// 'e' (equal): a[i1:i2] == b[j1:j2] -func (m *SequenceMatcher) GetOpCodes() []OpCode { - if m.opCodes != nil { - return m.opCodes - } - i, j := 0, 0 - matching := m.GetMatchingBlocks() - opCodes := make([]OpCode, 0, len(matching)) - for _, m := range matching { - // invariant: we've pumped out correct diffs to change - // a[:i] into b[:j], and the next matching block is - // a[ai:ai+size] == b[bj:bj+size]. So we need to pump - // out a diff to change a[i:ai] into b[j:bj], pump out - // the matching block, and move (i,j) beyond the match - ai, bj, size := m.A, m.B, m.Size - tag := byte(0) - if i < ai && j < bj { - tag = 'r' - } else if i < ai { - tag = 'd' - } else if j < bj { - tag = 'i' - } - if tag > 0 { - opCodes = append(opCodes, OpCode{tag, i, ai, j, bj}) - } - i, j = ai+size, bj+size - // the list of matching blocks is terminated by a - // sentinel with size 0 - if size > 0 { - opCodes = append(opCodes, OpCode{'e', ai, i, bj, j}) - } - } - m.opCodes = opCodes - return m.opCodes -} - -// Isolate change clusters by eliminating ranges with no changes. -// -// Return a generator of groups with up to n lines of context. -// Each group is in the same format as returned by GetOpCodes(). -func (m *SequenceMatcher) GetGroupedOpCodes(n int) [][]OpCode { - if n < 0 { - n = 3 - } - codes := m.GetOpCodes() - if len(codes) == 0 { - codes = []OpCode{OpCode{'e', 0, 1, 0, 1}} - } - // Fixup leading and trailing groups if they show no changes. - if codes[0].Tag == 'e' { - c := codes[0] - i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 - codes[0] = OpCode{c.Tag, max(i1, i2-n), i2, max(j1, j2-n), j2} - } - if codes[len(codes)-1].Tag == 'e' { - c := codes[len(codes)-1] - i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 - codes[len(codes)-1] = OpCode{c.Tag, i1, min(i2, i1+n), j1, min(j2, j1+n)} - } - nn := n + n - groups := [][]OpCode{} - group := []OpCode{} - for _, c := range codes { - i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 - // End the current group and start a new one whenever - // there is a large range with no changes. - if c.Tag == 'e' && i2-i1 > nn { - group = append(group, OpCode{c.Tag, i1, min(i2, i1+n), - j1, min(j2, j1+n)}) - groups = append(groups, group) - group = []OpCode{} - i1, j1 = max(i1, i2-n), max(j1, j2-n) - } - group = append(group, OpCode{c.Tag, i1, i2, j1, j2}) - } - if len(group) > 0 && !(len(group) == 1 && group[0].Tag == 'e') { - groups = append(groups, group) - } - return groups -} - -// Return a measure of the sequences' similarity (float in [0,1]). -// -// Where T is the total number of elements in both sequences, and -// M is the number of matches, this is 2.0*M / T. -// Note that this is 1 if the sequences are identical, and 0 if -// they have nothing in common. -// -// .Ratio() is expensive to compute if you haven't already computed -// .GetMatchingBlocks() or .GetOpCodes(), in which case you may -// want to try .QuickRatio() or .RealQuickRation() first to get an -// upper bound. -func (m *SequenceMatcher) Ratio() float64 { - matches := 0 - for _, m := range m.GetMatchingBlocks() { - matches += m.Size - } - return calculateRatio(matches, len(m.a)+len(m.b)) -} - -// Return an upper bound on ratio() relatively quickly. -// -// This isn't defined beyond that it is an upper bound on .Ratio(), and -// is faster to compute. -func (m *SequenceMatcher) QuickRatio() float64 { - // viewing a and b as multisets, set matches to the cardinality - // of their intersection; this counts the number of matches - // without regard to order, so is clearly an upper bound - if m.fullBCount == nil { - m.fullBCount = map[string]int{} - for _, s := range m.b { - m.fullBCount[s] = m.fullBCount[s] + 1 - } - } - - // avail[x] is the number of times x appears in 'b' less the - // number of times we've seen it in 'a' so far ... kinda - avail := map[string]int{} - matches := 0 - for _, s := range m.a { - n, ok := avail[s] - if !ok { - n = m.fullBCount[s] - } - avail[s] = n - 1 - if n > 0 { - matches += 1 - } - } - return calculateRatio(matches, len(m.a)+len(m.b)) -} - -// Return an upper bound on ratio() very quickly. -// -// This isn't defined beyond that it is an upper bound on .Ratio(), and -// is faster to compute than either .Ratio() or .QuickRatio(). -func (m *SequenceMatcher) RealQuickRatio() float64 { - la, lb := len(m.a), len(m.b) - return calculateRatio(min(la, lb), la+lb) -} - -// Convert range to the "ed" format -func formatRangeUnified(start, stop int) string { - // Per the diff spec at http://www.unix.org/single_unix_specification/ - beginning := start + 1 // lines start numbering with one - length := stop - start - if length == 1 { - return fmt.Sprintf("%d", beginning) - } - if length == 0 { - beginning -= 1 // empty ranges begin at line just before the range - } - return fmt.Sprintf("%d,%d", beginning, length) -} - -// Unified diff parameters -type UnifiedDiff struct { - A []string // First sequence lines - FromFile string // First file name - FromDate string // First file time - B []string // Second sequence lines - ToFile string // Second file name - ToDate string // Second file time - Eol string // Headers end of line, defaults to LF - Context int // Number of context lines -} - -// Compare two sequences of lines; generate the delta as a unified diff. -// -// Unified diffs are a compact way of showing line changes and a few -// lines of context. The number of context lines is set by 'n' which -// defaults to three. -// -// By default, the diff control lines (those with ---, +++, or @@) are -// created with a trailing newline. This is helpful so that inputs -// created from file.readlines() result in diffs that are suitable for -// file.writelines() since both the inputs and outputs have trailing -// newlines. -// -// For inputs that do not have trailing newlines, set the lineterm -// argument to "" so that the output will be uniformly newline free. -// -// The unidiff format normally has a header for filenames and modification -// times. Any or all of these may be specified using strings for -// 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'. -// The modification times are normally expressed in the ISO 8601 format. -func WriteUnifiedDiff(writer io.Writer, diff UnifiedDiff) error { - buf := bufio.NewWriter(writer) - defer buf.Flush() - wf := func(format string, args ...interface{}) error { - _, err := buf.WriteString(fmt.Sprintf(format, args...)) - return err - } - ws := func(s string) error { - _, err := buf.WriteString(s) - return err - } - - if len(diff.Eol) == 0 { - diff.Eol = "\n" - } - - started := false - m := NewMatcher(diff.A, diff.B) - for _, g := range m.GetGroupedOpCodes(diff.Context) { - if !started { - started = true - fromDate := "" - if len(diff.FromDate) > 0 { - fromDate = "\t" + diff.FromDate - } - toDate := "" - if len(diff.ToDate) > 0 { - toDate = "\t" + diff.ToDate - } - if diff.FromFile != "" || diff.ToFile != "" { - err := wf("--- %s%s%s", diff.FromFile, fromDate, diff.Eol) - if err != nil { - return err - } - err = wf("+++ %s%s%s", diff.ToFile, toDate, diff.Eol) - if err != nil { - return err - } - } - } - first, last := g[0], g[len(g)-1] - range1 := formatRangeUnified(first.I1, last.I2) - range2 := formatRangeUnified(first.J1, last.J2) - if err := wf("@@ -%s +%s @@%s", range1, range2, diff.Eol); err != nil { - return err - } - for _, c := range g { - i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 - if c.Tag == 'e' { - for _, line := range diff.A[i1:i2] { - if err := ws(" " + line); err != nil { - return err - } - } - continue - } - if c.Tag == 'r' || c.Tag == 'd' { - for _, line := range diff.A[i1:i2] { - if err := ws("-" + line); err != nil { - return err - } - } - } - if c.Tag == 'r' || c.Tag == 'i' { - for _, line := range diff.B[j1:j2] { - if err := ws("+" + line); err != nil { - return err - } - } - } - } - } - return nil -} - -// Like WriteUnifiedDiff but returns the diff a string. -func GetUnifiedDiffString(diff UnifiedDiff) (string, error) { - w := &bytes.Buffer{} - err := WriteUnifiedDiff(w, diff) - return string(w.Bytes()), err -} - -// Convert range to the "ed" format. -func formatRangeContext(start, stop int) string { - // Per the diff spec at http://www.unix.org/single_unix_specification/ - beginning := start + 1 // lines start numbering with one - length := stop - start - if length == 0 { - beginning -= 1 // empty ranges begin at line just before the range - } - if length <= 1 { - return fmt.Sprintf("%d", beginning) - } - return fmt.Sprintf("%d,%d", beginning, beginning+length-1) -} - -type ContextDiff UnifiedDiff - -// Compare two sequences of lines; generate the delta as a context diff. -// -// Context diffs are a compact way of showing line changes and a few -// lines of context. The number of context lines is set by diff.Context -// which defaults to three. -// -// By default, the diff control lines (those with *** or ---) are -// created with a trailing newline. -// -// For inputs that do not have trailing newlines, set the diff.Eol -// argument to "" so that the output will be uniformly newline free. -// -// The context diff format normally has a header for filenames and -// modification times. Any or all of these may be specified using -// strings for diff.FromFile, diff.ToFile, diff.FromDate, diff.ToDate. -// The modification times are normally expressed in the ISO 8601 format. -// If not specified, the strings default to blanks. -func WriteContextDiff(writer io.Writer, diff ContextDiff) error { - buf := bufio.NewWriter(writer) - defer buf.Flush() - var diffErr error - wf := func(format string, args ...interface{}) { - _, err := buf.WriteString(fmt.Sprintf(format, args...)) - if diffErr == nil && err != nil { - diffErr = err - } - } - ws := func(s string) { - _, err := buf.WriteString(s) - if diffErr == nil && err != nil { - diffErr = err - } - } - - if len(diff.Eol) == 0 { - diff.Eol = "\n" - } - - prefix := map[byte]string{ - 'i': "+ ", - 'd': "- ", - 'r': "! ", - 'e': " ", - } - - started := false - m := NewMatcher(diff.A, diff.B) - for _, g := range m.GetGroupedOpCodes(diff.Context) { - if !started { - started = true - fromDate := "" - if len(diff.FromDate) > 0 { - fromDate = "\t" + diff.FromDate - } - toDate := "" - if len(diff.ToDate) > 0 { - toDate = "\t" + diff.ToDate - } - if diff.FromFile != "" || diff.ToFile != "" { - wf("*** %s%s%s", diff.FromFile, fromDate, diff.Eol) - wf("--- %s%s%s", diff.ToFile, toDate, diff.Eol) - } - } - - first, last := g[0], g[len(g)-1] - ws("***************" + diff.Eol) - - range1 := formatRangeContext(first.I1, last.I2) - wf("*** %s ****%s", range1, diff.Eol) - for _, c := range g { - if c.Tag == 'r' || c.Tag == 'd' { - for _, cc := range g { - if cc.Tag == 'i' { - continue - } - for _, line := range diff.A[cc.I1:cc.I2] { - ws(prefix[cc.Tag] + line) - } - } - break - } - } - - range2 := formatRangeContext(first.J1, last.J2) - wf("--- %s ----%s", range2, diff.Eol) - for _, c := range g { - if c.Tag == 'r' || c.Tag == 'i' { - for _, cc := range g { - if cc.Tag == 'd' { - continue - } - for _, line := range diff.B[cc.J1:cc.J2] { - ws(prefix[cc.Tag] + line) - } - } - break - } - } - } - return diffErr -} - -// Like WriteContextDiff but returns the diff a string. -func GetContextDiffString(diff ContextDiff) (string, error) { - w := &bytes.Buffer{} - err := WriteContextDiff(w, diff) - return string(w.Bytes()), err -} - -// Split a string on "\n" while preserving them. The output can be used -// as input for UnifiedDiff and ContextDiff structures. -func SplitLines(s string) []string { - lines := strings.SplitAfter(s, "\n") - lines[len(lines)-1] += "\n" - return lines -} diff --git a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_windows.go b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_windows.go index 12bf36aa..a6000a3c 100644 --- a/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_windows.go +++ b/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_windows.go @@ -7,11 +7,15 @@ import ( "context" "errors" "fmt" + "math/bits" + "path/filepath" "strconv" + "strings" + "syscall" "unsafe" - "github.com/yusufpapurcu/wmi" "golang.org/x/sys/windows" + "golang.org/x/sys/windows/registry" "github.com/shirou/gopsutil/v4/internal/common" ) @@ -19,6 +23,8 @@ import ( var ( procGetNativeSystemInfo = common.Modkernel32.NewProc("GetNativeSystemInfo") procGetLogicalProcessorInformationEx = common.Modkernel32.NewProc("GetLogicalProcessorInformationEx") + procGetSystemFirmwareTable = common.Modkernel32.NewProc("GetSystemFirmwareTable") + procCallNtPowerInformation = common.ModPowrProf.NewProc("CallNtPowerInformation") ) type win32_Processor struct { //nolint:revive //FIXME @@ -46,6 +52,16 @@ type win32_SystemProcessorPerformanceInformation struct { //nolint:revive //FIXM InterruptCount uint64 // ULONG needs to be uint64 } +// https://learn.microsoft.com/en-us/windows/win32/power/processor-power-information-str +type processorPowerInformation struct { + number uint32 // http://download.microsoft.com/download/a/d/f/adf1347d-08dc-41a4-9084-623b1194d4b2/MoreThan64proc.docx + maxMhz uint32 + currentMhz uint32 + mhzLimit uint32 + maxIdleState uint32 + currentIdleState uint32 +} + const ( ClocksPerSec = 10000000.0 @@ -55,6 +71,30 @@ const ( // size of systemProcessorPerformanceInfoSize in memory win32_SystemProcessorPerformanceInfoSize = uint32(unsafe.Sizeof(win32_SystemProcessorPerformanceInformation{})) //nolint:revive //FIXME + + firmwareTableProviderSignatureRSMB = 0x52534d42 // "RSMB" https://gitlab.winehq.org/dreamer/wine/-/blame/wine-7.0-rc6/dlls/ntdll/unix/system.c#L230 + smBiosHeaderSize = 8 // SMBIOS header size + smbiosEndOfTable = 127 // Minimum length for processor structure + smbiosTypeProcessor = 4 // SMBIOS Type 4: Processor Information + smbiosProcessorMinLength = 0x18 // Minimum length for processor structure + + centralProcessorRegistryKey = `HARDWARE\DESCRIPTION\System\CentralProcessor` +) + +type relationship uint32 + +// https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getlogicalprocessorinformationex +const ( + relationProcessorCore = relationship(0) + relationProcessorPackage = relationship(3) +) + +const ( + kAffinitySize = unsafe.Sizeof(int(0)) + // https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/interrupt-affinity-and-priority + maxLogicalProcessorsPerGroup = uint32(unsafe.Sizeof(kAffinitySize * 8)) + // https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ne-wdm-power_information_level + processorInformation = 11 ) // Times returns times stat per cpu and combined for all CPUs @@ -101,32 +141,101 @@ func Info() ([]InfoStat, error) { return InfoWithContext(context.Background()) } +// this function iterates over each set bit in the package affinity mask, each bit represent a logical processor in a group (assuming you are iteriang over a package mask) +// the function is used also to compute the global logical processor number +// https://learn.microsoft.com/en-us/windows/win32/procthread/processor-groups +// see https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-group_affinity +// and https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-processor_relationship +// and https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-system_logical_processor_information_ex +func forEachSetBit64(mask uint64, fn func(bit int)) { + m := mask + for m != 0 { + b := bits.TrailingZeros64(m) + fn(b) + m &= m - 1 + } +} + +func getProcessorPowerInformation(ctx context.Context) ([]processorPowerInformation, error) { + numLP, countErr := CountsWithContext(ctx, true) + if countErr != nil { + return nil, fmt.Errorf("failed to get logical processor count: %w", countErr) + } + if numLP <= 0 { + return nil, fmt.Errorf("invalid logical processor count: %d", numLP) + } + + ppiSize := uintptr(numLP) * unsafe.Sizeof(processorPowerInformation{}) + buf := make([]byte, ppiSize) + ppi, _, err := procCallNtPowerInformation.Call( + uintptr(processorInformation), + 0, + 0, + uintptr(unsafe.Pointer(&buf[0])), + uintptr(ppiSize), + ) + if ppi != 0 { + return nil, fmt.Errorf("CallNtPowerInformation failed with code %d: %w", ppi, err) + } + ppis := unsafe.Slice((*processorPowerInformation)(unsafe.Pointer(&buf[0])), numLP) + return ppis, nil +} + func InfoWithContext(ctx context.Context) ([]InfoStat, error) { var ret []InfoStat - var dst []win32_Processor - q := wmi.CreateQuery(&dst, "") - if err := common.WMIQueryWithContext(ctx, q, &dst); err != nil { - return ret, err + processorPackages, err := getSystemLogicalProcessorInformationEx(relationProcessorPackage) + if err != nil { + return ret, fmt.Errorf("failed to get processor package information: %w", err) } - var procID string - for i, l := range dst { - procID = "" - if l.ProcessorID != nil { - procID = *l.ProcessorID - } + ppis, powerInformationErr := getProcessorPowerInformation(ctx) + if powerInformationErr != nil { + return ret, fmt.Errorf("failed to get processor power information: %w", powerInformationErr) + } + + family, processorId, smBIOSErr := getSMBIOSProcessorInfo() + if smBIOSErr != nil { + return ret, smBIOSErr + } - cpu := InfoStat{ + for i, pkg := range processorPackages { + logicalCount := 0 + maxMhz := 0 + model := "" + vendorId := "" + // iterate over each set bit in the package affinity mask + for _, ga := range pkg.processor.groupMask { + g := int(ga.group) + forEachSetBit64(uint64(ga.mask), func(bit int) { + // the global logical processor label + globalLpl := g*int(maxLogicalProcessorsPerGroup) + bit + if globalLpl >= 0 && globalLpl < len(ppis) { + logicalCount++ + m := int(ppis[globalLpl].maxMhz) + if m > maxMhz { + maxMhz = m + } + } + + registryKeyPath := filepath.Join(centralProcessorRegistryKey, strconv.Itoa(globalLpl)) + key, err := registry.OpenKey(registry.LOCAL_MACHINE, registryKeyPath, registry.QUERY_VALUE|registry.READ) + if err == nil { + model = getRegistryStringValueIfUnset(key, "ProcessorNameString", model) + vendorId = getRegistryStringValueIfUnset(key, "VendorIdentifier", vendorId) + _ = key.Close() + } + }) + } + ret = append(ret, InfoStat{ CPU: int32(i), - Family: strconv.FormatUint(uint64(l.Family), 10), - VendorID: l.Manufacturer, - ModelName: l.Name, - Cores: int32(l.NumberOfLogicalProcessors), - PhysicalID: procID, - Mhz: float64(l.MaxClockSpeed), + Family: strconv.FormatUint(uint64(family), 10), + VendorID: vendorId, + ModelName: model, + Cores: int32(logicalCount), + PhysicalID: processorId, + Mhz: float64(maxMhz), Flags: []string{}, - } - ret = append(ret, cpu) + }) } return ret, nil @@ -207,7 +316,7 @@ type systemInfo struct { } type groupAffinity struct { - mask uintptr // https://learn.microsoft.com/it-it/windows-hardware/drivers/kernel/interrupt-affinity-and-priority#about-kaffinity + mask uintptr // https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/interrupt-affinity-and-priority#about-kaffinity group uint16 reserved [3]uint16 } @@ -223,43 +332,128 @@ type processorRelationship struct { // https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-system_logical_processor_information_ex type systemLogicalProcessorInformationEx struct { - Relationship uint32 - Size uint32 - Processor processorRelationship + relationship uint32 + size uint32 + processor processorRelationship } -func getPhysicalCoreCount() (int, error) { - var length uint32 - const relationAll = 0xffff - const relationProcessorCore = 0x0 +// getSMBIOSProcessorInfo reads the SMBIOS Type 4 (Processor Information) structure and returns the Processor Family and ProcessorId fields. +// If not found, returns 0 and an empty string. +func getSMBIOSProcessorInfo() (family uint8, processorId string, err error) { + // https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemfirmwaretable + size, _, err := procGetSystemFirmwareTable.Call( + uintptr(firmwareTableProviderSignatureRSMB), + 0, + 0, + 0, + ) + if size == 0 { + return 0, "", fmt.Errorf("failed to get SMBIOS table size: %w", err) + } + buf := make([]byte, size) + ret, _, err := procGetSystemFirmwareTable.Call( + uintptr(firmwareTableProviderSignatureRSMB), + 0, + uintptr(unsafe.Pointer(&buf[0])), + uintptr(size), + ) + if ret == 0 { + return 0, "", fmt.Errorf("failed to read SMBIOS table: %w", err) + } + // https://wiki.osdev.org/System_Management_BIOS + i := smBiosHeaderSize // skip SMBIOS header (first 8 bytes) + maxIterations := len(buf) * 2 + iterations := 0 + for i < len(buf) && iterations < maxIterations { + iterations++ + if i+4 > len(buf) { + break + } + typ := buf[i] + length := buf[i+1] + if typ == smbiosEndOfTable { + break + } + if typ == smbiosTypeProcessor && length >= smbiosProcessorMinLength && i+int(length) <= len(buf) { + // Ensure we have enough bytes for procIdBytes + if i+16 > len(buf) { + break + } + // Get the processor family from byte at offset 6 + family = buf[i+6] + // Extract processor ID bytes (8 bytes total) from offsets 8-15 + procIdBytes := buf[i+8 : i+16] + // Convert first 4 bytes to 32-bit EAX register value (little endian) + eax := uint32(procIdBytes[0]) | uint32(procIdBytes[1])<<8 | uint32(procIdBytes[2])<<16 | uint32(procIdBytes[3])<<24 + // Convert last 4 bytes to 32-bit EDX register value (little endian) + edx := uint32(procIdBytes[4]) | uint32(procIdBytes[5])<<8 | uint32(procIdBytes[6])<<16 | uint32(procIdBytes[7])<<24 + // Format processor ID as 16 character hex string (EDX+EAX) + procId := fmt.Sprintf("%08X%08X", edx, eax) + return family, procId, nil + } + // skip to next structure + j := i + int(length) + innerIterations := 0 + maxInner := len(buf) // failsafe for inner loop + for j+1 < len(buf) && innerIterations < maxInner { + innerIterations++ + if buf[j] == 0 && buf[j+1] == 0 { + j += 2 + break + } + j++ + } + if innerIterations >= maxInner { + break // malformed buffer, avoid infinite loop + } + i = j + } + return 0, "", fmt.Errorf("SMBIOS processor information not found: %w", syscall.ERROR_NOT_FOUND) +} +func getSystemLogicalProcessorInformationEx(relationship relationship) ([]systemLogicalProcessorInformationEx, error) { + var length uint32 // First call to determine the required buffer size - _, _, err := procGetLogicalProcessorInformationEx.Call(uintptr(relationAll), 0, uintptr(unsafe.Pointer(&length))) + _, _, err := procGetLogicalProcessorInformationEx.Call(uintptr(relationship), 0, uintptr(unsafe.Pointer(&length))) if err != nil && !errors.Is(err, windows.ERROR_INSUFFICIENT_BUFFER) { - return 0, fmt.Errorf("failed to get buffer size: %w", err) + return nil, fmt.Errorf("failed to get buffer size: %w", err) } // Allocate the buffer buffer := make([]byte, length) // Second call to retrieve the processor information - _, _, err = procGetLogicalProcessorInformationEx.Call(uintptr(relationAll), uintptr(unsafe.Pointer(&buffer[0])), uintptr(unsafe.Pointer(&length))) + _, _, err = procGetLogicalProcessorInformationEx.Call(uintptr(relationship), uintptr(unsafe.Pointer(&buffer[0])), uintptr(unsafe.Pointer(&length))) if err != nil && !errors.Is(err, windows.NTE_OP_OK) { - return 0, fmt.Errorf("failed to get logical processor information: %w", err) + return nil, fmt.Errorf("failed to get logical processor information: %w", err) } - // Iterate through the buffer to count physical cores + // Convert the byte slice into a slice of systemLogicalProcessorInformationEx structs offset := uintptr(0) - ncpus := 0 + var infos []systemLogicalProcessorInformationEx for offset < uintptr(length) { info := (*systemLogicalProcessorInformationEx)(unsafe.Pointer(uintptr(unsafe.Pointer(&buffer[0])) + offset)) - if info.Relationship == relationProcessorCore { - ncpus++ - } - offset += uintptr(info.Size) + infos = append(infos, *info) + offset += uintptr(info.size) } - return ncpus, nil + return infos, nil +} + +func getPhysicalCoreCount() (int, error) { + infos, err := getSystemLogicalProcessorInformationEx(relationProcessorCore) + return len(infos), err +} + +func getRegistryStringValueIfUnset(key registry.Key, keyName, value string) string { + if value != "" { + return value + } + val, _, err := key.GetStringValue(keyName) + if err == nil { + return strings.TrimSpace(val) + } + return "" } func CountsWithContext(_ context.Context, logical bool) (int, error) { diff --git a/vendor/github.com/shirou/gopsutil/v4/host/host_aix_ppc64.go b/vendor/github.com/shirou/gopsutil/v4/host/host_aix_ppc64.go index de9674b7..6e5d802d 100644 --- a/vendor/github.com/shirou/gopsutil/v4/host/host_aix_ppc64.go +++ b/vendor/github.com/shirou/gopsutil/v4/host/host_aix_ppc64.go @@ -1,5 +1,4 @@ //go:build aix && ppc64 && cgo -// +build aix,ppc64,cgo // Guessed at from the following document: // https://www.ibm.com/docs/sl/ibm-mq/9.2?topic=platforms-standard-data-types-aix-linux-windows diff --git a/vendor/github.com/shirou/gopsutil/v4/internal/common/common.go b/vendor/github.com/shirou/gopsutil/v4/internal/common/common.go index 0e766b7b..36eb1d21 100644 --- a/vendor/github.com/shirou/gopsutil/v4/internal/common/common.go +++ b/vendor/github.com/shirou/gopsutil/v4/internal/common/common.go @@ -23,6 +23,7 @@ import ( "path/filepath" "reflect" "runtime" + "slices" "strconv" "strings" "time" @@ -290,22 +291,14 @@ func StringsHas(target []string, src string) bool { // StringsContains checks the src in any string of the target string slice func StringsContains(target []string, src string) bool { - for _, t := range target { - if strings.Contains(t, src) { - return true - } - } - return false + return slices.ContainsFunc(target, func(s string) bool { + return strings.Contains(s, src) + }) } // IntContains checks the src in any int of the target int slice. func IntContains(target []int, src int) bool { - for _, t := range target { - if src == t { - return true - } - } - return false + return slices.Contains(target, src) } // get struct attributes. @@ -449,7 +442,7 @@ func HostRootWithContext(ctx context.Context, combineWith ...string) string { } // getSysctrlEnv sets LC_ALL=C in a list of env vars for use when running -// sysctl commands (see DoSysctrl). +// sysctl commands. func getSysctrlEnv(env []string) []string { foundLC := false for i, line := range env { diff --git a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_darwin.go b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_darwin.go index c9d61054..8b756a11 100644 --- a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_darwin.go +++ b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_darwin.go @@ -4,32 +4,14 @@ package common import ( - "context" "errors" "fmt" - "os" - "os/exec" - "strings" "unsafe" "github.com/ebitengine/purego" "golang.org/x/sys/unix" ) -func DoSysctrlWithContext(ctx context.Context, mib string) ([]string, error) { - cmd := exec.CommandContext(ctx, "sysctl", "-n", mib) - cmd.Env = getSysctrlEnv(os.Environ()) - out, err := cmd.Output() - if err != nil { - return []string{}, err - } - v := strings.Replace(string(out), "{ ", "", 1) - v = strings.Replace(string(v), " }", "", 1) - values := strings.Fields(string(v)) - - return values, nil -} - func CallSyscall(mib []int32) ([]byte, uint64, error) { miblen := uint64(len(mib)) diff --git a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_freebsd.go b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_freebsd.go index 53cdceeb..7a40a40c 100644 --- a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_freebsd.go +++ b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_freebsd.go @@ -5,9 +5,6 @@ package common import ( "fmt" - "os" - "os/exec" - "strings" "unsafe" "golang.org/x/sys/unix" @@ -28,20 +25,6 @@ func SysctlUint(mib string) (uint64, error) { return 0, fmt.Errorf("unexpected size: %s, %d", mib, len(buf)) } -func DoSysctrl(mib string) ([]string, error) { - cmd := exec.Command("sysctl", "-n", mib) - cmd.Env = getSysctrlEnv(os.Environ()) - out, err := cmd.Output() - if err != nil { - return []string{}, err - } - v := strings.Replace(string(out), "{ ", "", 1) - v = strings.Replace(string(v), " }", "", 1) - values := strings.Fields(string(v)) - - return values, nil -} - func CallSyscall(mib []int32) ([]byte, uint64, error) { mibptr := unsafe.Pointer(&mib[0]) miblen := uint64(len(mib)) diff --git a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_linux.go b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_linux.go index 1ec22315..a2473f41 100644 --- a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_linux.go +++ b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_linux.go @@ -7,7 +7,6 @@ import ( "context" "errors" "os" - "os/exec" "path/filepath" "strconv" "strings" @@ -20,20 +19,6 @@ import ( // cachedBootTime must be accessed via atomic.Load/StoreUint64 var cachedBootTime uint64 -func DoSysctrl(mib string) ([]string, error) { - cmd := exec.Command("sysctl", "-n", mib) - cmd.Env = getSysctrlEnv(os.Environ()) - out, err := cmd.Output() - if err != nil { - return []string{}, err - } - v := strings.Replace(string(out), "{ ", "", 1) - v = strings.Replace(string(v), " }", "", 1) - values := strings.Fields(string(v)) - - return values, nil -} - func NumProcs() (uint64, error) { return NumProcsWithContext(context.Background()) } diff --git a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_netbsd.go b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_netbsd.go index 20653212..52796ddb 100644 --- a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_netbsd.go +++ b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_netbsd.go @@ -4,28 +4,11 @@ package common import ( - "os" - "os/exec" - "strings" "unsafe" "golang.org/x/sys/unix" ) -func DoSysctrl(mib string) ([]string, error) { - cmd := exec.Command("sysctl", "-n", mib) - cmd.Env = getSysctrlEnv(os.Environ()) - out, err := cmd.Output() - if err != nil { - return []string{}, err - } - v := strings.Replace(string(out), "{ ", "", 1) - v = strings.Replace(string(v), " }", "", 1) - values := strings.Fields(string(v)) - - return values, nil -} - func CallSyscall(mib []int32) ([]byte, uint64, error) { mibptr := unsafe.Pointer(&mib[0]) miblen := uint64(len(mib)) diff --git a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_openbsd.go b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_openbsd.go index 00fa19a2..df44ac04 100644 --- a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_openbsd.go +++ b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_openbsd.go @@ -4,28 +4,11 @@ package common import ( - "os" - "os/exec" - "strings" "unsafe" "golang.org/x/sys/unix" ) -func DoSysctrl(mib string) ([]string, error) { - cmd := exec.Command("sysctl", "-n", mib) - cmd.Env = getSysctrlEnv(os.Environ()) - out, err := cmd.Output() - if err != nil { - return []string{}, err - } - v := strings.Replace(string(out), "{ ", "", 1) - v = strings.Replace(string(v), " }", "", 1) - values := strings.Fields(string(v)) - - return values, nil -} - func CallSyscall(mib []int32) ([]byte, uint64, error) { mibptr := unsafe.Pointer(&mib[0]) miblen := uint64(len(mib)) diff --git a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_windows.go b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_windows.go index f3ec5a98..31df6efe 100644 --- a/vendor/github.com/shirou/gopsutil/v4/internal/common/common_windows.go +++ b/vendor/github.com/shirou/gopsutil/v4/internal/common/common_windows.go @@ -69,6 +69,7 @@ var ( ModNt = windows.NewLazySystemDLL("ntdll.dll") ModPdh = windows.NewLazySystemDLL("pdh.dll") ModPsapi = windows.NewLazySystemDLL("psapi.dll") + ModPowrProf = windows.NewLazySystemDLL("powrprof.dll") ProcGetSystemTimes = Modkernel32.NewProc("GetSystemTimes") ProcNtQuerySystemInformation = ModNt.NewProc("NtQuerySystemInformation") diff --git a/vendor/github.com/shirou/gopsutil/v4/internal/common/warnings.go b/vendor/github.com/shirou/gopsutil/v4/internal/common/warnings.go index 888cc57f..e09768f3 100644 --- a/vendor/github.com/shirou/gopsutil/v4/internal/common/warnings.go +++ b/vendor/github.com/shirou/gopsutil/v4/internal/common/warnings.go @@ -1,14 +1,28 @@ // SPDX-License-Identifier: BSD-3-Clause package common -import "fmt" +import ( + "fmt" + "strings" +) + +const ( + maxWarnings = 100 // An arbitrary limit to avoid excessive memory usage, it has no sense to store hundreds of errors + tooManyErrorsMessage = "too many errors reported, next errors were discarded" + numberOfWarningsMessage = "Number of warnings:" +) type Warnings struct { - List []error - Verbose bool + List []error + tooManyErrors bool + Verbose bool } func (w *Warnings) Add(err error) { + if len(w.List) >= maxWarnings { + w.tooManyErrors = true + return + } w.List = append(w.List, err) } @@ -22,10 +36,18 @@ func (w *Warnings) Reference() error { func (w *Warnings) Error() string { if w.Verbose { str := "" + var sb strings.Builder for i, e := range w.List { - str += fmt.Sprintf("\tError %d: %s\n", i, e.Error()) + sb.WriteString(fmt.Sprintf("\tError %d: %s\n", i, e.Error())) + } + str += sb.String() + if w.tooManyErrors { + str += fmt.Sprintf("\t%s\n", tooManyErrorsMessage) } return str } - return fmt.Sprintf("Number of warnings: %v", len(w.List)) + if w.tooManyErrors { + return fmt.Sprintf("%s > %v - %s", numberOfWarningsMessage, maxWarnings, tooManyErrorsMessage) + } + return fmt.Sprintf("%s %v", numberOfWarningsMessage, len(w.List)) } diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net_linux.go b/vendor/github.com/shirou/gopsutil/v4/net/net_linux.go index f01b04b5..d1e7f0ce 100644 --- a/vendor/github.com/shirou/gopsutil/v4/net/net_linux.go +++ b/vendor/github.com/shirou/gopsutil/v4/net/net_linux.go @@ -50,26 +50,25 @@ func IOCountersByFileWithContext(_ context.Context, pernic bool, filename string return nil, err } - parts := make([]string, 2) - statlen := len(lines) - 1 ret := make([]IOCountersStat, 0, statlen) for _, line := range lines[2:] { + // Split interface name and stats data at the last ":" separatorPos := strings.LastIndex(line, ":") if separatorPos == -1 { continue } - parts[0] = line[0:separatorPos] - parts[1] = line[separatorPos+1:] + interfacePart := line[0:separatorPos] + statsPart := line[separatorPos+1:] - interfaceName := strings.TrimSpace(parts[0]) + interfaceName := strings.TrimSpace(interfacePart) if interfaceName == "" { continue } - fields := strings.Fields(strings.TrimSpace(parts[1])) + fields := strings.Fields(strings.TrimSpace(statsPart)) bytesRecv, err := strconv.ParseUint(fields[0], 10, 64) if err != nil { return ret, err @@ -610,7 +609,7 @@ func getProcInodesAllWithContext(ctx context.Context, root string, maxConn int) return ret, nil } -// decodeAddress decode addresse represents addr in proc/net/* +// decodeAddress decode address represents addr in proc/net/* // ex: // "0500000A:0016" -> "10.0.0.5", 22 // "0085002452100113070057A13F025401:0035" -> "2400:8500:1301:1052:a157:7:154:23f", 53 diff --git a/vendor/github.com/shirou/gopsutil/v4/net/net_windows.go b/vendor/github.com/shirou/gopsutil/v4/net/net_windows.go index 96228969..f530e4e5 100644 --- a/vendor/github.com/shirou/gopsutil/v4/net/net_windows.go +++ b/vendor/github.com/shirou/gopsutil/v4/net/net_windows.go @@ -348,7 +348,7 @@ func getTableInfo(filename string, table any) (index, step, length int) { length = int(table.(pmibUDP6TableOwnerPid).DwNumEntries) } - return + return index, step, length } func getTCPConnections(family uint32) ([]ConnectionStat, error) { @@ -533,7 +533,7 @@ func getExtendedTCPTable(pTCPTable uintptr, pdwSize *uint32, bOrder bool, ulAf u if r1 != 0 { errcode = syscall.Errno(r1) } - return + return errcode } func getExtendedUDPTable(pUDPTable uintptr, pdwSize *uint32, bOrder bool, ulAf uint32, tableClass udpTableClass, reserved uint32) (errcode error) { @@ -541,7 +541,7 @@ func getExtendedUDPTable(pUDPTable uintptr, pdwSize *uint32, bOrder bool, ulAf u if r1 != 0 { errcode = syscall.Errno(r1) } - return + return errcode } func getUintptrFromBool(b bool) uintptr { diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process.go b/vendor/github.com/shirou/gopsutil/v4/process/process.go index 0bd4d9e1..5db5ff48 100644 --- a/vendor/github.com/shirou/gopsutil/v4/process/process.go +++ b/vendor/github.com/shirou/gopsutil/v4/process/process.go @@ -5,6 +5,7 @@ import ( "context" "encoding/json" "errors" + "regexp" "runtime" "sort" "sync" @@ -18,6 +19,7 @@ import ( var ( invoke common.Invoker = common.Invoke{} + strictIntPtrn = regexp.MustCompile(`^\d+$`) ErrorNoChildren = errors.New("process does not have children") // Deprecated: ErrorNoChildren is never returned by process.Children(), check its returned []*Process slice length instead ErrorProcessNotRunning = errors.New("process does not exist") ErrorNotPermitted = errors.New("operation not permitted") diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_darwin.go b/vendor/github.com/shirou/gopsutil/v4/process/process_darwin.go index 6fd57f3d..d0bba150 100644 --- a/vendor/github.com/shirou/gopsutil/v4/process/process_darwin.go +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_darwin.go @@ -237,7 +237,7 @@ func (p *Process) getKProc() (*unix.KinfoProc, error) { // call ps command. // Return value deletes Header line(you must not input wrong arg). -// And splited by Space. Caller have responsibility to manage. +// And split by Space. Caller have responsibility to manage. // If passed arg pid is 0, get information from all process. func callPsWithContext(ctx context.Context, arg string, pid int32, threadOption, nameOption bool) ([][]string, error) { var cmd []string diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_linux.go b/vendor/github.com/shirou/gopsutil/v4/process/process_linux.go index a6279d12..499d54ac 100644 --- a/vendor/github.com/shirou/gopsutil/v4/process/process_linux.go +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_linux.go @@ -1173,6 +1173,9 @@ func readPidsFromDir(path string) ([]int32, error) { return nil, err } for _, fname := range fnames { + if !strictIntPtrn.MatchString(fname) { + continue + } pid, err := strconv.ParseInt(fname, 10, 32) if err != nil { // if not numeric name, just skip diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_solaris.go b/vendor/github.com/shirou/gopsutil/v4/process/process_solaris.go index 685a3cc3..547d2287 100644 --- a/vendor/github.com/shirou/gopsutil/v4/process/process_solaris.go +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_solaris.go @@ -289,6 +289,9 @@ func readPidsFromDir(path string) ([]int32, error) { return nil, err } for _, fname := range fnames { + if !strictIntPtrn.MatchString(fname) { + continue + } pid, err := strconv.ParseInt(fname, 10, 32) if err != nil { // if not numeric name, just skip diff --git a/vendor/github.com/shirou/gopsutil/v4/process/process_windows.go b/vendor/github.com/shirou/gopsutil/v4/process/process_windows.go index 16580e1b..f4cbfa29 100644 --- a/vendor/github.com/shirou/gopsutil/v4/process/process_windows.go +++ b/vendor/github.com/shirou/gopsutil/v4/process/process_windows.go @@ -699,6 +699,7 @@ func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, er if err != nil { return nil, err } + defer windows.CloseHandle(process) buffer := make([]byte, 1024) var size uint32 @@ -956,7 +957,7 @@ func getProcessMemoryInfo(h windows.Handle, mem *PROCESS_MEMORY_COUNTERS) (err e err = syscall.EINVAL } } - return + return err } type SYSTEM_TIMES struct { //nolint:revive //FIXME diff --git a/vendor/github.com/stretchr/testify/LICENSE b/vendor/github.com/stretchr/testify/LICENSE deleted file mode 100644 index 4b0421cf..00000000 --- a/vendor/github.com/stretchr/testify/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2012-2020 Mat Ryer, Tyler Bunnell and contributors. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/stretchr/testify/assert/assertion_compare.go b/vendor/github.com/stretchr/testify/assert/assertion_compare.go deleted file mode 100644 index ffb24e8e..00000000 --- a/vendor/github.com/stretchr/testify/assert/assertion_compare.go +++ /dev/null @@ -1,495 +0,0 @@ -package assert - -import ( - "bytes" - "fmt" - "reflect" - "time" -) - -// Deprecated: CompareType has only ever been for internal use and has accidentally been published since v1.6.0. Do not use it. -type CompareType = compareResult - -type compareResult int - -const ( - compareLess compareResult = iota - 1 - compareEqual - compareGreater -) - -var ( - intType = reflect.TypeOf(int(1)) - int8Type = reflect.TypeOf(int8(1)) - int16Type = reflect.TypeOf(int16(1)) - int32Type = reflect.TypeOf(int32(1)) - int64Type = reflect.TypeOf(int64(1)) - - uintType = reflect.TypeOf(uint(1)) - uint8Type = reflect.TypeOf(uint8(1)) - uint16Type = reflect.TypeOf(uint16(1)) - uint32Type = reflect.TypeOf(uint32(1)) - uint64Type = reflect.TypeOf(uint64(1)) - - uintptrType = reflect.TypeOf(uintptr(1)) - - float32Type = reflect.TypeOf(float32(1)) - float64Type = reflect.TypeOf(float64(1)) - - stringType = reflect.TypeOf("") - - timeType = reflect.TypeOf(time.Time{}) - bytesType = reflect.TypeOf([]byte{}) -) - -func compare(obj1, obj2 interface{}, kind reflect.Kind) (compareResult, bool) { - obj1Value := reflect.ValueOf(obj1) - obj2Value := reflect.ValueOf(obj2) - - // throughout this switch we try and avoid calling .Convert() if possible, - // as this has a pretty big performance impact - switch kind { - case reflect.Int: - { - intobj1, ok := obj1.(int) - if !ok { - intobj1 = obj1Value.Convert(intType).Interface().(int) - } - intobj2, ok := obj2.(int) - if !ok { - intobj2 = obj2Value.Convert(intType).Interface().(int) - } - if intobj1 > intobj2 { - return compareGreater, true - } - if intobj1 == intobj2 { - return compareEqual, true - } - if intobj1 < intobj2 { - return compareLess, true - } - } - case reflect.Int8: - { - int8obj1, ok := obj1.(int8) - if !ok { - int8obj1 = obj1Value.Convert(int8Type).Interface().(int8) - } - int8obj2, ok := obj2.(int8) - if !ok { - int8obj2 = obj2Value.Convert(int8Type).Interface().(int8) - } - if int8obj1 > int8obj2 { - return compareGreater, true - } - if int8obj1 == int8obj2 { - return compareEqual, true - } - if int8obj1 < int8obj2 { - return compareLess, true - } - } - case reflect.Int16: - { - int16obj1, ok := obj1.(int16) - if !ok { - int16obj1 = obj1Value.Convert(int16Type).Interface().(int16) - } - int16obj2, ok := obj2.(int16) - if !ok { - int16obj2 = obj2Value.Convert(int16Type).Interface().(int16) - } - if int16obj1 > int16obj2 { - return compareGreater, true - } - if int16obj1 == int16obj2 { - return compareEqual, true - } - if int16obj1 < int16obj2 { - return compareLess, true - } - } - case reflect.Int32: - { - int32obj1, ok := obj1.(int32) - if !ok { - int32obj1 = obj1Value.Convert(int32Type).Interface().(int32) - } - int32obj2, ok := obj2.(int32) - if !ok { - int32obj2 = obj2Value.Convert(int32Type).Interface().(int32) - } - if int32obj1 > int32obj2 { - return compareGreater, true - } - if int32obj1 == int32obj2 { - return compareEqual, true - } - if int32obj1 < int32obj2 { - return compareLess, true - } - } - case reflect.Int64: - { - int64obj1, ok := obj1.(int64) - if !ok { - int64obj1 = obj1Value.Convert(int64Type).Interface().(int64) - } - int64obj2, ok := obj2.(int64) - if !ok { - int64obj2 = obj2Value.Convert(int64Type).Interface().(int64) - } - if int64obj1 > int64obj2 { - return compareGreater, true - } - if int64obj1 == int64obj2 { - return compareEqual, true - } - if int64obj1 < int64obj2 { - return compareLess, true - } - } - case reflect.Uint: - { - uintobj1, ok := obj1.(uint) - if !ok { - uintobj1 = obj1Value.Convert(uintType).Interface().(uint) - } - uintobj2, ok := obj2.(uint) - if !ok { - uintobj2 = obj2Value.Convert(uintType).Interface().(uint) - } - if uintobj1 > uintobj2 { - return compareGreater, true - } - if uintobj1 == uintobj2 { - return compareEqual, true - } - if uintobj1 < uintobj2 { - return compareLess, true - } - } - case reflect.Uint8: - { - uint8obj1, ok := obj1.(uint8) - if !ok { - uint8obj1 = obj1Value.Convert(uint8Type).Interface().(uint8) - } - uint8obj2, ok := obj2.(uint8) - if !ok { - uint8obj2 = obj2Value.Convert(uint8Type).Interface().(uint8) - } - if uint8obj1 > uint8obj2 { - return compareGreater, true - } - if uint8obj1 == uint8obj2 { - return compareEqual, true - } - if uint8obj1 < uint8obj2 { - return compareLess, true - } - } - case reflect.Uint16: - { - uint16obj1, ok := obj1.(uint16) - if !ok { - uint16obj1 = obj1Value.Convert(uint16Type).Interface().(uint16) - } - uint16obj2, ok := obj2.(uint16) - if !ok { - uint16obj2 = obj2Value.Convert(uint16Type).Interface().(uint16) - } - if uint16obj1 > uint16obj2 { - return compareGreater, true - } - if uint16obj1 == uint16obj2 { - return compareEqual, true - } - if uint16obj1 < uint16obj2 { - return compareLess, true - } - } - case reflect.Uint32: - { - uint32obj1, ok := obj1.(uint32) - if !ok { - uint32obj1 = obj1Value.Convert(uint32Type).Interface().(uint32) - } - uint32obj2, ok := obj2.(uint32) - if !ok { - uint32obj2 = obj2Value.Convert(uint32Type).Interface().(uint32) - } - if uint32obj1 > uint32obj2 { - return compareGreater, true - } - if uint32obj1 == uint32obj2 { - return compareEqual, true - } - if uint32obj1 < uint32obj2 { - return compareLess, true - } - } - case reflect.Uint64: - { - uint64obj1, ok := obj1.(uint64) - if !ok { - uint64obj1 = obj1Value.Convert(uint64Type).Interface().(uint64) - } - uint64obj2, ok := obj2.(uint64) - if !ok { - uint64obj2 = obj2Value.Convert(uint64Type).Interface().(uint64) - } - if uint64obj1 > uint64obj2 { - return compareGreater, true - } - if uint64obj1 == uint64obj2 { - return compareEqual, true - } - if uint64obj1 < uint64obj2 { - return compareLess, true - } - } - case reflect.Float32: - { - float32obj1, ok := obj1.(float32) - if !ok { - float32obj1 = obj1Value.Convert(float32Type).Interface().(float32) - } - float32obj2, ok := obj2.(float32) - if !ok { - float32obj2 = obj2Value.Convert(float32Type).Interface().(float32) - } - if float32obj1 > float32obj2 { - return compareGreater, true - } - if float32obj1 == float32obj2 { - return compareEqual, true - } - if float32obj1 < float32obj2 { - return compareLess, true - } - } - case reflect.Float64: - { - float64obj1, ok := obj1.(float64) - if !ok { - float64obj1 = obj1Value.Convert(float64Type).Interface().(float64) - } - float64obj2, ok := obj2.(float64) - if !ok { - float64obj2 = obj2Value.Convert(float64Type).Interface().(float64) - } - if float64obj1 > float64obj2 { - return compareGreater, true - } - if float64obj1 == float64obj2 { - return compareEqual, true - } - if float64obj1 < float64obj2 { - return compareLess, true - } - } - case reflect.String: - { - stringobj1, ok := obj1.(string) - if !ok { - stringobj1 = obj1Value.Convert(stringType).Interface().(string) - } - stringobj2, ok := obj2.(string) - if !ok { - stringobj2 = obj2Value.Convert(stringType).Interface().(string) - } - if stringobj1 > stringobj2 { - return compareGreater, true - } - if stringobj1 == stringobj2 { - return compareEqual, true - } - if stringobj1 < stringobj2 { - return compareLess, true - } - } - // Check for known struct types we can check for compare results. - case reflect.Struct: - { - // All structs enter here. We're not interested in most types. - if !obj1Value.CanConvert(timeType) { - break - } - - // time.Time can be compared! - timeObj1, ok := obj1.(time.Time) - if !ok { - timeObj1 = obj1Value.Convert(timeType).Interface().(time.Time) - } - - timeObj2, ok := obj2.(time.Time) - if !ok { - timeObj2 = obj2Value.Convert(timeType).Interface().(time.Time) - } - - if timeObj1.Before(timeObj2) { - return compareLess, true - } - if timeObj1.Equal(timeObj2) { - return compareEqual, true - } - return compareGreater, true - } - case reflect.Slice: - { - // We only care about the []byte type. - if !obj1Value.CanConvert(bytesType) { - break - } - - // []byte can be compared! - bytesObj1, ok := obj1.([]byte) - if !ok { - bytesObj1 = obj1Value.Convert(bytesType).Interface().([]byte) - - } - bytesObj2, ok := obj2.([]byte) - if !ok { - bytesObj2 = obj2Value.Convert(bytesType).Interface().([]byte) - } - - return compareResult(bytes.Compare(bytesObj1, bytesObj2)), true - } - case reflect.Uintptr: - { - uintptrObj1, ok := obj1.(uintptr) - if !ok { - uintptrObj1 = obj1Value.Convert(uintptrType).Interface().(uintptr) - } - uintptrObj2, ok := obj2.(uintptr) - if !ok { - uintptrObj2 = obj2Value.Convert(uintptrType).Interface().(uintptr) - } - if uintptrObj1 > uintptrObj2 { - return compareGreater, true - } - if uintptrObj1 == uintptrObj2 { - return compareEqual, true - } - if uintptrObj1 < uintptrObj2 { - return compareLess, true - } - } - } - - return compareEqual, false -} - -// Greater asserts that the first element is greater than the second -// -// assert.Greater(t, 2, 1) -// assert.Greater(t, float64(2), float64(1)) -// assert.Greater(t, "b", "a") -func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - failMessage := fmt.Sprintf("\"%v\" is not greater than \"%v\"", e1, e2) - return compareTwoValues(t, e1, e2, []compareResult{compareGreater}, failMessage, msgAndArgs...) -} - -// GreaterOrEqual asserts that the first element is greater than or equal to the second -// -// assert.GreaterOrEqual(t, 2, 1) -// assert.GreaterOrEqual(t, 2, 2) -// assert.GreaterOrEqual(t, "b", "a") -// assert.GreaterOrEqual(t, "b", "b") -func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - failMessage := fmt.Sprintf("\"%v\" is not greater than or equal to \"%v\"", e1, e2) - return compareTwoValues(t, e1, e2, []compareResult{compareGreater, compareEqual}, failMessage, msgAndArgs...) -} - -// Less asserts that the first element is less than the second -// -// assert.Less(t, 1, 2) -// assert.Less(t, float64(1), float64(2)) -// assert.Less(t, "a", "b") -func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - failMessage := fmt.Sprintf("\"%v\" is not less than \"%v\"", e1, e2) - return compareTwoValues(t, e1, e2, []compareResult{compareLess}, failMessage, msgAndArgs...) -} - -// LessOrEqual asserts that the first element is less than or equal to the second -// -// assert.LessOrEqual(t, 1, 2) -// assert.LessOrEqual(t, 2, 2) -// assert.LessOrEqual(t, "a", "b") -// assert.LessOrEqual(t, "b", "b") -func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - failMessage := fmt.Sprintf("\"%v\" is not less than or equal to \"%v\"", e1, e2) - return compareTwoValues(t, e1, e2, []compareResult{compareLess, compareEqual}, failMessage, msgAndArgs...) -} - -// Positive asserts that the specified element is positive -// -// assert.Positive(t, 1) -// assert.Positive(t, 1.23) -func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - zero := reflect.Zero(reflect.TypeOf(e)) - failMessage := fmt.Sprintf("\"%v\" is not positive", e) - return compareTwoValues(t, e, zero.Interface(), []compareResult{compareGreater}, failMessage, msgAndArgs...) -} - -// Negative asserts that the specified element is negative -// -// assert.Negative(t, -1) -// assert.Negative(t, -1.23) -func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - zero := reflect.Zero(reflect.TypeOf(e)) - failMessage := fmt.Sprintf("\"%v\" is not negative", e) - return compareTwoValues(t, e, zero.Interface(), []compareResult{compareLess}, failMessage, msgAndArgs...) -} - -func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedComparesResults []compareResult, failMessage string, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - e1Kind := reflect.ValueOf(e1).Kind() - e2Kind := reflect.ValueOf(e2).Kind() - if e1Kind != e2Kind { - return Fail(t, "Elements should be the same type", msgAndArgs...) - } - - compareResult, isComparable := compare(e1, e2, e1Kind) - if !isComparable { - return Fail(t, fmt.Sprintf(`Can not compare type "%T"`, e1), msgAndArgs...) - } - - if !containsValue(allowedComparesResults, compareResult) { - return Fail(t, failMessage, msgAndArgs...) - } - - return true -} - -func containsValue(values []compareResult, value compareResult) bool { - for _, v := range values { - if v == value { - return true - } - } - - return false -} diff --git a/vendor/github.com/stretchr/testify/assert/assertion_format.go b/vendor/github.com/stretchr/testify/assert/assertion_format.go deleted file mode 100644 index c592f6ad..00000000 --- a/vendor/github.com/stretchr/testify/assert/assertion_format.go +++ /dev/null @@ -1,866 +0,0 @@ -// Code generated with github.com/stretchr/testify/_codegen; DO NOT EDIT. - -package assert - -import ( - http "net/http" - url "net/url" - time "time" -) - -// Conditionf uses a Comparison to assert a complex condition. -func Conditionf(t TestingT, comp Comparison, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Condition(t, comp, append([]interface{}{msg}, args...)...) -} - -// Containsf asserts that the specified string, list(array, slice...) or map contains the -// specified substring or element. -// -// assert.Containsf(t, "Hello World", "World", "error message %s", "formatted") -// assert.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted") -// assert.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted") -func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Contains(t, s, contains, append([]interface{}{msg}, args...)...) -} - -// DirExistsf checks whether a directory exists in the given path. It also fails -// if the path is a file rather a directory or there is an error checking whether it exists. -func DirExistsf(t TestingT, path string, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return DirExists(t, path, append([]interface{}{msg}, args...)...) -} - -// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified -// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, -// the number of appearances of each of them in both lists should match. -// -// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted") -func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return ElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...) -} - -// Emptyf asserts that the given value is "empty". -// -// [Zero values] are "empty". -// -// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). -// -// Slices, maps and channels with zero length are "empty". -// -// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". -// -// assert.Emptyf(t, obj, "error message %s", "formatted") -// -// [Zero values]: https://go.dev/ref/spec#The_zero_value -func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Empty(t, object, append([]interface{}{msg}, args...)...) -} - -// Equalf asserts that two objects are equal. -// -// assert.Equalf(t, 123, 123, "error message %s", "formatted") -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). Function equality -// cannot be determined and will always fail. -func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Equal(t, expected, actual, append([]interface{}{msg}, args...)...) -} - -// EqualErrorf asserts that a function returned an error (i.e. not `nil`) -// and that it is equal to the provided error. -// -// actualObj, err := SomeFunction() -// assert.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted") -func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return EqualError(t, theError, errString, append([]interface{}{msg}, args...)...) -} - -// EqualExportedValuesf asserts that the types of two objects are equal and their public -// fields are also equal. This is useful for comparing structs that have private fields -// that could potentially differ. -// -// type S struct { -// Exported int -// notExported int -// } -// assert.EqualExportedValuesf(t, S{1, 2}, S{1, 3}, "error message %s", "formatted") => true -// assert.EqualExportedValuesf(t, S{1, 2}, S{2, 3}, "error message %s", "formatted") => false -func EqualExportedValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return EqualExportedValues(t, expected, actual, append([]interface{}{msg}, args...)...) -} - -// EqualValuesf asserts that two objects are equal or convertible to the larger -// type and equal. -// -// assert.EqualValuesf(t, uint32(123), int32(123), "error message %s", "formatted") -func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return EqualValues(t, expected, actual, append([]interface{}{msg}, args...)...) -} - -// Errorf asserts that a function returned an error (i.e. not `nil`). -// -// actualObj, err := SomeFunction() -// assert.Errorf(t, err, "error message %s", "formatted") -func Errorf(t TestingT, err error, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Error(t, err, append([]interface{}{msg}, args...)...) -} - -// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. -// This is a wrapper for errors.As. -func ErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return ErrorAs(t, err, target, append([]interface{}{msg}, args...)...) -} - -// ErrorContainsf asserts that a function returned an error (i.e. not `nil`) -// and that the error contains the specified substring. -// -// actualObj, err := SomeFunction() -// assert.ErrorContainsf(t, err, expectedErrorSubString, "error message %s", "formatted") -func ErrorContainsf(t TestingT, theError error, contains string, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return ErrorContains(t, theError, contains, append([]interface{}{msg}, args...)...) -} - -// ErrorIsf asserts that at least one of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func ErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return ErrorIs(t, err, target, append([]interface{}{msg}, args...)...) -} - -// Eventuallyf asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. -// -// assert.Eventuallyf(t, func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") -func Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Eventually(t, condition, waitFor, tick, append([]interface{}{msg}, args...)...) -} - -// EventuallyWithTf asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. In contrast to Eventually, -// it supplies a CollectT to the condition function, so that the condition -// function can use the CollectT to call other assertions. -// The condition is considered "met" if no errors are raised in a tick. -// The supplied CollectT collects all errors from one tick (if there are any). -// If the condition is not met before waitFor, the collected errors of -// the last tick are copied to t. -// -// externalValue := false -// go func() { -// time.Sleep(8*time.Second) -// externalValue = true -// }() -// assert.EventuallyWithTf(t, func(c *assert.CollectT, "error message %s", "formatted") { -// // add assertions as needed; any assertion failure will fail the current tick -// assert.True(c, externalValue, "expected 'externalValue' to be true") -// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false") -func EventuallyWithTf(t TestingT, condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return EventuallyWithT(t, condition, waitFor, tick, append([]interface{}{msg}, args...)...) -} - -// Exactlyf asserts that two objects are equal in value and type. -// -// assert.Exactlyf(t, int32(123), int64(123), "error message %s", "formatted") -func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Exactly(t, expected, actual, append([]interface{}{msg}, args...)...) -} - -// Failf reports a failure through -func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Fail(t, failureMessage, append([]interface{}{msg}, args...)...) -} - -// FailNowf fails test -func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return FailNow(t, failureMessage, append([]interface{}{msg}, args...)...) -} - -// Falsef asserts that the specified value is false. -// -// assert.Falsef(t, myBool, "error message %s", "formatted") -func Falsef(t TestingT, value bool, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return False(t, value, append([]interface{}{msg}, args...)...) -} - -// FileExistsf checks whether a file exists in the given path. It also fails if -// the path points to a directory or there is an error when trying to check the file. -func FileExistsf(t TestingT, path string, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return FileExists(t, path, append([]interface{}{msg}, args...)...) -} - -// Greaterf asserts that the first element is greater than the second -// -// assert.Greaterf(t, 2, 1, "error message %s", "formatted") -// assert.Greaterf(t, float64(2), float64(1), "error message %s", "formatted") -// assert.Greaterf(t, "b", "a", "error message %s", "formatted") -func Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Greater(t, e1, e2, append([]interface{}{msg}, args...)...) -} - -// GreaterOrEqualf asserts that the first element is greater than or equal to the second -// -// assert.GreaterOrEqualf(t, 2, 1, "error message %s", "formatted") -// assert.GreaterOrEqualf(t, 2, 2, "error message %s", "formatted") -// assert.GreaterOrEqualf(t, "b", "a", "error message %s", "formatted") -// assert.GreaterOrEqualf(t, "b", "b", "error message %s", "formatted") -func GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return GreaterOrEqual(t, e1, e2, append([]interface{}{msg}, args...)...) -} - -// HTTPBodyContainsf asserts that a specified handler returns a -// body that contains a string. -// -// assert.HTTPBodyContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return HTTPBodyContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...) -} - -// HTTPBodyNotContainsf asserts that a specified handler returns a -// body that does not contain a string. -// -// assert.HTTPBodyNotContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return HTTPBodyNotContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...) -} - -// HTTPErrorf asserts that a specified handler returns an error status code. -// -// assert.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return HTTPError(t, handler, method, url, values, append([]interface{}{msg}, args...)...) -} - -// HTTPRedirectf asserts that a specified handler returns a redirect status code. -// -// assert.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return HTTPRedirect(t, handler, method, url, values, append([]interface{}{msg}, args...)...) -} - -// HTTPStatusCodef asserts that a specified handler returns a specified status code. -// -// assert.HTTPStatusCodef(t, myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPStatusCodef(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return HTTPStatusCode(t, handler, method, url, values, statuscode, append([]interface{}{msg}, args...)...) -} - -// HTTPSuccessf asserts that a specified handler returns a success status code. -// -// assert.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return HTTPSuccess(t, handler, method, url, values, append([]interface{}{msg}, args...)...) -} - -// Implementsf asserts that an object is implemented by the specified interface. -// -// assert.Implementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted") -func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Implements(t, interfaceObject, object, append([]interface{}{msg}, args...)...) -} - -// InDeltaf asserts that the two numerals are within delta of each other. -// -// assert.InDeltaf(t, math.Pi, 22/7.0, 0.01, "error message %s", "formatted") -func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return InDelta(t, expected, actual, delta, append([]interface{}{msg}, args...)...) -} - -// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. -func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return InDeltaMapValues(t, expected, actual, delta, append([]interface{}{msg}, args...)...) -} - -// InDeltaSlicef is the same as InDelta, except it compares two slices. -func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return InDeltaSlice(t, expected, actual, delta, append([]interface{}{msg}, args...)...) -} - -// InEpsilonf asserts that expected and actual have a relative error less than epsilon -func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return InEpsilon(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...) -} - -// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices. -func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return InEpsilonSlice(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...) -} - -// IsDecreasingf asserts that the collection is decreasing -// -// assert.IsDecreasingf(t, []int{2, 1, 0}, "error message %s", "formatted") -// assert.IsDecreasingf(t, []float{2, 1}, "error message %s", "formatted") -// assert.IsDecreasingf(t, []string{"b", "a"}, "error message %s", "formatted") -func IsDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return IsDecreasing(t, object, append([]interface{}{msg}, args...)...) -} - -// IsIncreasingf asserts that the collection is increasing -// -// assert.IsIncreasingf(t, []int{1, 2, 3}, "error message %s", "formatted") -// assert.IsIncreasingf(t, []float{1, 2}, "error message %s", "formatted") -// assert.IsIncreasingf(t, []string{"a", "b"}, "error message %s", "formatted") -func IsIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return IsIncreasing(t, object, append([]interface{}{msg}, args...)...) -} - -// IsNonDecreasingf asserts that the collection is not decreasing -// -// assert.IsNonDecreasingf(t, []int{1, 1, 2}, "error message %s", "formatted") -// assert.IsNonDecreasingf(t, []float{1, 2}, "error message %s", "formatted") -// assert.IsNonDecreasingf(t, []string{"a", "b"}, "error message %s", "formatted") -func IsNonDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return IsNonDecreasing(t, object, append([]interface{}{msg}, args...)...) -} - -// IsNonIncreasingf asserts that the collection is not increasing -// -// assert.IsNonIncreasingf(t, []int{2, 1, 1}, "error message %s", "formatted") -// assert.IsNonIncreasingf(t, []float{2, 1}, "error message %s", "formatted") -// assert.IsNonIncreasingf(t, []string{"b", "a"}, "error message %s", "formatted") -func IsNonIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return IsNonIncreasing(t, object, append([]interface{}{msg}, args...)...) -} - -// IsNotTypef asserts that the specified objects are not of the same type. -// -// assert.IsNotTypef(t, &NotMyStruct{}, &MyStruct{}, "error message %s", "formatted") -func IsNotTypef(t TestingT, theType interface{}, object interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return IsNotType(t, theType, object, append([]interface{}{msg}, args...)...) -} - -// IsTypef asserts that the specified objects are of the same type. -// -// assert.IsTypef(t, &MyStruct{}, &MyStruct{}, "error message %s", "formatted") -func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return IsType(t, expectedType, object, append([]interface{}{msg}, args...)...) -} - -// JSONEqf asserts that two JSON strings are equivalent. -// -// assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted") -func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return JSONEq(t, expected, actual, append([]interface{}{msg}, args...)...) -} - -// Lenf asserts that the specified object has specific length. -// Lenf also fails if the object has a type that len() not accept. -// -// assert.Lenf(t, mySlice, 3, "error message %s", "formatted") -func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Len(t, object, length, append([]interface{}{msg}, args...)...) -} - -// Lessf asserts that the first element is less than the second -// -// assert.Lessf(t, 1, 2, "error message %s", "formatted") -// assert.Lessf(t, float64(1), float64(2), "error message %s", "formatted") -// assert.Lessf(t, "a", "b", "error message %s", "formatted") -func Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Less(t, e1, e2, append([]interface{}{msg}, args...)...) -} - -// LessOrEqualf asserts that the first element is less than or equal to the second -// -// assert.LessOrEqualf(t, 1, 2, "error message %s", "formatted") -// assert.LessOrEqualf(t, 2, 2, "error message %s", "formatted") -// assert.LessOrEqualf(t, "a", "b", "error message %s", "formatted") -// assert.LessOrEqualf(t, "b", "b", "error message %s", "formatted") -func LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return LessOrEqual(t, e1, e2, append([]interface{}{msg}, args...)...) -} - -// Negativef asserts that the specified element is negative -// -// assert.Negativef(t, -1, "error message %s", "formatted") -// assert.Negativef(t, -1.23, "error message %s", "formatted") -func Negativef(t TestingT, e interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Negative(t, e, append([]interface{}{msg}, args...)...) -} - -// Neverf asserts that the given condition doesn't satisfy in waitFor time, -// periodically checking the target function each tick. -// -// assert.Neverf(t, func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") -func Neverf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Never(t, condition, waitFor, tick, append([]interface{}{msg}, args...)...) -} - -// Nilf asserts that the specified object is nil. -// -// assert.Nilf(t, err, "error message %s", "formatted") -func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Nil(t, object, append([]interface{}{msg}, args...)...) -} - -// NoDirExistsf checks whether a directory does not exist in the given path. -// It fails if the path points to an existing _directory_ only. -func NoDirExistsf(t TestingT, path string, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NoDirExists(t, path, append([]interface{}{msg}, args...)...) -} - -// NoErrorf asserts that a function returned no error (i.e. `nil`). -// -// actualObj, err := SomeFunction() -// if assert.NoErrorf(t, err, "error message %s", "formatted") { -// assert.Equal(t, expectedObj, actualObj) -// } -func NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NoError(t, err, append([]interface{}{msg}, args...)...) -} - -// NoFileExistsf checks whether a file does not exist in a given path. It fails -// if the path points to an existing _file_ only. -func NoFileExistsf(t TestingT, path string, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NoFileExists(t, path, append([]interface{}{msg}, args...)...) -} - -// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the -// specified substring or element. -// -// assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted") -// assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted") -// assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted") -func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotContains(t, s, contains, append([]interface{}{msg}, args...)...) -} - -// NotElementsMatchf asserts that the specified listA(array, slice...) is NOT equal to specified -// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, -// the number of appearances of each of them in both lists should not match. -// This is an inverse of ElementsMatch. -// -// assert.NotElementsMatchf(t, [1, 1, 2, 3], [1, 1, 2, 3], "error message %s", "formatted") -> false -// -// assert.NotElementsMatchf(t, [1, 1, 2, 3], [1, 2, 3], "error message %s", "formatted") -> true -// -// assert.NotElementsMatchf(t, [1, 2, 3], [1, 2, 4], "error message %s", "formatted") -> true -func NotElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...) -} - -// NotEmptyf asserts that the specified object is NOT [Empty]. -// -// if assert.NotEmptyf(t, obj, "error message %s", "formatted") { -// assert.Equal(t, "two", obj[1]) -// } -func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotEmpty(t, object, append([]interface{}{msg}, args...)...) -} - -// NotEqualf asserts that the specified values are NOT equal. -// -// assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted") -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). -func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotEqual(t, expected, actual, append([]interface{}{msg}, args...)...) -} - -// NotEqualValuesf asserts that two objects are not equal even when converted to the same type -// -// assert.NotEqualValuesf(t, obj1, obj2, "error message %s", "formatted") -func NotEqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotEqualValues(t, expected, actual, append([]interface{}{msg}, args...)...) -} - -// NotErrorAsf asserts that none of the errors in err's chain matches target, -// but if so, sets target to that error value. -func NotErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotErrorAs(t, err, target, append([]interface{}{msg}, args...)...) -} - -// NotErrorIsf asserts that none of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func NotErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotErrorIs(t, err, target, append([]interface{}{msg}, args...)...) -} - -// NotImplementsf asserts that an object does not implement the specified interface. -// -// assert.NotImplementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted") -func NotImplementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotImplements(t, interfaceObject, object, append([]interface{}{msg}, args...)...) -} - -// NotNilf asserts that the specified object is not nil. -// -// assert.NotNilf(t, err, "error message %s", "formatted") -func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotNil(t, object, append([]interface{}{msg}, args...)...) -} - -// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic. -// -// assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted") -func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotPanics(t, f, append([]interface{}{msg}, args...)...) -} - -// NotRegexpf asserts that a specified regexp does not match a string. -// -// assert.NotRegexpf(t, regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted") -// assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted") -func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotRegexp(t, rx, str, append([]interface{}{msg}, args...)...) -} - -// NotSamef asserts that two pointers do not reference the same object. -// -// assert.NotSamef(t, ptr1, ptr2, "error message %s", "formatted") -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotSame(t, expected, actual, append([]interface{}{msg}, args...)...) -} - -// NotSubsetf asserts that the list (array, slice, or map) does NOT contain all -// elements given in the subset (array, slice, or map). -// Map elements are key-value pairs unless compared with an array or slice where -// only the map key is evaluated. -// -// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "error message %s", "formatted") -// assert.NotSubsetf(t, {"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") -// assert.NotSubsetf(t, [1, 3, 4], {1: "one", 2: "two"}, "error message %s", "formatted") -// assert.NotSubsetf(t, {"x": 1, "y": 2}, ["z"], "error message %s", "formatted") -func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotSubset(t, list, subset, append([]interface{}{msg}, args...)...) -} - -// NotZerof asserts that i is not the zero value for its type. -func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotZero(t, i, append([]interface{}{msg}, args...)...) -} - -// Panicsf asserts that the code inside the specified PanicTestFunc panics. -// -// assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted") -func Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Panics(t, f, append([]interface{}{msg}, args...)...) -} - -// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc -// panics, and that the recovered panic value is an error that satisfies the -// EqualError comparison. -// -// assert.PanicsWithErrorf(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted") -func PanicsWithErrorf(t TestingT, errString string, f PanicTestFunc, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return PanicsWithError(t, errString, f, append([]interface{}{msg}, args...)...) -} - -// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that -// the recovered panic value equals the expected panic value. -// -// assert.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted") -func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return PanicsWithValue(t, expected, f, append([]interface{}{msg}, args...)...) -} - -// Positivef asserts that the specified element is positive -// -// assert.Positivef(t, 1, "error message %s", "formatted") -// assert.Positivef(t, 1.23, "error message %s", "formatted") -func Positivef(t TestingT, e interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Positive(t, e, append([]interface{}{msg}, args...)...) -} - -// Regexpf asserts that a specified regexp matches a string. -// -// assert.Regexpf(t, regexp.MustCompile("start"), "it's starting", "error message %s", "formatted") -// assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted") -func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Regexp(t, rx, str, append([]interface{}{msg}, args...)...) -} - -// Samef asserts that two pointers reference the same object. -// -// assert.Samef(t, ptr1, ptr2, "error message %s", "formatted") -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func Samef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Same(t, expected, actual, append([]interface{}{msg}, args...)...) -} - -// Subsetf asserts that the list (array, slice, or map) contains all elements -// given in the subset (array, slice, or map). -// Map elements are key-value pairs unless compared with an array or slice where -// only the map key is evaluated. -// -// assert.Subsetf(t, [1, 2, 3], [1, 2], "error message %s", "formatted") -// assert.Subsetf(t, {"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") -// assert.Subsetf(t, [1, 2, 3], {1: "one", 2: "two"}, "error message %s", "formatted") -// assert.Subsetf(t, {"x": 1, "y": 2}, ["x"], "error message %s", "formatted") -func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Subset(t, list, subset, append([]interface{}{msg}, args...)...) -} - -// Truef asserts that the specified value is true. -// -// assert.Truef(t, myBool, "error message %s", "formatted") -func Truef(t TestingT, value bool, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return True(t, value, append([]interface{}{msg}, args...)...) -} - -// WithinDurationf asserts that the two times are within duration delta of each other. -// -// assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted") -func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return WithinDuration(t, expected, actual, delta, append([]interface{}{msg}, args...)...) -} - -// WithinRangef asserts that a time is within a time range (inclusive). -// -// assert.WithinRangef(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), "error message %s", "formatted") -func WithinRangef(t TestingT, actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return WithinRange(t, actual, start, end, append([]interface{}{msg}, args...)...) -} - -// YAMLEqf asserts that two YAML strings are equivalent. -func YAMLEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return YAMLEq(t, expected, actual, append([]interface{}{msg}, args...)...) -} - -// Zerof asserts that i is the zero value for its type. -func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Zero(t, i, append([]interface{}{msg}, args...)...) -} diff --git a/vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl b/vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl deleted file mode 100644 index d2bb0b81..00000000 --- a/vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -{{.CommentFormat}} -func {{.DocInfo.Name}}f(t TestingT, {{.ParamsFormat}}) bool { - if h, ok := t.(tHelper); ok { h.Helper() } - return {{.DocInfo.Name}}(t, {{.ForwardedParamsFormat}}) -} diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go b/vendor/github.com/stretchr/testify/assert/assertion_forward.go deleted file mode 100644 index 58db9284..00000000 --- a/vendor/github.com/stretchr/testify/assert/assertion_forward.go +++ /dev/null @@ -1,1723 +0,0 @@ -// Code generated with github.com/stretchr/testify/_codegen; DO NOT EDIT. - -package assert - -import ( - http "net/http" - url "net/url" - time "time" -) - -// Condition uses a Comparison to assert a complex condition. -func (a *Assertions) Condition(comp Comparison, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Condition(a.t, comp, msgAndArgs...) -} - -// Conditionf uses a Comparison to assert a complex condition. -func (a *Assertions) Conditionf(comp Comparison, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Conditionf(a.t, comp, msg, args...) -} - -// Contains asserts that the specified string, list(array, slice...) or map contains the -// specified substring or element. -// -// a.Contains("Hello World", "World") -// a.Contains(["Hello", "World"], "World") -// a.Contains({"Hello": "World"}, "Hello") -func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Contains(a.t, s, contains, msgAndArgs...) -} - -// Containsf asserts that the specified string, list(array, slice...) or map contains the -// specified substring or element. -// -// a.Containsf("Hello World", "World", "error message %s", "formatted") -// a.Containsf(["Hello", "World"], "World", "error message %s", "formatted") -// a.Containsf({"Hello": "World"}, "Hello", "error message %s", "formatted") -func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Containsf(a.t, s, contains, msg, args...) -} - -// DirExists checks whether a directory exists in the given path. It also fails -// if the path is a file rather a directory or there is an error checking whether it exists. -func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return DirExists(a.t, path, msgAndArgs...) -} - -// DirExistsf checks whether a directory exists in the given path. It also fails -// if the path is a file rather a directory or there is an error checking whether it exists. -func (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return DirExistsf(a.t, path, msg, args...) -} - -// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified -// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, -// the number of appearances of each of them in both lists should match. -// -// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2]) -func (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return ElementsMatch(a.t, listA, listB, msgAndArgs...) -} - -// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified -// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, -// the number of appearances of each of them in both lists should match. -// -// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted") -func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return ElementsMatchf(a.t, listA, listB, msg, args...) -} - -// Empty asserts that the given value is "empty". -// -// [Zero values] are "empty". -// -// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). -// -// Slices, maps and channels with zero length are "empty". -// -// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". -// -// a.Empty(obj) -// -// [Zero values]: https://go.dev/ref/spec#The_zero_value -func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Empty(a.t, object, msgAndArgs...) -} - -// Emptyf asserts that the given value is "empty". -// -// [Zero values] are "empty". -// -// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). -// -// Slices, maps and channels with zero length are "empty". -// -// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". -// -// a.Emptyf(obj, "error message %s", "formatted") -// -// [Zero values]: https://go.dev/ref/spec#The_zero_value -func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Emptyf(a.t, object, msg, args...) -} - -// Equal asserts that two objects are equal. -// -// a.Equal(123, 123) -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). Function equality -// cannot be determined and will always fail. -func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Equal(a.t, expected, actual, msgAndArgs...) -} - -// EqualError asserts that a function returned an error (i.e. not `nil`) -// and that it is equal to the provided error. -// -// actualObj, err := SomeFunction() -// a.EqualError(err, expectedErrorString) -func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return EqualError(a.t, theError, errString, msgAndArgs...) -} - -// EqualErrorf asserts that a function returned an error (i.e. not `nil`) -// and that it is equal to the provided error. -// -// actualObj, err := SomeFunction() -// a.EqualErrorf(err, expectedErrorString, "error message %s", "formatted") -func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return EqualErrorf(a.t, theError, errString, msg, args...) -} - -// EqualExportedValues asserts that the types of two objects are equal and their public -// fields are also equal. This is useful for comparing structs that have private fields -// that could potentially differ. -// -// type S struct { -// Exported int -// notExported int -// } -// a.EqualExportedValues(S{1, 2}, S{1, 3}) => true -// a.EqualExportedValues(S{1, 2}, S{2, 3}) => false -func (a *Assertions) EqualExportedValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return EqualExportedValues(a.t, expected, actual, msgAndArgs...) -} - -// EqualExportedValuesf asserts that the types of two objects are equal and their public -// fields are also equal. This is useful for comparing structs that have private fields -// that could potentially differ. -// -// type S struct { -// Exported int -// notExported int -// } -// a.EqualExportedValuesf(S{1, 2}, S{1, 3}, "error message %s", "formatted") => true -// a.EqualExportedValuesf(S{1, 2}, S{2, 3}, "error message %s", "formatted") => false -func (a *Assertions) EqualExportedValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return EqualExportedValuesf(a.t, expected, actual, msg, args...) -} - -// EqualValues asserts that two objects are equal or convertible to the larger -// type and equal. -// -// a.EqualValues(uint32(123), int32(123)) -func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return EqualValues(a.t, expected, actual, msgAndArgs...) -} - -// EqualValuesf asserts that two objects are equal or convertible to the larger -// type and equal. -// -// a.EqualValuesf(uint32(123), int32(123), "error message %s", "formatted") -func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return EqualValuesf(a.t, expected, actual, msg, args...) -} - -// Equalf asserts that two objects are equal. -// -// a.Equalf(123, 123, "error message %s", "formatted") -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). Function equality -// cannot be determined and will always fail. -func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Equalf(a.t, expected, actual, msg, args...) -} - -// Error asserts that a function returned an error (i.e. not `nil`). -// -// actualObj, err := SomeFunction() -// a.Error(err) -func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Error(a.t, err, msgAndArgs...) -} - -// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. -// This is a wrapper for errors.As. -func (a *Assertions) ErrorAs(err error, target interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return ErrorAs(a.t, err, target, msgAndArgs...) -} - -// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. -// This is a wrapper for errors.As. -func (a *Assertions) ErrorAsf(err error, target interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return ErrorAsf(a.t, err, target, msg, args...) -} - -// ErrorContains asserts that a function returned an error (i.e. not `nil`) -// and that the error contains the specified substring. -// -// actualObj, err := SomeFunction() -// a.ErrorContains(err, expectedErrorSubString) -func (a *Assertions) ErrorContains(theError error, contains string, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return ErrorContains(a.t, theError, contains, msgAndArgs...) -} - -// ErrorContainsf asserts that a function returned an error (i.e. not `nil`) -// and that the error contains the specified substring. -// -// actualObj, err := SomeFunction() -// a.ErrorContainsf(err, expectedErrorSubString, "error message %s", "formatted") -func (a *Assertions) ErrorContainsf(theError error, contains string, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return ErrorContainsf(a.t, theError, contains, msg, args...) -} - -// ErrorIs asserts that at least one of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func (a *Assertions) ErrorIs(err error, target error, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return ErrorIs(a.t, err, target, msgAndArgs...) -} - -// ErrorIsf asserts that at least one of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func (a *Assertions) ErrorIsf(err error, target error, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return ErrorIsf(a.t, err, target, msg, args...) -} - -// Errorf asserts that a function returned an error (i.e. not `nil`). -// -// actualObj, err := SomeFunction() -// a.Errorf(err, "error message %s", "formatted") -func (a *Assertions) Errorf(err error, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Errorf(a.t, err, msg, args...) -} - -// Eventually asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. -// -// a.Eventually(func() bool { return true; }, time.Second, 10*time.Millisecond) -func (a *Assertions) Eventually(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Eventually(a.t, condition, waitFor, tick, msgAndArgs...) -} - -// EventuallyWithT asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. In contrast to Eventually, -// it supplies a CollectT to the condition function, so that the condition -// function can use the CollectT to call other assertions. -// The condition is considered "met" if no errors are raised in a tick. -// The supplied CollectT collects all errors from one tick (if there are any). -// If the condition is not met before waitFor, the collected errors of -// the last tick are copied to t. -// -// externalValue := false -// go func() { -// time.Sleep(8*time.Second) -// externalValue = true -// }() -// a.EventuallyWithT(func(c *assert.CollectT) { -// // add assertions as needed; any assertion failure will fail the current tick -// assert.True(c, externalValue, "expected 'externalValue' to be true") -// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false") -func (a *Assertions) EventuallyWithT(condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return EventuallyWithT(a.t, condition, waitFor, tick, msgAndArgs...) -} - -// EventuallyWithTf asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. In contrast to Eventually, -// it supplies a CollectT to the condition function, so that the condition -// function can use the CollectT to call other assertions. -// The condition is considered "met" if no errors are raised in a tick. -// The supplied CollectT collects all errors from one tick (if there are any). -// If the condition is not met before waitFor, the collected errors of -// the last tick are copied to t. -// -// externalValue := false -// go func() { -// time.Sleep(8*time.Second) -// externalValue = true -// }() -// a.EventuallyWithTf(func(c *assert.CollectT, "error message %s", "formatted") { -// // add assertions as needed; any assertion failure will fail the current tick -// assert.True(c, externalValue, "expected 'externalValue' to be true") -// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false") -func (a *Assertions) EventuallyWithTf(condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return EventuallyWithTf(a.t, condition, waitFor, tick, msg, args...) -} - -// Eventuallyf asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. -// -// a.Eventuallyf(func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") -func (a *Assertions) Eventuallyf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Eventuallyf(a.t, condition, waitFor, tick, msg, args...) -} - -// Exactly asserts that two objects are equal in value and type. -// -// a.Exactly(int32(123), int64(123)) -func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Exactly(a.t, expected, actual, msgAndArgs...) -} - -// Exactlyf asserts that two objects are equal in value and type. -// -// a.Exactlyf(int32(123), int64(123), "error message %s", "formatted") -func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Exactlyf(a.t, expected, actual, msg, args...) -} - -// Fail reports a failure through -func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Fail(a.t, failureMessage, msgAndArgs...) -} - -// FailNow fails test -func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return FailNow(a.t, failureMessage, msgAndArgs...) -} - -// FailNowf fails test -func (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return FailNowf(a.t, failureMessage, msg, args...) -} - -// Failf reports a failure through -func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Failf(a.t, failureMessage, msg, args...) -} - -// False asserts that the specified value is false. -// -// a.False(myBool) -func (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return False(a.t, value, msgAndArgs...) -} - -// Falsef asserts that the specified value is false. -// -// a.Falsef(myBool, "error message %s", "formatted") -func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Falsef(a.t, value, msg, args...) -} - -// FileExists checks whether a file exists in the given path. It also fails if -// the path points to a directory or there is an error when trying to check the file. -func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return FileExists(a.t, path, msgAndArgs...) -} - -// FileExistsf checks whether a file exists in the given path. It also fails if -// the path points to a directory or there is an error when trying to check the file. -func (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return FileExistsf(a.t, path, msg, args...) -} - -// Greater asserts that the first element is greater than the second -// -// a.Greater(2, 1) -// a.Greater(float64(2), float64(1)) -// a.Greater("b", "a") -func (a *Assertions) Greater(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Greater(a.t, e1, e2, msgAndArgs...) -} - -// GreaterOrEqual asserts that the first element is greater than or equal to the second -// -// a.GreaterOrEqual(2, 1) -// a.GreaterOrEqual(2, 2) -// a.GreaterOrEqual("b", "a") -// a.GreaterOrEqual("b", "b") -func (a *Assertions) GreaterOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return GreaterOrEqual(a.t, e1, e2, msgAndArgs...) -} - -// GreaterOrEqualf asserts that the first element is greater than or equal to the second -// -// a.GreaterOrEqualf(2, 1, "error message %s", "formatted") -// a.GreaterOrEqualf(2, 2, "error message %s", "formatted") -// a.GreaterOrEqualf("b", "a", "error message %s", "formatted") -// a.GreaterOrEqualf("b", "b", "error message %s", "formatted") -func (a *Assertions) GreaterOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return GreaterOrEqualf(a.t, e1, e2, msg, args...) -} - -// Greaterf asserts that the first element is greater than the second -// -// a.Greaterf(2, 1, "error message %s", "formatted") -// a.Greaterf(float64(2), float64(1), "error message %s", "formatted") -// a.Greaterf("b", "a", "error message %s", "formatted") -func (a *Assertions) Greaterf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Greaterf(a.t, e1, e2, msg, args...) -} - -// HTTPBodyContains asserts that a specified handler returns a -// body that contains a string. -// -// a.HTTPBodyContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPBodyContains(a.t, handler, method, url, values, str, msgAndArgs...) -} - -// HTTPBodyContainsf asserts that a specified handler returns a -// body that contains a string. -// -// a.HTTPBodyContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPBodyContainsf(a.t, handler, method, url, values, str, msg, args...) -} - -// HTTPBodyNotContains asserts that a specified handler returns a -// body that does not contain a string. -// -// a.HTTPBodyNotContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPBodyNotContains(a.t, handler, method, url, values, str, msgAndArgs...) -} - -// HTTPBodyNotContainsf asserts that a specified handler returns a -// body that does not contain a string. -// -// a.HTTPBodyNotContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPBodyNotContainsf(a.t, handler, method, url, values, str, msg, args...) -} - -// HTTPError asserts that a specified handler returns an error status code. -// -// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPError(a.t, handler, method, url, values, msgAndArgs...) -} - -// HTTPErrorf asserts that a specified handler returns an error status code. -// -// a.HTTPErrorf(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPErrorf(a.t, handler, method, url, values, msg, args...) -} - -// HTTPRedirect asserts that a specified handler returns a redirect status code. -// -// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPRedirect(a.t, handler, method, url, values, msgAndArgs...) -} - -// HTTPRedirectf asserts that a specified handler returns a redirect status code. -// -// a.HTTPRedirectf(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPRedirectf(a.t, handler, method, url, values, msg, args...) -} - -// HTTPStatusCode asserts that a specified handler returns a specified status code. -// -// a.HTTPStatusCode(myHandler, "GET", "/notImplemented", nil, 501) -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPStatusCode(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPStatusCode(a.t, handler, method, url, values, statuscode, msgAndArgs...) -} - -// HTTPStatusCodef asserts that a specified handler returns a specified status code. -// -// a.HTTPStatusCodef(myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPStatusCodef(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPStatusCodef(a.t, handler, method, url, values, statuscode, msg, args...) -} - -// HTTPSuccess asserts that a specified handler returns a success status code. -// -// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil) -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPSuccess(a.t, handler, method, url, values, msgAndArgs...) -} - -// HTTPSuccessf asserts that a specified handler returns a success status code. -// -// a.HTTPSuccessf(myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPSuccessf(a.t, handler, method, url, values, msg, args...) -} - -// Implements asserts that an object is implemented by the specified interface. -// -// a.Implements((*MyInterface)(nil), new(MyObject)) -func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Implements(a.t, interfaceObject, object, msgAndArgs...) -} - -// Implementsf asserts that an object is implemented by the specified interface. -// -// a.Implementsf((*MyInterface)(nil), new(MyObject), "error message %s", "formatted") -func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Implementsf(a.t, interfaceObject, object, msg, args...) -} - -// InDelta asserts that the two numerals are within delta of each other. -// -// a.InDelta(math.Pi, 22/7.0, 0.01) -func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return InDelta(a.t, expected, actual, delta, msgAndArgs...) -} - -// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. -func (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return InDeltaMapValues(a.t, expected, actual, delta, msgAndArgs...) -} - -// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. -func (a *Assertions) InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return InDeltaMapValuesf(a.t, expected, actual, delta, msg, args...) -} - -// InDeltaSlice is the same as InDelta, except it compares two slices. -func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...) -} - -// InDeltaSlicef is the same as InDelta, except it compares two slices. -func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return InDeltaSlicef(a.t, expected, actual, delta, msg, args...) -} - -// InDeltaf asserts that the two numerals are within delta of each other. -// -// a.InDeltaf(math.Pi, 22/7.0, 0.01, "error message %s", "formatted") -func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return InDeltaf(a.t, expected, actual, delta, msg, args...) -} - -// InEpsilon asserts that expected and actual have a relative error less than epsilon -func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...) -} - -// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices. -func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return InEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...) -} - -// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices. -func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return InEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...) -} - -// InEpsilonf asserts that expected and actual have a relative error less than epsilon -func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return InEpsilonf(a.t, expected, actual, epsilon, msg, args...) -} - -// IsDecreasing asserts that the collection is decreasing -// -// a.IsDecreasing([]int{2, 1, 0}) -// a.IsDecreasing([]float{2, 1}) -// a.IsDecreasing([]string{"b", "a"}) -func (a *Assertions) IsDecreasing(object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return IsDecreasing(a.t, object, msgAndArgs...) -} - -// IsDecreasingf asserts that the collection is decreasing -// -// a.IsDecreasingf([]int{2, 1, 0}, "error message %s", "formatted") -// a.IsDecreasingf([]float{2, 1}, "error message %s", "formatted") -// a.IsDecreasingf([]string{"b", "a"}, "error message %s", "formatted") -func (a *Assertions) IsDecreasingf(object interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return IsDecreasingf(a.t, object, msg, args...) -} - -// IsIncreasing asserts that the collection is increasing -// -// a.IsIncreasing([]int{1, 2, 3}) -// a.IsIncreasing([]float{1, 2}) -// a.IsIncreasing([]string{"a", "b"}) -func (a *Assertions) IsIncreasing(object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return IsIncreasing(a.t, object, msgAndArgs...) -} - -// IsIncreasingf asserts that the collection is increasing -// -// a.IsIncreasingf([]int{1, 2, 3}, "error message %s", "formatted") -// a.IsIncreasingf([]float{1, 2}, "error message %s", "formatted") -// a.IsIncreasingf([]string{"a", "b"}, "error message %s", "formatted") -func (a *Assertions) IsIncreasingf(object interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return IsIncreasingf(a.t, object, msg, args...) -} - -// IsNonDecreasing asserts that the collection is not decreasing -// -// a.IsNonDecreasing([]int{1, 1, 2}) -// a.IsNonDecreasing([]float{1, 2}) -// a.IsNonDecreasing([]string{"a", "b"}) -func (a *Assertions) IsNonDecreasing(object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return IsNonDecreasing(a.t, object, msgAndArgs...) -} - -// IsNonDecreasingf asserts that the collection is not decreasing -// -// a.IsNonDecreasingf([]int{1, 1, 2}, "error message %s", "formatted") -// a.IsNonDecreasingf([]float{1, 2}, "error message %s", "formatted") -// a.IsNonDecreasingf([]string{"a", "b"}, "error message %s", "formatted") -func (a *Assertions) IsNonDecreasingf(object interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return IsNonDecreasingf(a.t, object, msg, args...) -} - -// IsNonIncreasing asserts that the collection is not increasing -// -// a.IsNonIncreasing([]int{2, 1, 1}) -// a.IsNonIncreasing([]float{2, 1}) -// a.IsNonIncreasing([]string{"b", "a"}) -func (a *Assertions) IsNonIncreasing(object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return IsNonIncreasing(a.t, object, msgAndArgs...) -} - -// IsNonIncreasingf asserts that the collection is not increasing -// -// a.IsNonIncreasingf([]int{2, 1, 1}, "error message %s", "formatted") -// a.IsNonIncreasingf([]float{2, 1}, "error message %s", "formatted") -// a.IsNonIncreasingf([]string{"b", "a"}, "error message %s", "formatted") -func (a *Assertions) IsNonIncreasingf(object interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return IsNonIncreasingf(a.t, object, msg, args...) -} - -// IsNotType asserts that the specified objects are not of the same type. -// -// a.IsNotType(&NotMyStruct{}, &MyStruct{}) -func (a *Assertions) IsNotType(theType interface{}, object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return IsNotType(a.t, theType, object, msgAndArgs...) -} - -// IsNotTypef asserts that the specified objects are not of the same type. -// -// a.IsNotTypef(&NotMyStruct{}, &MyStruct{}, "error message %s", "formatted") -func (a *Assertions) IsNotTypef(theType interface{}, object interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return IsNotTypef(a.t, theType, object, msg, args...) -} - -// IsType asserts that the specified objects are of the same type. -// -// a.IsType(&MyStruct{}, &MyStruct{}) -func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return IsType(a.t, expectedType, object, msgAndArgs...) -} - -// IsTypef asserts that the specified objects are of the same type. -// -// a.IsTypef(&MyStruct{}, &MyStruct{}, "error message %s", "formatted") -func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return IsTypef(a.t, expectedType, object, msg, args...) -} - -// JSONEq asserts that two JSON strings are equivalent. -// -// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) -func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return JSONEq(a.t, expected, actual, msgAndArgs...) -} - -// JSONEqf asserts that two JSON strings are equivalent. -// -// a.JSONEqf(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted") -func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return JSONEqf(a.t, expected, actual, msg, args...) -} - -// Len asserts that the specified object has specific length. -// Len also fails if the object has a type that len() not accept. -// -// a.Len(mySlice, 3) -func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Len(a.t, object, length, msgAndArgs...) -} - -// Lenf asserts that the specified object has specific length. -// Lenf also fails if the object has a type that len() not accept. -// -// a.Lenf(mySlice, 3, "error message %s", "formatted") -func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Lenf(a.t, object, length, msg, args...) -} - -// Less asserts that the first element is less than the second -// -// a.Less(1, 2) -// a.Less(float64(1), float64(2)) -// a.Less("a", "b") -func (a *Assertions) Less(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Less(a.t, e1, e2, msgAndArgs...) -} - -// LessOrEqual asserts that the first element is less than or equal to the second -// -// a.LessOrEqual(1, 2) -// a.LessOrEqual(2, 2) -// a.LessOrEqual("a", "b") -// a.LessOrEqual("b", "b") -func (a *Assertions) LessOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return LessOrEqual(a.t, e1, e2, msgAndArgs...) -} - -// LessOrEqualf asserts that the first element is less than or equal to the second -// -// a.LessOrEqualf(1, 2, "error message %s", "formatted") -// a.LessOrEqualf(2, 2, "error message %s", "formatted") -// a.LessOrEqualf("a", "b", "error message %s", "formatted") -// a.LessOrEqualf("b", "b", "error message %s", "formatted") -func (a *Assertions) LessOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return LessOrEqualf(a.t, e1, e2, msg, args...) -} - -// Lessf asserts that the first element is less than the second -// -// a.Lessf(1, 2, "error message %s", "formatted") -// a.Lessf(float64(1), float64(2), "error message %s", "formatted") -// a.Lessf("a", "b", "error message %s", "formatted") -func (a *Assertions) Lessf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Lessf(a.t, e1, e2, msg, args...) -} - -// Negative asserts that the specified element is negative -// -// a.Negative(-1) -// a.Negative(-1.23) -func (a *Assertions) Negative(e interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Negative(a.t, e, msgAndArgs...) -} - -// Negativef asserts that the specified element is negative -// -// a.Negativef(-1, "error message %s", "formatted") -// a.Negativef(-1.23, "error message %s", "formatted") -func (a *Assertions) Negativef(e interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Negativef(a.t, e, msg, args...) -} - -// Never asserts that the given condition doesn't satisfy in waitFor time, -// periodically checking the target function each tick. -// -// a.Never(func() bool { return false; }, time.Second, 10*time.Millisecond) -func (a *Assertions) Never(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Never(a.t, condition, waitFor, tick, msgAndArgs...) -} - -// Neverf asserts that the given condition doesn't satisfy in waitFor time, -// periodically checking the target function each tick. -// -// a.Neverf(func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") -func (a *Assertions) Neverf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Neverf(a.t, condition, waitFor, tick, msg, args...) -} - -// Nil asserts that the specified object is nil. -// -// a.Nil(err) -func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Nil(a.t, object, msgAndArgs...) -} - -// Nilf asserts that the specified object is nil. -// -// a.Nilf(err, "error message %s", "formatted") -func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Nilf(a.t, object, msg, args...) -} - -// NoDirExists checks whether a directory does not exist in the given path. -// It fails if the path points to an existing _directory_ only. -func (a *Assertions) NoDirExists(path string, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NoDirExists(a.t, path, msgAndArgs...) -} - -// NoDirExistsf checks whether a directory does not exist in the given path. -// It fails if the path points to an existing _directory_ only. -func (a *Assertions) NoDirExistsf(path string, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NoDirExistsf(a.t, path, msg, args...) -} - -// NoError asserts that a function returned no error (i.e. `nil`). -// -// actualObj, err := SomeFunction() -// if a.NoError(err) { -// assert.Equal(t, expectedObj, actualObj) -// } -func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NoError(a.t, err, msgAndArgs...) -} - -// NoErrorf asserts that a function returned no error (i.e. `nil`). -// -// actualObj, err := SomeFunction() -// if a.NoErrorf(err, "error message %s", "formatted") { -// assert.Equal(t, expectedObj, actualObj) -// } -func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NoErrorf(a.t, err, msg, args...) -} - -// NoFileExists checks whether a file does not exist in a given path. It fails -// if the path points to an existing _file_ only. -func (a *Assertions) NoFileExists(path string, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NoFileExists(a.t, path, msgAndArgs...) -} - -// NoFileExistsf checks whether a file does not exist in a given path. It fails -// if the path points to an existing _file_ only. -func (a *Assertions) NoFileExistsf(path string, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NoFileExistsf(a.t, path, msg, args...) -} - -// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the -// specified substring or element. -// -// a.NotContains("Hello World", "Earth") -// a.NotContains(["Hello", "World"], "Earth") -// a.NotContains({"Hello": "World"}, "Earth") -func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotContains(a.t, s, contains, msgAndArgs...) -} - -// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the -// specified substring or element. -// -// a.NotContainsf("Hello World", "Earth", "error message %s", "formatted") -// a.NotContainsf(["Hello", "World"], "Earth", "error message %s", "formatted") -// a.NotContainsf({"Hello": "World"}, "Earth", "error message %s", "formatted") -func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotContainsf(a.t, s, contains, msg, args...) -} - -// NotElementsMatch asserts that the specified listA(array, slice...) is NOT equal to specified -// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, -// the number of appearances of each of them in both lists should not match. -// This is an inverse of ElementsMatch. -// -// a.NotElementsMatch([1, 1, 2, 3], [1, 1, 2, 3]) -> false -// -// a.NotElementsMatch([1, 1, 2, 3], [1, 2, 3]) -> true -// -// a.NotElementsMatch([1, 2, 3], [1, 2, 4]) -> true -func (a *Assertions) NotElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotElementsMatch(a.t, listA, listB, msgAndArgs...) -} - -// NotElementsMatchf asserts that the specified listA(array, slice...) is NOT equal to specified -// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, -// the number of appearances of each of them in both lists should not match. -// This is an inverse of ElementsMatch. -// -// a.NotElementsMatchf([1, 1, 2, 3], [1, 1, 2, 3], "error message %s", "formatted") -> false -// -// a.NotElementsMatchf([1, 1, 2, 3], [1, 2, 3], "error message %s", "formatted") -> true -// -// a.NotElementsMatchf([1, 2, 3], [1, 2, 4], "error message %s", "formatted") -> true -func (a *Assertions) NotElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotElementsMatchf(a.t, listA, listB, msg, args...) -} - -// NotEmpty asserts that the specified object is NOT [Empty]. -// -// if a.NotEmpty(obj) { -// assert.Equal(t, "two", obj[1]) -// } -func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotEmpty(a.t, object, msgAndArgs...) -} - -// NotEmptyf asserts that the specified object is NOT [Empty]. -// -// if a.NotEmptyf(obj, "error message %s", "formatted") { -// assert.Equal(t, "two", obj[1]) -// } -func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotEmptyf(a.t, object, msg, args...) -} - -// NotEqual asserts that the specified values are NOT equal. -// -// a.NotEqual(obj1, obj2) -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). -func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotEqual(a.t, expected, actual, msgAndArgs...) -} - -// NotEqualValues asserts that two objects are not equal even when converted to the same type -// -// a.NotEqualValues(obj1, obj2) -func (a *Assertions) NotEqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotEqualValues(a.t, expected, actual, msgAndArgs...) -} - -// NotEqualValuesf asserts that two objects are not equal even when converted to the same type -// -// a.NotEqualValuesf(obj1, obj2, "error message %s", "formatted") -func (a *Assertions) NotEqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotEqualValuesf(a.t, expected, actual, msg, args...) -} - -// NotEqualf asserts that the specified values are NOT equal. -// -// a.NotEqualf(obj1, obj2, "error message %s", "formatted") -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). -func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotEqualf(a.t, expected, actual, msg, args...) -} - -// NotErrorAs asserts that none of the errors in err's chain matches target, -// but if so, sets target to that error value. -func (a *Assertions) NotErrorAs(err error, target interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotErrorAs(a.t, err, target, msgAndArgs...) -} - -// NotErrorAsf asserts that none of the errors in err's chain matches target, -// but if so, sets target to that error value. -func (a *Assertions) NotErrorAsf(err error, target interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotErrorAsf(a.t, err, target, msg, args...) -} - -// NotErrorIs asserts that none of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func (a *Assertions) NotErrorIs(err error, target error, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotErrorIs(a.t, err, target, msgAndArgs...) -} - -// NotErrorIsf asserts that none of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func (a *Assertions) NotErrorIsf(err error, target error, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotErrorIsf(a.t, err, target, msg, args...) -} - -// NotImplements asserts that an object does not implement the specified interface. -// -// a.NotImplements((*MyInterface)(nil), new(MyObject)) -func (a *Assertions) NotImplements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotImplements(a.t, interfaceObject, object, msgAndArgs...) -} - -// NotImplementsf asserts that an object does not implement the specified interface. -// -// a.NotImplementsf((*MyInterface)(nil), new(MyObject), "error message %s", "formatted") -func (a *Assertions) NotImplementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotImplementsf(a.t, interfaceObject, object, msg, args...) -} - -// NotNil asserts that the specified object is not nil. -// -// a.NotNil(err) -func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotNil(a.t, object, msgAndArgs...) -} - -// NotNilf asserts that the specified object is not nil. -// -// a.NotNilf(err, "error message %s", "formatted") -func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotNilf(a.t, object, msg, args...) -} - -// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. -// -// a.NotPanics(func(){ RemainCalm() }) -func (a *Assertions) NotPanics(f PanicTestFunc, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotPanics(a.t, f, msgAndArgs...) -} - -// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic. -// -// a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted") -func (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotPanicsf(a.t, f, msg, args...) -} - -// NotRegexp asserts that a specified regexp does not match a string. -// -// a.NotRegexp(regexp.MustCompile("starts"), "it's starting") -// a.NotRegexp("^start", "it's not starting") -func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotRegexp(a.t, rx, str, msgAndArgs...) -} - -// NotRegexpf asserts that a specified regexp does not match a string. -// -// a.NotRegexpf(regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted") -// a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted") -func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotRegexpf(a.t, rx, str, msg, args...) -} - -// NotSame asserts that two pointers do not reference the same object. -// -// a.NotSame(ptr1, ptr2) -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func (a *Assertions) NotSame(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotSame(a.t, expected, actual, msgAndArgs...) -} - -// NotSamef asserts that two pointers do not reference the same object. -// -// a.NotSamef(ptr1, ptr2, "error message %s", "formatted") -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func (a *Assertions) NotSamef(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotSamef(a.t, expected, actual, msg, args...) -} - -// NotSubset asserts that the list (array, slice, or map) does NOT contain all -// elements given in the subset (array, slice, or map). -// Map elements are key-value pairs unless compared with an array or slice where -// only the map key is evaluated. -// -// a.NotSubset([1, 3, 4], [1, 2]) -// a.NotSubset({"x": 1, "y": 2}, {"z": 3}) -// a.NotSubset([1, 3, 4], {1: "one", 2: "two"}) -// a.NotSubset({"x": 1, "y": 2}, ["z"]) -func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotSubset(a.t, list, subset, msgAndArgs...) -} - -// NotSubsetf asserts that the list (array, slice, or map) does NOT contain all -// elements given in the subset (array, slice, or map). -// Map elements are key-value pairs unless compared with an array or slice where -// only the map key is evaluated. -// -// a.NotSubsetf([1, 3, 4], [1, 2], "error message %s", "formatted") -// a.NotSubsetf({"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") -// a.NotSubsetf([1, 3, 4], {1: "one", 2: "two"}, "error message %s", "formatted") -// a.NotSubsetf({"x": 1, "y": 2}, ["z"], "error message %s", "formatted") -func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotSubsetf(a.t, list, subset, msg, args...) -} - -// NotZero asserts that i is not the zero value for its type. -func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotZero(a.t, i, msgAndArgs...) -} - -// NotZerof asserts that i is not the zero value for its type. -func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotZerof(a.t, i, msg, args...) -} - -// Panics asserts that the code inside the specified PanicTestFunc panics. -// -// a.Panics(func(){ GoCrazy() }) -func (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Panics(a.t, f, msgAndArgs...) -} - -// PanicsWithError asserts that the code inside the specified PanicTestFunc -// panics, and that the recovered panic value is an error that satisfies the -// EqualError comparison. -// -// a.PanicsWithError("crazy error", func(){ GoCrazy() }) -func (a *Assertions) PanicsWithError(errString string, f PanicTestFunc, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return PanicsWithError(a.t, errString, f, msgAndArgs...) -} - -// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc -// panics, and that the recovered panic value is an error that satisfies the -// EqualError comparison. -// -// a.PanicsWithErrorf("crazy error", func(){ GoCrazy() }, "error message %s", "formatted") -func (a *Assertions) PanicsWithErrorf(errString string, f PanicTestFunc, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return PanicsWithErrorf(a.t, errString, f, msg, args...) -} - -// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that -// the recovered panic value equals the expected panic value. -// -// a.PanicsWithValue("crazy error", func(){ GoCrazy() }) -func (a *Assertions) PanicsWithValue(expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return PanicsWithValue(a.t, expected, f, msgAndArgs...) -} - -// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that -// the recovered panic value equals the expected panic value. -// -// a.PanicsWithValuef("crazy error", func(){ GoCrazy() }, "error message %s", "formatted") -func (a *Assertions) PanicsWithValuef(expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return PanicsWithValuef(a.t, expected, f, msg, args...) -} - -// Panicsf asserts that the code inside the specified PanicTestFunc panics. -// -// a.Panicsf(func(){ GoCrazy() }, "error message %s", "formatted") -func (a *Assertions) Panicsf(f PanicTestFunc, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Panicsf(a.t, f, msg, args...) -} - -// Positive asserts that the specified element is positive -// -// a.Positive(1) -// a.Positive(1.23) -func (a *Assertions) Positive(e interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Positive(a.t, e, msgAndArgs...) -} - -// Positivef asserts that the specified element is positive -// -// a.Positivef(1, "error message %s", "formatted") -// a.Positivef(1.23, "error message %s", "formatted") -func (a *Assertions) Positivef(e interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Positivef(a.t, e, msg, args...) -} - -// Regexp asserts that a specified regexp matches a string. -// -// a.Regexp(regexp.MustCompile("start"), "it's starting") -// a.Regexp("start...$", "it's not starting") -func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Regexp(a.t, rx, str, msgAndArgs...) -} - -// Regexpf asserts that a specified regexp matches a string. -// -// a.Regexpf(regexp.MustCompile("start"), "it's starting", "error message %s", "formatted") -// a.Regexpf("start...$", "it's not starting", "error message %s", "formatted") -func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Regexpf(a.t, rx, str, msg, args...) -} - -// Same asserts that two pointers reference the same object. -// -// a.Same(ptr1, ptr2) -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func (a *Assertions) Same(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Same(a.t, expected, actual, msgAndArgs...) -} - -// Samef asserts that two pointers reference the same object. -// -// a.Samef(ptr1, ptr2, "error message %s", "formatted") -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func (a *Assertions) Samef(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Samef(a.t, expected, actual, msg, args...) -} - -// Subset asserts that the list (array, slice, or map) contains all elements -// given in the subset (array, slice, or map). -// Map elements are key-value pairs unless compared with an array or slice where -// only the map key is evaluated. -// -// a.Subset([1, 2, 3], [1, 2]) -// a.Subset({"x": 1, "y": 2}, {"x": 1}) -// a.Subset([1, 2, 3], {1: "one", 2: "two"}) -// a.Subset({"x": 1, "y": 2}, ["x"]) -func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Subset(a.t, list, subset, msgAndArgs...) -} - -// Subsetf asserts that the list (array, slice, or map) contains all elements -// given in the subset (array, slice, or map). -// Map elements are key-value pairs unless compared with an array or slice where -// only the map key is evaluated. -// -// a.Subsetf([1, 2, 3], [1, 2], "error message %s", "formatted") -// a.Subsetf({"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") -// a.Subsetf([1, 2, 3], {1: "one", 2: "two"}, "error message %s", "formatted") -// a.Subsetf({"x": 1, "y": 2}, ["x"], "error message %s", "formatted") -func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Subsetf(a.t, list, subset, msg, args...) -} - -// True asserts that the specified value is true. -// -// a.True(myBool) -func (a *Assertions) True(value bool, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return True(a.t, value, msgAndArgs...) -} - -// Truef asserts that the specified value is true. -// -// a.Truef(myBool, "error message %s", "formatted") -func (a *Assertions) Truef(value bool, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Truef(a.t, value, msg, args...) -} - -// WithinDuration asserts that the two times are within duration delta of each other. -// -// a.WithinDuration(time.Now(), time.Now(), 10*time.Second) -func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return WithinDuration(a.t, expected, actual, delta, msgAndArgs...) -} - -// WithinDurationf asserts that the two times are within duration delta of each other. -// -// a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted") -func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return WithinDurationf(a.t, expected, actual, delta, msg, args...) -} - -// WithinRange asserts that a time is within a time range (inclusive). -// -// a.WithinRange(time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second)) -func (a *Assertions) WithinRange(actual time.Time, start time.Time, end time.Time, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return WithinRange(a.t, actual, start, end, msgAndArgs...) -} - -// WithinRangef asserts that a time is within a time range (inclusive). -// -// a.WithinRangef(time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), "error message %s", "formatted") -func (a *Assertions) WithinRangef(actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return WithinRangef(a.t, actual, start, end, msg, args...) -} - -// YAMLEq asserts that two YAML strings are equivalent. -func (a *Assertions) YAMLEq(expected string, actual string, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return YAMLEq(a.t, expected, actual, msgAndArgs...) -} - -// YAMLEqf asserts that two YAML strings are equivalent. -func (a *Assertions) YAMLEqf(expected string, actual string, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return YAMLEqf(a.t, expected, actual, msg, args...) -} - -// Zero asserts that i is the zero value for its type. -func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Zero(a.t, i, msgAndArgs...) -} - -// Zerof asserts that i is the zero value for its type. -func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Zerof(a.t, i, msg, args...) -} diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl b/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl deleted file mode 100644 index 188bb9e1..00000000 --- a/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -{{.CommentWithoutT "a"}} -func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) bool { - if h, ok := a.t.(tHelper); ok { h.Helper() } - return {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) -} diff --git a/vendor/github.com/stretchr/testify/assert/assertion_order.go b/vendor/github.com/stretchr/testify/assert/assertion_order.go deleted file mode 100644 index 2fdf80fd..00000000 --- a/vendor/github.com/stretchr/testify/assert/assertion_order.go +++ /dev/null @@ -1,81 +0,0 @@ -package assert - -import ( - "fmt" - "reflect" -) - -// isOrdered checks that collection contains orderable elements. -func isOrdered(t TestingT, object interface{}, allowedComparesResults []compareResult, failMessage string, msgAndArgs ...interface{}) bool { - objKind := reflect.TypeOf(object).Kind() - if objKind != reflect.Slice && objKind != reflect.Array { - return false - } - - objValue := reflect.ValueOf(object) - objLen := objValue.Len() - - if objLen <= 1 { - return true - } - - value := objValue.Index(0) - valueInterface := value.Interface() - firstValueKind := value.Kind() - - for i := 1; i < objLen; i++ { - prevValue := value - prevValueInterface := valueInterface - - value = objValue.Index(i) - valueInterface = value.Interface() - - compareResult, isComparable := compare(prevValueInterface, valueInterface, firstValueKind) - - if !isComparable { - return Fail(t, fmt.Sprintf(`Can not compare type "%T" and "%T"`, value, prevValue), msgAndArgs...) - } - - if !containsValue(allowedComparesResults, compareResult) { - return Fail(t, fmt.Sprintf(failMessage, prevValue, value), msgAndArgs...) - } - } - - return true -} - -// IsIncreasing asserts that the collection is increasing -// -// assert.IsIncreasing(t, []int{1, 2, 3}) -// assert.IsIncreasing(t, []float{1, 2}) -// assert.IsIncreasing(t, []string{"a", "b"}) -func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - return isOrdered(t, object, []compareResult{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...) -} - -// IsNonIncreasing asserts that the collection is not increasing -// -// assert.IsNonIncreasing(t, []int{2, 1, 1}) -// assert.IsNonIncreasing(t, []float{2, 1}) -// assert.IsNonIncreasing(t, []string{"b", "a"}) -func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - return isOrdered(t, object, []compareResult{compareEqual, compareGreater}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...) -} - -// IsDecreasing asserts that the collection is decreasing -// -// assert.IsDecreasing(t, []int{2, 1, 0}) -// assert.IsDecreasing(t, []float{2, 1}) -// assert.IsDecreasing(t, []string{"b", "a"}) -func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - return isOrdered(t, object, []compareResult{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...) -} - -// IsNonDecreasing asserts that the collection is not decreasing -// -// assert.IsNonDecreasing(t, []int{1, 1, 2}) -// assert.IsNonDecreasing(t, []float{1, 2}) -// assert.IsNonDecreasing(t, []string{"a", "b"}) -func IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - return isOrdered(t, object, []compareResult{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...) -} diff --git a/vendor/github.com/stretchr/testify/assert/assertions.go b/vendor/github.com/stretchr/testify/assert/assertions.go deleted file mode 100644 index de8de0cb..00000000 --- a/vendor/github.com/stretchr/testify/assert/assertions.go +++ /dev/null @@ -1,2295 +0,0 @@ -package assert - -import ( - "bufio" - "bytes" - "encoding/json" - "errors" - "fmt" - "math" - "os" - "reflect" - "regexp" - "runtime" - "runtime/debug" - "strings" - "time" - "unicode" - "unicode/utf8" - - "github.com/davecgh/go-spew/spew" - "github.com/pmezard/go-difflib/difflib" - - // Wrapper around gopkg.in/yaml.v3 - "github.com/stretchr/testify/assert/yaml" -) - -//go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=assert -template=assertion_format.go.tmpl" - -// TestingT is an interface wrapper around *testing.T -type TestingT interface { - Errorf(format string, args ...interface{}) -} - -// ComparisonAssertionFunc is a common function prototype when comparing two values. Can be useful -// for table driven tests. -type ComparisonAssertionFunc func(TestingT, interface{}, interface{}, ...interface{}) bool - -// ValueAssertionFunc is a common function prototype when validating a single value. Can be useful -// for table driven tests. -type ValueAssertionFunc func(TestingT, interface{}, ...interface{}) bool - -// BoolAssertionFunc is a common function prototype when validating a bool value. Can be useful -// for table driven tests. -type BoolAssertionFunc func(TestingT, bool, ...interface{}) bool - -// ErrorAssertionFunc is a common function prototype when validating an error value. Can be useful -// for table driven tests. -type ErrorAssertionFunc func(TestingT, error, ...interface{}) bool - -// PanicAssertionFunc is a common function prototype when validating a panic value. Can be useful -// for table driven tests. -type PanicAssertionFunc = func(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool - -// Comparison is a custom function that returns true on success and false on failure -type Comparison func() (success bool) - -/* - Helper functions -*/ - -// ObjectsAreEqual determines if two objects are considered equal. -// -// This function does no assertion of any kind. -func ObjectsAreEqual(expected, actual interface{}) bool { - if expected == nil || actual == nil { - return expected == actual - } - - exp, ok := expected.([]byte) - if !ok { - return reflect.DeepEqual(expected, actual) - } - - act, ok := actual.([]byte) - if !ok { - return false - } - if exp == nil || act == nil { - return exp == nil && act == nil - } - return bytes.Equal(exp, act) -} - -// copyExportedFields iterates downward through nested data structures and creates a copy -// that only contains the exported struct fields. -func copyExportedFields(expected interface{}) interface{} { - if isNil(expected) { - return expected - } - - expectedType := reflect.TypeOf(expected) - expectedKind := expectedType.Kind() - expectedValue := reflect.ValueOf(expected) - - switch expectedKind { - case reflect.Struct: - result := reflect.New(expectedType).Elem() - for i := 0; i < expectedType.NumField(); i++ { - field := expectedType.Field(i) - isExported := field.IsExported() - if isExported { - fieldValue := expectedValue.Field(i) - if isNil(fieldValue) || isNil(fieldValue.Interface()) { - continue - } - newValue := copyExportedFields(fieldValue.Interface()) - result.Field(i).Set(reflect.ValueOf(newValue)) - } - } - return result.Interface() - - case reflect.Ptr: - result := reflect.New(expectedType.Elem()) - unexportedRemoved := copyExportedFields(expectedValue.Elem().Interface()) - result.Elem().Set(reflect.ValueOf(unexportedRemoved)) - return result.Interface() - - case reflect.Array, reflect.Slice: - var result reflect.Value - if expectedKind == reflect.Array { - result = reflect.New(reflect.ArrayOf(expectedValue.Len(), expectedType.Elem())).Elem() - } else { - result = reflect.MakeSlice(expectedType, expectedValue.Len(), expectedValue.Len()) - } - for i := 0; i < expectedValue.Len(); i++ { - index := expectedValue.Index(i) - if isNil(index) { - continue - } - unexportedRemoved := copyExportedFields(index.Interface()) - result.Index(i).Set(reflect.ValueOf(unexportedRemoved)) - } - return result.Interface() - - case reflect.Map: - result := reflect.MakeMap(expectedType) - for _, k := range expectedValue.MapKeys() { - index := expectedValue.MapIndex(k) - unexportedRemoved := copyExportedFields(index.Interface()) - result.SetMapIndex(k, reflect.ValueOf(unexportedRemoved)) - } - return result.Interface() - - default: - return expected - } -} - -// ObjectsExportedFieldsAreEqual determines if the exported (public) fields of two objects are -// considered equal. This comparison of only exported fields is applied recursively to nested data -// structures. -// -// This function does no assertion of any kind. -// -// Deprecated: Use [EqualExportedValues] instead. -func ObjectsExportedFieldsAreEqual(expected, actual interface{}) bool { - expectedCleaned := copyExportedFields(expected) - actualCleaned := copyExportedFields(actual) - return ObjectsAreEqualValues(expectedCleaned, actualCleaned) -} - -// ObjectsAreEqualValues gets whether two objects are equal, or if their -// values are equal. -func ObjectsAreEqualValues(expected, actual interface{}) bool { - if ObjectsAreEqual(expected, actual) { - return true - } - - expectedValue := reflect.ValueOf(expected) - actualValue := reflect.ValueOf(actual) - if !expectedValue.IsValid() || !actualValue.IsValid() { - return false - } - - expectedType := expectedValue.Type() - actualType := actualValue.Type() - if !expectedType.ConvertibleTo(actualType) { - return false - } - - if !isNumericType(expectedType) || !isNumericType(actualType) { - // Attempt comparison after type conversion - return reflect.DeepEqual( - expectedValue.Convert(actualType).Interface(), actual, - ) - } - - // If BOTH values are numeric, there are chances of false positives due - // to overflow or underflow. So, we need to make sure to always convert - // the smaller type to a larger type before comparing. - if expectedType.Size() >= actualType.Size() { - return actualValue.Convert(expectedType).Interface() == expected - } - - return expectedValue.Convert(actualType).Interface() == actual -} - -// isNumericType returns true if the type is one of: -// int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, -// float32, float64, complex64, complex128 -func isNumericType(t reflect.Type) bool { - return t.Kind() >= reflect.Int && t.Kind() <= reflect.Complex128 -} - -/* CallerInfo is necessary because the assert functions use the testing object -internally, causing it to print the file:line of the assert method, rather than where -the problem actually occurred in calling code.*/ - -// CallerInfo returns an array of strings containing the file and line number -// of each stack frame leading from the current test to the assert call that -// failed. -func CallerInfo() []string { - var pc uintptr - var file string - var line int - var name string - - const stackFrameBufferSize = 10 - pcs := make([]uintptr, stackFrameBufferSize) - - callers := []string{} - offset := 1 - - for { - n := runtime.Callers(offset, pcs) - - if n == 0 { - break - } - - frames := runtime.CallersFrames(pcs[:n]) - - for { - frame, more := frames.Next() - pc = frame.PC - file = frame.File - line = frame.Line - - // This is a huge edge case, but it will panic if this is the case, see #180 - if file == "" { - break - } - - f := runtime.FuncForPC(pc) - if f == nil { - break - } - name = f.Name() - - // testing.tRunner is the standard library function that calls - // tests. Subtests are called directly by tRunner, without going through - // the Test/Benchmark/Example function that contains the t.Run calls, so - // with subtests we should break when we hit tRunner, without adding it - // to the list of callers. - if name == "testing.tRunner" { - break - } - - parts := strings.Split(file, "/") - if len(parts) > 1 { - filename := parts[len(parts)-1] - dir := parts[len(parts)-2] - if (dir != "assert" && dir != "mock" && dir != "require") || filename == "mock_test.go" { - callers = append(callers, fmt.Sprintf("%s:%d", file, line)) - } - } - - // Drop the package - dotPos := strings.LastIndexByte(name, '.') - name = name[dotPos+1:] - if isTest(name, "Test") || - isTest(name, "Benchmark") || - isTest(name, "Example") { - break - } - - if !more { - break - } - } - - // Next batch - offset += cap(pcs) - } - - return callers -} - -// Stolen from the `go test` tool. -// isTest tells whether name looks like a test (or benchmark, according to prefix). -// It is a Test (say) if there is a character after Test that is not a lower-case letter. -// We don't want TesticularCancer. -func isTest(name, prefix string) bool { - if !strings.HasPrefix(name, prefix) { - return false - } - if len(name) == len(prefix) { // "Test" is ok - return true - } - r, _ := utf8.DecodeRuneInString(name[len(prefix):]) - return !unicode.IsLower(r) -} - -func messageFromMsgAndArgs(msgAndArgs ...interface{}) string { - if len(msgAndArgs) == 0 || msgAndArgs == nil { - return "" - } - if len(msgAndArgs) == 1 { - msg := msgAndArgs[0] - if msgAsStr, ok := msg.(string); ok { - return msgAsStr - } - return fmt.Sprintf("%+v", msg) - } - if len(msgAndArgs) > 1 { - return fmt.Sprintf(msgAndArgs[0].(string), msgAndArgs[1:]...) - } - return "" -} - -// Aligns the provided message so that all lines after the first line start at the same location as the first line. -// Assumes that the first line starts at the correct location (after carriage return, tab, label, spacer and tab). -// The longestLabelLen parameter specifies the length of the longest label in the output (required because this is the -// basis on which the alignment occurs). -func indentMessageLines(message string, longestLabelLen int) string { - outBuf := new(bytes.Buffer) - - for i, scanner := 0, bufio.NewScanner(strings.NewReader(message)); scanner.Scan(); i++ { - // no need to align first line because it starts at the correct location (after the label) - if i != 0 { - // append alignLen+1 spaces to align with "{{longestLabel}}:" before adding tab - outBuf.WriteString("\n\t" + strings.Repeat(" ", longestLabelLen+1) + "\t") - } - outBuf.WriteString(scanner.Text()) - } - - return outBuf.String() -} - -type failNower interface { - FailNow() -} - -// FailNow fails test -func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - Fail(t, failureMessage, msgAndArgs...) - - // We cannot extend TestingT with FailNow() and - // maintain backwards compatibility, so we fallback - // to panicking when FailNow is not available in - // TestingT. - // See issue #263 - - if t, ok := t.(failNower); ok { - t.FailNow() - } else { - panic("test failed and t is missing `FailNow()`") - } - return false -} - -// Fail reports a failure through -func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - content := []labeledContent{ - {"Error Trace", strings.Join(CallerInfo(), "\n\t\t\t")}, - {"Error", failureMessage}, - } - - // Add test name if the Go version supports it - if n, ok := t.(interface { - Name() string - }); ok { - content = append(content, labeledContent{"Test", n.Name()}) - } - - message := messageFromMsgAndArgs(msgAndArgs...) - if len(message) > 0 { - content = append(content, labeledContent{"Messages", message}) - } - - t.Errorf("\n%s", ""+labeledOutput(content...)) - - return false -} - -type labeledContent struct { - label string - content string -} - -// labeledOutput returns a string consisting of the provided labeledContent. Each labeled output is appended in the following manner: -// -// \t{{label}}:{{align_spaces}}\t{{content}}\n -// -// The initial carriage return is required to undo/erase any padding added by testing.T.Errorf. The "\t{{label}}:" is for the label. -// If a label is shorter than the longest label provided, padding spaces are added to make all the labels match in length. Once this -// alignment is achieved, "\t{{content}}\n" is added for the output. -// -// If the content of the labeledOutput contains line breaks, the subsequent lines are aligned so that they start at the same location as the first line. -func labeledOutput(content ...labeledContent) string { - longestLabel := 0 - for _, v := range content { - if len(v.label) > longestLabel { - longestLabel = len(v.label) - } - } - var output string - for _, v := range content { - output += "\t" + v.label + ":" + strings.Repeat(" ", longestLabel-len(v.label)) + "\t" + indentMessageLines(v.content, longestLabel) + "\n" - } - return output -} - -// Implements asserts that an object is implemented by the specified interface. -// -// assert.Implements(t, (*MyInterface)(nil), new(MyObject)) -func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - interfaceType := reflect.TypeOf(interfaceObject).Elem() - - if object == nil { - return Fail(t, fmt.Sprintf("Cannot check if nil implements %v", interfaceType), msgAndArgs...) - } - if !reflect.TypeOf(object).Implements(interfaceType) { - return Fail(t, fmt.Sprintf("%T must implement %v", object, interfaceType), msgAndArgs...) - } - - return true -} - -// NotImplements asserts that an object does not implement the specified interface. -// -// assert.NotImplements(t, (*MyInterface)(nil), new(MyObject)) -func NotImplements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - interfaceType := reflect.TypeOf(interfaceObject).Elem() - - if object == nil { - return Fail(t, fmt.Sprintf("Cannot check if nil does not implement %v", interfaceType), msgAndArgs...) - } - if reflect.TypeOf(object).Implements(interfaceType) { - return Fail(t, fmt.Sprintf("%T implements %v", object, interfaceType), msgAndArgs...) - } - - return true -} - -func isType(expectedType, object interface{}) bool { - return ObjectsAreEqual(reflect.TypeOf(object), reflect.TypeOf(expectedType)) -} - -// IsType asserts that the specified objects are of the same type. -// -// assert.IsType(t, &MyStruct{}, &MyStruct{}) -func IsType(t TestingT, expectedType, object interface{}, msgAndArgs ...interface{}) bool { - if isType(expectedType, object) { - return true - } - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Fail(t, fmt.Sprintf("Object expected to be of type %T, but was %T", expectedType, object), msgAndArgs...) -} - -// IsNotType asserts that the specified objects are not of the same type. -// -// assert.IsNotType(t, &NotMyStruct{}, &MyStruct{}) -func IsNotType(t TestingT, theType, object interface{}, msgAndArgs ...interface{}) bool { - if !isType(theType, object) { - return true - } - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Fail(t, fmt.Sprintf("Object type expected to be different than %T", theType), msgAndArgs...) -} - -// Equal asserts that two objects are equal. -// -// assert.Equal(t, 123, 123) -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). Function equality -// cannot be determined and will always fail. -func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if err := validateEqualArgs(expected, actual); err != nil { - return Fail(t, fmt.Sprintf("Invalid operation: %#v == %#v (%s)", - expected, actual, err), msgAndArgs...) - } - - if !ObjectsAreEqual(expected, actual) { - diff := diff(expected, actual) - expected, actual = formatUnequalValues(expected, actual) - return Fail(t, fmt.Sprintf("Not equal: \n"+ - "expected: %s\n"+ - "actual : %s%s", expected, actual, diff), msgAndArgs...) - } - - return true -} - -// validateEqualArgs checks whether provided arguments can be safely used in the -// Equal/NotEqual functions. -func validateEqualArgs(expected, actual interface{}) error { - if expected == nil && actual == nil { - return nil - } - - if isFunction(expected) || isFunction(actual) { - return errors.New("cannot take func type as argument") - } - return nil -} - -// Same asserts that two pointers reference the same object. -// -// assert.Same(t, ptr1, ptr2) -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func Same(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - same, ok := samePointers(expected, actual) - if !ok { - return Fail(t, "Both arguments must be pointers", msgAndArgs...) - } - - if !same { - // both are pointers but not the same type & pointing to the same address - return Fail(t, fmt.Sprintf("Not same: \n"+ - "expected: %p %#[1]v\n"+ - "actual : %p %#[2]v", - expected, actual), msgAndArgs...) - } - - return true -} - -// NotSame asserts that two pointers do not reference the same object. -// -// assert.NotSame(t, ptr1, ptr2) -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func NotSame(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - same, ok := samePointers(expected, actual) - if !ok { - // fails when the arguments are not pointers - return !(Fail(t, "Both arguments must be pointers", msgAndArgs...)) - } - - if same { - return Fail(t, fmt.Sprintf( - "Expected and actual point to the same object: %p %#[1]v", - expected), msgAndArgs...) - } - return true -} - -// samePointers checks if two generic interface objects are pointers of the same -// type pointing to the same object. It returns two values: same indicating if -// they are the same type and point to the same object, and ok indicating that -// both inputs are pointers. -func samePointers(first, second interface{}) (same bool, ok bool) { - firstPtr, secondPtr := reflect.ValueOf(first), reflect.ValueOf(second) - if firstPtr.Kind() != reflect.Ptr || secondPtr.Kind() != reflect.Ptr { - return false, false // not both are pointers - } - - firstType, secondType := reflect.TypeOf(first), reflect.TypeOf(second) - if firstType != secondType { - return false, true // both are pointers, but of different types - } - - // compare pointer addresses - return first == second, true -} - -// formatUnequalValues takes two values of arbitrary types and returns string -// representations appropriate to be presented to the user. -// -// If the values are not of like type, the returned strings will be prefixed -// with the type name, and the value will be enclosed in parentheses similar -// to a type conversion in the Go grammar. -func formatUnequalValues(expected, actual interface{}) (e string, a string) { - if reflect.TypeOf(expected) != reflect.TypeOf(actual) { - return fmt.Sprintf("%T(%s)", expected, truncatingFormat(expected)), - fmt.Sprintf("%T(%s)", actual, truncatingFormat(actual)) - } - switch expected.(type) { - case time.Duration: - return fmt.Sprintf("%v", expected), fmt.Sprintf("%v", actual) - } - return truncatingFormat(expected), truncatingFormat(actual) -} - -// truncatingFormat formats the data and truncates it if it's too long. -// -// This helps keep formatted error messages lines from exceeding the -// bufio.MaxScanTokenSize max line length that the go testing framework imposes. -func truncatingFormat(data interface{}) string { - value := fmt.Sprintf("%#v", data) - max := bufio.MaxScanTokenSize - 100 // Give us some space the type info too if needed. - if len(value) > max { - value = value[0:max] + "<... truncated>" - } - return value -} - -// EqualValues asserts that two objects are equal or convertible to the larger -// type and equal. -// -// assert.EqualValues(t, uint32(123), int32(123)) -func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - if !ObjectsAreEqualValues(expected, actual) { - diff := diff(expected, actual) - expected, actual = formatUnequalValues(expected, actual) - return Fail(t, fmt.Sprintf("Not equal: \n"+ - "expected: %s\n"+ - "actual : %s%s", expected, actual, diff), msgAndArgs...) - } - - return true -} - -// EqualExportedValues asserts that the types of two objects are equal and their public -// fields are also equal. This is useful for comparing structs that have private fields -// that could potentially differ. -// -// type S struct { -// Exported int -// notExported int -// } -// assert.EqualExportedValues(t, S{1, 2}, S{1, 3}) => true -// assert.EqualExportedValues(t, S{1, 2}, S{2, 3}) => false -func EqualExportedValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - aType := reflect.TypeOf(expected) - bType := reflect.TypeOf(actual) - - if aType != bType { - return Fail(t, fmt.Sprintf("Types expected to match exactly\n\t%v != %v", aType, bType), msgAndArgs...) - } - - expected = copyExportedFields(expected) - actual = copyExportedFields(actual) - - if !ObjectsAreEqualValues(expected, actual) { - diff := diff(expected, actual) - expected, actual = formatUnequalValues(expected, actual) - return Fail(t, fmt.Sprintf("Not equal (comparing only exported fields): \n"+ - "expected: %s\n"+ - "actual : %s%s", expected, actual, diff), msgAndArgs...) - } - - return true -} - -// Exactly asserts that two objects are equal in value and type. -// -// assert.Exactly(t, int32(123), int64(123)) -func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - aType := reflect.TypeOf(expected) - bType := reflect.TypeOf(actual) - - if aType != bType { - return Fail(t, fmt.Sprintf("Types expected to match exactly\n\t%v != %v", aType, bType), msgAndArgs...) - } - - return Equal(t, expected, actual, msgAndArgs...) -} - -// NotNil asserts that the specified object is not nil. -// -// assert.NotNil(t, err) -func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - if !isNil(object) { - return true - } - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Fail(t, "Expected value not to be nil.", msgAndArgs...) -} - -// isNil checks if a specified object is nil or not, without Failing. -func isNil(object interface{}) bool { - if object == nil { - return true - } - - value := reflect.ValueOf(object) - switch value.Kind() { - case - reflect.Chan, reflect.Func, - reflect.Interface, reflect.Map, - reflect.Ptr, reflect.Slice, reflect.UnsafePointer: - - return value.IsNil() - } - - return false -} - -// Nil asserts that the specified object is nil. -// -// assert.Nil(t, err) -func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - if isNil(object) { - return true - } - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Fail(t, fmt.Sprintf("Expected nil, but got: %#v", object), msgAndArgs...) -} - -// isEmpty gets whether the specified object is considered empty or not. -func isEmpty(object interface{}) bool { - // get nil case out of the way - if object == nil { - return true - } - - return isEmptyValue(reflect.ValueOf(object)) -} - -// isEmptyValue gets whether the specified reflect.Value is considered empty or not. -func isEmptyValue(objValue reflect.Value) bool { - if objValue.IsZero() { - return true - } - // Special cases of non-zero values that we consider empty - switch objValue.Kind() { - // collection types are empty when they have no element - // Note: array types are empty when they match their zero-initialized state. - case reflect.Chan, reflect.Map, reflect.Slice: - return objValue.Len() == 0 - // non-nil pointers are empty if the value they point to is empty - case reflect.Ptr: - return isEmptyValue(objValue.Elem()) - } - return false -} - -// Empty asserts that the given value is "empty". -// -// [Zero values] are "empty". -// -// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). -// -// Slices, maps and channels with zero length are "empty". -// -// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". -// -// assert.Empty(t, obj) -// -// [Zero values]: https://go.dev/ref/spec#The_zero_value -func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - pass := isEmpty(object) - if !pass { - if h, ok := t.(tHelper); ok { - h.Helper() - } - Fail(t, fmt.Sprintf("Should be empty, but was %v", object), msgAndArgs...) - } - - return pass -} - -// NotEmpty asserts that the specified object is NOT [Empty]. -// -// if assert.NotEmpty(t, obj) { -// assert.Equal(t, "two", obj[1]) -// } -func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - pass := !isEmpty(object) - if !pass { - if h, ok := t.(tHelper); ok { - h.Helper() - } - Fail(t, fmt.Sprintf("Should NOT be empty, but was %v", object), msgAndArgs...) - } - - return pass -} - -// getLen tries to get the length of an object. -// It returns (0, false) if impossible. -func getLen(x interface{}) (length int, ok bool) { - v := reflect.ValueOf(x) - defer func() { - ok = recover() == nil - }() - return v.Len(), true -} - -// Len asserts that the specified object has specific length. -// Len also fails if the object has a type that len() not accept. -// -// assert.Len(t, mySlice, 3) -func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - l, ok := getLen(object) - if !ok { - return Fail(t, fmt.Sprintf("\"%v\" could not be applied builtin len()", object), msgAndArgs...) - } - - if l != length { - return Fail(t, fmt.Sprintf("\"%v\" should have %d item(s), but has %d", object, length, l), msgAndArgs...) - } - return true -} - -// True asserts that the specified value is true. -// -// assert.True(t, myBool) -func True(t TestingT, value bool, msgAndArgs ...interface{}) bool { - if !value { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Fail(t, "Should be true", msgAndArgs...) - } - - return true -} - -// False asserts that the specified value is false. -// -// assert.False(t, myBool) -func False(t TestingT, value bool, msgAndArgs ...interface{}) bool { - if value { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Fail(t, "Should be false", msgAndArgs...) - } - - return true -} - -// NotEqual asserts that the specified values are NOT equal. -// -// assert.NotEqual(t, obj1, obj2) -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). -func NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if err := validateEqualArgs(expected, actual); err != nil { - return Fail(t, fmt.Sprintf("Invalid operation: %#v != %#v (%s)", - expected, actual, err), msgAndArgs...) - } - - if ObjectsAreEqual(expected, actual) { - return Fail(t, fmt.Sprintf("Should not be: %#v\n", actual), msgAndArgs...) - } - - return true -} - -// NotEqualValues asserts that two objects are not equal even when converted to the same type -// -// assert.NotEqualValues(t, obj1, obj2) -func NotEqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - if ObjectsAreEqualValues(expected, actual) { - return Fail(t, fmt.Sprintf("Should not be: %#v\n", actual), msgAndArgs...) - } - - return true -} - -// containsElement try loop over the list check if the list includes the element. -// return (false, false) if impossible. -// return (true, false) if element was not found. -// return (true, true) if element was found. -func containsElement(list interface{}, element interface{}) (ok, found bool) { - listValue := reflect.ValueOf(list) - listType := reflect.TypeOf(list) - if listType == nil { - return false, false - } - listKind := listType.Kind() - defer func() { - if e := recover(); e != nil { - ok = false - found = false - } - }() - - if listKind == reflect.String { - elementValue := reflect.ValueOf(element) - return true, strings.Contains(listValue.String(), elementValue.String()) - } - - if listKind == reflect.Map { - mapKeys := listValue.MapKeys() - for i := 0; i < len(mapKeys); i++ { - if ObjectsAreEqual(mapKeys[i].Interface(), element) { - return true, true - } - } - return true, false - } - - for i := 0; i < listValue.Len(); i++ { - if ObjectsAreEqual(listValue.Index(i).Interface(), element) { - return true, true - } - } - return true, false -} - -// Contains asserts that the specified string, list(array, slice...) or map contains the -// specified substring or element. -// -// assert.Contains(t, "Hello World", "World") -// assert.Contains(t, ["Hello", "World"], "World") -// assert.Contains(t, {"Hello": "World"}, "Hello") -func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - ok, found := containsElement(s, contains) - if !ok { - return Fail(t, fmt.Sprintf("%#v could not be applied builtin len()", s), msgAndArgs...) - } - if !found { - return Fail(t, fmt.Sprintf("%#v does not contain %#v", s, contains), msgAndArgs...) - } - - return true -} - -// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the -// specified substring or element. -// -// assert.NotContains(t, "Hello World", "Earth") -// assert.NotContains(t, ["Hello", "World"], "Earth") -// assert.NotContains(t, {"Hello": "World"}, "Earth") -func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - ok, found := containsElement(s, contains) - if !ok { - return Fail(t, fmt.Sprintf("%#v could not be applied builtin len()", s), msgAndArgs...) - } - if found { - return Fail(t, fmt.Sprintf("%#v should not contain %#v", s, contains), msgAndArgs...) - } - - return true -} - -// Subset asserts that the list (array, slice, or map) contains all elements -// given in the subset (array, slice, or map). -// Map elements are key-value pairs unless compared with an array or slice where -// only the map key is evaluated. -// -// assert.Subset(t, [1, 2, 3], [1, 2]) -// assert.Subset(t, {"x": 1, "y": 2}, {"x": 1}) -// assert.Subset(t, [1, 2, 3], {1: "one", 2: "two"}) -// assert.Subset(t, {"x": 1, "y": 2}, ["x"]) -func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if subset == nil { - return true // we consider nil to be equal to the nil set - } - - listKind := reflect.TypeOf(list).Kind() - if listKind != reflect.Array && listKind != reflect.Slice && listKind != reflect.Map { - return Fail(t, fmt.Sprintf("%q has an unsupported type %s", list, listKind), msgAndArgs...) - } - - subsetKind := reflect.TypeOf(subset).Kind() - if subsetKind != reflect.Array && subsetKind != reflect.Slice && subsetKind != reflect.Map { - return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...) - } - - if subsetKind == reflect.Map && listKind == reflect.Map { - subsetMap := reflect.ValueOf(subset) - actualMap := reflect.ValueOf(list) - - for _, k := range subsetMap.MapKeys() { - ev := subsetMap.MapIndex(k) - av := actualMap.MapIndex(k) - - if !av.IsValid() { - return Fail(t, fmt.Sprintf("%#v does not contain %#v", list, subset), msgAndArgs...) - } - if !ObjectsAreEqual(ev.Interface(), av.Interface()) { - return Fail(t, fmt.Sprintf("%#v does not contain %#v", list, subset), msgAndArgs...) - } - } - - return true - } - - subsetList := reflect.ValueOf(subset) - if subsetKind == reflect.Map { - keys := make([]interface{}, subsetList.Len()) - for idx, key := range subsetList.MapKeys() { - keys[idx] = key.Interface() - } - subsetList = reflect.ValueOf(keys) - } - for i := 0; i < subsetList.Len(); i++ { - element := subsetList.Index(i).Interface() - ok, found := containsElement(list, element) - if !ok { - return Fail(t, fmt.Sprintf("%#v could not be applied builtin len()", list), msgAndArgs...) - } - if !found { - return Fail(t, fmt.Sprintf("%#v does not contain %#v", list, element), msgAndArgs...) - } - } - - return true -} - -// NotSubset asserts that the list (array, slice, or map) does NOT contain all -// elements given in the subset (array, slice, or map). -// Map elements are key-value pairs unless compared with an array or slice where -// only the map key is evaluated. -// -// assert.NotSubset(t, [1, 3, 4], [1, 2]) -// assert.NotSubset(t, {"x": 1, "y": 2}, {"z": 3}) -// assert.NotSubset(t, [1, 3, 4], {1: "one", 2: "two"}) -// assert.NotSubset(t, {"x": 1, "y": 2}, ["z"]) -func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if subset == nil { - return Fail(t, "nil is the empty set which is a subset of every set", msgAndArgs...) - } - - listKind := reflect.TypeOf(list).Kind() - if listKind != reflect.Array && listKind != reflect.Slice && listKind != reflect.Map { - return Fail(t, fmt.Sprintf("%q has an unsupported type %s", list, listKind), msgAndArgs...) - } - - subsetKind := reflect.TypeOf(subset).Kind() - if subsetKind != reflect.Array && subsetKind != reflect.Slice && subsetKind != reflect.Map { - return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...) - } - - if subsetKind == reflect.Map && listKind == reflect.Map { - subsetMap := reflect.ValueOf(subset) - actualMap := reflect.ValueOf(list) - - for _, k := range subsetMap.MapKeys() { - ev := subsetMap.MapIndex(k) - av := actualMap.MapIndex(k) - - if !av.IsValid() { - return true - } - if !ObjectsAreEqual(ev.Interface(), av.Interface()) { - return true - } - } - - return Fail(t, fmt.Sprintf("%q is a subset of %q", subset, list), msgAndArgs...) - } - - subsetList := reflect.ValueOf(subset) - if subsetKind == reflect.Map { - keys := make([]interface{}, subsetList.Len()) - for idx, key := range subsetList.MapKeys() { - keys[idx] = key.Interface() - } - subsetList = reflect.ValueOf(keys) - } - for i := 0; i < subsetList.Len(); i++ { - element := subsetList.Index(i).Interface() - ok, found := containsElement(list, element) - if !ok { - return Fail(t, fmt.Sprintf("%q could not be applied builtin len()", list), msgAndArgs...) - } - if !found { - return true - } - } - - return Fail(t, fmt.Sprintf("%q is a subset of %q", subset, list), msgAndArgs...) -} - -// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified -// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, -// the number of appearances of each of them in both lists should match. -// -// assert.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2]) -func ElementsMatch(t TestingT, listA, listB interface{}, msgAndArgs ...interface{}) (ok bool) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if isEmpty(listA) && isEmpty(listB) { - return true - } - - if !isList(t, listA, msgAndArgs...) || !isList(t, listB, msgAndArgs...) { - return false - } - - extraA, extraB := diffLists(listA, listB) - - if len(extraA) == 0 && len(extraB) == 0 { - return true - } - - return Fail(t, formatListDiff(listA, listB, extraA, extraB), msgAndArgs...) -} - -// isList checks that the provided value is array or slice. -func isList(t TestingT, list interface{}, msgAndArgs ...interface{}) (ok bool) { - kind := reflect.TypeOf(list).Kind() - if kind != reflect.Array && kind != reflect.Slice { - return Fail(t, fmt.Sprintf("%q has an unsupported type %s, expecting array or slice", list, kind), - msgAndArgs...) - } - return true -} - -// diffLists diffs two arrays/slices and returns slices of elements that are only in A and only in B. -// If some element is present multiple times, each instance is counted separately (e.g. if something is 2x in A and -// 5x in B, it will be 0x in extraA and 3x in extraB). The order of items in both lists is ignored. -func diffLists(listA, listB interface{}) (extraA, extraB []interface{}) { - aValue := reflect.ValueOf(listA) - bValue := reflect.ValueOf(listB) - - aLen := aValue.Len() - bLen := bValue.Len() - - // Mark indexes in bValue that we already used - visited := make([]bool, bLen) - for i := 0; i < aLen; i++ { - element := aValue.Index(i).Interface() - found := false - for j := 0; j < bLen; j++ { - if visited[j] { - continue - } - if ObjectsAreEqual(bValue.Index(j).Interface(), element) { - visited[j] = true - found = true - break - } - } - if !found { - extraA = append(extraA, element) - } - } - - for j := 0; j < bLen; j++ { - if visited[j] { - continue - } - extraB = append(extraB, bValue.Index(j).Interface()) - } - - return -} - -func formatListDiff(listA, listB interface{}, extraA, extraB []interface{}) string { - var msg bytes.Buffer - - msg.WriteString("elements differ") - if len(extraA) > 0 { - msg.WriteString("\n\nextra elements in list A:\n") - msg.WriteString(spewConfig.Sdump(extraA)) - } - if len(extraB) > 0 { - msg.WriteString("\n\nextra elements in list B:\n") - msg.WriteString(spewConfig.Sdump(extraB)) - } - msg.WriteString("\n\nlistA:\n") - msg.WriteString(spewConfig.Sdump(listA)) - msg.WriteString("\n\nlistB:\n") - msg.WriteString(spewConfig.Sdump(listB)) - - return msg.String() -} - -// NotElementsMatch asserts that the specified listA(array, slice...) is NOT equal to specified -// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, -// the number of appearances of each of them in both lists should not match. -// This is an inverse of ElementsMatch. -// -// assert.NotElementsMatch(t, [1, 1, 2, 3], [1, 1, 2, 3]) -> false -// -// assert.NotElementsMatch(t, [1, 1, 2, 3], [1, 2, 3]) -> true -// -// assert.NotElementsMatch(t, [1, 2, 3], [1, 2, 4]) -> true -func NotElementsMatch(t TestingT, listA, listB interface{}, msgAndArgs ...interface{}) (ok bool) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if isEmpty(listA) && isEmpty(listB) { - return Fail(t, "listA and listB contain the same elements", msgAndArgs) - } - - if !isList(t, listA, msgAndArgs...) { - return Fail(t, "listA is not a list type", msgAndArgs...) - } - if !isList(t, listB, msgAndArgs...) { - return Fail(t, "listB is not a list type", msgAndArgs...) - } - - extraA, extraB := diffLists(listA, listB) - if len(extraA) == 0 && len(extraB) == 0 { - return Fail(t, "listA and listB contain the same elements", msgAndArgs) - } - - return true -} - -// Condition uses a Comparison to assert a complex condition. -func Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - result := comp() - if !result { - Fail(t, "Condition failed!", msgAndArgs...) - } - return result -} - -// PanicTestFunc defines a func that should be passed to the assert.Panics and assert.NotPanics -// methods, and represents a simple func that takes no arguments, and returns nothing. -type PanicTestFunc func() - -// didPanic returns true if the function passed to it panics. Otherwise, it returns false. -func didPanic(f PanicTestFunc) (didPanic bool, message interface{}, stack string) { - didPanic = true - - defer func() { - message = recover() - if didPanic { - stack = string(debug.Stack()) - } - }() - - // call the target function - f() - didPanic = false - - return -} - -// Panics asserts that the code inside the specified PanicTestFunc panics. -// -// assert.Panics(t, func(){ GoCrazy() }) -func Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - if funcDidPanic, panicValue, _ := didPanic(f); !funcDidPanic { - return Fail(t, fmt.Sprintf("func %#v should panic\n\tPanic value:\t%#v", f, panicValue), msgAndArgs...) - } - - return true -} - -// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that -// the recovered panic value equals the expected panic value. -// -// assert.PanicsWithValue(t, "crazy error", func(){ GoCrazy() }) -func PanicsWithValue(t TestingT, expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - funcDidPanic, panicValue, panickedStack := didPanic(f) - if !funcDidPanic { - return Fail(t, fmt.Sprintf("func %#v should panic\n\tPanic value:\t%#v", f, panicValue), msgAndArgs...) - } - if panicValue != expected { - return Fail(t, fmt.Sprintf("func %#v should panic with value:\t%#v\n\tPanic value:\t%#v\n\tPanic stack:\t%s", f, expected, panicValue, panickedStack), msgAndArgs...) - } - - return true -} - -// PanicsWithError asserts that the code inside the specified PanicTestFunc -// panics, and that the recovered panic value is an error that satisfies the -// EqualError comparison. -// -// assert.PanicsWithError(t, "crazy error", func(){ GoCrazy() }) -func PanicsWithError(t TestingT, errString string, f PanicTestFunc, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - funcDidPanic, panicValue, panickedStack := didPanic(f) - if !funcDidPanic { - return Fail(t, fmt.Sprintf("func %#v should panic\n\tPanic value:\t%#v", f, panicValue), msgAndArgs...) - } - panicErr, ok := panicValue.(error) - if !ok || panicErr.Error() != errString { - return Fail(t, fmt.Sprintf("func %#v should panic with error message:\t%#v\n\tPanic value:\t%#v\n\tPanic stack:\t%s", f, errString, panicValue, panickedStack), msgAndArgs...) - } - - return true -} - -// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. -// -// assert.NotPanics(t, func(){ RemainCalm() }) -func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - if funcDidPanic, panicValue, panickedStack := didPanic(f); funcDidPanic { - return Fail(t, fmt.Sprintf("func %#v should not panic\n\tPanic value:\t%v\n\tPanic stack:\t%s", f, panicValue, panickedStack), msgAndArgs...) - } - - return true -} - -// WithinDuration asserts that the two times are within duration delta of each other. -// -// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second) -func WithinDuration(t TestingT, expected, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - dt := expected.Sub(actual) - if dt < -delta || dt > delta { - return Fail(t, fmt.Sprintf("Max difference between %v and %v allowed is %v, but difference was %v", expected, actual, delta, dt), msgAndArgs...) - } - - return true -} - -// WithinRange asserts that a time is within a time range (inclusive). -// -// assert.WithinRange(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second)) -func WithinRange(t TestingT, actual, start, end time.Time, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - if end.Before(start) { - return Fail(t, "Start should be before end", msgAndArgs...) - } - - if actual.Before(start) { - return Fail(t, fmt.Sprintf("Time %v expected to be in time range %v to %v, but is before the range", actual, start, end), msgAndArgs...) - } else if actual.After(end) { - return Fail(t, fmt.Sprintf("Time %v expected to be in time range %v to %v, but is after the range", actual, start, end), msgAndArgs...) - } - - return true -} - -func toFloat(x interface{}) (float64, bool) { - var xf float64 - xok := true - - switch xn := x.(type) { - case uint: - xf = float64(xn) - case uint8: - xf = float64(xn) - case uint16: - xf = float64(xn) - case uint32: - xf = float64(xn) - case uint64: - xf = float64(xn) - case int: - xf = float64(xn) - case int8: - xf = float64(xn) - case int16: - xf = float64(xn) - case int32: - xf = float64(xn) - case int64: - xf = float64(xn) - case float32: - xf = float64(xn) - case float64: - xf = xn - case time.Duration: - xf = float64(xn) - default: - xok = false - } - - return xf, xok -} - -// InDelta asserts that the two numerals are within delta of each other. -// -// assert.InDelta(t, math.Pi, 22/7.0, 0.01) -func InDelta(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - af, aok := toFloat(expected) - bf, bok := toFloat(actual) - - if !aok || !bok { - return Fail(t, "Parameters must be numerical", msgAndArgs...) - } - - if math.IsNaN(af) && math.IsNaN(bf) { - return true - } - - if math.IsNaN(af) { - return Fail(t, "Expected must not be NaN", msgAndArgs...) - } - - if math.IsNaN(bf) { - return Fail(t, fmt.Sprintf("Expected %v with delta %v, but was NaN", expected, delta), msgAndArgs...) - } - - dt := af - bf - if dt < -delta || dt > delta { - return Fail(t, fmt.Sprintf("Max difference between %v and %v allowed is %v, but difference was %v", expected, actual, delta, dt), msgAndArgs...) - } - - return true -} - -// InDeltaSlice is the same as InDelta, except it compares two slices. -func InDeltaSlice(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if expected == nil || actual == nil || - reflect.TypeOf(actual).Kind() != reflect.Slice || - reflect.TypeOf(expected).Kind() != reflect.Slice { - return Fail(t, "Parameters must be slice", msgAndArgs...) - } - - actualSlice := reflect.ValueOf(actual) - expectedSlice := reflect.ValueOf(expected) - - for i := 0; i < actualSlice.Len(); i++ { - result := InDelta(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), delta, msgAndArgs...) - if !result { - return result - } - } - - return true -} - -// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. -func InDeltaMapValues(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if expected == nil || actual == nil || - reflect.TypeOf(actual).Kind() != reflect.Map || - reflect.TypeOf(expected).Kind() != reflect.Map { - return Fail(t, "Arguments must be maps", msgAndArgs...) - } - - expectedMap := reflect.ValueOf(expected) - actualMap := reflect.ValueOf(actual) - - if expectedMap.Len() != actualMap.Len() { - return Fail(t, "Arguments must have the same number of keys", msgAndArgs...) - } - - for _, k := range expectedMap.MapKeys() { - ev := expectedMap.MapIndex(k) - av := actualMap.MapIndex(k) - - if !ev.IsValid() { - return Fail(t, fmt.Sprintf("missing key %q in expected map", k), msgAndArgs...) - } - - if !av.IsValid() { - return Fail(t, fmt.Sprintf("missing key %q in actual map", k), msgAndArgs...) - } - - if !InDelta( - t, - ev.Interface(), - av.Interface(), - delta, - msgAndArgs..., - ) { - return false - } - } - - return true -} - -func calcRelativeError(expected, actual interface{}) (float64, error) { - af, aok := toFloat(expected) - bf, bok := toFloat(actual) - if !aok || !bok { - return 0, fmt.Errorf("Parameters must be numerical") - } - if math.IsNaN(af) && math.IsNaN(bf) { - return 0, nil - } - if math.IsNaN(af) { - return 0, errors.New("expected value must not be NaN") - } - if af == 0 { - return 0, fmt.Errorf("expected value must have a value other than zero to calculate the relative error") - } - if math.IsNaN(bf) { - return 0, errors.New("actual value must not be NaN") - } - - return math.Abs(af-bf) / math.Abs(af), nil -} - -// InEpsilon asserts that expected and actual have a relative error less than epsilon -func InEpsilon(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if math.IsNaN(epsilon) { - return Fail(t, "epsilon must not be NaN", msgAndArgs...) - } - actualEpsilon, err := calcRelativeError(expected, actual) - if err != nil { - return Fail(t, err.Error(), msgAndArgs...) - } - if math.IsNaN(actualEpsilon) { - return Fail(t, "relative error is NaN", msgAndArgs...) - } - if actualEpsilon > epsilon { - return Fail(t, fmt.Sprintf("Relative error is too high: %#v (expected)\n"+ - " < %#v (actual)", epsilon, actualEpsilon), msgAndArgs...) - } - - return true -} - -// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices. -func InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - if expected == nil || actual == nil { - return Fail(t, "Parameters must be slice", msgAndArgs...) - } - - expectedSlice := reflect.ValueOf(expected) - actualSlice := reflect.ValueOf(actual) - - if expectedSlice.Type().Kind() != reflect.Slice { - return Fail(t, "Expected value must be slice", msgAndArgs...) - } - - expectedLen := expectedSlice.Len() - if !IsType(t, expected, actual) || !Len(t, actual, expectedLen) { - return false - } - - for i := 0; i < expectedLen; i++ { - if !InEpsilon(t, expectedSlice.Index(i).Interface(), actualSlice.Index(i).Interface(), epsilon, "at index %d", i) { - return false - } - } - - return true -} - -/* - Errors -*/ - -// NoError asserts that a function returned no error (i.e. `nil`). -// -// actualObj, err := SomeFunction() -// if assert.NoError(t, err) { -// assert.Equal(t, expectedObj, actualObj) -// } -func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool { - if err != nil { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Fail(t, fmt.Sprintf("Received unexpected error:\n%+v", err), msgAndArgs...) - } - - return true -} - -// Error asserts that a function returned an error (i.e. not `nil`). -// -// actualObj, err := SomeFunction() -// assert.Error(t, err) -func Error(t TestingT, err error, msgAndArgs ...interface{}) bool { - if err == nil { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Fail(t, "An error is expected but got nil.", msgAndArgs...) - } - - return true -} - -// EqualError asserts that a function returned an error (i.e. not `nil`) -// and that it is equal to the provided error. -// -// actualObj, err := SomeFunction() -// assert.EqualError(t, err, expectedErrorString) -func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if !Error(t, theError, msgAndArgs...) { - return false - } - expected := errString - actual := theError.Error() - // don't need to use deep equals here, we know they are both strings - if expected != actual { - return Fail(t, fmt.Sprintf("Error message not equal:\n"+ - "expected: %q\n"+ - "actual : %q", expected, actual), msgAndArgs...) - } - return true -} - -// ErrorContains asserts that a function returned an error (i.e. not `nil`) -// and that the error contains the specified substring. -// -// actualObj, err := SomeFunction() -// assert.ErrorContains(t, err, expectedErrorSubString) -func ErrorContains(t TestingT, theError error, contains string, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if !Error(t, theError, msgAndArgs...) { - return false - } - - actual := theError.Error() - if !strings.Contains(actual, contains) { - return Fail(t, fmt.Sprintf("Error %#v does not contain %#v", actual, contains), msgAndArgs...) - } - - return true -} - -// matchRegexp return true if a specified regexp matches a string. -func matchRegexp(rx interface{}, str interface{}) bool { - var r *regexp.Regexp - if rr, ok := rx.(*regexp.Regexp); ok { - r = rr - } else { - r = regexp.MustCompile(fmt.Sprint(rx)) - } - - switch v := str.(type) { - case []byte: - return r.Match(v) - case string: - return r.MatchString(v) - default: - return r.MatchString(fmt.Sprint(v)) - } -} - -// Regexp asserts that a specified regexp matches a string. -// -// assert.Regexp(t, regexp.MustCompile("start"), "it's starting") -// assert.Regexp(t, "start...$", "it's not starting") -func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - match := matchRegexp(rx, str) - - if !match { - Fail(t, fmt.Sprintf("Expect \"%v\" to match \"%v\"", str, rx), msgAndArgs...) - } - - return match -} - -// NotRegexp asserts that a specified regexp does not match a string. -// -// assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting") -// assert.NotRegexp(t, "^start", "it's not starting") -func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - match := matchRegexp(rx, str) - - if match { - Fail(t, fmt.Sprintf("Expect \"%v\" to NOT match \"%v\"", str, rx), msgAndArgs...) - } - - return !match -} - -// Zero asserts that i is the zero value for its type. -func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if i != nil && !reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) { - return Fail(t, fmt.Sprintf("Should be zero, but was %v", i), msgAndArgs...) - } - return true -} - -// NotZero asserts that i is not the zero value for its type. -func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if i == nil || reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) { - return Fail(t, fmt.Sprintf("Should not be zero, but was %v", i), msgAndArgs...) - } - return true -} - -// FileExists checks whether a file exists in the given path. It also fails if -// the path points to a directory or there is an error when trying to check the file. -func FileExists(t TestingT, path string, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - info, err := os.Lstat(path) - if err != nil { - if os.IsNotExist(err) { - return Fail(t, fmt.Sprintf("unable to find file %q", path), msgAndArgs...) - } - return Fail(t, fmt.Sprintf("error when running os.Lstat(%q): %s", path, err), msgAndArgs...) - } - if info.IsDir() { - return Fail(t, fmt.Sprintf("%q is a directory", path), msgAndArgs...) - } - return true -} - -// NoFileExists checks whether a file does not exist in a given path. It fails -// if the path points to an existing _file_ only. -func NoFileExists(t TestingT, path string, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - info, err := os.Lstat(path) - if err != nil { - return true - } - if info.IsDir() { - return true - } - return Fail(t, fmt.Sprintf("file %q exists", path), msgAndArgs...) -} - -// DirExists checks whether a directory exists in the given path. It also fails -// if the path is a file rather a directory or there is an error checking whether it exists. -func DirExists(t TestingT, path string, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - info, err := os.Lstat(path) - if err != nil { - if os.IsNotExist(err) { - return Fail(t, fmt.Sprintf("unable to find file %q", path), msgAndArgs...) - } - return Fail(t, fmt.Sprintf("error when running os.Lstat(%q): %s", path, err), msgAndArgs...) - } - if !info.IsDir() { - return Fail(t, fmt.Sprintf("%q is a file", path), msgAndArgs...) - } - return true -} - -// NoDirExists checks whether a directory does not exist in the given path. -// It fails if the path points to an existing _directory_ only. -func NoDirExists(t TestingT, path string, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - info, err := os.Lstat(path) - if err != nil { - if os.IsNotExist(err) { - return true - } - return true - } - if !info.IsDir() { - return true - } - return Fail(t, fmt.Sprintf("directory %q exists", path), msgAndArgs...) -} - -// JSONEq asserts that two JSON strings are equivalent. -// -// assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) -func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - var expectedJSONAsInterface, actualJSONAsInterface interface{} - - if err := json.Unmarshal([]byte(expected), &expectedJSONAsInterface); err != nil { - return Fail(t, fmt.Sprintf("Expected value ('%s') is not valid json.\nJSON parsing error: '%s'", expected, err.Error()), msgAndArgs...) - } - - // Shortcut if same bytes - if actual == expected { - return true - } - - if err := json.Unmarshal([]byte(actual), &actualJSONAsInterface); err != nil { - return Fail(t, fmt.Sprintf("Input ('%s') needs to be valid json.\nJSON parsing error: '%s'", actual, err.Error()), msgAndArgs...) - } - - return Equal(t, expectedJSONAsInterface, actualJSONAsInterface, msgAndArgs...) -} - -// YAMLEq asserts that two YAML strings are equivalent. -func YAMLEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - var expectedYAMLAsInterface, actualYAMLAsInterface interface{} - - if err := yaml.Unmarshal([]byte(expected), &expectedYAMLAsInterface); err != nil { - return Fail(t, fmt.Sprintf("Expected value ('%s') is not valid yaml.\nYAML parsing error: '%s'", expected, err.Error()), msgAndArgs...) - } - - // Shortcut if same bytes - if actual == expected { - return true - } - - if err := yaml.Unmarshal([]byte(actual), &actualYAMLAsInterface); err != nil { - return Fail(t, fmt.Sprintf("Input ('%s') needs to be valid yaml.\nYAML error: '%s'", actual, err.Error()), msgAndArgs...) - } - - return Equal(t, expectedYAMLAsInterface, actualYAMLAsInterface, msgAndArgs...) -} - -func typeAndKind(v interface{}) (reflect.Type, reflect.Kind) { - t := reflect.TypeOf(v) - k := t.Kind() - - if k == reflect.Ptr { - t = t.Elem() - k = t.Kind() - } - return t, k -} - -// diff returns a diff of both values as long as both are of the same type and -// are a struct, map, slice, array or string. Otherwise it returns an empty string. -func diff(expected interface{}, actual interface{}) string { - if expected == nil || actual == nil { - return "" - } - - et, ek := typeAndKind(expected) - at, _ := typeAndKind(actual) - - if et != at { - return "" - } - - if ek != reflect.Struct && ek != reflect.Map && ek != reflect.Slice && ek != reflect.Array && ek != reflect.String { - return "" - } - - var e, a string - - switch et { - case reflect.TypeOf(""): - e = reflect.ValueOf(expected).String() - a = reflect.ValueOf(actual).String() - case reflect.TypeOf(time.Time{}): - e = spewConfigStringerEnabled.Sdump(expected) - a = spewConfigStringerEnabled.Sdump(actual) - default: - e = spewConfig.Sdump(expected) - a = spewConfig.Sdump(actual) - } - - diff, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{ - A: difflib.SplitLines(e), - B: difflib.SplitLines(a), - FromFile: "Expected", - FromDate: "", - ToFile: "Actual", - ToDate: "", - Context: 1, - }) - - return "\n\nDiff:\n" + diff -} - -func isFunction(arg interface{}) bool { - if arg == nil { - return false - } - return reflect.TypeOf(arg).Kind() == reflect.Func -} - -var spewConfig = spew.ConfigState{ - Indent: " ", - DisablePointerAddresses: true, - DisableCapacities: true, - SortKeys: true, - DisableMethods: true, - MaxDepth: 10, -} - -var spewConfigStringerEnabled = spew.ConfigState{ - Indent: " ", - DisablePointerAddresses: true, - DisableCapacities: true, - SortKeys: true, - MaxDepth: 10, -} - -type tHelper = interface { - Helper() -} - -// Eventually asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. -// -// assert.Eventually(t, func() bool { return true; }, time.Second, 10*time.Millisecond) -func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - ch := make(chan bool, 1) - checkCond := func() { ch <- condition() } - - timer := time.NewTimer(waitFor) - defer timer.Stop() - - ticker := time.NewTicker(tick) - defer ticker.Stop() - - var tickC <-chan time.Time - - // Check the condition once first on the initial call. - go checkCond() - - for { - select { - case <-timer.C: - return Fail(t, "Condition never satisfied", msgAndArgs...) - case <-tickC: - tickC = nil - go checkCond() - case v := <-ch: - if v { - return true - } - tickC = ticker.C - } - } -} - -// CollectT implements the TestingT interface and collects all errors. -type CollectT struct { - // A slice of errors. Non-nil slice denotes a failure. - // If it's non-nil but len(c.errors) == 0, this is also a failure - // obtained by direct c.FailNow() call. - errors []error -} - -// Helper is like [testing.T.Helper] but does nothing. -func (CollectT) Helper() {} - -// Errorf collects the error. -func (c *CollectT) Errorf(format string, args ...interface{}) { - c.errors = append(c.errors, fmt.Errorf(format, args...)) -} - -// FailNow stops execution by calling runtime.Goexit. -func (c *CollectT) FailNow() { - c.fail() - runtime.Goexit() -} - -// Deprecated: That was a method for internal usage that should not have been published. Now just panics. -func (*CollectT) Reset() { - panic("Reset() is deprecated") -} - -// Deprecated: That was a method for internal usage that should not have been published. Now just panics. -func (*CollectT) Copy(TestingT) { - panic("Copy() is deprecated") -} - -func (c *CollectT) fail() { - if !c.failed() { - c.errors = []error{} // Make it non-nil to mark a failure. - } -} - -func (c *CollectT) failed() bool { - return c.errors != nil -} - -// EventuallyWithT asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. In contrast to Eventually, -// it supplies a CollectT to the condition function, so that the condition -// function can use the CollectT to call other assertions. -// The condition is considered "met" if no errors are raised in a tick. -// The supplied CollectT collects all errors from one tick (if there are any). -// If the condition is not met before waitFor, the collected errors of -// the last tick are copied to t. -// -// externalValue := false -// go func() { -// time.Sleep(8*time.Second) -// externalValue = true -// }() -// assert.EventuallyWithT(t, func(c *assert.CollectT) { -// // add assertions as needed; any assertion failure will fail the current tick -// assert.True(c, externalValue, "expected 'externalValue' to be true") -// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false") -func EventuallyWithT(t TestingT, condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - var lastFinishedTickErrs []error - ch := make(chan *CollectT, 1) - - checkCond := func() { - collect := new(CollectT) - defer func() { - ch <- collect - }() - condition(collect) - } - - timer := time.NewTimer(waitFor) - defer timer.Stop() - - ticker := time.NewTicker(tick) - defer ticker.Stop() - - var tickC <-chan time.Time - - // Check the condition once first on the initial call. - go checkCond() - - for { - select { - case <-timer.C: - for _, err := range lastFinishedTickErrs { - t.Errorf("%v", err) - } - return Fail(t, "Condition never satisfied", msgAndArgs...) - case <-tickC: - tickC = nil - go checkCond() - case collect := <-ch: - if !collect.failed() { - return true - } - // Keep the errors from the last ended condition, so that they can be copied to t if timeout is reached. - lastFinishedTickErrs = collect.errors - tickC = ticker.C - } - } -} - -// Never asserts that the given condition doesn't satisfy in waitFor time, -// periodically checking the target function each tick. -// -// assert.Never(t, func() bool { return false; }, time.Second, 10*time.Millisecond) -func Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - ch := make(chan bool, 1) - checkCond := func() { ch <- condition() } - - timer := time.NewTimer(waitFor) - defer timer.Stop() - - ticker := time.NewTicker(tick) - defer ticker.Stop() - - var tickC <-chan time.Time - - // Check the condition once first on the initial call. - go checkCond() - - for { - select { - case <-timer.C: - return true - case <-tickC: - tickC = nil - go checkCond() - case v := <-ch: - if v { - return Fail(t, "Condition satisfied", msgAndArgs...) - } - tickC = ticker.C - } - } -} - -// ErrorIs asserts that at least one of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func ErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if errors.Is(err, target) { - return true - } - - var expectedText string - if target != nil { - expectedText = target.Error() - if err == nil { - return Fail(t, fmt.Sprintf("Expected error with %q in chain but got nil.", expectedText), msgAndArgs...) - } - } - - chain := buildErrorChainString(err, false) - - return Fail(t, fmt.Sprintf("Target error should be in err chain:\n"+ - "expected: %q\n"+ - "in chain: %s", expectedText, chain, - ), msgAndArgs...) -} - -// NotErrorIs asserts that none of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func NotErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if !errors.Is(err, target) { - return true - } - - var expectedText string - if target != nil { - expectedText = target.Error() - } - - chain := buildErrorChainString(err, false) - - return Fail(t, fmt.Sprintf("Target error should not be in err chain:\n"+ - "found: %q\n"+ - "in chain: %s", expectedText, chain, - ), msgAndArgs...) -} - -// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. -// This is a wrapper for errors.As. -func ErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if errors.As(err, target) { - return true - } - - expectedType := reflect.TypeOf(target).Elem().String() - if err == nil { - return Fail(t, fmt.Sprintf("An error is expected but got nil.\n"+ - "expected: %s", expectedType), msgAndArgs...) - } - - chain := buildErrorChainString(err, true) - - return Fail(t, fmt.Sprintf("Should be in error chain:\n"+ - "expected: %s\n"+ - "in chain: %s", expectedType, chain, - ), msgAndArgs...) -} - -// NotErrorAs asserts that none of the errors in err's chain matches target, -// but if so, sets target to that error value. -func NotErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if !errors.As(err, target) { - return true - } - - chain := buildErrorChainString(err, true) - - return Fail(t, fmt.Sprintf("Target error should not be in err chain:\n"+ - "found: %s\n"+ - "in chain: %s", reflect.TypeOf(target).Elem().String(), chain, - ), msgAndArgs...) -} - -func unwrapAll(err error) (errs []error) { - errs = append(errs, err) - switch x := err.(type) { - case interface{ Unwrap() error }: - err = x.Unwrap() - if err == nil { - return - } - errs = append(errs, unwrapAll(err)...) - case interface{ Unwrap() []error }: - for _, err := range x.Unwrap() { - errs = append(errs, unwrapAll(err)...) - } - } - return -} - -func buildErrorChainString(err error, withType bool) string { - if err == nil { - return "" - } - - var chain string - errs := unwrapAll(err) - for i := range errs { - if i != 0 { - chain += "\n\t" - } - chain += fmt.Sprintf("%q", errs[i].Error()) - if withType { - chain += fmt.Sprintf(" (%T)", errs[i]) - } - } - return chain -} diff --git a/vendor/github.com/stretchr/testify/assert/doc.go b/vendor/github.com/stretchr/testify/assert/doc.go deleted file mode 100644 index a0b953aa..00000000 --- a/vendor/github.com/stretchr/testify/assert/doc.go +++ /dev/null @@ -1,50 +0,0 @@ -// Package assert provides a set of comprehensive testing tools for use with the normal Go testing system. -// -// # Note -// -// All functions in this package return a bool value indicating whether the assertion has passed. -// -// # Example Usage -// -// The following is a complete example using assert in a standard test function: -// -// import ( -// "testing" -// "github.com/stretchr/testify/assert" -// ) -// -// func TestSomething(t *testing.T) { -// -// var a string = "Hello" -// var b string = "Hello" -// -// assert.Equal(t, a, b, "The two words should be the same.") -// -// } -// -// if you assert many times, use the format below: -// -// import ( -// "testing" -// "github.com/stretchr/testify/assert" -// ) -// -// func TestSomething(t *testing.T) { -// assert := assert.New(t) -// -// var a string = "Hello" -// var b string = "Hello" -// -// assert.Equal(a, b, "The two words should be the same.") -// } -// -// # Assertions -// -// Assertions allow you to easily write test code, and are global funcs in the `assert` package. -// All assertion functions take, as the first argument, the `*testing.T` object provided by the -// testing framework. This allows the assertion funcs to write the failings and other details to -// the correct place. -// -// Every assertion function also takes an optional string message as the final argument, -// allowing custom error messages to be appended to the message the assertion method outputs. -package assert diff --git a/vendor/github.com/stretchr/testify/assert/errors.go b/vendor/github.com/stretchr/testify/assert/errors.go deleted file mode 100644 index ac9dc9d1..00000000 --- a/vendor/github.com/stretchr/testify/assert/errors.go +++ /dev/null @@ -1,10 +0,0 @@ -package assert - -import ( - "errors" -) - -// AnError is an error instance useful for testing. If the code does not care -// about error specifics, and only needs to return the error for example, this -// error should be used to make the test code more readable. -var AnError = errors.New("assert.AnError general error for testing") diff --git a/vendor/github.com/stretchr/testify/assert/forward_assertions.go b/vendor/github.com/stretchr/testify/assert/forward_assertions.go deleted file mode 100644 index df189d23..00000000 --- a/vendor/github.com/stretchr/testify/assert/forward_assertions.go +++ /dev/null @@ -1,16 +0,0 @@ -package assert - -// Assertions provides assertion methods around the -// TestingT interface. -type Assertions struct { - t TestingT -} - -// New makes a new Assertions object for the specified TestingT. -func New(t TestingT) *Assertions { - return &Assertions{ - t: t, - } -} - -//go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=assert -template=assertion_forward.go.tmpl -include-format-funcs" diff --git a/vendor/github.com/stretchr/testify/assert/http_assertions.go b/vendor/github.com/stretchr/testify/assert/http_assertions.go deleted file mode 100644 index 5a6bb75f..00000000 --- a/vendor/github.com/stretchr/testify/assert/http_assertions.go +++ /dev/null @@ -1,165 +0,0 @@ -package assert - -import ( - "fmt" - "net/http" - "net/http/httptest" - "net/url" - "strings" -) - -// httpCode is a helper that returns HTTP code of the response. It returns -1 and -// an error if building a new request fails. -func httpCode(handler http.HandlerFunc, method, url string, values url.Values) (int, error) { - w := httptest.NewRecorder() - req, err := http.NewRequest(method, url, http.NoBody) - if err != nil { - return -1, err - } - req.URL.RawQuery = values.Encode() - handler(w, req) - return w.Code, nil -} - -// HTTPSuccess asserts that a specified handler returns a success status code. -// -// assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil) -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - code, err := httpCode(handler, method, url, values) - if err != nil { - Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...) - } - - isSuccessCode := code >= http.StatusOK && code <= http.StatusPartialContent - if !isSuccessCode { - Fail(t, fmt.Sprintf("Expected HTTP success status code for %q but received %d", url+"?"+values.Encode(), code), msgAndArgs...) - } - - return isSuccessCode -} - -// HTTPRedirect asserts that a specified handler returns a redirect status code. -// -// assert.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - code, err := httpCode(handler, method, url, values) - if err != nil { - Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...) - } - - isRedirectCode := code >= http.StatusMultipleChoices && code <= http.StatusTemporaryRedirect - if !isRedirectCode { - Fail(t, fmt.Sprintf("Expected HTTP redirect status code for %q but received %d", url+"?"+values.Encode(), code), msgAndArgs...) - } - - return isRedirectCode -} - -// HTTPError asserts that a specified handler returns an error status code. -// -// assert.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - code, err := httpCode(handler, method, url, values) - if err != nil { - Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...) - } - - isErrorCode := code >= http.StatusBadRequest - if !isErrorCode { - Fail(t, fmt.Sprintf("Expected HTTP error status code for %q but received %d", url+"?"+values.Encode(), code), msgAndArgs...) - } - - return isErrorCode -} - -// HTTPStatusCode asserts that a specified handler returns a specified status code. -// -// assert.HTTPStatusCode(t, myHandler, "GET", "/notImplemented", nil, 501) -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPStatusCode(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - code, err := httpCode(handler, method, url, values) - if err != nil { - Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...) - } - - successful := code == statuscode - if !successful { - Fail(t, fmt.Sprintf("Expected HTTP status code %d for %q but received %d", statuscode, url+"?"+values.Encode(), code), msgAndArgs...) - } - - return successful -} - -// HTTPBody is a helper that returns HTTP body of the response. It returns -// empty string if building a new request fails. -func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) string { - w := httptest.NewRecorder() - if len(values) > 0 { - url += "?" + values.Encode() - } - req, err := http.NewRequest(method, url, http.NoBody) - if err != nil { - return "" - } - handler(w, req) - return w.Body.String() -} - -// HTTPBodyContains asserts that a specified handler returns a -// body that contains a string. -// -// assert.HTTPBodyContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - body := HTTPBody(handler, method, url, values) - - contains := strings.Contains(body, fmt.Sprint(str)) - if !contains { - Fail(t, fmt.Sprintf("Expected response body for %q to contain %q but found %q", url+"?"+values.Encode(), str, body), msgAndArgs...) - } - - return contains -} - -// HTTPBodyNotContains asserts that a specified handler returns a -// body that does not contain a string. -// -// assert.HTTPBodyNotContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - body := HTTPBody(handler, method, url, values) - - contains := strings.Contains(body, fmt.Sprint(str)) - if contains { - Fail(t, fmt.Sprintf("Expected response body for %q to NOT contain %q but found %q", url+"?"+values.Encode(), str, body), msgAndArgs...) - } - - return !contains -} diff --git a/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go b/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go deleted file mode 100644 index 5a74c4f4..00000000 --- a/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go +++ /dev/null @@ -1,24 +0,0 @@ -//go:build testify_yaml_custom && !testify_yaml_fail && !testify_yaml_default - -// Package yaml is an implementation of YAML functions that calls a pluggable implementation. -// -// This implementation is selected with the testify_yaml_custom build tag. -// -// go test -tags testify_yaml_custom -// -// This implementation can be used at build time to replace the default implementation -// to avoid linking with [gopkg.in/yaml.v3]. -// -// In your test package: -// -// import assertYaml "github.com/stretchr/testify/assert/yaml" -// -// func init() { -// assertYaml.Unmarshal = func (in []byte, out interface{}) error { -// // ... -// return nil -// } -// } -package yaml - -var Unmarshal func(in []byte, out interface{}) error diff --git a/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go b/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go deleted file mode 100644 index 0bae80e3..00000000 --- a/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go +++ /dev/null @@ -1,36 +0,0 @@ -//go:build !testify_yaml_fail && !testify_yaml_custom - -// Package yaml is just an indirection to handle YAML deserialization. -// -// This package is just an indirection that allows the builder to override the -// indirection with an alternative implementation of this package that uses -// another implementation of YAML deserialization. This allows to not either not -// use YAML deserialization at all, or to use another implementation than -// [gopkg.in/yaml.v3] (for example for license compatibility reasons, see [PR #1120]). -// -// Alternative implementations are selected using build tags: -// -// - testify_yaml_fail: [Unmarshal] always fails with an error -// - testify_yaml_custom: [Unmarshal] is a variable. Caller must initialize it -// before calling any of [github.com/stretchr/testify/assert.YAMLEq] or -// [github.com/stretchr/testify/assert.YAMLEqf]. -// -// Usage: -// -// go test -tags testify_yaml_fail -// -// You can check with "go list" which implementation is linked: -// -// go list -f '{{.Imports}}' github.com/stretchr/testify/assert/yaml -// go list -tags testify_yaml_fail -f '{{.Imports}}' github.com/stretchr/testify/assert/yaml -// go list -tags testify_yaml_custom -f '{{.Imports}}' github.com/stretchr/testify/assert/yaml -// -// [PR #1120]: https://github.com/stretchr/testify/pull/1120 -package yaml - -import goyaml "gopkg.in/yaml.v3" - -// Unmarshal is just a wrapper of [gopkg.in/yaml.v3.Unmarshal]. -func Unmarshal(in []byte, out interface{}) error { - return goyaml.Unmarshal(in, out) -} diff --git a/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go b/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go deleted file mode 100644 index 8041803f..00000000 --- a/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go +++ /dev/null @@ -1,17 +0,0 @@ -//go:build testify_yaml_fail && !testify_yaml_custom && !testify_yaml_default - -// Package yaml is an implementation of YAML functions that always fail. -// -// This implementation can be used at build time to replace the default implementation -// to avoid linking with [gopkg.in/yaml.v3]: -// -// go test -tags testify_yaml_fail -package yaml - -import "errors" - -var errNotImplemented = errors.New("YAML functions are not available (see https://pkg.go.dev/github.com/stretchr/testify/assert/yaml)") - -func Unmarshal([]byte, interface{}) error { - return errNotImplemented -} diff --git a/vendor/github.com/stretchr/testify/require/doc.go b/vendor/github.com/stretchr/testify/require/doc.go deleted file mode 100644 index c8e3f94a..00000000 --- a/vendor/github.com/stretchr/testify/require/doc.go +++ /dev/null @@ -1,31 +0,0 @@ -// Package require implements the same assertions as the `assert` package but -// stops test execution when a test fails. -// -// # Example Usage -// -// The following is a complete example using require in a standard test function: -// -// import ( -// "testing" -// "github.com/stretchr/testify/require" -// ) -// -// func TestSomething(t *testing.T) { -// -// var a string = "Hello" -// var b string = "Hello" -// -// require.Equal(t, a, b, "The two words should be the same.") -// -// } -// -// # Assertions -// -// The `require` package have same global functions as in the `assert` package, -// but instead of returning a boolean result they call `t.FailNow()`. -// A consequence of this is that it must be called from the goroutine running -// the test function, not from other goroutines created during the test. -// -// Every assertion function also takes an optional string message as the final argument, -// allowing custom error messages to be appended to the message the assertion method outputs. -package require diff --git a/vendor/github.com/stretchr/testify/require/forward_requirements.go b/vendor/github.com/stretchr/testify/require/forward_requirements.go deleted file mode 100644 index 1dcb2338..00000000 --- a/vendor/github.com/stretchr/testify/require/forward_requirements.go +++ /dev/null @@ -1,16 +0,0 @@ -package require - -// Assertions provides assertion methods around the -// TestingT interface. -type Assertions struct { - t TestingT -} - -// New makes a new Assertions object for the specified TestingT. -func New(t TestingT) *Assertions { - return &Assertions{ - t: t, - } -} - -//go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=require -template=require_forward.go.tmpl -include-format-funcs" diff --git a/vendor/github.com/stretchr/testify/require/require.go b/vendor/github.com/stretchr/testify/require/require.go deleted file mode 100644 index 2d02f9bc..00000000 --- a/vendor/github.com/stretchr/testify/require/require.go +++ /dev/null @@ -1,2180 +0,0 @@ -// Code generated with github.com/stretchr/testify/_codegen; DO NOT EDIT. - -package require - -import ( - assert "github.com/stretchr/testify/assert" - http "net/http" - url "net/url" - time "time" -) - -// Condition uses a Comparison to assert a complex condition. -func Condition(t TestingT, comp assert.Comparison, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Condition(t, comp, msgAndArgs...) { - return - } - t.FailNow() -} - -// Conditionf uses a Comparison to assert a complex condition. -func Conditionf(t TestingT, comp assert.Comparison, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Conditionf(t, comp, msg, args...) { - return - } - t.FailNow() -} - -// Contains asserts that the specified string, list(array, slice...) or map contains the -// specified substring or element. -// -// require.Contains(t, "Hello World", "World") -// require.Contains(t, ["Hello", "World"], "World") -// require.Contains(t, {"Hello": "World"}, "Hello") -func Contains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Contains(t, s, contains, msgAndArgs...) { - return - } - t.FailNow() -} - -// Containsf asserts that the specified string, list(array, slice...) or map contains the -// specified substring or element. -// -// require.Containsf(t, "Hello World", "World", "error message %s", "formatted") -// require.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted") -// require.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted") -func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Containsf(t, s, contains, msg, args...) { - return - } - t.FailNow() -} - -// DirExists checks whether a directory exists in the given path. It also fails -// if the path is a file rather a directory or there is an error checking whether it exists. -func DirExists(t TestingT, path string, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.DirExists(t, path, msgAndArgs...) { - return - } - t.FailNow() -} - -// DirExistsf checks whether a directory exists in the given path. It also fails -// if the path is a file rather a directory or there is an error checking whether it exists. -func DirExistsf(t TestingT, path string, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.DirExistsf(t, path, msg, args...) { - return - } - t.FailNow() -} - -// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified -// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, -// the number of appearances of each of them in both lists should match. -// -// require.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2]) -func ElementsMatch(t TestingT, listA interface{}, listB interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.ElementsMatch(t, listA, listB, msgAndArgs...) { - return - } - t.FailNow() -} - -// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified -// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, -// the number of appearances of each of them in both lists should match. -// -// require.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted") -func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.ElementsMatchf(t, listA, listB, msg, args...) { - return - } - t.FailNow() -} - -// Empty asserts that the given value is "empty". -// -// [Zero values] are "empty". -// -// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). -// -// Slices, maps and channels with zero length are "empty". -// -// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". -// -// require.Empty(t, obj) -// -// [Zero values]: https://go.dev/ref/spec#The_zero_value -func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Empty(t, object, msgAndArgs...) { - return - } - t.FailNow() -} - -// Emptyf asserts that the given value is "empty". -// -// [Zero values] are "empty". -// -// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). -// -// Slices, maps and channels with zero length are "empty". -// -// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". -// -// require.Emptyf(t, obj, "error message %s", "formatted") -// -// [Zero values]: https://go.dev/ref/spec#The_zero_value -func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Emptyf(t, object, msg, args...) { - return - } - t.FailNow() -} - -// Equal asserts that two objects are equal. -// -// require.Equal(t, 123, 123) -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). Function equality -// cannot be determined and will always fail. -func Equal(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Equal(t, expected, actual, msgAndArgs...) { - return - } - t.FailNow() -} - -// EqualError asserts that a function returned an error (i.e. not `nil`) -// and that it is equal to the provided error. -// -// actualObj, err := SomeFunction() -// require.EqualError(t, err, expectedErrorString) -func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.EqualError(t, theError, errString, msgAndArgs...) { - return - } - t.FailNow() -} - -// EqualErrorf asserts that a function returned an error (i.e. not `nil`) -// and that it is equal to the provided error. -// -// actualObj, err := SomeFunction() -// require.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted") -func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.EqualErrorf(t, theError, errString, msg, args...) { - return - } - t.FailNow() -} - -// EqualExportedValues asserts that the types of two objects are equal and their public -// fields are also equal. This is useful for comparing structs that have private fields -// that could potentially differ. -// -// type S struct { -// Exported int -// notExported int -// } -// require.EqualExportedValues(t, S{1, 2}, S{1, 3}) => true -// require.EqualExportedValues(t, S{1, 2}, S{2, 3}) => false -func EqualExportedValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.EqualExportedValues(t, expected, actual, msgAndArgs...) { - return - } - t.FailNow() -} - -// EqualExportedValuesf asserts that the types of two objects are equal and their public -// fields are also equal. This is useful for comparing structs that have private fields -// that could potentially differ. -// -// type S struct { -// Exported int -// notExported int -// } -// require.EqualExportedValuesf(t, S{1, 2}, S{1, 3}, "error message %s", "formatted") => true -// require.EqualExportedValuesf(t, S{1, 2}, S{2, 3}, "error message %s", "formatted") => false -func EqualExportedValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.EqualExportedValuesf(t, expected, actual, msg, args...) { - return - } - t.FailNow() -} - -// EqualValues asserts that two objects are equal or convertible to the larger -// type and equal. -// -// require.EqualValues(t, uint32(123), int32(123)) -func EqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.EqualValues(t, expected, actual, msgAndArgs...) { - return - } - t.FailNow() -} - -// EqualValuesf asserts that two objects are equal or convertible to the larger -// type and equal. -// -// require.EqualValuesf(t, uint32(123), int32(123), "error message %s", "formatted") -func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.EqualValuesf(t, expected, actual, msg, args...) { - return - } - t.FailNow() -} - -// Equalf asserts that two objects are equal. -// -// require.Equalf(t, 123, 123, "error message %s", "formatted") -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). Function equality -// cannot be determined and will always fail. -func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Equalf(t, expected, actual, msg, args...) { - return - } - t.FailNow() -} - -// Error asserts that a function returned an error (i.e. not `nil`). -// -// actualObj, err := SomeFunction() -// require.Error(t, err) -func Error(t TestingT, err error, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Error(t, err, msgAndArgs...) { - return - } - t.FailNow() -} - -// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. -// This is a wrapper for errors.As. -func ErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.ErrorAs(t, err, target, msgAndArgs...) { - return - } - t.FailNow() -} - -// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. -// This is a wrapper for errors.As. -func ErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.ErrorAsf(t, err, target, msg, args...) { - return - } - t.FailNow() -} - -// ErrorContains asserts that a function returned an error (i.e. not `nil`) -// and that the error contains the specified substring. -// -// actualObj, err := SomeFunction() -// require.ErrorContains(t, err, expectedErrorSubString) -func ErrorContains(t TestingT, theError error, contains string, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.ErrorContains(t, theError, contains, msgAndArgs...) { - return - } - t.FailNow() -} - -// ErrorContainsf asserts that a function returned an error (i.e. not `nil`) -// and that the error contains the specified substring. -// -// actualObj, err := SomeFunction() -// require.ErrorContainsf(t, err, expectedErrorSubString, "error message %s", "formatted") -func ErrorContainsf(t TestingT, theError error, contains string, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.ErrorContainsf(t, theError, contains, msg, args...) { - return - } - t.FailNow() -} - -// ErrorIs asserts that at least one of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func ErrorIs(t TestingT, err error, target error, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.ErrorIs(t, err, target, msgAndArgs...) { - return - } - t.FailNow() -} - -// ErrorIsf asserts that at least one of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func ErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.ErrorIsf(t, err, target, msg, args...) { - return - } - t.FailNow() -} - -// Errorf asserts that a function returned an error (i.e. not `nil`). -// -// actualObj, err := SomeFunction() -// require.Errorf(t, err, "error message %s", "formatted") -func Errorf(t TestingT, err error, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Errorf(t, err, msg, args...) { - return - } - t.FailNow() -} - -// Eventually asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. -// -// require.Eventually(t, func() bool { return true; }, time.Second, 10*time.Millisecond) -func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Eventually(t, condition, waitFor, tick, msgAndArgs...) { - return - } - t.FailNow() -} - -// EventuallyWithT asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. In contrast to Eventually, -// it supplies a CollectT to the condition function, so that the condition -// function can use the CollectT to call other assertions. -// The condition is considered "met" if no errors are raised in a tick. -// The supplied CollectT collects all errors from one tick (if there are any). -// If the condition is not met before waitFor, the collected errors of -// the last tick are copied to t. -// -// externalValue := false -// go func() { -// time.Sleep(8*time.Second) -// externalValue = true -// }() -// require.EventuallyWithT(t, func(c *require.CollectT) { -// // add assertions as needed; any assertion failure will fail the current tick -// require.True(c, externalValue, "expected 'externalValue' to be true") -// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false") -func EventuallyWithT(t TestingT, condition func(collect *assert.CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.EventuallyWithT(t, condition, waitFor, tick, msgAndArgs...) { - return - } - t.FailNow() -} - -// EventuallyWithTf asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. In contrast to Eventually, -// it supplies a CollectT to the condition function, so that the condition -// function can use the CollectT to call other assertions. -// The condition is considered "met" if no errors are raised in a tick. -// The supplied CollectT collects all errors from one tick (if there are any). -// If the condition is not met before waitFor, the collected errors of -// the last tick are copied to t. -// -// externalValue := false -// go func() { -// time.Sleep(8*time.Second) -// externalValue = true -// }() -// require.EventuallyWithTf(t, func(c *require.CollectT, "error message %s", "formatted") { -// // add assertions as needed; any assertion failure will fail the current tick -// require.True(c, externalValue, "expected 'externalValue' to be true") -// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false") -func EventuallyWithTf(t TestingT, condition func(collect *assert.CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.EventuallyWithTf(t, condition, waitFor, tick, msg, args...) { - return - } - t.FailNow() -} - -// Eventuallyf asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. -// -// require.Eventuallyf(t, func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") -func Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Eventuallyf(t, condition, waitFor, tick, msg, args...) { - return - } - t.FailNow() -} - -// Exactly asserts that two objects are equal in value and type. -// -// require.Exactly(t, int32(123), int64(123)) -func Exactly(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Exactly(t, expected, actual, msgAndArgs...) { - return - } - t.FailNow() -} - -// Exactlyf asserts that two objects are equal in value and type. -// -// require.Exactlyf(t, int32(123), int64(123), "error message %s", "formatted") -func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Exactlyf(t, expected, actual, msg, args...) { - return - } - t.FailNow() -} - -// Fail reports a failure through -func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Fail(t, failureMessage, msgAndArgs...) { - return - } - t.FailNow() -} - -// FailNow fails test -func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.FailNow(t, failureMessage, msgAndArgs...) { - return - } - t.FailNow() -} - -// FailNowf fails test -func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.FailNowf(t, failureMessage, msg, args...) { - return - } - t.FailNow() -} - -// Failf reports a failure through -func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Failf(t, failureMessage, msg, args...) { - return - } - t.FailNow() -} - -// False asserts that the specified value is false. -// -// require.False(t, myBool) -func False(t TestingT, value bool, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.False(t, value, msgAndArgs...) { - return - } - t.FailNow() -} - -// Falsef asserts that the specified value is false. -// -// require.Falsef(t, myBool, "error message %s", "formatted") -func Falsef(t TestingT, value bool, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Falsef(t, value, msg, args...) { - return - } - t.FailNow() -} - -// FileExists checks whether a file exists in the given path. It also fails if -// the path points to a directory or there is an error when trying to check the file. -func FileExists(t TestingT, path string, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.FileExists(t, path, msgAndArgs...) { - return - } - t.FailNow() -} - -// FileExistsf checks whether a file exists in the given path. It also fails if -// the path points to a directory or there is an error when trying to check the file. -func FileExistsf(t TestingT, path string, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.FileExistsf(t, path, msg, args...) { - return - } - t.FailNow() -} - -// Greater asserts that the first element is greater than the second -// -// require.Greater(t, 2, 1) -// require.Greater(t, float64(2), float64(1)) -// require.Greater(t, "b", "a") -func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Greater(t, e1, e2, msgAndArgs...) { - return - } - t.FailNow() -} - -// GreaterOrEqual asserts that the first element is greater than or equal to the second -// -// require.GreaterOrEqual(t, 2, 1) -// require.GreaterOrEqual(t, 2, 2) -// require.GreaterOrEqual(t, "b", "a") -// require.GreaterOrEqual(t, "b", "b") -func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.GreaterOrEqual(t, e1, e2, msgAndArgs...) { - return - } - t.FailNow() -} - -// GreaterOrEqualf asserts that the first element is greater than or equal to the second -// -// require.GreaterOrEqualf(t, 2, 1, "error message %s", "formatted") -// require.GreaterOrEqualf(t, 2, 2, "error message %s", "formatted") -// require.GreaterOrEqualf(t, "b", "a", "error message %s", "formatted") -// require.GreaterOrEqualf(t, "b", "b", "error message %s", "formatted") -func GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.GreaterOrEqualf(t, e1, e2, msg, args...) { - return - } - t.FailNow() -} - -// Greaterf asserts that the first element is greater than the second -// -// require.Greaterf(t, 2, 1, "error message %s", "formatted") -// require.Greaterf(t, float64(2), float64(1), "error message %s", "formatted") -// require.Greaterf(t, "b", "a", "error message %s", "formatted") -func Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Greaterf(t, e1, e2, msg, args...) { - return - } - t.FailNow() -} - -// HTTPBodyContains asserts that a specified handler returns a -// body that contains a string. -// -// require.HTTPBodyContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.HTTPBodyContains(t, handler, method, url, values, str, msgAndArgs...) { - return - } - t.FailNow() -} - -// HTTPBodyContainsf asserts that a specified handler returns a -// body that contains a string. -// -// require.HTTPBodyContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.HTTPBodyContainsf(t, handler, method, url, values, str, msg, args...) { - return - } - t.FailNow() -} - -// HTTPBodyNotContains asserts that a specified handler returns a -// body that does not contain a string. -// -// require.HTTPBodyNotContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.HTTPBodyNotContains(t, handler, method, url, values, str, msgAndArgs...) { - return - } - t.FailNow() -} - -// HTTPBodyNotContainsf asserts that a specified handler returns a -// body that does not contain a string. -// -// require.HTTPBodyNotContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.HTTPBodyNotContainsf(t, handler, method, url, values, str, msg, args...) { - return - } - t.FailNow() -} - -// HTTPError asserts that a specified handler returns an error status code. -// -// require.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPError(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.HTTPError(t, handler, method, url, values, msgAndArgs...) { - return - } - t.FailNow() -} - -// HTTPErrorf asserts that a specified handler returns an error status code. -// -// require.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.HTTPErrorf(t, handler, method, url, values, msg, args...) { - return - } - t.FailNow() -} - -// HTTPRedirect asserts that a specified handler returns a redirect status code. -// -// require.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPRedirect(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.HTTPRedirect(t, handler, method, url, values, msgAndArgs...) { - return - } - t.FailNow() -} - -// HTTPRedirectf asserts that a specified handler returns a redirect status code. -// -// require.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.HTTPRedirectf(t, handler, method, url, values, msg, args...) { - return - } - t.FailNow() -} - -// HTTPStatusCode asserts that a specified handler returns a specified status code. -// -// require.HTTPStatusCode(t, myHandler, "GET", "/notImplemented", nil, 501) -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPStatusCode(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.HTTPStatusCode(t, handler, method, url, values, statuscode, msgAndArgs...) { - return - } - t.FailNow() -} - -// HTTPStatusCodef asserts that a specified handler returns a specified status code. -// -// require.HTTPStatusCodef(t, myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPStatusCodef(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.HTTPStatusCodef(t, handler, method, url, values, statuscode, msg, args...) { - return - } - t.FailNow() -} - -// HTTPSuccess asserts that a specified handler returns a success status code. -// -// require.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil) -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPSuccess(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.HTTPSuccess(t, handler, method, url, values, msgAndArgs...) { - return - } - t.FailNow() -} - -// HTTPSuccessf asserts that a specified handler returns a success status code. -// -// require.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.HTTPSuccessf(t, handler, method, url, values, msg, args...) { - return - } - t.FailNow() -} - -// Implements asserts that an object is implemented by the specified interface. -// -// require.Implements(t, (*MyInterface)(nil), new(MyObject)) -func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Implements(t, interfaceObject, object, msgAndArgs...) { - return - } - t.FailNow() -} - -// Implementsf asserts that an object is implemented by the specified interface. -// -// require.Implementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted") -func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Implementsf(t, interfaceObject, object, msg, args...) { - return - } - t.FailNow() -} - -// InDelta asserts that the two numerals are within delta of each other. -// -// require.InDelta(t, math.Pi, 22/7.0, 0.01) -func InDelta(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.InDelta(t, expected, actual, delta, msgAndArgs...) { - return - } - t.FailNow() -} - -// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. -func InDeltaMapValues(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.InDeltaMapValues(t, expected, actual, delta, msgAndArgs...) { - return - } - t.FailNow() -} - -// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. -func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.InDeltaMapValuesf(t, expected, actual, delta, msg, args...) { - return - } - t.FailNow() -} - -// InDeltaSlice is the same as InDelta, except it compares two slices. -func InDeltaSlice(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.InDeltaSlice(t, expected, actual, delta, msgAndArgs...) { - return - } - t.FailNow() -} - -// InDeltaSlicef is the same as InDelta, except it compares two slices. -func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.InDeltaSlicef(t, expected, actual, delta, msg, args...) { - return - } - t.FailNow() -} - -// InDeltaf asserts that the two numerals are within delta of each other. -// -// require.InDeltaf(t, math.Pi, 22/7.0, 0.01, "error message %s", "formatted") -func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.InDeltaf(t, expected, actual, delta, msg, args...) { - return - } - t.FailNow() -} - -// InEpsilon asserts that expected and actual have a relative error less than epsilon -func InEpsilon(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.InEpsilon(t, expected, actual, epsilon, msgAndArgs...) { - return - } - t.FailNow() -} - -// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices. -func InEpsilonSlice(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.InEpsilonSlice(t, expected, actual, epsilon, msgAndArgs...) { - return - } - t.FailNow() -} - -// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices. -func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.InEpsilonSlicef(t, expected, actual, epsilon, msg, args...) { - return - } - t.FailNow() -} - -// InEpsilonf asserts that expected and actual have a relative error less than epsilon -func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.InEpsilonf(t, expected, actual, epsilon, msg, args...) { - return - } - t.FailNow() -} - -// IsDecreasing asserts that the collection is decreasing -// -// require.IsDecreasing(t, []int{2, 1, 0}) -// require.IsDecreasing(t, []float{2, 1}) -// require.IsDecreasing(t, []string{"b", "a"}) -func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.IsDecreasing(t, object, msgAndArgs...) { - return - } - t.FailNow() -} - -// IsDecreasingf asserts that the collection is decreasing -// -// require.IsDecreasingf(t, []int{2, 1, 0}, "error message %s", "formatted") -// require.IsDecreasingf(t, []float{2, 1}, "error message %s", "formatted") -// require.IsDecreasingf(t, []string{"b", "a"}, "error message %s", "formatted") -func IsDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.IsDecreasingf(t, object, msg, args...) { - return - } - t.FailNow() -} - -// IsIncreasing asserts that the collection is increasing -// -// require.IsIncreasing(t, []int{1, 2, 3}) -// require.IsIncreasing(t, []float{1, 2}) -// require.IsIncreasing(t, []string{"a", "b"}) -func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.IsIncreasing(t, object, msgAndArgs...) { - return - } - t.FailNow() -} - -// IsIncreasingf asserts that the collection is increasing -// -// require.IsIncreasingf(t, []int{1, 2, 3}, "error message %s", "formatted") -// require.IsIncreasingf(t, []float{1, 2}, "error message %s", "formatted") -// require.IsIncreasingf(t, []string{"a", "b"}, "error message %s", "formatted") -func IsIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.IsIncreasingf(t, object, msg, args...) { - return - } - t.FailNow() -} - -// IsNonDecreasing asserts that the collection is not decreasing -// -// require.IsNonDecreasing(t, []int{1, 1, 2}) -// require.IsNonDecreasing(t, []float{1, 2}) -// require.IsNonDecreasing(t, []string{"a", "b"}) -func IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.IsNonDecreasing(t, object, msgAndArgs...) { - return - } - t.FailNow() -} - -// IsNonDecreasingf asserts that the collection is not decreasing -// -// require.IsNonDecreasingf(t, []int{1, 1, 2}, "error message %s", "formatted") -// require.IsNonDecreasingf(t, []float{1, 2}, "error message %s", "formatted") -// require.IsNonDecreasingf(t, []string{"a", "b"}, "error message %s", "formatted") -func IsNonDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.IsNonDecreasingf(t, object, msg, args...) { - return - } - t.FailNow() -} - -// IsNonIncreasing asserts that the collection is not increasing -// -// require.IsNonIncreasing(t, []int{2, 1, 1}) -// require.IsNonIncreasing(t, []float{2, 1}) -// require.IsNonIncreasing(t, []string{"b", "a"}) -func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.IsNonIncreasing(t, object, msgAndArgs...) { - return - } - t.FailNow() -} - -// IsNonIncreasingf asserts that the collection is not increasing -// -// require.IsNonIncreasingf(t, []int{2, 1, 1}, "error message %s", "formatted") -// require.IsNonIncreasingf(t, []float{2, 1}, "error message %s", "formatted") -// require.IsNonIncreasingf(t, []string{"b", "a"}, "error message %s", "formatted") -func IsNonIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.IsNonIncreasingf(t, object, msg, args...) { - return - } - t.FailNow() -} - -// IsNotType asserts that the specified objects are not of the same type. -// -// require.IsNotType(t, &NotMyStruct{}, &MyStruct{}) -func IsNotType(t TestingT, theType interface{}, object interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.IsNotType(t, theType, object, msgAndArgs...) { - return - } - t.FailNow() -} - -// IsNotTypef asserts that the specified objects are not of the same type. -// -// require.IsNotTypef(t, &NotMyStruct{}, &MyStruct{}, "error message %s", "formatted") -func IsNotTypef(t TestingT, theType interface{}, object interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.IsNotTypef(t, theType, object, msg, args...) { - return - } - t.FailNow() -} - -// IsType asserts that the specified objects are of the same type. -// -// require.IsType(t, &MyStruct{}, &MyStruct{}) -func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.IsType(t, expectedType, object, msgAndArgs...) { - return - } - t.FailNow() -} - -// IsTypef asserts that the specified objects are of the same type. -// -// require.IsTypef(t, &MyStruct{}, &MyStruct{}, "error message %s", "formatted") -func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.IsTypef(t, expectedType, object, msg, args...) { - return - } - t.FailNow() -} - -// JSONEq asserts that two JSON strings are equivalent. -// -// require.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) -func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.JSONEq(t, expected, actual, msgAndArgs...) { - return - } - t.FailNow() -} - -// JSONEqf asserts that two JSON strings are equivalent. -// -// require.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted") -func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.JSONEqf(t, expected, actual, msg, args...) { - return - } - t.FailNow() -} - -// Len asserts that the specified object has specific length. -// Len also fails if the object has a type that len() not accept. -// -// require.Len(t, mySlice, 3) -func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Len(t, object, length, msgAndArgs...) { - return - } - t.FailNow() -} - -// Lenf asserts that the specified object has specific length. -// Lenf also fails if the object has a type that len() not accept. -// -// require.Lenf(t, mySlice, 3, "error message %s", "formatted") -func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Lenf(t, object, length, msg, args...) { - return - } - t.FailNow() -} - -// Less asserts that the first element is less than the second -// -// require.Less(t, 1, 2) -// require.Less(t, float64(1), float64(2)) -// require.Less(t, "a", "b") -func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Less(t, e1, e2, msgAndArgs...) { - return - } - t.FailNow() -} - -// LessOrEqual asserts that the first element is less than or equal to the second -// -// require.LessOrEqual(t, 1, 2) -// require.LessOrEqual(t, 2, 2) -// require.LessOrEqual(t, "a", "b") -// require.LessOrEqual(t, "b", "b") -func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.LessOrEqual(t, e1, e2, msgAndArgs...) { - return - } - t.FailNow() -} - -// LessOrEqualf asserts that the first element is less than or equal to the second -// -// require.LessOrEqualf(t, 1, 2, "error message %s", "formatted") -// require.LessOrEqualf(t, 2, 2, "error message %s", "formatted") -// require.LessOrEqualf(t, "a", "b", "error message %s", "formatted") -// require.LessOrEqualf(t, "b", "b", "error message %s", "formatted") -func LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.LessOrEqualf(t, e1, e2, msg, args...) { - return - } - t.FailNow() -} - -// Lessf asserts that the first element is less than the second -// -// require.Lessf(t, 1, 2, "error message %s", "formatted") -// require.Lessf(t, float64(1), float64(2), "error message %s", "formatted") -// require.Lessf(t, "a", "b", "error message %s", "formatted") -func Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Lessf(t, e1, e2, msg, args...) { - return - } - t.FailNow() -} - -// Negative asserts that the specified element is negative -// -// require.Negative(t, -1) -// require.Negative(t, -1.23) -func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Negative(t, e, msgAndArgs...) { - return - } - t.FailNow() -} - -// Negativef asserts that the specified element is negative -// -// require.Negativef(t, -1, "error message %s", "formatted") -// require.Negativef(t, -1.23, "error message %s", "formatted") -func Negativef(t TestingT, e interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Negativef(t, e, msg, args...) { - return - } - t.FailNow() -} - -// Never asserts that the given condition doesn't satisfy in waitFor time, -// periodically checking the target function each tick. -// -// require.Never(t, func() bool { return false; }, time.Second, 10*time.Millisecond) -func Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Never(t, condition, waitFor, tick, msgAndArgs...) { - return - } - t.FailNow() -} - -// Neverf asserts that the given condition doesn't satisfy in waitFor time, -// periodically checking the target function each tick. -// -// require.Neverf(t, func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") -func Neverf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Neverf(t, condition, waitFor, tick, msg, args...) { - return - } - t.FailNow() -} - -// Nil asserts that the specified object is nil. -// -// require.Nil(t, err) -func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Nil(t, object, msgAndArgs...) { - return - } - t.FailNow() -} - -// Nilf asserts that the specified object is nil. -// -// require.Nilf(t, err, "error message %s", "formatted") -func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Nilf(t, object, msg, args...) { - return - } - t.FailNow() -} - -// NoDirExists checks whether a directory does not exist in the given path. -// It fails if the path points to an existing _directory_ only. -func NoDirExists(t TestingT, path string, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NoDirExists(t, path, msgAndArgs...) { - return - } - t.FailNow() -} - -// NoDirExistsf checks whether a directory does not exist in the given path. -// It fails if the path points to an existing _directory_ only. -func NoDirExistsf(t TestingT, path string, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NoDirExistsf(t, path, msg, args...) { - return - } - t.FailNow() -} - -// NoError asserts that a function returned no error (i.e. `nil`). -// -// actualObj, err := SomeFunction() -// if require.NoError(t, err) { -// require.Equal(t, expectedObj, actualObj) -// } -func NoError(t TestingT, err error, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NoError(t, err, msgAndArgs...) { - return - } - t.FailNow() -} - -// NoErrorf asserts that a function returned no error (i.e. `nil`). -// -// actualObj, err := SomeFunction() -// if require.NoErrorf(t, err, "error message %s", "formatted") { -// require.Equal(t, expectedObj, actualObj) -// } -func NoErrorf(t TestingT, err error, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NoErrorf(t, err, msg, args...) { - return - } - t.FailNow() -} - -// NoFileExists checks whether a file does not exist in a given path. It fails -// if the path points to an existing _file_ only. -func NoFileExists(t TestingT, path string, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NoFileExists(t, path, msgAndArgs...) { - return - } - t.FailNow() -} - -// NoFileExistsf checks whether a file does not exist in a given path. It fails -// if the path points to an existing _file_ only. -func NoFileExistsf(t TestingT, path string, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NoFileExistsf(t, path, msg, args...) { - return - } - t.FailNow() -} - -// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the -// specified substring or element. -// -// require.NotContains(t, "Hello World", "Earth") -// require.NotContains(t, ["Hello", "World"], "Earth") -// require.NotContains(t, {"Hello": "World"}, "Earth") -func NotContains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotContains(t, s, contains, msgAndArgs...) { - return - } - t.FailNow() -} - -// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the -// specified substring or element. -// -// require.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted") -// require.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted") -// require.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted") -func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotContainsf(t, s, contains, msg, args...) { - return - } - t.FailNow() -} - -// NotElementsMatch asserts that the specified listA(array, slice...) is NOT equal to specified -// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, -// the number of appearances of each of them in both lists should not match. -// This is an inverse of ElementsMatch. -// -// require.NotElementsMatch(t, [1, 1, 2, 3], [1, 1, 2, 3]) -> false -// -// require.NotElementsMatch(t, [1, 1, 2, 3], [1, 2, 3]) -> true -// -// require.NotElementsMatch(t, [1, 2, 3], [1, 2, 4]) -> true -func NotElementsMatch(t TestingT, listA interface{}, listB interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotElementsMatch(t, listA, listB, msgAndArgs...) { - return - } - t.FailNow() -} - -// NotElementsMatchf asserts that the specified listA(array, slice...) is NOT equal to specified -// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, -// the number of appearances of each of them in both lists should not match. -// This is an inverse of ElementsMatch. -// -// require.NotElementsMatchf(t, [1, 1, 2, 3], [1, 1, 2, 3], "error message %s", "formatted") -> false -// -// require.NotElementsMatchf(t, [1, 1, 2, 3], [1, 2, 3], "error message %s", "formatted") -> true -// -// require.NotElementsMatchf(t, [1, 2, 3], [1, 2, 4], "error message %s", "formatted") -> true -func NotElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotElementsMatchf(t, listA, listB, msg, args...) { - return - } - t.FailNow() -} - -// NotEmpty asserts that the specified object is NOT [Empty]. -// -// if require.NotEmpty(t, obj) { -// require.Equal(t, "two", obj[1]) -// } -func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotEmpty(t, object, msgAndArgs...) { - return - } - t.FailNow() -} - -// NotEmptyf asserts that the specified object is NOT [Empty]. -// -// if require.NotEmptyf(t, obj, "error message %s", "formatted") { -// require.Equal(t, "two", obj[1]) -// } -func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotEmptyf(t, object, msg, args...) { - return - } - t.FailNow() -} - -// NotEqual asserts that the specified values are NOT equal. -// -// require.NotEqual(t, obj1, obj2) -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). -func NotEqual(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotEqual(t, expected, actual, msgAndArgs...) { - return - } - t.FailNow() -} - -// NotEqualValues asserts that two objects are not equal even when converted to the same type -// -// require.NotEqualValues(t, obj1, obj2) -func NotEqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotEqualValues(t, expected, actual, msgAndArgs...) { - return - } - t.FailNow() -} - -// NotEqualValuesf asserts that two objects are not equal even when converted to the same type -// -// require.NotEqualValuesf(t, obj1, obj2, "error message %s", "formatted") -func NotEqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotEqualValuesf(t, expected, actual, msg, args...) { - return - } - t.FailNow() -} - -// NotEqualf asserts that the specified values are NOT equal. -// -// require.NotEqualf(t, obj1, obj2, "error message %s", "formatted") -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). -func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotEqualf(t, expected, actual, msg, args...) { - return - } - t.FailNow() -} - -// NotErrorAs asserts that none of the errors in err's chain matches target, -// but if so, sets target to that error value. -func NotErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotErrorAs(t, err, target, msgAndArgs...) { - return - } - t.FailNow() -} - -// NotErrorAsf asserts that none of the errors in err's chain matches target, -// but if so, sets target to that error value. -func NotErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotErrorAsf(t, err, target, msg, args...) { - return - } - t.FailNow() -} - -// NotErrorIs asserts that none of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func NotErrorIs(t TestingT, err error, target error, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotErrorIs(t, err, target, msgAndArgs...) { - return - } - t.FailNow() -} - -// NotErrorIsf asserts that none of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func NotErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotErrorIsf(t, err, target, msg, args...) { - return - } - t.FailNow() -} - -// NotImplements asserts that an object does not implement the specified interface. -// -// require.NotImplements(t, (*MyInterface)(nil), new(MyObject)) -func NotImplements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotImplements(t, interfaceObject, object, msgAndArgs...) { - return - } - t.FailNow() -} - -// NotImplementsf asserts that an object does not implement the specified interface. -// -// require.NotImplementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted") -func NotImplementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotImplementsf(t, interfaceObject, object, msg, args...) { - return - } - t.FailNow() -} - -// NotNil asserts that the specified object is not nil. -// -// require.NotNil(t, err) -func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotNil(t, object, msgAndArgs...) { - return - } - t.FailNow() -} - -// NotNilf asserts that the specified object is not nil. -// -// require.NotNilf(t, err, "error message %s", "formatted") -func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotNilf(t, object, msg, args...) { - return - } - t.FailNow() -} - -// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. -// -// require.NotPanics(t, func(){ RemainCalm() }) -func NotPanics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotPanics(t, f, msgAndArgs...) { - return - } - t.FailNow() -} - -// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic. -// -// require.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted") -func NotPanicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotPanicsf(t, f, msg, args...) { - return - } - t.FailNow() -} - -// NotRegexp asserts that a specified regexp does not match a string. -// -// require.NotRegexp(t, regexp.MustCompile("starts"), "it's starting") -// require.NotRegexp(t, "^start", "it's not starting") -func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotRegexp(t, rx, str, msgAndArgs...) { - return - } - t.FailNow() -} - -// NotRegexpf asserts that a specified regexp does not match a string. -// -// require.NotRegexpf(t, regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted") -// require.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted") -func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotRegexpf(t, rx, str, msg, args...) { - return - } - t.FailNow() -} - -// NotSame asserts that two pointers do not reference the same object. -// -// require.NotSame(t, ptr1, ptr2) -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func NotSame(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotSame(t, expected, actual, msgAndArgs...) { - return - } - t.FailNow() -} - -// NotSamef asserts that two pointers do not reference the same object. -// -// require.NotSamef(t, ptr1, ptr2, "error message %s", "formatted") -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotSamef(t, expected, actual, msg, args...) { - return - } - t.FailNow() -} - -// NotSubset asserts that the list (array, slice, or map) does NOT contain all -// elements given in the subset (array, slice, or map). -// Map elements are key-value pairs unless compared with an array or slice where -// only the map key is evaluated. -// -// require.NotSubset(t, [1, 3, 4], [1, 2]) -// require.NotSubset(t, {"x": 1, "y": 2}, {"z": 3}) -// require.NotSubset(t, [1, 3, 4], {1: "one", 2: "two"}) -// require.NotSubset(t, {"x": 1, "y": 2}, ["z"]) -func NotSubset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotSubset(t, list, subset, msgAndArgs...) { - return - } - t.FailNow() -} - -// NotSubsetf asserts that the list (array, slice, or map) does NOT contain all -// elements given in the subset (array, slice, or map). -// Map elements are key-value pairs unless compared with an array or slice where -// only the map key is evaluated. -// -// require.NotSubsetf(t, [1, 3, 4], [1, 2], "error message %s", "formatted") -// require.NotSubsetf(t, {"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") -// require.NotSubsetf(t, [1, 3, 4], {1: "one", 2: "two"}, "error message %s", "formatted") -// require.NotSubsetf(t, {"x": 1, "y": 2}, ["z"], "error message %s", "formatted") -func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotSubsetf(t, list, subset, msg, args...) { - return - } - t.FailNow() -} - -// NotZero asserts that i is not the zero value for its type. -func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotZero(t, i, msgAndArgs...) { - return - } - t.FailNow() -} - -// NotZerof asserts that i is not the zero value for its type. -func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.NotZerof(t, i, msg, args...) { - return - } - t.FailNow() -} - -// Panics asserts that the code inside the specified PanicTestFunc panics. -// -// require.Panics(t, func(){ GoCrazy() }) -func Panics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Panics(t, f, msgAndArgs...) { - return - } - t.FailNow() -} - -// PanicsWithError asserts that the code inside the specified PanicTestFunc -// panics, and that the recovered panic value is an error that satisfies the -// EqualError comparison. -// -// require.PanicsWithError(t, "crazy error", func(){ GoCrazy() }) -func PanicsWithError(t TestingT, errString string, f assert.PanicTestFunc, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.PanicsWithError(t, errString, f, msgAndArgs...) { - return - } - t.FailNow() -} - -// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc -// panics, and that the recovered panic value is an error that satisfies the -// EqualError comparison. -// -// require.PanicsWithErrorf(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted") -func PanicsWithErrorf(t TestingT, errString string, f assert.PanicTestFunc, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.PanicsWithErrorf(t, errString, f, msg, args...) { - return - } - t.FailNow() -} - -// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that -// the recovered panic value equals the expected panic value. -// -// require.PanicsWithValue(t, "crazy error", func(){ GoCrazy() }) -func PanicsWithValue(t TestingT, expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.PanicsWithValue(t, expected, f, msgAndArgs...) { - return - } - t.FailNow() -} - -// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that -// the recovered panic value equals the expected panic value. -// -// require.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted") -func PanicsWithValuef(t TestingT, expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.PanicsWithValuef(t, expected, f, msg, args...) { - return - } - t.FailNow() -} - -// Panicsf asserts that the code inside the specified PanicTestFunc panics. -// -// require.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted") -func Panicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Panicsf(t, f, msg, args...) { - return - } - t.FailNow() -} - -// Positive asserts that the specified element is positive -// -// require.Positive(t, 1) -// require.Positive(t, 1.23) -func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Positive(t, e, msgAndArgs...) { - return - } - t.FailNow() -} - -// Positivef asserts that the specified element is positive -// -// require.Positivef(t, 1, "error message %s", "formatted") -// require.Positivef(t, 1.23, "error message %s", "formatted") -func Positivef(t TestingT, e interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Positivef(t, e, msg, args...) { - return - } - t.FailNow() -} - -// Regexp asserts that a specified regexp matches a string. -// -// require.Regexp(t, regexp.MustCompile("start"), "it's starting") -// require.Regexp(t, "start...$", "it's not starting") -func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Regexp(t, rx, str, msgAndArgs...) { - return - } - t.FailNow() -} - -// Regexpf asserts that a specified regexp matches a string. -// -// require.Regexpf(t, regexp.MustCompile("start"), "it's starting", "error message %s", "formatted") -// require.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted") -func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Regexpf(t, rx, str, msg, args...) { - return - } - t.FailNow() -} - -// Same asserts that two pointers reference the same object. -// -// require.Same(t, ptr1, ptr2) -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func Same(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Same(t, expected, actual, msgAndArgs...) { - return - } - t.FailNow() -} - -// Samef asserts that two pointers reference the same object. -// -// require.Samef(t, ptr1, ptr2, "error message %s", "formatted") -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func Samef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Samef(t, expected, actual, msg, args...) { - return - } - t.FailNow() -} - -// Subset asserts that the list (array, slice, or map) contains all elements -// given in the subset (array, slice, or map). -// Map elements are key-value pairs unless compared with an array or slice where -// only the map key is evaluated. -// -// require.Subset(t, [1, 2, 3], [1, 2]) -// require.Subset(t, {"x": 1, "y": 2}, {"x": 1}) -// require.Subset(t, [1, 2, 3], {1: "one", 2: "two"}) -// require.Subset(t, {"x": 1, "y": 2}, ["x"]) -func Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Subset(t, list, subset, msgAndArgs...) { - return - } - t.FailNow() -} - -// Subsetf asserts that the list (array, slice, or map) contains all elements -// given in the subset (array, slice, or map). -// Map elements are key-value pairs unless compared with an array or slice where -// only the map key is evaluated. -// -// require.Subsetf(t, [1, 2, 3], [1, 2], "error message %s", "formatted") -// require.Subsetf(t, {"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") -// require.Subsetf(t, [1, 2, 3], {1: "one", 2: "two"}, "error message %s", "formatted") -// require.Subsetf(t, {"x": 1, "y": 2}, ["x"], "error message %s", "formatted") -func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Subsetf(t, list, subset, msg, args...) { - return - } - t.FailNow() -} - -// True asserts that the specified value is true. -// -// require.True(t, myBool) -func True(t TestingT, value bool, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.True(t, value, msgAndArgs...) { - return - } - t.FailNow() -} - -// Truef asserts that the specified value is true. -// -// require.Truef(t, myBool, "error message %s", "formatted") -func Truef(t TestingT, value bool, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Truef(t, value, msg, args...) { - return - } - t.FailNow() -} - -// WithinDuration asserts that the two times are within duration delta of each other. -// -// require.WithinDuration(t, time.Now(), time.Now(), 10*time.Second) -func WithinDuration(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.WithinDuration(t, expected, actual, delta, msgAndArgs...) { - return - } - t.FailNow() -} - -// WithinDurationf asserts that the two times are within duration delta of each other. -// -// require.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted") -func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.WithinDurationf(t, expected, actual, delta, msg, args...) { - return - } - t.FailNow() -} - -// WithinRange asserts that a time is within a time range (inclusive). -// -// require.WithinRange(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second)) -func WithinRange(t TestingT, actual time.Time, start time.Time, end time.Time, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.WithinRange(t, actual, start, end, msgAndArgs...) { - return - } - t.FailNow() -} - -// WithinRangef asserts that a time is within a time range (inclusive). -// -// require.WithinRangef(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), "error message %s", "formatted") -func WithinRangef(t TestingT, actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.WithinRangef(t, actual, start, end, msg, args...) { - return - } - t.FailNow() -} - -// YAMLEq asserts that two YAML strings are equivalent. -func YAMLEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.YAMLEq(t, expected, actual, msgAndArgs...) { - return - } - t.FailNow() -} - -// YAMLEqf asserts that two YAML strings are equivalent. -func YAMLEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.YAMLEqf(t, expected, actual, msg, args...) { - return - } - t.FailNow() -} - -// Zero asserts that i is the zero value for its type. -func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Zero(t, i, msgAndArgs...) { - return - } - t.FailNow() -} - -// Zerof asserts that i is the zero value for its type. -func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if assert.Zerof(t, i, msg, args...) { - return - } - t.FailNow() -} diff --git a/vendor/github.com/stretchr/testify/require/require.go.tmpl b/vendor/github.com/stretchr/testify/require/require.go.tmpl deleted file mode 100644 index 8b328368..00000000 --- a/vendor/github.com/stretchr/testify/require/require.go.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -{{ replace .Comment "assert." "require."}} -func {{.DocInfo.Name}}(t TestingT, {{.Params}}) { - if h, ok := t.(tHelper); ok { h.Helper() } - if assert.{{.DocInfo.Name}}(t, {{.ForwardedParams}}) { return } - t.FailNow() -} diff --git a/vendor/github.com/stretchr/testify/require/require_forward.go b/vendor/github.com/stretchr/testify/require/require_forward.go deleted file mode 100644 index e6f7e944..00000000 --- a/vendor/github.com/stretchr/testify/require/require_forward.go +++ /dev/null @@ -1,1724 +0,0 @@ -// Code generated with github.com/stretchr/testify/_codegen; DO NOT EDIT. - -package require - -import ( - assert "github.com/stretchr/testify/assert" - http "net/http" - url "net/url" - time "time" -) - -// Condition uses a Comparison to assert a complex condition. -func (a *Assertions) Condition(comp assert.Comparison, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Condition(a.t, comp, msgAndArgs...) -} - -// Conditionf uses a Comparison to assert a complex condition. -func (a *Assertions) Conditionf(comp assert.Comparison, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Conditionf(a.t, comp, msg, args...) -} - -// Contains asserts that the specified string, list(array, slice...) or map contains the -// specified substring or element. -// -// a.Contains("Hello World", "World") -// a.Contains(["Hello", "World"], "World") -// a.Contains({"Hello": "World"}, "Hello") -func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Contains(a.t, s, contains, msgAndArgs...) -} - -// Containsf asserts that the specified string, list(array, slice...) or map contains the -// specified substring or element. -// -// a.Containsf("Hello World", "World", "error message %s", "formatted") -// a.Containsf(["Hello", "World"], "World", "error message %s", "formatted") -// a.Containsf({"Hello": "World"}, "Hello", "error message %s", "formatted") -func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Containsf(a.t, s, contains, msg, args...) -} - -// DirExists checks whether a directory exists in the given path. It also fails -// if the path is a file rather a directory or there is an error checking whether it exists. -func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - DirExists(a.t, path, msgAndArgs...) -} - -// DirExistsf checks whether a directory exists in the given path. It also fails -// if the path is a file rather a directory or there is an error checking whether it exists. -func (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - DirExistsf(a.t, path, msg, args...) -} - -// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified -// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, -// the number of appearances of each of them in both lists should match. -// -// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2]) -func (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - ElementsMatch(a.t, listA, listB, msgAndArgs...) -} - -// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified -// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, -// the number of appearances of each of them in both lists should match. -// -// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted") -func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - ElementsMatchf(a.t, listA, listB, msg, args...) -} - -// Empty asserts that the given value is "empty". -// -// [Zero values] are "empty". -// -// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). -// -// Slices, maps and channels with zero length are "empty". -// -// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". -// -// a.Empty(obj) -// -// [Zero values]: https://go.dev/ref/spec#The_zero_value -func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Empty(a.t, object, msgAndArgs...) -} - -// Emptyf asserts that the given value is "empty". -// -// [Zero values] are "empty". -// -// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). -// -// Slices, maps and channels with zero length are "empty". -// -// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". -// -// a.Emptyf(obj, "error message %s", "formatted") -// -// [Zero values]: https://go.dev/ref/spec#The_zero_value -func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Emptyf(a.t, object, msg, args...) -} - -// Equal asserts that two objects are equal. -// -// a.Equal(123, 123) -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). Function equality -// cannot be determined and will always fail. -func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Equal(a.t, expected, actual, msgAndArgs...) -} - -// EqualError asserts that a function returned an error (i.e. not `nil`) -// and that it is equal to the provided error. -// -// actualObj, err := SomeFunction() -// a.EqualError(err, expectedErrorString) -func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - EqualError(a.t, theError, errString, msgAndArgs...) -} - -// EqualErrorf asserts that a function returned an error (i.e. not `nil`) -// and that it is equal to the provided error. -// -// actualObj, err := SomeFunction() -// a.EqualErrorf(err, expectedErrorString, "error message %s", "formatted") -func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - EqualErrorf(a.t, theError, errString, msg, args...) -} - -// EqualExportedValues asserts that the types of two objects are equal and their public -// fields are also equal. This is useful for comparing structs that have private fields -// that could potentially differ. -// -// type S struct { -// Exported int -// notExported int -// } -// a.EqualExportedValues(S{1, 2}, S{1, 3}) => true -// a.EqualExportedValues(S{1, 2}, S{2, 3}) => false -func (a *Assertions) EqualExportedValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - EqualExportedValues(a.t, expected, actual, msgAndArgs...) -} - -// EqualExportedValuesf asserts that the types of two objects are equal and their public -// fields are also equal. This is useful for comparing structs that have private fields -// that could potentially differ. -// -// type S struct { -// Exported int -// notExported int -// } -// a.EqualExportedValuesf(S{1, 2}, S{1, 3}, "error message %s", "formatted") => true -// a.EqualExportedValuesf(S{1, 2}, S{2, 3}, "error message %s", "formatted") => false -func (a *Assertions) EqualExportedValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - EqualExportedValuesf(a.t, expected, actual, msg, args...) -} - -// EqualValues asserts that two objects are equal or convertible to the larger -// type and equal. -// -// a.EqualValues(uint32(123), int32(123)) -func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - EqualValues(a.t, expected, actual, msgAndArgs...) -} - -// EqualValuesf asserts that two objects are equal or convertible to the larger -// type and equal. -// -// a.EqualValuesf(uint32(123), int32(123), "error message %s", "formatted") -func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - EqualValuesf(a.t, expected, actual, msg, args...) -} - -// Equalf asserts that two objects are equal. -// -// a.Equalf(123, 123, "error message %s", "formatted") -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). Function equality -// cannot be determined and will always fail. -func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Equalf(a.t, expected, actual, msg, args...) -} - -// Error asserts that a function returned an error (i.e. not `nil`). -// -// actualObj, err := SomeFunction() -// a.Error(err) -func (a *Assertions) Error(err error, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Error(a.t, err, msgAndArgs...) -} - -// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. -// This is a wrapper for errors.As. -func (a *Assertions) ErrorAs(err error, target interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - ErrorAs(a.t, err, target, msgAndArgs...) -} - -// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. -// This is a wrapper for errors.As. -func (a *Assertions) ErrorAsf(err error, target interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - ErrorAsf(a.t, err, target, msg, args...) -} - -// ErrorContains asserts that a function returned an error (i.e. not `nil`) -// and that the error contains the specified substring. -// -// actualObj, err := SomeFunction() -// a.ErrorContains(err, expectedErrorSubString) -func (a *Assertions) ErrorContains(theError error, contains string, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - ErrorContains(a.t, theError, contains, msgAndArgs...) -} - -// ErrorContainsf asserts that a function returned an error (i.e. not `nil`) -// and that the error contains the specified substring. -// -// actualObj, err := SomeFunction() -// a.ErrorContainsf(err, expectedErrorSubString, "error message %s", "formatted") -func (a *Assertions) ErrorContainsf(theError error, contains string, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - ErrorContainsf(a.t, theError, contains, msg, args...) -} - -// ErrorIs asserts that at least one of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func (a *Assertions) ErrorIs(err error, target error, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - ErrorIs(a.t, err, target, msgAndArgs...) -} - -// ErrorIsf asserts that at least one of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func (a *Assertions) ErrorIsf(err error, target error, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - ErrorIsf(a.t, err, target, msg, args...) -} - -// Errorf asserts that a function returned an error (i.e. not `nil`). -// -// actualObj, err := SomeFunction() -// a.Errorf(err, "error message %s", "formatted") -func (a *Assertions) Errorf(err error, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Errorf(a.t, err, msg, args...) -} - -// Eventually asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. -// -// a.Eventually(func() bool { return true; }, time.Second, 10*time.Millisecond) -func (a *Assertions) Eventually(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Eventually(a.t, condition, waitFor, tick, msgAndArgs...) -} - -// EventuallyWithT asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. In contrast to Eventually, -// it supplies a CollectT to the condition function, so that the condition -// function can use the CollectT to call other assertions. -// The condition is considered "met" if no errors are raised in a tick. -// The supplied CollectT collects all errors from one tick (if there are any). -// If the condition is not met before waitFor, the collected errors of -// the last tick are copied to t. -// -// externalValue := false -// go func() { -// time.Sleep(8*time.Second) -// externalValue = true -// }() -// a.EventuallyWithT(func(c *assert.CollectT) { -// // add assertions as needed; any assertion failure will fail the current tick -// assert.True(c, externalValue, "expected 'externalValue' to be true") -// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false") -func (a *Assertions) EventuallyWithT(condition func(collect *assert.CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - EventuallyWithT(a.t, condition, waitFor, tick, msgAndArgs...) -} - -// EventuallyWithTf asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. In contrast to Eventually, -// it supplies a CollectT to the condition function, so that the condition -// function can use the CollectT to call other assertions. -// The condition is considered "met" if no errors are raised in a tick. -// The supplied CollectT collects all errors from one tick (if there are any). -// If the condition is not met before waitFor, the collected errors of -// the last tick are copied to t. -// -// externalValue := false -// go func() { -// time.Sleep(8*time.Second) -// externalValue = true -// }() -// a.EventuallyWithTf(func(c *assert.CollectT, "error message %s", "formatted") { -// // add assertions as needed; any assertion failure will fail the current tick -// assert.True(c, externalValue, "expected 'externalValue' to be true") -// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false") -func (a *Assertions) EventuallyWithTf(condition func(collect *assert.CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - EventuallyWithTf(a.t, condition, waitFor, tick, msg, args...) -} - -// Eventuallyf asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. -// -// a.Eventuallyf(func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") -func (a *Assertions) Eventuallyf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Eventuallyf(a.t, condition, waitFor, tick, msg, args...) -} - -// Exactly asserts that two objects are equal in value and type. -// -// a.Exactly(int32(123), int64(123)) -func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Exactly(a.t, expected, actual, msgAndArgs...) -} - -// Exactlyf asserts that two objects are equal in value and type. -// -// a.Exactlyf(int32(123), int64(123), "error message %s", "formatted") -func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Exactlyf(a.t, expected, actual, msg, args...) -} - -// Fail reports a failure through -func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Fail(a.t, failureMessage, msgAndArgs...) -} - -// FailNow fails test -func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - FailNow(a.t, failureMessage, msgAndArgs...) -} - -// FailNowf fails test -func (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - FailNowf(a.t, failureMessage, msg, args...) -} - -// Failf reports a failure through -func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Failf(a.t, failureMessage, msg, args...) -} - -// False asserts that the specified value is false. -// -// a.False(myBool) -func (a *Assertions) False(value bool, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - False(a.t, value, msgAndArgs...) -} - -// Falsef asserts that the specified value is false. -// -// a.Falsef(myBool, "error message %s", "formatted") -func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Falsef(a.t, value, msg, args...) -} - -// FileExists checks whether a file exists in the given path. It also fails if -// the path points to a directory or there is an error when trying to check the file. -func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - FileExists(a.t, path, msgAndArgs...) -} - -// FileExistsf checks whether a file exists in the given path. It also fails if -// the path points to a directory or there is an error when trying to check the file. -func (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - FileExistsf(a.t, path, msg, args...) -} - -// Greater asserts that the first element is greater than the second -// -// a.Greater(2, 1) -// a.Greater(float64(2), float64(1)) -// a.Greater("b", "a") -func (a *Assertions) Greater(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Greater(a.t, e1, e2, msgAndArgs...) -} - -// GreaterOrEqual asserts that the first element is greater than or equal to the second -// -// a.GreaterOrEqual(2, 1) -// a.GreaterOrEqual(2, 2) -// a.GreaterOrEqual("b", "a") -// a.GreaterOrEqual("b", "b") -func (a *Assertions) GreaterOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - GreaterOrEqual(a.t, e1, e2, msgAndArgs...) -} - -// GreaterOrEqualf asserts that the first element is greater than or equal to the second -// -// a.GreaterOrEqualf(2, 1, "error message %s", "formatted") -// a.GreaterOrEqualf(2, 2, "error message %s", "formatted") -// a.GreaterOrEqualf("b", "a", "error message %s", "formatted") -// a.GreaterOrEqualf("b", "b", "error message %s", "formatted") -func (a *Assertions) GreaterOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - GreaterOrEqualf(a.t, e1, e2, msg, args...) -} - -// Greaterf asserts that the first element is greater than the second -// -// a.Greaterf(2, 1, "error message %s", "formatted") -// a.Greaterf(float64(2), float64(1), "error message %s", "formatted") -// a.Greaterf("b", "a", "error message %s", "formatted") -func (a *Assertions) Greaterf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Greaterf(a.t, e1, e2, msg, args...) -} - -// HTTPBodyContains asserts that a specified handler returns a -// body that contains a string. -// -// a.HTTPBodyContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - HTTPBodyContains(a.t, handler, method, url, values, str, msgAndArgs...) -} - -// HTTPBodyContainsf asserts that a specified handler returns a -// body that contains a string. -// -// a.HTTPBodyContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - HTTPBodyContainsf(a.t, handler, method, url, values, str, msg, args...) -} - -// HTTPBodyNotContains asserts that a specified handler returns a -// body that does not contain a string. -// -// a.HTTPBodyNotContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - HTTPBodyNotContains(a.t, handler, method, url, values, str, msgAndArgs...) -} - -// HTTPBodyNotContainsf asserts that a specified handler returns a -// body that does not contain a string. -// -// a.HTTPBodyNotContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - HTTPBodyNotContainsf(a.t, handler, method, url, values, str, msg, args...) -} - -// HTTPError asserts that a specified handler returns an error status code. -// -// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - HTTPError(a.t, handler, method, url, values, msgAndArgs...) -} - -// HTTPErrorf asserts that a specified handler returns an error status code. -// -// a.HTTPErrorf(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - HTTPErrorf(a.t, handler, method, url, values, msg, args...) -} - -// HTTPRedirect asserts that a specified handler returns a redirect status code. -// -// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - HTTPRedirect(a.t, handler, method, url, values, msgAndArgs...) -} - -// HTTPRedirectf asserts that a specified handler returns a redirect status code. -// -// a.HTTPRedirectf(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - HTTPRedirectf(a.t, handler, method, url, values, msg, args...) -} - -// HTTPStatusCode asserts that a specified handler returns a specified status code. -// -// a.HTTPStatusCode(myHandler, "GET", "/notImplemented", nil, 501) -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPStatusCode(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - HTTPStatusCode(a.t, handler, method, url, values, statuscode, msgAndArgs...) -} - -// HTTPStatusCodef asserts that a specified handler returns a specified status code. -// -// a.HTTPStatusCodef(myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPStatusCodef(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - HTTPStatusCodef(a.t, handler, method, url, values, statuscode, msg, args...) -} - -// HTTPSuccess asserts that a specified handler returns a success status code. -// -// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil) -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - HTTPSuccess(a.t, handler, method, url, values, msgAndArgs...) -} - -// HTTPSuccessf asserts that a specified handler returns a success status code. -// -// a.HTTPSuccessf(myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - HTTPSuccessf(a.t, handler, method, url, values, msg, args...) -} - -// Implements asserts that an object is implemented by the specified interface. -// -// a.Implements((*MyInterface)(nil), new(MyObject)) -func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Implements(a.t, interfaceObject, object, msgAndArgs...) -} - -// Implementsf asserts that an object is implemented by the specified interface. -// -// a.Implementsf((*MyInterface)(nil), new(MyObject), "error message %s", "formatted") -func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Implementsf(a.t, interfaceObject, object, msg, args...) -} - -// InDelta asserts that the two numerals are within delta of each other. -// -// a.InDelta(math.Pi, 22/7.0, 0.01) -func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - InDelta(a.t, expected, actual, delta, msgAndArgs...) -} - -// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. -func (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - InDeltaMapValues(a.t, expected, actual, delta, msgAndArgs...) -} - -// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. -func (a *Assertions) InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - InDeltaMapValuesf(a.t, expected, actual, delta, msg, args...) -} - -// InDeltaSlice is the same as InDelta, except it compares two slices. -func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...) -} - -// InDeltaSlicef is the same as InDelta, except it compares two slices. -func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - InDeltaSlicef(a.t, expected, actual, delta, msg, args...) -} - -// InDeltaf asserts that the two numerals are within delta of each other. -// -// a.InDeltaf(math.Pi, 22/7.0, 0.01, "error message %s", "formatted") -func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - InDeltaf(a.t, expected, actual, delta, msg, args...) -} - -// InEpsilon asserts that expected and actual have a relative error less than epsilon -func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...) -} - -// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices. -func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - InEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...) -} - -// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices. -func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - InEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...) -} - -// InEpsilonf asserts that expected and actual have a relative error less than epsilon -func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - InEpsilonf(a.t, expected, actual, epsilon, msg, args...) -} - -// IsDecreasing asserts that the collection is decreasing -// -// a.IsDecreasing([]int{2, 1, 0}) -// a.IsDecreasing([]float{2, 1}) -// a.IsDecreasing([]string{"b", "a"}) -func (a *Assertions) IsDecreasing(object interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - IsDecreasing(a.t, object, msgAndArgs...) -} - -// IsDecreasingf asserts that the collection is decreasing -// -// a.IsDecreasingf([]int{2, 1, 0}, "error message %s", "formatted") -// a.IsDecreasingf([]float{2, 1}, "error message %s", "formatted") -// a.IsDecreasingf([]string{"b", "a"}, "error message %s", "formatted") -func (a *Assertions) IsDecreasingf(object interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - IsDecreasingf(a.t, object, msg, args...) -} - -// IsIncreasing asserts that the collection is increasing -// -// a.IsIncreasing([]int{1, 2, 3}) -// a.IsIncreasing([]float{1, 2}) -// a.IsIncreasing([]string{"a", "b"}) -func (a *Assertions) IsIncreasing(object interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - IsIncreasing(a.t, object, msgAndArgs...) -} - -// IsIncreasingf asserts that the collection is increasing -// -// a.IsIncreasingf([]int{1, 2, 3}, "error message %s", "formatted") -// a.IsIncreasingf([]float{1, 2}, "error message %s", "formatted") -// a.IsIncreasingf([]string{"a", "b"}, "error message %s", "formatted") -func (a *Assertions) IsIncreasingf(object interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - IsIncreasingf(a.t, object, msg, args...) -} - -// IsNonDecreasing asserts that the collection is not decreasing -// -// a.IsNonDecreasing([]int{1, 1, 2}) -// a.IsNonDecreasing([]float{1, 2}) -// a.IsNonDecreasing([]string{"a", "b"}) -func (a *Assertions) IsNonDecreasing(object interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - IsNonDecreasing(a.t, object, msgAndArgs...) -} - -// IsNonDecreasingf asserts that the collection is not decreasing -// -// a.IsNonDecreasingf([]int{1, 1, 2}, "error message %s", "formatted") -// a.IsNonDecreasingf([]float{1, 2}, "error message %s", "formatted") -// a.IsNonDecreasingf([]string{"a", "b"}, "error message %s", "formatted") -func (a *Assertions) IsNonDecreasingf(object interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - IsNonDecreasingf(a.t, object, msg, args...) -} - -// IsNonIncreasing asserts that the collection is not increasing -// -// a.IsNonIncreasing([]int{2, 1, 1}) -// a.IsNonIncreasing([]float{2, 1}) -// a.IsNonIncreasing([]string{"b", "a"}) -func (a *Assertions) IsNonIncreasing(object interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - IsNonIncreasing(a.t, object, msgAndArgs...) -} - -// IsNonIncreasingf asserts that the collection is not increasing -// -// a.IsNonIncreasingf([]int{2, 1, 1}, "error message %s", "formatted") -// a.IsNonIncreasingf([]float{2, 1}, "error message %s", "formatted") -// a.IsNonIncreasingf([]string{"b", "a"}, "error message %s", "formatted") -func (a *Assertions) IsNonIncreasingf(object interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - IsNonIncreasingf(a.t, object, msg, args...) -} - -// IsNotType asserts that the specified objects are not of the same type. -// -// a.IsNotType(&NotMyStruct{}, &MyStruct{}) -func (a *Assertions) IsNotType(theType interface{}, object interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - IsNotType(a.t, theType, object, msgAndArgs...) -} - -// IsNotTypef asserts that the specified objects are not of the same type. -// -// a.IsNotTypef(&NotMyStruct{}, &MyStruct{}, "error message %s", "formatted") -func (a *Assertions) IsNotTypef(theType interface{}, object interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - IsNotTypef(a.t, theType, object, msg, args...) -} - -// IsType asserts that the specified objects are of the same type. -// -// a.IsType(&MyStruct{}, &MyStruct{}) -func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - IsType(a.t, expectedType, object, msgAndArgs...) -} - -// IsTypef asserts that the specified objects are of the same type. -// -// a.IsTypef(&MyStruct{}, &MyStruct{}, "error message %s", "formatted") -func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - IsTypef(a.t, expectedType, object, msg, args...) -} - -// JSONEq asserts that two JSON strings are equivalent. -// -// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) -func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - JSONEq(a.t, expected, actual, msgAndArgs...) -} - -// JSONEqf asserts that two JSON strings are equivalent. -// -// a.JSONEqf(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted") -func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - JSONEqf(a.t, expected, actual, msg, args...) -} - -// Len asserts that the specified object has specific length. -// Len also fails if the object has a type that len() not accept. -// -// a.Len(mySlice, 3) -func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Len(a.t, object, length, msgAndArgs...) -} - -// Lenf asserts that the specified object has specific length. -// Lenf also fails if the object has a type that len() not accept. -// -// a.Lenf(mySlice, 3, "error message %s", "formatted") -func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Lenf(a.t, object, length, msg, args...) -} - -// Less asserts that the first element is less than the second -// -// a.Less(1, 2) -// a.Less(float64(1), float64(2)) -// a.Less("a", "b") -func (a *Assertions) Less(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Less(a.t, e1, e2, msgAndArgs...) -} - -// LessOrEqual asserts that the first element is less than or equal to the second -// -// a.LessOrEqual(1, 2) -// a.LessOrEqual(2, 2) -// a.LessOrEqual("a", "b") -// a.LessOrEqual("b", "b") -func (a *Assertions) LessOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - LessOrEqual(a.t, e1, e2, msgAndArgs...) -} - -// LessOrEqualf asserts that the first element is less than or equal to the second -// -// a.LessOrEqualf(1, 2, "error message %s", "formatted") -// a.LessOrEqualf(2, 2, "error message %s", "formatted") -// a.LessOrEqualf("a", "b", "error message %s", "formatted") -// a.LessOrEqualf("b", "b", "error message %s", "formatted") -func (a *Assertions) LessOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - LessOrEqualf(a.t, e1, e2, msg, args...) -} - -// Lessf asserts that the first element is less than the second -// -// a.Lessf(1, 2, "error message %s", "formatted") -// a.Lessf(float64(1), float64(2), "error message %s", "formatted") -// a.Lessf("a", "b", "error message %s", "formatted") -func (a *Assertions) Lessf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Lessf(a.t, e1, e2, msg, args...) -} - -// Negative asserts that the specified element is negative -// -// a.Negative(-1) -// a.Negative(-1.23) -func (a *Assertions) Negative(e interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Negative(a.t, e, msgAndArgs...) -} - -// Negativef asserts that the specified element is negative -// -// a.Negativef(-1, "error message %s", "formatted") -// a.Negativef(-1.23, "error message %s", "formatted") -func (a *Assertions) Negativef(e interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Negativef(a.t, e, msg, args...) -} - -// Never asserts that the given condition doesn't satisfy in waitFor time, -// periodically checking the target function each tick. -// -// a.Never(func() bool { return false; }, time.Second, 10*time.Millisecond) -func (a *Assertions) Never(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Never(a.t, condition, waitFor, tick, msgAndArgs...) -} - -// Neverf asserts that the given condition doesn't satisfy in waitFor time, -// periodically checking the target function each tick. -// -// a.Neverf(func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") -func (a *Assertions) Neverf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Neverf(a.t, condition, waitFor, tick, msg, args...) -} - -// Nil asserts that the specified object is nil. -// -// a.Nil(err) -func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Nil(a.t, object, msgAndArgs...) -} - -// Nilf asserts that the specified object is nil. -// -// a.Nilf(err, "error message %s", "formatted") -func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Nilf(a.t, object, msg, args...) -} - -// NoDirExists checks whether a directory does not exist in the given path. -// It fails if the path points to an existing _directory_ only. -func (a *Assertions) NoDirExists(path string, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NoDirExists(a.t, path, msgAndArgs...) -} - -// NoDirExistsf checks whether a directory does not exist in the given path. -// It fails if the path points to an existing _directory_ only. -func (a *Assertions) NoDirExistsf(path string, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NoDirExistsf(a.t, path, msg, args...) -} - -// NoError asserts that a function returned no error (i.e. `nil`). -// -// actualObj, err := SomeFunction() -// if a.NoError(err) { -// assert.Equal(t, expectedObj, actualObj) -// } -func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NoError(a.t, err, msgAndArgs...) -} - -// NoErrorf asserts that a function returned no error (i.e. `nil`). -// -// actualObj, err := SomeFunction() -// if a.NoErrorf(err, "error message %s", "formatted") { -// assert.Equal(t, expectedObj, actualObj) -// } -func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NoErrorf(a.t, err, msg, args...) -} - -// NoFileExists checks whether a file does not exist in a given path. It fails -// if the path points to an existing _file_ only. -func (a *Assertions) NoFileExists(path string, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NoFileExists(a.t, path, msgAndArgs...) -} - -// NoFileExistsf checks whether a file does not exist in a given path. It fails -// if the path points to an existing _file_ only. -func (a *Assertions) NoFileExistsf(path string, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NoFileExistsf(a.t, path, msg, args...) -} - -// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the -// specified substring or element. -// -// a.NotContains("Hello World", "Earth") -// a.NotContains(["Hello", "World"], "Earth") -// a.NotContains({"Hello": "World"}, "Earth") -func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotContains(a.t, s, contains, msgAndArgs...) -} - -// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the -// specified substring or element. -// -// a.NotContainsf("Hello World", "Earth", "error message %s", "formatted") -// a.NotContainsf(["Hello", "World"], "Earth", "error message %s", "formatted") -// a.NotContainsf({"Hello": "World"}, "Earth", "error message %s", "formatted") -func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotContainsf(a.t, s, contains, msg, args...) -} - -// NotElementsMatch asserts that the specified listA(array, slice...) is NOT equal to specified -// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, -// the number of appearances of each of them in both lists should not match. -// This is an inverse of ElementsMatch. -// -// a.NotElementsMatch([1, 1, 2, 3], [1, 1, 2, 3]) -> false -// -// a.NotElementsMatch([1, 1, 2, 3], [1, 2, 3]) -> true -// -// a.NotElementsMatch([1, 2, 3], [1, 2, 4]) -> true -func (a *Assertions) NotElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotElementsMatch(a.t, listA, listB, msgAndArgs...) -} - -// NotElementsMatchf asserts that the specified listA(array, slice...) is NOT equal to specified -// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, -// the number of appearances of each of them in both lists should not match. -// This is an inverse of ElementsMatch. -// -// a.NotElementsMatchf([1, 1, 2, 3], [1, 1, 2, 3], "error message %s", "formatted") -> false -// -// a.NotElementsMatchf([1, 1, 2, 3], [1, 2, 3], "error message %s", "formatted") -> true -// -// a.NotElementsMatchf([1, 2, 3], [1, 2, 4], "error message %s", "formatted") -> true -func (a *Assertions) NotElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotElementsMatchf(a.t, listA, listB, msg, args...) -} - -// NotEmpty asserts that the specified object is NOT [Empty]. -// -// if a.NotEmpty(obj) { -// assert.Equal(t, "two", obj[1]) -// } -func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotEmpty(a.t, object, msgAndArgs...) -} - -// NotEmptyf asserts that the specified object is NOT [Empty]. -// -// if a.NotEmptyf(obj, "error message %s", "formatted") { -// assert.Equal(t, "two", obj[1]) -// } -func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotEmptyf(a.t, object, msg, args...) -} - -// NotEqual asserts that the specified values are NOT equal. -// -// a.NotEqual(obj1, obj2) -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). -func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotEqual(a.t, expected, actual, msgAndArgs...) -} - -// NotEqualValues asserts that two objects are not equal even when converted to the same type -// -// a.NotEqualValues(obj1, obj2) -func (a *Assertions) NotEqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotEqualValues(a.t, expected, actual, msgAndArgs...) -} - -// NotEqualValuesf asserts that two objects are not equal even when converted to the same type -// -// a.NotEqualValuesf(obj1, obj2, "error message %s", "formatted") -func (a *Assertions) NotEqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotEqualValuesf(a.t, expected, actual, msg, args...) -} - -// NotEqualf asserts that the specified values are NOT equal. -// -// a.NotEqualf(obj1, obj2, "error message %s", "formatted") -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). -func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotEqualf(a.t, expected, actual, msg, args...) -} - -// NotErrorAs asserts that none of the errors in err's chain matches target, -// but if so, sets target to that error value. -func (a *Assertions) NotErrorAs(err error, target interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotErrorAs(a.t, err, target, msgAndArgs...) -} - -// NotErrorAsf asserts that none of the errors in err's chain matches target, -// but if so, sets target to that error value. -func (a *Assertions) NotErrorAsf(err error, target interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotErrorAsf(a.t, err, target, msg, args...) -} - -// NotErrorIs asserts that none of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func (a *Assertions) NotErrorIs(err error, target error, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotErrorIs(a.t, err, target, msgAndArgs...) -} - -// NotErrorIsf asserts that none of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func (a *Assertions) NotErrorIsf(err error, target error, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotErrorIsf(a.t, err, target, msg, args...) -} - -// NotImplements asserts that an object does not implement the specified interface. -// -// a.NotImplements((*MyInterface)(nil), new(MyObject)) -func (a *Assertions) NotImplements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotImplements(a.t, interfaceObject, object, msgAndArgs...) -} - -// NotImplementsf asserts that an object does not implement the specified interface. -// -// a.NotImplementsf((*MyInterface)(nil), new(MyObject), "error message %s", "formatted") -func (a *Assertions) NotImplementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotImplementsf(a.t, interfaceObject, object, msg, args...) -} - -// NotNil asserts that the specified object is not nil. -// -// a.NotNil(err) -func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotNil(a.t, object, msgAndArgs...) -} - -// NotNilf asserts that the specified object is not nil. -// -// a.NotNilf(err, "error message %s", "formatted") -func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotNilf(a.t, object, msg, args...) -} - -// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. -// -// a.NotPanics(func(){ RemainCalm() }) -func (a *Assertions) NotPanics(f assert.PanicTestFunc, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotPanics(a.t, f, msgAndArgs...) -} - -// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic. -// -// a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted") -func (a *Assertions) NotPanicsf(f assert.PanicTestFunc, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotPanicsf(a.t, f, msg, args...) -} - -// NotRegexp asserts that a specified regexp does not match a string. -// -// a.NotRegexp(regexp.MustCompile("starts"), "it's starting") -// a.NotRegexp("^start", "it's not starting") -func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotRegexp(a.t, rx, str, msgAndArgs...) -} - -// NotRegexpf asserts that a specified regexp does not match a string. -// -// a.NotRegexpf(regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted") -// a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted") -func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotRegexpf(a.t, rx, str, msg, args...) -} - -// NotSame asserts that two pointers do not reference the same object. -// -// a.NotSame(ptr1, ptr2) -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func (a *Assertions) NotSame(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotSame(a.t, expected, actual, msgAndArgs...) -} - -// NotSamef asserts that two pointers do not reference the same object. -// -// a.NotSamef(ptr1, ptr2, "error message %s", "formatted") -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func (a *Assertions) NotSamef(expected interface{}, actual interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotSamef(a.t, expected, actual, msg, args...) -} - -// NotSubset asserts that the list (array, slice, or map) does NOT contain all -// elements given in the subset (array, slice, or map). -// Map elements are key-value pairs unless compared with an array or slice where -// only the map key is evaluated. -// -// a.NotSubset([1, 3, 4], [1, 2]) -// a.NotSubset({"x": 1, "y": 2}, {"z": 3}) -// a.NotSubset([1, 3, 4], {1: "one", 2: "two"}) -// a.NotSubset({"x": 1, "y": 2}, ["z"]) -func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotSubset(a.t, list, subset, msgAndArgs...) -} - -// NotSubsetf asserts that the list (array, slice, or map) does NOT contain all -// elements given in the subset (array, slice, or map). -// Map elements are key-value pairs unless compared with an array or slice where -// only the map key is evaluated. -// -// a.NotSubsetf([1, 3, 4], [1, 2], "error message %s", "formatted") -// a.NotSubsetf({"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") -// a.NotSubsetf([1, 3, 4], {1: "one", 2: "two"}, "error message %s", "formatted") -// a.NotSubsetf({"x": 1, "y": 2}, ["z"], "error message %s", "formatted") -func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotSubsetf(a.t, list, subset, msg, args...) -} - -// NotZero asserts that i is not the zero value for its type. -func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotZero(a.t, i, msgAndArgs...) -} - -// NotZerof asserts that i is not the zero value for its type. -func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - NotZerof(a.t, i, msg, args...) -} - -// Panics asserts that the code inside the specified PanicTestFunc panics. -// -// a.Panics(func(){ GoCrazy() }) -func (a *Assertions) Panics(f assert.PanicTestFunc, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Panics(a.t, f, msgAndArgs...) -} - -// PanicsWithError asserts that the code inside the specified PanicTestFunc -// panics, and that the recovered panic value is an error that satisfies the -// EqualError comparison. -// -// a.PanicsWithError("crazy error", func(){ GoCrazy() }) -func (a *Assertions) PanicsWithError(errString string, f assert.PanicTestFunc, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - PanicsWithError(a.t, errString, f, msgAndArgs...) -} - -// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc -// panics, and that the recovered panic value is an error that satisfies the -// EqualError comparison. -// -// a.PanicsWithErrorf("crazy error", func(){ GoCrazy() }, "error message %s", "formatted") -func (a *Assertions) PanicsWithErrorf(errString string, f assert.PanicTestFunc, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - PanicsWithErrorf(a.t, errString, f, msg, args...) -} - -// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that -// the recovered panic value equals the expected panic value. -// -// a.PanicsWithValue("crazy error", func(){ GoCrazy() }) -func (a *Assertions) PanicsWithValue(expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - PanicsWithValue(a.t, expected, f, msgAndArgs...) -} - -// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that -// the recovered panic value equals the expected panic value. -// -// a.PanicsWithValuef("crazy error", func(){ GoCrazy() }, "error message %s", "formatted") -func (a *Assertions) PanicsWithValuef(expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - PanicsWithValuef(a.t, expected, f, msg, args...) -} - -// Panicsf asserts that the code inside the specified PanicTestFunc panics. -// -// a.Panicsf(func(){ GoCrazy() }, "error message %s", "formatted") -func (a *Assertions) Panicsf(f assert.PanicTestFunc, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Panicsf(a.t, f, msg, args...) -} - -// Positive asserts that the specified element is positive -// -// a.Positive(1) -// a.Positive(1.23) -func (a *Assertions) Positive(e interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Positive(a.t, e, msgAndArgs...) -} - -// Positivef asserts that the specified element is positive -// -// a.Positivef(1, "error message %s", "formatted") -// a.Positivef(1.23, "error message %s", "formatted") -func (a *Assertions) Positivef(e interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Positivef(a.t, e, msg, args...) -} - -// Regexp asserts that a specified regexp matches a string. -// -// a.Regexp(regexp.MustCompile("start"), "it's starting") -// a.Regexp("start...$", "it's not starting") -func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Regexp(a.t, rx, str, msgAndArgs...) -} - -// Regexpf asserts that a specified regexp matches a string. -// -// a.Regexpf(regexp.MustCompile("start"), "it's starting", "error message %s", "formatted") -// a.Regexpf("start...$", "it's not starting", "error message %s", "formatted") -func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Regexpf(a.t, rx, str, msg, args...) -} - -// Same asserts that two pointers reference the same object. -// -// a.Same(ptr1, ptr2) -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func (a *Assertions) Same(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Same(a.t, expected, actual, msgAndArgs...) -} - -// Samef asserts that two pointers reference the same object. -// -// a.Samef(ptr1, ptr2, "error message %s", "formatted") -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func (a *Assertions) Samef(expected interface{}, actual interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Samef(a.t, expected, actual, msg, args...) -} - -// Subset asserts that the list (array, slice, or map) contains all elements -// given in the subset (array, slice, or map). -// Map elements are key-value pairs unless compared with an array or slice where -// only the map key is evaluated. -// -// a.Subset([1, 2, 3], [1, 2]) -// a.Subset({"x": 1, "y": 2}, {"x": 1}) -// a.Subset([1, 2, 3], {1: "one", 2: "two"}) -// a.Subset({"x": 1, "y": 2}, ["x"]) -func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Subset(a.t, list, subset, msgAndArgs...) -} - -// Subsetf asserts that the list (array, slice, or map) contains all elements -// given in the subset (array, slice, or map). -// Map elements are key-value pairs unless compared with an array or slice where -// only the map key is evaluated. -// -// a.Subsetf([1, 2, 3], [1, 2], "error message %s", "formatted") -// a.Subsetf({"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") -// a.Subsetf([1, 2, 3], {1: "one", 2: "two"}, "error message %s", "formatted") -// a.Subsetf({"x": 1, "y": 2}, ["x"], "error message %s", "formatted") -func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Subsetf(a.t, list, subset, msg, args...) -} - -// True asserts that the specified value is true. -// -// a.True(myBool) -func (a *Assertions) True(value bool, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - True(a.t, value, msgAndArgs...) -} - -// Truef asserts that the specified value is true. -// -// a.Truef(myBool, "error message %s", "formatted") -func (a *Assertions) Truef(value bool, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Truef(a.t, value, msg, args...) -} - -// WithinDuration asserts that the two times are within duration delta of each other. -// -// a.WithinDuration(time.Now(), time.Now(), 10*time.Second) -func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - WithinDuration(a.t, expected, actual, delta, msgAndArgs...) -} - -// WithinDurationf asserts that the two times are within duration delta of each other. -// -// a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted") -func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - WithinDurationf(a.t, expected, actual, delta, msg, args...) -} - -// WithinRange asserts that a time is within a time range (inclusive). -// -// a.WithinRange(time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second)) -func (a *Assertions) WithinRange(actual time.Time, start time.Time, end time.Time, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - WithinRange(a.t, actual, start, end, msgAndArgs...) -} - -// WithinRangef asserts that a time is within a time range (inclusive). -// -// a.WithinRangef(time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), "error message %s", "formatted") -func (a *Assertions) WithinRangef(actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - WithinRangef(a.t, actual, start, end, msg, args...) -} - -// YAMLEq asserts that two YAML strings are equivalent. -func (a *Assertions) YAMLEq(expected string, actual string, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - YAMLEq(a.t, expected, actual, msgAndArgs...) -} - -// YAMLEqf asserts that two YAML strings are equivalent. -func (a *Assertions) YAMLEqf(expected string, actual string, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - YAMLEqf(a.t, expected, actual, msg, args...) -} - -// Zero asserts that i is the zero value for its type. -func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Zero(a.t, i, msgAndArgs...) -} - -// Zerof asserts that i is the zero value for its type. -func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - Zerof(a.t, i, msg, args...) -} diff --git a/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl b/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl deleted file mode 100644 index 54124df1..00000000 --- a/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -{{.CommentWithoutT "a"}} -func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) { - if h, ok := a.t.(tHelper); ok { h.Helper() } - {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) -} diff --git a/vendor/github.com/stretchr/testify/require/requirements.go b/vendor/github.com/stretchr/testify/require/requirements.go deleted file mode 100644 index 6b7ce929..00000000 --- a/vendor/github.com/stretchr/testify/require/requirements.go +++ /dev/null @@ -1,29 +0,0 @@ -package require - -// TestingT is an interface wrapper around *testing.T -type TestingT interface { - Errorf(format string, args ...interface{}) - FailNow() -} - -type tHelper = interface { - Helper() -} - -// ComparisonAssertionFunc is a common function prototype when comparing two values. Can be useful -// for table driven tests. -type ComparisonAssertionFunc func(TestingT, interface{}, interface{}, ...interface{}) - -// ValueAssertionFunc is a common function prototype when validating a single value. Can be useful -// for table driven tests. -type ValueAssertionFunc func(TestingT, interface{}, ...interface{}) - -// BoolAssertionFunc is a common function prototype when validating a bool value. Can be useful -// for table driven tests. -type BoolAssertionFunc func(TestingT, bool, ...interface{}) - -// ErrorAssertionFunc is a common function prototype when validating an error value. Can be useful -// for table driven tests. -type ErrorAssertionFunc func(TestingT, error, ...interface{}) - -//go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=require -template=require.go.tmpl -include-format-funcs" diff --git a/vendor/github.com/tklauser/go-sysconf/.cirrus.yml b/vendor/github.com/tklauser/go-sysconf/.cirrus.yml index 495e5e63..61724abe 100644 --- a/vendor/github.com/tklauser/go-sysconf/.cirrus.yml +++ b/vendor/github.com/tklauser/go-sysconf/.cirrus.yml @@ -1,6 +1,6 @@ env: CIRRUS_CLONE_DEPTH: 1 - GO_VERSION: go1.24.0 + GO_VERSION: go1.25.0 freebsd_13_task: freebsd_instance: diff --git a/vendor/github.com/tklauser/go-sysconf/sysconf_netbsd.go b/vendor/github.com/tklauser/go-sysconf/sysconf_netbsd.go index 40f6c345..87cf6a10 100644 --- a/vendor/github.com/tklauser/go-sysconf/sysconf_netbsd.go +++ b/vendor/github.com/tklauser/go-sysconf/sysconf_netbsd.go @@ -25,10 +25,13 @@ const ( _POSIX2_UPE = -1 ) -var clktck struct { - sync.Once - v int64 -} +var clktck = sync.OnceValue(func() int64 { + ci, err := unix.SysctlClockinfo("kern.clockrate") + if err != nil { + return -1 + } + return int64(ci.Hz) +}) func sysconfPOSIX(name int) (int64, error) { // NetBSD does not define all _POSIX_* values used in sysconf_posix.go @@ -54,14 +57,7 @@ func sysconf(name int) (int64, error) { } return -1, nil case SC_CLK_TCK: - // TODO: use sync.OnceValue once Go 1.21 is the minimal supported version - clktck.Do(func() { - clktck.v = -1 - if ci, err := unix.SysctlClockinfo("kern.clockrate"); err == nil { - clktck.v = int64(ci.Hz) - } - }) - return clktck.v, nil + return clktck(), nil case SC_NGROUPS_MAX: return sysctl32("kern.ngroups"), nil case SC_JOB_CONTROL: diff --git a/vendor/github.com/tklauser/numcpus/.cirrus.yml b/vendor/github.com/tklauser/numcpus/.cirrus.yml index 495e5e63..61724abe 100644 --- a/vendor/github.com/tklauser/numcpus/.cirrus.yml +++ b/vendor/github.com/tklauser/numcpus/.cirrus.yml @@ -1,6 +1,6 @@ env: CIRRUS_CLONE_DEPTH: 1 - GO_VERSION: go1.24.0 + GO_VERSION: go1.25.0 freebsd_13_task: freebsd_instance: diff --git a/vendor/github.com/tklauser/numcpus/numcpus_linux.go b/vendor/github.com/tklauser/numcpus/numcpus_linux.go index 7b991da4..d05ee982 100644 --- a/vendor/github.com/tklauser/numcpus/numcpus_linux.go +++ b/vendor/github.com/tklauser/numcpus/numcpus_linux.go @@ -47,10 +47,12 @@ func readCPURangeWith[T any](file string, f func(cpus string) (T, error)) (T, er if err != nil { return zero, err } - return f(strings.Trim(string(buf), "\n ")) + return f(string(buf)) } func countCPURange(cpus string) (int, error) { + cpus = strings.Trim(cpus, "\n ") + // Treat empty file as valid. This might be the case if there are no offline CPUs in which // case /sys/devices/system/cpu/offline is empty. if cpus == "" { @@ -58,7 +60,7 @@ func countCPURange(cpus string) (int, error) { } n := int(0) - for _, cpuRange := range strings.Split(cpus, ",") { + for cpuRange := range strings.SplitSeq(cpus, ",") { if cpuRange == "" { return 0, fmt.Errorf("empty CPU range in CPU string %q", cpus) } @@ -84,13 +86,15 @@ func countCPURange(cpus string) (int, error) { } func listCPURange(cpus string) ([]int, error) { + cpus = strings.Trim(cpus, "\n ") + // See comment in countCPURange. if cpus == "" { return []int{}, nil } list := []int{} - for _, cpuRange := range strings.Split(cpus, ",") { + for cpuRange := range strings.SplitSeq(cpus, ",") { if cpuRange == "" { return nil, fmt.Errorf("empty CPU range in CPU string %q", cpus) } diff --git a/vendor/golang.org/x/sys/cpu/cpu.go b/vendor/golang.org/x/sys/cpu/cpu.go index 63541994..34c9ae76 100644 --- a/vendor/golang.org/x/sys/cpu/cpu.go +++ b/vendor/golang.org/x/sys/cpu/cpu.go @@ -92,6 +92,9 @@ var ARM64 struct { HasSHA2 bool // SHA2 hardware implementation HasCRC32 bool // CRC32 hardware implementation HasATOMICS bool // Atomic memory operation instruction set + HasHPDS bool // Hierarchical permission disables in translations tables + HasLOR bool // Limited ordering regions + HasPAN bool // Privileged access never HasFPHP bool // Half precision floating-point instruction set HasASIMDHP bool // Advanced SIMD half precision instruction set HasCPUID bool // CPUID identification scheme registers diff --git a/vendor/golang.org/x/sys/cpu/cpu_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_arm64.go index af2aa99f..f449c679 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_arm64.go @@ -65,10 +65,10 @@ func setMinimalFeatures() { func readARM64Registers() { Initialized = true - parseARM64SystemRegisters(getisar0(), getisar1(), getpfr0()) + parseARM64SystemRegisters(getisar0(), getisar1(), getmmfr1(), getpfr0()) } -func parseARM64SystemRegisters(isar0, isar1, pfr0 uint64) { +func parseARM64SystemRegisters(isar0, isar1, mmfr1, pfr0 uint64) { // ID_AA64ISAR0_EL1 switch extractBits(isar0, 4, 7) { case 1: @@ -152,6 +152,22 @@ func parseARM64SystemRegisters(isar0, isar1, pfr0 uint64) { ARM64.HasI8MM = true } + // ID_AA64MMFR1_EL1 + switch extractBits(mmfr1, 12, 15) { + case 1, 2: + ARM64.HasHPDS = true + } + + switch extractBits(mmfr1, 16, 19) { + case 1: + ARM64.HasLOR = true + } + + switch extractBits(mmfr1, 20, 23) { + case 1, 2, 3: + ARM64.HasPAN = true + } + // ID_AA64PFR0_EL1 switch extractBits(pfr0, 16, 19) { case 0: diff --git a/vendor/golang.org/x/sys/cpu/cpu_arm64.s b/vendor/golang.org/x/sys/cpu/cpu_arm64.s index 22cc9984..a4f24b3b 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_arm64.s +++ b/vendor/golang.org/x/sys/cpu/cpu_arm64.s @@ -9,31 +9,34 @@ // func getisar0() uint64 TEXT ·getisar0(SB),NOSPLIT,$0-8 // get Instruction Set Attributes 0 into x0 - // mrs x0, ID_AA64ISAR0_EL1 = d5380600 - WORD $0xd5380600 + MRS ID_AA64ISAR0_EL1, R0 MOVD R0, ret+0(FP) RET // func getisar1() uint64 TEXT ·getisar1(SB),NOSPLIT,$0-8 // get Instruction Set Attributes 1 into x0 - // mrs x0, ID_AA64ISAR1_EL1 = d5380620 - WORD $0xd5380620 + MRS ID_AA64ISAR1_EL1, R0 + MOVD R0, ret+0(FP) + RET + +// func getmmfr1() uint64 +TEXT ·getmmfr1(SB),NOSPLIT,$0-8 + // get Memory Model Feature Register 1 into x0 + MRS ID_AA64MMFR1_EL1, R0 MOVD R0, ret+0(FP) RET // func getpfr0() uint64 TEXT ·getpfr0(SB),NOSPLIT,$0-8 // get Processor Feature Register 0 into x0 - // mrs x0, ID_AA64PFR0_EL1 = d5380400 - WORD $0xd5380400 + MRS ID_AA64PFR0_EL1, R0 MOVD R0, ret+0(FP) RET // func getzfr0() uint64 TEXT ·getzfr0(SB),NOSPLIT,$0-8 // get SVE Feature Register 0 into x0 - // mrs x0, ID_AA64ZFR0_EL1 = d5380480 - WORD $0xd5380480 + MRS ID_AA64ZFR0_EL1, R0 MOVD R0, ret+0(FP) RET diff --git a/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go index 6ac6e1ef..e3fc5a8d 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go @@ -8,5 +8,6 @@ package cpu func getisar0() uint64 func getisar1() uint64 +func getmmfr1() uint64 func getpfr0() uint64 func getzfr0() uint64 diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go index 7f194678..8df2079e 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go @@ -8,4 +8,5 @@ package cpu func getisar0() uint64 { return 0 } func getisar1() uint64 { return 0 } +func getmmfr1() uint64 { return 0 } func getpfr0() uint64 { return 0 } diff --git a/vendor/golang.org/x/sys/cpu/cpu_netbsd_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_netbsd_arm64.go index ebfb3fc8..19aea063 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_netbsd_arm64.go @@ -167,7 +167,7 @@ func doinit() { setMinimalFeatures() return } - parseARM64SystemRegisters(cpuid.aa64isar0, cpuid.aa64isar1, cpuid.aa64pfr0) + parseARM64SystemRegisters(cpuid.aa64isar0, cpuid.aa64isar1, cpuid.aa64mmfr1, cpuid.aa64pfr0) Initialized = true } diff --git a/vendor/golang.org/x/sys/cpu/cpu_openbsd_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_openbsd_arm64.go index 85b64d5c..87fd3a77 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_openbsd_arm64.go @@ -59,7 +59,7 @@ func doinit() { if !ok { return } - parseARM64SystemRegisters(isar0, isar1, 0) + parseARM64SystemRegisters(isar0, isar1, 0, 0) Initialized = true } diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index d1c8b264..42517077 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -226,6 +226,7 @@ struct ltchars { #include #include #include +#include #include #include #include @@ -529,6 +530,7 @@ ccflags="$@" $2 ~ /^O[CNPFPL][A-Z]+[^_][A-Z]+$/ || $2 ~ /^(NL|CR|TAB|BS|VT|FF)DLY$/ || $2 ~ /^(NL|CR|TAB|BS|VT|FF)[0-9]$/ || + $2 ~ /^(DT|EI|ELF|EV|NN|NT|PF|SHF|SHN|SHT|STB|STT|VER)_/ || $2 ~ /^O?XTABS$/ || $2 ~ /^TC[IO](ON|OFF)$/ || $2 ~ /^IN_/ || diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index 9439af96..06c0eea6 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -2643,3 +2643,9 @@ func SchedGetAttr(pid int, flags uint) (*SchedAttr, error) { //sys Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) (err error) //sys Mseal(b []byte, flags uint) (err error) + +//sys setMemPolicy(mode int, mask *CPUSet, size int) (err error) = SYS_SET_MEMPOLICY + +func SetMemPolicy(mode int, mask *CPUSet) error { + return setMemPolicy(mode, mask, _CPU_SETSIZE) +} diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux.go b/vendor/golang.org/x/sys/unix/zerrors_linux.go index b6db27d9..d0a75da5 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -853,20 +853,86 @@ const ( DM_VERSION_MAJOR = 0x4 DM_VERSION_MINOR = 0x32 DM_VERSION_PATCHLEVEL = 0x0 + DT_ADDRRNGHI = 0x6ffffeff + DT_ADDRRNGLO = 0x6ffffe00 DT_BLK = 0x6 DT_CHR = 0x2 + DT_DEBUG = 0x15 DT_DIR = 0x4 + DT_ENCODING = 0x20 DT_FIFO = 0x1 + DT_FINI = 0xd + DT_FLAGS_1 = 0x6ffffffb + DT_GNU_HASH = 0x6ffffef5 + DT_HASH = 0x4 + DT_HIOS = 0x6ffff000 + DT_HIPROC = 0x7fffffff + DT_INIT = 0xc + DT_JMPREL = 0x17 DT_LNK = 0xa + DT_LOOS = 0x6000000d + DT_LOPROC = 0x70000000 + DT_NEEDED = 0x1 + DT_NULL = 0x0 + DT_PLTGOT = 0x3 + DT_PLTREL = 0x14 + DT_PLTRELSZ = 0x2 DT_REG = 0x8 + DT_REL = 0x11 + DT_RELA = 0x7 + DT_RELACOUNT = 0x6ffffff9 + DT_RELAENT = 0x9 + DT_RELASZ = 0x8 + DT_RELCOUNT = 0x6ffffffa + DT_RELENT = 0x13 + DT_RELSZ = 0x12 + DT_RPATH = 0xf DT_SOCK = 0xc + DT_SONAME = 0xe + DT_STRSZ = 0xa + DT_STRTAB = 0x5 + DT_SYMBOLIC = 0x10 + DT_SYMENT = 0xb + DT_SYMTAB = 0x6 + DT_TEXTREL = 0x16 DT_UNKNOWN = 0x0 + DT_VALRNGHI = 0x6ffffdff + DT_VALRNGLO = 0x6ffffd00 + DT_VERDEF = 0x6ffffffc + DT_VERDEFNUM = 0x6ffffffd + DT_VERNEED = 0x6ffffffe + DT_VERNEEDNUM = 0x6fffffff + DT_VERSYM = 0x6ffffff0 DT_WHT = 0xe ECHO = 0x8 ECRYPTFS_SUPER_MAGIC = 0xf15f EFD_SEMAPHORE = 0x1 EFIVARFS_MAGIC = 0xde5e81e4 EFS_SUPER_MAGIC = 0x414a53 + EI_CLASS = 0x4 + EI_DATA = 0x5 + EI_MAG0 = 0x0 + EI_MAG1 = 0x1 + EI_MAG2 = 0x2 + EI_MAG3 = 0x3 + EI_NIDENT = 0x10 + EI_OSABI = 0x7 + EI_PAD = 0x8 + EI_VERSION = 0x6 + ELFCLASS32 = 0x1 + ELFCLASS64 = 0x2 + ELFCLASSNONE = 0x0 + ELFCLASSNUM = 0x3 + ELFDATA2LSB = 0x1 + ELFDATA2MSB = 0x2 + ELFDATANONE = 0x0 + ELFMAG = "\177ELF" + ELFMAG0 = 0x7f + ELFMAG1 = 'E' + ELFMAG2 = 'L' + ELFMAG3 = 'F' + ELFOSABI_LINUX = 0x3 + ELFOSABI_NONE = 0x0 EM_386 = 0x3 EM_486 = 0x6 EM_68K = 0x4 @@ -1152,14 +1218,24 @@ const ( ETH_P_WCCP = 0x883e ETH_P_X25 = 0x805 ETH_P_XDSA = 0xf8 + ET_CORE = 0x4 + ET_DYN = 0x3 + ET_EXEC = 0x2 + ET_HIPROC = 0xffff + ET_LOPROC = 0xff00 + ET_NONE = 0x0 + ET_REL = 0x1 EV_ABS = 0x3 EV_CNT = 0x20 + EV_CURRENT = 0x1 EV_FF = 0x15 EV_FF_STATUS = 0x17 EV_KEY = 0x1 EV_LED = 0x11 EV_MAX = 0x1f EV_MSC = 0x4 + EV_NONE = 0x0 + EV_NUM = 0x2 EV_PWR = 0x16 EV_REL = 0x2 EV_REP = 0x14 @@ -2276,7 +2352,167 @@ const ( NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 + NN_386_IOPERM = "LINUX" + NN_386_TLS = "LINUX" + NN_ARC_V2 = "LINUX" + NN_ARM_FPMR = "LINUX" + NN_ARM_GCS = "LINUX" + NN_ARM_HW_BREAK = "LINUX" + NN_ARM_HW_WATCH = "LINUX" + NN_ARM_PACA_KEYS = "LINUX" + NN_ARM_PACG_KEYS = "LINUX" + NN_ARM_PAC_ENABLED_KEYS = "LINUX" + NN_ARM_PAC_MASK = "LINUX" + NN_ARM_POE = "LINUX" + NN_ARM_SSVE = "LINUX" + NN_ARM_SVE = "LINUX" + NN_ARM_SYSTEM_CALL = "LINUX" + NN_ARM_TAGGED_ADDR_CTRL = "LINUX" + NN_ARM_TLS = "LINUX" + NN_ARM_VFP = "LINUX" + NN_ARM_ZA = "LINUX" + NN_ARM_ZT = "LINUX" + NN_AUXV = "CORE" + NN_FILE = "CORE" + NN_GNU_PROPERTY_TYPE_0 = "GNU" + NN_LOONGARCH_CPUCFG = "LINUX" + NN_LOONGARCH_CSR = "LINUX" + NN_LOONGARCH_HW_BREAK = "LINUX" + NN_LOONGARCH_HW_WATCH = "LINUX" + NN_LOONGARCH_LASX = "LINUX" + NN_LOONGARCH_LBT = "LINUX" + NN_LOONGARCH_LSX = "LINUX" + NN_MIPS_DSP = "LINUX" + NN_MIPS_FP_MODE = "LINUX" + NN_MIPS_MSA = "LINUX" + NN_PPC_DEXCR = "LINUX" + NN_PPC_DSCR = "LINUX" + NN_PPC_EBB = "LINUX" + NN_PPC_HASHKEYR = "LINUX" + NN_PPC_PKEY = "LINUX" + NN_PPC_PMU = "LINUX" + NN_PPC_PPR = "LINUX" + NN_PPC_SPE = "LINUX" + NN_PPC_TAR = "LINUX" + NN_PPC_TM_CDSCR = "LINUX" + NN_PPC_TM_CFPR = "LINUX" + NN_PPC_TM_CGPR = "LINUX" + NN_PPC_TM_CPPR = "LINUX" + NN_PPC_TM_CTAR = "LINUX" + NN_PPC_TM_CVMX = "LINUX" + NN_PPC_TM_CVSX = "LINUX" + NN_PPC_TM_SPR = "LINUX" + NN_PPC_VMX = "LINUX" + NN_PPC_VSX = "LINUX" + NN_PRFPREG = "CORE" + NN_PRPSINFO = "CORE" + NN_PRSTATUS = "CORE" + NN_PRXFPREG = "LINUX" + NN_RISCV_CSR = "LINUX" + NN_RISCV_TAGGED_ADDR_CTRL = "LINUX" + NN_RISCV_VECTOR = "LINUX" + NN_S390_CTRS = "LINUX" + NN_S390_GS_BC = "LINUX" + NN_S390_GS_CB = "LINUX" + NN_S390_HIGH_GPRS = "LINUX" + NN_S390_LAST_BREAK = "LINUX" + NN_S390_PREFIX = "LINUX" + NN_S390_PV_CPU_DATA = "LINUX" + NN_S390_RI_CB = "LINUX" + NN_S390_SYSTEM_CALL = "LINUX" + NN_S390_TDB = "LINUX" + NN_S390_TIMER = "LINUX" + NN_S390_TODCMP = "LINUX" + NN_S390_TODPREG = "LINUX" + NN_S390_VXRS_HIGH = "LINUX" + NN_S390_VXRS_LOW = "LINUX" + NN_SIGINFO = "CORE" + NN_TASKSTRUCT = "CORE" + NN_VMCOREDD = "LINUX" + NN_X86_SHSTK = "LINUX" + NN_X86_XSAVE_LAYOUT = "LINUX" + NN_X86_XSTATE = "LINUX" NSFS_MAGIC = 0x6e736673 + NT_386_IOPERM = 0x201 + NT_386_TLS = 0x200 + NT_ARC_V2 = 0x600 + NT_ARM_FPMR = 0x40e + NT_ARM_GCS = 0x410 + NT_ARM_HW_BREAK = 0x402 + NT_ARM_HW_WATCH = 0x403 + NT_ARM_PACA_KEYS = 0x407 + NT_ARM_PACG_KEYS = 0x408 + NT_ARM_PAC_ENABLED_KEYS = 0x40a + NT_ARM_PAC_MASK = 0x406 + NT_ARM_POE = 0x40f + NT_ARM_SSVE = 0x40b + NT_ARM_SVE = 0x405 + NT_ARM_SYSTEM_CALL = 0x404 + NT_ARM_TAGGED_ADDR_CTRL = 0x409 + NT_ARM_TLS = 0x401 + NT_ARM_VFP = 0x400 + NT_ARM_ZA = 0x40c + NT_ARM_ZT = 0x40d + NT_AUXV = 0x6 + NT_FILE = 0x46494c45 + NT_GNU_PROPERTY_TYPE_0 = 0x5 + NT_LOONGARCH_CPUCFG = 0xa00 + NT_LOONGARCH_CSR = 0xa01 + NT_LOONGARCH_HW_BREAK = 0xa05 + NT_LOONGARCH_HW_WATCH = 0xa06 + NT_LOONGARCH_LASX = 0xa03 + NT_LOONGARCH_LBT = 0xa04 + NT_LOONGARCH_LSX = 0xa02 + NT_MIPS_DSP = 0x800 + NT_MIPS_FP_MODE = 0x801 + NT_MIPS_MSA = 0x802 + NT_PPC_DEXCR = 0x111 + NT_PPC_DSCR = 0x105 + NT_PPC_EBB = 0x106 + NT_PPC_HASHKEYR = 0x112 + NT_PPC_PKEY = 0x110 + NT_PPC_PMU = 0x107 + NT_PPC_PPR = 0x104 + NT_PPC_SPE = 0x101 + NT_PPC_TAR = 0x103 + NT_PPC_TM_CDSCR = 0x10f + NT_PPC_TM_CFPR = 0x109 + NT_PPC_TM_CGPR = 0x108 + NT_PPC_TM_CPPR = 0x10e + NT_PPC_TM_CTAR = 0x10d + NT_PPC_TM_CVMX = 0x10a + NT_PPC_TM_CVSX = 0x10b + NT_PPC_TM_SPR = 0x10c + NT_PPC_VMX = 0x100 + NT_PPC_VSX = 0x102 + NT_PRFPREG = 0x2 + NT_PRPSINFO = 0x3 + NT_PRSTATUS = 0x1 + NT_PRXFPREG = 0x46e62b7f + NT_RISCV_CSR = 0x900 + NT_RISCV_TAGGED_ADDR_CTRL = 0x902 + NT_RISCV_VECTOR = 0x901 + NT_S390_CTRS = 0x304 + NT_S390_GS_BC = 0x30c + NT_S390_GS_CB = 0x30b + NT_S390_HIGH_GPRS = 0x300 + NT_S390_LAST_BREAK = 0x306 + NT_S390_PREFIX = 0x305 + NT_S390_PV_CPU_DATA = 0x30e + NT_S390_RI_CB = 0x30d + NT_S390_SYSTEM_CALL = 0x307 + NT_S390_TDB = 0x308 + NT_S390_TIMER = 0x301 + NT_S390_TODCMP = 0x302 + NT_S390_TODPREG = 0x303 + NT_S390_VXRS_HIGH = 0x30a + NT_S390_VXRS_LOW = 0x309 + NT_SIGINFO = 0x53494749 + NT_TASKSTRUCT = 0x4 + NT_VMCOREDD = 0x700 + NT_X86_SHSTK = 0x204 + NT_X86_XSAVE_LAYOUT = 0x205 + NT_X86_XSTATE = 0x202 OCFS2_SUPER_MAGIC = 0x7461636f OCRNL = 0x8 OFDEL = 0x80 @@ -2463,6 +2699,59 @@ const ( PERF_RECORD_MISC_USER = 0x2 PERF_SAMPLE_BRANCH_PLM_ALL = 0x7 PERF_SAMPLE_WEIGHT_TYPE = 0x1004000 + PF_ALG = 0x26 + PF_APPLETALK = 0x5 + PF_ASH = 0x12 + PF_ATMPVC = 0x8 + PF_ATMSVC = 0x14 + PF_AX25 = 0x3 + PF_BLUETOOTH = 0x1f + PF_BRIDGE = 0x7 + PF_CAIF = 0x25 + PF_CAN = 0x1d + PF_DECnet = 0xc + PF_ECONET = 0x13 + PF_FILE = 0x1 + PF_IB = 0x1b + PF_IEEE802154 = 0x24 + PF_INET = 0x2 + PF_INET6 = 0xa + PF_IPX = 0x4 + PF_IRDA = 0x17 + PF_ISDN = 0x22 + PF_IUCV = 0x20 + PF_KCM = 0x29 + PF_KEY = 0xf + PF_LLC = 0x1a + PF_LOCAL = 0x1 + PF_MAX = 0x2e + PF_MCTP = 0x2d + PF_MPLS = 0x1c + PF_NETBEUI = 0xd + PF_NETLINK = 0x10 + PF_NETROM = 0x6 + PF_NFC = 0x27 + PF_PACKET = 0x11 + PF_PHONET = 0x23 + PF_PPPOX = 0x18 + PF_QIPCRTR = 0x2a + PF_R = 0x4 + PF_RDS = 0x15 + PF_ROSE = 0xb + PF_ROUTE = 0x10 + PF_RXRPC = 0x21 + PF_SECURITY = 0xe + PF_SMC = 0x2b + PF_SNA = 0x16 + PF_TIPC = 0x1e + PF_UNIX = 0x1 + PF_UNSPEC = 0x0 + PF_VSOCK = 0x28 + PF_W = 0x2 + PF_WANPIPE = 0x19 + PF_X = 0x1 + PF_X25 = 0x9 + PF_XDP = 0x2c PID_FS_MAGIC = 0x50494446 PIPEFS_MAGIC = 0x50495045 PPPIOCGNPMODE = 0xc008744c @@ -2758,6 +3047,23 @@ const ( PTRACE_SYSCALL_INFO_NONE = 0x0 PTRACE_SYSCALL_INFO_SECCOMP = 0x3 PTRACE_TRACEME = 0x0 + PT_AARCH64_MEMTAG_MTE = 0x70000002 + PT_DYNAMIC = 0x2 + PT_GNU_EH_FRAME = 0x6474e550 + PT_GNU_PROPERTY = 0x6474e553 + PT_GNU_RELRO = 0x6474e552 + PT_GNU_STACK = 0x6474e551 + PT_HIOS = 0x6fffffff + PT_HIPROC = 0x7fffffff + PT_INTERP = 0x3 + PT_LOAD = 0x1 + PT_LOOS = 0x60000000 + PT_LOPROC = 0x70000000 + PT_NOTE = 0x4 + PT_NULL = 0x0 + PT_PHDR = 0x6 + PT_SHLIB = 0x5 + PT_TLS = 0x7 P_ALL = 0x0 P_PGID = 0x2 P_PID = 0x1 @@ -3091,6 +3397,47 @@ const ( SEEK_MAX = 0x4 SEEK_SET = 0x0 SELINUX_MAGIC = 0xf97cff8c + SHF_ALLOC = 0x2 + SHF_EXCLUDE = 0x8000000 + SHF_EXECINSTR = 0x4 + SHF_GROUP = 0x200 + SHF_INFO_LINK = 0x40 + SHF_LINK_ORDER = 0x80 + SHF_MASKOS = 0xff00000 + SHF_MASKPROC = 0xf0000000 + SHF_MERGE = 0x10 + SHF_ORDERED = 0x4000000 + SHF_OS_NONCONFORMING = 0x100 + SHF_RELA_LIVEPATCH = 0x100000 + SHF_RO_AFTER_INIT = 0x200000 + SHF_STRINGS = 0x20 + SHF_TLS = 0x400 + SHF_WRITE = 0x1 + SHN_ABS = 0xfff1 + SHN_COMMON = 0xfff2 + SHN_HIPROC = 0xff1f + SHN_HIRESERVE = 0xffff + SHN_LIVEPATCH = 0xff20 + SHN_LOPROC = 0xff00 + SHN_LORESERVE = 0xff00 + SHN_UNDEF = 0x0 + SHT_DYNAMIC = 0x6 + SHT_DYNSYM = 0xb + SHT_HASH = 0x5 + SHT_HIPROC = 0x7fffffff + SHT_HIUSER = 0xffffffff + SHT_LOPROC = 0x70000000 + SHT_LOUSER = 0x80000000 + SHT_NOBITS = 0x8 + SHT_NOTE = 0x7 + SHT_NULL = 0x0 + SHT_NUM = 0xc + SHT_PROGBITS = 0x1 + SHT_REL = 0x9 + SHT_RELA = 0x4 + SHT_SHLIB = 0xa + SHT_STRTAB = 0x3 + SHT_SYMTAB = 0x2 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -3317,6 +3664,16 @@ const ( STATX_UID = 0x8 STATX_WRITE_ATOMIC = 0x10000 STATX__RESERVED = 0x80000000 + STB_GLOBAL = 0x1 + STB_LOCAL = 0x0 + STB_WEAK = 0x2 + STT_COMMON = 0x5 + STT_FILE = 0x4 + STT_FUNC = 0x2 + STT_NOTYPE = 0x0 + STT_OBJECT = 0x1 + STT_SECTION = 0x3 + STT_TLS = 0x6 SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 @@ -3553,6 +3910,8 @@ const ( UTIME_OMIT = 0x3ffffffe V9FS_MAGIC = 0x1021997 VERASE = 0x2 + VER_FLG_BASE = 0x1 + VER_FLG_WEAK = 0x2 VINTR = 0x0 VKILL = 0x3 VLNEXT = 0xf diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/vendor/golang.org/x/sys/unix/zsyscall_linux.go index 5cc1e8eb..8935d10a 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux.go @@ -2238,3 +2238,13 @@ func Mseal(b []byte, flags uint) (err error) { } return } + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setMemPolicy(mode int, mask *CPUSet, size int) (err error) { + _, _, e1 := Syscall(SYS_SET_MEMPOLICY, uintptr(mode), uintptr(unsafe.Pointer(mask)), uintptr(size)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go index 944e75a1..c1a46701 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -3590,6 +3590,8 @@ type Nhmsg struct { Flags uint32 } +const SizeofNhmsg = 0x8 + type NexthopGrp struct { Id uint32 Weight uint8 @@ -3597,6 +3599,8 @@ type NexthopGrp struct { Resvd2 uint16 } +const SizeofNexthopGrp = 0x8 + const ( NHA_UNSPEC = 0x0 NHA_ID = 0x1 @@ -6332,3 +6336,30 @@ type SockDiagReq struct { } const RTM_NEWNVLAN = 0x70 + +const ( + MPOL_BIND = 0x2 + MPOL_DEFAULT = 0x0 + MPOL_F_ADDR = 0x2 + MPOL_F_MEMS_ALLOWED = 0x4 + MPOL_F_MOF = 0x8 + MPOL_F_MORON = 0x10 + MPOL_F_NODE = 0x1 + MPOL_F_NUMA_BALANCING = 0x2000 + MPOL_F_RELATIVE_NODES = 0x4000 + MPOL_F_SHARED = 0x1 + MPOL_F_STATIC_NODES = 0x8000 + MPOL_INTERLEAVE = 0x3 + MPOL_LOCAL = 0x4 + MPOL_MAX = 0x7 + MPOL_MF_INTERNAL = 0x10 + MPOL_MF_LAZY = 0x8 + MPOL_MF_MOVE_ALL = 0x4 + MPOL_MF_MOVE = 0x2 + MPOL_MF_STRICT = 0x1 + MPOL_MF_VALID = 0x7 + MPOL_MODE_FLAGS = 0xe000 + MPOL_PREFERRED = 0x1 + MPOL_PREFERRED_MANY = 0x5 + MPOL_WEIGHTED_INTERLEAVE = 0x6 +) diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go index bd513373..69439df2 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -892,8 +892,12 @@ const socket_error = uintptr(^uint32(0)) //sys MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) = kernel32.MultiByteToWideChar //sys getBestInterfaceEx(sockaddr unsafe.Pointer, pdwBestIfIndex *uint32) (errcode error) = iphlpapi.GetBestInterfaceEx //sys GetIfEntry2Ex(level uint32, row *MibIfRow2) (errcode error) = iphlpapi.GetIfEntry2Ex +//sys GetIpForwardEntry2(row *MibIpForwardRow2) (errcode error) = iphlpapi.GetIpForwardEntry2 +//sys GetIpForwardTable2(family uint16, table **MibIpForwardTable2) (errcode error) = iphlpapi.GetIpForwardTable2 //sys GetUnicastIpAddressEntry(row *MibUnicastIpAddressRow) (errcode error) = iphlpapi.GetUnicastIpAddressEntry +//sys FreeMibTable(memory unsafe.Pointer) = iphlpapi.FreeMibTable //sys NotifyIpInterfaceChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyIpInterfaceChange +//sys NotifyRouteChange2(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyRouteChange2 //sys NotifyUnicastIpAddressChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyUnicastIpAddressChange //sys CancelMibChangeNotify2(notificationHandle Handle) (errcode error) = iphlpapi.CancelMibChangeNotify2 @@ -916,6 +920,17 @@ type RawSockaddrInet6 struct { Scope_id uint32 } +// RawSockaddrInet is a union that contains an IPv4, an IPv6 address, or an address family. See +// https://learn.microsoft.com/en-us/windows/win32/api/ws2ipdef/ns-ws2ipdef-sockaddr_inet. +// +// A [*RawSockaddrInet] may be converted to a [*RawSockaddrInet4] or [*RawSockaddrInet6] using +// unsafe, depending on the address family. +type RawSockaddrInet struct { + Family uint16 + Port uint16 + Data [6]uint32 +} + type RawSockaddr struct { Family uint16 Data [14]int8 diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go index 358be3c7..6e4f50eb 100644 --- a/vendor/golang.org/x/sys/windows/types_windows.go +++ b/vendor/golang.org/x/sys/windows/types_windows.go @@ -2320,6 +2320,82 @@ type MibIfRow2 struct { OutQLen uint64 } +// IP_ADDRESS_PREFIX stores an IP address prefix. See +// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-ip_address_prefix. +type IpAddressPrefix struct { + Prefix RawSockaddrInet + PrefixLength uint8 +} + +// NL_ROUTE_ORIGIN enumeration from nldef.h or +// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_route_origin. +const ( + NlroManual = 0 + NlroWellKnown = 1 + NlroDHCP = 2 + NlroRouterAdvertisement = 3 + Nlro6to4 = 4 +) + +// NL_ROUTE_ORIGIN enumeration from nldef.h or +// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_route_protocol. +const ( + MIB_IPPROTO_OTHER = 1 + MIB_IPPROTO_LOCAL = 2 + MIB_IPPROTO_NETMGMT = 3 + MIB_IPPROTO_ICMP = 4 + MIB_IPPROTO_EGP = 5 + MIB_IPPROTO_GGP = 6 + MIB_IPPROTO_HELLO = 7 + MIB_IPPROTO_RIP = 8 + MIB_IPPROTO_IS_IS = 9 + MIB_IPPROTO_ES_IS = 10 + MIB_IPPROTO_CISCO = 11 + MIB_IPPROTO_BBN = 12 + MIB_IPPROTO_OSPF = 13 + MIB_IPPROTO_BGP = 14 + MIB_IPPROTO_IDPR = 15 + MIB_IPPROTO_EIGRP = 16 + MIB_IPPROTO_DVMRP = 17 + MIB_IPPROTO_RPL = 18 + MIB_IPPROTO_DHCP = 19 + MIB_IPPROTO_NT_AUTOSTATIC = 10002 + MIB_IPPROTO_NT_STATIC = 10006 + MIB_IPPROTO_NT_STATIC_NON_DOD = 10007 +) + +// MIB_IPFORWARD_ROW2 stores information about an IP route entry. See +// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_ipforward_row2. +type MibIpForwardRow2 struct { + InterfaceLuid uint64 + InterfaceIndex uint32 + DestinationPrefix IpAddressPrefix + NextHop RawSockaddrInet + SitePrefixLength uint8 + ValidLifetime uint32 + PreferredLifetime uint32 + Metric uint32 + Protocol uint32 + Loopback uint8 + AutoconfigureAddress uint8 + Publish uint8 + Immortal uint8 + Age uint32 + Origin uint32 +} + +// MIB_IPFORWARD_TABLE2 contains a table of IP route entries. See +// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_ipforward_table2. +type MibIpForwardTable2 struct { + NumEntries uint32 + Table [1]MibIpForwardRow2 +} + +// Rows returns the IP route entries in the table. +func (t *MibIpForwardTable2) Rows() []MibIpForwardRow2 { + return unsafe.Slice(&t.Table[0], t.NumEntries) +} + // MIB_UNICASTIPADDRESS_ROW stores information about a unicast IP address. See // https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_unicastipaddress_row. type MibUnicastIpAddressRow struct { diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go index 426151a0..f25b7308 100644 --- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -182,13 +182,17 @@ var ( procDwmGetWindowAttribute = moddwmapi.NewProc("DwmGetWindowAttribute") procDwmSetWindowAttribute = moddwmapi.NewProc("DwmSetWindowAttribute") procCancelMibChangeNotify2 = modiphlpapi.NewProc("CancelMibChangeNotify2") + procFreeMibTable = modiphlpapi.NewProc("FreeMibTable") procGetAdaptersAddresses = modiphlpapi.NewProc("GetAdaptersAddresses") procGetAdaptersInfo = modiphlpapi.NewProc("GetAdaptersInfo") procGetBestInterfaceEx = modiphlpapi.NewProc("GetBestInterfaceEx") procGetIfEntry = modiphlpapi.NewProc("GetIfEntry") procGetIfEntry2Ex = modiphlpapi.NewProc("GetIfEntry2Ex") + procGetIpForwardEntry2 = modiphlpapi.NewProc("GetIpForwardEntry2") + procGetIpForwardTable2 = modiphlpapi.NewProc("GetIpForwardTable2") procGetUnicastIpAddressEntry = modiphlpapi.NewProc("GetUnicastIpAddressEntry") procNotifyIpInterfaceChange = modiphlpapi.NewProc("NotifyIpInterfaceChange") + procNotifyRouteChange2 = modiphlpapi.NewProc("NotifyRouteChange2") procNotifyUnicastIpAddressChange = modiphlpapi.NewProc("NotifyUnicastIpAddressChange") procAddDllDirectory = modkernel32.NewProc("AddDllDirectory") procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject") @@ -1624,6 +1628,11 @@ func CancelMibChangeNotify2(notificationHandle Handle) (errcode error) { return } +func FreeMibTable(memory unsafe.Pointer) { + syscall.SyscallN(procFreeMibTable.Addr(), uintptr(memory)) + return +} + func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) { r0, _, _ := syscall.SyscallN(procGetAdaptersAddresses.Addr(), uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer))) if r0 != 0 { @@ -1664,6 +1673,22 @@ func GetIfEntry2Ex(level uint32, row *MibIfRow2) (errcode error) { return } +func GetIpForwardEntry2(row *MibIpForwardRow2) (errcode error) { + r0, _, _ := syscall.SyscallN(procGetIpForwardEntry2.Addr(), uintptr(unsafe.Pointer(row))) + if r0 != 0 { + errcode = syscall.Errno(r0) + } + return +} + +func GetIpForwardTable2(family uint16, table **MibIpForwardTable2) (errcode error) { + r0, _, _ := syscall.SyscallN(procGetIpForwardTable2.Addr(), uintptr(family), uintptr(unsafe.Pointer(table))) + if r0 != 0 { + errcode = syscall.Errno(r0) + } + return +} + func GetUnicastIpAddressEntry(row *MibUnicastIpAddressRow) (errcode error) { r0, _, _ := syscall.SyscallN(procGetUnicastIpAddressEntry.Addr(), uintptr(unsafe.Pointer(row))) if r0 != 0 { @@ -1684,6 +1709,18 @@ func NotifyIpInterfaceChange(family uint16, callback uintptr, callerContext unsa return } +func NotifyRouteChange2(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) { + var _p0 uint32 + if initialNotification { + _p0 = 1 + } + r0, _, _ := syscall.SyscallN(procNotifyRouteChange2.Addr(), uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle))) + if r0 != 0 { + errcode = syscall.Errno(r0) + } + return +} + func NotifyUnicastIpAddressChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) { var _p0 uint32 if initialNotification { diff --git a/vendor/modules.txt b/vendor/modules.txt index 83694e61..82bf0c4c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -159,7 +159,7 @@ github.com/benbjohnson/clock # github.com/cenkalti/backoff/v4 v4.3.0 ## explicit; go 1.18 github.com/cenkalti/backoff/v4 -# github.com/conductorone/baton-sdk v0.5.25 +# github.com/conductorone/baton-sdk v0.7.10 ## explicit; go 1.25.2 github.com/conductorone/baton-sdk/internal/connector github.com/conductorone/baton-sdk/pb/c1/c1z/v1 @@ -171,6 +171,7 @@ github.com/conductorone/baton-sdk/pb/c1/ratelimit/v1 github.com/conductorone/baton-sdk/pb/c1/reader/v2 github.com/conductorone/baton-sdk/pb/c1/transport/v1 github.com/conductorone/baton-sdk/pb/c1/utls/v1 +github.com/conductorone/baton-sdk/pkg/actions github.com/conductorone/baton-sdk/pkg/annotations github.com/conductorone/baton-sdk/pkg/auth github.com/conductorone/baton-sdk/pkg/bid @@ -187,6 +188,7 @@ github.com/conductorone/baton-sdk/pkg/dotc1z/manager github.com/conductorone/baton-sdk/pkg/dotc1z/manager/local github.com/conductorone/baton-sdk/pkg/dotc1z/manager/s3 github.com/conductorone/baton-sdk/pkg/field +github.com/conductorone/baton-sdk/pkg/healthcheck github.com/conductorone/baton-sdk/pkg/lambda/grpc github.com/conductorone/baton-sdk/pkg/lambda/grpc/config github.com/conductorone/baton-sdk/pkg/lambda/grpc/middleware @@ -203,11 +205,9 @@ github.com/conductorone/baton-sdk/pkg/sync/expand github.com/conductorone/baton-sdk/pkg/sync/expand/scc github.com/conductorone/baton-sdk/pkg/synccompactor github.com/conductorone/baton-sdk/pkg/synccompactor/attached -github.com/conductorone/baton-sdk/pkg/synccompactor/naive github.com/conductorone/baton-sdk/pkg/tasks github.com/conductorone/baton-sdk/pkg/tasks/c1api github.com/conductorone/baton-sdk/pkg/tasks/local -github.com/conductorone/baton-sdk/pkg/test github.com/conductorone/baton-sdk/pkg/types github.com/conductorone/baton-sdk/pkg/types/entitlement github.com/conductorone/baton-sdk/pkg/types/grant @@ -230,9 +230,6 @@ github.com/conductorone/dpop/integrations/dpop_grpc # github.com/conductorone/dpop/integrations/dpop_oauth2 v0.2.3 ## explicit; go 1.23.4 github.com/conductorone/dpop/integrations/dpop_oauth2 -# github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc -## explicit -github.com/davecgh/go-spew/spew # github.com/deckarep/golang-set/v2 v2.7.0 ## explicit; go 1.18 github.com/deckarep/golang-set/v2 @@ -250,7 +247,7 @@ github.com/doug-martin/goqu/v9/sqlgen # github.com/dustin/go-humanize v1.0.1 ## explicit; go 1.16 github.com/dustin/go-humanize -# github.com/ebitengine/purego v0.8.4 +# github.com/ebitengine/purego v0.9.1 ## explicit; go 1.18 github.com/ebitengine/purego github.com/ebitengine/purego/internal/cgo @@ -369,9 +366,6 @@ github.com/pelletier/go-toml/v2/internal/characters github.com/pelletier/go-toml/v2/internal/danger github.com/pelletier/go-toml/v2/internal/tracker github.com/pelletier/go-toml/v2/unstable -# github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 -## explicit -github.com/pmezard/go-difflib/difflib # github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 ## explicit; go 1.14 github.com/power-devops/perfstat @@ -397,8 +391,8 @@ github.com/sagikazarmark/slog-shim # github.com/segmentio/ksuid v1.0.4 ## explicit; go 1.12 github.com/segmentio/ksuid -# github.com/shirou/gopsutil/v4 v4.25.8 -## explicit; go 1.23.0 +# github.com/shirou/gopsutil/v4 v4.25.11 +## explicit; go 1.24.0 github.com/shirou/gopsutil/v4/common github.com/shirou/gopsutil/v4/cpu github.com/shirou/gopsutil/v4/host @@ -438,19 +432,16 @@ github.com/spf13/viper/internal/encoding/json github.com/spf13/viper/internal/encoding/toml github.com/spf13/viper/internal/encoding/yaml github.com/spf13/viper/internal/features -# github.com/stretchr/testify v1.11.1 -## explicit; go 1.17 -github.com/stretchr/testify/assert -github.com/stretchr/testify/assert/yaml -github.com/stretchr/testify/require +# github.com/stretchr/objx v0.5.2 +## explicit; go 1.20 # github.com/subosito/gotenv v1.6.0 ## explicit; go 1.18 github.com/subosito/gotenv -# github.com/tklauser/go-sysconf v0.3.15 -## explicit; go 1.23.0 +# github.com/tklauser/go-sysconf v0.3.16 +## explicit; go 1.24.0 github.com/tklauser/go-sysconf -# github.com/tklauser/numcpus v0.10.0 -## explicit; go 1.23.0 +# github.com/tklauser/numcpus v0.11.0 +## explicit; go 1.24.0 github.com/tklauser/numcpus # github.com/yusufpapurcu/wmi v1.2.4 ## explicit; go 1.16 @@ -570,6 +561,8 @@ golang.org/x/exp/slices golang.org/x/exp/slog golang.org/x/exp/slog/internal golang.org/x/exp/slog/internal/buffer +# golang.org/x/mod v0.23.0 +## explicit; go 1.22.0 # golang.org/x/net v0.35.0 ## explicit; go 1.18 golang.org/x/net/context/ctxhttp @@ -591,7 +584,7 @@ golang.org/x/oauth2/jwt ## explicit; go 1.18 golang.org/x/sync/semaphore golang.org/x/sync/singleflight -# golang.org/x/sys v0.37.0 +# golang.org/x/sys v0.38.0 ## explicit; go 1.24.0 golang.org/x/sys/cpu golang.org/x/sys/plan9 @@ -623,6 +616,8 @@ golang.org/x/text/secure/bidirule golang.org/x/text/transform golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm +# golang.org/x/tools v0.30.0 +## explicit; go 1.22.0 # google.golang.org/genproto/googleapis/api v0.0.0-20250218202821-56aae31c358a ## explicit; go 1.22 google.golang.org/genproto/googleapis/api/httpbody